Sunday 18 October 2009

Goodbye lad.

It's been less than five months since I buried Garfield under his favourite tree at my mother's. Today, I gave him company, and set Jake's ashes down next to his.

Take care of the pup for me, old man.

Wednesday 14 October 2009

The Religious Persecution Complex

In the best traditions of throwing a tantrum to get their way, the Mormons (I keep typing 'morons') in California are upset because public support for their suppression of gay rights is waning.  Enshrining the rights of those who think differently in law is a threat to their religious freedom, they whine.  Furthermore, they have the audacity to portray themselves as the persecuted minority, "similar to the intimidation of Southern blacks during the civil rights movement".

Every time I try to think of an appropriately outraged response, my brain just shuts down.  It simply can't deal with that level of stupidity.

Religions that kick and scream whenever they don't get their way are a common sight: the Catholics are upset because they were mocked by US comedienne, Sarah Silverman, who suggested that selling the Vatican and giving the proceeds to the poor would feed the hungry of the world.  The Muslims get upset every time someone doesn't automatically yield to their demands for respect (seriously, why would a non-Muslim care about the traditions and taboos of Islam?)  And then the Mormons, bat-shit crazy even by the high-bar set by standard Christianity, think that California legislation threatening to overturn their hate campaign is an attack on their religion.

I'm an atheist.  I really don't care which gods or spirits or entities you worship.  But when it infringes upon the rights of other people who wish to live their lives free of religiously-inspired bigotry, I start to have a problem.  And this notion that every disagreement is an attack against your god or gods, or your freedom to practice religion: forget it.  I don't have a problem with imaginary entities.  But I do have a problem with stupidity, and if you think that your particular brand of stupidity is allowed because it's sanctioned by an invisible being, that doesn't give it any more weight.

In a close to this rant, you might be thinking of some suitably boring tirade that involves either quotes from whichever book you believe is the One, True, Unaltered Word of God, or threats of violence or hellfire.  Save your fingers.  If I am wrong, and there really is a god, I'll happily answer to him/her/it when it's all over: the supreme creator of the universe doesn't need your assistance in eliminating me.

Tuesday 13 October 2009

Keyboard and Mouse Unresponsive in GDM

A fairly major upgrade of Xorg at the weekend left my Gentoo Linux box in a state where mouse and keyboard input no longer worked at the GDM login screen.


First port of call was /var/log/Xorg.0.log, in which I could see some suspicious lines:

(II) LoadModule: "mouse"
(II) Loading /usr/lib/xorg/modules/input//
(II) Module mouse: vendor="X.Org Foundation"
compiled for 1.5.3, module version = 1.4.0
Module class: X.Org XInput Driver
ABI class: X.Org XInput driver, version 2.1
(EE) module ABI major version (2) doesn't match the server's version (4)
(II) UnloadModule: "mouse"
(II) Unloading /usr/lib/xorg/modules/input//
(EE) Failed to load module "mouse" (module requirement mismatch, 0)
(EE) No input driver matching `mouse'
(II) LoadModule: "kbd"
(II) Loading /usr/lib/xorg/modules/input//
(II) Module kbd: vendor="X.Org Foundation"
compiled for 1.5.3, module version = 1.3.2
Module class: X.Org XInput Driver
ABI class: X.Org XInput driver, version 2.1
(EE) module ABI major version (2) doesn't match the server's version (4)
(II) UnloadModule: "kbd"
(II) Unloading /usr/lib/xorg/modules/input//
(EE) Failed to load module "kbd" (module requirement mismatch, 0)
(EE) No input driver matching `kbd'

So, a version mismatch between driver modules and the updated X server.

The solution?

emerge -1 x11-drivers/xf86-input-{evdev,keyboard,mouse}

Followed by:

/etc/init.d/xdm restart

The downside? The keyboard wasn't working. So I had to issue these commands from my Macbook Pro after sshing into my Linux box.

If you're stuck without ssh access, hold down Alt-SysRq and then press r and then e to kill the X server, then Alt-Shift-F1 to get back to a virtual terminal, and then log in as root. Not pretty, but I'd guess that it'd work.

Monday 12 October 2009

Avoiding e-Readers

There has been a great deal of hype about electronic books from Sony and Amazon but, as much as I like shiny new gadgets, I just can't get excited over these offerings. Fundamentally, I like replacements for old ideas to be better than their predecessors in every measurable way, but e-readers are more give-and-take.

On the plus side, you've almost eliminated the weight/bulk factor. You can buy books on-the-go, and have them almost instantly available for reading. The Kindle offers free Wikipedia access, which is handy for settling those pub debates. The text-to-speech feature could occasionally be useful if you just want to stare out of the train window for a while on the way to work rather than squinting tired eyes at text on a page.

