Spectrwm – minor annoyance solved

One of the commonest things I do in Spectrwm is swap two windows (Main to Stack or vice versa).  This is done instantly with Mod+Return. But a minor annoyance is that the focus doesn’t follow the swap.

Suppose you have two windows open, A in Main and B in Stack, and the focus is on A. After the swap the focus is still on A but this is now in the Stack. I usually want it to be in Main, which now contains B. I can achieve this with Mod+m, which alternates the focus back and forth between the two windows. This is OK but can become annoying if I do it a lot since it’s easy to miss-type the m.

For a time I solved this by setting the pointer focus to “follow” instead of the default, but this wasn’t ideal; it required me to keep the pointer always in the left side of the screen.

The solution I’ve adopted now is to remap Mod+Space (quick and easy to type) to give me focus_main. By default Mod+Space cycles between vertical, horizontal, and full-screen layouts, but I hardly ever need to do this. I’ve mapped Mod+v and Mod+z to give me vertical and horizontal layouts in case I do need to change them; for full-screen I use Mod+e.

Here are the entries in .spectrwm.conf.

bind[focus_main] = Mod+space
bind[layout_vertical] = Mod+v
bind[layout_horizontal] = Mod+z

How to save $HOME when reinstalling OpenBSD

Everything has gone wrong and you have to reinstall from scratch. It shouldn’t happen but it may if you do something silly – I once accidentally deleted /etc! But you have all sorts of stuff in $HOME that you don’t want to lose. Can you preserve it?

Well, of course, you should have a backup. I save one nightly on Tarsnap. But it may take a long time to restore from backup and it would be better if you didn’t have to.

Fortunately you can save your $HOME quite easily. Here’s how.

  1. When the Install process asks you to use disklabel, choose either OpenBSD or Whole Disk.

2. See which partition contains /home. Suppose it is ‘k’.Delete this with ‘d k’ and remake it with ‘a k’. Choose ‘No mount point’ (this seems to be the defalt at present).

3. Complete the Install process. When the system restarts,  edit /etc/fstab to mount the ‘k’ partition as /home.

It should work – it has worked for me. But if at all possible make a backup first, just in case it doesn’t.

 

 

When CUPS suddenly fails to work

I have a Brother HL-5035DN networked laser printer for which I use CUPS on my OpenBSD desktop. I’d set up the printer  over a year ago and there had been no printing problems during that time.

Three days ago CUPS suddenly refused to print anything even tbough I could still place files in the queue for printing.  Nothing relevant had changed on my system as far as I could remember. I spent the next three days trying to get printing to work again, with plenty of help from kind people on daemonforums, but no luck.

After innumerable reconfigurations of the printer I decided to be radical: I deleted CUPS entirely and reinstalled it. No result.

At long last on the third day it occurred to me to delete the printer entry in CUPS and remake it. As soon as I’d done this CUPS started printing again.

I did think of trying that solution right at the start of the problem but I got side-tracked into other things,and forgot about it.  Even when I remembered it  I assumed,at first that reinstalling CUPS would automatically delete and reinstall the printer as well. It didn’t.

I still don’t know what the original cause of the problem was. One possibility is that I use the -current version of OpenBSD (similar to the unstable branch of Debian), which produces quite frequent updates for CUPS among other things. When this happens I’m supposed to delete various CUPS files after the update, but on a couple of occasions recently I couldn’t do this because the screen showing the list of instructions went blank before there was time to do so. Maybe this screwed something up.

Anyway, the moral of the story is that when a previously working CUPS suddenly fails, you should try deleting and remakikng the printer entry before doing anything else.

WordPress and Serendipity Compared

Which is the better blog platform, Serendipity (s9y) or WordPress (WP)? I’d been a confirmed s9y advocate for a long time, in fact since 2004, when I switched to it from WP because WP had eaten my database. I was happy with s9y for many years, but in the last year or so I got the impression that it was beginning to show its age. There seemed to be fewer posts on the forums and the promised upgrade was taking its time to appear (though it now has); there had been few if any new plugins or themes.

I decided to start a new blog on WP and see how I got on. This is now what I use for all new posts (although the previous blog is also available as well). I thought it would be worth while to summarise the main differences I’ve found between the two platforms.

Upgrades

As I already mentioned, upgrading is sluggish on s9y. On the other hand upgrades of WP (both the main software and plugins) happen quite frequently, which is reasonably reassuring from the security point of view.

Appearance

There is a huge number of plugins and themes for WP – far more than for s9y. Actually, I’m all for plainness and simplicity so I don’t need most of these things but it’s still good to have them available.

Adding and editing posts

Here WP definitely has the lead. In s9y either you are viewing the blog in the way that a visitor would or you are logged in as administrator. Admittedly you can see a preview of any post you are writing or editing, but once you save it and return to viewing mode, that’s it. If you belatedly spot a typo in what you’ve just saved you have to login again as administrator. This can be quite annoying.

