Andrew Godwin - What can programmers learn from pilots

by Mads
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.

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 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:
        with open(file, "r") as infile, open(file+".html", "w") as outfile:
            outfile.writelines("categories: " + ", ".join(ent))
            for inline in infile:
                if body==True:
                    if not inline.startswith('END-----'):
                elif inline.startswith("BODY:"):
                    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.

Today I made it into Flickrs TwitterTuesday

by Mads
October 22, 2014 at 23:44 | categories: photo

Today I got a Tweet from @Flickr

@quasi42 Congratulations! We've chosen your photo for the #TwitterTuesday 

The whole thing is here: Twitter Tuesday: The Pink Selection
My image is called Pink & Bling.

Pink & Bling

There's a total of more than 300 pictures in the Parades album.

(Yeah, I know it's been almost 3 years since my last post, but I blame Twitter and my spending more of that precious spare time with taking pictures.)

bread meatloaf recipe

by Mads Toftum
August 30, 2011 at 14:19 | categories: food, cooking

bread meatloaf

This is an old favorite of mine. A recipe I've used for more than 25 years. It also eats well cold or reheated in a bit of oil on a fryingpan. All that remains is a loose page from a cookbook, so I don't know the exact origins.

Bread meatloaf recipe - 1

150g butter or margerine
0.25L milk
50g fresh yeast
1 tsp salt
540g wheat flour

2 onions
250g mushrooms
3 tbsp oil
2 tsp paprika
0.15L stock
600g ground beef or veal
3 eggs
2 tbsp breadcrumbs
sesame seeds

Melt the butter, mix with the milk and add the yeast into the lukewarm mixture. Add salt and flour. (If using dry yeast, you need 1 portion and should mix it with the flour instead.

Bread meatloaf recipe - 2

Knead the dough well and leave it in a warm place for 20 minutes. It should about double in size.

Bread meatloaf recipe - 3

Finely chop mushrooms and onions.
Saute the onions and mushrooms on a frying pan. Add salt, pepper and paprika and fry for a couple of minutes more. Add the stock and leave on a medium heat until the liquid has evaporated.

Roll out the dough on a floured table to a size of about 60cm by 45 cm. Try to avoid making any holes in the dough.

Bread meatloaf recipe - 4

Mix the mushroom mixture, ground beef, 2 eggs and breadcrumbs in a bowl. If the mixture feels too loose, add a bit more breadcrumbs. (The picture is from a slightly larger batch, so there's 3 eggs instead of 2).

Bread meatloaf recipe - 5

Spread the mix evenly over the rolled out dough leaving a little bit of the dough free on both ends and one of the sides.

Bread meatloaf recipe - 6

Roll up the dough starting at the side where you let the filling go all the way to the edge.
When done rolling up the bread, transfer to a baking sheet, cover and leave for another 15 - 20 minutes while the oven heats up to 225C.
Whisk the remaining egg and brush it over the bread. Sprinkle sesame seeds over it if you have them. (I was sure I did, but it turned out to be quinoa instead).
Put the bread in the oven and lower the heat from 225C to 200C and bake for 45 minutes.
Once out of the oven, let it cool a bit and serve with a green salad on the side.

Bread meatloaf recipe - 7

This is one of those recipes that lends itself really well to variations. The two simplest ones are adding grated red and green pepper or adding grated cheese and dijon mustard. In both cases, you will need to use less meat and mushrooms and more breadcrumbs or increase the size of the dough a little bit to avoid the bread breaking up while baking.
If you're making a larger portion (I usually do), then shaping it as a horseshoe may be a way to fit it on the baking sheet.

Osso buco

by Mads Toftum
March 29, 2010 at 11:54 | categories: food, cooking

An old winter(or in this case early spring) favorite is Ossobuco. It's a good warming dish full of flavor.

Osso buco 1
Osso buco 2


This is probably far from the original recipe, but it works for me. Although it is based on being for 2 people, I'd never make as little as that, it's just a convenient number to split the recipe by. Multiply to get a more sensible size - it's good enough that I always make sure there's leftovers for another meal.

2 large slices (or 4 small) of veal or beef shanks
flour, seasoned with pepper and salt
1 onion
1 clove garlic
1 stick celery
1 tin of tomatos
1 small glass of red wine
beef or veal or chicken stock
1 bay leaf, salt, pepper
grated lemon peel and chopped parsley

Make small cuts every 2 cm around the edge of the meat to prevent it rolling up.
Coat the slices in a thin layer of flour and brown on a frying pan.
Add the shanks, chopped vegetables, tomato, red wine, bay leaf and enough stock to cover.
Simmer at a low heat for 3 hours until. (The impatient could use a pressure cooker on high for about 45 minutes).
Sprinkle with grated lemon zest and chopped parsley before serving. This time I've served it with brown rice but mashed potatos work really well also.

Osso buco 3
Osso buco 4

Next Page ยป