Sunday, 30 August 2009

Ubuntu mysql and ssl

4 flippin' hours I have been tearing my hair out trying to force an ssl connection with mysql.
I generated keys, wrote the code, but it didn't work.

finally got it going though.
this HOW TO is the bomb.

for ubuntu swap all references to /var/db/mysql to /etc/mysql

so now you can all sniff my packets, see if I care.

Thursday, 27 August 2009


So I've started an application to help make and deploy python apps on Ubuntu.

Here's a screencast showing it in use (version 0.2)

project is at

I would love feedback as to whether this application is of interest to anyone.

Tuesday, 25 August 2009


to get a break from programming openMolar... but to help cement what I had learned about ubuntu packaging, I started another project pyAppTemplate.

The goal of pyAppTemplate is to create a "debianisable" source tree from the get go of a project and... it works! The debs put the app onto the python path, and an executable in /usr/bin an icon into /usr/share/icons/hicolor/scalable and create a menu item.

pyAppTemplate is currently a command-line only app, (I had my first play with the getopt module to parse the command line args passed), but I intend to create a qt, gtk, wx and tkinter frontend for it... just for fun!

I quickly made 2 virgin packages... and deployed them locally.

pyAppTemplate is, of course, gplv3 code, and available at

I'll put a deb into My PPA soon, and create a demo of the tool in use.

Monday, 24 August 2009

Silly python lyrics....

To the lyrics of "Always on your side" by Sheryl Crow.

My pyqt apps are all boxed up and neatly put away
The qt kit with python they did bind
But we were always waiting for the license to be changed
From the LGPL, it found a place to hide
Which is a shame but now we have PySide.

why is my head full of such garbage?

Sunday, 23 August 2009

.bashrc for pythonistas

It's a great trick for creating a clean copy of a directory of python stuff, but I got sick of typing

~$ rsync -av --exclude="*~" --exclude="*.pyc" ~/tests/ ~/tested/

so I decided to add an alias to ~/.bashrc

alias rsync='rsync --exclude="*~" --exclude="*.pyc"'

works fine.

Saturday, 22 August 2009

Ubuntu Karmic alpha4 - 1st impressions

2 months before the release of Ubuntu 9.10 "Karmic Koala" (due 29th October), I am trying out the alpha 64-bit live CD on my advent 9112 laptop.

I have to tell you I am MIGHTILY impressed.

First linux distro that has recognised my rf (wireless) switch.
And palimpsest gave me a warning about my failing hard drive.
Time to run captain spinrite methinks.

My keyboard was incorrectly recognised as us... but that gave me my first look at the keyboard settings app. A thing of beauty. Dunno if that's new to karmic?
Anyways I would stake my mortgage on the keyboard layout being correct if I choose to install this to disk......

.... and do you know what? I am going to, because this just feels RIGHT.

congrats and thanks to everyone involved!

Friday, 14 August 2009

Pylint Recursively

Not sure why I am blogging this, but I've been having a bit of fun with pylint, which checks python code for "bad smells" (ie. code which doesn't match the PEP standards).
Pylint also finds unused imports, variables etc...

I have written a little script to get only errors and scores out of pylint.
It works recursively looking for *.py scripts within a directory passed to it on the command line, or (if that is missing) within the current working directory.

Posted here in case it is of any use to anyone.

#! /usr/bin/env python
this module runs pylint on all python scripts found in a directory tree

import os
import re
import sys

total = 0.0
count = 0

def check(module):
apply pylint to the file specified if it is a *.py file
global total, count

if module[-3:] == ".py":

print "CHECKING ", module
pout = os.popen('pylint %s'% module, 'r')
for line in pout:
if re.match("E....:.", line):
print line
if "Your code has been rated at" in line:
print line
score = re.findall("\d.\d\d", line)[0]
total += float(score)
count += 1

if __name__ == "__main__":
print sys.argv
BASE_DIRECTORY = sys.argv[1]
except IndexError:
print "no directory specified, defaulting to current working directory"
BASE_DIRECTORY = os.getcwd()

print "looking for *.py scripts in subdirectories of ", BASE_DIRECTORY
for root, dirs, files in os.walk(BASE_DIRECTORY):
for name in files:
filepath = os.path.join(root, name)

print "==" * 50
print "%d modules found"% count
print "AVERAGE SCORE = %.02f"% (total / count)

Thursday, 13 August 2009


I went trawling through synaptic to find a little app to notify me when a new piece of email arrived in my googlemail account, and found "gmail-notifier". I installed it, and decided that this was perfect for me.


the project looks stale (last commit in 2007) and the project's mailing list is full of spam.

the app has IMHO two major shortcomings...
  • password is stored in plain text in a config file

  • I suspect the password is sent in the clear

I may be wrong about point number 2, I was going to ask via the mailing list, but I very much doubt anyone reads it unless they want a bigger willy or cheap pharmaceuticals.

So it looks like I will have to use the FF plug in like everybody else :(