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.

Firefox fonts too small in toolbars

For a long time I’ve been using userChrome.css to adjust the size of the fonts in the toolbars in FF. Then for some reason it stopped working (FF 72.0.2 on OpenBSD).

After some digging on the internet I found a solution. You need to use the “about:config”. command.

Type this command in a new tab. Accept the warning and then click on “Show All” (this is new in this version of FF). Then search for “devp”. This has a line:

layout.css.devPixelsPerPx

In my case the default value for this was -1.0. To get acceptable-size fonts I needed to make it 1.8  (i.e. increase it from a negative to a positive value).

To change this, click the pencil symbol on the right and make the change. Then click the tick symbol to confirm.

Note: doing this will change ALL the fonts in FF, so you will probably need to adjust your font size setting in Preferences.

 

 

`

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.

 

My Spectrwm Configuration File

Actually, the default spectrwm.conf works pretty well, apart perhaps from changing the Mod key. It’s easy to try out changes on the fly; just edit the file with the help of the man page and test it with Mod+q. If you make a mistake Spectrwm will tell you by printing an error message in the bar.

Just one caution: some mistakes may prevent spectrwm from starting, so be careful about using Mod+Shift+q. If that happens you will have to edit .spectrwm.conf without using X. This doesn’t apply to Mod+q.


# PLEASE READ THE MAN PAGE BEFORE EDITING THIS FILE # http://omensource.conformal.com/cgi-bin/man-cgi?spectrwm
#
# NOTE: all rgb color values in this file are in hex! see XQueryColor for examples

# Mod key, (Windows key is Mod4) (Apple key on OSX is Mod2)
modkey = Mod4

workspace_limit = 5 # I don’t need more than this

bind[flip_layout] = Mod+r # default binding doesn’t work on my keyboard.

# The next three entries replace the default Mod+Space. Why? By default, this command cycles between the different layouts (vertical, horizontal, full screen). I seldom need to do this whereas I very frequently need to alternate the focus between main and stack. So I set Mod+Space to give focus_main and provide commands to give vertical and horizontal configurations in case these are needed. (Mod+e gives full screen.)

bind[focus_main] = Mod+space # Replace the default
bind[layout_vertical] = Mod+v # Provide vertical layout
bind[layout_horizontal] = Mod+z # Provide horizontal layout

# Window Decoration
border_width = 2
color_focus = red
# color_unfocus = rgb:88/88/88
color_unfocus = blue
tile_gap = 2

# Remove window border when bar is disabled and there is only one window in workspace
disable_border = 1

# Bar Settings
bar_enabled = 1
bar_border_width = 2
# bar_border[1] = rgb:00/80/80
# bar_border_unfocus[1] = rgb:00/40/40
bar_border[1] = yellow
bar_border_unfocus[1] = yellow
# bar_color[1] = black
# bar_font_color[1] = rgb:a0/a0/a0
bar_font_color[1] = white
# bar_font = -*-terminus-medium-*–*–*–*–*–
bar_font = -*-courier-*-r-*–*-120-*–*–*-
# bar_action = conky
bar_justify = left
bar_format = %a %b %d %R +S +F +L +V
#bar_format = +N +I +S <+D>+4<%a %b %d %R %Z %Y+8<+A+4<+V
bar_at_bottom = 1
# stack_enabled = 1
#clock_enabled = 1
# clock_format = %a %b %c %d %R %Z %Y
# region_padding = 0
window_name_enabled = 1
# verbose_layout = 1
# urgent_enabled = 1

# Split a non-RandR dual head setup into one region per monitor
# (non-standard driver-based multihead is not seen by spectrwm)
# region = screen[1]:1280×1024+0+0
# region = screen[1]:1280×1024+1280+0

# Launch applications in a workspace of choice
# Not needed because my desktop is normally running non-stop

# Customize workspace layout at start (not needed – see above)
# layout = ws[2]:0:0:1:0:fullscreen
# layout = ws[3]:0:0:0:0:vertical
# layout = ws[4]:0:0:1:0:fullscreen

iconic_enabled = 1

# This restricts toggling bar to one workspace
bind[bar_toggle_ws] = Mod+b

# The default key bindings for screenshots are easy to hit accidentally so replace these with Mod+F12 etc.
bind[] = Mod+s
bind[] = Mod+Shift+s
bind[screenshot_all] = Mod+F12
bind[screenshot_wind] = Mod+Shift+F12

# Swap between workspaces back and forth (very useful)
# Can use alternatives
bind[ws_prior] = Mod+Shift+Up
bind[ws_prior] = Mod+Shift+Down
bind[ws_prior] = Mod+Shift+Left
bind[ws_prior] = Mod+Shift+Right

# This allows you to include pre-defined key bindings for your keyboard layout.
# keyboard_mapping = ~/.spectrwm_us.conf

# PROGRAMS
# Validated default programs:
program[lock] = xterm # I don’t need to lock screen so avoid doing it accidentally
program[term] = xterm

# QUIRKS
# Default quirks, remove with: quirk[class:name] = NONE
# quirk[MPlayer:xv] = FLOAT + FULLSCREEN + FOCUSPREV
# quirk[OpenOffice.org 2.4:VCLSalFrame] = FLOAT
# quirk[OpenOffice.org 3.0:VCLSalFrame] = FLOAT
# quirk[OpenOffice.org 3.1:VCLSalFrame] = FLOAT
# quirk[xine:Xine Window] = FLOAT + ANYWHERE
# quirk[Xitk:Xitk Combo] = FLOAT + ANYWHERE
# quirk[xine:xine Panel] = FLOAT + ANYWHERE
# quirk[Xitk:Xine Window] = FLOAT + ANYWHERE
# quirk[xine:xine Video Fullscreen Window] = FULLSCREEN + FLOAT
# quirk[pcb:pcb] = FLOAT
quirk[Xsane:xsane] = FLOAT + ANYWHERE
# quirk[XaoS:xaos] = FLOAT + ANYWHERE
# quirk[Firefox:firefox] = TRANSSZ
# quirk[Firefox:Dialog] = FLOAT
quirk[Gimp:gimp] = FLOAT + ANYWHERE
# quirk[XTerm:xterm] = XTERM_FONTADJ

Four Tiling Window Managers Compared

 

Introduction

I’m an enthusiast for tiling window managers. I’ve tried out quite a few over the years, and here I offer my assessment of the four I’ve liked best: spectrwm,  i3, xmonad and dwm.

 

Summary for the impatient

My outright favourite is Spectrwm because I find that it offers all the features I want without making things over-complicated. Configuration via the text file is easy and the commands quickly become intuitive and automatic. Dwm is almost as good as Spectrwm but lacks some features that I want. i3 seems to be a popular WM and is better known than Spectrwm, I like it quite a lot but I find Spectrwm more intuitive to use. Xmonad is an attractive WM but is irretrievably let down by requiring Haskell to configure it. (Detailed comparison of Spectrwm and i3 )

The window managers in more detail

 

1. Spectrwm
This is currently my favourite. Configuration by a plain text file is simple.   I should say that it is the most flexible and intuitive WM that I’ve tried.

Here are some screenshots.

Firefox in master position; two other windows open
Screenshot 2

Enlarge master window (Mod + L)
Screenshot 3


Change to horizontal split (Mod + Space)

Screenshot 4


Make a window fullscreen.(Mod + E)

Screenshot 5

Switch to Workspace 2 containing xsane (Mod +2 or Mod + R. arrow)
Screenshot 6

Note: xsane was started from xterm; the xsane windows  are floating (set via Quirk in ~/.spectrwm.conf)

More information

My Spectrwm configuration file

Get spectrwm here

Detailed comparison of Spectrwm and i3 .

 

 2. i3
I liked i3 quite a lot and used it for a time. Configuration is simple since it is done in a plain text file. In many ways it is similar to Spectrwm but the way the windows are arranged is slightly different. i3 seems to be better known than Spectrwm with a larger following However, having tried out both of them fairly extensively I find I prefer Spectrwm.

3. Xmonad
T
his has a large user base and a helpful mailing list. It has many of the features I want and is quite similar to Spectrwm but is let down by its being configured in Haskell, which makes any configuration beyond the most basic a major undertaking requiring hours of research on the internet. There is also a large disk space overhead required to house the libraries needed for said configuration. For these reasons Xmonad loses out to its competitors, at least for me.

4. Dwm
Dwm is the forerunner from which many other tiling WMs forked. There is still a lot going for it: it’s simple and functional and easy to learn. Configuration is via C, but don’t be put off; it’s easier than it looks even if you don’t know C (I don’t). If you are not willing to embark on learning Haskell, dwm would be an attractive alternative. If Spectrwn were not available I’d use Dwm.

Continue reading “Four Tiling Window Managers Compared”

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?

 

 

Why are some of your books free?

 

 

 

Introduction

This question is really part of a larger one, which is why do I self-publish? Let’s get one thing out of the way immediately: it isn’t because I can’t get published by mainstream commercial publishers.

In the past I’ve had seven books published in this way, both fiction and non-fiction, but I’ve abandoned that route now, as have many other writers.

Why self-publish?

In a word, disillusionment. The science writer John Horgan explains why he decided to self-publish his latest book. “After I got the idea for Mind-Body Problems in 2015, I pitched it to a few agents and editors and got chilly responses. Fuck ‘em, I thought, and wrote the damn book anyway.” My feeling precisely. Mainstream publishing ain’t what it used to be.

In recent years I’ve gone down the self-publishing route entirely, for similar reasos, with eight books produced so far. All are available elecgtronically as e-books and most are also in hardcopy as paperbacks (on Amazon and Lulu).

But why are some of them free? Don’t you want to make mooney from your writing? (‘No man but a blockhead ever wrote except for money – Samuel Johnson,) I certainly don’t dislike receiving the payments I get for these books from various sources.

Still, pace Johnson, there are other motives for writing, such as being read. This has prompted Horgan to make his latest book free, and I’ve done the samd with three of mine.

This isn’t as quixotic as it may appear. The sad fact is that you are very unlikely to make much money from any of the books you self-publish unless you are extremely lucky or willing and able to invest a lot of time and effort in marketing your work, which I’m not.

That may be discouraging, but don’t think that you’ll do a lot better if you take the commecial route. Mainstreame publishers these days make little if any attempt to publicise and market your book, and the cbances that you will make even a modest income from writing is small unless you have a specific audience in view (as in the case of a standard textbook, for example).

The changing face of publishing

This is a consequence of the fact that the independent publshers who used to exist have virtually all been swallowed up by giant international conglomerates. Things were very different when my first book, a novel, was published by Chatto & Windus in 1967. My editor was one of the directors, Cecil Day Lewis, who shortly afterwards was appointed Poet Laureate. After my book was accepted I went to see him in his Central London office and he asked me if I would allow him to edit my manuscript for publication, assuring me that I could trust him to do a good job! He also said he thought I had married too young (something which I think he had done himself).

Two decades later things had changed a lot but some of the original publishing houses still maintained their independence. One of these was Victor Gollancz Ltd, which published a book of mine in the 1980s.

I got to meet the Managing Director, Livia Gollancz, the daughter of Victor Gollancz, the founder of the firm. She had been a fine concert musician and became a publisher reluctantly, when her musical career ended owing to ill-health. She was a tall imposing woman who I think ran the firm rather imperiously. She took the decision to publish my book herself, but that wouldn’t happen today. Such decisions are now made on strictly commercial grounds by accountants. Publishing today

If you have a book published commercially today you are most unlikely to meet any of the directors. In fact, you may not even get an editor, which explains the shoddy standard of some of the books I read nowadays.

Conclusion

The moral of the story is that if you want to write, go ahead and dso, but don’t count on its making you a fortune or even a modest income.

 

 

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.

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.

 

Vim – how to avoid hjkl confusion in Insert mode

 

 

Are you a Vim user? Do you like to use the hjkl keys to move the cursor in Normal mode, like me? If you do, perhaps you’ve experienced the annoyance of forgetting that you are in Insert mode, only to find something like hhhhh or kkkkk appearing on the screen instead of the expected cursor movement. I have to admit that this still happens to me, even after many years. How can it be avoided?

Vim experts advise that you should stay in Normal mode most of the time; it should be the default. I agree, and I do try to remember to do this.  Another idea, which I’ve tried in the past, is to make key mappings such as Alt+h and Alt+l in Insert mode to move the cursor. Of course, you still have to remember which mode you are in unless you make the same mappings for Normal mode. But then you’ve lost the simplicity of the default one-key hjkl, which was the main reason to go down this route in the first place.

The solution I’ve adopted is based on <https://stackoverflow.com/questions/7614546/vim-cursorline-color-change-in-insert-mode>. Here is the code I’m using in .gvimrc with a dark colour scheme (Murphy).

set cursorline
autocmd InsertEnter * highlight CursorLine guifg=white guibg=grey25
autocmd InsertLeave * highlight CursorLine guifg=white guibg=red
set guicursor+=n-v-c:blinkonO

This gives a light grey cursor line in Insert mode which stand out on the dark background but not too starkly. (The last character in the bottom line is a zero.)

Insert mode

In Normal mode the cursor line becomes red.

Normal mode

I use the default cursor, which is block in Normal mode and 25% in Insert mode. Both are white; I’ve set the Normal mode cursor not to blink.

I find that this set-up acts as an effective reminder of which mode I’m in.