Category archives: Snaking
Discussions of programming, particularly of programming Python
Cross-database relations in SQLAlchemy?
Written by
on
in
Snaking.
Set out to make an app use two different databases today; one for a high-write-volume set, the other for low-volume mostly-read set. It's a TurboGears 2.0 application using SQLAlchemy. I'd half-way hoped for "tell these tables they're in that db" and then have the ORM figure out all the magic of which session to use ...
Dreaming of deterministic profilers future...
Written by
on
in
Snaking.
- High resolution, accurate, captured data (obviously)
- Trace every line executed (yes, every line)
- Trace every call operation, i.e. CALL #32 of function #45 took 0.0003s and have a record of CALL #32 which details what *it* called, its timing, ...
PyCon recordings seem to suffer from link-rot...
Written by
on
in
Snaking.
Searching for links to some of my presentations from PyCon (particularly the audio/video). Lots of links to no-longer-existing pages at PyCon.org. There's an unofficial mirror that at least covers back to 2009, but most of the older stuff seems to have black-holed.
New release of globalsub is out
Written by
on
in
Snaking.
Globalsub is a mechanism to allow you easily replace an object throughout your interpreter. This is normally done to make it easier to test. You can stub out objects which have side effects for most of your tests and just test those functions in carefully isolated environments. It comes from the Mocker codebase originally, but ...
KDE seems to have stabilized... I suppose I should break it
Written by
on
in
Snaking.
After the hiccups of a few days ago where suspend/resume didn't work for a day or so, my laptop seems to have settled into a happy place. Suspend/resume is now working, and I haven't had any hard-hangs where the machine becomes unresponsive (which was why I upgraded to the backported KDE 4.7.1). Which is to ...
The PyCon Presentation Proposal Deadline is Upon You!
Written by
on
in
Snaking.
You don't need to be an expert on something. It doesn't need to be something obscure.
Talk about how to use a debugger effectively. Talk about how using a debugger is a crutch for those too weak to use TDD. Talk about how TDD is a crutch for those too insecure about their code to ...
Find Equivalent Timezones with pytz?
Written by
on
in
Snaking.
Ran into a little problem today that requires being able to see what timezones (of the Linux-ish America/Toronto, America/Montreal variety) are equivalent to one another.:
#! /usr/bin/env python
"""Stupid little script to find equivalent timezones"""
import pytz, pprint, pickle, datetime
all_timezones = [pytz.timezone(name) for name in pytz.all_timezones]
def search():
now = datetime.datetime.now()
set = {} ...
Django Model Forms made easier...
Written by
on
in
Snaking.
Django model forms are already easy. How could they be easier?
@decorators.with_X( request, model_class, key, url_field, parameter, required=True )
def my_view( parameter ):
We also use decorators that do x.y lookup on another parameter (i.e. lookup a particular object in the fields of another object based on ids (root_object.field.get( id=...))). Sure, it winds up hitting ...
PyDispatcher runs on Python 3.2 now...
Written by
on
in
Snaking.
PyDispatcher is one of those projects that's been in "just works" mode for a long time which needs to be updated to work on Python 3.x if I'm going to be able to test much of my software there. PyDispatcher is the glue that keeps OpenGLContext/PyVRML97 together. It's also the ancestor of the Django signals ...
RunSnakeRun begins to get a memory...
Written by
on
in
Snaking.
By popular demand (well, one user so far), I've added rudimentary support for window state storage to RunSnakeRun. There's lots more state that could be stored, but for now it just stores the window position, size and maximization. Should be considered an alpha-level feature for now, as it is untested on Win32 or OSX. ...