A collection of technical articles, primarily on software and programming.
written on 16 Sep 2014 in category Python
A presentation of various problems and an effective solution for pickling Python collections with non-built-in types as keys and cycles or self references. Applies to dictionaries, default dictionaries, ordered dictionaries, sets, and ordered sets, at all levels of the pickle and cPickle protocol, in Python 2 and 3. The entirety of the implementation is available as an open source package python-restorable-collections.
written on 03 Aug 2014 in category Clojure
I investigate the performance of several Collatz sequence generation algorithms through profiling Clojure code, inspired by Project Euler Problem 14 (no spoilers as I won't show the solution number in this article, however, if you run the code you will get the solution as the return value). My approach focuses on the number of specific operations of interest rather than clock time (but clock figures are also discussed).
written on 29 May 2014 in category Python
written on 11 Aug 2011 in category Django
Due to opaque application loading semantics within the Django i18n code, several model classes may be imported before a
class_preparedsignal listener connects, resulting in missing the signal entirely. Specifically, connecting to this signal from an application which appears first in
INSTALLED_APPS, does not guarantee that it will execute when a class is first imported by any of the subsequent applications.
written on 05 Apr 2010 in category Django
Django's ORM creates multiple aliases for the same Model instance. In certain situations this may result in problematic behavior, as multiple operations on the same instance are interleaved, however, field access happens on different aliases of the instance, ultimately resulting in loss of updates.
written on 16 Mar 2010 in category Python
The following decorator will capture all available information regarding the method which invokes the decorated method (the invoked method).
written on 06 Feb 2010 in category Django
It is not possible to order a Django Model on a field of the Model acting as the intermediate
through = ...of a ManyToMany relation, because queries will not return items in the correct order, and in addition will include duplicate items, even when using
written on 27 Jan 2010 in category Django
When the optional
ordering = ...attribute of a Django Model's Meta class contains a GenericRelation from the Content Types framework, there is no way to eliminate duplicate items being returned, even when using
.order_by(...)is applied by the ORM only after the SQL
SELECT DISTINCTclause is built).