SOS

Shane O’Sullivan’s technical blog… really ties the room together

Archive for the 'Technical' Category


New Demos for Dojo & Google search engine online

Posted by Shane O'Sullivan on 13 May, 2008

I’ve previously written about the data stores I committed to the Dojo Ajax Toolkit that enable you to search Google’s services for all sorts of things - books, news, blogs, images and everything else.

Now I’ve put some demos up on DojoCampus that show off a few of the stores.  Check them out at http://dojocampus.org/explorer/#Dojo_Data_GoogleSearchStore , especially the Google Images one - it’s shiny :-)

Posted in Ajax, Demo Engine, Dojo, Technical, demo, dijit, dojo.data, dojox, open source | 2 Comments »

Keep up with the latest Dojo Demos

Posted by Shane O'Sullivan on 8 May, 2008

The Dojo Feature Explorer now has an Atom feed you can subscribe to to keep up with all the latest demos that have been added.  So, point your browser at http://dojocampus.org/explorer/featureexplorer/latestDemos.xml and subscribe!

For all the Web 2.0 addicts out there, I’ve also added access to the list via SCRIPT IO.  If you point your browser to http://dojocampus.org/explorer/featureexplorer/latestDemos.php, you will receive a file containing a JavaScript array of the last ten demos added to the feature explorer.  By default, it will call the function dojocDemos, passing it the array.  You can specify the callback function you want using the callback parameter. e.g.

http://dojocampus.org/explorer/featureexplorer/latestDemos.php?callback=myFunction

will call the myFunction JavaScript function.  You can load this file, as I mentioned, using SCRIPT IO.  This could be hard coded into your HTML page, e.g.:

<script type=”text/javascript” src=”http://dojocampus.org/explorer/featureexplorer/latestDemos/php?callback=myFunction”></script>

or loaded using dojo.io.script.

Posted in Ajax, Atom, Dojo, Javascript, Technical, json, open source | No Comments »

Google and Dojo, F.E.E.D.I.N.G

Posted by Shane O'Sullivan on 6 May, 2008

This is the second in series of posts on the work I’m doing to bring the Google Ajax APIs and Dojo Ajax Toolkit together. The first post was Google And Dojo, Sitting in a Tree, which you can read for some background.

I have submitted a new data store to the DojoX project, dojox.data.GoogleFeedStore, which makes it possible to access any RSS or Atom feed, anywhere, directly from your own web page. Simply pass the URL of the feed to the GoogleFeedStore, and it will return it to you using the dojo.data.Read API.

Example

var store = new dojox.data.GoogleFeedStore();
store.fetch({
  query:{url:"http://shaneosullivan.wordpress.com/feed/"},
  onComplete: function(items) {
    dojo.forEach(items, "alert('Got feed entry with title ' + this.getValue(item, 'title'))", store);
  },
  count: 10
});

This will retrieve the first 10 entries in my blogs feed, and alert the title of each.

The huge advantage of this is that you no longer need any server side redirects to access RSS and Atom feeds from your own website. This Google service is the basis for Google Reader and iGoogle.

If you want to access an Atom feed from your own web server, you can also use the dojox.data.AtomReadStore that I wrote earlier. However, this is only useful if you have direct access to the Atom XML document using Ajax, and due to browser security issues, you can only load these documents from the web server hosting the web page. This new GoogleFeedStore removes that restriction, and has the added advantage that it also works with RSS.

Check out the demo page to get a feel for it (available in the May 6th nightlies), and there should be an example up on the Dojo Feature Explorer quite soon too.

As before, a big thanks to Google for providing such a cool service.

Posted in Ajax, Dojo, Feeds, Google, Javascript, Technical, dojo.data, dojox, dojox.data, json, open source | 4 Comments »

Google and Dojo, Sitting in a tree…

Posted by Shane O'Sullivan on 1 May, 2008

I’ve submitted a bunch of new data stores to the Dojo Ajax Toolkit that make it simple to search Google directly from your own site (ticket here).

Update: I’ve also submitted a store to read any Atom or RSS feed, anywhere, without any server redirects. See Google And Dojo, F.E.E.D.I.N.G

This is different from putting a search box on your site and redirecting to Google. With the new dojox.data.GoogleSearchStore family of data stores, you can retrieve google search results in JSON format, and display them on your site directly.

