TravelAgent Gnome Do plugin in the wild

I’ve just completed the initial release of my second Gnome Do plugin. It’s called TravelAgent. TravelAgent allows you to kick off searches for flights, rental cars, and hotel rooms on select travel agency websites right from Do. To use TravelAgent, you tell Do what you want to search for (flights, cars, or hotels), provide Do a simple search query string (see the plugin’s wiki page for details), and specify which of the supported travel agencies you’d like to use to conduct the search. Do will then open up a web browser, bringing you to the search results page on the travel agency’s website.

Let me just state this right from the start. I have no idea who will use this plugin, or who, if anybody, will find it useful. This is just something I wanted to do. If others find it useful, then that’s great. But, that was not my main motivation. Searching for travel can be complicated, as there are many options to consider. Take flights for example. The number of passengers you’re looking to book a flight for, and the “types” of those passengers (adults, children, seniors, etc) can vary from search to search. The departure time, arrival time, and flight time is often very important to people. Some people only fly certain airlines or certain cabin classes (coach, first class, etc). Trying to sum all of this up into a Do plugin is difficult. Do’s interface is simple…it needs to be. That’s one of the reasons why Do rocks so much. So, using the plugin had to be just as simple. To do that, many assumptions were made about the search being conducted, greatly reducing the flexibility of the search as compared to doing the search right on the travel agency’s website.

So, what is it useful for then? Well, it’s a quick an easy way to do a price check. And if you’re interested in purchasing some travel, then you can always tweak the search right from the search results page, to get it just the way you want it, before continuing down the purchase path.

As for the list of agencies supported, they are all Orbitz Worldwide agencies. All of the agencies are also running our global travel platform, which means I can interact with all of them the same way. The plugin currently works by building a URL, which contains all of the necessary search criteria, and feeding that URL to the web browser. It was the simplest way to get up and running. So, where is Orbitz you ask? Well, Orbitz is still running the classic platform. It does not have pretty URLs, or any other type of publicly available web services that I could use to conduct a search. I could write a screen scraper to get the job done, but that was beyond the scope of this initial 0.1 release. Cheaptickets suffers from the same issue. Soon, we will be rolling some of the other Ebookers agencies onto the new platform. When those sites go on, I will add support for them in the plugin. Orbitz and Cheaptickets are still a ways out, so I may look into scraping those sites for the time being.

So, what’s next for the plugin? Here’s a short list of stuff I’d like to do:

  • Add support for additional OWW agencies
  • Add support for searching packages (flight + car rental, flight + hotel, flight + car rental + hotel)
  • Change the plugin to display the search results in Do, instead of on the agency’s search results page (but still giving the user the option to see the full search results page)
  • Add support for pre-configured search options, like cabin class, preferred airline, etc. This would give the user more control over the search, while keeping the search query string simple.

I’m sure more features will come up as time goes on. We’ll see where this heads. If you have any ideas for what you’d like this plugin to be able to do, I’m all ears.

My first Gnome Do plugin

I just pushed the code for my first Gnome Do plugin. It is a plugin for Confluence, a popular wiki package, and allows you to search your wiki from within Gnome Do. Do will present you with the results, and selecting one of the results will open that page in a web browser.

I want to give a shout out to the Do developers. Because of their very powerful and flexible plugin architecture, writing the plugin was a snap. Very little code was required. I probably spent no more than 10 hours total on this plugin, and the majority of that time was spent learning the plugin architecture, and learning how to install and test my plugin.

The code is currently on its own branch, waiting to be merged with the Gnome Do community plugins branch. If interested, you can currently find the code at https://code.launchpad.net/~john-p-wood/do-plugins/confluence. Eventually, it will be merged to https://code.launchpad.net/~do-plugins/do-plugins/community.

Next up, I’m working on a Do plugin that will interact with the many Orbitz Worldwide travel websites. Stay tuned!

Threading gotcha in C#

So, as I mentioned last time, Gnome Do rocks. So much in fact that I’m looking for ways to contribute to the project. I haven’t been this excited about a piece of software in quite some time. The nerd in me is giddy.

