Category archives: Snaking

Discussions of programming, particularly of programming Python

RSS feed of Snaking

Little bit of OpenGL hacking this afternoon

Managed to find and fix a few small bugs in PyOpenGL. Also did some minor Python 3.x compatibility work. BTW, Python 3.x advocates: low-scored reviews on PyPI with snarky comments are not a huge motivator. Actually they are a pretty strong de-motivator. I was so tempted to just change the categorization to something equally snarky ...

Continue reading

I was like, all, let's do uPNP too... then I was like, meh

So, having worked with mDNS/Zeroconf a bit, I thought I'd take a quick look at uPNP, particularly the IGD device type. IGD here is "Internet Gateway Device", i.e. your router. There are approximately two things you want to be able to access from generic software on a router, your external IP address (so you can ...

Continue reading

mDNS is kinda fun


I've been writing mDNS and uPNP code this past week. It's kinda fun. I've been using a hacked-up version of pyzeroconf which breaks out the multicast, dns and mdns stuff so that multicast-but-not-zeroconf code can use the same code paths as the zeroconf code. Sample code for doing a basic multi-cast but not mDNS operation ...

Continue reading

Flex Devs, KISS, please, for the Love of the FSM

I have been writing some acceptance tests for a Flex application in Selenium using Nose, and VirtualBox. To do so, I had to fix quite a few bugs in the Selenium Flex API. Are all Flex devs over-engineers? The SFAPI had a scary series of interacting methods, a helper class, multiple pieces of shared state ...

Continue reading

All those little spots where you use strings...

x.split( '.' )
Is an idiom that shows up all over the place, particularly in list comprehensions. Run your code through 2to3 and it fails when x is a str (bytes) object, as 3.x thinks the '.' is unicode. It fails with a rather cryptic TypeError: Type str doesn't support the buffer API error as ...

Continue reading

bzr-svn for those stuck with svn servers...

At work I need to interact with an svn (1.4) repository, but honestly I'm so spoiled by bzr that it just drives me nuts, particularly the (frustratingly frequent) situations where I miss a particular change-set/revision when merging into my tree and wind up reverting someone's changes.  The VCS should bloody-well track what revisions are missing, ...

Continue reading

Python 3.x Porting Notes

Decided to see how much work getting PyOpenGL ported to Python 3.x would be.  Notes so far:

  • ubuntu has Python 3.1 packaged (yay)
  • also has distribute and -dev, you'll need both
  • virtualenv -- this is key for my porting work-flow (not just for PyOpenGL, for almost every project), had to use an hg branch to ...

Continue reading

Mocker's hidden gem...

Mocker has one uber-nice feature... it will mock out an object in basically all namespaces, so you can do a .proxy( 'mymodule.this.that' ) and have the resulting mock object replace the target "that" wherever it's been imported.  It won't, for instance, pick up references in lists, sets and the like, but for basic namespaces (dictionaries) ...

Continue reading

Stub/Mock-a-Process Module

Say you want to have a test suite that tests logic which runs command-line processes that should *not* be run on the test machine (e.g. they would cause the test machine's configuration to be totally messed up).  You want to test right down to the point where the call is made (i.e. you don't way ...

Continue reading

Anyone with PostgreSQL-on-EC2 recipes that work?

Seeing ridiculously slow PostgreSQL performance on an application.  Can't claim the application is particularly tightly coded for DB usage (too much ORM-ish-ness), so there's room to improve there, but right now we're seeing the same app 10x slower on the EC2 instances than on my (somewhat high-end) laptop... which makes me wonder if there's some ...

Continue reading