Book Club: U+E770-U+E777

September 16th, 2006

I’m reading Banvard’s Folly: Thirteen Tales of People Who Didn’t Change The World, a captivating book. One of those tales is that of Jean-François Sudre, inventor of Solresol, a self-proclaimed universal language written using an alphabet of 7 musical notes: do, re, mi, fa, sol, la, si. For instance, “good night” is “mi-si” in solresol and can be uttered by just saying “mee-see” or playing E-B on a musical instrument.

The book describes the rise and fall of Sudre and his invention and ends with this note: “years ago, someone in the computer industry quietly inserted the seven letters of the Solresol alphabet in the Unicode sixteen-character set.”
That was surprising, because I’d been told that even the Klingon alphabet wasn’t in Unicode. In fact neither Klingon nor Solresol are in Unicode proper. But they are part of the Conscript Unicode Registery, a not-really-standard project to squat Unicode’s Private Use Area with symbols from constructed or artificial scripts. And there, you find U+E770 to be “SOLRESOL SYLLABLE DO”, etc. up to U+E777, but also alphabets from similar universal projects like Visible Speech or Monofon, along with entirely fictional ones like Klingon and a couple of languages out of Tolkien’s own folly.

Incidentally there’s also “U+E6D0 - U+E6FF”, containing the symbols found on the undeciphered Phaistos Disc, a replica of which was offered to me by the W3C’s Greek Office last May:

phaistos disc, backphaistos disk, back

Oddly, there isn’t the mysterious Voynich Manuscript (quoting from the voinich.net mailing list: “Hey, if the Shavians and Tolkien freaks can have their page in UNICODE, why not us?). Perhaps because it is still possible that it’s a hoax, or more likely the alphabet used isn’t quite clear yet, as there are apparently a few dozen “weird” characters that occur only once or twice each. John Cowan, co-originator of ConScript, confirms, and adds that it’s also because nobody ever made a proposal.

Musical Networking

July 18th, 2006

This is a project idea that came to me while listening to Ale Fernandez from ILRT giving a talk on distributed online performance art. I’ll probably never have the time and ability to implement it, and it might exist already, so I’m just braindumping it here in case someone’s looking for ideas for a software project.

Basically, it is a social network for musicians. Like any other orkut, but with an emphasis on musical instruments, skills and tastes, with a view to get people to get together to form bands or record together.

User profiles would contain information like instrument played, a vague idea of the person’s skill at it (from beginner to pro), an idea of their musical tastes, etc. An important field would also be the user’s location, if they are looking for bandmates.

Behind the scenes, the site would have an ontology of musical instruments and musical genres, making it possible to perform requests like “find me anyone playing brass, living near Manchester, who likes Big Band music and who would like to join a band”.

A nice extra would be the ability to upload a sample of one’s playing (MIDI, mp3, etc.), to provide an idea of their skills. Extending that would allow musicians to share tracks online and do mixes.

Obviously, one can imagine any number of social networking sites, adapted to any number of hobbies, jobs or occupations. This could be generalised to a single social networking framework with custom ontologies. A bit like Meta-wiki, which allows people to create topic-based wikis, each with its custom namespace (like Symptom:Cough for Medical Dictionary Wiki). Clearly FOAF would be the best choice for implementing such a system, if only for RDF’s support for namespace, ontology and queries.

Implementing DISelect

July 13th, 2006

Implementing DISelect using XSLT, WURLF and Java Servlets

When you read the DISelect specification you can’t help but notice the similarity of the syntax with XSLT: conditionals, variables, XPath expressions, attribute value templates, etc. So it’s easy to imagine implementing DISelect by transforming documents to XSLT stylesheets. It seems it’s just a matter of transforming <sel:if> to <xsl:if> and so on, and implement the access functions as XPath extensions. This is what I started to do, thinking it would be easy. It wasn’t, but I learned a lot in the process. Here are a few details.

DISelect process

The idea is that a web page containing DISelect markup is statically transformed into an XSLT stylesheet (a “literal result element as stylesheet”, in XSLT parlance), and put on the web server. The generated stylesheet, which implements the content adaptation as described in DISelect, is run when the document is requested by a browser. In principle the adaptation can be performed at any stage between the server and the browser. Here I did it on the server, because it’s much easier to have XSLT run there.

The static transformation: XSLT

There are a few differences in the semantics of DISelect and XSLT. <xsl:choose> is not quite like <sel:select>, for instance. This makes the mapping not that straightforward, but not too difficult (about 70 lines of XSLT). One major difference between DISelect and XSLT is that DISelect allows changing the value of variables, which XSLT doesn’t allow. So I cheated and used a non-standard element in the saxon XSLT engine that does allows changing variable values. Therefore,

