Empty premises

“We had a search warrant for this empty premise where we found all these goods,” said Singh.

Will they next start searching through empty promises, too?


The most time-wasting command-line problem to diagnose …

If I had to vote for the computer problem that consumes the most time in diagnosis vs. the ease of actually fixing it, I would definitely choose the line termination issue.

It’s the simplest thing to understand, in principle. Different operating systems have different conventions in how they format their files, in particular plain text files. If you open up a plain text file in a editor application like Notepad on Windows, you’ll see the content as simple text characters without any formatting. There are also “invisible” characters, such as tab and “newline”, which affect the formatting of the text but aren’t really text themselves.

Windows uses two invisible characters, called CR (Carriage Return) and LF (Line Feed) to represent each new line. This dates back to the days when computers didn’t have monitors, but instead literally printed their output onto spools of paper. CR+LF were instructions to the printer to bring the printer head back to the origin, and feed the paper forward, in order to begin printing a new line of text.

Unix/Linux and Mac OS X have a different convention. They only use one character, LF, to represent new lines. (Even more confusingly, the classic Mac OS uses only CR). Therefore, when you have a text file from a Windows system on your Linux system, you’ll first have to convert the line endings first, or weird things will happen, and at first you might have no idea what is going on because newline characters are invisible, so the file will look completely normal when you open it in a text editor. Instead you’ll blame yourself, like the 99% of the time when things don’t work, because that’s usually some other fault in your code, like a typo in your elaborate regular expression.

Fortunately it’s happened to me frequently enough before that when things don’t work as they should on the command line, one of the first things I do is to check the file type. In Linux this is easily done with:

file FILENAME.txt

You should expect to get something like:


But if you see this:

FILENAME.txt: ASCII text, with CRLF line terminators

Then it’s probably coming from a Windows system and needs to be converted before you work with it on Linux/Unix/Mac OS X.

It’s easy to fix if you have the dos2unix utility that’s bundled on many Linux systems.

dos2unix FILENAME.txt # Silently overwrite original
dos2unix -n FILENAME.txt NEWFILE.txt # Write to new file, keep original

The reverse can be done with unix2dos.

If you don’t have dos2unix, you can use sed. The escape character \r represents CR, so the following simply means “remove the CR character from each line”.

sed -i 's/\r//' FILENAME.txt # Overwrite original
sed 's/\r//' FILENAME.txt > NEWFILE.txt # Write to new file, keep original

Further reading here and on the manual page of dos2unix.

DIY Soy Milk

To use up some soy beans that had been lying around the house for too long, I decided to try making some soy milk. The recipe is really easy – the only special equipment you’ll need is a blender. It’s a fun project for a weekend afternoon, and by making your own you can control for example how much sugar goes into the drink.

2018-04-01 18.31.52

Continue reading

Seeking fresh vegetables

If you live in Germany, you’ll certainly have seen posters for Parship.de, a dating website based in Hamburg. Their posters all bear the tagline “Alle 11 Minuten verliebt sich ein Single über Parship” (A single falls in love every 11 minutes through Parship), and usually feature an attractive person (mostly women) on each poster (examples).

In recent months they seem to have gone all-out with the advertising campaign, and almost every bus or tram stop seems to have at least one ad. The repetitiveness of it has inspired some ideas for how they could branch out into other lucrative markets….

(Disclaimer: I am not associated with nor derive any profit from either parship.de or parsnip.de. This is purely for my personal amusement.)

Seven tons of old coins

The South China Morning Post had a feature this past October on Werner Burger, an expert on old Chinese cash, and his collection of seven tons (!) of coins stored in a warehouse in Hong Kong. Burger recently published a door-stopper of a book on cash in the Qing dynasty, following up on his first book from 1975.

Chinese coin from the Qianlong era of the Qing dynasty

Chinese coin from the Qianlong era of the Qing dynasty. (By Murberget Länsmuseet Västernorrland [Public domain], via Wikimedia Commons)

My father had a copy of the latter at home, and I remember thinking that it was merely a collector’s guide. I had no idea that this work was based on (just a part of) his collection of 2 million coins. The story of how Burger came into possession of these coins is also fascinating – a friend of his in Hong Kong was importing old Chinese cash from Indonesia to use as scrap metal, and let him pick out some for himself.

Since his 1975 book, which covered the Qing dynasty up to the beginning of the Qianlong emperor’s reign, new archival material from the imperial mint has been discovered. Burger used his collection and the archival material to reconstruct the fiscal history of the era, in order to analyze why Chinese currency became so devalued during the Qing.

What a wonderful story of serendipity and sheer persistence! Cash is such a fascinating thing – at once a physical artefact and an abstract idea, a ritual item (in the anthropological sense) that most people handle every day, somewhat mystical and yet mundane.

New paper! An enduring partnership between ciliates and bacteria

My latest paper has just been published in Proceedings of the Royal Society B! My colleagues and I describe how a partnership between a group of ciliates (a type of single-celled organism) called Kentrophoros and their bacterial symbionts had a single evolutionary origin. This is despite the fact that different species of Kentrophoros can look very different from each other and are found all over the world. The bacteria are also a lineage that is new to science, and that as far as we know is only associated with these ciliates. This means that after the first Kentrophoros and its bacterial partner got together tens or hundreds of millions of years ago, their descendants have diversified into different species and spread themselves throughout the globe, all the while remaining true to each other.


Kentrophoros sp. from the Mediterranean island of Elba. This ciliate carries a few hundred thousand bacterial symbionts (whitish mass) and is almost 2 mm long despite being a single cell.

Still have questions? Read more below…

Continue reading