Archives for December 2011

December 2011 (11)
SMTWTFS
« Nov Jan »
123
45678910
11121314151617
18192021222324
25262728293031

Like this Archive Calendar widget? Download it here.


The Body Farm (TV series)

A couple of months ago I purchased The Body Farm on DVD from Amazon.co.uk. In theory it sounded promising enough: a series spinoff of Waking the Dead , with one of the characters from that series moving on from the break-up of Boyd’s cold case crime unit. It stars Tara Fitzgerald as Dr Eve Lockhart. The setup: Lockhart is in charge of a body farm, a forensic laboratory where they research how bodies decay in various situations. So over the course of the series, we see bodies in a dry habitat (a kind...

READ MORE

JavaScript for C# developers: the Module Pattern (part 2)

Last time I talked about the simple module pattern . This is where you create a function that returns an object with behavior and state and that behavior and state is implemented (and made private) by using a closure. We showed this by using the module pattern to create a stopwatch object. Let’s now see how we can extend this stopwatch object by adding the facility to have lap times. This gives us the ability to use the same stopwatch to time a sequence of time-consuming actions, rather than creating...

READ MORE

JavaScript for C# developers: the Module Pattern (part 1)

If you recall, JavaScript closures are an extremely powerful concept in the language. By using JavaScript’s rather peculiar scoping rules, closures are a way of creating private variables and functionality for an object. The module pattern builds upon this feature. A quick recap on scope in JavaScript may be in order. Scope is the means by which programmers limit the visibility and the lifetime of their variables and parameters. Without scope, all variables would be global and visible everywhere...

READ MORE

PCPlus 301: The science of speech recognition

On rereading this just now, I just had to laugh. Two reasons I suppose. First of all, the article is really about Markov chains (my original title was just that), and I spend just 3 paragraphs right at the end talking about speech recognition. I think my editor was a smidge too enthusiastic about the speech recognition part. Secondly I note that I talk about random walks in a couple of places – even Gambler’s Ruin – a topic I skirted just recently here . It certainly sounds like I knew back then...

READ MORE

True credit-card-sized calculators – Casio SL-800

As it says in my bio for this site, I’m a calculator collector. Mostly Hewlett-Packard LCD calculators it must be said, but every now and then I pick up something from another manufacturer. Back in the early 80s, I remember buying one of these Casio SL-800 calculators for fun, a gold one. And then – because it was the size of a credit card -- I put it into my wallet, which of course sounded its death knell after a few months. They are just not that robust. Sad to say, my original one bent and came...

READ MORE

Euclid and continued fractions

Back in my days at Kings College, there was a movement to try and make sure that we mathematics students could write. There was a general worry that because we expressed ourselves tersely and symbolically in the language of mathematics we would forget how to express ourselves correctly in the language of English. So, while I was there, we had to write two essays, one at the end of our first year and one at the end of the second. The essays should be on a mathematical subject, maybe even with a proof...

READ MORE

POPA and Glif: photography accessories for the iPhone 4/4S

I’ve been playing around a bit with Kickstarter recently. One of the projects I offered to fund was originally called Red Pop, a gizmo that attached to your iPhone to (a) give it a better grip like a normal camera, and (b) have a nice physical button on top to take photos. They reached their funding, got asked by Red to rename it to avoid any confusion (which they did, to POPA ), and then eventually released it. (The following photo is courtesy Beep Industries.) I finally got mine a couple of weeks...

READ MORE

PCPlus 300: 10 mistakes every programmer makes

The call went out: November 2010 was going to be the 300th issue of PC Plus. Our articles had to be better than ever before and preferably some kind of top N list to go along with the issue’s theme (the lead article for example was 300 Advanced PC Tips ). So, my top 10 algorithms? Data structures? A possibility, but I wouldn’t have much room to say anything in depth about each (“Number 4: Quicksort. It’s very fast at sorting but a bit complicated to get right. Number 5: Red-black trees. A very fast...

READ MORE

The PacMan problem

I came across this mathematical problem the other day: Consider n points on a circle, labeled clockwise from 0 to n -1. Initially PacMan begins at 0 and there is a dot at each of the remaining n -1 points. PacMan takes a random walk around the circle; at each step, it moves with probability 1/2 to one neighbor and with probability 1/2 to the other neighbor. (Note that points 0 and n -1 are neighbors.) The first time PacMan visits any point it eats the dot that is there. Which dot is most likely to...

READ MORE

JavaScript for C# developers: calling functions and the ‘this’ variable

I can’t believe that I haven’t posted an article on how to call functions in JavaScript and what this gets set to for each of the various invocation patterns. It’s one of those things that catches people out periodically, so it’s well worth discussing at length. There are four different ways to call or invoke a JavaScript function: method invocation , function invocation , constructor invocation , and apply invocation . Each of these invocation patterns results in this being set to a different object...

READ MORE