Saturday, April 29, 2006

Day 361

[reading: George Gamow, "Thirty Years That Shook Physics"]

I was idly looking at the website for a dance camp I used to go to, and I thought: hang on, that photograph looks a bit familiar. Easy enough to figure out why: it's one of mine.

I don't really mind them using it, even if it is for one of the more commercial aspects of the camp—I had a lot of fun at Herräng over the years—but it would have been nice if they'd asked before borrowing it.

And then out for a bit of culture in the afternoon: the current staging of the Crucible was excellent. It was good when I read it, and even better on stage.

[A:37261 B:3218 C:346 D:9187 E:5851 Total:55863]

Thursday, April 27, 2006

Day 359

[reading: Ellen Lupton, "Thinking With Type"]

I was going to write a long rant about the VHS capture box and software that I bought today, but I can't be bothered. Just take my word for it: it's awful. It's eaten up my whole afternoon trying to get anything out of it.

[A:37261 B:3218 C:346 D:9187 E:3725 Total:53737]

Tuesday, April 25, 2006

Day 357

[reading: Dave Sim, "Church & State II"]

Slacker's Lunch XI, which is probably the last one for a while. We could do Slacker's Dinner, but that doesn't have the attraction of watching everybody else go back to work as we stay on in the pub.

Oh, and a quick tweak to the pan/zoom for the applet to make it a bit more sane:

Monday, April 24, 2006

Day 356

[reading: Dave Sim, "Church & State I"]

I guess I'm starting to have a bit more respect for graphic designers—Anne and I spent about two and a half hours this morning tweaking and fine tuning the layout for some business cards. I think the end results are rather good, but it took a huge amount of time—it was almost an evolutionary process: we'd randomly generate a large number of different designs, and then pick the least ugly each time round, until we evolved an attractive business card.

I also spent a bit of time playing with embedding version and build information into the binaries for the product. I'd previously added a tracing framework and embedded $Id$ information (for ident) into the code; with a judicious combination of
  • preprocessor hackery (for__DATE__ and __TIME__) to embed
  • static global objects in each source file, whose constructors register information with
  • a Singleton object (to get around the problem of arbitrary order of initialization of global C++ objects), whose contents enable
  • tracing out the build information when trace files are flipped, which in turn needs
  • recursion protection (to prevent a flip which triggers a trace of build info which triggers a flip which triggers a trace which triggers ...)
I think I've now arranged things so that every trace file starts with a dump of the version information and build date for all of the objects. Which will be useful if things go wrong in the field. Not that that will happen, of course.

In the end, my code changes only amounted to around fifty lines. I guess that for software, I've got the experience to know exactly which fifty lines are needed; for graphic design, a proper designer would have the experience to know precisely what tweaks to the layout are needed and would look good.

Saturday, April 22, 2006

Day 354

I've been toying with the idea of converting my software engineering scribbles into DocBook (it's currently in texinfo), so I've started trying to put together a DocBook toolchain. The core tools seemed easy enough to get hold of (the libxml2-bin, openjade and docbook-bundle Fink packages covered most everything), but setting up a makefile for the full system has been quite complicated.

