Archive for April, 2010

The Reinvigorated Programmer (Mike Taylor) quotes from Jon Bentley’s 1986 classic Programming Pearls:

Only 10% of programmers can write a binary search

Shocking indeed

Better yet, he has a coding challenge for you to take part in (post answers as comments):

Here are the rules:

  1. Use whatever programming language you like.
  2. No cutting, pasting or otherwise copying code.  Don’t even look at other binary search code until you’re done.
  3. I need hardly say, no calling bsearch(), or otherwise cheating :-)
  4. Take as long as you like — you might finish, and feel confident in your code, after five minutes; or you’re welcome to take eight hours if you want (if you have the time to spare).
  5. You’re allowed to use your compiler to shake out mechanical bugs such as syntax errors or failure to initialise variables, but …
  6. NO TESTING until after you’ve decided your program is correct.
  7. Finally, the most important one: if you decide to begin this exercise, then you must report — either to say that you succeeded, failed or abandoned the attempt.  Otherwise the figures will be skewed towards success.

If you haven’t yet, try it. Read just the article, but do not look at the others’ comments just yet.

After you have attempted this, there is his redux, on why coding exercises like this matter; and his redux of the redux, on why you should not test while attempting exercises like this. They are all worth a good read.

Was reading some old XKCD, and I came across this one:

So, on a whim, I decide plug it in. I would encourage you to try it too:

import antigravity

Spoiler: python antigravity easter egg as evidenced in python’s source code (circa 2008)

In the previous posts, on socket programming and JDBC, the focus has been on programming for the server. This post will focus on client-side programming: applets and web start – with particular focus on the latter.
Continue reading

How to connect to a relational database from a Java program using Java Database Connectivity (JDBC); the JDBC API; some basic SQL; Object-Relational Mapping -all put together with a code example
Continue reading

Here is a quick introduction to socket programming in Java – using a simple demonstration of client-server communication. For the purposes of the demonstration, both the client and the server will be on the same physical machine (“localhost”). However, this can be easily changed later on.
Continue reading

Read this rant by Lee Brimelow (Adobe), on why he is angry that Apple has restricted the programming languages that are available of the new iPhone SDK. Now as much as I dislike Adobe’s PDF reader and flash player for being so slow and memory inefficient on Linux, I am inclined to agree with him.

IMHO so long as a compiler (or interpreter, or virtual machine) can be written for the language on a platform, there is no reason at all to disallow programs written in that language to run. Worse still, having the other languages available on the earlier versions of the platform, and then taking them away is about as anti-developer as it gets.

3.3.1 … Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

Now Apple has previously taken a lot of flak for its black-box-esque iPhone app store, with its sometimes arbitrary app rejection policies; however they could still claim “quality control” and be somewhat believable. With this new move however, there is no denying that they are just being plain developer unfriendly – Lee puts it best: “has no rational defense other than wanting tyrannical control over developers.”

I have no personal interest in this, as I do not develop for the iPhone; and after this, I do not think it is something I see myself getting into in the future either.


Larry O’brien and joeberkovitz have must-read opinions on the matter. Larry notes that, reading between the lines, this effectively means that code generation is disallowed. Joeberkovitz points out the interesting implications of the phrase “originally written” (in a particular programming language), and how it is fundamentally flawed.

How do we compare the relative performance of several data mining models? Previously, we discussed some basic model evaluation methods and metrics. Now we delve into more of them: ROC curves, Kappa statistic, mean square error, relative squared error, mean absolute error, and relative absolute error are the various metrics used, discussed below.
Continue reading

The dessert sandwich


  • 2X slices of bread, frozen
  • Nutella (chocolate spread)
  • Thick custard
  • Chocolate ice cream Continue reading

In order to build the models used in data mining, one will need a set of data for training the learning algorithm, and then another set to evaluate the model built by the learning algorithm. Some basic evaluation methods and metrics are explored. Additionally, advanced techniques such as boosting and bagging may be applied to improve accuracy.
Continue reading

Came across this new game called Evoke, whose objective is to expose players to various global causes and issues* through a fun medium. Quite smart, using MMO-style skill points and in-game rewards to promote what would otherwise be a rather bland message- and it comes as a comic to boot.

Play | How to play | About

* food security, energy, water security, disaster relief, poverty, pandemic, education, human rights
Continue reading