Fighting blind

No technology today. I’m spending this week in San Francisco at Coverity head office and did not have time to get blog posts in the queue ahead of time. But here’s a question I got from my friend Peggy a few days ago:

I watched The Return of the King on TV again last night and was left wondering: how it is that Gollum manages to get the Ring away from Frodo when Frodo is invisible?

Well that’s an amazing coincidence as I was watching TROTK on DVD with my housemate at I suspect the same time, even given the time zone difference. Clearly we are connected by some mysterious fifth sense! Continue reading

What I did on my long weekend

I had a delightful and relaxing American Thanksgiving weekend where I did not think about programming languages hardly at all. My general plan for the weekend was to (1) roast a turkey to feed 19, (2) make soup from the bones, and (3) do jigsaw puzzles with friends while eating soup.

Missions accomplished: (As always, click for larger versions.)



Many thanks to my crew of helpful friends who did most of the work putting Aragorn together.

I roast a turkey every year; people often ask me how to make it come out well. The answer is simple:

1) Brine the turkey for 12+ hours in a clean, food-safe five-gallon bucket with eight litres of water, half a kilogram of salt and two bottles of the cheapest chardonnay you can find.

2) Carefully follow the instructions in the Joy of Cooking. That is, truss the bird, roast it upside down at 325F for the first half, then flip it to roast breast side up for the second half. This solves the problem of undercooked legs and overcooked breast. Increase the temperature at the end, and measure the temperature inside the thigh. I find that going all the way to 175F is unnecessary; I’ve never had a problem with undercooked legs after the thigh gets to the mid to high 160’s. I stuff the cavities with apples and have someone else make the bread stuffing separately.

Next time on FAIC: Back to C# with another look at the method type inference algorithm.

Digital pain (rerun)

Today, another fun-for-your-Friday rerun from the past decade of FAIC.

When you bang your finger with a hammer or burn it on the stove, somehow the pain has to get from your finger to your brain via a nerve. That’s an immense distance on the cellular level. What possible mechanisms are there for that?

A nerve carries the pain signal from your finger to your brain like a wire carries electrical current. Perhaps zero “voltage” on that nerve would represent “no pain”, and then the “voltage” would vary smoothly up to some maximum that represented “extreme pain”. That’s a plausible mechanism.

Or, you could have a system where zero “voltage” meant “no pain”, 100% meant “severe pain”, and any lesser amount of pain is measured by the average power delivered over a period of time, say, a millisecond. If the nerve was on 100% for 250 microseconds, then off for 750 microseconds, that indicates a 25% level of pain. If it was then on for 220 microseconds, off for 780, then on for 200, off for 800, that would indicate that pain was decreasing from 25% to 22% to 20%. The granularity of a millisecond might not be quite right, but in principle this would work. [1. Lighting circuit dimmer switches work using these two mechanisms. Old-style dimmer switches work by adding a resistance to the line that decreases the voltage overall, and modern dimmer switches work by cutting out a certain percentage of the power signal.]

Both of those are analog systems: in an analog system the possible signals smoothly vary from 0% to 100%. But neither of them are how nervous systems actually work. If you measure the “signal strength” on pain nerves you see that they actually send groups of extremely short bursts, where the number of bursts per unit time indicates the level of pain. That is, the nervous system communicates pain by sending an integer from the source of the pain to the brain! It’s discrete, not analog.

Why is that?

You know what my favourite scene in the movie version of The Return of the King
is? It’s the one where Gandalf needs to send a message to Rohan in a hurry, so he has Pippin climb up the side of a mountain to light a signal beacon. We then see this great sequence as the beacon wardens set off the seven signal fires on Amon Din, Eilenach, Nardol, Erelas, Min-Rimmon, Calenhad and Halifirien, one after the other.

Listen carefully to the soundtrack at this point. It echoes Gandalf’s “White Rider” theme, which was established earlier in a visually parallel set of shots, as Gandalf and Pippin ride up the seven levels of Minas Tirith. But to give it some additional fire, they add these kick-ass violin arpeggios on top of the basso continuo. The whole thing works perfectly; it’s a triumph of cinematography!

But I digress.

The Gondorian war beacon system sends a single binary bit at extremely high speed over the huge distance from the White Tower in Gondor to Meduseld in Rohan. Suppose the Gondorians wanted to send more information than just “we need help!” — like, say, how big the opposing army was. They could come up with an analog convention. Perhaps a really big signal fire indicates a really big army, a small signal fire indicates a small army, a medium sized signal fire indicates a medium-sized army.

Obviously that doesn’t work. There are seven beacon fires. The beacon keepers would have to figure out how big the previous fire was and then set their fire accordingly. Error would accumulate along each part of the process, and the final result might bear little relation to the original input.

To send information accurately over long distances without error you need some kind of discrete system. You need signals that are clearly either ON or OFF. Once you’ve got ON and OFF, you can use them to transmit integers, letters, morse code, whatever you want.

That is why nerves are digital, not analog. Nerves need to transmit huge amounts of complex data over the vast distance from your toes to your brain without accruing any error along the way as the signal is picked up by new nerves and forwarded on. All the sensory nerves work this way: smell, touch, taste and so on, are digital. We are digital machines, we’re just digital machines made out of meat instead of silicon.

Next time on FAIC: We’ll resume the current series on uses and abuses of the static constructor.