May 28, 2003
MovableType and Kung-Log |
Weblogs
|
I've upgraded my MovableType installation to 2.64 to be able to use Kung-Log, a really nice MacOS X application for posting to a Weblog. Both MT and Kung-Log look pretty good so far...
|
Posted by ovidiu at 05:14 PM
|
May 12, 2003
More on advanced XSLT usage |
XSLT
|
I found this old article by Jason Diamond via Leigh Dodds. The article describes the same technique I was referring to in a previous entry. The article refers to an even older article by Eric van der Vlist describing the same technique.
The idea is to come up with your own set of XML elements that describe best your problem domain, annotate your HTML pages with these XML elements, and then use an XSLT stylesheet to transform the annotated HTML page into another XSLT stylesheet. This last XSLT stylesheet contains all the presentation information from the original HTML; it is applied on the real input data model to generate the output HTML.
A traditional user of XSLT would write this last stylesheet by hand, mixing the presentation with the actual code that traverses the data structure to be represented. To do this, the developer would first have to reverse engineer the structure of the HTML page, and embed that structure into the stylesheet. The process is time consuming, frustrating and error-prone; the result is ugly and hard to maintain.
Annotating an HTML page and generating the stylesheet automatically is a much easier solution to maintain in the long run. The HTML page designer doesn't have to know XSLT, they would follow exactly the same design process as before. The only thing they need to learn are the extension XML elements that describe where and how the dynamic data will be placed into the HTML page.
The challenge is on the developer of the extension XML elements to be able to cover all the corner cases, and make it possible for the designer to easily embed the data in the page templates.
|
Posted by ovidiu at 12:59 AM
|
May 11, 2003
Cocoon flow controller implemented in Java |
Cocoon
| Java
|
Alex Krut has an implementation of Cocoon's control flow controller using ATCT - Asynchronous Transfer of Control Threading - a proprietary technology from Velare Technologies that emulates the behavior of continuations in Java.
ATCT's enhanced Java becomes the third language used to implement Cocoon's control flow. The first one was Scheme through the use of SISC; because of the little interest, support for it is not provided anymore in Cocoon. The second language, and currently the main one used in Cocoon, is Christopher Oliver's extended version of Rhino JavaScript, that incorporates continuations support. The Cocoon integration of ATCT appears to be pretty straightforward, the new flow controller simply implements the API provided by Cocoon. Great job, Alex!
The ATCT framework appears to provide the functionality of continuations in pure Java. A similar approach has been provided in Java by Brakes, which instruments the Java bytecodes to be able to capture the state of the execution at any given point in time. I'm not familiar with the way ATCT works, but the Web site claims ATCT is "a patent pending, pure J2SE and J2EE Java framework", which is a dubious statement to me. Continuations have been around for more than three decades, so I really doubt there's anything to be patented here. Anyways, I'd be curious to know more about this technology and what is that the actual patent covers.
|
Posted by ovidiu at 11:18 PM
|
May 09, 2003
Processing XML configuration files using XSLT |
Java
| XSLT
|
Charles Miller decided to use Scheme to describe configuration files instead of XML.
I have a different approach. Since most of the applications I write these days end up processing XML anyways, I prefer writing XML configurations file. Since I really like XSLT's power and to avoid the proliferation of tools like commons-digester and others, I write a simple XSLT stylesheet to process my configuration files. Such a stylesheet would need to receive as parameter a context Java object which needs to be initialized according to the configuration file.
The object initialization could be written in simple XSLT templates. Using Charles' example, lets say we have a hypothetic add-module XML element with a module attribute. We'd like to have a MyClass instance that gets invoked with a addModule method and passed the string value of module . The following XSLT stylesheet would do it:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:MyClass="java:some.package.MyClass">
<!-- This is the MyClass instance to be initialized --> <xsl:param name="context"/>
<xsl:template match="add-module"> <xsl:value-of select="MyClass:addModule($context, @module)"/> </xsl:template>
</xsl:stylesheet>
An instance of MyClass would need to be passed as parameter to the XSLT stylesheet from the Java side of the world. This can be set using the Transformer.setParameter(String, Object) method.
XSLT comes for free in Java 1.4, so there is no memory overhead from using XSLT. Even so, I still prefer Saxon over Xalan 2.3.1 that is distributed in JDK 1.4.
|
Posted by ovidiu at 01:01 AM
|
May 07, 2003
Hackers |
Random
|
Paul Graham's Hackers and Painters [via Steve Jenson] is a nice insight into what a hacker is.
Several things that I liked:
- hackers like to design beautiful software. "Over time, beautiful things tend to thrive, and ugly things tend to get discarded. Unfortunately, the amounts of time involved can be longer than human lifetimes."
- "When Yahoo bought Viaweb, they asked me what I wanted to do. I had never liked the business side very much, and said that I just wanted to hack. When I got to Yahoo, I found that what hacking meant to them was implementing software, not designing it. Programmers were seen as technicians who translated the visions (if that is the word) of product managers into code."
- "Great software [...] requires a fanatical devotion to beauty."
- "At Viaweb [...] when we interviewed programmers, the main thing we cared about was what kind of software they wrote in their spare time. You can't do anything really well unless you love it, and if you love to hack you'll inevitably be working on projects of your own. "
- "Most hackers don't learn to hack by taking college courses in programming. They learn to hack by writing programs of their own at age thirteen. Even in college classes, you learn to hack mostly by hacking."
- "The other way makers learn is from examples. [...] Hackers, likewise, can learn to program by looking at good programs-- not just at what they do, but the source code too."
- "I think hacking should work this way [too]. It's unrealistic to expect that the specifications for a program will be perfect. You're better off if you admit this up front, and write programs in a way that allows specifications to change on the fly.
(The structure of large companies makes this hard for them to do, so here is another place where startups have an advantage.)"
|
Posted by ovidiu at 09:05 AM
|
|
|
Cool stuff
Search
More from me
Picture gallery
Topics
Archives
People
Admin
|