Wednesday, January 31, 2007

XSL[T|-FO]

My friend (and co-worker, and constant source of distraction) Kirt was poking around the company intranet today and came across a document detailing interview questions for “XSLT Developers”. When I was doing Java for a living I used XSLT quite a lot and eventually became quite good at using it effectively. Naturally, I was curious to see what we had to say about the qualifications of a good XSLT developer, especially since as far as I know, we don’t now, nor have we ever, used the slightest bit of XSLT for any part of our entire system.

Using the document to conduct an actual interview would have made for a pretty miserable experience which - since we’ve never used it and are unlikely to ever use it - I’m okay with. But it reminded me that there is a lot of confusion about what XSLT is and isn’t. XSLT and XSL are not synonymous. XSLT is a language for transforming XML documents. XSLT is but one of two components of the larger XSL, the other being XSL-FO: which is a language for specifying visual display. XSL is just a unifying term, a shorthard for saying “XSLT plus XSL-FO.” Wikipedia’s article on XSL disagrees with at least two points here but I won’t go into it other than to say that Wikipedia (though I love it so) is wrong.

I think that part of the reason why XSL and XSLT are used interchangeably is that in the beginning, XSLT pretty much was all of XSL. Sure, XSL-FO was envisioned early on but it took a long time to get a standard and it took a really long time to get an implementation. XSLT had a standard and multiple implementations while XSL-FO was nothing more than a dim idea. If you started using XSLT back then, you could be forgiven for thinking that was all there was to XSL.

The other point of confusion about XSLT is that it’s nothing more than a glorified variable substitution engine with horrid syntax. It’s syntax is retched and you certainly can use it to simply plug variables into an output template but XSLT is a lot more capable than that. It took me a long time to see and even longer to really understand that XSLT is basically a functional programming language.

Monday, January 22, 2007

lisp on OS X

I’ve decided (finally) to learn lisp. I don’t know if it will make me a better programmer but if even half of what Paul Graham says about it is true, it has to be the best programming language ever written. =)

Mac OS X doesn’t ship with a lisp interpreter but there are several free implementations out there. After ruling out the ones that cost money and the ones that have icky IDEs that run in X11 and the ones that depend on things like Fink, you’re really only left with two options.

  1. Clozure CL (formerly known as OpenMCL)
  2. SBCL (Steele Bank Common Lisp)

I went with SBCL because it works on both PowerPC and intel. Installing it is pretty easy. You do need to have the Developer Tools installed on your computer as the install process makes use of gcc.

  1. Download the “binary” for the platform of your choice
  2. Uncompress/untar the bz2 file
  3. Fire up Terminal.app
  4. cd to the directory that you extracted from the tar file
  5. Run the following commands:
    INSTALL_ROOT=/usr/local
    sudo sh install.sh

That’s all there is to it. At this point you can run the lisp interpreter (sbcl) or bring up the man page for it.

UPDATE (27 August 2008): Clozure CL now supports both PPC and x86-64. CCL has always had better integration support for Mac OS X so it may now be a better choice for Mac users than SBCL. I haven't used it much but I plan to put it through it's paces.

Wednesday, January 17, 2007

Sunnis and Shiites

If you pay attention to the news, it’s nearly impossible to go a day without hearing about Sunnis and Shiites. Assuming you start out knowing nothing about them, it only takes a few news stories to figure out the most pertinent facts: they’re Islamic groups that seem to hate each other. But the news outlets never tell you anything about why Sunnis and Shiites don’t get along. If you want to understand that, you have to do a little research of your own.

The best and most succinct description I’ve read comes from Thomas L. Friedman’s From Beirut to Jerusalem

The Muslims of the world have long been divided between Sunnis, who are the majority, and Shiites. In the seventh century, shortly after the death of Islam’s founder, the prophet Muhammad a dispute arose over who should be his successor as spiritual and political leader, known as caliph. One group, the majority, argued that Muhammad’s successor should be appointed through the process of election and consensus by the elders of the community, as was the tradition of the desert. Sunna in Arabic means tradition, and those who held this view became known as the Sunnis.

A minority faction, however, argued that Muhammad’s successors should come exclusively from his own family and their descendants. They insisted, therefore, that his first cousin and son-in-law—Ali—be appointed as leader of the community. Those who held this view became known in Arabic as the Shia or “partisans,” of Ali. The Shiites were clearly influenced by the notion of divine-right monarchy of pre-Islamic Persia (Iran). The Sunnis eventually defeated the supporters of Ali and installed their own chosen caliphs. Nevertheless, the Sunni-Shiite split has continued down through the ages of Islam, and a whole body of theological and even cultural differences developed, distinguishing Shiites from Sunnis. Summarizing these differences, Islam expert Edward Mortimer observed in his book Faith & Power: “Sunni Islam is the doctrine of power and achievement. Shi’ism is the doctrine of opposition. The starting point of Shi’ism is defeat: the defeat of Ali and his house…. Its primary appeal is therefore to the defeated and oppressed. That is why it has so often been the rallying cry for the underdogs in the Muslim world … especially for the poor and dispossessed.”

Iraq happens to be one of only two Islamic countries (Iran is the other) where the Shia constitute a majority of the population (about 60 percent). This does nothing to help explain the Iran-Iraq war but does help illuminate why many other Islamic states seem supportive of the Sunni insurgency.