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.
Garbage collection, in a very real sense
Use and abuse of the “with” programmatic statement to make your Django template code less mad.
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 [...]
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, [...]
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 [...]
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 [...]
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. [...]
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 [...]
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 [...]
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 [...]
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 [...]