Category archives: Snaking

Discussions of programming, particularly of programming Python

RSS feed of Snaking

Py_buffer underwhelms so far

I spent this evening getting the Py_buffer support in PyOpenGL worked through the codebase.  Originally I'd converted the numpy handler to use Py_buffer when in non-accelerated mode, but in the end it didn't provide much of anything other than the occasional "duh" moment where a piece of code assumed that you could treat an output ...

Continue reading

PyOpenGL Py_buffer Support Moving Forward

I've been getting the Py_buffer protocol based format handler for PyOpenGL implemented. The actual handler for buffer-providing types is pretty simple, and the numpy handler is now rewritten into a tiny subclass that just provides a "zeros" method and some "coerce to contiguous" code.  Not yet ready for prime time, and needs accelerator support still, ...

Continue reading

pip/pytz fails with 1.4 and 2013b

We happened to be building a new build server today, and one of the steps in the process is to install packages.  We download all of the packages to local disk in one step (pip install --download ${packages}), then install them in the next step (pip install --no-index --find-links ${packages}).  Thing is, while pytz downloaded ...

Continue reading

ctypes + PyBuffer?

Chris Barker asked about having a PEP 3118 format handler for PyOpenGL. I've played around with this in the past, but always wound up with segfaults due to apparent double-free operations when using ctypes to do buffer work.  Basically, once I GetBuffer() into a buffer the deallocation of the buffer struct in ctypes seems to ...

Continue reading

Defaulting a POINT to GeoIP

So you added a totally cool and gnarly view that lets the user specify a POINT on a map (and text coordinates), and then two more to let them view and explore them.  Your users should love you forever... but those dratted users are complaining that the default location is off in the Atlantic ocean ...

Continue reading

Metaclasses, what are they good for...

A question was asked at the Django Toronto meetup during the metaclasses talk, basically, "what would you use this for"... so, here's my talk on Metaclasses [pdf] from a PyCon of the Python 2.2 era, which addressed that question at some length (the first half of the presentation). It doesn't secifically mention the use-case cited ...

Continue reading

olwidget show features in the window

So now you've got your spiffy textual-entry-of-GPS-coordinates-and-map admin GUI and you're wanting to actually let people see your "features" on a map.  olwidget has an InfoMap() which is basically a Map + a single InfoLayer, but it uses a static set of "info" rather than a dynamically updating set. Here's how to hack the dynamic ...

Continue reading

olwidget templates...

If you are using olwidget to get your geodjango editing up-and-running fast, and you want your users to be able to enter the GPS coordinates textually, as well as via the map, then yay, I've already gone through the pain for you.  Here is a hacky way to get synchronized text-field and map entry using an ...

Continue reading

GeoDjango is Pretty Straightforward

Doing some trivial GeoDjango today.  All was pretty straightforward, though the tutorial didn't cover how to add PostGIS to an existing DB (you just run the same commands you'd use to create the template against the existing DB, but it needs to be as a DB superuser, so it won't go into a regular migration ...

Continue reading

Okay, spammers, you win

I was just going through and deleting your dozens or hundreds of posts a day using django admin interface, but drat it, you're posting way too many comments and that was taking too long.  You wore me down, so I wrote a stupid little view to kill your comments en-mass.  You win, you wasted part ...

Continue reading