But then, the negatives are huge:

  1. Sure, the battery life is impressive, but it's still a battery life that dead-tree just doesn't have to worry about.

  2. It's no big deal if you lose a book or drop it in the pool by mistake on holiday, but doing the same with these pricey devices is a blow, both from the perspective that it cost so damn much and that your entire holiday reading was on it.

  3. Digital Rights Management. This is wrong on so many levels it's hard to know where to start. Want to lend a book to your friend? Not allowed. Want to view it on a broader range of devices than the publisher of your book wants? Not allowed. Have you inadvertently bought something that shouldn't have been sold to you? No problem (for the publishers) -- your reseller can remotely remove the book from your library (the fact that this was done with George Orwell's 1984 is deliciously ironic).

  4. On a DRM-related note, you can only buy books for your reader from online stores affiliated with the manufacturer of your device, and it's not too difficult to envision a music industry-like scenario where a given title is only available on a given platform.

  5. (and this is the part that makes me think I'm getting old...) it just doesn't feel good. Some throw-away books I don't really care about, but others, I want to feel the paper under my fingers to get a feel for it (I have a copy of the Smalltalk 'Blue Book', printed in 1983, that exudes that fuzzy feeling)

Maybe that's it. The only books I'd be happy to have on an electronic reader would be ones that I don't care about; ones that are effectively disposable. But disposable and expensive don't sit well together.

How can e-readers get it right? They have to be better than 'old-style' books, and that involves both a significant drop in price and the ditching of the DRM millstone. Some unique opportunities arise in the case of corrections and updated versions, as well. Does your technical book have a new, updated edition? Maybe you could get it cheaper because you owned the previous one. Maybe you can wirelessly submit feedback or corrections back to the author/publisher. When you're part way through a series, waiting for the author to publish the next volume, wouldn't it be useful say, "I'm interested in this series" and automatically be notified when it's available?

Despite my dislike of the current state of affairs, there's lots of potential for the platform, but only if some draconian notions of control relax their grip on its throat.

Saturday 10 October 2009

Thank you, US Airways!

I spent some work-time in southern California about a month ago, involving a long day of travel from Glasgow to Philadelphia, and then from there to San Diego. With my entertainment loaded onto my iPod Touch, I was prepared.

At least, until I left it on the plane in Philadelphia on the way to the states.

Having realised almost immediately that I'd left it, I asked a US Airways representative if they could help out but, without a procedure to follow, there was nothing that could be done to get my iPod from the plane. It was mildly frustrating, but when it came down to it, it was my fault for leaving it! Still, I left my details in the hopes that it might turn up later.

Back home two weeks later, I got a call from US Airways asking if I had lost something, and when I confirmed the what and the when was told that they could take my postal address to return it to me. It took a while to get it across the Atlantic, but it finally arrived yesterday.

So thank you US Airways!

Wednesday 7 October 2009

Regular Expressions in Erlang

My favourite general-purpose language is still Perl. It's not that it's the best at everything, but that it's good enough for just about anything (and better than most).

Probably as a side-effect of what many would consider this misguided affection, one of the first things I look at in a new language is its regular expression support. Mostly, this is a no-brainer: Perl 5 is the de-facto standard, and its regex engine is available as a library to link into your favourite C-binding language.

So I was disappointed initially when looking for advice on regular expressions in Erlang. The first hit on Google (at the time of this writing) is here, and indicates the regex module. Unfortunately, that module is really, really limited compared to the mind-bending flexibility of the Perl 5 engine.

I was disappointed. I'm going to re-write my CTCS clone in Erlang, and it makes quite a lot of use of regular expressions to extract information from the various messages ctorrent sends throughout its lifetime. In this case, it was a bit of a show-stopper: there's absolutely no point in doing the re-write if it's going to be more difficult to create the new version than improve the old.

But then, salvation! The re module, an (almost) mapping onto PCRE!

Suddenly, extracting groups from a string was easy:

regex_example() ->
Name = "Danny Woods",
{ match, [ Forename, Surname ] } =
re:run(Name, "(\\w+)\\s+(\\w+)", [{capture,all_but_first,list}]),
{ Forename, Surname }.

The escaped backslashes are ugly, but the direct capturing of groups as a list is pretty sweet.

Monday 5 October 2009

Another Sad Day

It's been almost six months since Garfield died. Every Garfield needs his Odie, and my Garfield's was Jake. We had to take Jake to his final visit to the vet's today: he was diagnosed with aggressive terminal cancer three weeks ago and given six months to live, but a turn for the worse last week pulled that date back to today. He was sixteen.

We got Jake as a pup in 1993, and he kept those puppy looks right up until the end. I visited him at my mother's yesterday, and gave him a hug and touched our foreheads together like we've done since we were both young. He was the best of dogs.

Sleep peacefully boy.

I will miss you.