Variable assignment in Django templates, sort of May 29th, 2008

Use and abuse of the “with” programmatic statement to make your Django template code less mad.

Django laziness at all levels May 12th, 2008

Following on from Simon Willison’s recent post about Django’s ORM, I’ve found both the lazy evaluation and chaining properties of Django’s querysets to be really useful quite deep within Django’s own view-layer framework.
Django has its own library for building forms, currently called newforms (to distinguish it from the old library, deprecated but left around for [...]

Deserving of a serious LAMPing March 31st, 2008

The LAMP-stack community frequently shows their disdain for foreign and primary keys in databases, and sometimes with reason borne of experience. MySQL historically has been little more than a nice language for comparing a set of unrelated spreadsheets, so referential integrity has had to happen at the application layer or not at all. As such, [...]

FixMySpine January 18th, 2008

FixMyStreet is getting some great press, this time a Guardian article comparing it favourably to Facebook. We were lucky to have Tom Steinberg at the fourth Oxford Geek Night, and his plucky lieutenant Matthew Somerville (I may get in trouble for that) back at the third OGN. They’re both fascinating speakers (and I still turn [...]

“You have to have something bad happen to you” January 7th, 2008

Steve Yegge on code’s worst enemy:
… This brings us to the second obviously-bad thing that can go wrong with code bases: copy and paste. It doesn’t take very long for programmers to learn this lesson the hard way. It’s not so much a rule you have to memorize as a scar you’re going to get [...]

A complex CCK module in Drupal September 20th, 2007

CCK is Drupal’s way of making rich content. It means that nodes of any content type can have any kind of data attached to them, so you can have e.g. a directory of superstore outlets, where the outlet records have their longitude and latitude (editable by a Google Map widget) whereas the contact records (e.g. [...]

Team Drupal FTW! June 26th, 2007

Coming to the end of the Drupal project on which I’m currently working, I spotted someone else’s brand new site on drupal.org: TeamSugar.
The hallmark of a good frameworked site is that it’s not easy to guess which framework was used, and TeamSugar manages that admirably. While I can’t really comment on the design—I find most [...]

Save our servers! June 11th, 2007

Sick and tired of getting a million hits, all to the same page, which more often than not hasn’t been updated in the mean time? Want to reduce your bandwidth and server-time loads without necessarily impairing your visitors’ experience of your site?
If you haven’t ever had cause to use it, there’s a standard called ETag [...]

Now that’s magic (quotes) August 15th, 2006

If your web application ensures that all your incoming CGI variables are free of the most common source of malicious site damage, can you stop worrying?
I wondered this as I got far enough into a PHP publishing system that I had to start thinking about adding new content through the system (rather than just jamming [...]

This space intentionally left blank July 11th, 2006

I’ve been asked a couple of times recently, as part of separate projects, to split the results of a SQL query on whitespace within. Simply put, how does one go from:
foo
foo bar
quux
blort wuu spong

to the expanded form:
foo
foo
bar
quux
blort
wuu
spong

efficiently and cleanly, only using SQL? (In case anyone’s worried, I’ve scrubbed the data sets of any personal details [...]