<sel:variable ref="x" value="1"/>

becomes

<saxon:assign name="x" select="1"/>

(Note that it’s actually possible to avoid saxon:assign but one would need to do pretty complicated stuff, including implementing an XPath parser in XSLT, which is crazy.)

Dynamic Adaptation: Saxon, WURLF

The Jigsaw web server is used to run an instance of a Java Servlet which calls saxon to run the dynamic adaptation. When the document is requested, the servlet runs the XSL file and the result is sent back to the browser.

What remains is DIselect access functions, which I implemented in Java as standard XPath extension functions. An example is cssmq-width(), which returns the client device’s screen width, typically used in statements such as:

<sel:if expr="cssmq-width() > 200">
<img xsrc="picture.jpg" mce_src="picture.jpg" alt="photo"/>
</sel:if>

Obviously, if the access functions are going to be executed on the server, it needs data about the client which is requesting the document, in order to figure out the values returned. This is where we use WURFL, a big XML file that contains a lot of data on plenty of mobile devices. It comes with a Java API, which allows you to query device properties by passing the User-Agent string of the HTTP GET request originating from that device. It’s quite easy to use. However, about 75% of the debugging that this stage took was because of me misspelling WURFL and writing WURLF. I just hate that name now.

Does it work?

With desktop browsers, definitely not. WURFL gets it wrong. Or maybe I’m not using it right. Firefox or Konqueror are thought to be Netfront. Opera is thought to be Nokia 6230. WURFL claims it’s for “wireless devices”, which is missing the point that the line between conventional computers and mobile devices is getting thinner and thinner. Anyone who would want to write a service for any device would find WURFL insufficient, because it’s only telling you about mobile phones and PDAs.

On mobile phones and PDAs, here’s what WURLF found:

- Tréo 650 with Blazer 3.0 (default browser): WURFL finds it’s a Tréo 650
- Tréo 650 with Xiino/3.1: WURFL returns “generic”
- Tréo 650 with Opera Mini: WURFL thinks it’s a Nokia 6230
- Motorola V220 with default browser: WURFL correctly guessed.

That’s not bad. Opera Mini is tricky since HTTP requests are proxied through opera servers. Xiino is an obscure browser and WURFL cannot know about everything. The next problem is that WURFL properties don’t match DISelect functions (copied from CSS media queries, actually). For instance, WURLF doesn’t have a property for the screen’s size width and height in real length units (cm, mm, etc.). Reciprocally, WURFL has “xhtml_table_support” which seems pretty essential but doesn’t feature in DISelect. Admittedly, both are extensible, but that’s not enough to make them interoperate.
Obviously a wider device repository is needed, to which all browser manufacturers can contribute. Well, guess what, there’s a W3C MWI work item for that, called Device Description Repository, and the Working Group is holding a workshop on it as I’m writing these lines.

Notes

Why Jigsaw and not Tomcat? Because Jigsaw is home-brewed at W3C and Yves Lafon was kind enough to help me set it up locally. It seems it would be very easy to port it to Tomcat, which I might do if I’m going to distribute this to anyone.

Why XSLT and not PHP? I thought about transforming DISelect source files into PHP (sel:if to if(), etc.) but didn’t know enough that you can’t do that, at least not XSLT because PHP isn’t well-formed. At least the PHP generated here wouldn’t be.

What’s missing: access to the delivery context via XPath. E.g. <sel:value ref=”/system/os/version/”/> Seems feasible if the server manages to maintain a source XML file with the correct values for the requesting client. Also, we don’t do DISelect events at all, since XSLT doesn’t have events and always recovers silently. Therefore this implementation will never be able to claim compliance to DISelect.

Client-side transformation? You’d have to find a browser with an XSLT engine that lets you have extension-functions and assign variables. As far as I know there isn’t any that does assigning, which is a shame (or maybe I’m just pushing XSLT a bit too far).

If I had to do this seriously, I would do it in PHP, which is widely implemented and would free me from XSLT, Saxon and Java. The offline transformation (from DISelect source to PHP file) could be done in any language that has a decent DOM API. The service could then run on any off-the-shelf Apache+PHP. I would try to do a better job than WURFL by analysing the User-Agent string a bit better, at least to try and find out if the client is a desktop computer.

Please email me for details or code.

I use gnus for email

April 28th, 2006

This entry isn’t about W3C technology, but since email is the thing I, and most W3C staff, do the most I think it’s not too inappropriate if I write about it here.

