Tornado’s secure cookie support in Flask

I’ve recently had the chance to write a new project on AppEngine. It’s been a long time since I tried I was too lazy (as always) to setup servers just for that. I’ve decided to use Python but just to be sure I won’t be vendor locked into various AppEngine services I’ve decided to use: Flask (instead of webapp2) Cloud SQL (instead of DataStore) This will ensure that I can break out of AppEngine easily with minimal code changes. [Read More]

Python Implementation of Twitter’s Snowflake Service

A while back Twitter announced the Snowflake service. Snowflake is a unique ID generator that is fast and generate 64bit integer unique ids that are “roughly sortable”. That is, newer ids are bigger than older ones, up to a certain point. The service was originally written in Scala (which runs on the JVM) and has a Thrift interface, which means you can talk to it from almost any thinkable programming language. [Read More]

Determine if an Email address is Gmail or Hosted Gmail (Google Apps for Your Domain)

For my latest venture, MyFamilio, I needed to know if a user’s Email address is a Gmail one so that I could show the user his/her contacts from Gmail. Figuring out if the user is on Gmail is usually easy – the Email ends with But what happens for all of those Google Apps for Your domain (like my own, which uses the domain) ? Well, you can easily detect that by running a DNS query on the MX record. [Read More]

Extract GPS Latitude and Longitude Data from EXIF using Python Imaging Library (PIL)

I was searching an example of using Python Imaging Library (PIL) to extract the GPS data from EXIF data in images.

There were various half baked examples that didn’t handle things well, so I baked something of my own combining multiple examples.

You can get it here:

Or see it embedded below:

Disco Tip – Crunching web server logs

At my day job we use Disco, a Python + Erlang based Map-Reduce framework, to crunch our web servers and application logs to generate useful data. Each web server log file per day is a couple of GB of data which can amount to a lot of log data that needs to be processed on a daily. Since the files are big it was easier for us to perform all the necessary filtering of find the rows of interest in the “map” function. [Read More]

New programming languages forces you to re-think a problem in a fresh way (or why do we need new programming languages. always.)

Whenever a new programming language appears some claim its the best thing since sliced bread (tm – not mine ;-) ), other claim its the worst thing that can happen and you can implement everything that the language provides in programming language X (assign X to your favorite low level programming language and append a suitable library). After seeing Google’s new Go programming language I must say I’m excited. Not because its from Google and it got a huge buzz around the net. [Read More]

Google AppEngine – Python – issubclass() arg 1 must be a class

If you are getting the error “”issubclass() arg 1 must be a class”” with Google App Engine SDK for Python on Linux its probably because you are running Python 2.6 (and will probably happen to you when you run Ubuntu 9.04 – 2.6 is the default there).

Just run the dev server under python 2.5 (i.e. python2.5

My first post using a Blog Editor

I’ve decided I wanted to find a reasonable blog editor to post from instead of using the web interface of Blogger (which is nice, but not THAT nice) After long searches and going through a lot of blog editors (some even cost money) I’ve found this one which is called Zoundry which is even written in Python. It has some neat features in it like: Tags support – including support for Technorati, Del. [Read More]