Adding Pandoc to Gollum

The nice thing about Markdown is that it’s a very lightweight markup language which lets you write files in any text editor which look pretty normal when read as plain text, because they use mostly the kind of idioms which people commonly use in text documents anyway, but you can run them through a simple converter to generate HTML or PDF output with all kinds of fancy formatting.

The not-so-nice thing about Markdown is that approximately seven seconds after its original creation, it split into a kazillion subtly different flavours, variants and dialects. There’s Original Markdown, PHP-Markdown (a.k.a. Markdown Extra), GitHub Flavored Markdown, Pandoc Markdown, and a whole bunch of others. So whenever you move from one tool to another, you have to learn and unlearn a few tricks, and fix some subtle breakage in any content files you try to take with you..

So, if you have free choice to pick any of the many command-line tools for converting Markdown to, say, HTML, which one should you choose? That one’s easy: Pandoc. It’s amazing. It can convert to and from pretty much every markup format ever invented. Its own default flavour of the Markdown syntax is incredibly complete (you can literally write books in it), and pretty much a superset of all of the others, but you can selectively disable features, or even put it into ‘strict’ mode where it will behave almost exactly like John Gruber’s original version.

The main disadvantage of Pandoc is that it’s addictive: after writing some documents in Pandoc Markdown, going back to one of the more limited variants feels like going back to a Punto after zipping around in a Ferrari for a while. This commonly happens when you are using a blog or wiki which lets users write pages in Markdown.

The obvious solution, if you happen to be the maintainer of that blog or wiki site, is to configure it to use Pandoc instead of some lesser Markdown-to-HTML converter. (If you’re not, you will just need to suck it up, I’m afraid.)

HTML5 Micro-app for Blogging From the iPad With Textastic and Octopress

I switched to using Octopress for my blog a few months ago. Octopress, as you may be aware, is a Jekyll derivative, which means that you can maintain your blog posts offline (typically in a Git repository) as a series of text files in a simple markup format such as Markdown or ReStructuredText, and then generate plain HTML files which you deploy on your webserver.

I am running “rake watch” on the server, so that whenever I modify a file (via ssh, for example), it gets immediately picked up and the necessary pages get regenerated. Or I can write a page on a separate machine, commit it in a local git repository, and push the change to the server. So far, so good. However, I would like to be able to write blog posts on my iPad as well, preferably using Textastic, which is the best editor I’ve discovered for such purposes so far.

One of the things which makes Textastic nice, is that it has a bunch of options for easily synchronizing with a remote server: WebDAV and SFTP, among others. So I can create a file on the iPad and then easily copy it to the server. (Textastic doesn’t understand Git though, but that’s a different topic.)

So what’s the remaining problem?

OK, I Give Up. You Can Have My Privacy.

Any day now, I expect Google to release their latest product: Google Toilet Paper™.

It will be delivered to your doorstep for free, the production costs covered by targeted ads printed on the paper in biodegradable ink. It will be softer and nicer than any competing product (except Apple’s, but that’s quite expensive and only works in Apple Bathroom™s), and it will have several unique features which I’m not smart enough to anticipate but which will surely revolutionise the toilet paper industry overnight.

Inside every roll, there will be an RFID chip which can be read by the RFID reader in the next generation of Android phones. There will also be a simple rotation counter connected to the chip, so that the roll knows how often you use paper when you visit the toilet, and how much paper you use each time. All this information will be automatically uploaded to Google, the next time you sync your gmail account with your phone. By matching the pattern of your toilet visits to the e-mails and search queries of people with similar patterns, Google will then have a pretty good idea of any bowel-related afflictions you may have, often long before you do.

RIP Benoit Mandelbrot

Benoit Mandelbrot died a few days ago, at the age of 85. He is best known for discovering and popularizing the concept of fractals, in particular the Mandelbrot set and its close relative the Julia set.

In doing so, Mandelbrot gave the world much more than just a way to create pretty pictures and psychedelic animations. The realisation that such a literally infinite amount of complexity, not to mention beauty, could be created with a formula which you can write on the back of your hand, influenced thinkers in just about every field from philosophy to economics and from physics to biology.

