elliot's blog


Plodding along this week: nothing earth-shattering, but steady progress. I've taught my PHP+MySQL FastTrack course several times now, but I'd been squeezing as much as possible of a 5 day course into 2 days. This felt a bit of a mess (though the trainees so far haven't noticed, it irked me). So I decided I'd write a cleaner, more integrated 2 day version of the course instead, and have been working on it this week. Nearly done: just some stuff on sessions to complete.

It's interesting writing PHP after spending some time writing in Rails this week. PHP coding makes you think at a much lower level than Rails: how should I write MVC? which frameworks should I use to talk to the database? which templating system should I use? how should I integrate them? Rails lets you move your decision making to a much higher level of abstraction: what is the data model? what is the flow of control for this part of the application? Coding in PHP after Rails seems hopelessly unproductive and scattershot. I think Rails demonstrates the point (as does Ubuntu) that choice isn't necessarily good: you want someone intelligent to make good decisions for you, so you can concentrate on important problems. I suppose that's why people have personal shoppers.

LUGRadio Live was great last Saturday, with Mark Shuttleworth and Bill Thompson being my highlights. Bill's talk was particularly good from an open source advocate's point of view, as he emphasised risk as a factor in choosing between open source and proprietary software. Bill's point being: if he chooses open source, he has far more control over risk to his project, as he is not locked into a vendor (providing he is prepared to familiarise himself with the codebase, or pay someone else to). I've been thinking about this a bit, and think I'll try to work this angle into my seminars from now on.

Garden birds

At the weekend I was delighted to see two sparrows in our garden, making use of the facilities. We get very few birds in the garden, because verminous cats swarm all over the local area. But these two had got through. I was particularly pleased because the sparrows landed on the purple loosestrife plants and ate up the froghoppers (a.k.a. spittle bugs) thereon. I'm glad I don't use chemicals in the garden, as it would have deprived the birds of a good meal.

Why MD5 may not be particularly secure

An interesting example showing how two meaningful, but utterly different, documents could end up with the same MD5 hash, and how this could be used as an exploit, written in plain English.

Books, books, books

I've recently been buying tons of second-hand books. Amazon Marketplace is fantastic, but another one you might not have heard of is Abebooks (OK, you probably have, as I'm normally the last person to find anything). This place is a central point for searching books from hundreds of sellers and buying them. The delivery times can be fairly long, as the US sellers seem to use surface mail which takes weeks, but I've got round this by ordering stuff this month which I will get next month, then ordering more next month when they arrive, ad infinitum... I've managed to find lots of obscure SF paperbacks by authors I've read in anthologies but whose books are fairly rare and out of print: people like Edward Bryant (Cinnabar is a gem) and Pamela Zoline (her The Holland of the Mind is a fantastic depiction of a crumbling relationship, mirrored in the rooms and streets of Amsterdam).

Ruby on Rails

I am loving Ruby on Rails so far. Ruby itself seems like a very neat language, fully object oriented (like Java), but still simple to write scripts (like Python), so the best of the two worlds I like to inhabit. Rails is a nice web framework which includes templating, caching, and code generation from database schemas for CRUD operations. Within about 3 hours, I'd managed to write an application which allowed me to display records from two related database tables, edit them, add new ones, and delete them. Rails needs some understanding of web application development, and some familiarity with Model-View-Controller is useful, but it was relatively painless to pick up. Though some of Ruby's syntax still eludes me.

So, deciding Rails is a good framework, I started thinking about building a web server with proper Rails support, and perhaps writing something useful with it (like a new blog engine or CMS, just what the world needs). By default, Rails works through CGI, but this is no good for production use as it's too slow; instead, I decided to venture into the world of FastCGI, another method for running rails, faster, more efficient and more secure than CGI. In the end, I built mod_ruby support into my XAMPP setup, installed the FastCGI module into XAMPP from source, installed FastCGI (fcgi) bindings for Ruby from source, and tinkered with my Rails code to make it use FastCGI. This article was a life-saver for getting this up and working. Now I have XAMPP with mod_ruby and mod_fastcgi, running my first Rails application. Once I've reached some level of proficiency with the framework, I plan to write up my journey, including all of this stuff. The notes are stacking up...

