Memory leaks are difficult to trace down. A nice description of finding one is "A server memory leak", a story about tracing a memory leak in a Django application.
I'm trying to work out why a server process is slowly using more and more memory. The server parses a stream of text, and shoves stuff into a database. It's written in Python, and about the only external code it uses is SQLAlchemy
I found a combination of Meliae and objgraph useful. Pympler also seems useful (the tracker class particularly). Dowser also looks useful, and might have made things a bit easier..
...
I've been working on a new version of tvnamer, the utility I discussed in "Automatically rename your torrent'd TV episodes"
It's a pretty much complete rewrite. Some of the new features include:
~/.tvnamer.json which changes any of the default options.scrubs.s01e23e24.avi/media/tv/{series name}/season {seasonnumber}/ for example)...
Part two of my regex guide was released as a shiney PDF. At the time I never created a PDF for part one. Sometime between then and now I created an updated PDF version of both, and they have been gathering metaphorical dust.
So, here is a PDF version of part 1, along with an updated version of part 2 (incorporating feedback form the comment section):
Remember: The guide isn't a guide on regex best practises; the examples used are purely to explain the regex syntax. I use examples like escaping MySQL parameters because this is something most programmers are familiar with - you should never use regex for this purpose outside a regex tutorial..
...
OpenID, the "decentralized standard for user authentication and access control" has a nice feature whereby you can use your own domain as your OpenID login.
Basically you put a few lines of HTML in your <head> tag, and any OpenID supporting basically treats it as a redirect.
I have a Verisign PIP OpenID account, to login to various sites (such as the Stackoverflow "family" of sites), but I can use my own domain (dbrweb.co.uk) as a login.. I could run my own OpenID "endpoint", but this is much simpler, and more secure (as Versign will do a better job than I could)
...
Another short film my brother an I created last weekend (previous one is here)
Stuart announced his retirement from sundayleague.com. This is my attempt to make him reconsider
...
Discussing the current state of video-capable DSLR cameras
Note: There's a summary for the impatient!
In August 2008 Nikon released the D90, the video DSLR that shot HD video.
The concept was apparently aimed at news-gathering, where reporters who would usually have to carry both a DSLR for photos and a separate video camera, could instead carry a single device capable of both shooting stills and, at the press of a button, shoot HD video.
For completely different reasons, these VDSLRs also appealed to film makers - a wide range of changeable, affordable lenses and large sensors capable of creating "filmic" shallow depth of field.. but, film-makers and news-gatherers have very different needs, and all VDSLR's thus far have been, in various ways, broken..
...
After restoring a backup, the various OS X system folders became visible again (such as /bin /mach_kernel etc)
The following command (adapted from this post by Wowzera) will hide them again:
# Hide sym-links SETFILECMD="/Developer/Tools/SetFile" for cdir in /etc /tmp /var; do sudo $SETFILECMD -P -a V $cdir; done # Hide directories for cdir in /bin /cores /mach_kernel /private /sbin /usr /Volumes; do sudo $SETFILECMD -a V $cdir; done
Launch Terminal (in Applications, then Utilities), and paste the above script.
...
Simpletons guide to git
This is simply a "click these buttons" guide to git. See the last section of the article for more advanced/better guides and resources.
...
To print some information every 10 loop iterations can be a bit messy. Given the following, simple loop:
for x in lots_of_stuff: process(x)
The "dumbest" way would be:
i = 0 for x in lots_of_stuff: process(x) if i % 10 == 0: print "Some progress info" i += 1
A more elegant solution would be to use the enumerate built-in:
for i, x in enumerate(lots_of_stuff): process(x) if i % 20 == 0: print "Some progress info"
Much nicer, but this doesn't work with while loops
...
I wrote a bandwidth-usage Dashboard Widget for Adam Internet a while ago. They have since changed their quota system to use "onpeak" and "offpeak" quotas, breaking my old Widget. I've now updated it for the new system.. I may create a nicer widget at some point, the current code is a bit of a mess, and I have an idea for presenting the on/offpeak data better...)
Admittedly there's probably around zero other Adam Internet customers reading this, but it should appear in search engines, should someone be looking for such a widget..
Anyway, how it looks:
...