Dragons in the Algorithm
Adventures in Programming
by Michael Chermside

Author: mcherm

The Wager

You are really lazy. It's nothing personal of course -- everyone tends to procrastinate to some extent, but right now it's YOUR turn. In just a moment, I am going to convince you that you want to do something. You'll agree that it's a good idea, you'll tell yourself that you …

Read more

Posted Mon 25 August 2008 by mcherm in Uncategorized (backup, bet, lazy, mozy, review, wager)

Metaphorical Programming

Unlike computers, humans tend to think in metaphors. That is, when we want to reason about something new or unfamiliar we reason by analogy with something familiar. This is a great mental trick and it is part of what allows humans to be flexible and to deal with unanticipated circumstances …

Read more

Posted Mon 28 July 2008 by mcherm in Programming

Go Easy on the Maintenance Programmer

"Maintenance Programmer": This common, and underappreciated species of programmer is often heard muttering and cursing under their breath. Sometimes bald from tearing their hair out in frustration.

From time to time we all have to do it: simple changes and maintenance to code - often other people's code. And the truth …

Read more

Posted Fri 18 July 2008 by mcherm in Programming

A random selection algorithm

Suppose you want to select k things randomly from a list of n items, with no duplicates. Of course, if k > n, then it's hopeless, and if k = n it's trivial, so the interesting case is when k < n. A naive approach might pick an item randomly, and try again …

Read more

Posted Fri 27 June 2008 by mcherm in Math, Programming

Two more uses for a Secure Hash

In a previous article I talked about using salt with a secure hash, but all of the examples assumed that the secure hash would be used to validate passwords. Secure hashes can be used for many other purposes, and I'll illustrate that by describing two other possible uses.

The first …

Read more

Posted Thu 12 June 2008 by mcherm in Programming