Wed Mar 5 15:07:06 GMT 2003
Mon Mar 3 23:27:11 GMT 2003
Digital Sound Desks

This is the current sound desk that Imperial Union use. As analog desks go it's really nice, but one cannot help but wonder, everytime that it's used, if a digital one wouldn't be better.

I can decode an ogg stream, FFT it, FFT it back and write it to the sound card using 30% of one of my PII 450s. That suggests that I could process about 6 CD quality streams in real time. That's not helpful as we have 32 incoming XLR feeds. Also, quality ADCs output 96Khz, 24-bit and I could only manage a couple of those.

Thankfully, FFT is pretty simple operation and a Xilinx (or 2, or 3 etc) could handle all 32 96/24 streams. A quick calculation suggest that it's 4.6 MB/s (remembering that a real domain FFT can throw away half the results) and that's easy to handle.

Still, I might see if I can simulate some 3D spaces with sound in them and have a play about with feedback suppression etc.

Sun Mar 2 13:08:34 GMT 2003

Does anyone have the audio recordings of CodeCon? Mail me.

"US dirty tricks to win vote on Iraq war". Who wants to bet that 'a friendly foreign intelligence agency asking for its input' is the UK?

Watson (on the 50th anniversary of his discovery) says stupidity should be cured

Sat Mar 1 19:04:11 GMT 2003

BCS (British Programming Competition) today, so a 6:30am start and off to IBM in Winchester. The rules are very different from the BIO and IOI that I'm used to. For one, you enter in teams of 5 and you only have a single computer.

Things certainly weren't helped by the fact that I didn't wake up until 1pm (Cola for lunch did it). After that things started moving, but we should have done a lot better really. In the end we came fifth, beating the Cambridge team at least.

Wed Feb 26 20:08:07 GMT 2003
Coins

What's special about the value of English coins that a greedy algorithm for picking them seems to work right? If you only had 1p, 20p and 50p, and you were trying to make 60p then a greedy algorithm would get you a solution with 11 coins (50 + 10×1), while the best one does it in 3 (3×20). So a greedy solution doesn't work in the general case, but I can't find a counter example for English coins.

So, is there a counter example that I've missed, or is there something special about the value of English coins?

(English coins are 200p, 100p, 50p, 20p, 10p, 5p, 2p and 1p)

Sun Feb 23 20:24:00 GMT 2003

Codecon is going on at the moment. As far as I knew, it was in a 21+ venue again (it was in DNA last year) but there are some noises on IRC that it's only 18+. Damm! I might have been able to go! Probably couldn't have afforded it anyway. Hopefully there will be tarballs of the audio again.

The air-con in the labs had failed and it's getting pretty hot in here now with all 150 or so computers. However, I have switched to using Phoenix (currently the best browser, IMHO) so it's not all bad news

Sun Feb 23 20:03:31 GMT 2003
Rent (part 2)

Read the first part first or this will make no sense at all.

Rupert had given the people in his labs the rest of the week off once the bulk of the first message had been decoded but many of the people there couldn't imagine anything better in the world than working to finish the decoding. There were many details still to be understood, but they were falling under the attack faster and faster. People in the labs were conversing in the highly structured language of the alien message and an outsiders were starting to have problems following conversations.

The next morning, Rupert was once again standing in the Nu-Vu conference room which had been converted into a semi-permanent media war room, starting to hate shirts and ties as the lights above baked him.

"Last night, several members of the Nu-Vu labs team that helped to decode the first message, received another via the satellite communications equipment that was setup immediately once we started decoding. At this moment we can be sure that someone on Earth sent the reply.

The communication with the aliens started at 0233 this morning and terminated at 0245. It was mostly consisted of incoming information and we are still revising our translation. I hesitate to say anything while our teams are still unfinished, but this cannot wait any longer. Please understand that details may change.

As best we can tell, and I'm finding this pretty hard to believe, the situation is this:

Our entire universe is a simulation. Every interaction of every particle is calculated at each step in time and the universe is advanced. As we are part of the universe we perceive this as forward motion in time. We think, and translations of this are still sketchy, that this information is embedded somehow in the physical working of the universe and that we would have discovered it once our physics was advanced enough.

