skip main content

Archive for November, 2008

QLStephen, a QL plugin that understands README’s and more

posted by Duncan at 12:24 pm on November 27th, 2008

QLStephen is a simple Quicklook Plugin that simply reads plain/text files.

I use the QuickLook feature of OSX 10.5 a lot. More than I ever thought I would. One niggling problem was though that it did not understand files like README, INSTALL, CHANGELOG .. etc that had no file extensions. I like to view these files before any other when viewing new libs or programs I may install, and using Quicklook would be ideal.

QLStephen

Quicklook support can be extended with plugins (I use QLColorCode) a lot, but after a quick scan I couldn’t find one that did the above. So I wrote one.

That’s it. You should now be able to view files like README, MakeFile, INSTALL etc. You may need to wait a few seconds for OSX to see the plugin.

My Xbox-live Avatar

posted by Duncan at 11:10 pm on November 23rd, 2008

I don’t have a Wii so creating a new Xbox live avatar was a new experience for me. I like the fact they’ve made them addressable, although for how long we’ll wait and see. Anyway here’s mine, and yes –as the wife said– I do look camp don’t I.

Duncan Robertson

My gametag is whomwah if you’re interested too. See you online sometime.

Installing Nokogiri on CentOS5

posted by Duncan at 10:45 am on November 13th, 2008

Nokogiri is an HTML, XML, SAX, and Reader parser with XPath and CSS selector support. It claims to be a drop in replacement for Hpricot, and it claims to be faster. I think the latter has been addressed but the drop-in bit, well. You see, the Hpricot’s gem had always in the past, just installed, but with Nokogiri I had dependency problems. Turns out I needed a few extra libs that were not installed on my machine. Here’s how I got things going again:

# It seems you need the latest version of rubygems
sudo gem update --system
# and some RPM's
sudo yum install libxml libxml-devel libxslt libxslt-devel
# now the gem should install ok
sudo gem install nokogiri

Installing daemontools on CentOS5 x86_64

posted by Duncan at 9:43 pm on November 4th, 2008

[UPDATE] It turns out you need to apply the patch below on any recent Linux distribution, not just 64 bit architectures, if that helps anyone.

More head scratching, web searching, friend asking, and huzzah, finally solved. How to actually install daemonstools on my SliceHost CentOS5 slice. The catch for me was that it wouldn’t compile because ‘it required a patch‘. Who’d of known? So here’s my notes:

$ sudo mkdir -p /package
$ sudo chmod 1755 /package/
$ cd /package/
$ sudo wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
$ sudo tar xzf daemontools-0.76.tar.gz
$ sudo wget http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/daemontools-0.76.errno.patch
$ cd admin/daemontools-0.76
$ sudo patch -p1 < ../../daemontools-0.76.errno.patch
$ sudo rm ../../daemontools-0.76.errno.patch ../../daemontools-0.76.tar.gz
$ sudo ./package/install
...
...
Adding svscanboot to inittab...
init should start svscan now.

BBC Programmes via Instant Messenger

posted by Duncan at 4:04 pm on November 2nd, 2008

I have been playing with ejabberd, Jabber, XMPP and the various client libraries, specifically the rather wonderfully simple Jabber::Simple and Jabber:Bot.

It all started because I was doing a Fireeagle integration job with a product at work, and was getting frustrated with the fact that it is still not super simple to update my location. It struck me as I stared at my desktop, that I always have Adium running. Wouldn’t it be great if I had a Fireeagle contact that I could just tell my location, and it would go off and update, letting me know when they’re done. Now that part is midway done (post to come), but before I started that, I wanted to research more the workings of a Chatterbot, a computer program that pretends to be a human and can answer basic commands. They have been around for a long time, I remember playing with an IRC bot a while back, getting it to display the last commit messages from Subversion.

So that research turned into a BBC Programmes bot. As I worked on BBC Programmes, I have good knowledge of the site and the data within, and building a bot that integrated with that data seemed a good example of using the restful API available.

If you just want to try this thing out, here are the details of what you need to do.

  1. You need a Gmail or Jabber compatible IM account
  2. You need a Jabber enabled client, I’ve listed a few:
  3. You need to add a new contact: im.bbcprogrammes@gmail.com

This should be it. You should have a new contact appear in your list (They have a BBC logo as an avatar). You can now begin a conversation with this contact. It’s probably best to start with:

-> ?
-> help

BBC Programmes IM BotThe help menu is your best starting point

You can get more detailed help on the various commands with:

-> ? upcoming
-> ? schedule

This should give you enough information to start making queries against the BBC Programmes data.

[NOTE] I should say at this point, that this service is running on my own little virtual box, and I don’t have the funds to have Deep Blue, so the service may well fall over, or be a bit flaky if many people use it. I’m hoping to persuade my bosses to let me host this on the BBC infrastructure at some point, but until then be aware. The beauty of this kind of service though is that if it dies, your contact just goes offline. When the service is brought up again, the contact comes online. Nothing too drastic in other words.

So here’s a few fun commands to get you going:

# show what's currently on 6music
-> now 6music
# show what's currently on radio4
-> next radio4:fm
# show the BBC One London schedule
-> schedule bbcone:london
# show the BBC One London schedule in detail
-> schedule bbcone:london in full
# show upcoming programmes in the format Films available on BBC One in detail
# you can get a full formats list from: http://add.url.com 
-> upcoming films on bbcone:london in full
# show upcoming programmes in the genre Drama/Soaps available in detail
# you can get a full genres list from: http://add.url.com 
-> upcoming drama:soaps in full

BBC Programmes IM botUpcoming films on BBC Two

Hopefully you get the idea, and like I said the help page should give you all the information you need, specifically around getting hold of all the network names available to the bot.

I have a few ideas for future development, specifically around asking for things that you can watch via iPlayer. So you could ask:

-> available films on bbcone:london
-> available eastenders

This is in the pipeline, and I’ll just add the functionality as I get it finished, so keep an eye on the help page for more commands.

Much of the heavy carrying is handled but the brilliant Jabber::Bot written by Brett Stimmerman. I’ve customised it slightly for my needs, by added the ability to deamonize it and also tweaks around the displaying of help information.

The work that remained was to build a ‘recipe’ script that defines and handles all the incoming commands. There is currently no caching or optimisations, but you can get a copy of this to use yourself from:

You can just add the relevant configuration entries at the top of the script and then start in a way that suits you best. I have moved over to using daemontools, but you can still uncomment the relevant lines in the script (see comments) and use:

-> ./bbcbot start

and bingo, you should now have your own BBC Programmes bot to communicate with.


back to the top