Dan Wellman’s jQuery UI 1.7 reviewed

I recently finished reading Dan Wellman’s book, jQuery UI 1.7 – The User Interface Library for jQuery. But with the imminent realease of version 1.8 of the popular interface library, is this book still relevant? In my opinion,  it is.

This book is recommended for beginner to intermediate users of jQuery UI, and it hits the mark perfectly for its intended audience. There’s a chapter for each of the high and low level widgets, as well as the CSS and effects frameworks. Each chapter is structured to follow a logical pattern, and Dan’s clear writing style means that the code and text is easy to follow.

Each chapter starts with a basic example, and gradually adds more and more options to show the flexibility and power of the framework. The text is supported by numerous code samples, which can be downloaded from Packt Publishing’s support site. Finally, each chapter ends with an imaginative, more advanced use of the library. One chapter showcases jQuery UI’s drag and drop functionality with a game, for example. These examples really bring the code to life, and inspire you to open your favourite text editor and start coding!

The most obvious omission from this book (in fact, the only one worth mentioning, really) is the lack of a section on writing your own plugins for jQuery UI. Dan obviously feels the same way, because he’s written a tutorial on the subject here, and something like this is promised for the next update of the book. If this more advanced topic is something that interests you, you might want to wait for the next version of the book.

Alternatively, if your knowledge of jQuery UI is at the other end of the spectrum, there’s no reason at all not to go ahead and buy the current version. The book focuses on the common features of each widget (for example the destroy, enable, and disable methods) so that you can easily adapt to the new components as they appear.

If you’re somewhere between the two camps, as I was, then this book will consolidate your knowledge and give you lots of inspiration to use the parts of the library you might not have touched on yet. And that, for me, was worth the cover price alone.

Posted by admin on March 9th, 2010 No Comments

My MP responds to the Digital Economy Bill

I recently wrote to my MP, Thomas McAvoy, regarding my concerns about the Digital Economy Bill, asking him to sign Tom Watson’s early day motion.

I wasn’t expecting a response, but I got a letter this morning – and only a couple of days after emailing him. Kudos.

Here’s his response:

“Thank you for your recent email.

Please be advised that as a member of the Government I am unable to sign Early Day Motions.

The concerns that you raise in relation to the Digital Economy Bill are ones that should be considered as the Bill comes through Parliament. Indeed, it is most likely that the clauses in the Bill that you refer to will be subject to much debate and may even come to a vote. This would give Ministers the opportunity to listen to any concerns and take on board any criticisms that are made of the Bill. This is normal procedure for the progress of a Bill through Parliament.

I believe that this Bill will be subject to the usual checks and scrutiny that any Bill undergoes as it passes. I will be paying attention to the Bill as it progresses and I hope that you will continue to show an interest in its progress too.”

I should point out that he’s the Deputy Chief Whip.

So not much to go on there, but if I were to guess, it looks to me like he doesn’t expect the bill to go through in its current form.

Thanks to Sam Stokes for letting us re-use the text he sent to his MP. If you want to do the same, I would recommend the excellent write to them.

Posted by admin on November 23rd, 2009 1 Comment

Pro Javascript Techniques by John Resig – a review

pro-javascript-techniquesI’ve just finished reading Pro JavaScript Techniques by John Resig, and I thought I’d post some thoughts about it.

The author, John Resig, is the creator of the popular jQuery library. He also works as a Javascript evangelist for Mozilla, so there’s no doubt that he’s one of the best known proponents of the language.

Although I use the jQuery library on a daily basis, I was keen to brush up on some of the finer points of Javascript; my knowledge of the jQuery library probably exceeds my knowledge of Javascript! For this reason, I thought the book sounded good.

The first half of the book certainly doesn’t disappoint. Covering the nitty-gritty of DOM traversal, OO Javascript, and unobtrusive scripting, the book does a great job of covering a lot of ground in a concise, clear manner. The key concepts are illustrated with plenty of code snippets which do a great job of illuminating the subject matter.

The second part of the book was less useful for me, illustrating some examples of AJAX functionality, image galleries, autocomplete, that sort of thing. These topics might have been considered intermediate to advanced in 2006, when the book was released, but the plethora of options around today means that developing stuff like that now is re-inventing the wheel. (Of course you might be interested in learning more about wheels!)

You can almost see the snippets of code in this book forming the nuts and bolts of the jQuery library, and it’s interesting to take a look at the hoops we developers would have to jump through to otherwise gain cross-browser compliance.

I’m just glad I’m not the one having to negotiate those hoops myself!

To sum up, this book is still worth reading for the first half alone, and the stuff on OO javascript, scoping, closures etc is really useful. But some might consider the book a little out of date, so be warned.

Posted by admin on October 3rd, 2009 Comments Off

Converting Prototype’s Ajax.PeriodicalUpdater to jQuery

One of the things I missed when switching from Prototype to jQuery was the former’s Ajax.PeriodicalUpdater function. It is used to provide a ‘decay’ mechanism for ajax calls, making them less and less frequent if the retrieved content doesn’t change inbetween calls.

It can be a seriously useful piece of functionality. I took a chatroom that was polling every second and using an entire CPU core (50% usage!) and reduced it to 2-3% using this method. There were also errors retrieving content because sometimes the responses would take longer than a second to come back!

The problem is, there really isn’t a similar piece of functionality in jQuery.

So here it is! The script checks the returned data against previously received data, and increases the time between calls if it hasn’t changed.

I’d be interested in your comments. Would it be useful to turn this into a plugin?

View the demonstration here.

Posted by admin on February 18th, 2009 8 Comments

Using JSON to access the Twitter search API

Steve Reynolds recently wrote a blog post showing how to access the twitter search API using PHP, cURL, and JQuery.

Steve used JQuery to post to a page on his server, which then cURLed in search results for a given term. This approach is often necessary to get avoid the issue of cross domain ajax calls.

While this approach works well, there’s an even easier way to go about it – $.getJSON!

There are two main advantages to this approach:

  • Server side technology isn’t an issue. You don’t have to rely on PHP, cURL, firewalls, anything like that. It will even work on a static HTML page!
  • All the work is done on the client’s browser – saving precious bandwidth! This could be important on busy sites.

I’ve knocked up a quick-and-dirty demonstration of this concept. If a name doesn’t already exist for this methodology, my vote goes for JAJA (Javascript and JSON, asynchronous!)

View the demonstration here!

Posted by admin on February 7th, 2009 10 Comments