March 18, 2003

Bookmarklets

Whilst digging around during the implementation of my FOAF Bookmarklet I came across a number of interesting bookmarklet techniques and examples.

I've started documenting some of these in wordtin. See Bookmarklet for an entry point. The Bookmarklet Bootloader is a very interesting technique.

I started writing up some notes on the techniques for using bookmarklets as service intermediaries last night, but have refrained from posting them yet until I've edited it a bit. This could well turn into a more fully-fledged tutorial as there are a lot of options.

Fun geeky stuff.

Posted by ldodds at 02:05 PM | Feedback? | TrackBack

March 14, 2003

FOAF Autodiscovery Bookmarklet

There are a few web applications available for displaying FOAF files in a human-friendly format. For example there's FOAF Web View, FOAFnaut, and FOAF Explorer.

A number of folk have also started using FOAF autodiscovery to LINK to their own FOAF descriptions. This uses the same principle as RSS autodiscovery.

I thought that it'd be useful to tie these together, and create a FOAF autodiscovery bookmarklet. So, here's a first crack at it.

Drag the following to your toolbar: FOAF Explorer.

You should now be able to click that link and be automatically routed to FOAF Explorer if the current page references a FOAF description in the correct way.

This page has one, as does hackdiary, Semantic Weblog, and dive into mark to name but a few.

