Author Archives: tb

Printing unicode to windows terminal from scratch (2.7)

Python 2.7 is dying, but still, here is a way to print a unicode string without requiring users to edit python stdlib files or changing code pages (both being both scary and inconvenient). I can’t imagine this being anything but … Continue reading

Posted in Uncategorized | Leave a comment

Pre-compiled binaries for PyCrypto 2.6.1 (py27) on Win7

There is a “new” version of PyCrypto out, and I can’t find any simple way to install it on Windows.  This is hardly news, and usually the Michael Foord has ready made windows installers over at Voidspace. To be totally … Continue reading

Posted in Python | 2 Comments

django :: list_display can’t sort on attribute of foreign key field…

I’m not the only one surprised by the fact that you can’t use the double-underscore-foreignkey-attribute-accessor syntax in list_display: [python] class MyModelOptions(admin.ModelAdmin): list_display = [‘fk_field__fk_attribute’] # ILLEGAL [/python] There has been extensive discussions on the tracker (https://code.djangoproject.com/ticket/5863) and on the mailing … Continue reading

Posted in django | Tagged | 2 Comments

python :: Calculating the distance between two locations…

How far is it from point a to point b? There are complicated ways to answer this question, that e.g. takes into account whether you’re walking or driving etc. However, if you only need the approximate distance “as the crow … Continue reading

Posted in Python | Leave a comment