AZERTY Keyboards: A Rant

[Note: I have deliberately not checked any of the spellings on this post so that you can feel some of my pain.]

Even though I have been in Belgium for the best part of thirteen years and, even though the Belgians qre as fond of their biwarre keyboard layouts as the French, I have managed to avoid using an AZERTY keyboard for any significant period of time. Until noz.

Not all of the keys are in the wrong place, but there are enough of them to keep catching me out. I am not a touch-typist by any stretch of the imagination, but I knoz which keys should be where qnd am (usually) able to type reasonably quickly and reasonably accurately. Now I need to take a great deql more care with the spell checker.

This is all mildly annoying (for me) and mildly amusing (for everyone else) but when I started trying to use Vim with an AZERTY keyboard, things really became painful.

Take the movement keys (H, J, K and L), for exqmple. These are qll correctly positioned relative to each other, but some bright spark thought it would be a good idea to put the M key to the right of the L. Since I instinctively reqch for the rightmost letters on the middle row to navigate around a file, I keep using the J, K, L and M keys to go in randoml directions, or none.

(And who thought it would be a good idea to make you press shift to get at the number keys?)

But the fun really begins when I want to switch from one window to another. This is something I do quite often.

The key sequence to move one zindoz to the right used to be:
CTRL-W L

Noz it’s more like this:

  • CTRL-Z
  • exit the new shell I’ve accidentally started
  • CTRL-W M
  • curse
  • ESCESC
  • CTRL-Z
  • swear
  • exit the new shell I’ve accidentally started
  • CTRL-Z
  • Leave the office in order to fill the corridor with obscenities.

It takes about eight hours to get used to typing in AZERTY (as far as is possible — what bright spark thought it would be a good idea to press shift to get at the forward slash?), at which point I climb into my car, drive home and boot up my QWERTY keyboarded laptop.

If there is anyone out there successfully using Vim on an AZERTY keyboard, how on earth do you manage?

:zq

Footnote

While searching for the image at the top of this post, I stumbled across this article from 2016. It appears that the AZERTY keyboard is so ergonomically disastrous, that even the French want to get rid of it.

Editing RPGLE source members with Vim

I am very fond of the Vim text editor and will use it, out of preference, whenever possible. This includes writing RPG (and, obviously, RPGLE) programs on the IBM i. The only downside here is that, while Vim supports syntax highlighting for a multitude of languages, RPG isn’t one of them.

For a long time, I have relied on the syntax files written by Martin Rowe back in 2014. These, however, are getting more than a little long in the tooth. So, since I have a little time on my hands, I have started putting together a new set of syntax files which, hopefully, will be able to keep up with any new developments.

It’s all very early days so far, but you can find the Vim RPG Syntax highlighter here.

Feel free to download it and use it. And if you have any improvements to make or suggest, I would love to hear from you.

Shotwell ate my photos

I’m not sure what happened, but when I launched the Shotwell photo management application a couple of days ago, it started deleting my entire library of photos and by the time I realised what was happening, they were gone. Fortunately I have a backup, but that only goes as far as the middle of 2016, for he rest PhotoRec proved to be a life-saver (note to self — next time make sure to uncheck all the file types you don’t want to recover).

What did strike me when recovering my JPGs was the number of files that have been sitting on my hard drive that I had never actively downloaded. Clearly these are all images on various websites that I have visited. While I understand that a browser needs to download the contents of a page in order to display it, I was slightly taken aback at just how much of my browsing history was captured in these deleted files.

For now, though, most of my photos are restored and I am continuing with the slow and painful process of going through the recovered photos, removing duplicates and copying them back into my photos folder.

Once this is done, I shall be uninstalling Shotwell and looking for a safer photo management solution. To be fair, it is possible that I did something foolish when launching Shotwell — although what, I have no idea — but even if that is the case, I am not going to trust an application that starts deleting stuff without warning.

And I really should start thinking about a better backup strategy.

Merging multiple PDF files with pdfunite

One thing that using Linux has taught me is to always look for the simplest solution, because it probably exists. As it turned out in this case.

In this case, I was emailed a five page PDF document that I had to print, sign, scan and send back. Printing and signing, of course, was easy enough and I can scan the five pages to get five, separate PDF files. Merging these files back into a single document is where pdfunite comes in, and it really is as simple as:

pdfunite page1.pdf page2.pdf page3.pdf page4.pdf page5.pdf outfile.pdf

You can specify as many source files as you like and the last file is the destination file.

And if I’d known about pdfseperate, I could have probably avoided printing the entire document in the first place.

Smarter Coffee and Systemd User Units

One of the particularly handy features that systemd supports is the ability to set up unit files on a per-user basis. You simply put the unit files in your home directory and tell systemd to start using them.

I have a couple of these and, because I can never remember the details, I’m putting them here to save me trawling through the interwebs next time I change something.

The user level unit files all go in ~/.config/systemd/user

If this folder doesn’t already exists, you will need to create it.

You can then manage the unit by adding a --user switch to the normal systemctl commands.

Clear as mud, I know, so here’s an example.

Back in October I was given a Smarter Coffee coffee machine — this is a filter coffee machine that can connect to your home network in order to send alerts to your phone. On receiving this, my first thought was to wonder if I could direct these alerts to my laptop.

