Putting up with Javascript

Sylvain Hellegouarch wrote in "Client side application frustration"

I don't want to start a flame or whatever so I'll only say that Javascript is far from being THE solution for clientside application IMO. Don't get me wrong, the language itself is interesting and powerful enough for most things you might want to do, but the environment (the browsers) in which it sits is quite not there yet.

It looks like Javascript has never been seen as something browser vendors should pay much attention. So they did implement what the ECMA group had specified but with some variations which doesn't allow the developer to ensure everything will work the same way. For too long Javascript was seen as a toy for doing rollover menus or spamming you with popups all over the place.

He was trying to write a Weblog engine with a lot of the code in the browser and ran into endless portability problems, as well as security concerns and lack of friendly developer tools.

He also tried looking beyond Javascript.

Then I decided to look at SVG, XForm and the WHATWG effort but again I felt frustrated. Those are very well specified but have such a bad support (or none) amongst browsers that they are almost unusable. Should I come back to Java applets? sigh

And he finishes with a question:

So my question now is about the future of client side development, we do have a lot of different choices but there are no clear vision for the average joe like me on which one to focus on neither on how they will cooperate in the future nor what will be the support amongst browsers. Maybe people in the know could clarify things?

Kurt Cagle took up the question in his piece "Is Javascript Dead?", providing some historical perspective and exploring some code patterns as a way to illustrate the language's flexibility.

Javascript has traditionally been considered a lightweight language - useful for web pages, but not something appropriate for larger scale applications. There is some justification for this viewpoint - Javascript is almost invariably interpreted, meaning that it cannot optimize content cleanly prior to running it. While it does have classes (in the sense of functional prototypes), Javascript has no obvious concept of a package, which means that higer order organization can prove complicated and likely to impinge upon namespaces. There are, however, ways around this.

Kurt goes on to show an example of Javascript's elegance by turning what most people write as gruesome forms element processing logic completely inside out, and mapping events quite naturally to classes and functions. He concludes:

I think the final point of all of this is that, far from being too primitive for use with existing technology, Javascript is in point of fact still very relevent, and if anything is finally reaching a point where it can hold its own against just about every other programming language out there, at least within the domain of the manipulation of DOMs (or XML). Given the incipient emergence of E4X, I fully expect Javascript to become one of the predominent languages on the planet.

Kurt doesn't touch on Sylvain's concerns about portability, security and development environment, and those are still matters that need serious discussion (for one thing, they are issues that have always interfered with my productivity in Web development). I see Kurt's post as a bit of advocacy to underscore for developers why some of the pain is worth enduring. I look forward to more posts on the topic.

[Uche Ogbuji]

via Copia

So what of that Gaza pull-out?

I recently had separate discussions with different Jewish friends, touching on the Gaza pull-out and related matters. One, Staci, is a quite conservative Ashkenazi American with close family ties to Israel. She has some very sharp things to say about Palestinians in general, and is in favor of expansion of Israeli territory (she rebuked me for using the term "Palestinian", and mentioned the long ago withdrawal from the Sinai Peninsula in very grudging terms). The other, Hadar, is a pretty quite Separdic Israeli. I actually knew her for all of Tuesday evening, but we had a very long and ranging conversation. She had just completed her two year stint in the Israeli Army and was blowing off steam by backpacking the U.S. (her previous stop was Burning Man).

What I found fascinating was that even coming from separate ends of the political spectrum, they both had very similar views on the Gaza pull-out and the anticipated outcome therefrom. And just to be clear, I'm not entirely extrapolating from the opinions of two people in the following thoughts: I've had discussions (generally shorter) with others with some connection to the situation, and I do my best to keep well informed of developments in the news of that region.

