An ineffable moment

[2008-12-31+07:00 / 2009-01-01Z]

If we add it all up, the XML Schema Working Group has spent a lot of time, since the beginning of the group, worrying about leap seconds.

XSD 1.0 attempts to accommodate them in its descriptions of the date/time types, but leaves some aspects of behavior unspecified. Accordingly, implementations of XSD 1.0 vary wildly in how carefully they handle leap seconds; not every implementation comes with built-in knowledge of when leap seconds have occurred in the past, and not every implementation enforces the rules which specify that, when they occur in the future, leap seconds will occur only at midnight, UTC, at the end of a month. You can read some things on the Web that seem to imply leap seconds can only occur at the end of June or December, or possibly also March and September, but that’s not what the relevant spec says. The quarter days are to be preferred, but in principle a leap second could occur at the end of any month. You can also read things on the Web that suggest many people are uncertain whether the responsible authorities could in principle insert (or delete) two leap seconds at a time, or even more. I was unsure myself, until some time after I read the relevant specification it finally dawned on me that the answer is no.

[“The relevant spec?” asked Enrique. “Which is that?” “Well, if you want to be precise, it’s Recommendation ITU-R TF.460-6: Standard-frequency and time-signal emissions, published by the International Telecommunications Union (Geneva: ITU, February 2002). I don’t remember how I managed to acquire a copy.” “And how can you be sure there can never be adjacent leap seconds, if it doesn’t say that flat out?” “What it says is that leap seconds are to be added at the end of some month, UTC, in order to keep UTC within 0.8 seconds of the appropriate solar time measure (maybe UT1 or UT2, but it’s been a while and I forget the details). If after adding two leap seconds, UTC is within 0.8 seconds of solar time, then before they were added it must have been more than 0.8 seconds off. But it’s not allowed to be more than 0.8 seconds off — that’s the point of adding or deleting leap seconds.” “What if there was a large change between January and June?” insisted Enrique. “Then the spec implies that a leap second should be added between January and June. The spec does not limit the insertion of leap seconds to December 31 and June 30, it just says to prefer those dates. I think the implication is pretty clear that if you need to add a leap second at the end of May, you are supposed to do so.”

[“Yeah, but what if the world slowed down by two seconds in the course of a single month? Isn’t that logically possible?” “Logically possible, yeah, I guess so. But astronomically implausible. If the rotation of the earth starts to vary that much, it’s likely to be because a large asteroid just hit us, or something. Under those circumstances, schema-validity is likely to be the least of our worries” “Well, my point exactly,” said Enrique. “If the world is falling apart, that’s the last time you want your systems to start failing because the schema validator doesn’t like your time stamps. There will be more important things to be worrying about!”]

In developing XSD 1.1, we spent a lot of time trying to nail things down better, but ultimately reached the conclusion that there just was no good way to allow all real leap seconds and only real leap seconds, to handle validation of dateTime values for the future, and to maintain the principle that a document’s schema-validity against a given schema is the same today and in the future; it should not change from day to day depending on decisions made by the managers of Universal Coordinated Time. In the end, we said that XSD 1.1 processors just don’t handle leap seconds at all: the moments in the global time-line which are occupied by leap seconds do not correspond to values in the xsd:dateTime value space.

It’s an important principle of schema design (and of the use of other formalisms as well, I think) that in the general case, what the formal notation can express may be only an approximation to the reality you are modeling. Some things may exist without being able to be spoken. Mostly we mean by that that specific rules that apply in a given context may not be expressible in a given formal notation, since the expressive power of the formalism may be hobbled in order to preserve its tractability. It’s nice, I think, that the principle is also instantiated by the dateTime type: there are some moments of UTC time that cannot be captured as values in the dateTime value space.

All this is on my mind, of course, because one of those moments is scheduled to occur today. At midnight UTC. Any moment, now, in fact.

[Pause.]

[“Shouldn’t it be midnight local time?” hissed Enrique. “No, you’re thinking of shifting to and from Daylight Savings Time. Leap seconds are inserted at the same moment all around the globe. Hush, now, don’t spoil it. Just wait and watch.”]

And there it went. Midnight UTC has passed, and the sequence of seconds shown by the applet at http://www.time.gov for Mountain Time went:

  • 16:59:56
  • 16:59:57
  • 16:59:58
  • 16:59:59
  • 16:59:60 [That’s it! That’s it!! “Hey, come look at this!” I wanted to call to my wife.]
  • 17:00:00 [“No, wait, never mind. It’s over already.”
  • 17:00:01

All of these past weeks, as events in W3C and in the economy and in the world have gone from bad to worse, I’ve been waiting impatiently to shake the dust of this year from my feet, and yearning for 2009 and a new leaf. The new year will surely be hard in many ways, I tell myself, but it cannot be as bad as the year just ending. As far as I can tell, I am not alone; 2009 has a heavy freight of hope and expectations to carry. A heavier freight than it’s fair to ask any year to bear.

So I like the idea that between the old year, so widely and deservingly anathematized, and the new one which carries so much fragile hope, time paused, just for a second, to gather its forces before picking up its burden and marching forward again.

Happy New Year, o my readers. Happy New Year.

Moving a WordPress blog to a new domain

[12 December 2008]

Having just moved this blog from people.w3.org to cmsmcq.com, I think it might be useful (to others, or to me down the road) to record what I did in order to make the move relatively smooth.

I started out thinking that I would have to export all the data from MySQL on people.w3.org (using my handy backup routine), move the resulting mib.sql file to cmsmcq.com, and load it from the command line.

Reading the various documents about moving blogs from one site to another, or within a site, however, I discovered that that wasn’t what anyone recommended. Export from the old site, I read, and then import into the new site. WordPress has developed a handy export format that can be used conveniently for this purpose.

I tried it. Export worked fine, and I edited the resulting XML document to change all occurrences of “http://people.w3.org/~cmsmcq/blog” to “http://cmsmcq.com/mib”. Then I imported the file to the new WordPress installation. Several articles loaded successfully, but by no means all, and those that did load did not have similar query strings in their URIs. Article http://people.w3.org/~cmsmcq/blog/?p=12 might appear as http://cmsmcq.com/mib/?p=3, not as ...?p=12. That’s a pain, because I’d like to redirect from the old locations to the new, so existing references to the blog don’t break. I know I can build a table containing all the URIs of everything in the blog, and map each to the appropriate URI on the new host, but I’d really rather not have to spend time on that.

I never did figure out why only part of the data was loading successfully; deleting spam from the site, and then re-exporting helped some (more of the posts loaded), but I never got everything to load.

So I reconsidered. I made a new SQL dump of the database on the old site, and edited it to change URIs from the old name to the new. (I also deleted the commands to load data into the user and options tables, since I didn’t want to overwrite them. I deleted the Spam Karma 2 tables, too, since my new host has a newer version of Word Press and the existing SK2, which is no longer maintained, may or may not work with it. I’ll install Bad Behavior instead.)

I tried to load this edited SQL dump to the new host by using the Web interface to MySQL provided by phpMyAdmin; it complained about a problem, and after I fixed that the process kept hanging.

So I split the file into smaller pieces, to evade any timeout and data-volume restrictions, and tried importing each in turn. Either the host choked, or my name service went away about this time; I think some of the smaller SQL files were successfully imported, but not all. Tried again the next day, and it hung again.

So I went back to Plan A: I copied the entire edited SQL file to the new host and loaded it in MySQL from the command line — took about five minutes (including the file transfer), if you don’t count the six or eight hours of time I burned trying to follow other people’s directions.

For the sake of keeping the old URIs stable, I then added a .htaccess file to the ~/cmsmcq/blog directory on people.w3.org to redirect from the old addresses to the new.

Concisely, what worked best for me was:

  1. Export the data from the old server. I did this with the command mysqldump --verbose --add-drop-table --all --extended-insert --quick --skip-lock-tables --user mysql-userid --password dbname > mib.sql, but it might have been better to export individual tables more selectively.
  2. Edit the mib.sql file, changing the old address (in this case “http://people.w3.org/~cmsmcq/blog”) to the new address (in this case “http://cmsmcq.com/mib”) wherever it occurs (it will occur primarily in cross references from one post to another). Some authorities also recommend doing a global search and replace on your old email address. I also took this opportunity to delete tables I didn’t want in the dump: wp_options, wp_usermeta, wp_users, and the tables used by Spam Karma 2 (RIP). And I modified the wp_ prefix in the table names to match the one provided by my hosting service’s auto-install of WordPress.
  3. Copy the edited SQL dump file (in my case named mib.edited.sql) to the new host.
  4. Invoke MySQL from the command line in the obvious way: mysql -h hostname -u username -p dbname < mib.edited.sql
  5. On the original host, add a .htaccess file to the blog directory (here “~cmsmcq/public_html/blog”) including
    RedirectMatch permanent ^/~cmsmcq/blog/(.*)$ http://cmsmcq.com/mib/$1
    Redirect permanent ^/~cmsmcq/blog$ http://cmsmcq.com/mib
    

No WordPress export/import, no phpMyAdmin, just command line tools. I'm all in favor of Web interfaces and so I think that WordPress export and import, and phpMyAdmin, are great ideas; they just didn't work at all well for me in this situation. But one possible take-home message is: it pays to be comfortable with the command line.

Participant observation / moving house

[12 December 2008]

Some ill defined thoughts are occupying my musings.

Some time ago, my colleague Liam Quin decided to include advertising on his site http://www.fromoldbooks.org/, which makes available high-quality scans of public-domain images he finds in … well, in old books. When we have discussed it, he has occasionally observed that one of his goals in doing so is to understand Web technology and Web usage from a slightly different vantage point. I understand him to mean that it is one thing to have a deep factual knowledge about the specifications which undergird and constitute the web, but a different thing to experience them in the process of running a web site. By accepting ads, and experimenting with different advertising programs, and watching his search engine rankings, Liam says, he has learned a good deal.

In a way, it sounds a bit like what one reads about participant observers in introductory anthropology courses. Some kinds of knowledge are more accessible from the inside than from the outside.

A second observation has concerned me for some time. The Semantic Web proposes to use URIs to denote things we want to talk about, and this has the nice side effect that proposals to mint a new term for something are safe from name collisions while still not needing to go through any central registration authority. All of my colleagues at W3C, from Tim Berners-Lee on down, recommend the use of HTTP URIs for such purposes. But new HTTP URIs can be minted, in practice, only by people who own domain names, or who have arrangements with people who own domain names. (It’s a bit like freedom of the press, which guarantees the right of uncensored publication to those who own a press. Fortunately, the Web makes owning a virtual press fairly simple, but it does tend to involve, again, owning a domain name.)

These lines of thought, together with some other considerations that need not concern us here at the moment, have led me to think it’s really high time I moved into the domain-owning classes.

So: We’re moving, or rather, we’ve moved. Messages in a Bottle is now hosted at http://cmsmcq.com/mib instead of the old address on people.w3.org.

I believe all existing references to posts and comments in the old location should be successfully redirected to the same posts and the same comments in the new location; this was a bit harder than it really ought to have been (details in a later post). If any reader finds exceptions or failures, please let me know at the email address whose username is “mib” and whose host name is “cmsmcq.com”.