New features in diskgraph

Posted on Thu 29 December 2011 in Tools • Tagged with diskgraph, linux

I added some new features to diskgraph, and bumped the version to 1.1. New things:

  • Graph nodes now have colors depending on their type.
  • Nodes that represent free space are included in the graph. Only free space >= 5 MB is shown, though.
  • Mounted file systems are shown in the …

Continue reading

Presenting diskgraph

Posted on Wed 28 December 2011 in Tools • Tagged with diskgraph, linux

My server case is full of disks, and many of them are pretty small, like 250 GB. I would like to upgrade the boot disk from a USB stick to a proper SSD disk, but that requires me to replace a number of the smaller disks with something bigger. To …


Continue reading

Mocking iteration over file in Python

Posted on Sat 24 December 2011 in Coding • Tagged with file, mock, test, Python

Let’s say that I want to mock reading from a file using file’s iterator capability, i.e. (simplified version):

def readfile(f):
    using open(f) as fd:
        for line in fd:
            yield line

I could mock the readfile function, but then my mock would have to replicate the …


Continue reading

Split on separator but keep the separator, in Python

Posted on Fri 23 December 2011 in Coding • Tagged with reduce, split, string, Python

I have a function that reads from a file using file’s iterator capability, i.e. (simplified version, in reality there’s going on more within the generator):

def readfile(f):
    using open(f) as fd:
        for line in fd:
            yield line

If the file contains something like a\nb …


Continue reading

Function return value caching in F#

Posted on Tue 20 December 2011 in Coding • Tagged with caching, f#, return value

In my TestNess project I have decided to try to rewrite certain parts in F# to see if the code can benefit from functional programming. It is also a learning thing as I’m definitively not well versed in functional programming - yet :-). One of the specific problems I try to …


Continue reading

A Maven POM for building JSR335 code

Posted on Mon 19 December 2011 in Coding • Tagged with closures, defender methods, java8, maven

While playing around with lambdas and defender methods developed within the scope of Project Lambda, I thought I’d create a Maven POM file to facilitate compiling, testing and weaving (the process of making defender methods work in the JVM) of the code I write. The entire project can be …


Continue reading

Some notes on building Project Lambda to test closures and defender methods in Java

Posted on Thu 15 December 2011 in Coding • Tagged with closures, defender methods, jdk8

Check out Project Lambda if you don’t already know what I’m talking about! It adds lambda functions and interface extension methods to Java. Lambda functions allows for very compact and concise code as well as functional programming aspects. Interface extension methods gives you the ability to add to …


Continue reading

Forcing a .NET application to use a 4.0 CLR

Posted on Wed 14 December 2011 in Coding • Tagged with clr, dotnet

I was in a situation where I had an application built with .NET 3.5, but the application needed to launch a sub system build with .NET 4.0. This didn’t work, obviously, as the 3.5 CLR refused to load the 4.0 assemblies. My first idea was …


Continue reading

A convoluted way to list controllers per block device in Linux

Posted on Thu 08 December 2011 in Sysadmin • Tagged with bash, controller, device

One of my SATA drives has failed and needs to be replaced. I have tried to find out if I can hot swap it instead of having to turn off the computer (which isn’t a big deal, but it’s nice if I don’t have to), and the …


Continue reading

Serializing non-qualified attributes with ElementTree

Posted on Mon 21 November 2011 in Coding • Tagged with elementtree, hack, python

The other day, I had a piece of Python code that deserialized an XML text containing a UPnP service description to an ElementTree instance using ElementTree.parse, then at a later stage serialized it back to XML using ElementTree.write.

Now, the service description happened to contain non-qualified attributes (like …


Continue reading