Book Review: Learning Website Development with Django

Reviewing The Definitive Guide To Django a few months ago I noted that the key place that book lacked was in examples. As befits the work of the creators of a framework, it did very well at explaining the underlying philosophies and working through all manner of implementation details, but it wasn’t the book for those who just want to dive in and build something. If that’s how you like to use technical books, then Learning Website Development With Django may be more what you’re looking for. ...

Book Review: The Definitive Guide to Django

Django is a framework I’ve long (in web years) held in some esteem, despite never having used it before the past few weeks. The framework’s creators’ many well reasoned contributions on all manner of debates about the web suggested a thoughtful approach, and the range of high quality sites powered by Django has kept growing, with the recent launch of EveryBlock being a prime example of its capabilities. So I was delighted to receive a copy of The Definitive Guide to django: Web Development Done Right for review. ...

Using the Django ORM as a standalone component

I’ve found myself working in Python lately, both for a new project and while preparing a review of the Django book. Working in Ruby I’ve become used to relying on ActiveRecord whenever I need to talk to a database (whether inside Rails or not) and after a little time refamiliarising myself with MySQLdb I realised I was going to need a decent ORM for this project. As well as being road-tested and well documented, I was also looking for something that could either generate its models on the fly, or had a tool to generate them from an existing schema. ...

Converting HTML to Textile with Ruby

One of the many tricky decisions to be made when building content management tools is how to allow users to control the basic formatting of their input without breaking your carefully crafted layouts or injecting nasty hacks into your pages. One approach has long been to provide your own markup language. Instead of allowing users to write HTML, let them use bbcode, or markdown, or textile, which have more controlled vocabularies and rules that mean it’s much less likely that problems will occur. ...

Link blogging

For a while now I’ve been wanting to set up one of those fancy del.icio.us posting things, whereby links I’ve added to my account during the day get posted to this blog each evening. But I use my del.icio.us account for a lot more than just topics that are covered here, and I don’t want to clutter it up. Nor did I want to have to switch between accounts to specify which links get posted where. ...

Rack: Layering Ruby Web Apps

I’ve not used it myself, but conceptually I’ve always been very interested in WSGI (the Python Web Server Gateway Interface). WSGI defines a standard interface between web servers and frameworks, giving python web applications the same portability that Java servlets enjoy, and also makes it much easier to layer code—with a standardised interface you can easily add in extra components to process your input and output before or after your main framework has handled it. ...

Better than BASIC?

David Brin complains about the difficulty of obtaining BASIC for modern computers, in a piece published yesterday on Salon. He’s been trying to teach his son to code, starting with simple algorithms and developing a good sense of what the computer is doing as it processes each step. Java and C++ are considered too complex for this purpose, and he seems to consider most scripting languages to be too high-level: The “scripting” languages that serve as entry-level tools for today’s aspiring programmers – like Perl and Python – don’t make this experience accessible to students in the same way. BASIC was close enough to the algorithm that you could actually follow the reasoning of the machine as it made choices and followed logical pathways. Repeating this point for emphasis: You could even do it all yourself, following along on paper, for a few iterations, verifying that the dot on the screen was moving by the sheer power of mathematics, alone. Wow! ...

Collage Mk. 2: Now With Separation

Last year I posted a few times about the aggregation code I wrote to allow Greenbelt to collect festival-related content scattered around the web and republish it. What I may not have gone into was how frustrating that code tended to be to work with, written in a rush before the festival and heavily patched while on site. This year, with longer to prepare, I decided to throw that one away and start again. I chose python as the language again, partly because I wanted to use some python libraries and partly because it seemed time to get some more python practice in. I also decided that rather than have the parsers for each service (currently technorati, del.icio.us, flickr, pubsub, and magnolia) each update the database, it was time for some abstraction and layering. ...

Feed Parser: Universal Feed Parser Tests

Inspired by Sam Ruby’s work on applying the Universal Feed Parser tests to the Ruby FeedTools, I’ve spent a little time this afternoon working on testing XML_Feed_Parser with that same test suite. There’s a lot of work to do! UFP’s tests consist of a series of feed files, some well-formed, and some illformed, with a description and test condition defined at the top of the file. eg. Example description So far all I’ve done is run a script through all the tests for well-formed feeds, testing whether XML_Feed_Parser throws an exception when I try and interpret them. When run against the current CVS, 1181 of the 1273 feeds parsed successfully and 92 failed. 68 of those failures were due to encoding problems (which I’ll try and work around, but won’t be able to cleanly fix until PHP has full unicode support), and another 17 were a result of not supporting CDF, leaving another seven I need to get fixed asap. ...

Greenbelt Collage Updates

After far too long a day of travelling I’m back in the US. The Festival was great, though as tiring as ever (jetlag compensated for the more relaxed on-site schedule). I’ve spent the day catching up on feeds and email, and tinkering with the collage code. For the most part it’s been working well and new content has been picked up pretty quickly, particularly since I added in a technorati watchlist for links to www.greenbelt.org.uk. The one exception was from flickr, where often there’d be more new photos between checks than were included in the feed, meaning that we only had ~100 of the 500 posted. As a quick fix I added the individual ‘greenbelt2005’ feeds for several of the more active flickr users, but now I’ve rewritten the code to use the flickr API to check for all new photos within the last 45 minutes (we check every half an hour, so 45 minutes should make sure nothing falls through the cracks) and pulls them in that way. ...