I keep forgetting how to format and indent xml from the command line. The tool
xmllint does a fine job of doing just that, which has saved me numerous times whilst working with sports results. So. Much. Data.
will re-format and re-indent the xml in the input file, and check it for various errors while doing it.
I needed to send an email, so I came up with this:
Not rocket science, but it gets the job done.
Lets face it, I’m way to lazy to write blog posts at the moment, so I’m just going to publish some python code that i wrote today.
It’s a program that runs aacgain on all the albums in your iTunes library.
Continue reading Concurrent aacgain on iTunes library
While working on a project using PyAMF today, i was about to write a unittest of a service method, when I realized that it would be harder than necessary to make unittests of the service. The cause of this is, that there was no test client wrapper for the django test client for pyamf, which means, that to do a unittest of the gateway, you’ll have to start a django server, and run a unittest elsewhere.
Seeing as how there are a lot of benefits to using djangos own test suite (fixtures and automatic database generation to name a few), i set out to write a little test client for PyAMF to utilize django’s test client, so it would be possible to write a proper test suite.
This turned out great, and is now ticket 508 over at PyAMFs trac. Look at the client.py for the code. At some point, it will be integrated into PyAMF mainline as
p.r.c.django.TestClient (or something like that).
It took me a while of messing with fontsets and various other settings, before i came across how to select fonts in the Emacs wiki:
- M-x mac-font-panel-mode and pick the font you want.
- M-x describe-font and copy the font name (e.g.
- Add the following to your
In my case the lines for font selection looks like this:
(set-face-font 'default "-apple-proggytiny-medium-r-normal--11-110-72-72-m-110-iso10646-1")
Using this to make the font display without antialisaing:
defaults write org.gnu.Emacs AppleAntiAliasingThreshold 100
And this to position emacs in the top left, and be 104 chars wide, and 64 high.
(setq initial-frame-alist `((width . 106) (height . 64)
(top . 0) (left . 0)))
And of course some other tweaks. Re-learning emacs is turning out to be a good idea. But that’s another story.
Having searched a lot around google, it does not seem that anyone has published their trac commit hooks for mercurial. Since I had to use just that, I’ve cooked up a little hook which is based on the hook from the
timingandestimationplugin. I’ve created it as a changegroup hook, and it’s probably filled with bugs, but it seems to work and it catches the
fixes #42 and such.
To use the hook you must place it somewhere inside your
PYTHONPATH and tell mercurial to use it (I placed it in a module called trachook — don’t call your module trac):
changegroup = python:trachook.hook
And tell the hook where to find your trac installation:
root = /path/to/trac
url = http://url/to/trac
Grab your own copy of the source, and happy coding. And a big thank you to Jesper Nøhr.
Also, if you need a place to host your mercurial repository but don’t wan’t to set it up yourself, check out bitbucket.
So, you want to POST some XML data to a web service.
Let’s for the fun of it say, that we would like to POST the following piece of XML to a PHP script:
Continue reading Actionscript 3 – posting XML data with URLLoader
At work we yestoday decided to update our internal url structure for our client test sites, issue management systems and such arround a bit. Seeing as we decided on purchasing a genuine signed ssl wildcard certificate, we needed to change our url’s a bit.
Continue reading Fun with mod_macro and django
The code for a very simple asynchronous socket server written in python utilizing the asynchat module. It’s all in good fun.
Continue reading Asynchronous socket server in python