There are many universes like ours, differing only in the physical laws that govern them. The purpose of all these universes is to generate mathematics and the reason that the aliens are telling us all this is because we are falling behind. Unless we produce enough this universe will be terminated. In short, they need help paying the rent.

Because of this, they are seeking to contact all the unenlightened species and asking them to package up all their mathematical knowledge into their language. In a little over 22 years they will be back to collect it from us and deliver it to a point in space that acts as an information conduct out of the universe.

At our request, we think they have agreed to take an observation capsule to this point, which we are calling the origin.

That's it. I'm going back to the labs now and will brief you again in half an hour with any corrections to that translation. The wording is our own, but we are quite confident that the important points are correct. I know how fantastic this all sounds and I think it's going to be another interesting day.

Thank you."

The news didn't speak of anything else for a week.

Rupert remembered motion in space being very slow and delicate. The arms that extended from the top and bottom of the window were anything but. They shot into place with perfect accuracy, coupling with the origin at the top and bottom. Barely a second after that they retracted again and, in a moment, had vanished. Was that it? Had the whole of human mathematical knowledge and that of an unknown number of other races been transfered in that short time? It had taken over 20 years of painstaking but frantic work, coordinated by an international body lead by Rupert, to convert proofs into the rigorous format that the Gods (as the beings who ran the universe had become known) demanded. Many had failed under the close scrutiny and mankind hoped that it was enough. The origin seemed to start moving as the ship turned for the return journey.

The cream of human mathematicians that populated the capsule began to drift away from the window. Further away from Earth than any human had ever been, a professor dropped an empty Starbucks cup into the bin. They were all thankful for the 1 gee artificial gravity that the alien ship provided the Nu-Vu capsule that looked so out of place bolted onto the alien ship. It seemed that only humans had requested a ride. Or maybe no other unenlightened species had been found.

Time stopped.

The universe disappeared.

Physical laws twitched almost imperceptibly.

At a single point an unimaginable amount of energy was poked into memory.

Sat Feb 22 22:51:52 GMT 2003

The carefully planned generator that was meant to keep the core servers running during the power cut, died due to earth leakage. The UPSes let the servers down gently, but they were still down for a while.

And oddly, we managed to blow a lot of fuses somehow. Admittedly, some of them were 1 amp fuses and it doesn't take a lot to kill those. (somehow siskin now needs at least a 3 amp fuse when it has lived on 1 amp for months). We also managed to blow a few power supplies in a room which was totally isolated. The mind boggles.

Anyway, things are mostly working now.

Fri Feb 21 12:46:55 GMT 2003

IC draws so much power (despite the fact that we have our own power station on campus) that the supply is having to be upgraded. Because of this Dept/Comp are having a power cut tomorrow morning. We should have a genny, but I don't know how many of the servers we can put on it, so IV maybe down for a while.

Wed Feb 19 22:01:18 GMT 2003
Rent

Here's the first part (of 2) of a really-short story.

Everyone in the capsule bustled around the window as the origin swung into view. The balance of politeness and eagerness kept the crew from pushing to get closer, but just barely. As the reflection of the ship and stars twisted and warped around the perfect surface its shape became clear. "Axial symmetry. Bugger. Doesn't define direction then" thought Rupert.

Rupert had been a middle manager at Nu-Vu Labs during first contact. Nu-Vu was the unlikely, but fortunate, result of the collapse of NASA. While most companies were happy to peck tiny parts of NASA for their own ends the founders of Nu-Vu had managed, somehow, to get funding to buy large chunks of NASAs' research divisions through a number of mind-contorting legal agreements. It now did outsourced research for hire for a fair number of the Fortune 1000 companies. Quite how it had all worked, Rupert wasn't sure. He was just very glad that it had.

Academically acceptable, Rupert had never excelled at anything much and had staggered, more than anything, down his career path. Well off parents had managed to get him into Stanford and he came out as an average management type in a world full of average management types. With a couple of years experience doing nothing of note, getting the job at Nu-Vu (which was hiring as fast as possible) had been the biggest break of his life. However, at the time, managing a group that researched communication theory had merely been a quick escape from a small company that now included the other half of the messy end of a relationship.

It just happened that a few months later the first alien message was received and the resulting effort to decode it meant that communications theory enjoyed the steepest rise in attention and funding of any research area, ever.