In WP, in contrast, you can combine both modes quite easily. Once you have logged in you can both see the entries as a visitor would and also edit them via a number of buttons on the top line. These allow you, for example, to add a new post, edit an existing post, or edit a static page (e.g. the frontispiece). All these things, and others, can be done without logging in again. This is a more flexible arrangement and allows considerably faster working.

Getting help

There’s a vast amount of documentation for WP on the internet so it’s almost always easy and quick to solve problems or get answers to questions. For s9y there is practically nothing apart from the forums on the s9y website. In the past I’ve had good and quick responses here from helpful people, for which I’m grateful, but activity now seems to be declining steeply, which to me suggests a shrinking user base.

In conclusion

Regrettably (because, no doubt absurdly, I have a lingering sense of loyalty to s9y) I have to say that for me there’s really no contest; WP is now the way to go. If it were possible I’d migrate all my content from s9y to WP but it isn’t so I shall have to continue to run two blogs in parallel.

Choosing a new monitor for non-gamers

A year ago I bought a new monitor, Iiyama Prolite XU22HS. This is a 22″ 1080p (1920 x 1080) monitor. I’d been pretty happy with it but a few weeks ago I noticed that the power LED wasn’t working.  As it was still under warranty I reported this to Amazon and although I’d had the monitor for a year they accepted it for a refund, which I appreciate. Whatever one’s feelings about Amazon, this willingness to replace things without quibbling is a big reason for dealing with them.

I needed to choose a replacement and this wasn’t easy. Most of the reviews I found on Amazon were concerned with gaming, which I don’t do.  I mostly need the computer for text (writing articles and books), with some viewing of TV on BBC iPlayer and occasional YouTube. The most helpful advice site I found was How to Pick a Good Monitor for Software Development  by Nick Janetakis, which I recommend to anyone whose needs are similar to mine..

By now I’d realised that there are few 22″ monitors around now and 24″ or 27″ is the norm. I’m embarrassed to admit that I’d managed to confuse myself to the point where I was making the same mistake as Janetakis’s mum, thinking a bigger monitor would be useful to me as a writer by giving me more text on the screen.

Physical size doesn’t constitute how much you can fit on a monitor. For example my mom thinks that a 25” 1080p monitor is going to let her fit more things on her screen than a 22” 1080p monitor. Don’t be my mom!

The only thing that matters for “fitting more stuff on the screen” is the resolution of the monitor.

This became obvious to me as soon as I read it. I would have been happy to buy another 22″ monitor, but as few of these are now available.I eventually settled on the 24″ HP 24W Full HD monitor, which a number of reviewers had found good for office work and text generally. I needed to adjust my on-screen text sizes to suit the new ppi of the larger monitor but other than that it’s fine for text and iPlayer is better than it was with the Iiyama.

 

KISS – A computer odyssey

Introduction

In a recent post on misc@openbsd.org Ingo Schwarze, an OpenBSD developer, wrote as follows.

I waste time whenever i have to select anything from any kind of menu, select any icon from any kind of iconbox or desktop background, select any file or directory from any file selection dialogue, or have to click any icon in any dialogue box.

I prefer typing commands and use as little menus, clickable icons, selection lists, and dialogue boxes as possible because it is faster, simpler, and requires less looking at the screen.

My feeling exactly. I favour the KISS (Keep It Simple, Stupid) principle in computing, although it took me a long time to realise this fully. But looking back I see it’s a continuing trend.

MS-DOS to Linux

I got my first PC in 1992 to replace an Amstrad PCW, if anyone remembers that. The PC came with MS-DOS and Windows 3.0, which was replaced almost immediately by Windows 3.1. I didn’t upgrade. I didn’t see much point in Windows and continued to use DOS until, at some point in the 1990s, I began to experiment with Linux. After an initial unsuccessful attempt to use Slackware I tried Red Hat and got on better with that.

I knew nothing about Unix at this stage; in fact, I still knew very little about computers in general. But I was beginning to enjoy the intellectual challenge they offered and that was what drew me to Linux. At this time it was pretty much entirely reliant on the command line, but this wasn’t a problem for me because I was used to it from DOS and in fact preferred it. But the lack of word processors was a different matter.

Linux and word processors

My practical reason for using a computer was as a writing tool for books and articles. In my Amstrad and DOS days I’d had a word processor called Protext which I liked, but it wasn’t available for Linux. In fact, there weren’t any real word processors for Linux at the time; you pretty much had to use either Emacs or Vim. I tried both and eventually settled on Vim. Some people disliked it because it is modal (you have to alternate between Insert mode to write the text and Normal mode to modify it), but that didn’t worry me because Protext is also modal.

I still use Vim all the time, even though there are now plenty of word processors and similar programs available to me. The only one I have any use for is LyX, which I’ve used to produce seven books, but even there I usually write my text first in Vim and then paste it into LyX for final editing before printing.

Desktop environments and window managers