Some searching revealed that not only is this possible but someone else has already done it. So I forked nanab’s repository and started playing around with the code, managing to direct the notifications to the Gnome notifications area. All of this is available on GitHub, but the systemd bit is described below.

First, I should mention that I have a small binary file (smartercoffee) in /usr/local/bin that points to the actual code. This looks like this:

#! /bin/bash
python2 /path/to/smartercoffee/pollingStatusMessage.py --notify GNOME

So the service file (smartercoffee.service), which needs to be dropped in ~/.config/systemd/user, looks like this:

[Unit]
Description=Monitor the coffee machine

[Service]
Type=simple
ExecStart=/usr/local/bin/smartercoffee
StandardOutput=journal
Restart=on-abort

[Install]
WantedBy=basic.target

You can enable the service with:
systemctl --user enable smartercoffee

And start it with:
systemctl --user start smartercoffee

So now, whenever I boot up my laptop, the first thing it does is tells me the status of the coffee machine.

Freedom to tinker

Talking about the way in which his embrace of Free Software has changed his attitude to computers, Bruce Byfield reaches a conclusion that rings very true for me.

All unknowing, I had wandered into the world of do-it-yourself. Originating in small groups of hobbyists who had few resources except themselves, free software naturally required more independence of its users. Far from discouraging users from tinkering, free software actually encouraged it with text configuration files and scripting so simple that it could be learned without taking classes. Because there were so many choices, it encouraged me to explore so I could make informed decisions. Just as importantly, because free software was a minority preference, the necessary compatibility with proprietary operating system sometimes required considerable ingenuity.

As a result of these expectations, I gradually lost my learned helplessness. I can’t say exactly when I shed the last of my conditioning, but after a couple of years, I realized that a major shift in my thinking had occurred. I still didn’t — and still don’t know everything about free software, but I no longer panic when a problem strikes.

Although I was using a number of open source applications before, I didn’t really start to delve into GNU/Linux until early 2007 when I installed Ubuntu on my PC alongside Windows XP. And, over the past ten years I have gone from being excessively cautious to (probably) a bit too casual.

There was never a sudden shift but, the more I have poked around the more I have found — all documented and backed by a helpful community. I have moved from really not wanting to do anything that might cause any sort of problem at all to being willing to break my install, safe in the knowledge that if the worst comes to the worst, I can just reinstall the operating system without even risking my data.

I am far from being able to claim any expertise but the openness and availability of information surrounding Free Software means that for any problem I am generally able to understand what the issue is and find or figure out how to fix it.

And that’s freedom.

Learning Genie with Project Euler

I’ve recently started playing around with the Genie programming language. This is a variation of Vala but with a more Pythonesque syntax. And I do like Python.

Genie is a compiled language that uses the Vala compiler to produce C code which then compiles to an executable binary. This means that it has less overhead than programs written in Python and should run faster. This is not always a consideration but it can certainly be useful.

The inevitable Hello World program looks pretty simple:

[indent=4]
init
    print "Hello World"

The only problem I’ve found so far is that there appears to be a dearth of “Teach Yourself Genie” resources, either online or off. This is not helped by some of the results that come up when you search for “Genie” or even “Genie Gnome”.

So I’ve decided to have another crack at Project Euler. I have already solved a fair few of these problems in Python, if I can re-implement the same solutions in Genie I will count myself as having made some progress.

One down, 592 to go.

Unplugging

Yesterday was Data Protection Day, which seeks to raise awareness and promote privacy and data protection best practices. Data protection and online privacy are issues that I have tended to think about in the abstract. While I am aware that my online data is exposed, I have a hard time motivating myself to do anything serious about it.

However, with the current global direction of travel, I started to think about how much of my data is going through US servers and the obvious first point of concern is Google, particularly Gmail.

Although I have a few email accounts, for the past few years I have been using Gmail as my primary email — and as my email client. The Accounts and Import page make it very easy to set up Gmail to send and receive from all of my email accounts, allowing me to easily synchronise everything across everything. It’s damnably convenient, but a complete disaster from a privacy point of view.

So today I have unplugged every other email account from Gmail. I have also installed and configured Geary on my desktop and started playing around with the default email client on my phone.

It’s not as convenient as letting Google do all the synchronisation for me, but the effort is minimal and it does mean that all of my email is no longer being pushed through the same server.

I haven’t decided whether to keep my Gmail account. It’s handy to have, but not irreplaceable. I shall watch how my email traffic changes over time and decide later. I shall also have to look into calendaring services.

But first, I shall see about scraping the Google Apps off my phone. This should be reasonably straightforward — if all else fails I just need to do a factory reset. But I must remember to take a backup first.

Portable Vim in Powershell

Because I have finally been able to replace my work laptop.

Because I’m allowed to install software on a server, but not on the laptop in front of me.

Because corporate security policies are insane.

Because I need a decent text editor.

Because PortableApps is a lifesaver.

I have talked about getting Vim to work in Powershell in the past, but this time around I need to get the portable version of Vim working in Powershell.

The first step, of course, is to download the PortableApps platform and install gVim. Handily, this brings the Vim binary along with it so you just need to point your Vim alias to this.

This is done by editing your $profile so that the following line is included:

set-alias vim "PathToPortableAppsgVimPortableAppvimvim80vim.exe"

Everything else appears to be working as expected, so I can actually get some work done now.