The media went into a fit. The raw data from the SETI project was distributed all over the 'net and it seemed that everyone on the planet had their own take on what it meant. Channels were dedicated to following the researchers who were pouring over the data 24 hours a day all around the world and while the cranks got their 15 minutes of fame, explaining to the camera their latest theory, Rupert's face led most of the reports.

It wasn't that he was partially smart (in fact, truth be told, he didn't even grasp half of what was going on in his own lab) but he had the right face and was junior enough a manager to seem involved. Because of this, it was he who announced, after 2 days, that the aliens had asked for us to ring them back and had given the position of a communications relay and frequency to do so.

The talk shows exploded. Everyone on the planet had an opinion of what we should do and it was only fueled by the pictures of the communications relay taken by Hubble (which silenced many of the people who doubted that the original message was genuine).

But few people commented that the debates were rather useless. If the first message had been picked up and decoded in private then it could have been contained. But SETI wasn't that sort of organisation and had spread the message far and wide.

Noone knows, to this day, who sent the reply

Wed Feb 19 20:50:28 GMT 2003
Microsoft Visitation

Dear old M$ came a visiting today to espouse the virtues of .NET. The front row of the lecture theatre was full of systems people (myself included) wearing Apple, Linux and WebSphere T-shirts, so it was a pretty tough audience.

But the M$ guy spoke really well and said only a few dumb things ("ASP is a scripting language so it runs on the client", "You need to R&D of commercial software houses to develop quality products") and it was generally a pretty noddy introduction to .NET.

He demoed VS.NET doing web services stuff (it really looks like web services are a Big Thing (tm) at Microsoft now) and it worked well. But like most M$ stuff, if you wish to change any of the details you have better pre-book the triple heart bypass operation for the stress. He also showed linking a C# and J# (java to you and I) application together, and he used vim to edit the files no less.

I also got to play with a Tablet PC. The handwriting recognition worked well for me (I have the girliest handwriting, however), but it's nothing special. A neat packaging of technology - no great break throughs.

Hmm, that's actually a pretty positive entry about M$ I know, but they are being really nice to us. We (as students of Dept of Comp) can now get any M$ software for free. Don't know why we would wish to, but we could

Tue Feb 18 13:00:48 GMT 2003

XFree 4.2.99 has transparent cursors, which is quite nice

