> Books that changed my life

December 2nd, 2014
  • Further Programming for the ZX Spectrum by Ian Stewart, Robin Jones
  • Foundation by Isaac Asimov
  • Crime and Punishment by Fyodor Dostoyevsky
  • Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman, Julie Sussman
  • Slaughterhouse 5 by Kurt Vonnegut
  • Possibly: Children of Men by P.D. James (too early to say)

> Why I use Linux

December 1st, 2014

I have used Linux at home for quite a few years, and a couple of years ago I changed my work machine from Windows to Ubuntu Linux. It’s made life at work better for me.

Better for me

This move has made me much more productive, saving valuable time and money. Here is why:

Security updates happen automatically, without hitches, and rarely requiring reboots.

Since I changed, security updates are applied almost as soon as they are made available with no interaction from me. I have never seen a security upgrade that broke my system and prevented me working, whereas before I saw this several times.

My computer works faster.

My computer feels much faster to work with. In recent tests for our project, we found that the time spent waiting for a compile on my Linux machine was half that spent waiting on an identical system using Windows.

I work faster.

Because my system is more customisable than before, I can work the way that feels more comfortable to me. Support for keyboard shortcuts is more comprehensive in Linux, and I can work using the keyboard for most things, which helps prevent recurrence of RSI, from which I have suffered in the past.

I can automate repetitive tasks.

It’s much easier to write small scripts on Linux for things that I do every day. This means I spend more time thinking about the work I have to do, instead of all the button-clicking required to do it.

I can have more programs open.

My computer now works comfortably simultaneously running 3 or 4 heavy corporate applications, at least 2 copies of Eclipse, Firefox with many tabs open, several Chrome windows, 3 text editor windows, a 1GB virtual machine and many other programs, without slowing down or crashing. When I used Windows I needed fewer programs open, but because Linux manages memory better and many of the programs are less memory-hungry, I can do more things at the same time.

I can use “virtual desktops”.

It’s hard to explain why until you’ve tried it, but virtual desktops are an incredibly addictive feature. I avoid neck strain by using a single monitor directly in front of me*, but I am able to have lots of separate work spaces and can switch very quickly between them. I use one desktop for email and instant messaging, another for the Internet, and several more for programming in different environments. Switching between them happens as fast as I can press the relevant keyboard shortcut. This is a killer feature of modern Linux desktops in my opinion.

[*Multiple-monitor setups are well-supported too, of course.]

Modern tools work better.

Modern software – especially programming software – is frequently developed on Linux, and has its “home” there, meaning it is easier to install and update than on other platforms. Examples include: Python, Node.js, Perl, Vim, Emacs, Bash and Ruby, all of which are much easier to use and install on Linux than on Windows.

Better for my company

Because I use Linux, my company saves time and money.

  • Administering machines is easier. I get Ubuntu and corporate security updates automatically through the built-in security update mechanisms. The corporate updates are maintained by volunteers at my work in their spare time.
  • It’s cheaper. There is no license fee to use Ubuntu, and no added-value version to buy. Support can be paid for from several companies, including the company behind Ubuntu, Canonical.
  • I am more productive. As explained above, I am able to do more work in the same time because I use Linux.

> LibreOffice spell check not working in Lubuntu

November 12th, 2014

I installed LibreOffice into Lubuntu, but the spell checking didn’t work.

It turns out I need to install a dictionary for my locale:

sudo apt-get install myspell-en-gb

I needed to restart LibreOffice, and then I got spell checking as I typed.

> Is it ok to represent dates as Unix time (seconds since the epoch) in JSON?

November 6th, 2014

Yes.

If your JSON contains integer numbers that represent Unix time (seconds since the “epoch”), and you parse your JSON to JavaScript, the range of integers that can accurately be represented is -9007199254740992 to 9007199254740992 (ref: EcmaScript standard, section 8.5).

The year 4000AD starts at unix time 64060588815, which is 9007135194152192 less than the maximum.

The year 1AD started at unix time -2177452800, which is 9007197077288192 more than the minimum.

So there are enough numbers.

> Using hexdump to represent a binary file in Java source code

November 5th, 2014

To embed a binary file (e.g. a png image) into Java source code:

$ hexdump -v -e '/1 "%3i, "' myfile.png
-119,  80,  78,  71,  13,  10,  26,  10,   0,   0,   0,  13,  73,  72,  68,  82, ...

Copy and paste the output into Java code like this:

private static final byte[] myfile = { (byte)-119,  80,  78,  71, ... };