elliot's blog

Online tax returns - DONE!

April of this year marked the end of my first year's trading as mooch labs. I didn't make much money, to be honest, but I thought it best to declare what I had made :).

Last year, I attended two excellent, free workshops organised by HM Revenue and Customs; if you're starting your own business, I recommend you book onto the Becoming Self-Employed and Self Assessment for self-employed people courses. I found them immensely useful in helping me to cut through the masses of forms.

And this week, I've been using the HMRC Online Services to complete my first tax return. It's a really nice web application: not without a few oddities, but very clear, taking you step by step through the process. You have to wait until they send you your first self assessment form, then apply for a PIN to use the website, which I turned around in about a week. Once I got that set up and logged in, it took me perhaps 2 hours to sort out my paperwork, read the guidance, fill it in (though because I have very low profits, I don't have to put much detail in), and submit it. I also rang the business support team at the local tax office with a couple of queries and found them very helpful.

Turns out tax doesn't have to be taxing, like they say on the adverts. Now I just have to pay the bill...

Progress on Drupal Last.fm module

I had another issue with my Last.fm module the other day, which is why it's currently turned off. I think it happens if the Last.fm feeds are unavailable; causing the module's HTTP requests to time out; which in turn causes the whole of Drupal to time out as it waits for the response; which means my whole site falls over.

I've been using the drupal_http_request() function to run my HTTP requests, but unfortunately you can't adjust its timeout setting. So I dug around in that code, and have submitted a feature request and patch which enables you to customise the timeout when using this function. I then rewrote my module with shorter timeouts when making requests to Last.fm, which seems to do the trick.

Hopefully, if this patch makes it into Drupal, I will be able to release the new version of my module, complete with timeouts, so it won't cripple my site or anyone else's. It also adds a Last.fm recent tracks listing to user profiles (if they've set up their username) and has a block (only for one user - I just put it in for myself, really). It still needs a bit of work, and only handles recent tracks, but it's coming along fine.

Don't you Windows users get fed up?

I've switched my Windows machine on today, as my sister sent me a CD which won't open on my Linux machine, but inexplicably will on Windows. I'm currently copying a load of music tracks from it to my laptop. However, every 5 minutes or so, Windows pops up a dialogue box which says it has updated itself and needs to restart, with two buttons: Restart now and Restart later. It also has a countdown progress bar, which gives me 5 minutes to decide which I want to do: presumably if I left it, it would restart once the progress bar reached zero. Despite me pressing Restart later, the Window has popped up 3 times already. When I click Restart Later, I mean "later, when I've decided I want to restart"?! Not "I can't decide, ask me again in 5 minutes"!

Do you people out there using Windows find this enjoyable? How on earth do you stop yourself putting your fist through the monitor with the constant nagging?

By the way sis, if you're reading this, thanks for the MP3s.

Packt Open Source CMS Awards

I'm a judge on the panel of the Packt Open Source CMS Awards, in the category of Best Overall CMS.

Nominations open on 16th July 2007, so remember to twitch your voting fingers. There's a $5000 prize to the winner in the category I'm judging, plus prizes of $3000 for second place and $2000 for third. Other categories include Most Promising, Best PHP, Best Other, and Best Social Networking; but I'm not a judge for any of those.

(By the way, despite using Drupal myself, I will be scrupulously objective as always.)

Pro Drupal Development - Review

Pro Drupal Development (by John K. VanDyk and Matt Westgate, published by Apress; get it here) is a great little book. I know a bit about Drupal, and have written a couple of modules, but always felt like I was skirting the edge of some dark lake I dared not step into; when I did get in, I was quickly overwhelmed by the currents, got wet, and struggled out as soon as I had what I needed. (OK, a bit melodramatic, but you get the picture.) My knowledge was mostly gleaned from the handbooks on the Drupal site, which vary widely in quality, some being excellent and complete, others patchy and inaccurate, or for obsolete Drupal versions. I've also dug around in Drupal code a lot, but a clear understanding of the architecture continued to elude me.

This book, however, shines a clear strong light into Drupal's innards. I feel like it's written for someone like me: pretty technical, fairly able to make sensible inferences if given decent examples, and with some experience of Drupal of a user and dabbler. The chapters are pretty terse, but pack in some excellent code examples and fragments to help with common tasks. For example, I've been working a bit on my Last.fm module this week, and this book helped me to:

  • Work out how to use the caching system.
  • Modify the page which displays a user's account details to show data from my module.
  • Figure out how to extend an existing Drupal "object" (a user) with fields from my module's table.
  • Understand how to write HTML generation code which works nicely with the themes system.
  • Understand Drupal coding conventions a bit more and how to document my module.
  • Write a proper module installer/uninstaller.

And probably other stuff I've forgotten. Things I had been working out from the handbooks, by making inferences from other people's code, reading forum posts etc., were covered briefly, pleasantly and clearly. They've probably saved me a good few weeks of scrabbling around. The book covers most Drupal concepts with enough depth for you to get a good overview of the whole architecture, as well as giving you practical snippets (table of contents here).

Highly recommended, and a snip at $22.50 for the ebook. No Drupal developer should be without it! Especially useful if you're not a complete Drupal nut but want to be able to write modules properly.

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.

lolcats

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.):

HAI
CAN HAS STDIO?
I HAS A VAR
GIMMEH VAR
IZ VAR BIGGER THAN 10?
  YARLY
    BTW this is true
    VISIBLE "BIG NUMBER!"
  NOWAI
    BTW this is false
    VISIBLE "LITTLE NUMBER!"
  KTHX
KTHXBYE

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).)

Syndicate content