I'm not too convinced by the results as yet, but I haven't really gone too deeply into the markup and the stylesheets. On the plus side, at least the standard references are available online to help out (although if I do shift to DocBook, I'll probably get around to getting the dead tree versions anyway).

Friday, April 21, 2006

Day 353

Well, the latest Tomb Raider was certainly better than the last few of the previous games (and had the advantage of being fairly short). It still had some aspects of the authentic Tomb Raider feel, though: moments of intense frustration when the camera position refuses to show anything useful; bizarre glitches in the 3D models so you can see through the scenery; repeated deaths when the camera arbitrarily decides to flip round so the Left key you're holding suddenly becomes a Right. Ah, the nostalgia.

Wednesday, April 19, 2006

Day 351

Made a bit more progress on playing with my noddy 3D wireframe thing. It was getting tricky to keep track of all of the angles for the model, until I decided to keep a running dreibein* to hold the local orientation; after that, adding more joints and angles was much more straightforward. Not particularly speedy, but then getting the model clear is more important.

Hmm, I wonder if I can dump applets in here...

Left-mouse to pan, right-mouse to zoom (badly). Much debugging to come.

* Inspired by 'vierbeins', which show up in QFT in curved spacetimes.

Tuesday, April 18, 2006

Day 350

I went out dancing last night for the first time in quite a while, and it turns out that the club that I've been going to on and off since 1994 is coming up to its twentieth birthday. Simon, who runs it, is after stories from the club to celebrate the occasion, so I sent him this one:

This story takes place in around 1995, at about ten to midnight on a Monday night at Stompin' at the 100 Club. The place was almost empty, and Simon put on a tango track. Louise Thwaite, Simon's partner at the time, had recently started getting into tango so she was desperately looking around the nearly empty club for a fellow tango dancer. Her eyes lit on me, and she insisted that I come and dance the tango with her.

Unfortunately, I'd already gotten ready to leave for the night. So I had to dance the tango in my motorcycle gear—bulky sweater, padded leather trousers and rigid calf-high armoured boots. At least I didn't have my helmet on.

(And I have to admit, I danced it dreadfully; I couldn't feel any connection and it was difficult to move in anything other than a waddle—not ideal for tango).

Monday, April 17, 2006

Day 349

[reading: Michael Peskin & Daniel Schroeder, "An Introduction to Quantum Field Theory"]

So I've ordered the new Tomb Raider game. The reviews seem to imply it's a decent game, but mostly I'm just a slave to tradition. For a number of years (1996-2000), my standard Xmas routine was to stay home, play Tomb Raider and eat crispy aromatic duck. The games got worse and worse with each iteration; the duck didn't. (The tradition is slightly changed now: a friend of mine usually comes over, and we spend the day watching DVDs and muttering 'humbug'. There's still crispy duck, although twice as much* now.)

Anyway, hopefully it's rather better than the last Tomb Raider game. Apparently, it's also not too long, so it shouldn't take up too much of my remaining Copious Free Time.

* I made a fatal tactical and strategic mistake the first time I had a guest and two crispy ducks: I put the ducks on separate plates. This meant that it was immediately obvious when I'd finished all of my duck and was about to start devouring his (that's the tactical mistake part). It also meant he now insists on separate plates every year (strategic mistake). Drat.

Sunday, April 16, 2006

Day 348

"If wishes were horses, we'd all be eating steak."

"Loose you're marbles too insure an affect."

That's the shortest sentence I could think of that has the top five most-annoyingly-incorrect homonyms from the filthy Internet (although some of them are the other way round from how they're normally observed in the wild). Still, it's not like they're going to disappear anytime soon (cf. The Association For The Abolition Of The Aberrant Apostrophe, The Campaign For Real Science In Movies).

Disclaimer: This post falls under the jurisdiction of Skitt's Law.

Friday, April 14, 2006

Day 346

I've found myself thinking about timezones recently, and how much of a pain they are. It seems to be difficult for software to get timezone stuff right, which I guess is because the core data for timezones is set by administrative fiat rather than anything predictable.

So wouldn't it be helpful if there was a time zone server out there on the internet? A centralized place that held up-to-date timezone information, which would handle various standardized queries:

  • Return a list of available timezones.
  • Given a timezone identifier, return information about that timezone (offset from UTC, dates for DST shifts, amount of DST shift).
  • Given a timezone identifier and a UTC date/time, return the corresponding local time for that timezone.
  • Given a GPS location, return timezone for that location.
  • Given an IP address, return timezone for the reverse-lookup of the location for that IP address.

Obviously, the raw Olsen data for this kind of thing is out there, but none of the web resources seem to quite do everything. Of course, if there were such a server it would need to cope with idiots abusing it.

Wednesday, April 12, 2006

Day 344

[reading: Dave Sim, "High Society"]

Its odd the habits you get into. Once upon a time I worked on a codebase where you werent allowed to use single quote characters*; it took me ages to get out of the habit of skipping apostrophes. I just now realized that Im starting to avoid using ampersands, because they interfere with HTML and XML and its easier to avoid them than to keep track of what system Im typing for.

In other news, I've spent a day or so fiddling with some noddy 3D wireframe animation stuff. So far, it looks like I've only made one sign error. Modulo two, at least.

* This was back in 1987; the codebase was in Pascal, but it was automatically translated from Pascal into C and the slightly-bodged translator code didn't cope with single quotes properly.

Monday, April 10, 2006

Day 342

[reading: Dave Sim, "Cerebus"]

[Edit 7-Nov-2007: I've since found a couple of good explanations.]

In my photography course yesterday, I found myself explaining how flash sync speeds work. To my surprise, there doesn't seem to be an easily-googleable explanation online, so I though it might be worth writing up:

The flash sync speed for a camera is the fastest shutter speed you can set and still use flash. It varies from camera to camera: more recent and more expensive cameras are faster, older cameras are slower (and often have the sync speed helpfully marked in red on the speed dial). If you try to use a shutter speed that's faster than the sync speed you end up with pictures like this:


So what goes wrong?

The first thing to understand is how the camera's shutter works. If you could slow down time, you'd see a sequence like this:


There are two shutter curtains that pass down the frame from top to bottom. This first opens things up to light, and the second closes it again. As the shutter speed gets faster, we reach a point where the shutter never completely opens during the sequence:


Each area of the frame is exposed for the same amount of time (because both shutter curtains move at the same speed), but the top and bottom parts of the frame aren't exposed at the same time.

The second thing to realize is that flash is very fast—much faster than the fastest shutter speed on the camera, maybe 1/16,000 to 1/50,000 of a second. Revisiting our two sequence diagrams:


At this speed, everything is fine. The flash triggers and illuminates the whole of the image. At the faster speed, problems arise:


If we think of the flash as being effectively instantaneous, then because there is no moment where the whole of the frame is exposed at once, there's no moment when the flash could fire and illuminate the whole of the scene. This also explains the sort of problems that occur in the final image:

  • Dark bar at the top of the frame (illustrated above): the camera has triggered the flash when the first shutter curtain reaches the bottom of the frame, but the second curtain is already obscuring the top of the image.
  • Dark bar at the bottom of the frame: the camera has triggered the flash when the second shutter curtain is about to start at the top of the frame, but the first curtain has not yet exposed the whole of the bottom of the image.
Model: Bernard T. Bonsai.

And in other news, we've now had our first directors meeting for the new company.

Sunday, April 09, 2006

Day 341

[reading: Rich Burlew, "On the Origin of PCs"]

Had my first ever photography training today: a studio lighting course at a centre down in Clapham. I've read various books on the subject, so I didn't learn that much in theory—but in practice, spending six hours actually doing it makes a big difference. I suspect I'll still take dreadful portraits, but they might now be well-lit dreadful portraits.

Saturday, April 08, 2006

Day 340

Finally getting around to some picture-taking with my most recent lens acquisition:





And then on to the British Museum for some culture (although it veered a bit too far in the direction of popular culture for me).

Thursday, April 06, 2006

Day 338

So it turns out that my birthday is International Talk Like A Pirate day. Perhaps this is a sign: I already had pastafarian tendencies, but this shows the influence of His Noodly Appendage.

Wednesday, April 05, 2006

Day 337

Urk. My chances of getting a few things off my long-term Projects To Do list before the Project X moves into high gear are being eroded.

Tuesday, April 04, 2006

Day 336

Time for a Slacker's lunch, aiming at a Thai place this time round. I can't recommend it: mostly mediocre food from a ridiculously expensive set menu (even for the City), with a bizarre insistence on making us wait at the bar while they "prepared a table" in an empty restaurant. But I bounced an idea off my fellow slacker over lunch, which he seemed to think was a decent idea—so maybe I need to learn more about how GPS and RFID work.

Monday, April 03, 2006

Day 335

We decided it was time to tidy up the diagnostics for the product, so I spent today going through the code converting it to use an C++ trace framework that I wrote back in 2000. Getting a basic version running under Windows was straightforward, but it seems the more advanced features are going to be harder to port—inter-process locking and memory-mapped files and suchlike.

I'm sure there are ways of doing what's needed in Win32, but it's just so much more of a pain in the arse to program to than the equivalent UNIXy APIs. In UNIX-land, you can figure out what's needed just from the API documentation, but in Windows-land you don't have any chance of getting things working unless you've got some sample code to work from. Anne told me about a friend who had to use a new Microsoft API that didn't come with any sample code; in the end, he had to use a perl script to autogenerate every possible variant of the code to use the API, and run them all to see which one worked.

I could definitely do with a decent low-level Win32 API book. Ideally, an equivalent to Stevens—in fact, a translation guide which covered how to achieve equivalent effects under Win32 would be perfect.

[Edit 16-Jun-06: Johnson Hart's Windows System Programming has a helpful appendix comparing Win32 with POSIX and libc.]

Sunday, April 02, 2006

Day 334

Took the bike out for the first time this year. I had to recharge the battery and change the spark plugs* to get it going, but after that it seemed to run fairly well.

Getting into my leathers was a bit more difficult, though. Perhaps they've shrunk in the wash. Except I haven't washed them.

* A tip I found out a few years ago: if you leave an engine for a while, the petrol breaks down and gums up the spark plugs. So if I'm not going to ride the bike for a bit, I take out the spark plugs (and swap them for an old pair, so that the holes in the side of the engine are closed off).