Moving House…

December 15th, 2009

For various reasons, I’m moving my blogging activity over to pythoneering.blogspot.com; anyone still reading this blog should head over there in future.

XML hate

March 14th, 2009

Had a need to download and install html5lib the other day, and was most amused to find a module called ihatexml.py lurking there in the source code!…

On CDs vs. downloads, packaging and artwork…

March 10th, 2009

The release of a new album by a favourite band or artist seemed much more of a special event back in the days before CDs and music downloads. 12-inch vinyl was the medium, so the album sleeve was a decent size, with bigger and more comprehensive artwork than we’ve been accustomed to seeing since CDs took over from vinyl. I used to love pouring over every detail of a new album’s sleeve while I listened to it for the first time. Gatefold sleeves were the best, giving you four surfaces that could be covered with artwork, photographs, song lyrics and obscure details about the instruments used by the band members…

CDs pretty much killed all of that for me. Sure, you could shrink everything down to jewel case proportions - even make the CD insert into a booklet containing more words and pictures than would be found on the typical gatefold sleeve. But somehow, it just wasn’t the same. The fact that a magnifying glass was often needed to read everything might have had something to do with it.

Now, in the brave new world of music downloads, things are even worse in this regard. A PDF of the booklet that would have come with the physical CD is just not as satisfying as having the actual booklet in your hands, which in turn is not as satisfying as opening up the gatefold sleeve of a 12-inch vinyl LP.

As we move into a digital future, we’ve all but lost the tactile element of being a music consumer. CDs may have been more convenient than vinyl and may have sounded better (without high-end equipment, at least), but there was something special about the look, feel and even the smell of a vinyl album and its packaging that CDs just couldn’t duplicate. And now, with downloads, there’s nothing there at all!

Fortunately, some of my favourite musicians are trying their best to buck the trend. I recently purchased a beautifully-packaged release of Steven Wilson’s solo album Insurgentes, in the form of an 11×11-inch cloth-bound book containing 2 CDs, 1 DVD and 120 pages of colour photographs - brilliant stuff! Marillion’s recent Happiness Is The Road was also made available to fans as a special release - a slip case containing two hardback books, each with a disc and a collection of impressive artwork.

Although this special packaging is expensive - Happiness Is The Road cost me three times as much as a digital download - I, for one, think it is worth it.

PyCon UK 2008

September 15th, 2008

PyCon UK 2008 has been and gone and, once again, it was an intense and stimulating experience. Our presentation - a follow-up to the one we gave last year - seemed to go well. Once that was over, it was possible to relax and enjoy the other sessions.

The keynotes, from Mark Shuttleworth on Saturday and Ted Leung on Sunday, were both interesting. I picked up a couple of very useful tips from Simon Willison’s demo of advanced Django admin customisations, and it was great to talk to other Djangonauts in Sunday morning’s Django BoF.

Other talks of note included Jonathan Hartley’s demos of pyglet - something I must check out soon as a potential alternative to Pygame - and John Pinner’s entertaining account of how he made his central heating system Python-powered. However, the highlights for me were probably the talks given by Raymond Hettinger. Raymond’s introduction to descriptors and how Python’s dot operator works was truly enlightening, as was his presentation on doing AI with Python. He presented with great enthusiasm and explained the difficult concepts clearly and concisely.

See my PyCon set on Flickr, or the PyCon UK photo pool.

HDR Fun

August 14th, 2008



Ashbourne Tunnel Interior

Originally uploaded by Nick Efford

I’ve been experimenting with HDR imaging lately. Here’s a recent effort at enhancing the interior of a dimly-lit former railway tunnel in Derbyshire.

Olympics BSOD

August 12th, 2008

This made me laugh quite a bit.

Fingers crossed…

July 10th, 2008

I’ve just moved my various small Django projects across to newforms-admin. So far, so good…

Review: Practical Django Projects

July 9th, 2008

James Bennett’s Practical Django Projects is, by my count, the fifth book on Django to make it into print, but it is distinctly different from its predecessors.

