Simon Willison’s Weblog

Subscribe

August 2008

Aug. 12, 2008

Django snippets: RequestFactory. I’ve been wanting this for ages; when I finally got around to writing it it turned out to only be a dozen or so lines of code. Makes it easy to create mock request objects in Django, which you can then use for testing view functions directly (bypassing the current test client mechanism which requires views to be assigned to a URLconf before they can be tested).

# 12:40 pm / django, testing, requestfactory, code, python, httprequest

Fire Eagle has launched! No need for an invite any more, hooray!

# 9:33 pm / fireeagle, location, yahoo

Aug. 13, 2008

The statement that the password anti-pattern "teaches users to be phished" should be rephrased "has taught users to be phished"

Me, on Twitter

# 12:52 pm / twitter, passwordantipattern, phishing, security

Underscores are now word separators, proclaims Google. I missed this story last year—the change was announced by Matt Cutts at WordCamp 2007.

# 1:06 pm / matt-cutts, wordcamp, wordpress, google, underscores, hyphens, seo

Keyczar (via) New open source cryptography toolkit from Google, designed to get algorithm selection, key rotation and versioning right so you don’t have to. Java and Python versions are available; the Python version depends on PyCrypto.

# 1:20 pm / pycrypto, python, google, encryption, keyrotation, ben-laurie, java, keyczar

Around the world and back again. Flickr are using data from OpenStreetMap to provide street-level detail of Beijing for the Olympics.

# 11:05 pm / openstreetmap, mapping, flickr, beijing, china, olympics

Aug. 14, 2008

Free licenses upheld by US “IP” court. Free software and CC licenses which dictate conditions that, when violated, turn you in to a copyright infringer now have precedence in US law.

# 9:33 am / law, uslaw, creativecommons, freesoftware, open-source, licenses, copyright, lawrence-lessig

ECMAScript Harmony. John Resig explains the outcome of the recent “Oslo meeting” where proponents of ECMAScript 3.1 (incremental improvements to JS as it exists today) and 4 (massive, sweeping changes including many new programming constructs) harmonised their differences. The combined effort is closer to 3.1 than it is to 4, which I think is the right decision.

# 9:37 am / john-resig, ecmascript, oslomeeting, javascript, harmony

OAuth came out of my worry that if the Twitter API became popular, we'd be spreading passwords all around the web. OAuth took longer to finish than it took for the Twitter API to become popular, and as a result many Twitter users' passwords are scattered pretty carelessly around the web. This is a terrible situation, and one we as responsible web developers should work to prevent.

Blaine Cook

# 10:01 am / security, passwords, phishing, oauth, blaine-cook, twitter, twitterapi

YUI 3.0 Preview Release 1. YUI sandboxing is a really good idea, which cleverly addresses both the need to run multiple versions of the library at once and the complaints about how verbose traditional YUI code can get.

# 10:03 am / yui, sandboxing, javascript, yui3

This Week in Django. After 33 episodes Django’s usually-weekly podcast finally has its own website.

# 2:57 pm / thisweekindjango, django, python, podcasts

Aug. 15, 2008

If it's easy to make all your calls conform to the RESTful verb architecture, then that's good, I guess. But if not, then just use a POST as an RPC call, keep it as simple as possible and be done with it. And don't spend another minute worrying about being RESTful or not.

Damien Katz

# 8:07 am / restful, rest, damien-katz, http, web-services, post, rpc

REST, I just don’t get it. Read the comments for some excellent practical reasons to care about REST, including cache management (PUT and DELETE can expire the cache entries for the corresponding GET), the ability to add or move parts of the server API without redeploying client libraries and the idempotency of GET / PUT / DELETE and HEAD (repeated POST operations may have side-effects).

# 8:20 am / rest, damien-katz, post, get, put, delete, caching, idempotency

minidetector. Neat piece of Django middleware that adds a “mobile = True” attribute to the request object if the request’s user-agent matches a list of strings of known low-power browsers in mobiles, PDAs or game consoles.

# 8:21 am / minidetector, middleware, django, python, mobile

Aug. 16, 2008

Domain-Driven Design in an Evolving Architecture. How the team at guardian.co.uk used Domain-Driven Design in their recent two year rebuild. The core of DDD is having end users involved with domain modeling, which results in a shared domain language that should be understood by everyone involved.

