elliot's blog

Ruby HTTP clients revisited

A while ago I posted about Ruby HTTP clients, and how I'd been messing around with writing my own. As is so often the case with open source, I waited around long enough, and now the good solutions are floating to the surface. When writing some simple HTTP client stuff recently (to do spidering of a Rails application), I found that the following combination worked really well and meant I could dispense with my hoary old scripts:

  • The RFuzz HTTP client library, to fetch pages.
  • The Hpricot HTML/XML parser library for parsing the pages.

Installing them was as easy as:

gem install rfuzz
gem install hpricot

Though you're likely to need a lot of build tools installed, as they build native extensions.

Once they were in place, I could do stuff like this (to parse all the URLs out of an HTML page):

require 'rubygems'
require 'hpricot'
require 'rfuzz/client'

client = RFuzz::HttpClient.new('localhost', 4000)

# to fetch http://localhost:4000/people and get the response body
body = client.get('/people').http_body

# to parse the links out of the response body using XPath
doc = Hpricot(body)
links = doc.search('//a')

# to get the URLs out of the links
urls = links.map { |l| l.attributes['href'] }

etc.. Pretty good. I think my quest is over.


Here's something I hadn't seen given a name before: the practice of putting captions with poor grammar and IM-style spelling onto pictures of cats to humorous effect. The resulting pictures are referred to as lolcats. Apparently, it is quite profound and clever.

The site I Can Has Cheezburger has many examples of the form. There's even a programming language, which uses lolcat style idioms, e.g. (explanation of keywords etc.):

    BTW this is true
    BTW this is false

Well I never.

WMITA Unplugged Event - "Open Source is Winning"

Last night saw me taking a long-ish trek out to the West (near Telford) to present at a WMITA event. The event was held in a debating-style format, with me supporting the motion "This house believes that open source is winning". After I thought about it for a while, I realised I didn't really understand the motion, and spent my speech moulding it into what I would have preferred as a motion:

This house believes that those companies which make the most effective use of open source will be the ones which win.

Which I do believe. It was a fun debate with a nice bunch of people (mainly .NET programmers, which in itself was interesting), and I kind of "won": we had a vote for/against the motion before we started the debate, at which 31% were for, 31% against, and 38% didn't know; after the debate, for was up to 50%, against 31% and don't know down to 19%. If I convinced one person, I consider it a victory.

There is a report about the event online now.

The notes I used as the outline for my talk are attached below.

A computer scanner playing music/Are you being served? etc.

Has to be seen to be believed: ftp://ftpmirror.sectoor.de/private/ganjatron/scanjet-elise2.mpg

A remix of the theme tune to Are You Being Served?: http://www.scottcairo.co.uk/pilchard/tunes/served.htm

Pilchard has a whole range of other remixes/mashups at: http://www.scottcairo.co.uk/pilchard/tunes/index.htm

I've spent this morning listening to WFMU (mp3 feed; ogg feed), a New York freeform radio station (basically, the DJs choose what to play). It is awesomely eclectic. It's like listening to the record collection of a mad friend who's spent too long at car boot sales. Jason Elbogen, I salute you.

I really should have a music category...

Open source for normal people

The BBC ran an edition of its Click on open source on Saturday. The RealPlayer feed is available from the BBC website. It's fairly interesting, low-level stuff: you know, here's a load of free software ("free" as in beer) you can use instead of that expensive proprietary stuff. There's an interview with Mark Shuttleworth of Canonical (those folk behind Ubuntu) where he talks about space more than software, but reasonably interesting. (I find this programme quite quaint, as they still have a "best websites of the week" section, and it is very English and slightly patronising in places (if you're a techie).)

John Cage - super cool

Some fantastic footage of John Cage, that most endearingly controversial of avant garde composers, performing one of his pieces (Water Walk) on the American game show "I've Got a Secret" in 1960.

Here's some crazy mashups for my sis. Now them's what I call mashups. You might also enjoy these one minute or less remixes of various songs. My favourite is this version of Stagger Lee by Nick Cave. I also enjoyed Take One (a version of Dave Brubeck's Take Five). Or how about the whole of OK Computer in 45 seconds (wait for the hilarious ending).

Martin Denny performing Quiet Village. Class.

In fact, just go and read this fantastic radio station blog I stumbled across where these and many other nuggets came from.

Birmingham Poets Online

Yes, I know it looks like I've dropped off the earth, and I don't appear to be doing any technical writing or research (don't appear...aha, just you wait), but I have been spending a lot of my spare time writing poetry. Before you laugh, can I just remind you that it is a noble art form, intellectually challenging, and one which I find very engaging (I lose hours troubling over a rhyme or the right words to keep my iambic pentameter intact). OK, maybe not for everyone, but I am really into it at the moment (reading poetry as well as writing it).

Anyway, to my point: I've now got my own space on Birmingham Poets Online. I don't think it takes much to get on there, to be honest, but it's nice to be part of an (albeit small) literary community. Those of you who've been missing my poetry on here (not you, obviously, sis) can catch up with my latest works there.

Gardeners' Question Time

Update: If you can't be bothered to find it yourself, here's a RealPlayer feed of Sunday's programme. My question is about 29 minutes in.

Yesterday evening I went to a recording of Gardeners' Question Time at Birmingham Botanical Gardens (Nicola got me a couple of tickets, so I took along my friend Adrian). I have to confess I've never listened to a full episode myself, as I thought it would be pretty dry and uninteresting. But seeing it recorded live was very entertaining. I was impressed by the professionalism of the presenters (John Cushnie, Bob Flowerdew, Bunny Guiness, and hosted by one of the BBC weathermen whose name I can't remember). They seemed genuinely pleased to be there and treated all the questioners with great courtesy; and they recorded tight to schedule, with little need for retakes. They were also funny, particularly John Cushnie, who has a dry, quite dark sense of humour, and was comically blunt when faced with some of the questions (though still polite).

For a jape, I decided to pen a question and drop it into the "question pot". I didn't expect to get picked, but amazingly did. Adrian did a "facial groan" when they got us to go up to the front, but I think he enjoyed getting close to the action by the end of it. So (unless they cut it) my question will be on the end of this Sunday's (2pm, June 10th) programme. I won't give away what it was: you'll have to listen.

Drupal in the West Midlands

At OpenAdvantage we are starting to see more and more enquiries about support for Drupal. Often this will be from companies who've started using Drupal but need some work done on customisation; or a company that's seen Drupal in action elsewhere but lacks the technical skill for implementation. They are often looking for a local company to support their work, and ask for suggestions. I end up scouring the Drupal services page for UK companies, but it's not very often I see any West Midlands companies.

If you are a Drupal company based in the West Midlands region and are looking for consultancy work, please let me know in the comments so I can pass your details on. I've had enquiries from three different organisations in the past month, to give you an idea of the levels of interest. For the record, here's a list of compiled; note that these are not recommendations, just companies I know of who work with Drupal in the UK:

Check my new widget

Last.fm has released a new recent tracks widget (see the left-hand side of my about page). It is a definite improvement over my plain HTML Drupal module: this one will preview bits of the tracks I've been listening to. You lucky people.

Syndicate content