The best of those predecessors, Adrian Holovaty’s and Jacob Kaplan Moss’ The Definitive Guide to Django (also published by Apress) continues to serve both as a reference and as an excellent introduction to the framework, detailing the philosophy behind Django and explaining how it differs from its rivals. However, The Definitive Guide is very much a ‘bottom-up’ book, exploring each of Django’s components individually by means of small examples. James has, interestingly, adopted the complete opposite approach in Practical Django Projects. The result is a book that complements The Definitive Guide superbly. This is essential reading for anyone wishing to step up from merely experimenting with Django to actually doing serious work with it.

Early Material

James’ approach is to guide the reader through the construction process for three realistic web applications: a simple CMS, a fully-featured blog and a site for uploading and rating code snippets. The first of these examples is the smallest, spanning Chapters 2 and 3 of the book. This example serves partly as a very basic introduction to key features of the framework - project configuration, the admin app, views, templates and models - and partly as a powerful demonstration of how a genuinely useful application can be constructed mainly from components already present in Django (in this case, the admin and flatpages apps), with barely any additional code.

James doesn’t leave it at that; in what is to be a recurring theme of the book, he makes his CMS more useful and interesting by also incorporating a third-party component - in this case, the TinyMCE JavaScript rich text editor, which is used in a customised admin template to enhance flatpage editing.

The Blog Example

The book is dominated by the second example app, a blog, which is developed over the course of the next four chapters. The basic data models, templates, view code and URL configuration needed to deal with blog entries are discussed in detail in the first of these chapters. This chapter also demonstrates the value of generic views and explains how to decouple an app’s URL configuration from that of the project that hosts it.

Subsequent chapters introduce the concepts of data model managers, template inheritance, custom template tags and Django’s signals mechanism. James very sensibly avoids covering every last detail of these advanced features; after all, you can go to The Definitive Guide or the excellent built-in/online documentation for that. The important thing is that these features are introduced in the context of a real application, making it much easier to appreciate the benefits that they bring.

Once again, James takes the opportunity to demonstrate how third-party components can be used to enhance an application - in this case, providing the ability to write entries using Markdown syntax, submit blog links to del.icio.us and filter comment spam using Akismet. The final version of the blog even has the ability to generate Atom feeds for links and entries that have been posted to it. It really is a fully-featured application, lacking only the CSS and JavaScript required for a professional look and feel. (A suitable stylesheet is supposed to be available from the Apress website, along with all of the source code described in the book, but this material wasn’t available at the time of writing this review.)

The Last Four Chapters

The final example app reinforces the techniques discussed in earlier chapters. Further advanced features of Django are also introduced - notably the customisation of ORM queries with extra SQL and the development of more complex template tags that have to parse ahead in a template - but the app serves mainly as a vehicle for introducing Django’s form processing capabilities. James gives a very thorough explanation of form validation here, which may clarify things considerably for less experienced Djangonauts.

The last chapter of the book is in some ways the most valuable of all. In it, James takes a step back from the code to provide general advice on how you can make it easier to reuse apps in other projects. Readers of his blog will have come across some of his advice before, but it is useful to see all of this material collated, expanded and on the printed page.

Conclusions

Practical Django Projects is a valuable addition to the growing library of books on the world’s best web application development framework. It isn’t a work of reference, but it is an excellent and detailed guide to the construction of flexible and reusable apps that make effective use of Django’s extensive capabilities. It could certainly serve as a good, top-down introduction to Django for someone with a background in other web frameworks and some prior experience of Python, although it isn’t a replacement for the more detailed exposition of Django design principles to be found in The Definitive Guide to Django.

No book is perfect, and this one has a few minor problems. There is the odd typo to be found in the text and the code examples which could trip you up if you are working through the example apps, and the use of third-party components needs to be explained a little more carefully, particularly with regard to which versions are required. (For example, I found out the hard way that the existing version of the markdown library on my Ubuntu machine wasn’t compatible with the blog app.) However, these minor flaws detract little from what is the new ‘must-have’ purchase for the beginner- to intermediate-level Django developer.

Practical Django Projects is here

July 2nd, 2008

James Bennett’s Practical Django Projects arrived in the post yesterday and it looks pretty good. I’ll post a proper review here later - I’m off sick today and don’t feel up to writing much :(

Bastards

June 1st, 2008

Scum

Yeah, right...