I have encountered some problems with the bookmarklet in Mozilla 1.0, although the same pages work fine in IE 5. If there are any javascript experts out there I'd appreciate a pointer or two if you can see anything wrong with the code.. Morten Frederikson has fixed the bookmarklet and incorporated it into FOAF Explorer, so the bookmarklet should now work in all browsers. The link is basically just a hacked version of Mark Pilgrim's RSS autodisovery bookmarklet, with the addition of a check for relative FOAF file locations as sported by Internet Alchemy. A quick test of the original RSS bookmarklet showed the same problem, so hopefully its not just me being dull (but don't rule it out).

Thats my sad friday night tinkering done with for another week!

Posted by ldodds at 10:33 PM | Feedback? | TrackBack

March 11, 2003

Final Spooky Uploaded

I've just uploaded the final version of Spooky which is a little language for describing project structures and their default contents.

Just tinkering really.

Posted by ldodds at 08:31 PM | Feedback? | TrackBack

Ant Fan

Ant is rapidly becoming my favourite Java and XML processing tool. It features heavily in my next tutorial for IBM developerWorks (working title "Code Generation using XSLT") which describes how to use XSLT as a code generation tool using an Ant based build framework. Basically using Ant + Jalopy takes all the hard work out of handling multi-step transformations that have to result in nice clean Java code.

The tutorial also discusses XSLT meta-stylesheets which is a pretty powerful technique that I've successfully used when building XML/XSLT web page templating systems. Basically this involves: defining an XML template language, a meta-stylesheet to process that language and generate the final XSLT stylesheet to apply to your data. This avoids the limitations of a single step transformation. E.g. the need to carry around extra context as exhibited in Example 10 in this article "Template Languages in XSLT".

I've previously written up how to use meta-stylesheets in Cocoon.

You can also do a lot of XML pipelining with Ant as this excellent XML.com article illustrates. The XSLT support also came in useful recently during a migration from Weblogic to JBoss. I was able to whip up some XSLT stylesheets that allowed the automatic conversion of our Weblogic deployment descriptors into the JBoss equivalents. We did this originally because it was easier than going through an changing all the descriptors manually as we were trying to maintain support for both platforms.

Whilst tinkering with Spooky (really must upload the final working version) it finally dawned on me that Ant provides a good way to write cross-platform scripts in general, not just build scripts. The installation is easy, and there's more than enough functionality there to handle any task you care to think of. Wonder if anyone has produced an application installer using Ant?

Anyway, tip of the hat to the Ant developers. Nice one.

Posted by ldodds at 04:48 PM | Feedback? | TrackBack

(Not) Creating Apps with Mozilla

Having recently picked up a copy of Creating Applications with Mozilla on one of my occasional hit-and-run attacks on Amazon, I've been tinkering a bit with XUL to see how easy it is to build applications.

This is part of some ongoing tinkering I've been doing to look at ways to quickly prototype user interfaces. My immediate interest is to decide on a toolkit for building internal administration tools for work, but I'd like to try out creating client-side user interfaces for web applications/services in general.

I initially looked at XUL, and the Luxor toolkit but decided against them as the docs weren't brilliant, and they were more complex than I wanted: I need something as simple as possible. I then picked up Thinlets and have been quite pleased. I've been building the FOAF-a-Matic Mark 2 using that framework and found it to quick and easy to use.

I've been teaching an introductory Java course for Bath University's Community Course programme -- I did one last term, and am half way through my second. As part of the preparation for this I took another look at Swing and found it was less horrid than I'd remembered. So I also ended building some code which I'll release some day which is basically a Swing application framework, complete with a fledgling plugin system, and the Bean Scripting Framework for extra scripting goodness. I plan to add support for plugging in thinlets and probably applets as well. So the research has been is bearing fruit in various directions. And most importantly I've had some fun along the way. Until now anyway.

I came back to XUL once more via a rekindled interest in "smart browsing". I'm interested in further automating the browser to do cool stuff (tm) with all that metadata that web pages, blogs especially, are integrating these days. So, after poking around in my Mozilla installation a bit I decided it was time to find out exactly what XUL, XPCOM, XBL, etc were all about. Hence the book purchase.

Now, while the Creating Apps book has answered a lot of questions, its also raised a whole lot more. I've found it to be a rather infuriating read as it covers a lot of ground very quickly, so I'm left going back to the web, e.g. XUL Planet to get them answered. XUL is itself worthy of a book, even a Nutshell book, IMO.

The chapters on XUL Templates and Mozilla's RDF support have left me on the one hand quite excited about the possibilities lurking beneath the covers of Mozilla, but on the other tearing my hair out with frustration as there are a lot of problems with the book. There are mistakes in the examples, diagrams are in correctly referenced, and in one case several pages were devoted to walking through an example of how to process some RDF data without actually showing the underlying data first.

There are corrections on the O'Reilly site, corrections on the Mozilla site, reader corrections in the per chapter comments, as well as bug reports. But no single unified place to check them all. I'm left running around double-checking everything. Even more frustratingly the example application, xFly, which has its own Mozilla project hasn't been updated to include all the examples from the book! They are available as text files but you need to manually integrate them with the app (should you want to bother) or apply the corrections yourself. Not a good situation given the book was published September 2002.

This all lead me to conclude that the examples weren't thoroughly tested, and had me questioning the wisdom of purchasing the book at all. But perhaps I'm being unfair as it may be that they've been trying to hit a moving target all along.

For example last night I spent several hours trying to apply sorting to a XUL tree element. The Creating Apps book uses the sort attribute in an example, but doesn't explain it. I've since got that example running, but the sorting doesn't actually work. Ooops. So I check the RDF docs on the Mozilla site and see that the XUL template primer has an example that uses the same syntax. Stumped again. The full XUL template reference, which is apparently outdated, has a "To Be Done" in the sorting section. Oh dear. So I check the XULPlanet tutorial and discover that uses a completely different syntax for the value of the sort attribute, and defines a couple of others to boot. This doesn't work either. I even ended up fishing into the XUL for Mozilla itself to see how it did it (same as the XULPlanet tutorial). Still no joy. Googling doesn't return any useful hits beyond the documents referenced above. This doesn't bode well so I'm wondering whether to go any further at all.

But, if someone knows how to get sorting to work in a tree I'd appreciate some help.

And if anyone has built a complete working version of the xFly sample application from the Creating Apps book I'd appreciate a copy. And no doubt so would the authors.

Posted by ldodds at 02:08 PM | Feedback? | TrackBack

March 03, 2003

John Peel and Orson Welles

Slightly random posting this one.

I was listening to the excellent John Peel last week, enjoying his usual eclectic mix of tunes, when he chose to play a 7inch recording of Orson Welles in a studio recording a voice-over for peas. Now I'm sure everyone else has already heard it but it was the first time for me, and I thought it was absolutely fantastic. Basically Welles slowly loses it over the poor quality of the script and the direction; it ends up with him walking out of the studio.

Due to the magic of the internet, and the clueful Radio 1 website you too can listen to the recording. Either here where its available as a Macromedia file (WinAmp handles it just fine, although its a bit glitchy in places) or you can listen to it "in situ" as part of the entire John Peel broadcast. The latter is recommended if you have time as
you can also hear Peel's take on the difficulties in doing voice-overs and he's done a few himself!

If you don't have a soundcard handy, then try reading the transcript here.

I'm deeply pleased that I was able to find it online as the chances of coming across said 7inch record is practically nil. Ladies and gentleman, this is what the internet is all about.

Posted by ldodds at 02:49 PM | Feedback? | TrackBack