Pause a second…. let it sink in…..

There are no cross domain issues, and no server side component is required. It uses the dojo.io.script transport to access the Google Ajax API service. Just stick the following on your page:

<div dojoType=”dojox.data.GoogleWebSearchStore” jsID=”googleStore”></div>

and you have Google’s millions of servers at your fingertips.

The following data stores are available:

  • GoogleWebSearchStore - does a standard web search.
  • GoogleBlogSearchStore - searches blogs. A future enhancement I will be writing will be to write a data store that accesses Google’s extremely cool Ajax Feed API, which provides access to any ATOM feed, anywhere, in JSON. It’ll be possible to do a full web search of all blogs for certain topics, then using the feed store to pull down that complete feed .
  • GoogleLocalSearchStore - searches the Google Local service to find places, businesses etc.
  • GoogleVideoSearchStore - Does what it says on the tin, searches for videos.
  • GoogleNewsSearchStore - Finds news stories…. noticing a pattern yet?
  • GoogleBookSearchStore - Um, finds books..
  • GoogleImageSearchStore - Finds images. This provides both a thumbnail and full sized version, similar to the FlickrRestStore already provided by Dojo.

The potential applications are more or less infinite. Demos included in the check-in show how to integrate this with the extremely cool dojox.dtl templating engine to display the results in a number of different ways, as well as how to feed the results into the Dojo Grid, Gallery and SlideShow.

This code is included in the nightly checkouts of Dojo, and not in v1.1. To get it, either check it out from source control, or get it from http://archive.dojotoolkit.org/nightly/.

Have a look at the simplistic demo of it in action at http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/data/demos/demo_GoogleSearchStore.html (available from the May 1st nightlies).

A big thank you to Google for making this service available. Now go play!

P.S. Stay tuned for the Yahoo variant, coming soon!

Posted in Ajax, Atom, Dojo, Javascript, Technical, dojo.data, dojox, json, open source | 10 Comments »

Dojo Developers: Subscribe to this now!

Posted by Shane O'Sullivan on 1 May, 2008

DojoCampus.org has created a feed for their amazingly useful series of tutorials on all things Dojo, called Dojo Cookies, at http://dojocampus.org/content/category/dojo-cookies/feed/. Bookmark it. Now. Seriously. Or, as this guy says, Do It :-)

Posted in Technical | 2 Comments »

DojoX Calendar widget committed

Posted by Shane O'Sullivan on 11 April, 2008

Following on from my previous post about the cool new Calendar widget I wrote for the Dojo Ajax toolkit, the initial version has now been committed to the DojoX project.

dojox.widget.Calendar

Check out the calendar test page at http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/widget/tests/test_Calendar.html

Check out the dropdown date text box at http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/form/tests/test_DateTextBox.html

Some more work still has to go into the widgets, including allowing individual dates to be highlighted for specific event, and perhaps including a refactoring into a series of mixin classes, but it should be in great shape for 1.2!

Posted in Ajax, Calendar, Dojo, Javascript, Technical, dojox, open source | 4 Comments »

DojoCampus - The best Dojo learning resource

Posted by Shane O'Sullivan on 9 April, 2008

DojoCampus.org is an ever-growing learning resource for users of the Dojo Ajax toolkit, and also for anyone wanting to do cool (and mundane) things with JavaScript. It is designed to complement, rather than replace, the existing Dojo documentation. It features:

  • Tutorials - examples aimed at both beginners and advanced hackers
  • Videos - step by step videos showing off Dojo capabilities, and showing how to get the most out of the toolkit.
  • Cookies - small nuggets of handy information, as discovered by Dojo hackers. These come both from the Dojo contributors, and can also be submitted by the general public through the website.
  • Feature Explorer - a great demo engine, written by myself and Nikolai Onken, that shows off most of the capabilities of the Dojo toolkit, and shows how it is done. I wrote a previous post about this here.
  • Community Polls - polls to allow the community to vote on what features they would prefer were covered next in tutorials, cookies and demos.
  • Dojo News - updates on what’s happening in Dojo-Land.

