Friday, June 18, 2010

Search pages should not use POST

This'll be a short post, because it's a simple thing. If you're writing a web site search form, it should not use HTTP POST to submit the query. This breaks the back button ("do you want to resubmit?") and is a poor fit for the semantics of the HTTP requests. What you want to use is a regular GET request.

The main problem with this is that sometimes you don't want people to resubmit a search form because searches are computationally expensive. The solution is not to make searching more painful; the solution is to cache the results on the server for a few minutes with memcached. It's easy to install and use, very fast, and popular enough to be widely available. Use memcached and HTTP GET requests, and your web site will be closer to Just Working.

Wednesday, June 9, 2010

91 Free Icons from Dmitry Baranovskiy

Dmitry Baranovskiy, the author of the excellent Raphaƫl JavaScript vector graphics library, made a bunch of nice icons. Then he gave them away to everybody, but not in the formats most people would like. I wrote some Python code to convert them to SVG and PNG files in various sizes.






If you want to convert them to some other image size, you'll need librsvg and optipng. I tried using ImageMagick, but it wouldn't convert some of the SVG files correctly. As for optipng, I assume that you'll want the PNG files to be small and load quickly. If you don't have optipng or don't want to use it, just comment out the line in rasterize.py that runs it.