I have been using gnus to read email for more than 10 years. Gnus is originally a Usenet news reader that runs in emacs, but has quickly evolved to handle email too. It has many features I like and couldn’t do without, even if I sometimes consider switching to something else (because it has its flaws too). Let me just list my favourites and let you think “does my email client do that?”.

  • Gnus lets you read your email “newsgroup-style”: when retrieving email, it filters it and files each message away in folders (called “groups”, from NNTP parlance), and presents you a view of all the groups (see the first screenshot below). That’s been the way I’ve always wanted to read my email: reading messages in order of their arrival involves too much context switching. I much prefer reading all my personal email first, then all the emails from this or that list, etc.
  • Scoring: some emails can be highlighted in the “summary” display: so I can easily find out if any emails in a given folder mention me, or have “W3C sucks” in them.
  • Expiry: when I have deleted an email in a group, it’s not deleted! It’s kept for a custom amount of time. So, in personal email folders, emails are never deleted, and in mailing list folders, they are “expired” after a month. I like that feature as I often want to find recent email I’ve deleted but don’t want to be bothered finding it in a Web archive.
  • Emacs keybindings and text editing teatures. Obviously, I’m used to them and couldn’t really do without
  • Hacking: I really like the fact that if I find a bug (and I’ve found many), I can go and fix it myself, and then submit it to the official maintainers. I also have my own extensions: my favourite is that when I display any email coming from a W3C mailing list, gnus copies in the selection the URL of that email (in the archive on lists.w3.org). So if I want to give someone the URL of an archived message, I just find it in gnus, then paste the URL. So much time gained.
  • Literally everything is customisable through standard emacs mechanisms
  • I think gnus has all the features you could require from an email client: PGP, Mime, threading, spam, IMAP, POP, etc.
  • Aside from email, you can use groups to display and manage just about everything that’s organised in lists: newsgroups and emails, obviously, but also RSS feeds, local files and directories, diaries, web search results, and more. It’s really wild!
  • The documentation is hilarious

Now for the bad things:

  • Starting from scratch must be hard. I can imagine the frustration of having to set lisp variables to customize the way you read email. Not for people in a hurry. Similarly, the full text interface can appear a bit terse when compared to modern graphical email readers. Also, you need to learn quite a few keystrokes (but there’s menus too). However, after this admittedly steep learning curve, you probably have the most efficient way to read email. I believe this applies to many programs based on text interfaces (shells, IRC clients, etc.): they look horrible and are hard to learn, but once you master them, they’re still the most efficient tools to do things. Note: I’ve recently moved to proportional fonts in emacs, and even if it sometimes messes up the formatting, it’s increased readability enormously (see screenshot below). Now I can’t wait for antialised GTK fonts in Emacs 22.
  • Emacs lisp: you have to know lisp to do advanced customisation.
  • Gnus can be slow, being written in Lisp: it’s ok for most things, I find, except IMAP support: combined with the slow speed of managing IMAP connections, I gave up using it.
  • Searching can’t be perfomed globally (across all groups) and is very slow inside a large group. I have to use grepmail externally to find something somewhere.

All in all, I feel that the time I’ve invested learning and hacking gnus wasn’t wasted.

gnus group view

gnus article view

More fun with Google maps

March 29th, 2006

Exactly a week ago, I was skiing. And I had my GPS unit with me. And now I’ve downloaded the track data and integrated them with Google maps. Many others have done it before me (including Bryce Nesbitt, whose code I borrowed), so there’s nothing very new here. But the resulting page also has some notes and a few nice pictures.

update: KML file now available for Google Earth.

textorizer 2

March 15th, 2006

textorizer 2 is now available for people to play with. This version still forms a picture with bits of text, but this time the text is just written left-to-right and top-to-bottom, with variations in colour and size.

Because I wanted it to run in Opera I couldn’t use text spans, so every letter is an SVG text. It makes rendering quite long. Also, letter width are hard-coded in the source. A bit ugly, I know. The font used is sera, the free version of Bitstream’s Vera Sans.

Xtech abstract on DCI

March 8th, 2006

I just received a notification that my abstract for XTech 2006 was rejected. So I’m publishing it here so it’s not wasted:

“Delivery Context: Interfaces (DCI) Accessing Static and Dynamic Properties” is a W3C specification that describes DOM interfaces and events to enable an HTML+JavaScript page (or other Web application language) to access client-side system information. For instance, static characteristics like the device’s screen size, or dynamic ones like its latitude and longitude. The event interface provides a means for applications to get notified if, for instance, the device is running out of battery power or if the phone’s signal level is becoming too weak.

Typical usage scenarios are web pages that dynamically adapt their geometry to a tablet PC’s screen orientation, or that display the device’s remaining battery time. But with DCI enabling a web application to make full use of today’s multimodal devices, one can envisage much more complex applications: more examples include pages which adapt their colours to the amount of ambient light (measured through the device’s camera), or that dynamically update their content, cinema listings for instance, according to the geographical location of the device. Among the informations that the web page could also indicate are the remaining memory available on the device, the number of text messages that have been received, what calendar appointments are scheduled for today, etc.

