Mucho Tags

When Is it OK To Invent New Tags?. Tantek Çelik, smart Microsoft browser guy, is blogging from the big W3C meeting now going on in Boston. Among other things, he's mad because some W3C specifications are written not in HTML but in a completely different XML language called xmlspec, and that language has some tags that are a lot like HTML tags, so why don't we just use HTML tags? I'll address some of the historical background and specifics, but Tantek is pointing at a real important issue in the world of XML: when do you invent your own language, and when do you re-use someone else's? Warning: long, and loaded with markup design theory and obscure standards history.… [ongoing]

Tim Bray, an old XML-DEV collegue and a major living landmark in XML history, writes about inventing new tags.  I found it interesting because I am hacking together something that will allow anyone to invent new HTML tags with a few lines of Python on the client-side.  You want a <laugh> tag?  You got it.

DHTML DOM Weirdness

I was playing with some Python code that monitor and change currently displayed web page in IE using DHTML DOM API and ran into some weird behavior.  Specifically, it won't let me insert child elements into an element without a parent.  Here is what my code looks like:

itemNode = doc.createElement('div')
textNode = doc.createTextNode(item['description'])
itemNode.appendChild(textNode)

This fails because itemNode is parentless.  To make it work, I had to insert itemNode into either the document or a document fragment like this:

itemFrag = doc.createDocumentFragment()
itemNode = doc.createElement('div')
itemFrag.appendChild(itemNode)
textNode = doc.createTextNode(item['description'])
itemNode.appendChild(textNode)

This is clearly weird behavior, particularly since I participated in the design of W3C DOM API Level 1 and 2.  I just don't recall this sort of behavior being brought up for discussion while the DOM specs were being written.  If it did, I would have demanded the API be changed to make this assumption explicit like adding parentNode parameter to DOMImplementation.createXXX() methods.  Did I forget something or is this another case of Microsoft's inventive interpretation of specs?

FYI: Python code above is part of code used to display RSS feeds on IE.  Its working well now.

Python: Boa Constructor

Programming Python can be extremely frustrating.  Docs are almost always incomplete and overly brief.  Finding stuff is tedious, forcing me to grep over all the modules.  Pythonwin IDE feels less than half finished.  Urgh.  Great deal of my frustrations were erased by Boa Constructor.  While Boa is still in development, its better than Pythonwin by a mile already.  Just install the 0.2 version and then pour the CVS version on top to fix at least one minor but irritating bug that prevents Boa from coming up on some machines.  Enjoy.

User-Unfriendly Security

In today's heightened awareness of online risks and vulnerabilities, software engineers are increasingly shifting burden to the users, bombarding them with confirmation dialogs that overwhelms users with unwanted details and desensitizing them into pressing the OK button without reading the dialog message.

Number, complexity, and ambiguity of regional regularity obligations also encourage this trend.  Add to this, increasing demand for user control over all matters by privacy proponents.  Take for example, P3P initiative that, although well intended and widely implemented, provides no tangible benefits no comprehension to average users.  Result is secure software that is difficult and bewildering to use, manage, and support.

Typical engineering solution to this problem is to add "Do not show" checkbox on the dialog.  Unfortunately, most users I have met are either ignorant of the "Do not show" checkbox or abuse it, turning off every confirmation dialogs they run into.  So this solution is not only useless, but also make software difficult and tedious to use.  There are other solutions that can do better.  I'll describe one in another post.

Going nuts with Python

While I had a great time playing with Lua — its smaller, faster, as easy to hack in, and internally simpler than Python — what I like about Python is the large volume of available Python libraries and the community that built them.  So, I have been doing some crazy things with Python from within IE.  I just got back from a day long conference at Adobe that gave me some new ideas too.  First step is to embed Python inside Acrobat so I can start playing with Acrobat itself as well as writing some Acrobat plugins in Python.  Adobe should have used SWIG, Python, and wxWindows instead of wasting time with JavaScript and hard to use API.

Back from Python Jungle

Whew.  Last night, I finally nailed the bug that forced me to get lost inside Python.  Debugging Python inside Internet Explorer is not easy.  To debug native code inside Python, I had to rebuild all of Python, Pythonwin, and PyWin32 native code because you have to have debug builds of all the DLLs.  To debug Python scripts, I wrote some debugging helper code that lets me watch each line of Python code executing.  I am going to hook up a real Python debugger as an IE explorer bar (like the Favorites bar) so I can step through Python scripts and set debug points.  That would be so cool!

Finding out that win32ui module required hosting application to be written in MFC stumped me because I was hosting Python as a DLL written in ATL/WTL and IE doesn't seem to be written in MFC.  Come to think of it, its been ages since I last wrote an MFC application.  I think the last one was NetDynamics Studio.  NetDynamics was bought by Sun and NetDynamics products turned into iPlanet and I have no idea if they are still using the code I wrote.  I was going to replace it with a XUL-engine written Java, but that never happened.

Coercing Win32com module to use existing IE automation objects took some effort, mostly spent on trying to figure out how Win32com works.  I had to patch win32com.client.dynamic.py to do what I needed to.  Real bummer was finding out that most of Win32com is written in Python.  This means its much slower than native glue code.  For most COM automation use, this is no problem since tasks performed by each COM method takes much longer than the time it takes to invoke the method via Python-based Win32com code.  But for manipulating IE DOM, this is dog slow.  Sometimes, I can literally see changes being made to a web page.  Also, each COM dispatch object uses too much memory in Win32com.  Just touching all the nodes in a document will be prohibitive.

I'll have to write my own optimized COM glue for Python at some point.  For now, I am pushing forward with Win32com.

XML Advanced Electronic Signatures

W3C released XML Advanced Electronic Signatures (XAdES) as a Note.  XAdES extends XML-Signature (XMLDSIG) to support signatures valid over long periods and to comply with the requirements of European Directive on electronic signatures.  Does this impact 3D-Secure?  No, because its the card issuer that signs in 3D-Secure, not the cardholder.  Future 3D-Secure architectures might support cardholder signatures as well as leveraging P2P infrastructures, but I'll be glad just to see current 3D-Secure become ubiquitous.  I think 3D-Secure adoption has slowed lately.

J2SE 1.4.1_02 Released

You can download it here and read the release notes here.  I have been using Java ever since the first beta of JDK (8 years ago?) and its amazing how buggy it is still thanks to features being piled on major release after release.  Most of those features I could do without, an exception being NIO (finally working acceptable since 1.4.1_01) and ActiveX bridge (removed but due to reappear in 1.4.2).  Features I care about are speed, size (download and runtime), and stability.  So far, speed is satisfactory, size remains unbearable, and stability is frequently suspicious.  Java is turning into a classic example of creeping grace.

IHTML: Interactive HTML

Of late, I have been dreaming about IHTML.  IHTML is, as I define it, HTML for highly interactive web applications.  It defines new high-level tags for defining new interactive behaviors and for replacing all those custom DHTML+CSS+JavaScript-based widgets with 'native' components.  It also supports weblets, client-side web applications that extends browsers.

To make IHTML a reality, I have embedded Python and PythonCOM into Internet Explorer.  That was hard, but the hard part is over and the fun part begins.  Beyond replacing IHTML tags with native parts on the fly, I am playing with the idea of Persistent Page which are web pages with persistance and mutates over its lifetime: changes you make on the page are permanent.  Sounds weird, but is no different from writing on your newspaper.  The kicker is that these pages are smart and task-oriented.  Fun stuff.

In case you are wondering, I have little interest in what W3C might say about IHTML.