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.

Nasty.

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//mouse_drv.so
(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//mouse_drv.so
(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//kbd_drv.so
(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//kbd_drv.so
(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.

jake.jpg

Wednesday, 9 September 2009

Wastage

I stumbled across this amusing video of a cat drinking by dunking its head under a flowing tap. Even this light-hearted fun had some people in the comments bemoaning the wasted water of a tap being on for a few minutes of recorded video.

Then, with the subject of wasted water fresh in my mind, I switched tabs to this story (also from Reddit), and almost snorted my tea.

It was funny at the time.

Monday, 7 September 2009

Building MPlayer from SVN on Mac OS X Snow Leopard

I use the command line mplayer on Mac OS. The only competition for this superb video player is VLC, but sometimes I like to just quickly launch something without a bulky UI getting in the way.

But today I upgraded to Snow Leopard, distinctive from it's predecessor in being a truly native 64-bit operating system. And my SVN checkout of MPlayer stopped working, giving me a green video window and needing some effort to kill. So, to get MPlayer working, you're going to need the following:



...and, of course, your MPlayer sources. If you want FAAC support, get libfaac and build/install it using the same procedure as for freetype below.



Install the Apple Developer Tools using the graphical installer.

Build libpng and libjpeg:

./configure --arch=x86_64

make

sudo make install

Build freetype:

./configure --target=x86_64-Darwin

make

sudo make install

Build mplayer:

./configure --target=x86_64-Darwin --enable-menu

make

sudo make install




Now, you should have a native 64-bit /usr/local/bin/mplayer:



danny@mirror ~ [1] % file /usr/local/bin/mplayer


/usr/local/bin/mplayer: Mach-O 64-bit executable x86_64


danny@mirror ~ [2] %



Success!