Dojo in .NET… Is Atlas about to drop the ball?

Just read about the Emergetk toolkit, bringing Dojo to .NET. Very cool idea. I wonder how this will play out against MS Atlas, Microsoft’s Ajax toolkit? They’re going to need good tooling for Visual Studio for one thing, and probably get rid of the GPL license, or else it’ll be a pretty hard sell. Still, it’s great to hear Dojo being promoted to the .NET crowd!

Here’s my comment on the subject..

Update: The GPL is now gone, they’re using the BSD license instead. Much better!

Getting the selected ID from a Dojo ComboBox

While fiddling around with the Dojo ComboBox widget today, I noticed that while it does support name-value pairs, it doesn’t provide an explicit way of getting back the “value”. For example, if you provide it with the JSON object:

[ {"Pat":1}, {"Mary":2}]

you can use the ComboBox’s getValue() function to retrieve the names “Pat” and “Mary”, but not the second value, which is generally what you really want.

So, FYI, to get the value, get a handle to the ComboBox, and retrieve it’s comboBoxSelectionValue.value attribute. For example, given a ComboBox with a widgetId of “myCombo”, use

var selectedId = dojo.widget.byId(‘myCombo’).comboBoxSelectionValue.value;

Alternatively, and possibly simpler, you can set the setSelectedValue attribute on the div when you’re creating the ComboBox. For example, if I had a hidden input field that I wanted the selected id to be copied to:

<input type=”hidden” name=”userid” id=”userid”></input>

you would define the ComboBox like:

<div dojoType=”ComboBox”

setSelectedValue=”dojo.byId(‘userid’).value=arguments[0]” …….(whatever other args you want)

> </div>

This results in the hidden input field being automatically populated with the selected id value. Simple enough, but it would be better if the ComboBox had a parameter where you could simply give it the id of an input node to mirror itself to.

The Cake PHP MVC framework and its Amazing Technicolor Documentation

I’ve recently been looking into various MVC frameworks for PHP, and came across the Cake framework. It’s a port of Ruby On Rails to PHP (or as close to a port as possible), emphasising convention over configurabililty. While it’s very impressive from a technical standpoint, that’s not what is so pleasantly surprising about it – plenty of open source projects have very talented programmers contributing to them, making technical prowess a starting point for OS projects, not a destination. No, what surprised me was the amazing level of documentation for the project.CakePhp Logo

Simply put, CakePhp has some of the best, most comprehensive, most relevant and best organised documentation I’ve seen in an open source project. Whenever I had a question of any sort, not only did I find documentation “related” to it, I found full tutorials specifying exactly what I needed. In addition to the great docs at their manual and wiki, the also have a full set of API documentation.

Now, many projects state that they have API documentation by virtue of the fact they have some kind of automatic document generation รก la Javadoc, but in the vast majority of cases this just consists of a listing of the available objects/classes and their functions, with extremely sparse explanations of what the methods/classes actually do, how to work with them, caveats etc. CakePhp has all of this. How they convinced open source developers to spend so much time writing documentation, I’ll never understand, but I as I said, I am very, very happy to see it.

I read a blog post that evaluated a number of PHP MVC frameworks, that stated that one of the main reasons Cake didn’t top its list was the seemingly slow pace of development compared to some of the other frameworks. If this kind of documentation, which provides me with everything I could possibly need, is the result of such “slow” development, I could only wish that more open source developers would slow down a bit.

Namespace code submission to Dojo merged

A quick note to say that my first code submission to the Dojo Toolkit project has been accepted and merged into the tree. The changeset can be seen here.

The idea is that you can simply define your widgets right in the HTML like

<dojo:Dialog id=”foo” … />

and they’ll be automatically detected and instantiated.ย  You can also define/register your own namespace.

Proof that I do actually work occasionally ๐Ÿ™‚

ApacheCon Europe Highlights

ApacheCon Europe 2006 is over, and I had a blast.

Mark Shuttleworth Keynote

It started off with Mark Shuttleworth, the Ubuntu founder, giving a very well delivered speech about where he sees the world of free software heading in the next five years. Some of his better points include “Pretty is a feature“, and the massive opportunity for Linux and other free software on consumer gadgets.

Apache Axis

The Axis folks gave a good talk about the new features in version 2.0 of Apache Axis, the web services/SOAP implementation in Apache. The coolest thing, to me at least, is the fact that every web service is also automatically given a REST interface. While it isn’t a full REST api, just using GET and PUT methods, it is a great step forward for people who’d like to write simplistic clients (e.g. Javascript/Web 2.0 clients) and access web services with neither the need to write annoyingly complex client side code, or modifying the server-side code to add a simpler REST interface.

Microsoft Atlas Keynote – Rob Burke

Rob Burke from Microsoft Ireland braved the choppy waters of ApacheCon to speak about Microsoft Atlas, their free javascript toolkit. What could easily have been a hostile crowd was quickly disarmed by Rob using possibly the funniest picture I’ve ever seen, which I’m happy to say I may have helped come into being a little. The talk went down very well, with the main thrust it focused on a coding demo, where Rob went through how to write Atlas applications with .NET and PHP. While .NET looked more attractive due to the slight difference in prettiness between Visual Studio and Notepad (used for the .NET and PHP examples respectively) it was pretty cool to see how easily it could be used in a PHP environment. Microsoft even wrote some PHP code (!) to make the transition to a non .NET framework easier.Clippy
One thing that was missing was a quick comparision between other open source Ajax toolkits, and “why” people should use Atlas instead of Dojo or Scriptaculous/Prototype etc, which are firmly estabished in the open source and commercial worlds. To play devils advocate for a minute, in defence of the other toolkits:

  • Tooling around open source ajax frameworks took a large leap forward with the initiation of the Ajax Toolkit Framework in Eclipse, and should soon be quite comparable to the MS IDE. Also, it doesn’t lock you in to a particular framework, as it supports multiple existing ajax toolkits (currently Dojo, Zimbra/Kabuki and Open Rico)
  • The announcement that MyFaces, the Apache implementation of the Java Server Faces specification, is migrating its client side widgets to Dojo means that Dojo will now have a server-side binding, for Java developers at least. This should be more or less equvalent to the .NET combination of Atlas + VB/C#
  • The recent announcements by IBM and Sun regarding their support of Dojo, with both code and documentation, along with the Oracle connection through MyFaces, and you’ve pretty much got three of the four main IT companies jumping on the Dojo bandwagon.
  • The latest code drop for Dojo will surely lead to it’s dominance over mankind as we know it…. cue self patting on back ๐Ÿ™‚

My extra-happy birthday

On a more personal note, the second last day of the conference just so happened to be my birthday, and since it was also the birthday of one of the organisers of the conference, we got Happy Birthday sung to us by hundreds of inebriated hackers. Now THAT I can get used to.

Finally, thanks/hi/bye to all the cool people I crossed paths with over the week. I had a fantastic time bouncing ideas & beer bottle tops off you all, and hope to see you all again in a years time!

P.S. For a listing of a whole host of pictures of the event, go here and here.