bloovis.com

March 15, 2019

Thoughts and Prayers

#include <signal.h>
#include <stdio.h>
#include <unistd.h>

#define MASS_MURDER SIGINT

void knee_jerk(int sig)
{
  printf("\nOur thoughts and prayers are with the families "
         "of the victims.\n");
}

int do_nothing(void)
{
  printf("La-di-da...\n");
  sleep(5);
  return 1;
}

int main(int argc, const char *argv[])
{
  printf("Hit Control-C whenever a mass murder occurs.\n");
  signal(MASS_MURDER, knee_jerk);
  while (do_nothing())
    ;
  return 0;
}

February 20, 2019

Using LastPass in Pale Moon browser

Firefox 57 introduced a new extension API that broke most of the extensions I had been using, including It’s All Text, Dorando Keyconfig, and Tab Mix Plus. So I installed Pale Moon, a fork of an older Firefox that works with those extensions. But the current LastPass extension only works with the new (57+) Firefox.

February 9, 2019

Adding Redo to MicroEMACS

Last year I added undo support to my ancient fork of Dave Conroy’s MicroEMACS. The undo function has been useful on those occasions where I do something stupid, like justifying a paragraph in, say, a piece of C code. But sometimes it’s possible to go a bit to far with repeated undos and lose some valuable work. The solution was to implement a redo command that undoes an undo.

November 23, 2018

Ispell unable to open default.hash

For some reason, one of my Linux Mint 18.1 machines was not able to run ispell, which gave this error message:

Can't open /usr/lib/ispell/default.hash

Comparing this installation with another machine running the same OS, it seemed that the missing file was supposed to be the first in a chain of symlinks that eventually pointed to /var/lib/ispell/american.hash. The man page for ispell suggested that the buildhash program might possibly create the missing files, but I could find no instructions online about how to use it.

Eventually I figured out that I needed to install the missing iamerican package, which contains the missing files and runs buildhash as part of its configuration script. I’m still not sure why this package wasn’t installed automatically when the Mint was first installed on this machine.

November 8, 2018

Using an HP P1006 printer in Linux Mint 18

Over the years, one persistent problem with using HP printers in Linux Mint has been the conflict between the drivers provided by CUPS (the standard Linux printing system), and HPLIP (the HP software that provides proprietary drivers for some of the company’s printers). My old P1006 printer (which uses a USB connection) requires the use of HPLIP, because CUPS does not contain the required drivers. However, when the printer is first plugged into a system running Linux Mint (and, presumably, Ubuntu), CUPS automatically installs its own incorrect driver for the P1006 after a few seconds. Then if you run the HPLIP device manager, which installs its own driver, the incorrect CUPS driver will still be used, and printing from Xreader (a PDF reader) will not produce correct output.

The fix is to delete the CUPS printer driver before running the HPLIP device manager. After you plug in the printer, wait a few seconds for CUPS to install its driver. Then open the CUPS Printers tools (aka system-config-printer, found by searching for “printer” in the Mint menu). Find the newly added HP printer, right click on it, and select Delete. This will remove the incorrect driver.

Then run the HPLIP device manager. (This is part of the hplip-gui package, and looks like a little HP logo in the system tray.) Tell it to add a USB printer, and it should soon install a working driver.

You can verify that the correct driver is in use by opening the CUPS Printers tool again (see above). Right click on the printer, and select Properties. In Settings, the Make and Model field should include words saying something like “hpcups 3.16.3, requires proprietary plugin”. If the incorrect CUPS driver is being used, this field will not mention “hpcups”, but may include the word “foomatic” somewhere.

September 28, 2018

Updating ThinkPad BIOS from Linux

Updating a ThinkPad BIOS usually involves booting a floppy or CD-ROM containing PC-DOS and an update program, or running a Windows-only updater. Neither of these is an option on a machine like my ThinkPad X200s, which has no floppy or CD drives, and is running Linux only.

The various options available to Linux users are discussed in the ThinkWiki BIOS upgrade page. The one option that worked for me in the X200s case is to boot the CD-based updater using Grub2.

First, I downloaded the latest CD-based BIOS updater from the link on the ThinkWiki BIOS Upgrade Downloads page. In the case of the X200s, the bootable CD updater file was called 6duj48us.iso and was found here.

Then I logged in as root (using sudo su) and performed the following steps:

apt-get install grub-imageboot
cp 6duj48us.iso /boot/images
update-grub

After rebooting, I realized that I needed to force the Grub menu to appear at boot time. (The menu was invisible because this machine had no other operating systems when I installed Mint. If your machine dual boots Windows and Linux with Grub, you should not have to perform these steps.) As root, I edited the file /etc/default/grub, and commented out the line containing GRUB_HIDDEN_TIMEOUT so that it looked like this:

#GRUB_HIDDEN_TIMEOUT=0

Finally, I ran update-grub and rebooted. This time the Grub menu appeared, and I was able to select 6duj48us.iso for booting.

July 26, 2018

Microsoft buys Github

For a while now I’ve been publishing my free software projects on Github. But last month Microsoft purchased Github, and that alarmed me. Traditionally, Microsoft has been the mortal enemy of free software, and Linux in particular. The company now claims to be the friend of free software, but trusting Microsoft, whose mission is total monopoly power, is like trusting an abuser who claims to be reformed and promises he will never hit you again. So I’ve starting moving my projects to Gitlab; see them here.

June 22, 2018

Mailing labels in Linux

Once a year our library sends out appeal letters to donors, using mailing labels that we print ourselves. The librarian keeps a list of donors in a spreadsheet that records their names, addresses, and past donation amounts. Formerly the librarian attempted to use MS Office to generate the labels, but this was an error-prone and time-consuming operation. I prefer to automate processes like this using scripts and open source software instead of GUIs, so I took on this task.

June 13, 2018

Cervantes on Criticism

The following explains much of the commentary on Youtube and other forums on the internet:

“Men who are famous for their talent, great poets, eminent historians, are always, or almost always, envied by those whose particular pleasure and entertainment is judging other people’s writings without ever having brought anything of their own into the light of day.”

– Cervantes, Don Quixote, Second Part, Chapter III

← Archive