As of today, I am married to a British Citizen.
See Abi’s post for more details.
No gods, no kings, no billionaires
I came across an amusing bug in IE6 last week. The existence of a bug in IE is no great surprise, but the way it manifests itself is quite interesting: with just a tiny bit of HTML and CSS, you can cause IE’s CPU usage to spike up to 100% and stay there, slowly leaking away memory. It seems unlikely that this has never been seen before, (especially as it doesn’t occur in the IE7 beta), but I couldn’t find a reference to it anywhere on the web, so I’m posting it here.
It starts off with a simple piece of HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"><html>
<head>
<title>IE6 100% CPU test page</title>
</head>
<body>
<table>
<tr>
<td>
<p><span class="test">abcd efgh ijkl mnop</span></p>
</td>
</tr>
</table>
</body>
</html>
Especially in table-based layouts, it’s not unusual to see a span wrapped in a p wrapped in a table cell. The problem kicks in, though, when you apply the following CSS:
<style type="text/css">
p {
padding:0.5em;
position:relative;
white-space:nowrap;
}
span.test {
padding:1em;
}
</style>
Setting the position of the p is potentially unusual, and you might wonder why the white-space:nowrap is being applied to the paragraph rather than the span, but at least on the surface, it all looks kosher. Nuh-uh.
I’ve set up a test page with exactly this code in it. Try using IE6 to visit it. Does everything seem to be working as normal? How about if you try resizing your window to narrow it down…and down…until it’s just wide enough to hold the text. Oh no! It’s dead. Poor IE.
Now imagine the text in the cell being wider, or the table having several of those cells in a row, so that even at a normal window size the CPU usage spikes as soon as you load the page. Major bumcraft. This was a pig to track down and debug.
But even having reduced the problem to a simple test case, I’m still not sure why this should go wrong. It looks like IE’s rendering model is unable to resolve a circular reference between the p and the span when the forced width of the nowrap and the added paddings interact. But beyond that…mmmidunno. As always, it pays to be on your guard when dealing with IE and padding.
Update (20 Feb 2006): After playing around with this bug a bit more, I’ve found that it’s even worse than I’d first described. You don’t even need the p to be embedded in a table cell to bring IE down. Using the same CSS as above, the following HTML is sufficient (example 2):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"><html>
<head>
<title>IE6 100% CPU test page</title>
</head>
<body>
<p><span class="test">abcd efgh ijkl mnop</span></p>
</body>
</html>
You don’t even have to use a p and a nested span, either. Although I haven’t tested every possible combination, it looks like any inline element nested within a block-level element shows the same behaviour, e.g. an em within a h3 or an a inside a div. If you nest a block-level element inside another block (e.g. a p inside a div, everything’s fine.
What’s even more amusing is if you remove the DTD from the HTML above, and watch what happens (example 3). IE still goes to 100% cpu, but it retains just enough spare capacity to refresh its display. This time, if you narrow the window down, the text disappears, and the window’s vertical scrollbar makes it look like the page has got enormously tall. But if you try scrolling up and down, the content is nowhere to be found. If fact, it looks like IE is still trying to figure out where the content should go, too: if you scroll part-way down the (blank) page, you’ll notice the scroll block jumping up and down like a confused monkey.
But then if you try to widen the window back to its original size, it freezes up completely again.
And yes, it also works if you place the style definitions inline, rather than in a <style> block (example 4):
<html>
<head>
<title>IE6 100% CPU test page</title>
</head>
<body>
<p style="padding:0.5em;position:relative;white-space:nowrap"><a style="padding:0.3em"
href="http://www.example.com">abcd efgh ijkl mnop.</a></p>
</body>
</html>
If you needed another reason why it’s a really bad idea to allow visitors to use HTML in your blog comments section, well, there you go.
Over at Bloggie-nominated The Movie Blog, oft-proclaimed “Founder and Editor” John Campea is busy eliminating all traces of Richard Brunton, who wrote most of the site’s content last year. The other week, John told Richard (by means of an an article in the Hamilton Spectator) that he is now earning enough money from the site to quit his day job. Richard, who has received (I believe) approximately the cost of a sandwich and coffee in expenses from the site, went “WTF?” Whereupon John told him he was no longer needed.
Classy.
I realized the other day that I hadn’t downloaded any new music since the beginning of November. Yikes! No wonder my days were feeling stale and uninspired. So here’s what I’ve grabbed as the first batch of new(ish) music for 2006:
Mmmm. It’s a great start to the year.
The @Media 2006 conference has just been announced, and it looks bigger and better than last year. I must try to get down to this. Last year’s conference sounded awesome.
Update: I’m all signed up for it. Woo!
In terms of games, 2005 was quite a telling year, in terms of illustrating the types of game I play most:
Let’s see…that would be four cartoonish “kids” games, one silly extreme sports title, and a story-based first person shooter. Picking a favourite is easy–Ratchet: Gladiator.
In its latest incarnation, R&C has finally become what is has been been evolving into since the first game: the perfect three-dimensional translation of an old school shoot-em-up. You’ve got your power-ups, your health packs, ever-increasing firepower, complex enemy attack patterns, and tough boss battles. The “levels” are linked by a story that is every bit as fun as the three previous games, but the platforming element is gone, and what is left is distilled essence of manic combat. The amount of explosive graphic detail the game engine renders without any slowdown whatsoever is mind-blowing. The controls are perfectly tuned, providing a sensation of fluidity and total immersion in the moment. Psychologically, the game provides quick bursts of action, peppered with small yet significant rewards at every turn. It has the “just one more” factor down to a T. I love this game.
At the other extreme of my game-playing lay Half-Life 2 on the PC. I enjoyed it, but I can’t say that it was a life-altering experience. It had some intense moments, and many thrilling and memorable sequences, but is it a game I would ever go back to? No. I am simply not an FPS kind of guy any more.
Nor am I a PC gamer any more. I appreciate that the PC is going to continue offering the best graphics of any platform, but that doesn’t really interest me. I’ll choose a fun, bright, cartoonish world over a perfectly rendered environment any day. I want simple gameplay. I don’t generally enjoy realistic violence. (Cartoon violence is a different matter, and more is generally better.) Bring on the Revolution.
In fact, I’ve even got to the point where I’m considering selling my XBox. The only games I have for it right now are Halo, Halo 2, and Burnout 3. The Burnout series is cross-platform, so I could get it on the PS2 or the Cube if I wanted to play it again. Halo was excellent, and it’s a game I might well go back to. Halo 2 I never finished, and, to be honest, I’m not sure I ever will. (I got bogged down on the levels where I had to play as the aliens, and I got bored of having to hack through the Flood again. I’ve been keeping it around on an “I know I should play this, but…” basis.) I know of no XBox-only titles currently available or in development that interest me. Given that I will probably buy myself an XBox 360 at some point in the future (“it’s the sound of…inevitability”), I’ll be able to play these games in backwards-compatibility mode should I ever feel the need.
(Yeah, I think that’s decided. The XBox goes. I can use the money from selling it to fund some games I am really looking forward to, all of which are due to land in February: We Love Katamari, Shadow Of The Colossus, and Psychonauts.)
Finally, my 2005 games roundup would not be complete without mentioning a non-videogame highlight, namely Poker. I bought myself a set of poker chips at the beginning of the year, and I’ve been getting together with a small gang of buddies every now and then for an evening of Hold’em, booze, junk food, and much hilarity. I was playing on-line for a while earlier in the year, and according to my statistics spreadsheet, I managed to get over 50 hours of raked hands and 100 tournaments out of my initial $50 stake before going bust. Not bad. I haven’t reloaded yet, because I found it was swallowing too much time in the evenings. Our gang has been talking about a real-life casino trip for a while, and maybe we’ll make that happen in 2006.