Dojo based Inflation calculator

A cool project based on the Dojo Ajax toolkit has just gone live.  The Cost of Living Calculator from KBC Bank and The Sunday Independant (in Ireland) newspaper enables you (especially Irish people :-)) to calculate their own personal inflation rate.  This is the rate of inflation as it applies to you personally, based on what you spend your money on, rather than the inflation rate average for the entire country.

It uses many features of the Dojo toolkit version 0.4.2, including tab containers, spinner widgets and charting.

Give it a go at

Click the Tutorial tab for instructions on how to use it, but it’s not complicated at all. UI Overhaul

I’ve completely overhauled the look and feel of, my next-gen search portal build using the Dojo Ajax Toolkit.  It’s now much more user friendly, prettier etc.  I’ve also fixed a number of small bugs.

Read the official blog post about it at, or even better, try out for yourself!  It rocks, if I do say so myself (and I do 🙂 )

Ajaxian seemed to like it too.

Some pics of the new look

Quick Django Tip – Modulus

I was fiddling around with Dojo‘s Django Templating language (amazingly cool bit of tech of course), and got a bit stuck trying to do something very simple: modulus

All I wanted to do was stripe a list of elements by applying a different class based on whether a row was odd or even. It turns out the reason the answer didn’t really pop up in searches was because, in Django land, it is called divisibleby

So, if you are using a for loop in Django, to check if
(current loop index % 2) == 0
you can use

which returns either true or false.

More Offline Goodness With Dojo

Kris Zyp from SitePen has posted an article about the Dojo Ajax Toolkit‘s latest addition to it’s Offline Web capabilities, OfflineRest. Check it out at

The idea is brilliant – if you send your data to the user using the JsonRestStore, you can now add an amazingly simple offline capabilty to your website with two lines of code (more or less).

This rocks.

There’s also an interview with Kris over at Ajaxian –

Setting the default locale in Dojo using PHP

When writing locale aware JavaScript for a browser environment,  you only have access to the locale that the browser used upon installation.  If the user changes their preferred locale, a JavaScript application has no way of detecting it.  See the Dojo documentation for more details on this at

However, the list of accepted languages are sent to the web server in the request headers.  It is also possible to instruct Dojo as to which locale to use.  Below is an example of how to do this in PHP

 // Get the array of request headers
 $h = getallheaders();
 // Retrieve the 'Accept-Language' header, a comma separated list
 $langs  = $h['Accept-Language'];
 // Parse the first language
 if(strlen($locale) < 1) {
  // Set a default language if you like
  $locale = "en";
 }else {
  // Make sure that the optional 'q' parameter is not included
  $locale = strtok($locale, ";");
<script type="text/javascript" src="dojo/dojo.js" djConfig="parseOnLoad:true,locale:'<?=$locale?>'"> </script>

Note the djConfig attribute when including the dojo.js file. It specifies the locale to be used.

Microsoft are thieves, and I like it

The Internet Explorer team recently posted an article about additions to IE8 that will help Ajax developers – see . In it, they describe some of the features of Firebug that they are blatantly copying, including:

  • Script debugger –  step through your JavaScript code, place breakpoints etc.  A nice addition is coloured syntax, which hopefully Firebug will have soon.
  • Script profiler, for indentifying performance bottlenecks.

I think it’s great that MS are taking one side of the open source movement to heart – the free sharing of ideas for the benefit of all.  This will make developing web application of IE infinitely less painful (i.e. possible).

Now if only they would scratch the back of the open source community, and stop patenting and locking down every good idea to come out of Redmond, just imagine how good things could get!

Of course this is not about to happen (an open source IE?? Um, no).  But we can dream.