Skip to main content

Posts

Showing posts from 2012

Speeding up HTTP with minimal protocol changes

As SPDY works its way through IETF ratification I began wondering whether it was really necessary to add a complex, binary protocol to the HTTP suite to improve HTTP performance. One of the main things that SPDY sets out to fix is defined in the opening paragraph of the SPDY proposal:
One of the bottlenecks of HTTP implementations is that HTTP relies on multiple connections for concurrency.  This causes several problems, including additional round trips for connection setup, slow-start delays, and connection rationing by the client, where it tries to avoid opening too many connections to any single server.  HTTP pipelining helps some, but only achieves partial multiplexing.  In addition, pipelining has proven non-deployable in existing browsers due to intermediary interference. The solution to this problem (as currently proposed) is SPDY. But I couldn't help thinking that solving the multiplexing problem could be done in a simpler manner within HTTP itself. And so here is a parti…

Listen on a UDP port and dump received lines of data

I needed to quickly fake up a syslog server for some debugging and wrote a small Perl program to listen for messages (lines of text) on a UDP port and dump them to the console. The program listens on a port specified on the command-line and simply prints out whatever it receives. It is only suitable for line oriented protocols since it uses the Perl <FN> operator to read data.

Here it is:

#!/usr/bin/perl # # udp.pl - listen on UDP port and dump out whatever has been received use strict; use warnings; use Socket; die "Usage: udp.pl <port>" if (!defined($ARGV[0])); socket(UDP, PF_INET, SOCK_DGRAM, getprotobyname("udp")); bind(UDP, sockaddr_in($ARGV[0], INADDR_ANY)); print $_ while (<UDP>);
PS Some people have asked why I'…

How I ended up with so much Hacker News karma

On the Hacker News leaderboard I'm currently in position #12 with 32,360 points. I was curious to find out how I ended up in that position, so I used the HNSearch API to pull down my complete submission and comment history.

Some headline numbers: I've been on Hacker News for well over 5 years (I joined on July 2, 2007) and have made 2,985 comments or submissions. That's 1.5 comments or submissions every day for over 5 years (I've actually commented far more than I've submitted: 670 submissions; 2,315 comments). And for all those items I've received on average 10.8 points.

So, the first conclusion is: consistency over a long period.

Looking at comments and submissions separately, I've received 15,985 points for 2,315 comments and 18,119 points for 670 submissions. That means my average comment received 6.9 points, but my average submission received 27 points.

Second conclusion: good submissions earn way more points than comments (which was probably obvious)…

A home-made Voltaic Pile

Back from my trip to Italy and visit to Tempio Voltiano I decided that I really ought to make my own Voltaic Pile. So, I gathered together the following easy to obtain items: British 2p coins, zinc coated disks of metal, some blotting paper and a bottle of vinegar.

The British 2p coins are copper (at least on the outside) and so, with the zinc disks, will make the two electrodes of each cell in the pile. The vinegar is the electrolyte and the blotting paper is used to separate the metals. I got the zinc disks by buying the cheapest electrical junction box I could find and punching out all the holes:

Each cell consists of a 2p coin, a piece of blotting paper soaked in vinegar and a zinc disk:

Each cell gave roughly 1.02v (apparently zinc-copper should be 1.1v at 25C) and then it's just a question of making a pile of them to make a larger voltage. This pile of 10 cells had a measured voltage of 9.7v (clearly not all the cells are at 1.02v).


And there's sufficient current to lig…

The greatest Google Mail feature you may not be using

There's a wonderfully powerful and subtle technique in Google Mail that can be used to enhance every reply you make to a mail: if you select an area of a message and then hit Reply only the selected text will be quoted in the response.

For example, here's an email I need to reply to:

If I simply hit Reply then the entire original message is quoted in the response:

But if I first select the piece that's important to me:

And then hit reply, only that part is in the response:

Use this to respond to just the right parts of a message and cut down those enormous chains of replies where the messages grow and grow and grow.

PS This feature has been disabled by default in Google Mail. You must enable it to use it.

The Bergamo Analemma

While in Italy I briefly visited Bergamo and stumbled upon a wonderful projection of the Sun's analemma in the old town. A hole in a metal disk causes a dot of sunlight to be projected on the ground and the path of the Sun throughout the year is recorded by keeping track of the position of the Sun at local noon. The path of the Sun is an analemma. In Bergamo the position of the dot has been permanently engraved in the stone work:


In the photograph you can see the curved line that shows the local noon position of the Sun as projected through a metal disk. At the top of the image you can just make out the metal disk that has the hole used to create the track of the Sun on the ground. The two ends of the analemma represent the summer and winter solstices. The central line is a meridian and the photograph above is facing south. Here's the compass rose at the end of the meridian line:

