The Guitar and the Piano

Sometime ago I read this article about the future of Lisp. Even if you’re not interested in Lisp there is an interesting explanation of two design philosophies the author calls The Right Thing and Worse is Better. His description is rather long, so I’ll grossly misinterpret it by summarizing it as: any tool used by developers (a programming language, OS, framework, library or anything with an API) at some point needs to choose between keeping the tool simple or moving the complexity into the tool. In general, a simpler tool makes it easier to understand what’s going on “under the hood” and thus offers more control. In contrast, moving the complexity into the tool makes its usage simpler.

A good analogy I think is a guitar versus a piano. A guitar is arguably the simpler instrument. It has few moving parts and it’s reasonably portable. By contrast a piano has most of it’s mechanics “under the hood” and you certainly wouldn’t take it with you on a camping trip. On the other hand striking chords on a guitar is a fairly complicated affair that is difficult to grasp by a beginner, both literally and figuratively. On a piano it’s still a cinch, but at least the notes are laid out right next to each other. Also with a piano (and enough practice) it is possible to play different things with either hand. With a guitar this only works with specific chords and often requires sacrificing notes.

Now I suck playing either instrument so don’t take this too far, but I hope you see the analogy. In any case, there certainly isn’t a “best” instrument, only what’s best in a given situation.

Let’s consider an extreme case, C versus Haskell. C is clearly the simple, “guitar” type tool favoring precise control needed in systems programming. In contrast, Haskell is the expressive “piano” type tool for implementing complicated algorithms.

A more subtle case is systemd. Because it handles dependencies between daemons “under the hood” its configuration is simpler than other init systems. Whether this follows the Unix philosophy (“Do one thing and do it well”) is, in my opinion, a matter of scope; If handling dependencies is what you want your init system to dosystemd certainly does it well. But Unix traditionally favors simpler tools and many long-time users don’t like giving up the more precise control these offer.

I’m sure you can think of more examples, it’s a recurring theme. The key takeaway is that there’s no clear winner, it depends on personal preference and the specific situation.

Let’s hope more people will realize that before starting a flame war.


KB2995388 breaks VMWare Player

Update: this is fixed in VMWare Player 6.04.

After installing update KB2995388 my VMWare Player images refused to start. Only after reducing the required virtual memory to 2 GB or less they would run. Reinstalling Player didn’t work. Luckily after removing the update things returned to normal. The reader be warned…

Running ActiveMQ as non-root

Running ActiveMQ as non-root with a handy script and a small tweak in conf/ replace log4j.appender.logfile.file=${activemq.base}/data/activemq.log with log4j.appender.logfile.file=${}/activemq.log to prevent ActiveMQ from putting the log in the installation folder.

Though I suppose you could also create a new broker instance.

“Insufficient Storage” on Samsung Galaxy S II (I-9100)

My wife’s phone (Samsung Galaxy S2 I-9100, upgraded to Android 4.1.2) recently refused to update any installed apps with the error ‘Insufficient Storage’, even though the phone clearly had enough internal storage left to install at least some apps.

After surfing the web I found 2 solutions that worked:

  1. In the dialer type *#9900#. You get some techie menu, then choose the second menu option Delete dumpstate/logcat.
  2. Shut down the phone then start it up by holding the Volumne Up, Power and Home buttons. You boot into the recovery menu. Then choose the second last option Wipe the cache partition. Then restart the phone normally.

This solved the problem, now all apps update without any problems.

Navigation Bar issues between iOS 6 and iOS 7

A major difference between iOS 6 and 7 is that in iOS 7 the navigation bar is translucent by default and stuff appears underneath it instead of being shifted down.

Normally this is fixed by making the navigation bar opaque, but this doesn’t always work. An additional solution is described here, and translated to Xamarin it is:

using MonoTouch.ObjCRuntime;


public override void ViewDidLoad ()
    base.ViewDidLoad ();
    if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
        EdgesForExtendedLayout = UIRectEdge.None;

Secure RESTful WCF Service with SHA-256 hashing

This is an old draft I found, perhaps it is useful if you’re trying to do SHA-256. If not, let me know, I might be able to help you out. Azure Storage supports secure access of resources without logon. It involves hashing the query part of the URL and then signing that hash. I’ve implemented this at my workplace in the following steps:

  • Create a web project for a WCF service.
  • Update the .svc file by adding (this makes everything work without configuration, found this here):


  • Add the following attribute to your interface method:

[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "?p0={parameter0}&p1={parameter1}&sig={signature}")]

  • Create a method like (please note that parameter names match those specified in the WebInvoke attribute and that they are all string type):

Stream MyMethod(string parameter0, string parameter1, string signature);

  • In the implementation of MyMethod verify the signature with the following function:

bool ValidSignature(string customerID, string signature, params string[] toSignArguments)
var certificate = FindCertificate(customerID);
if (certificate == null) {
return false;
const string TERMINATOR = "\n";
var toSign = string.Join(TERMINATOR, toSignArguments) + TERMINATOR;
var oldProvider = (RSACryptoServiceProvider)certificate.PublicKey.Key;
using (var newProvider = new RSACryptoServiceProvider())
return newProvider.VerifyData(Encoding.UTF8.GetBytes(toSign), "SHA256", Convert.FromBase64String(signature));

The trick is to create a new provider instead of the default one you get when loading the key. The default is connected to the wrong library that doesn’t support SHA-256.

Installing latest nginx on lubuntu

I finally managed to install the latest nginx on my test lubuntu install after following this link and some of my own fumbling. The default repositories are several versions behind. Don’t expect this to work on your system, it’s more of an inspiration. I sudo’ed each command but a single su would have been quicker on hindsight.

sudo apt-get autoupdate
sudo aptitude install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo aptitude update
sudo apt-get install nginx