Both of my friends thought that the Gaza and even the limited West Bank pull-outs were necessary. Staci thought that Israelis did have rights to those areas, but felt that the settlers should not be compromising general security by stubbornly camping out in areas she felt were to a great extent spoiled by the presence of so many Arabs. Hadar felt that it was necessary to establish sovereign territory for Palestinians in order to have any chance at peace, and that settlers were just making any such peace impossible (she did have some reservations, saying that if Palestinians are given the West Back too lightly, they would want all of Jerusalem, and even if they somehow got Jerusalem, they'd want Haifa, Netanya, Ashkelon, The Negev, you know, the whole bit). Both supported the withdrawal. I'd actually never expected there to be much violence in the withdrawal, and I think these two attitudes are a microcosm of why relatively orderly withdrawal was inevitable.

As for the effects, both surprised me by being very pessimistic about the outcome from the withdrawal. Staci went just about to the point of saying there would never be peace between Palestinians ("Arab refugees from Jordan", as I think she put it) and Israelis (and more generally Arabs and Jews). Hadar felt that the peace process would go nowhere despite the withdrawal, because it would give Palestinians nothing but excuse for obstinacy, and would lead to even more extravagant demands.

It's this juxtaposition that gets me. Both felt the pull-out was necessary, but both also felt that it would do nothing to bring about a real peace. I argued with both of them, saying that eventually Palestinians and Israelis would be forced to détente by simple economic need, just as sworn implacable foes Israel and Egypt had been. Those sworn to the annihilation of Israel would lose their foothold if Israel focused on security within its mainland rather than a diffident extension of territorial pseudopods. Palestinians free to erect the apparatus of state and social service where they live would be actually empowered to needed compromise in crafting a final accord.

Personally, I think that one of the greatest tragedies in this matter is that two separate groups of people were so terribly treated throughout the 20th century continue to beat each other to a pulp in the 21st. But that's just drippy sentiment. The reality is that as long as attitudes on the ground are so self-contradictory, it's hard to see how any move will lead to ultimate peace.

[Uche Ogbuji]

via Copia

More on the Gulf Coast Catastrophe

The Interdictor is reporting signs of life in NOLA. Let's hope the trend continues.

Meanwhile, I wanted to comment on some notes stemming from my earlier rant on the calamity.

First of all, Kwasi (viva immigrante), who has a very nice blog, pointed to his own rant, and I heartily cosign with most of his points and his fury. I focused my notes more on the insane economics of the Katrina response, whereas he focused squarely on the humanitarian and sociological dimensions. There is tremendous suffering in the Gulf Coast that from everything I, Kwasi, and many others can tell, could have been heavily reduced, if our government cared about its citizens better. People who carp about complaints from hindsight including putrid comment spammers are choosing to ignore the substance of the complaints.

My initial response, like those of most of us who follow human tragedy, was one of shock, pity, empathy. From whence, then, comes this wave of anger, this storm surge of emotion seething within me that threatens to overcome my better nature? It comes with the realization that, despite the capricious and uncontrollable nature of the hurricane, the vast majority of the tableau of misery that plays out before us represents an Optional Tragedy.

I'm glad Kanyeezee saw fit to speak his mind. I tend to say instead that it's poor people rather than Black people that our present government is happy to abandon, but regardless of that distinction, I'm all for a prominent figure pulling some cards right now. Someone damn well has to, because Americans will be all too eager to forget the whole tragedy once CNN starts losing interest in the Gulf Coast.

Oh yeah, big up US Rep. Diane Watson for a little card-pulling of her own:

Shame, shame on America. We were put to the test, and we have failed

And it's just amazing that no tragedy is overwhelming enough for us to, even for a moment, put aside our contempt for the rest of the world. John Cowan pointed me to this shocking story of disdain for the visitors whose tourist dollars have provided so much fuel to NOLA's much-remembered joie-de-vivre.

It's been my observation for years that the direction of American culture slouches towards oligarchy, but the NOLA disaster indicates something worse. It feels as if we don't just want to reserve power for the few and the wealthy, but we want to reserve even civil protections for these few. The elite in Washington storm to faraway war, but don't expect their children to be among those who risk their lives and limbs in combat. They find excuses for poor mobilization in the face of natural disaster, because they know their own children are not in peril, nor do those in peril even look like their children. And in the middle of all this, nothing, it seems, can stir the great mass from its ennui.

[Uche Ogbuji]

via Copia

Tintin en Irak

via Herve Dufraux of La Table Francophone de Boulder

OK, folks, sit back with a dish of Freedom Fries and listen to a tale (it helps a lot if you read French).

Someone ("Youssouf") with a lot of time on their hands (quelle chance pour lui) put together a satire comic based on a collage of pages from the popular Tintin series. It lambastes Bush and fellow cast members for the greed, intrigue and arrogance that leads to the current situation in Iraq. It's clever, and funny in patches, but it does take a good bit of filler to make up the 63 pages.

The cover panel (above) sets the mood:

Apportons leur la liberté! - Oui...Largons les bombes!
Let's bring them liberty! - Yeah...let's drop the bombs!

Some particular gems:

Page 3, which is a neat summary of how the Kurds and Southern Shi'ites must have felt in 1991.

Asked whether Hussein had been captured, the adjutant says:

Pas du tout!... Les américains ont finalement décidé de quitter l'Irak et de laisser le régime de Saddam Hussein en place!... Ils ont peur que celui-ci ne soit remplacé par une république islamiste chiite!
Not at all. The Americans have finally decided to leave Iraq and leave Hussein's regime in place. They're scared he'll be replaced by a Shi'a Islamic republic!

Pages 4-6 dramatize the supposed intrigue of Petroleum multinationals to encourage an invasion of Iraq and Bush's eagerness to do so. They're followed by an unnecessarily cynical take on the role of September 11th in justification of war (that part really annoyed me).

Pages 10 through 12 are the hilarious center of the piece, first dramatizing the back and forth over UN inspectors and conditions for avoiding war as a chess game between Bush and Hussein, which "Bush" ends by jumping to his feet and shooting over "Hussein's" head (I expect Hergé would be rolling in his grave at the use of Tintin as the face of the odious Hussein, but that's the one flaw in that sequence).

It climaxes with "Bush"'s boast:

Je suis la première puissance du monde!... Ha! ha!... Je fais ce que je veux!... Malgré toute cette comédie, par un moyen ou un autre, tu verra: il y aura une guerre en Irak!
I'm the foremost world power!... Haha!... I do what I want!... Despite all this fooling around, one way or another, you will see: there will be a war in Iraq!

Followed by a full page panel, cutting to "Osama bin Laden", who laughs:

Tu as raison de rire, George... ha! ha!... Moi aussi, j'en ris déjà de cette guerre...et de ce qui va s'ensuivre...
You're right to laugh, George... Haha! I'm also already laughing over this war...and over what will follow from it...

It gets to be a bit of a plod of increasingly extravagant schemes for pressing Hergé's images into the service of the satire, but don't miss the absurdist/slapstick ending, which includes the following sage words of advice from "Lionel Jospin":

Fumer un joint avec Romain Goupil est certainement moins dangereux que boire de l'alcool dans une mosquée de Nadjaf!
Smoking a joint with Romain Goupil is indeed less dangerous than drinking alcohol in a Najaf mosque!

Umm...er...yeah...no doubt...I'd say. What would we do without those maddening Gauls?

Peace, y'all.

[Uche Ogbuji]

via Copia

Wrapping rdflib's Graph around a 4RDF Model

Well, for some time I had pondered what it would take fo provide SPARQL support in 4Suite RDF. I fell upon sparql-p, earlier and noticed it was essentially a SPARQL query processor w/out a parser to drive it. It works over a deprecated rdflib interface: TripleStore. The newly suggested interface is Graph, which is as solid suggestion for a generic RDF:API as any. So, I wrote a 4Suite RDF model backend for rdflib, that allows the wrapping of Graph around a live 4Suite RDF model. Finally, I used this backend to execute a sparql-p query over http://http://del.icio.us/rss/chimezie:

SELECT
  ?title
WHERE {
  ?item rdf:type rss:item;
        dc:subject ?subj;
        rss:title ?title.
        FILTER (REGEX(?subj,".*rdf")).
}

The corresponding python code:

#Setup FtRDF Model
Memory.InitializeModule()   
db = Memory.GetDb('rules', 'test')
db.begin()
model = Model.Model(db)

#Parse my del.icio.us rss feed
szr = Dom.Serializer()
domStr=urllib2.urlopen('http://del.icio.us/rss/chimezie').read()        
dom = Domlette.NonvalidatingReader.parseString(domStr,'http://del.icio.us/rss/chimezie')
szr.deserialize(model,dom,scope='http://del.icio.us/rss/chimezie')

#Setup rdflib.Graph with FtRDF Model as Backend, using FtRdf driver
g=Graph(FtRdf(model))

#Setup sparql-p query processor engine
select = ("?title")

#Setup term
copia = URIRef('http://del.icio.us/chimezie')
rssTitle = URIRef('http://purl.org/rss/1.0/title')
versaWiki = URIRef('http://en.wikipedia.org/wiki/Versa')
dc_subject=URIRef("http://purl.org/dc/elements/1.1/subject")

#Filter on objects of statements (dc:subject values) - keep only those containing the string 'rdf'
def rdfSubFilter(subj,pred,obj):
    return bool(obj.find('rdf')+1)

#Execute query
where = GraphPattern([("?item",rdf_type,URIRef('http://purl.org/rss/1.0/item')),
                       ("?item",dc_subject,"?subj",rdfSubFilter),
                       ("?item",rssTitle,"?title")])    
tStore = myTripleStore(FtRdf(model))
result = tStore.query(select,where)
pprint(result)

The result (which will change daily as my links shift thru my del.icio.us channel queue:

[chimezie@Zion RDF-API]$ python FtRdfBackend.py
[u'rdflibUtils',
 u'Representing Specified Values in OWL: "value partitions" and "value sets"',
 u'Sparta',
 u'planner-rdf',
 u'RDF Template Language 1.0',
 u'SIOC Vocabulary Specification',
 u'SPARQL in RDFLib',
 u'MeetingRecords - ESW Wiki',
 u'Enumerated datatypes (OWL)',
 u'Defining N-ary Relations on the Semantic Web: Use With Individuals']

Chimezie Ogbuji

via Copia

My country is out of its COT DAMN MIND

First of all, the XML community way to help with Katrina (thanks, Alan).

So Katrina, which we fully anticipated, which smacked the Gulf Coast with much less force than it could have, which worked its devastation in a slow series of stages rather than one furious blow, still kicked our ever loving asses. We panic and spend billions of dollars on homeland security because we're afraid that some punk terrorist will blow up a test tube of Strontium 90 in a paper bag of C4? When we diverted this country's entire emergency management ledger over to terrorism prevention, all while we were busy cutting taxes and borrowing hundreds of billions from the very Asians we speak of in 21st century "yellow peril" terms, how did our most highly placed thinkers miss the simple fact that a natural disaster can inflict a hell of a lot more damage than human terrorists?

We want to despoil the environment in Anwar, Alaska for a modest mess of crude, when we haven't even taken common sense precautions to deal with the effect of natural disaster on the Gulf Coast refinery complex that is a couple of orders of magnitude more important to energy supply than Anwar will ever be.

We're forming post-apocalyptic gangs and shooting at rescuers. Hold up, what, what was that? Yeah. We're shooting at rescuers.

We're finding that we don't have enough resources to deal with the above problem at the same time we try to contain what could end up being a tertiary disaster in public health. Dead bodies float and loll, bloated, maturating, and mixed rudely in with the wretched living as if to mock their will to live.

We're seeing how a natural disaster, sentimentally an event that should bring people together, underscores the disparity between the races in much of this country. The geography and demographics of this disaster means that it is mostly a scourge of dark skinned people, and it is very hard, even for someone (like me) who is not very sensitive to racial matters not to see in the spasmodic official response a case of lesser concern about what happens to dark skinned people.

We're passing laws against small business petrol stations proprietors for "price gouging" despite the fact that stations throughout the region are out of gasoline, and station owners do not know how steep replacement prices will be (fuel futures are soaring, mind you), nor even how long it will be before they get can be re-stocked. Our energy policy has compounded long-term price pressures with a sharp, immediate scarcity, and we somehow prefer to use small businessmen as scapegoats for the inevitable spike in prices.

As I post this they are badly botching the relief effort to move tens of thousands of refugees from the Superdome (New Orleans) to the Astrodome (Houston), and the Astrodome is apparently turning into as much of a dirty, diseased and dangerous camp as the Superdome was.

And speaking of the Superdome environs, there was a horrible exchange yesterday on NPR between anchor Robert Siegel and Secretary of Homeland Security Michael Chertoff. First Siegel confronted Chertoff about thousands of people stranded at the Ernest N. Morial New Orleans Convention Center (NOCC), 8-10 blocks from the Superdome. Chertoff at first petulantly tried to brush this off as rumor-mongering. Siegel pointed out that these were details from reporters in the field, and Chertoff pretty much made a throw-up-the-hands response. Then reporter John Burnett came on the air and offered his first-hand description of the situation at the NOCC. You just have to hear the ghastly account yourself. "2000 people living like animals". No food, water or any provisions whatsoever, no security, and no one having even stopped by to tell them when to expect relief. It seems this is because no one even knew they existed except for reporters, despite the fact that they had been thronged there for three days. This isn't a handful of folks clustered on a flyover. It's a couple of thousand refugees stranded within blocks of the Superdome, which had been a similarly squalid scene, but on a greater scale until the evacuations started yesterday.

Chertoff's spokesperson contacted NPR later on, to admit that he had confirmed the NOCC situation, and that they are working tirelessly to address the full humanitarian disaster. The funny thing is that early on in the Siegel/Chertoff exchange the secretary had said rather piquantly that the Federal Emergency Management Agency (FEMA) has plans in place for every conceivable disaster. You could have bloody fooled me. I repeat: Katrina was a good ways from the worst case scenario of a hurricane hitting New Orleans.

We have botched the search and rescue. We have botched public health. We have botched security. We have botched management of the economic effects. Our leaders are mewling about commentators "politicizing" the situation while they continue to botch matters for hundreds of thousands of displaced citizens who have already lost everything and don't even know when they will be afforded the basic necessities of life.

Most of the executive branch of the U.S., starting with the president, truly this week deserves to have their heads dunked into the fouled waters of the Pontchartrain, before they are relieved of duty for the grossest possible mismanagement. It's too bad that it's only criminal activity that is grounds for impeachment. Bush this morning calls the response to the disaster "unacceptable". Quick. Someone get that man a mirror while he is still in this moment of lucidity.

I don't know whether to ascribe to left wing agitprop the tales of Condi Rice shopping in Manhattan and practicing tennis with Monica Seles while the Bush cabinet purports to be on an emergency footing, but at this point it wouldn't surprise me the merest bit.

I mean, someone call up the Last Poets, because this is true madness.

Update: Thanks to Micah Dubinko for a link to a good summary of Bush mismanagement and belligerence and how it made things worse in New Orleans.

And please listen to Michael Rys:

And do not forget the situation in Iraq, Darfour and Niger, Malawi and other forgotten emergencies...

Wikipedia says that report claim up to 20,000 at the Convention Center, rather than the 2,000 estimated by Burnett.

[Uche Ogbuji]

via Copia

Thinking XML #33: Serving up WordNet as XML

"Thinking XML: Serving up WordNet as XML"

Subtitle: Build the basic WordNet/XML facilities into a Web server framework
Synopsis: A few articles back, Uche Ogbuji discussed WordNet 2.0, a Princeton University project that aims to build a database of English words and lexical relationships between them. He showed how to extract XML serializations from the word database. In this article he continues the exploration, demonstrating code to serve up these WordNet/XML documents over Web protocols and showing you how to access these from XSLT.

This is the second part of a mini-series within the column. The previous article is "Querying WordNet as XML,", in which I present Python code for processing WordNet 2.0 into XML. This time I use CherryPy to expose the XML on the Web, either in human-readable or in raw form. This seems to be part of a nice trend of CherryPy on developerWorks. I hope people see this as yet another example of how easy and clean CherryPy is.

See other articles in the column. Comments here on Copia or on the column's official discussion forum. Next up in Thinking XML, RDF equivalents for the WordNet/XML.

[Uche Ogbuji]

via Copia

Does XML give away the keys to the data warehouse?

"Does XML give away the keys to the warehouse?"

In this ADT article I reflect on some of the implications of XPath injection attacks, and to what extent XML and open data are a danger to developers.

While I don’t claim to have foreseen XPath injection attacks, it does strike me that this security problem is made possible by practices that I and others have always discouraged. One problem is the phenomenon of production XML as database dump. Developers love to create titanic XMLfiles, often as monolithic dumps from databases. Sometimes they deploy such monsters to servers susceptible to the cleverness of attackers.

If someone does compromise the server, they can pilfer one file and have your information warehouse at their hands.

I wrote this article a long time ago, and I actually didn't know if it would be published, because of editorial changes at ADT. I just discovered it by accident yesterday. I'm glad to see it "in print".

[Uche Ogbuji]

via Copia