Kate Wilhelm

Just finished a thought-provoking book of short stories (Somerset Dreams) by Kate Wilhelm, who is not really science fiction through and through, more "speculative fiction" (as it says on the cover). Her work is very emotionally charged, and one interesting feature of it is how she manifests conflicts between or within characters (often caused by stultifying marriages) as supernatural entities: for example, in "The Hounds", two dogs represent the anxieties of the main female character, literally "hounding" her until she confronts her husband with her frustrations, at which point the threat disappears. In "State of Grace", a woman sees tiny creatures in a tree in her garden which no one is able to dislodge or capture. She uses their elusiveness to distract her husband, who is pressuring her into being a drudge, and by the end of the story the creatures are dictating her and her husband's sex lives. Very skilfully written, and good characterisation. Well worth a look.

My sister's blog and the mysterious tabular disappearance

My sister now has a blog (you'll need to join up to read it). Funny sort of blog engine which needs you to login before reading, but anyway.

Apologies if you tried to access my Drupal site over the weekend: one of the tables (storing caching information) strangely disappeared, which stopped the whole site from working. Nothing showed up in the logs, no error messages from PHP, so I only worked it out by chance (error message from mysqldump when it tried to backup a non-existent table). Just rebuilt the table and it seems OK now. Hopefully it's not a Drupal security hole someone exploited...

Music baton

Jono has passed on the music baton to me, so here goes.

Total volume of music on this computer: 8.7Gb

Last CD I bought: "Lover's Acid" - Luke Vibert

Song playing right now: "Map Ref. 41N 93W" - Wire

Five songs I listen to a lot, that mean a lot to me:

  1. "On Your Own Again" - Scott Walker
  2. "Dead Beat Descendant" - The Fall
  3. "Surf's Up" - the Beach Boys
  4. "You Hung Your Lights in the Trees" - Wire
  5. "We Have All the Time in the World" - My Bloody Valentine

Very few of my friends have blogs, so the baton may halt with me here... If you're reading this, feel free to pick it up, and send me a trackback.


I've been fiddling with two PEAR packages for PHP, PHPDocumentor and PHPUnit2. This is part of an attempt to make my PHP development more structured. These should provide, respectively, a unit testing framework and a system for documenting my code.

One annoying thing about PHP libraries is that they seem to have multiple incarnations (e.g. a PEAR homepage and another homepage), which reference different versions; and there are multiple libraries with very similar names which do similar things; plus the documentation is appalling in nearly all cases. It took me a while to hunt through the rubble to find what I wanted, but I got there eventually.

So, still using the trusty XAMPP (which bundles PEAR), I installed these two with a simple:

    /opt/lampp/bin/pear install --alldeps phpunit2
    /opt/lampp/bin/pear install --alldeps phpdocumentor

--alldeps ensures all dependencies of the packages are installed as well. I've toyed with PHPUnit and got that working satisfactorily (I think a howto may be in order before too long), but haven't got round to PHPDocumentor yet.

PEAR (and the related PECL) are noble attempts to pull together the morass of PHP libraries, but they are still very hard to dig around in. What's needed for PHP is a kind of "PHP Ubuntu", which sorts the wheat from the chaff and presents the "best of breed" libraries for particular tasks. Typically this will be the PEAR/PECL libraries, but occasionally there will be gaps or deficiencies in PEAR where you want to know what the good solutions are (e.g. Phrame for Model-View-Controller, Smarty for templating). I'm hoping that companies like SourceLabs might move into this area and produce an add-on for their AMP stack.

Looking for attractive personnel for your corporate event?

I had to blog this unusual company, who provide attractive, caring professional staff for events. Nicholas is my favourite, and would surely add a touch of class to any function. As the site states, he looks the part and oozes presence.

Syndicate content