My first contribution was to fix a bug I opened against the JIRA Gnome Do plugin (an awesome plugin by the way). The bug was causing Gnome Do to crash at startup if the JIRA server could not be reached. The fix was pretty easy. Wrap the code throwing the exception that was causing the crash in a try/catch block, and simply log and swallow the exception. Gnome Do calls the plugin every 5 minutes to update its index, so once you eventually connected to the web or logged in to your company’s network and can see your JIRA server, the plugin will be able to index the JIRA issues and all will be peachy.

I tested the fix, and it worked like a champ. However, I started to think to myself that it was very odd that Gnome Do let a rogue plugin take it down. I figured it would be a good idea to isolate all calls to the plugins, and wrap them all in try/catch blocks, as a means to protect the core application. I did some digging in the code, and I found that Gnome Do was already doing exactly that. So why on earth did an exception in the plugin take down the core app?

I did some more digging, and in the JIRA plugin, the update takes place in a separate thread. The author of the JIRA plugin, knowing that the call from Do to update the plugin’s index was a blocking call, and knowing that the communication with JIRA may take a little while, decided to do the communication with JIRA in a different thread, and immediately return control to Do. It was this thread that was throwing the exception when the JIRA server could not be reached. This puzzled me. Could it be possible that an uncaught exception in a separate thread can take down the entire application? “No way in hell” I thought to myself.

I was wrong.

With Google by my side, I searched the web for “c# thread exception” and found this free e-book about threading in C#. At the very bottom of the page, read this:

From .NET 2.0 onwards, an unhandled exception on any thread shuts down the whole application, meaning ignoring the exception is generally not an option. Hence a try/catch block is required in every thread entry method at least in production applications in order to avoid unwanted application shutdown in case of an unhandled exception.

Holy crap! I showed this to a co-worker, who quickly whipped up a Java program that spawned a thread that threw an exception, to see what happened. We were pretty sure that only that thread would die, and that the JVM would continue to chug along as normal. Thankfully, we were right.

Why on earth would .NET behave this way? The e-book says “From .NET 2.0 onwards”, so I’m assuming that this wasn’t the case in .NET 1.0. I wonder what the reason was for this change. Now, any .NET application that allows itself to be extended by plugins is now at risk of being taken down, at any time, by a rogue plugin! Yikes!

Gnome Do Absolutely Rocks

I’ve been talking to some Mac users at work recently, as Orbitz is contemplating replacing the Linux workstations our developers use with Macbook Pros. As you could imagine, this is generating a lot of buzz. I’m not a Mac user (long live Ubuntu), so I set out to understand what makes Mac users so passionate about Macs. What rose to the top of everybody’s list was an application launcher on steroids called Quicksilver. People just couldn’t stop talking about how awesome it was. So, I set out to see if there was a port of Quicksilver for Linux.

What I found was Gnome Do. Do, and Quicksilver, enable you to do anything you may need to do on your computer with just a few key strokes. A wide variety of plugins enable Do to support just about anything you can think of. I don’t know much about Quicksilver beyond it’s main features, so I can’t really compare Do and Quicksilver. However, I can state with 100% confidence that Gnome Do rocks!. Assuming that Quicksilver can do everything that Do can (and I don’t see why that wouldn’t be the case), I can see why all of the Mac users are ga-ga over it.

With Do, you can:

  • Start applications
  • Start applications with certain parameters (ssh to a given box)
  • Open files or folders on your file system
  • Perform operations (move, rename, delete, etc) on files or folders on your file system
  • Traverse the hierarchy of folders in your file system
  • Search Google (having the results presented right in Do)
  • Kick off the composition of an email to somebody in your address book
  • Kick off an IM conversation with somebody in your buddy list
  • Quickly navigate to a JIRA issue (if you use JIRA for issue tracking)

That’s the short list. I’ve only been using it a day, so I’m still learning some tricks. I can see how this could make somebody much more productive, as now everything I need is just a few key strokes away. Check it out. You won’t be disappointed.