Many people have helped out on making DojoCampus what it is today, but biggest props have to go to Peter Higgins and Nikolai Onken, who have both done, and are doing, a great job.  However, it’s up to the community now to participate and make it even better.  You can:

  • Submit new Dojo Cookies
  • Submit new tutorials
  • Send in ideas about something that would make a good tutorial.  A good example is to take two technologies that may not be used together in demos or unit tests, but would complement each other.
  • Once the development environment is stable for the Feature Explorer, you will be able to submit new demos.

Posted in Technical | 1 Comment »

Dojo Ajax Demo Engine released

Posted by Shane O'Sullivan on 3 April, 2008

A great new demo engine has just been released for the Dojo Toolkit. Check it out at http://dojocampus.org/explorer/. It is based on the initial attempt at a demo engine I wrote a few months ago, but has since been updated with new demos, and made infinitely more sexy by css/theme master Nikolai Onken.

Dojo Demo Engine

The features include:

  • Demos for all three Dojo projects - Dojo (the base toolkit), Dijit (widgets) and DojoX (all that is newest and coolest) .
  • Source views for all demos. Not only do we show what Dojo can do, we show you how to do it! The source views also benefit from the very cool dojox.highlight project, which provides client side syntax highlighting.
  • Addressability - you can link directly to a demo, as I did with the dojox.highlight link above.
  • Search feature - a combo box that you can use to quickly find a demo on any subject. For example, type “image” into the box, and you’ll be shown a list of all demos to do with displaying images, such as dojox.image.Gallery, dojox.image.SlideShow etc.
  • Cool animated menus - totally aesthetic I know, but a very pretty addition by Peter Higgins. The menus separate the three projects, providing easier, clearer navigation.
  • Link hierarchies - each set of demos can have links attached to it, for example to extra tutorials or documentation. If you click a parent of that demo, you are shown all links of all children of that section. For example, click on the DojoX link on the top of the page, and you’ll be presented with a list of all links to all DojoX projects.
  • Browser Back Button management. Using the dojo.back package, you can navigate back and forward through the application using the browser’s back and forward buttons.

The demo engine is hosted on the extremely cool Dojo Campus website, which is a new learning resource for all things Dojo. It contains videos, tutorials and much more.

This version of the demo engine has many many examples in it. However, it is only the beginning, and there is a lot of room to add more content. The next step is to open the development process for community submissions of all the cool things people have done with Dojo. We will be making available the demo engine on Subversion, and writing development and submission processes to make it as easy as possible for people to contribute.

This is gonna be big!

Update: see http://ajaxian.com/archives/dojo-mini-and-the-feature-explorer for the Ajaxian post.
Share this post:digg it|kick it|Email it|bookmark it|reddit|liveIt

Posted in Ajax, Demo Engine, Dojo, Image Gallery, Javascript, Technical, demo, dijit, django, dojo.charting, dojo.data, dojo.event, dojo.image, dojo.query, dojox, dojox.data, dojox.image, json, open source | 10 Comments »

Dojo 1.1 is cooked and ready to eat!

Posted by Shane O'Sullivan on 28 March, 2008

The latest and greatest release of the Dojo Ajax Toolkit has just hit the presses, and she’s looking good. As Alex mentioned, the number of cool features in Dojo can be difficult to keep up with, so I’ll just list some of the things I’ve either written for Dojo, helped along, or just been damn impressed by in this release:

Dojo Datastores

The number of useful data stores for Dojo just keeps growing and growing, under the watchful eye of Jared. For release 1.1, I submitted a data store to read Atom XML documents, dojox.data.AtomReadStore. See more about this at http://shaneosullivan.wordpress.com/2008/02/20/new-atom-data-store-for-dojo/.

FisheyeLite

Peter Higgins submitted an amazingly simple, but oh-so-cool widget called dojox.widget.FisheyeLite. Rather than act like a ‘true’ Fisheye widget, which would generally only work on images (á la OS X), this widget can apply cool Fisheye-like behaviors to just about anything - text, divs, spans, you name it. Check out the test page for some cool examples, or see my personal website for an example of how I used it to spruce up my site menu.

Django Template Languate - dojox.dtl