Lucrative is a new anonymous cash project (yes, another one and we're still waiting to hear a peep out of OpenDBS; hint Ryan) but it's there anyway. These projects can generally be classified pretty grossly and Lucrative is based on Lucre, but I can't remember the classification of Lucre.

It seems that Intel have really tried with their compiler (non-freespech but free-beer for non-commercial) and make it a GCC drop-in. It can't compile a kernel without a fair amount of bodges, but I managed to get portage to use it and it compiled a number of packages perfectly. I just need to benchmark them now.

Sun Feb 16 12:33:55 GMT 2003

There was a first alarm at 4:30 this morning. I grabbed my coat, jumped into my slippers and got out of the building. Seeing I was the only person there I yelled,

"First Post!"

Fri Feb 14 23:50:36 GMT 2003

Did you know you can rename network interfaces under Linux. It could be quite useful to have a utility that reads a mapping of MAC addresses to names and sets all the interface names. That way you could work with inside and outside and not eth0 and eth1. A quick utility for your renaming pleasure:

/* if_rename.c - Renames linux network interfaces
 * Adam Langley <aglREMOVETHIS@imperialviolet.org>
 * % gcc -o if_rename if_rename.c -Wall
 */

#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/sockios.h>
#include <stdio.h>
#include <string.h>

int
main (int argc, char **argv)
{
	struct ifreq ifr;
	int fd;

	if (argc != 3) {
		printf ("Usage: %s <old interface name> <new interface name>\n", argv[0]);
		return 1;
	}
	
	if (strlen (argv[1]) > IFNAMSIZ - 1 || strlen (argv[2]) > IFNAMSIZ - 1) {
		printf ("String too long (max length is %d chars)\n", IFNAMSIZ - 1);
		return 2;
	}

	strcpy (ifr.ifr_name, argv[1]);
	strcpy (ifr.ifr_newname, argv[2]);

	fd = socket (PF_INET, SOCK_STREAM, 0);
	if (fd < 0) {
		printf ("I cannot create a normal TCP socket. It is, of course, possible "
		"to not build your kernel with TCP/IP support, in which case you have to " 
		"hack this utility to work you wizard you.\n");
		return 3;
	}
	if (ioctl (fd, SIOCSIFNAME, &ifr) == -1) {
		perror ("ioctl");
		printf ("Are you root? Is %s down? Does %s even exist?\n", argv[0], 
			argv[0]);
		return 4;
	}

	return 0;
}
Fri Feb 14 17:07:04 GMT 2003

(read the previous post first)

Guess what? It had happened! It just so perfectly matched the divine comedy that is my life I never really had any doubt

Fri Feb 14 12:11:19 GMT 2003

I think JWZ and I have the same personal gods who take great pleasure in our misfortune. (seriously, read that link). However, unlike JWZ I actually laugh along.

I suddenly realised something at about 10 this morning walking down a corridor and nearly wet myself. People were walking past me quickly as I just spontaneously burst into fits of giggles. I'm sure a fair number of random people I've never met now think I've a serious mental problem. And I'm still going hours later!

Thing is, I don't actually know that it's happened. But it's just so perfect, and so wonderfully typical of me I'm sure it has. The hand of fate will not be thwarted!

But I'm afraid, dear reader, that the details shall not grace these pages.

Thu Feb 13 14:54:58 GMT 2003

Still working on the Secure NFS thing. Been looking at a couple of kernel patches:

Firstly, epoll. This used to be known as /dev/epoll, but it's now a set of system calls and is merged into 2.5. Patches are on that site for 2.4.

This is basically a replacement for the poll system call (though it is edge-triggered, not level-triggered) and, as the results on the webpage show, works much more quickly for large fd sets. I still have some worries about some multithreading issues with this, but it looks like I'm going to use it.

Secondly, the Kernel Mode Linux patch. This runs processes in the kernel address space, making system calls much faster. Results from my computer are 286 cycles/getpid from user-land and 6 cycles/getpid from kernel-land. This would be nice to have (see below) but, unfortunately, it seems to cause random crashes in (at least) vim and xmms.

To explain why fast system calls would be really nice, consider: My current numbers for the amount of processing I'm going to be doing is 250MB/s in 300 byte packets. That's somewhat pessimistic, but that's what I'm going on. That about 830,000 packets/second. If a system call takes 400 cycles (the 286 figure is for getpid, other system calls do a little more work and with the TBL flushes, it's at least 400) that's 330 megacycles of system calls per second (for 1 system call per packet). But it's going to take more than one system call per packet even with funky vector IO so, basically, I'm looking at about 600 MHz just for system calls. Ouch.

(I reserve the right to ridicule these numbers later)

Mon Feb 10 19:42:12 GMT 2003

Designs for stuff. More so that I don't forget really.

Caching MBoxes

For mail servers that handle mboxes (POP/IMAP) it's a real pain when you have to parse the whole mbox every time. Especially when the mboxes are large. Especially, especially when said mboxes are NFS mounted.

So the simple observation is that mboxes are append only and other mail clients will only change something in the middle if they are deleting a message. Thus:

The above design is pretty much implemented and has a POP3 server wrapped around it. It still needs a fair amount of work tidying it up but I might stick it up here at some point. It was going to be an IMAP4 server, but having seen the IMAP protocol I don't think that's going to happen.

Secure NFS

NFS is generally pretty delicate. And while other projects aim to fix it properly I'm going to leave it well alone.

So, the general design at the moment is to put a box (call it bastion) in front of the NFS server (call it falcon) that handles all the traffic for it. The clients use a tuntap to direct NFS traffic down an RC4 encrypted TCP tunnel to bastion. Bastion then sends decrypts it and sends the packets onto falcon, which is none the wiser.

Sat Feb 8 17:23:25 GMT 2003
The Salmon Of Doubt

I swear when I came here that I intended to do some work. I really did! Look, there's a problem sheet to prove it. (there's also an empty pack of Munchies, which I don't remember eating but I suppose that I must have because it was full 20 minutes ago.)

But alas, Waterstones are finally selling the paperback edition of The Salmon Of Doubt and my spotting and subsequent purchase of the aforementioned book is the current reason for the lack of work and, I suspect, will continue being so until I finish it.

"Why, ", you might ask, "has such an Adams fan not obtained himself a copy of this work of art before?". Well, the hardback edition was £18. Which isn't really a lot and, in my school days, would not even have been an item of note on my monthly book expenditure. But being the poor student that I now find myself, living in the centre of a city that is, by all accounts, extremely expensive; £18 seems a lot of money. Every time I saw the book on the shelf I could never quite justify the cost.

Thankfully, I now can. And I now need to finish the damm thing before so that I can do the work I need to do for Monday!

Fri Feb 7 23:26:14 GMT 2003
Twisted Python

Twisted describes itself as "Twisted is a framework, written in Python, for writing networked applications". You can browse the documentation to your hearts' delight, but I'll take you through the (small) code for doing a POP3 server.

class POP3(LineReceiver):
	def connectionMake (self):
		self.transport.write ("+OK POP3 Ready\r\n");
	def lineReceived(self, line):
		...

factory = Factory ()
factory.protocol = POP3

reactor.listenTCP (8007, factory)
reactor.run ()

And that's all (minus the import lines). Since POP3 is purely a line based protocol we can subclass the LineReceiver which handles all the buffering for us. The code is pretty self explanatory.

Twisted works as an async core and, as such, your functions cannot block (say, reading a large mbox). In these cases, you use Twisted's threading functions:


	def command_RETR (self, parts):
		reactor.callInThread (self.RETR_worker, n, -1)
	def RETR_worker (self, n, top_lines):
		ret = cStringIO.StringIO ()
		n = self.mbox.message_numbers_get (n)
		...

Twisted also offers very nice objects for callbacks when a thread function returns a value.

Twisted provides pretty much everything you could ask for in a networking framework and more besides. Just look at the list of modules in the API reference

Site Map
/Root
     AlternateThe Weird and Wonderful
          BacklinksWhat are backlinks
          John GilmoreWhat's Wrong with Copy Protection
     ArchivesBlog Archives
          OneArchive 1
          TwoArchive 2
          ThreeArchive 3
          FourArchive 4
          FiveArchive 5
          SixArchive 6
          SevenArchive 7
          EightArchive 8
          NineArchive 9
          TenArchive 10
          ElevenArchive 11
          TwelveArchive 12
          ThirteenArchive 13
          FourteenArchive 14
          FifteenArchive 15
          SixteenArchive 16
          SeventeenArchive 17
          EighteenArchive 18
          NineteenArchive 19
          Twenty Archive 20
          Twenty OneArchive 21
          Twenty TwoArchive 22
          Twenty ThreeArchive 23
          Twenty FourArchive 24
          Twenty FiveArchive 25
          Twenty SixArchive 26
          Twenty SevenArchive 27
          Twenty EightArchive 28
          Twenty NineArchive 29
          Thirty Archive 30
     PhotosPoor People Caught on Film
          Jack and the Beanstalk Jack and the Beanstalk
          RIP ScanResults of a Stage Scan Fire
          YosemiteYosemite National Park
     ProjectsIncomplete things from the lab
          Seagull's BaneLinux Automounter
          bttrackdBitTorrent Tracker
          CAPTCHACAPTCHA CGI script
          ConservConsole Serving
          DeerparkUsing Tor with Firefox/1.1 (Deerpark)
          DNSFixFixing DNS
          XoversXTA Crossover Control
          IAFSArchive Org Storage
          JBIG2JBIG2 Encoder
          VerifyPGP Key Verifier
          MaxFlowMaximal Flow in Python
          PyBloomBloom Filters in Python
          pyGnuTLSPython wrapping of GnuTLS
          SxmapApache SuEXEC Map
          HellardUnion Server Notes
     RecordingsFree recordings
          ICSM ChoirSt Paul's Church
     SchoolAncient School Stuff
     WritingsWho knows
          Cap SystemsCapability Systems
          IntroIntroduction to me
          SupremaJMC2 Group Project
          MP LettersLetters I've written to my MP
          SoundSound With Dramsoc
          SyncThreadingThe wonders of user-land threads