Archives 2012

Thursday, 25th October 2012 - 22:43:10

Python Logo

It's been a while...

I decided to finally spend the time and fix the data in the main RRD for the temperature logger. At one point digitemp config was re-written and the order of the sensors was skewed.

Before: After:

Python to the rescue. A quick script to load the dump up and transpose the sensor readings after the datestamp of the glitch. It looks a lot better now. I may just rip out that fermenter column all together, it has maybe a handfull of sensor readings over the 3 years.

Thursday, 19th April 2012 - 12:54:30


I have been messing around with the home server. A disk has died.

Handy summary of all the mdraid devices in your machine:
for q in `find /dev/ -name md\* | sort`; do echo $q:; mdadm --detail $q | grep -E "/dev/s|Array Size|Raid Level"; echo; done > driveinfo.txt;
grep "/dev/sd" driveinfo.txt | awk '{print $7}' | xargs hdparm -i | grep -E 'dev|Model' | awk '{print $1" "$6}' >> driveinfo.txt;
mail -s "mdraid info" [your email] < driveinfo.txt

This machine is a modifed intel server. Because it does not have the hotswap chassis installed with nice numbering and fixed IDs, its hard to keep track of the drives (there are 10). The idea of this is to send the info across via email so that I can look at it on my mobile or other computer while the server is down.

Sunday, 8th April 2012 - 13:12:00


The mint has gone bannanas. It's already rooted in 2-3 more places where the branch touched the ground.

Sunday, 8th April 2012 - 13:09:35


Veggie patch weeded. It looks like a veggie patch again now, not more grass...


Wednesday, 21st March 2012 - 07:23:20


I swear my 2YO is housing some sort of fission reactor. Up several times during the night, then up at 6 full of energy. I am stuffed =)

Friday, 16th March 2012 - 19:42:55


Hrm... facepalm... "" != "" #python

I have the date in the title of my blog entries, recently  I added some code to do this automatically. When defining the model originally I had This set the default title of my blog to the date and time when the model was evaluated. So when I came back the next day to add an entry the date was for the day I added the code and touched the .wsgi file. By passing the function, not the result it means that the function is evaluated when a record is made.

Friday, 16th March 2012 - 19:23:17


First week at the new job went well. So many new toys! Lots of new stuff to learn.

Thursday, 8th March 2012 - 22:16:32


Watched Unstoppable last night. Good movie. They take use of the Battlestar Galactica handycam-with-zoom-to-draw-attention to a new level.

Thursday, 8th March 2012 - 22:16:33


Well that was quite a lot of rain. At least the new veggie patch didn't wash away! Will post some pics later.

Tuesday, 6th March 2012 - 22:35:02


I really should stop adding features to my new website and put it live. It will never be done!

Saturday, 03 March 2012 - 11:33PM


I found a great site demonstrating how to add reCaptcha to the existing comments app from django.contrib.

Saturday, 03 March 2012


So, there is blog, wiki and gallery, thats all the old featured covered. Time for a new feature. Today I wrote an app which pulls my tweets from the twitter API and stores them in the database and also display the last few in the side bar. The app has one new comonent which I don't normally use - a management interface.This allows an external call using running on crontab to go and fetch the last few messages.

I also ran through a lot of old blogs and tagged them - the tag cloud is looking a lot healthier now.

Tuesday 28th Febuary 2012

Python Logo

I have been working on this site on and off for a week now and having great fun hacking some python.

As a base for the blog I am using Django. Django is a framwork which is python based and tends to be very modular. The main modules are called applications or apps. There are millions of apps to do different jobs. As a starting point I used Zinnia. Zinnia looks after blogging and includes tagging and CRM type stuff. It was as simple matter of concocting some sqlfu and pulling the data out of mysql and sticking it in postgres. Blog entries are very simple.

Being a bit rusty on Django, I opted to start with stockphoto, a simple gallery app. The ultimate aim is to replicate all of the overall functionality that my current PHP based site has. The original gallery was gallery2 based with over 4000 images in it. There was no way that I was going to upload those again! I ended up doing a lot of hacking on the stockphoto model. They used a number of field names that match postgres keywords like "date" for the creation date field and "desc" for the description field.

The existing gallery2 instance has about 200 galleries with nesting up to 4 levels deep from the root. I was willing to cut this down to just 2 levels. To facilitate this I created the "group" model, which is really just another "gallery" model which lists galleries. That way there are groups in the root, then galleries, then photos. I also customised the admin areas a bit with extra list columns. I wrote two templatetags for stockphoto, first the index page, which shows the list of groups in the sidebar, the second is the random image block. Next on the agenda is to add in tagging.

On a roll now, I decided to tackle the wiki. The existing site had a mediawiki instance with lots of stuff on it which I didn't particulary want to rewrite. Once I worked out how to get the latest revisions of each pages out of the DB, I dumped them all. Next I replicated the schema in postgres and imported the wiki entries. I was then able to create wiki records from the mediawiki data. There was a lot of messing around required, because the wiki module is designed to be used with markdown. I modified the wiki app to incude the wikimarkup python library. I then wrote a new filter which used that instead of the markdown filter.

The mediawiki has a feature currently which allows me to include code and have it syntax hilighted. To replicate this feature I made another filter based on python-pygments. There was all sorts of messing around required because the two filters werent' playing nice together. I found in the end that I needed to run the field through the pygments filter first, then the wikimarkup filter. It's still not perfect. I'm also having trouble with something eating newlines on blog entries code tags.

I also wrote a template tag for the wiki which dumps out a link to the index, as well as a list of featured pages. This involved another model change to include the models.BooleanField() for featuring it.

All of this happend over a week with lots of back and forward and adjustments and tearout-and-reinstall of apps. It's been good fun!


Saturday, 25 February 2012


Kids and speakers are a bad combination. One of the two sub boxes has now laid down it's life for the kids enterainment for 5 minutes. The surrounds are torn and one dome is off. The second sub was rescuable with a bit of vacuum treatment.

Wednesday, 15 February 2012


I have landed a job in internet land! I will be looking after office pcs and their users doing desktop support as well as looking after a few linux boxes serving VPS.

Sunday, 12 February 2012

No Spark

De-Triffidizer has no spark. Obviously they sabotaged the fuel.


This afternoon it poured. Di-Hydrogen Monoxide is clogging my drain...

Monthly archives