The Django Template Language is an amazingly powerful templating language, with which you can turn your JavaScript data into HTML. While this was originally designed to be a server side templating solution, Neil Roberts has done a brilliant job of converting it over to work in the browser. While I though I’d had an original idea when I pitched the idea to him that it’d be cool to integrate Dojo data stores directly into DTL, Alex already had the whole thing implemented and about to check it in. Typical :-) I’ve written up a tutorial on how to integrate DTL with Dojo data stores, specifically the AtomReadStore I wrote, at http://shaneosullivan.wordpress.com/2008/03/03/writing-a-django-template-widget-with-dojo-data-stores/.

Functional Programming

This enables you perform many operations on data using just a single function call. Once of the cool things it provides is the ability to specify a function as a simple string, drastically reducing the complexity and size of your own code. Eugene Lazutkin wrote a great blog post about this, which is well worth a read. I wrote a follow up post, as a quick reference to some of the cool things you can do with this feature. Some of this was available in 1.0, but I’ve just discovered it, so here you go!

Dojo Campus

Peter Higgins, Nikolai Onken and myself have been working on a new learning resource for Dojo developers, called Dojo Campus. It provides a lot of learning materials, including videos, tutorials for beginners and more advanced programmers, and much more. We also have a still-under-wraps-but-soon-to-be-release demo engine that has loads of easy to use runtime examples of things to make and do with Dojo. I blogged about a very early version of it at http://shaneosullivan.wordpress.com/2008/01/07/dojo-demo-engine-update/, but it’s come a long way since then. Keep you eyes peeled for it’s release. Any day now…..

And finally….

A very sexy Calendar widget I’ve written got submitted just a bit too late to make in into 1.1 (read: the day before release), but will be in the nightlies soon, and will make it into 1.2. See the blog post about it at http://shaneosullivan.wordpress.com/2008/03/24/sexy-new-calendar-widget-for-dojo/.

This is nowhere near a comprehensive list of course, just the bits I’ve been fiddling with over the last few months:

  • See Dylan’s post for some more info.
  • Get the release notes here.
  • See the Ajaxian post here.
  • See Alex Russell’s (Dojo project lead) post here.

So go forth and explore, it’s good healthy nerd-fun! Share this post:
digg it|kick it|Email it|bookmark it|reddit|liveIt

Posted in Ajax, Alex Russell, Atom, Date Picker, Demo Engine, Dojo, Javascript, Technical, demo, django, dojo.data, dojox.data, json, open source, widget | No Comments »

Sexy new Calendar widget for Dojo

Posted by Shane O'Sullivan on 24 March, 2008

I’ve submitted a sexy new Calendar widget to the Dojo Toolkit, called dojox.widget.Calendar. Check out a test page for it at http://www.skynet.ie/~sos/js/demo/dojo/dojox/widget/tests/test_Calendar.html. The ticket tracking it is at http://trac.dojotoolkit.org/ticket/6297.

The features of this calendar widget are:

  • Day view - the standard view, showing all the days in a month
  • Month view - lists the twelve months of the year.
  • Year view - lists all the years that can be chosen.
  • Cool animations between these views.
  • Cool animations when moving from month to month, and from year to year.
  • Cool animations when moving the mouse over the widget, courtesy of the dojox.widget.FisheyeLite widget. (tired of cool animations yet? Nah, me neither)

The daily, monthly and yearly views of the Calendar
The day, month and year views of the calendar widget

I was inspired to write it after seeing the very cool Calendar widget in the AjaxControl Toolkit, a .NET Ajax framework, which made me think “I wonder how long this would take to write with Dojo?“, taking into account the obvious: not a single line of code could be copied from the original.

The answer turned out to be about 3 hours or so, since Dojo already provided the majority of what I needed.

  • All the Date-related heavy lifting is done with dijit._Calendar, the existing Dojo calendar widget. This also handles the majority of the localisation issues.
  • Most of the animations are done using the dojo.animateProperty function.
  • Generating the HTML of the widget is mostly taken care of by the standard Dijit templating system.

What remained to do was changing the exiting dijit._Calendar HTML template to give a month and year view, and fiddling with CSS to get it looking right. A textbox popup widget was also submitted to integrate the Calendar with a text input field, called dojox.form.DateTextBox;

Hopefully this will make it’s way into the DojoX project fairly soon, and be available for general use.
Share this post:digg it|kick it|Email it|bookmark it|reddit|liveIt

Posted in Ajax, Calendar, Date Picker, Dojo, Javascript, Technical, dijit, dojox, open source | 4 Comments »