Enabling access mechanisms to device information from a web application could in fact result in the device’s UI becoming a dynamic web page, the browser then being the sole component through which one interacts with the device. Thus, DCI, along with the other open standards for the web would give interface developers a truly
cross-platform way to design a device interface. “Themes” for one’s phone could then easily be made available on the web, and be downloaded and perhaps modified locally. Or the interface could never reside on the device, but instead be loaded like a web page each time the device is used. Thus, the UI would always be the latest available, with no firmware update necessary, and could be modified on special
occasions, e.g. Christmas.

One could also envisage other languages using DCI in other modality scenarios, like SVG or VoiceXML in a voice browser. Or Web applications could also be designed that dynamically change modalities if some event occurs: information normally sent using audio (speech synthesis readout of news items, for instance) could be shown on the screen instead, if an event notifying a high level of background noise was received, or a whole application could switch to an audio-only modality in case the device, like an embedded browser in a car, is notified that the vehicle is now in motion.

The DCI specification is expected to enter W3C Candidate Recommendation status before the full paper is published, at which point existing implementation will be thoroughly. Two prototypes have already been presented by major mobile browser manufacturers. This presentation will demonstrate running examples.

textorized!

February 17th, 2006

Some SVG hack I wrote 3 years ago resurfaced recently (I won’t go into the details of how but psd, Norm Walsh and Danbri are to blame, essentially). The hack, called textorizer is a C program that takes an image and creates an SVG file in which the image is reconstructed using bits of text. It’s easier shown than explained, and there’s now a “textorized” flickr group full of very nice examples.

Not only has psd boosted textorizer’s popularity by creating the flickr group, but he’s also built an online interface so you don’t have to run the executable yourself. Rasterising the SVG “by hand” isn’t even essential anymore, since most browsers will render it these days.

And so it ended up being mentioned on digg.com, and since then I’ve received a dozen emails asking for a Windows version and enhancements. I don’t think I’ll do a Windows version since I don’t use Windows and surely someone who has the knowledge can do it better than me. However I will be working on a new version, and releasing it hopefully soon. Watch this space.

update: it didn’t take long to psd to make a windows version. Thanks!

Celtic

February 8th, 2006

squarish celtic pattern

I’ve recently come across Les Entrelacs Celtes, by Christian Mercat in Dossier Pour La Science, no. 47, april/june 2005 (see also the web site), which describes a method for drawing celtic patterns, as they used to do in days of yore. The basic idea, drawing curves around an arbitrary graph, was easy enough to be implemented using Bézier curves, and so I quickly put together a small ruby hack to draw some basic shapes in SVG (example).

A further version of the hack, which I lost since, was able to do more complex stuff: more elaborate shapes, using more SVG features (text on a path was particularly nice). However the one thing that SVG can’t do is intertwine curves, because of the back-to-front drawing model. That’s a major impediment to any sort of celtic-ish design one might want to draw. Or, the solution is to have each curve conveniently split and each bit correctly placed inside the SVG file so that the overlaps are correct. Pretty tricky to implement.

And now you think: that’s a job for <canvas>. Probably. But before thinking of doing it in a canvas, I thought I’d rewrite my hack in C and using X11. And as it was progressing well and producing really nice patterns, I thought I would write an xscreensaver hack. Eventually I submitted it to jwz and it’s now part of xscreensaver 4.23. It differs a lot from the ruby version obviously: I had to make it crash-proof, leak-proof, and look better graphically. In particular I added 4 different types of patterns, shadows under each curve, and many random parameters to make the pattern different each time. An early version is on my personal site, with screenshots. The latest version is now in the latest xscreensaver.

I might port it to canvas, if it ever becomes popular in browsers.

Photo Albums on Google Maps

January 17th, 2006

After finding a page that explains How to add a Google Map to any web page in less than 10 minutes and finding that it really takes less than 10 minutes, I hacked together an XSLT transform which takes my photo index page (with added geo:lat and geo:long tags) and generates the Max’s pictures on a map page. Broadly speaking, the stylesheet transforms each row in the index into a JavaScript function call creating the pictures.

update: I made a few changes:
- now the latest map is at the top of the index page;
- the map features Dom’s area selector;
- each album row now has a ‘map’ link which links to a close-up satellite view of where the thumbnail picture was taken. It’s not always very accurate since I don’t always remember where I took that particular picture;
- the page is almost XHTML. The geo namespace declaration is still inserted by XSLT, even despite the exclude-result-prefixes declaration.