Login Register

Shane O'Sullivan

Syndicate content
Shane O'Sullivan's technical blog... really ties the room together
Updated: 1 hour 4 min ago

Firefox 3 has proper modal dialogs!

Wed, 06/25/2008 - 09:32

The application I work on for my employer makes extensive use of modal dialogs in Internet Explorer.  These are a nice feature where you can load a page in a dialog box, and the user cannot access the parent window until the dialog has closed - this includes forward/back buttons, menus, everything.

An issue we have had with supporting Firefox 2 is that it doesn’t support modal dialogs.

It seems to have completely been missed by the Firefox 3 fanboys, but Firefox 3 supports modal dialogs.  See my previous post on tips on how to use them.  This is a very very cool thing which I’m sure many people will find use for.  There aren’t many examples of modal dialog use around, since up until now it was IE-specific, but hopefully it’ll become much more popular.

The Mozilla team seem to have simply copied the window.showModalDialog function exactly from Microsoft, so any code previously used to open modals in IE works just fine in FireFox 3.

You’ve got to love open source: out-innovating the proprietary guys 99% of the time, then copying whatever you missed :-)

Update: I’ve confirmed that in FireFox 3 modal dialogs, unlike in IE, when you click a hyperlink the resulting page will correctly open in the dialog, and NOT open a new window.  This makes them infinitely more useful, and should negate the need for the horrendous hacks that IE forces on people.

Categories: Web Developement

Temporary solution for using Huawei modems in Windows

Sun, 05/18/2008 - 12:59

Microsoft, in their infinte wisdom, recently sent out a “security” update that has broken the use of many USB devices. It switches off the power of USB devices it considers to not being used. This may be fine for mice, keyboards and printers, but I use the Huawei broadband modem from O2 (also used by Vodafone an 3 Mobile here in Ireland). See one of many discussion threads about it here.

Update June 16th 2008: O2 have released a fix for this. Go to http://www.o2.ie/firmware and follow their instructions. I installed their update, and so far my connection has not dropped for 5 hours or so.

The modem is powered down every few minutes, disconnecting you from the web, and forcing you re-enter the PIN after 10 or 20 seconds. Extremely annoying. O2 say that they and Microsoft are working on a patch, but it’s been 4 weeks or so now, and my broadband is still more or less unusable.

So, I’ve come up with a temporary fix that seems to work well. All it does is repeatedly list the contents of the the drive that the modem is mapped to (F: on my laptop) every 5 seconds. This tells Windoze that the device is in use. To use this, paste the code below into a text file whose name ends in .bat, e.g. PollModem.bat. This is an executable script file in Windows.

:loop
dir F:\
PING -n 5 127.0.0.1>nul
goto loop

Alternatively, you could download the file from http://www.skynet.ie/~sos/misc/PollO2.bat

If your modem is listed as a different drive, change the drive letter from F to whatever drive it is on the second line of the script. You can find the letter by double clicking on My Computer and looking for the drive called “O2 Broadband” (this is for O2 obviously, the Vodafone and 3 Mobile modems may be called something different.)

Once you’ve saved the PollModem.bat file, double click on it. You’ll see a window pop up, listing the drive’s contents every 5 seconds. It’s been running for me now for an hour, and the modem hasn’t disconnected yet.

You’ll have to run this once each time you start Windows, but it’s far more convenient that having your broadband disconnect every 3 minutes! Hopefully 02, Huawei and MS will fix this permanently soon, but until then, this should keep you going.

Update: After using this solution for a few weeks, I’ve found that it doesn’t reliably fix the problem. However, it does seem to keep the modem alive for longer, but it will still cut out eventually. Huawei, O2, Vodafone and Microsoft (especially bloody Microsoft) had better get their act together!

Categories: Web Developement

New Demos for Dojo & Google search engine online

Tue, 05/13/2008 - 15:42

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 :-)

Categories: Web Developement

Keep up with the latest Dojo Demos

Thu, 05/08/2008 - 15:32

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.

Categories: Web Developement

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

Tue, 05/06/2008 - 22:19

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.

Categories: Web Developement

Google and Dojo, Sitting in a tree…

Thu, 05/01/2008 - 17:15

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!

Categories: Web Developement

Dojo Developers: Subscribe to this now!

Thu, 05/01/2008 - 12:45

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 :-)

Categories: Web Developement

Great Dojo Widget tutorial

Tue, 04/22/2008 - 13:01

Pete Higgins has posted a great tutorial on how to write a Dojo widget, taking as an example his recent addition, FisheyeLite.  Check it out at http://dojocampus.org/content/?p=100

Categories: Web Developement

DojoX Calendar widget committed

Fri, 04/11/2008 - 10:05

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!

Categories: Web Developement

DojoCampus - The best Dojo learning resource

Wed, 04/09/2008 - 13:19

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.
Categories: Web Developement