Here's the disk:

And the position of the solstices:


All along the meridian line are the days …

The Rizzoli Conundrum

I was in the Rizzoli book shop in Milan buying The Economist when I noticed that the wear pattern on the pinpad used to pay using a debit card was anything but uniform.  Unfortunately, I didn't have my phone with me so was unable to snap a picture, but it looked like this:

There was heavy wear on the buttons 1, 4, 7, 8, 9 and the green OK button. The buttons 2, 3, 5 and 6 showed little wear. What could cause this?

At first I assumed that Italian debit cards had four digit PINs and people might be able to choose their PIN and use a birth year. To check that I grabbed the latest statistics on the number of people living in Italy by age (statistics are available from ISTAT in CSV format) and wrote a small program to process that. Based on people aged 18 to 80, assuming 4 digit PINs equal to birth year the wear pattern would be: 9 (29.08%), 1 (27.46%), 7 (7.39%), 6 (7.34%), 5 (6.39%), 8 (6.19%), 4 (6.13%), 3 (4.84%), 2 (2.70%), 0 (2.47%) (which isn't terribly surprising as there …

Tempio Voltiano

At the bottom tip of Lake Como one of the most (if not the) most over-the-top memorials to a scientist is found sitting on the edge of the lake. The Tempio Voltiano is a temple built to commemorate the Italian scientist Alessandro Volta (who, amongst other things, invented the battery). Built in 1927 the temple depicts Volta as a classical figure. In central Como there's a statue of Volta (on the Piazza Alessandro Volta) with the scientist draped in robes as if he were a figure from the Roman era.

The temple itself continues the theme, with statues representing science (on the left of the entrance) and the Roman goddess Fides (Goddess of trust).

And the interior is similarly grand with an inlaid floor of marble, alabaster and other stones. The circular  layout follows the progression of science that Volta worked from the left to right with the dates engraved in the stonework.

The actual exhibition is a little disappointing. In 1899 Como put on an enormous exhibition celebrating t…

"Calculation and Tabulation in the Nineteenth Century: Airy versus Babbage"

Doron Swade's 2003 PhD thesis entitled "Calculation and Tabulation in the Nineteenth Century: Airy versus Babbage" is available for download.

It covers the interaction between Charles Babbage and George Airy and shines light on a relationship that has previously been reduced to caricatures of the two men.


A downloadable nanosecond

I came across a wonderful video of Grace Hopper (if you don't know who she is go read that Wikipedia article first and the come back here) explaining what a nanosecond is using a visual aid. The aid is a length of wire equal to the distance light travels in one nanosecond. That's 299.8mm (or as she puts it 11.8").


That's a handy length because it fits neatly on A4 and US Letter paper. So, here are downloadable nanoseconds that can be used to make the same point as Hopper. I've prepared both A4 and US Letter versions as PDFs.

Seeing the distance light travels in a nanosecond is interesting because it becomes clear that at the very high frequencies that computers operate at the speed of light and length of cabling become significant. This propagation delay is something that designers of very high speed circuits have to take into account. For example, a machine working 1 GHz has a clock that's ticking once every nanosecond.

Here are the two versions.


Plan 28 now accepting donations

Plan 28's donation system is now online through JustGiving. Donations can be made in British Pounds, US Dollars, Euros and a number of other currencies. As a UK charity Plan 28 is eligible for GiftAid; tax payers in the UK can help the charity by signing the GiftAid form when they make a donation.

As Plan 28 is a very long project it is particularly helpful when we receive regular donations. The donation system is able to set up monthly donations for people who want to contribute a little each month over the long term.

Plan 28 can accept donations on the web or via mobile phone. For example, to donate £10 by phone text BABB37 £10 to 70070.

Web-scale Arduino

There are a number of projects that allow one to control an Arduino using node.js.  For example, there's Noduino and Johnny-Five. To my mind these things are an abomination(*) because they are teaching people to use Arduino at the wrong level of abstraction. If you are going to learn Arduino, learn some C.

One can always argue that they get more people using Arduino, but all these people would be better off learning some C for the joy of Arduino is not (to my mind) controlling it using a massive desktop or laptop machine. The joy of Arduino is small, embedded projects that do stuff. Such as Simonoids:
And if they learn some C they'll get more out of Arduino because they'll be able to do things that the node.js layers don't allow: cool stuff. And once they've learnt some C and need to control the Arduino from the host they'll be able to do even more cool stuff. If you are going to learn Arduino, learn some C.

To get an idea of what's problematic about '…

The Great Railway Caper: Big Data in 1955

The story of a Big Data problem in 1955 presented at StrataConf London 2012.


As soon as I have Tim Greening-Jackson's permission to share his research paper on "LEO 1 and the BR Job" I will update this blog post with information on how to get it.

PS Tim has kindly given permission to post his paper here.


Fact checking George Dyson (where he taps me on the shoulder)

It's no secret that I wasn't impressed by George Dyson's book "Turing's Cathedral" because it skewed history in a particular way a bit too much, and I felt that the title exploited the Turing anniversary. But I was struck by something he said in a StrataConf EU keynote.

He said that in 1953 there were only 53 kilobytes of random-access memory in computers in use and showed a picture of a February 1953 report entitled "A Survey of Automatic Digital Computers" published by the US Office of Naval Research. I thought that sounded odd, so I tracked down a copy of the report.


In fact, he makes the same claim in the book, but I'd overlooked it:


So, I started going through the report looking at machines that were operational in March 1953 according to the report. Just concentrating on binary machines I quickly found that random-access memory was well past 53KB.  By the time you reach E (the machines are in alphabetical order) there were 85,856 bytes of…

A water rocket made from household bits and bobs

Last year I made a 'Ponyo' boat out of an aluminium can and a juice carton following the instructions from Science Toy Maker. This summer when the weather was nice enough I followed his instructions for a simple water rocket launcher made from a pen and a piece of PVC tube.

The nice thing about Science Toy Maker is that all the stuff he makes uses the minimum number of tools and a maximum of common items. The water rocket launcher needs the following: a bicycle pump, a "Bic" pen, a length of PVC tube, a candle, and some glue. Add a drinks bottle for the rocket.

Here's the finished launcher.
It's pretty simple. The length of PVC tube is pinched at the bottom end (on the right) to seal it, a hole is made for the bicycle pump connector made from the pen and a neck is made to rest the bottle on. Since the PVC melts at a low temperature he uses a candle to do all the work.

The first job is to heat the PVC pipe at the point where the drinks bottle rocket's nec…

The UK has an entire IPv4 /8 that it isn't using (UPDATED)

IMPORTANT UPDATES BELOW

If you take a look at the list of IPv4 allocated /8 blocks there's one interesting block in there:

51.0.0.0/8 UK Government Department for Work and Pensions 1994-08 whois.ripe.net LEGACY

That block of addresses, all 16.8 million of them, is completely unused. A check of the ASN database will show that there are no networks for that block of addresses. Right when IPv4 is running out there's a huge block sitting unused.

That's an extremely valuable asset. One recent article valued an entire /8 at between "$500 million to $1.5 billion".

So, Mr. Cameron, I'll accept a 10% finder's fee if you dispose of this asset :-)

PS A comment draws my attention to a Freedom of Information Act response from the Department for Work and Pensions concerning this block. The FOI response says that the block is used internally by the government and there are no plans to release it.

PPS This Cabinet Office document says that 51.0.0.0/8 is used internally by…

The Joy of Bit-Banging

One of the joys of doing things with microcontrollers is the ability to bit-bang: to simulate the serial interface to a device so it can be controlled by the microcontroller without special hardware. The digital I/O pins on microcontrollers are ideal for interfacing to a variety of serial devices.

For example, I've used software controlled serial to connect to various things...

1. A Lassen IQ GPS module as part of my high-altitude balloon flight. The code is here and used a software serial interface to communicate with Lassen's binary TSIP protocol.

2. On the same flight I bit-banged an interface to a DS1821 temperature sensor. This was typical of many small devices where the serial interface is entirely controlled (including the clock signal) by the microcontroller. Details here.

3. A string of addressable RGB LED Christmas lights for my home made 7x7 display. The code for that serial protocol is here.

4. Yesterday, I blogged about interfacing to an optical mouse sensor usin…

Conversion of cheap optical mouse to robot odometer

For a small robot project I'm working on I needed a way to measure the robot's progress across the floor. There are various possibilities, such as: use stepper motors (expensive and am recycling some old continuous run servos), add an encoder to the wheels (would need to go buy some parts for that), or use the optical sensor for a mouse.


I had a really old PS/2 optical mouse lying around which contains an MCS-12085 optical sensor that has a rather simple serial interface suitable for connection to a microcontroller. Inside there are two separate areas of components. On the right in the picture above is the PS/2 interface chips and four nice extras that I desoldered for later use (three microswitches and a quadrature encoder). On the left is the red LED that illuminates the surface and the 8 pin square MCS-12085 that has the camera.

The only description of the chip was for a related optical sensor, the MCS-12086. The difference between the two appears to be that the MCS-12085 …