As a little tribute to the man, if you are a programmer, I hereby encourage you to implement his famous fractal in your favourite programming language. It’s really simple; in many programming environments, opening a canvas to draw the pixels onto will be more work than actually calculating the fractal.

Silly Workaround for Android 2.2 Not Importing vCard Files via Bluetooth

I bought myself a new phone yesterday: an HTC Desire HD, running Android 2.2. On the whole, I’m extremely happy with it — especially since my previous phone was an LG Windows Mobile piece of junk which didn’t really deserve the name ‘smartphone’. There are a few quibbles, however.

One of them is this: I had a lot of contacts stored in the phone memory of the LG rather than on the SIMM card, so naturally I wanted to transfer them to its successor, preferably via Bluetooth. The HTC actually offered that option during the initial setup, but only for a limited number of models, mine not included.

But, fear not: the LG offered the option to transmit contacts to another phone via Bluetooth. One at a time, unfortunately, but hey — it didn’t take that long, and it gave me the opportunity to clean out some contacts. After perhaps five minutes of diligent Bluetoothing, all the contacts I still cared about seemed to have been transfered, with the Android phone happily saying something along the lines of “transfer received successfully!” for each one.

And after that, they turned out to have disappeared.

Upgraded to Ubuntu 10.10

The upgrade to Ubuntu 10.10, “Maverick Meerkat”, went smoothly enough. Except for one thing: Grub, as always. For some reason, Grub really hates me: for the last three Ubuntu upgrades, every time when I rebooted after the installation, it failed to boot. This despite the fact that I have a very straightforward setup: no dual-boot or anything, just a single Ubuntu installation on the machine. The error message this time was something along the lines of “unknown function”; I didn’t write it down exactly.

Martin Starts Link-blogging

When I started this blog, it was with the intention to write a post only when I had something interesting to say. Well, given my deplorably low posting frequency over the past year, I guess we have found out how interesting a person I really am.

So I am going to, every now and then, write a blog post just to share some links I found on the web recently which happened to catch my eye.

About Chess and Nuclear Reactors: The Case for Exception Handling

The world of software development has more than its fair share of topics where people tend to have long religious discussions about the “correct” way to do something. I think this is partly because the field for some reason attracts the kind of person who enjoys a nice bout of verbal fisticuffs, and partly because we spend a lot of time dealing with very abstract topics where the pros and cons of a given choice have more to do with differing philosophies than with objective facts.

One classic topic for this kind of discussion, which came up recently at work, is the use of exceptions for error handling. Every modern programming language offers an exception mechanism for this purpose, and presumably it is there to be used. However, ever since they were first introduced, there has been a large and vocal subset of the community arguing that exceptions do more harm than good and you’ll be writing better code if you just use good old return values to report whether a method succeeded.

One representative example comes from Joel Spolsky, one of my favorite authors. Another oft-quoted article making the same arguments is found in the “Frequently Questioned Answers” by Yossi Kreinin. They both make the same basic points: exceptions do not reduce complexity but merely hide it, and when complexity is hidden people tend to forget about it.

These arguments have merit, but I still feel that (when properly used) exception handling delivers enough value to be worth the cost. So I am going to be arguing for the status quo here, for a change. Executive summary: the dangers of exceptions are real, but code readability trumps almost everything.

LASEK

This is a blog post about something which took place six months ago, so it could be considered somewhat belated. On the other hand, that gives me the opportunity to give the full story in one go, rather than just posting “well, I had the operation two hours ago and they didn’t actually blow up my eyeball, so I guess it could have been worse, but I’m not really supposed to be staring at a computer screen just now and anyway I am doped up on painkillers so I’m leaving now, okthxbye.”

The Betrayal of the Spirit

I don’t normally like to do “link blogging” — I’d rather post nothing at all for several months (which frequently happens) than just copy someone else’s work. But I’ll make an exception for this XKCD strip. I think it actually brought a tear to my eye.