Archive

Archive for September, 2008

Merlin Mann visits Orbitz

September 30th, 2008

Merlin Mann, creator of 43 folders, was in the office today to give his talk on Time and Attention. It was a very good talk, and Merlin offered plenty of practical advice on how to manage distractions at work, and really focus on what you are getting paid to do. If you constantly feel like you can never get anything done at work due to meetings, the constant flow of emails, or some other distraction, I’d highly recommend checking out the presentation. None of what Merlin points out is rocket science. It is all simple, practical, and sound advice. I’m really going to make an effort to try some of his suggestions, and see they can’t help me spend a little more time doing what I’m good at while at work…solving problems.

Tech Industry ,

TravelAgent Gnome Do plugin in the wild

September 19th, 2008

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.

Software , ,

My first Gnome Do plugin

September 13th, 2008

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!

Software ,

Threading gotcha in C#

September 11th, 2008

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!

Software , ,

Gnome Do Absolutely Rocks

September 9th, 2008

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.

Linux

Testing your software

September 1st, 2008

Over the past couple of years, I have taken quite an interest to software testing. I’ve been reading up on the subject and playing around with different testing tools and techniques, trying to find ways to better test my software. I know from experience that many developers write off testing as boring, pointless, or too difficult. However, I don’t believe that any of these arguments pan out. I’ve also come to better understand the need for comprehensive tests that run on their own and report any problems that they find.

I’ve found that some of the challenges I’ve faced trying to test my team’s production code have been as difficult, or more difficult than solving some of our business issues. Several of these issues have been very fun to solve. Not only did I have to face issues regarding how to test a given piece of code (which were numerous), but also how to go about automating all of our different tests. I am also currently looking into ways to make these automated tests run faster, so we can get notified quickly if our continuous integration build breaks.

As for testing being pointless, well, that argument just doesn’t hold up at all. Sure, comprehensive test coverage, even 100% coverage, will not prevent bugs from creeping their way into your code. But, assuming that you write a new test for each bug you find, it will ensure that once you squash that bug it will never come back. A good test suite acts as a safety net, letting you know immediately if code you are introducing breaks other existing code. These are just the functional benefits. Good tests also serve as excellent documentation on how to use your class or your system. This documentation, unlike some other forms of documentation that is separated from the code, never goes out of date. If it does, it usually results in a test breaking.

Testing can be challenging, but it is far from impossible. In fact, the more you do it, the easier it gets. Testing can be much more difficult on code that was never designed to be tested. Refactoring is the best way to make your code more testable. And, as a side benefit, making your code more testable usually means decoupling it from the rest of the system (always a good thing). However, due to time constraints or other issues, refactoring to this degree may not always be possible. In that case, several tools exist to make testing possible. Mocking tools like EasyMock, jMockit, and JMock allow you to mock out parts of your system that are not decoupled via an interface. Although this is not ideal, it does provide a means for you to test your previously untestable code. If your code is already written to use interfaces over implementations, dependency injection tools like Spring and Guice give you a great means to inject mock objects into your code at runtime.

You’ve probably noticed that I have not mentioned one form of testing over another (unit, integration, performance, etc). That is because everything above applies to all forms of testing. And, in addition to what is listed here, each of these testing types has their own list of benefits. My next several posts will will focus on a particular testing type, and talk about that type in much more detail.

Stay tuned!

Uncategorized