Daniele Esposti's Blog

Build 64-bit Skia on Mac OS X

It takes me a while to discover how to do it, so I’ll leave this post as a note to myself and to anyone which will have the same need. By default Skia will be build as 32-bit static library under Mac OS X but for who needs to have...


Beware of keyword's default values

Look this class definition, do you see what’s is wrong and potentially generate big problems in you code? class Foo(object): def __init__(self, bars=[]): self.bars = bars <!–more–!> Before jumping straight to the solution lets play with some instances of that class: >>> foo1=Foo([1, 2, 3]) >>> foo2=Foo([3, 4, 5]) >>>...


Parallel data processing

Developing an application or script which process data is a straight-forward pattern: data is collected, processed and the result is provided to be stored in a file or database. Those three blocks (collect, process, store) forms a pipeline and in the old days this pipeline is implemented in a series...


Build PyQt4 into your virtualenv

Here I’ll show the steps to build and install PyQt4 inside a virtualenv. These instructions are related to Mac OS X and Linux systems only. SIP First build and install the SIP binaries: $ cd sip $ python configure.py --incdir=${VIRTUAL_ENV}/include $ make -j2 $ make install The ${VIRTUAL_ENV} environmental variable...


Object's instance key in SQLAlchemy

In SQLAlchemy you can query the database returning ORM objects instead of raw data from the SQL statement (if you don’t know about it this is a good starting point). Object can be fetched by the value of their primary key: session.query(<class>).get(<primary_key_value>) which returns an instance of class with the...