Javascript

QED Wiki and the Zend Framework

Oliver Brown
— This upcoming video may not be available to view yet.

IBM are working on an impressive looking product called QED Wiki, developed with the Zend Framework.

Fundamentally it’s a wiki like any other. But there is a cool layer on top of it that could be revolutionary (although like many Web 2.0 concepts will probably fall short and just be “cool” - we can hope). The interface allows you to create “situational applications” that can link different components together with the ease of a wiki. It doesn’t really make much sense just reading about it so go watch the video about it.

On a related note, you can now get snapshots of PHP 6.

Audio in Linux

Oliver Brown
— This upcoming video may not be available to view yet.

I’ve started writing the page to actually play the audio clips in my language learning app.

At the moment it loads the Windows Media Play plug in. This obviously won’t work on Linux so I have to ask, how do you play media files in a web browser when not on Windows? Flash would be the obvious answer I suppose but I have an uncommon requirement - I need to be able to access the object via Javascript. Specifically, I need to know when a track is finished and the next one begins (from a play list) and none of the freely available Flash media players do that.

Any advice from anyone?

Yet another XML based AJAX toolkit

Oliver Brown
— This upcoming video may not be available to view yet.

Jitsu is another AJAX toolkit.

Like Backbase and Atlas it supports an XML based declarative format that is parsed by JavaScript and converted into real HTML.

This one is open source and free.

ASP.NET Atlas really is like Backbase

Oliver Brown
— This upcoming video may not be available to view yet.

It turns out that ASP.NET might not suck after all. Atlas for ASP.NET is a toolkit for doing AJAXy stuff.

Well in fact it is quite a bit more than that. It has many features of the Google Web Toolkit (except in ASP.NET instead of Java) including serializing server side objects for use client side use. Interesting it also has a lot in common with Backbase. It allows you to embed some nifty XML to define a user interface which is then interpreted by the Javascript to render real (X)HTML.

The final irony is that it’s pretty much free. Since it’s .NET, to really use it you need Visual Studio, but the Atlas part itself is free and should be perfectly usable with the Express version of the Visual Studio projects.

Another Firefox cleverity

Oliver Brown
— This upcoming video may not be available to view yet.

Cleverity? Something that is clever. If that word really exists I should get an award.

A lot of people love Firefox and seem to think that loving it is “obvious”. This is despite the fact that it just eats up memory. Not only that but it keeps it regardless (if you minimise most programs on Windows they free up most of their memory).

There are uses for it, most of them for developers. The DOM explorer and JavaScript debug consoles are absolute necessities. But another cool feature I’ve found is “View Selection Source”. Highlight part of a web page, right-click and you can view the source just for that bit. Yay :)

3D gaming in Firefox and Safari

Oliver Brown
— This upcoming video may not be available to view yet.

Using the canvas element with some clever JavaScript, someone has written a basic ray-traced 3D graphics engine that runs in Safari and Firefox.

Okay so “3D gaming” is overstating it slightly, but it’s clever. What’s double clever is that you can get a pure JavaScript implementation of canvas for Internet Explorer from Google Code. Which means technically you can now do 3D graphics using JavaScript and a browser.

Now Google push AJAX development

Oliver Brown
— This upcoming video may not be available to view yet.

I recently posted about BackBase, an expensive (for commercial use) AJAX development thingy*. Well Google have produced something similar for free Google Web Toolkit.

Although the end results are the same (as far as the user is concerned) there are important differences. The BackBase software is entirely client side. You write server stuff as normal, output BackBase code and the browser with JavaScript handles everything. The Google system is client and server orientated and odes more work on the server. The server also has to be running Java. It also has better browser support.

This could be a reason for me to learn Java, something I’ve managed to avoid for quite a while now…

* It’s actually an XML based markup language combined with a real time JavaScript processing engine.

Multiple forms in ASP.NET

Oliver Brown
— This upcoming video may not be available to view yet.

I previously ranted that being unable to have two ASP controlled forms in a single ASP.NET page is a serious flaw. They may be a way round it though. I would assume that ASP.NET can’t output two “smart” forms (the ones with runat="server") on the same page but I’m pretty sure that there is nothing stopping a HTML page itself actually holding two of them. Of course that could be wrong.

Essentially all you have to do is load the extra forms using AJAX and I think everything will work.

(I’m working a on a page (not in ASP.NET) that has a table of data with a status column. Each column needed to have a drop down box letting you change the status. Since the number of statuses is large I decided to have a link that AJAXly changed into the dropdown box and a button when you clicked it. Of course you could click all the links and not submit any of the forms leaving you with a page that actually has a bout 30 forms on it.)

BackBase really pushing AJAX

Oliver Brown
— This upcoming video may not be available to view yet.

BackBase is another AJAX toolkit. This one is different though. It’s not really an AJAX toolkit, more a toolkit powered by JavaScript taking advantage of AJAX.

The clue is the price. Yes it has a price - $2000 to be exact. There is a “community edition” that is free for personal use though. Anyway, I don’t have time to run down all the features but basically it defines a whole new bunch of tags allowing you to create complicated content in a declarative HTML style way. These tags are then translated into proper XHTML on the fly by the back end JavaScript engine. Since the clever work is actually handled by the browser, you’re free to use whatever you like on the server (PHP, Ruby) including static HTML pages - outputting BXML is no different to outputting HTML. In fact BXML has a very ASP.NET feel to it and embedding BXML into an XHTML page along with ASP content could have the ultimate cleanness about it (syntax isn’t one of my complaints about ASP.NET).

It should be noted that Microsoft are working on Atlas which could be something very similar but I haven’t looked into it… It all seems very clever.

Silly things with JavaScript closures

Oliver Brown
— This upcoming video may not be available to view yet.

From a theoretical programming point of view, JavaScript is immensely cool. You can do some amazing things with it. Although I’m not entirely sure whether you should.

For example I had a bunch of elements on a page I needed to update using AJAX. I needed a function I could pass the URLs and ids of elements to replace with those URLs and then have it perform each replacement in turn (I’ve seen IE have problems with simultaneous AJAX requests).

First I replace a simple replace_id function that accepts three arguments. An element id, a URL to GET to replace its contents with and finally a function to be called when it’s all completed.

And then things got silly.

function chain_replace(urls, ids) {
    id = 0;
    next_id = function() {
        if (id < = ids.length) {
            return function() {
                replace_id(urls[id], ids[id++], next_id());
            }
        }
    };
    next_id()();
}

Now the next_id()(); bit towards the end should be a clue that something a little odd is going on. But I must confirm that this code does actually work. With enough arguments it might make the browser explode with some sort of call stack problem though…