I’ve added a code style tool to the Dojo Util project that developers can use to ensure that their code is following the syle guidelines published here –http://www.dojotoolkit.org/developer/StyleGuide .
You can see the current report, as of May 23rd 2009 at http://skynet.ie/~sos/misc/dojoCheckstyle/util/checkstyle/checkstyleReport.html
It can be very difficult to police your own code for tabs and spaces, and developers have much better things to be doing with their time than visually scanning over their code making sure that it is formatted correctly.
This tool identifies style guide violations, and gives developers a HTML file that displays them, and automatically fixes many of the common mistakes for you. (This works best in Firefox right now, so you that if you have it)
The style checker is primarily aimed at Dojo contributors, but can also be used by normal users of the toolkit. To override the standard folders that are examined, you can simply set the ‘dir‘ parameter relative to the Dojo base folder, and a checkstyle report will be generated for you custom code.
To see how to use the tool, get the latest vode from svn, the go to util/checkstyle and type
To run the checkstyle tool on the entire Dojo tree, simply type
then open the checkstyleReport.html file, which you can see below.
If you want to be able to save files from the web interface, you’ll have to renamve the file checkstyle.php.rename.html to checkstyle.php, then click the Save or Save All buttons in the UI.
There is a ticket to track all checkstyle fixes at http://bugs.dojotoolkit.org/ticket/7390 , so can developers please reference this when checking in style fixes?
Announcing the dojo.beer event in Dublin on June 6th, in the Ginger Man on Fenian St.
dojo.beer events have been running all over the world for over a year now, where developers and users of the Dojo Ajax Toolkit meet up, usually with a presentation or two from Dojo committers, and always with lots of beer/wine/whiskey/Coke (for the designated driver) depending on the locale.
We’re very lucky to have Dylan Schiemann,the co-founder of Dojo and CEO of SitePen, presenting on all things Dojo/Ajax/Web2.0. I’ll also be doing a presentation on some of the cooler things you can do with Dojo, and I might even show you how to do them!
So, if you’re interested in the Dojo toolkit, or Ajax/Web 2.0 technologies in general, come along and knock back some beers with us. The event details are:
When: 5pm Saturday June 6th
Where: Upstairs (private bar) in the Ginger Man pub on Fenian St. Click here for a map.
What: Two very interesting and informative presentations from Dylan Schiemann (Dojo co-founder) and Shane O’Sullivan (Dojo committer). And beer.
Duration: between 1 and 2 hours, but we’ll be hanging around for beers long after the official event is finished, so stay as long as you like!
Cost: Free! As with all things Open Source, the event is free entry, but you can buy me a pint if you like :-).
Contact: You can just turn up, or add yourself to the event on Facebook at http://www.facebook.com/event.php?eid=78088992918 . Or email me at shaneosullivan1 at gmail dot com
I’ve written a useful script for Firefox and Greasemonkey called EasyCheckboxes. It makes it more convenient to work with multiple checkboxes on a page, enabling you to select, deselect or toggle groups of checkboxes. It will also work with all web pages.
See the video below for more info, or you can install it right now by clicking here, or by visiting the script homepage at http://chofter.com/apps/?n=easycheckboxes
Context Aware Selections
One of the most useful features of EasyCheckboxes is that it is context aware. It figures out what checkboxes are related to the one you chose, and only changes the state of those. This is useful if you have multiple columns of checkboxes, and you only want to check all inputs in one column.
Of course you can also change the values of all checkboxes on the page.
Using Dojo’s query engine, Acme, in Greasemonkey
If you’re not interested in the techie details, you can stop reading now.
Since version 1.3 of the Dojo Ajax Toolkit, it provides a standalone DOM query engine called Acme. I compressed this down to a single line of code, and inserted it in my GreaseMonkey script. I previously tried using the Sizzle query engine, but it had too many issues with Greasemonkey, the main being that it sometimes crashed the browser.
Using it is very simple. Simply call:
And it returns an array of the matching nodes.
I posted a couple of weeks ago on how I used the Sizzle CSS selector engine in a Greasemonkey script to skip annoying “Welcome Screens”, see it here, or check out the very handy script here. However, there were a couple of issues with using Sizzle:
- On some pages it crashed the browser. Not good.
So, I’ve replaced it with the Dojo standalone library, Acme. Some advantages it has over Sizzle:
- It’s arguably faster
- It doesn’t have to be put outside the Greasemonkey sandbox, so no interfering with the page code.
- It doesn’t crash the browser 🙂
You can get the uncompressed version of Acme here – http://archive.dojotoolkit.org/nightly/checkout/dojo/_base/query.js
If you want a compressed version, that works independantly of Dojo, you can compress that file to a single line using the YUI compressor at http://www.refresh-sf.com/yui/