# 1:35 pm / ddd, domaindrivendesign, guardian, modeling

АЭРОКРАТ КОНЦЕПТ (via) Another great Airship blog. I don’t speak Russian, but the photos and videos speak for themselves.

# 11:50 pm / airships, russian, zeppelins

Aug. 17, 2008

I can't question that [the App Store] is probably the best mobile application distribution method yet created, but every time I use it, a little piece of my soul dies.

Steven Frank

# 11:15 pm / steven-frank, appstore, apple, iphone, mobile

Explaining REST to Damien Katz. I didn’t know that it was Mark Baker back in 2002 who first pointed out that SOAP was flawed because it ignored the architecture of the Web as defined by Roy Fielding’s Ph.D thesis.

# 11:19 pm / mark-baker, rest, soap, dare-obasanjo, royfielding, history, damien-katz

Aug. 18, 2008

Dare left something out (and it’s important). Dave Winer: “You should at least learn the lessons and add to REST what it needs to catch up with XML-RPC. Seriously. What’s missing in REST, btw, is a standard method of serializing structs, lists and scalar types.” That would be JSON.

# 9:39 am / json, dave-winer, rest, xml-rpc, dare-obasanjo

Cyberstar. Adrian made the front cover of the Chicago Tribune magazine!

# 11:56 pm / adrian-holovaty, django, everyblock

Aug. 20, 2008

UnicodeDictWriter—write unicode strings out to Excel compatible CSV files using Python. Stuart Langridge and I spent quite a while this morning battling with Excel. The magic combination for storing unicode text in a CSV file such that Excel correctly reads it is UTF-16, a byte order mark and tab delimiters rather than commas.

# 12:19 pm / excel, csv, internationalisation, i18n, byteordermark, python, stuart-langridge, unicode, unicodedictwriter, utf16

Facebook engineering notes on Scaling Out. Jason Sobel explains a couple of tricks Facebook use to deal with consistency between their California and Virginia data centres. The first is to hijack the MySQL replication stream to include information about memcached records to invalidate; the second is to use Layer 7 load balancers which inspect a “last modification time” cookie and send users to the masters in California if they have updated their profile in the past 20 seconds.

# 11:51 pm / facebook, scaling, memcached, mysql, replication, jason-sobel

Aug. 21, 2008

SecondLife rolls out Mono-powered servers. Most of the work on this was done in Linden Lab’s Brighton UK office. If you’re interested in Mono and want to live in Brighton, they’re hiring!

# 9:45 am / secondlife, mono, lindenlab, migueldeicaza, jimpurbrick

querySelectorAll in Firefox 3.1. John Resig benchmarks the various JavaScript libraries’ support for querySelelectorAll, and finds an impressive 2-6x performance improvement over native DOM traversal. It’s worth clicking through to John’s experimental plugin for adding support to jQuery, which does a clever trick using __proto__ to convert the collection returned by querySelectorAll in to a jQuery object in browsers that support it.

# 9:50 am / jquery, proto, john-resig, javascript, queryselectorall, selectors, firefox

Unfortunately, we're not cool enough to run on your OS yet. We really wish we had a version of Photosynth that worked cross platform, but for now it only runs on Windows.

Install Photosynth page

# 10:07 am / copywriting, microsoft, photosynth, windows

Amazon Elastic Block Store (EBS). EC2 just got a whole lot more useful—you can now create “block level storage volumes” (think virtual hard drives) and mount them to an EC2 instance for real persistent storage—but because they’re virtual you can clone them, snapshot them and benefit from automatic replication.

# 10:15 am / amazon, ec2, ebs

Package Management Sudoku. “A package management system that can solve Sudoku based on package dependency rules is not something that I think would be useful or worth having”—like a red flag to a bull.

# 7:09 pm / sudoku, debian, funny, apt

Persistent Django on Amazon EC2 and EBS—the easy way. Useful tutorial on getting Django up and running on EC2 with EBS for a persistent PostgreSQL database.

# 9:32 pm / aws, ec2, amazon, ebs, django, python, postgresql

django-timezones. Models, form fields and a template filter for dealing with timezones in Django.

# 11:18 pm / django, timezones, python