Together with the switch to Linux I also began to use the graphics mode, and that led me to explore the world of desktop environments. KDE and Gnome intrigued me at first but gradually I realised that I didn’t need or want either of them. Eventually I settled for a simple stacking window manager, IceWM, and was happy with that for a long time, until I tried tiling window managers. Since then I’ve been sold on them; nothing would persuade me to go back to a stacking WM. My favouring tiling WM, as I’ve explained elsewhere, is Spectrwm. (See my previous blog for details.)

From Linux to OpenBSD

I’d long had a curiosity about the Unix philosophy and I tried out FreeBSD, a couple of times, but found it rather frustrating and always went back to Linux. Then I tried OpenBSD, simply from curiosity. Over a period of about six months I became completely hooked, and six years later I still am.

The transition from Linux to OpenBSD was probably easier for me because the Linux distribution I was coming from was Arch, which is often said to be the most Unix-like version of Linux. I very much doubt I shall change my operating system again. Ths Unix philosophy  is based on KISS and that’s what suits me.

Conclusion

Looking back now over almost 30 years of messing about with computers (and doing some proper work with them in the process, obviously!) I see that there has been a gradual but quite definite progression towards simplification and minimalism.  I know that at least some other people have had a similar experience. If that’s your case I hope you may find these jottings of interest.

A taste for minimalism in computing probably reflects a more general attitude to other things in life. I’ve written a post about that as well.

Free broadband? Zen and the art of internet maintenance

The Labour promise to give me free fibre broadband doesn’t fill me with joy. You know what they say about offers that sound too good to be true.

My ISP is Zen Internet. It isn’t the cheapest but its speed and stability are good given that I’m still on ADSL and live rather far from the exchange.

But probably the best thing about Zen is that you can speak to someone who is actually at Zen instead of India. A couple of weeks ago my connection slowed down dramatically in the evenings. I phoned Zen and they reset my connection, which brought things back to normal. They called back twice on different days to check that all was still OK.

Do you think Labour’s nationalised internet  will do the same? Do you really like the thought of your broadband being a state monopoly?

 

 

Mutt not weeding headers

Mutt has the command ‘h’ to hide (weed) most of the headers in emails. After an upgrade to 1.12.0 I found this wasn’t working. I emailed Stuart Henderson, the maintainer of the Mutt package for OpenBSD. He thinks this is due to a change in the code of the new version of Mutt. He advised including these lines in .muttrc:

ignore *
unignore From To CC Subject Date Reply-To Organization X-Mailer User-Agent Organisation Organization Priority Importance Mail-Followup-To

This makes ‘c’ work correctly. Thanks, Stuart.

Note added 31 May: Stuart has sent me a link which explains how the problem arose (https://gitlab.com/muttmua/mutt/issues/144). The change appeared in 1.12.0 but has now been reversed in 1.12.1 so the above lines are no longer needed.

How to avoid problems with Vim undo & redo

Starting with Vim 7.0 this brilliant editor introduced a more powerful set of commands for Undo and Redo, using an undo tree. Being lazy, I didn’t fully get to grips with this and as a result didn’t really understand what I was doing. At times I accidentally deleted text I’d just writtenjjjk and then couldn’t recover it.

I knew the previous version of my work had to be there but I didn’t know how to get it back. After a time I realised that when things seemed to go wrong the solution was usually to use ‘g-‘ and ‘g+’ to go hack and forth in the undo tree.  But this was a bit hit & miss.

If you have had a similar experience here are a couple of useful site where things are explained clearly; Undo and Redo and Using Undo Branches.

Finally, thanks to a third page I now know why I occasionally deleted work I’d just done and couldn’t recover it. See Recover from accidental Ctrl-U. This explains why it happens  and provides a way to recover the deleted text. Better still, it tells you how to prevent it happening in future. Short cut for the impatient:  put these lines in .vimrc:

inoremap <c-u> <c-g>u<c-u>
inoremap <c-w> <c-g>u<c-w>

 

 

 

New feature in OpenBSD

OpenBSD has introduced a new utility in the most recent version (6.6 – now in -current). This is sysupgrade, which makes upgrading the system even more painless than it was previously.

sysupgrade downloads the necessary files to /home/_sysupgrade, verifies them with signify(1), and copies bsd.rd to /bsd.upgrade.

sysupgrade by default then reboots the system. The bootloader will automatically choose /bsd.upgrade, triggering a one-shot upgrade using the files in /home/_sysupgrade.

This is brilliant. I do upgrades to -current about once a week. Previously I had to reboot with a new bsd.rd and connect to a mirror to do the upgrade. Downloading the files took some time (more than 20 min) during which the computer was not available for work.  Now I just run sysupgrade and everything happens automatical. I can continue to use the computer while the files are being downloaded, after which the system reboots with the new upgrade. This is a major advance in ease of use – congratulations to OpenBSD!

Incidentally it also works for upgrading -release versions; it knows whether you are using -release or -current.