Entries published in June 2006
For the second time, Mark Pilgrim has written up a list of his “essential” software (for reference, here’s the first time). It being Friday, the day when bloggers around the world veer off and post things of very little relevance to important world issues, I feel compelled to do the same.
Wherever I go, there they are
I work with two operating systems on a regular basis: Mac OS X and Ubuntu GNU/Linux. Obviously there are going to be some disjoints between the sets of applications I use on the …
Django tips: the difference between ‘blank’ and ‘null’
New users of Django, even people who have lots of experience writing database-driven applications, often run into a seemingly simple problem: how do you set up a model with “optional” fields that don’t always have to be filled in? Django’s validation system assumes by default that all fields are required, so obviously you have to tell it which fields it’s OK to leave blank.
But therein lies the problem: there are two different ways you can “leave it blank”.
For the most part, assuming that fields should be required is a …
Levels of openness knowledge
You were upset when you heard about the DRM “lock-in” of Apple’s iTunes Music Store, so you burned all those locked-up files to CDs, then ripped them back in Windows Media Player. As WMA. You can’t play them on your iPod anymore, but at least you can play them on all the other portable music players you own.
You blog on MySpace. But you keep links on your MySpace page to your old LiveJournal and your old Xanga blog, so people can still read all your old entries there …
Let’s talk about Python and Ruby
As a result of various things I’ve been reading up on recently, I’ve been exposed to far too many Python vs. Ruby flamewars. As someone who’s used both languages (though I’ve got much more experience with Python, and a Python-based framework is now how I make my living), I think they both solve similar problems in slightly different syntactical ways, and are pretty much equivalent on functionality.
But the debates, when they happen, always seem to come down to a few tired old arguments that just don’t hold up.
Ruby people say:
- “ …
Upgrading to Ubuntu 6.06
I’ve been a Linux user for about six years now; I started out with Red Hat while I was in college, and then a little over a year ago I jumped ship to Ubuntu because smart people kept talking about how nice it was.
Overall, my experiences with Ubuntu have lived up to that; Ubuntu does an amazing job of being both a great development platform and a good desktop operating system. That’s no mean feat. So naturally I was looking forward to upgrading to the recently-released version 6.06, code-named “Dapper …
Django tips: Template context processors
Last time around we looked at how to write an effective template tag, with the focus on writing a flexible template tag that would make it easy to pull in various types of recent content in any page; I use a tag similar to the one in that entry to pull out the recent entries, links and comments in the footer of every page on this site.
For situations where you want to get content out of your database, a template tag is typically the best way to go, but …
How Django processes a request
In a comment he left yesterday, Jonathan Snook posed an excellent challenge: document the chain of how Django processes a request, from start to finish, with plenty of detail on the various things being called internally and links to the appropriate documentation.
Simon Willison once wrote such a document, but it was a fairly high-level view and a fair number of things have changed since then, so I’m going to take a stab at it myself, and hopefully the result will be comprehensible.
Note: this is a first draft. Not …
Let’s talk about frameworks: When frameworks aren’t right
I know, I know, I said I was done with the series. But there’s one more thing I’ve been feeling like I should have mentioned: when frameworks aren’t the right choice for a project.
The big belly, revisited
Remember that image? It shows the types of projects for which I think frameworks are a good choice, the 80% or so of web projects which can all be handled by a database-driven application and gradual scaling of the hardware. Which, logically, indicates that other types of projects — basically, those which aren’t in …
Installing the GIMP
Anil Dash has written up some complaints about installing the GIMP on Windows.
Special care should be used while reading that, because he does go through several very valid points:
- The GIMP should bundle the GTK libraries it requires, and install them if they’re not present.
- The process of choosing a mirror from which to download a package, while extremely common for software which doesn’t come from companies with multi-billion-dollar market caps, could easily be hidden away by an automated system.
- The GIMP installer screen are hideous to look at and badly designed.
But his …
Django tips: Write better template tags
Django‘s template tags are a great way to handle things that don’t always make sense being in a view. If you want to have, say, a list of recently-added content which appears in a sidebar or footer on every page of a site, it’d be crazy to manually change every view to fetch that content and add it to the template context; a template tag is definitely the way to go.
For example, in the footer of every page on this site, I pull out the five most recent entries, …
Django tips: extending the User model
One of Django‘s great strengths is its built-in user and authentication system; the bundled application
django.contrib.auth includes models for users, user groups and permissions and views for logging users in and out and changing and resetting their passwords. This is enough to cover the needs of a huge number of sites and, after the admin, the auth system is probably the most popular bundled application Django ships (or maybe the other way around, since the admin requires the auth system to be installed).
Because of the auth system’s popularity, though, …
Templating languages redux
So, I thought I’d explained why templating languages are pretty useful things. Markup is, after all, just about the fastest and simplest way to, well, mark up content for presentation and, when coupled with a small amount of logic, is by far the best way to present the output of a dynamic database-driven web application. I kind of hoped that I wouldn’t have to write more on the topic, because there are so many more interesting things to which I can devote my time.
Sadly, I was mistaken. Enter one …
Let’s talk about frameworks, DBA edition
In the previous entry in this series I took a look at some common criticisms programmers level against the new generation of web-development frameworks. Today I’ll be following up in somewhat the same vein, by expounding on something that might lead your friendly local database administrator to look somewhat askance at how these frameworks do things.
And let me say right now, before I ruffle anyone’s feathers, that when I talk about applications and databases below, I won’t be talking about any particular application or database. I’m not engaging in thinly-veiled …
Let’s talk about frameworks, programmer edition
In the previous entries in this series I’ve been talking mostly about the benefits of the new web frameworks that have been popping up over the last year or so. And from a programmer’s perspective, there are certainly a number of benefits:
- Speed. Because a framework gives you a solid foundation of code for common functions, it also gives you a pretty big head start on a new project. Generic data modeling and object-relational mapping, coupled with solid data-access APIs give you an even stronger boost, cutting development time significantly.
- Flexibility. …