Writing My Own Travel Agent in C#

Jul
30
2008

Yesterday, Garrick was describing the difference between a "search result" and "find". His short answer was:

Search Results Listings say, 'The answer might be here'. Find says, 'Here you are, get on with your day.'”

That distinction is something that has always struck me as irritating about using every travel site I've ever seen (later discussion revealed that, ironically, this distinction is talked about obsessively at Orbitz). That irritation is because every search I've made started out as something that doesn't fit in their search boxes: "Find me a cheap coach flight and a hotel near the conference center in Austin, TX for SXSW", "I'd like to go to San Francisco for a long weekend some time this fall; is there a way to do that for under $500?" or "Which one of these cities and which weekend will be cheapest in October for a 5 day weekend?".

Those aren't questions which naturally get answered by a search results page. You don't get to pose those questions to travel sites. What you are asked on every one of them is to choose specific dates and, in many cases, both airports. The sites don't even so much as hold on to the fact that 99% of my travel is based out of Minneapolis/St. Paul International Airport.

Rather, I get a constant flow of emails from the travel engines telling me about great deals to Miami/Las Vegas/New York for $89. Of course, if you are flying out of Minneapolis, that deal suddenly becomes $327 instead.

There is a place you could and can ask those questions and get your "find" satisfied. Travel agents pick up the phone, listen to just such a question and call you back later in the day with the results of your find. Unfortunately, they also are professionals who need to make a living. That means they're not entirely thrilled to, for instance, check daily for weeks at a time for a very specific set of criteria for a vacation I may take if the deal is good enough.

That does, however, smell of the kind of thing that I like sling a bit of code to solve. And, it's something I've wanted to solve for a very long time. Every couple of months, I go looking for a way to write code that searches for flights and hotels and have always come up empty.

Then, this weekend, I did it again and ran across the Kayak API, which looks like what I've been looking for all along. The API allows 1000 searches per day, per developer key. While that wouldn't let me create much of a public service or commercial application, it's a really roomy number if you're looking to do lots of permutations for your own travel needs.

Personally, I'd like to do things like have a list of cities I've never been to and have software grind away on it, finding a good deal for a "fall long weekend" or a "week-long summer vacation", etc. for one of those locations. Similarly, I'd like to be able to say, "I've got $300. Is there somewhere I can go and get a hotel for a 3 day weekend that's on my list?".

Software can easily handle digging through the tedious crap like seeing whether leaving on Thursday and coming back on Sunday is cheaper or more expensive than leaving on Friday and coming back on Monday. As a person, trying those combinations on the existing search results-oriented sites is tedious. Tedious is what software does best.

Before I start dreaming too big for what might be possible, I threw together a quick POC app to see how easy it might be to search and grab results. I created a really basic class library for doing the actual searches and a tiny console app to try out a single search.

I have to say, I like what I see and think that there are some real possibilities for coding up my own travel agent with Kayak.

The sample, half-finished POC code is available in PDF form if you want to look at it. It's got gaping holes all over (hard-coded, read-only properties, unused properties, concatenated strings, etc), but shows the basic idea for how to hit the service. This doesn't do anything to take advantage of any of the polling cycle that the API documentation describes, so the results are incomplete.

However, it proved what I wanted from the POC. I'm now pretty sure that I'll be able to get what I want out of that API. If you're interested in travel and writing software, it might be worth a look for you as well.

New Motorized Bicycle Arrived

Jun
11
2008

In the early days of the internal combustion engine, there were lots of fairly simple vehicles powered by the new motors. One of the first was also fairly cheap. Bicycle shops all over the place took small gasoline engines and regular bikes, creating hybrids (human/gasoline) long before Prius fever swept the nation.



1902 Motorbike Advertisement

As Henry Ford's Model T came on to the scene, the attention shifted to vehicles that could transport the whole family, more cargo, etc. World War II vets brought interest back to 2 wheeled motorized transportation. However, by then, the engines got much bigger and eventually led to the Harley, Honda, and other full-sized motorcycles that you see (and hear) heading down the road.

Today, there's lots of interest in getting from Point A to Point B with as little of the liquified dinosaurs as possible. Heck, if you're looking for a new drinking game that will get you drunk by noon, just take a swig every time someone starts a paragraph with the following phrase:

With gas at $4.00…

There are reports at dealerships selling mopeds, scooters and motorcycles that sales are up by as much as 40% over this time last year. The appeal of vehicles that get 75, 100 or even 150 miles per gallon is obvious if you've ever seen the gas pump fly past $70 as you fill the tank.

Personally, I've been interested in alternative forms of transportation for a while. Heck, I distinctly remember sitting on the riding lawn mower at the age of 10 daydreaming about whether I could take the mower into town. I dreamed up a way of putting a sort of tent over it so I could ride in the rain.

More recently, I've tinkered with an electric bike. That project is sitting in the garage, taunting me. I would love to tackle it again and have that option available in my transportation arsenal. However, the pragmatist in me realizes if I wait for that day to come, I'll just keep driving my truck.

So, last fall, I began thinking about a way to expand my options for getting around without using a gallon of gas for every 20 miles I drive. Shelly's new job has provided one option and we're now carpooling several days per week. However, I wanted something that makes the short trips to the store, library, etc. better as well as the commute.

Since Minnesota requires an extra endorsement on one's driver's license to ride a motorcycle (and the time to take the class/test is in short supply), I did a bunch of digging into the gas-powered options with engines smaller than 50cc's. That size avoids the motorcycle endorsement and slides into a fairly unregulated category.

I looked at the "normal" mopeds a bit, but they didn't really catch my interest. Then I ran across a company called Spookytooth Cycles. They build motorized bicycles in the style of the original motorcycles from 1902. With several models under $500, they are providing cheap transportation to lots of people.

I was intrigued and made a note to look into getting one this spring. About a month or so ago, I finally took action and ordered one of their bikes, called The Dresser.


Spookytooth Dresser (what I bought)

I ordered it and have spent the last month waiting for the build and shipment process to finish up (that's their normal lead time FYI). Today, FedEx delivered a couple of boxes containing my new motorized bicycle. While I ordered it "fully assembled", there is some assembly that needs to happen in order to cut down on shipping costs.

So, I still have a minor project to finish before I can ride it (plus the rain has to stop before I'd want to). However, the shiny new vehicle is sitting in the garage right now and I'm looking forward to taking it for a spin when I get a chance.

With mileage in the 150 mpg range, it's definitely an option worth looking at if you're trying to cut down on transportation costs or just want to cruise down the street with the wind in your hair.

 

J Wynia

For better or worse, I'm the guy who runs things here. I'm a web consultant, software developer, writer and geek from Minneapolis, MN. This site is a fairly wide cross-section of the things I'm interested in and enjoy writing about.

Oh, and if you happen to be looking for hosting for your Subversion repositories or just web hosting in general, take a look at Dreamhost. It's what I use for Subversion and your signup helps me out.

Feeds and Links


www.flickr.com
This is a Flickr badge showing public photos from J Wynia. Make your own badge here.

Search


Pages

Archives

Computers Blog Directory
© 2003-2008 J Wynia. All original content is licensed under the terms of the Creative Commons Attribution license unless otherwise noted. Content from other sources is licensed under its original terms.