Preston L. Bannister { random memes }

2008.01.23

DOCTYPE works

Filed under: Web, html@w3c — Preston @ 12:02 am

There is once again talk about versioned web pages. Unfortunately there is also the same continuing confusion between theory and reality.

A List Apart: Articles: Beyond DOCTYPE: Web Standards, Forward Compatibility, and IE8
The DOCTYPE switch is broken

Back in 1998, Todd Fahrner came up with a toggle that would allow a browser to offer two rendering modes: one for developers wishing to follow standards, and another for everyone else. The concept was brilliantly simple. When the user agent encountered a document with a well-formed DOCTYPE declaration of a current HTML standard (i.e. HTML 2.0 wouldn’t cut it), it would assume that the author knew what she was doing and render the page in “standards” mode (laying out elements using the W3C’s box model). But when no DOCTYPE or a malformed DOCTYPE was encountered, the document would be rendered in “quirks” mode, i.e., laying out elements using the non-standard box model of IE5.x/Windows.

The above referenced article goes on to describe a hideously complex new version mechanism, which if adopted is pretty much guaranteed to cause grief. We do not need anything so complex. DOCTYPE works, but what DOCTYPE means may not be what you expect.

This topic is very old and very familiar when developing distributed applications. If you have two independent machines with a network in the middle, sooner or later you are going to be running different software versions on the two (or more) machines. This forces you to think through the issues, and after twenty-odd years working on distributed applications, on this topic I have no doubt as to what works.

What you have to do is version the data. In a distributed application, this is the data that goes across the web. A single version number is sufficient. Note that this version number is not the version of the application.

The DOCTYPE version is all and exactly what we need. In theory the DOCTYPE was meant to indicate exact compliance with a particular W3C specification. In reality DOCTYPE means something else.

Up until the release of IE7, a web page that declared <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> was tested and worked under IE6 (at a very high probability), and may have been tested on other then-current browsers. The DOCTYPE does NOT indicate that the page works in an HTML 4.01 compliant web browser. There was (and is?) no browser that exactly implemented HTML 4.01, so exact 4.01 compliance in the web page is impossible to assert. Lacking a reference implementation of the HTML standard, web developers can only test against the most widely-used web browser(s).

In effect the DOCTYPE string is the version on data – but only vaguely related to the W3C specification.

On the release of IE7, the Microsoft folk fumbled. In changing the interpretation of web pages (no matter how well-intentioned) they changed to meaning of the data. When you change the meaning of the data, you MUST bump the version number.

If you lose the confusion between theory and reality, the DOCTYPE is all we need to exactly version the data (HTML).

2008.01.18

Point of view

Filed under: Humor, Images — Preston @ 7:55 am


xkcd

2008.01.07

Cache Valley Cheese

Filed under: General — Preston @ 8:23 pm

If you happen to be driving down Interstate 15 a ways north of Cedar City, Utah – you might see the sign for Cache Valley Cheese. On the last trip curiosity won and I pulled off in Beaver, Utah to – I hoped – snag some really good cheese. (Heck, they advertise on the highway – they must be good.)

Let me save you the bother. Keep driving….

Bought locally branded cheddar, jack, and mozzarella cheeses. The mozzarella tasted like jack (not a very good jack at that). The jack tasted like … the cheapest jack you could buy at the supermarket. The cheddar was passable – OK to melt on hamburgers (for your less liked/discerning guests), but not something you want to serve on it’s own. All had fairly high moisture content, and were … rather sticky (like Velveeta).

Generic industrial cheese with no character – not what I hoped to find.

2008.01.03

This is still bugging me…

Filed under: Software — Preston @ 2:58 am

Follow this story.

  1. Sun introduces the T2 with many CPUs on one chip – an impressive and appropriate work of technology.
  2. Tim Bray visits the question of how to make use of many CPUs for generic tasks, and poses the Wide Finder as an example task.
  3. Readers create a variety of interesting solutions over the next two months, for which Tim posts 15(!) updates on his weblog.

As sketched above, a very successful topic. The only problem is that the example task is too lightweight to need distribution. Tim Bray used his soapbox to stir interest in a good question, though not with the right example. A reasonable mistake – better to pose the question at the right time, with risk of asking an imperfect question, rather than wait an indefinite time (maybe forever if otherwise busy) until your question is perfect.

What does bother me a great deal is no one asked whether the example task was suitable for distribution! A relatively small set of measurements show that a simple Perl script can process the file data as fast as it can be read off disk, and will be done before all the fancier solutions (those that require the file data already in memory) can get started.

Why did no one ask this question earlier?

Readers of Tim’s weblog picked up the challenge and came up with a variety of interesting answers … that solved the wrong problem. Presumably a good fraction of the readers are young and in or just out of school. That these folk charged off with great energy in the wrong direction – does not bother me much. Surely some portion of Tim’s readership have a bit more experience. The performance of disk and file systems are not too difficult to understand. A relatively small set of measurements can clarify what sort of solutions fit the problem.

Does this specific case offer a more general clue? There are quite a number of open source projects that start with one or a few good ideas, then charge off (with great energy, initially) in what proves to be not really the right direction. Are we looking at the same root cause?