New blog software and layout

by Mads
April 09, 2015 at 18:33 | categories: python, soulfood

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[0] in ['AUTHOR', 'DATE', 'TITLE']:
                        outfile.write(head[0].lower() + ": " + head[1])

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.

The future

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.


XKCD gets close to the truth

by Mads
February 23, 2010 at 10:10 | categories: soulfood

Devotion to Duty

Autumn has arrived

by Mads Toftum
November 04, 2009 at 23:23 | categories: soulfood, misc

I went on yet another walk to one of the nearby parks and found a lot of colors had changed.


Boat "parking"


Fall has arrived in the park


Nearby parks

by Mads
July 05, 2009 at 13:18 | categories: soulfood

I've got a very nice choice of parks near to home to choose from when the weather is good.


View nearby parks and gardens in a larger map




Rostrups Have

A hidden gem nearby. It didn't look like much when I went by during winter, but now it is an explosion of color with a great variety of flowers. Below are a few images shot yesterday on a rather windy day. More on flickr....


P1010323


P1010273


P1010249

Frederiksberg Have

The largest park in the area that can get rather crowded on Sunny days. Home to a large population of herons and ducks.
Also contains my favorite spot for relaxing in the city (see below>. More on flickr....

Official site


Boats


My favorite spot


Kongelige Haveselskabs have

Right next to Frederiksberg Have is Kongelige Haveselskabs have with a good selection of plants. Morn on flickr....

Official site


KHS - 00975


KHS - 00998


Copenhagen zoo

The zoo. I for access all days so that I can walk through the zoo when I'm nearby. More on flickr...

Official site


IMG_1768


IMG_1426


Rosenhaven

A small rose garden across the street from Frederiksberg Have. More on flickr...


Roses - Schneewitchen


Roses - Meijulita Chorus


Small vacation

by Mads
June 28, 2009 at 21:40 | categories: soulfood

Legoland - entrance

Last week I took 4 days off from work and headed to Legoland with part of my family. Come to think of it, that's the longest time I've been away since my vacation last january - with the Busy times lately, it was long overdue. Going without email and net access is quite enjoyable (except for the hassle of sorting through an overflooding mailbox when you get back).
We stayed at Lalandia which is right next to Legoland and the airport. It's brand new and everything was really nicely done - we rented a really nice house with room for 8 people and it fit 6 people quite comfortably.


Legoland - reflection

Legoland - mill

Legoland - castle

And don't forget to bring one or more kids to enjoy the experience!


Anna - so where are we on this map?

I don't know when or where my next vacation will be, but I know it's not going to be many months from now and I'm already looking for somewhere that'd let me relax and perhaps shoot one or two pictures along the way.



Next Page ยป