June 23, 2015 at 14:01 | categories: python
This morning I found a rather interesting video on youtube called What can programmers learn from pilots In this video Andrew covers how to write and more importantly how to run critical systems. Pretty much every advice he gives rings true with my own experince managing critical systems. Well worth a look for anyone involved in critical systems both from the management and the daily operations perspective.
After quite some time ignoring my blog, I wanted to take a look at getting a slightly more modern theme. A quick look at the site found an official EOL notice for NanoBlogger. To replace NanoBlogger, I've chosen Blogofile which admittedly hasn't had any commits to its repo for about 2 years and could appear as dead as NanoBlogger. In addition to Blogofile, I've grabbed a basic blog template from Start Bootstrap to get something a bit cleaner than the basic Blogofile template.
Reasons for picking Blogofile
I'm a big fan of pre-generated websites letting static content be static rather than generated on the fly. Apart from the fact that it scales a whole lot better, it also avoids the usual security headaches that seem to follow things like Wordpress and friends. There's even an option to turn on comments without having anything dynamic on the site. It's written in Python which has been the language I've been playing with lately to add something beyond shell and Perl to my usual tool stack. There's a good varied template support giving me easy choices to write posts with a little more styling than just the plain html from NanoBlogger. The layout of the working directories is clean and simple and easily let me integrate old leftovers. Migration from NanoBlogger was pretty simple.
Installation and Migration notes
Installing Blogofile with pip doesn't quite work out of the box, but cloning the git repos and running python setup.py install did the trick. NanoBlogger keeps its post categories in two places - in cat__N_.db which contains the category name on the first line and in the master.db file which has an entry for each post with something like "2011-08-30T14_19_45.txt>6,8". That's the filename for the post and the N corresponding to the category files. In order to migrate, I manually changed the numbers in master.db to category names which didn't take long with a bit of vim. I also changed the > and the , into | for simplicity. Next I ran my conversion code (see below) as the simplest hack.
with open("master.db", "r") as master: for line in master: ent=line.split('|') file=ent.pop(0) with open(file, "r") as infile, open(file+".html", "w") as outfile: outfile.write("---\n") outfile.writelines("categories: " + ", ".join(ent)) body=False for inline in infile: if body==True: if not inline.startswith('END-----'): outfile.write(inline) elif inline.startswith("BODY:"): outfile.write("---\n") body=True else: head=inline.split(': ') if head in ['AUTHOR', 'DATE', 'TITLE']: outfile.write(head.lower() + ": " + head)
Pretty simple stuff putting in the YAML headers, the new categories and lowercasing the remaining headers that are reused. Once it gets to the body it just copies line by line. The only problems that ran into was titles with : and # in them, which was easy to fix by hand.
Changing the templates only took a little bit more time than it should have because the last time I cared about writing HTML, CSS had only just been invented.
I've got a bit more tweaking to my site to get done, making it less ugly and to add some of my pictures. There's also a couple of blog posts about OpenData half written in my mind, which should appear as time permits. After that, your guess is as good as mine. Maybe some of what currently goes out on Twitter will end up here along with some of the pictures that go on Flickr.
- Andrew Godwin - What can programmers learn from pilots
- New blog software and layout
- Today I made it into Flickrs TwitterTuesday
- bread meatloaf recipe
- Osso buco
- XKCD gets close to the truth
- Open Source Days 2010
- Autumn has arrived
- Recipes - Sottofiletto di Manzo al Pepe Verde and Pere al Vino Rosso
- Nearby parks