Wednesday, October 31, 2007

Scarier Day At Work Than Usual

I love Halloween at work - I get to marvel just how creative my coworkers are. I didn't, as usual, dress up, because, as usual, I didn't give myself enough time to put a costume together.

I'm adding a note to myself in Google Calendar, 6 months from now I'm going to research and prepare a costume to have ready to go for the Halloween.

Congrats to Chris, from the dev team, on winning funniest costume for his Bad Santa outfit.

--Ben

Update: My photo of Megan, as a Zombie, just isn't doing her costume justice. She definitely earned the award of scariest costume. The whole blood stains around her mouth - just too spooky.

Tuesday, October 30, 2007

Remote MySQL Tips

Last night I wanted to dump all the data from a MySQL table, edit it in Excel and then reload it back into the table. MySQL provides tools like mysqldump and syntax like SELECT ... INTO OUTFILE ... - however, they assume you have local access to the filesystem. Unfortunately, I didn't have this kind of access.

After a bit of poking around, I came up with the following commands to bulk extract and load remotely.

Remote Table Dump

--
-- Run from a shell (cygwin works) prompt
--
echo 'select <col1>, <col2>, ... from <table>' | \
  mysql  -h<remotehost> -u<user> -p<password> \
  <database> > outfile.txt

Note: This command is run from a shell command prompt, not from inside the database. In this case, outfile.txt will contain a tab separated file with the results of the query that was echo'ed into the mysql command.

Remote Table Restore

--
-- Run at a MySQL command prompt, assuming you're in the right database
--
LOAD DATA LOCAL INFILE 'outfile.txt'  
   INTO TABLE <table> (<col1>,<col2>,...);

This command is not nearly as sexy as the previous one. LOAD DATA is a SQL command MySQL offers. The tricky part is that you need to include the LOCAL keyword.

Did I mention that Postgres handles all this in a much cleaner and more consistent way?

Digital Bookmarks

I just had to return two books to the library I didn't get to finished. I'm leaving myself a few notes about them here so I can decide if I want to go back and pick them up.

------------------------------------------

Title: Too Lazy To Work, To Nervous To Steal

Author: John Clausen

What it's about: How to make enough money as a freelance writer so you can live the good life (as a freelance writer)

Why I picked it up: My interest in small business and the fact that the act of writing is similar to the act of programming. To be honest though, I the clever title probably was as much a reason as any.

Main lesson: Reuse, reuse, reuse. Find ways to take the same writing and republish it in as many contexts as possible (changing it to be relevant, of course). Also, be a generalist - write lots of different types of content to cast the widest net possible.

Worth reading? Sure, why not. Programmers like myself will probably find a lesson or two to take away. Writers, YMMV. I doubt this is the best book on the topic out there.

Rating: 7/10

------------------------------------------

Title: Debugging

Author: David Agans

What it's about: This is a book that attempts to teach the art of software and hardware debugging. It's programming language and environment agnostic. It's trying to teach the fundamentals of debugging.

Why I picked it up: I'm a programmer, debugging is what I do. I'm always up for learning new tricks.

Main lesson: Debugging isn't just a skill that takes years to master through trial and error. There are concrete rules a beginner can follow today to be better at debugging.

Worth reading? Great for beginners and anyone who hasn't had a lot of practice in debugging software. Even if you aren't a programmer, the lessons are invaluable. If you've been programming for years, there's probably less here for you.

Rating: 7/10

--Ben

Morning Linux Challange

What is this, Monday? I come and find that one of our dev wiki is down. I poke around and learn that the box is pingable but not sshable. Something is hosed.

I wander back to the machine room, where Phil and I find the physical hardware. The machine was running, but there was no video and the keyboard wasn't working. I hit the old reset button and watched the machine reboot. Just as it was showing me the prompt to log in, the screen went dark and the keyboard stopped responding. Crap.

Our first move was to swap out the keyboard, and reboot. That would have been too easy, and of course didn't fix the problem.

Here's what we did to actually debug the problem:

  • Boot into single user mode by following the instructions here
  • Once at a shell prompt, I changed into the startup scripts directory by doing: /etc/rc.d/rc3.d
  • We then listed every file that should be started in that directory by using command: ls S*
  • One at a time, we started up each service on the box by doing: ./S13portmap start.
  • As soon as we ran ./S56gpm start the console went dark the keyboard stopped responding. Aha - found it!
  • We ran: rm S56gpm and rebooted. Problem solved!

Apparently, a recent update of the Linux OS apparently installed a version of GPM which is incompatible with something. Either way, we don't use the console on this box, so ditching GPM was an easy decision.

Whew, back in business. OK Linux, what do you have for me next?!

Monday, October 29, 2007

You Did What?!?!

Gavin Purcell pointed me to this remarkable site: WeAreOnlyHuman.com. The goal: collect up stories from people who have messed up and are willing to share their stories with the world.

The site is all about publishing your experiences to help people avoid the same pitfalls you've had. Some examples: taking out stitches myself, sending my wife another woman's number (d'oh!) and trusting Apple Technical Support.

Plenty to learn here. It's sort of a tipbin for your screwups.

Read it for the advice. Or just read it to appreciate that your day wasn't that bad.

Now that's a screensaver!

Forget race cars, scenic shots and chicks in bikinis - this is a *real* screensaver. It's the GNU Emacs Reference card in all its glory.

My guess is that now the cleaning people will get to learn emacs, and once they do, take over our jobs. Yeah, emacs is that powerful.

--Ben

Update: It's worth mentioning that this was Beamer's screen at the office. Way to go Beamer!

Sunday, October 28, 2007

Paper Folding, Math Hacks and Yummy Geography

We had a great lunch with the boys. Some of the activities that kept us
busy included...

- Nibbling on toast until it was shaped like a US State (can you
identify: 2 Commonweath's of Virginia, 1 Rhode Island and a shoe?).

- Attempting to beat Briteny Gallivan's paper folding record [1]. We
got stumped at 8 folds.

- Spencer taught us a nifty hack for multiplying any set of two digit
numbers.

- I got trounced in the connect-the-dots-to-make-squares game (by a 9
year old, no less). At least I held my own in tic-tac-toe.

A fun time was had by all.

[1] - http://www.pomonahistorical.org/12times.htm


--Ben

My First Blidget

George just introduced me to the term Blidget. Basically, it's a Blog + Widget. In about 15 seconds, I made one for my site.

So, if for some sick and twisted reason you think you need a mini version of my blog on your website, you can easily get one here.

Here's what it looks like:

I suppose this whole Blidget ideal would be useful for sites other than mine, too. I could see how it would be handy to put your favorite RSS feed into a nice, neat, little box to shown your site.

Thanks George!

Haunted Manor - Ben's Ideal Level Of Scary

Last night we hit the Haunted Manor in Leesburg VA with friends. It was the first time in years (if ever?) that I'd been to one of these haunted spectacles, so I wasn't quite sure what to expect. It was basically a walk through various parts of a farm with costumed figures jumping out and attempting to get you to wet your pants. You'll be glad to know, I held my pee the whole night.

The good news is that that the event wasn't that scary, so I kept a tiny amount of dignity and won't be needing Post Traumatic Stress Disorder counseling. On the other hand, for $15.00 a head, I expected a bit more drama. Franky, I wasn't scared enough.

I did get to appreciate one of my defense mechanisms when I'm under stress though. Man, do I talk a lot. I must have attempted to carry on a conversation with every zombie and axe murderer that jumped out at me. I expressed everything from hope that they could get past their anger issues, to pleas to take the tasty morsel walking directly behind me (uh, that would be Shira). Hopefully it was entertaining for those around me.

I think this whole experience would probably be good for kids on the older side (like 13-14ish, maybe?). They'll appreciate that the gore, while knowing that it's all fake. As for adults, I would go in knowing that there's not much to be terrified of here.

As if to insure that at least older guys had fun at the event, they had a belly dancer / snake tamer on hand. Me, I was only interested in checking out the snake. Was there a young lady there holding it? I had no idea...

Friday, October 26, 2007

Winter Time

It's winter in DC. My proof? Our heat is on for the first time this year!

Apparently, the house dipped to a chilly 69 degrees, and to keep the pipes from freezing, Shira was forced to turn on the heat.

I just talked to my dad in Rochester. His house is 61 degrees, and no sign of heat even being considered.

--Ben

Dabbling With Forth

Want to give this whole Forth programming language a try? Check out myForth, a Java Applet that gives you instant access to a running instance of Forth.

Open up the Beginners Guide To Forth for help to get you started.

After a few false starts, I finally got down Hello World:

 : yo CR ." Hello World" CR ;
 yo

As a side note - what a blast from the past. This is a Geocities site running a Java Applet. What is this, 1998? It's amazing it runs as well as it does. If all Java Applets were this clean, maybe we wouldn't have had to abandon Java in the web browser?

Happy Forth'ing!

Thursday, October 25, 2007

Two Languages For The Price Of One

A while back I stumbled upon this very cool, and tiny, implementation of forth. Why learn forth? The introductory comments explain why quite elegantly:

LISP is the ultimate high-level language, and features from LISP are being added every decade to the more common languages. But FORTH is in some ways the ultimate in low level programming. Out of the box it lacks features like dynamic memory management and even strings. In fact, at its primitive level it lacks even basic concepts like IF-statements and loops.

The introduction goes on to explain that not only is forth minimal, but it also supports extending it in dramatic ways. If you are ever in a situation where a low level language is called for (say programming your robot legos), then forth should be your language of choice.

The tutorial also provides you with a working demonstration of another language: i386 Assembly. The forth interpreter is written in assembly, a language I've never really got comfortable with. One reason why, no doubt, is the lack of substantial examples. Well, that's no longer the case.

If I can fully understand the implementation I'll be a lot closer to understanding both these languages on a much deeper level.

I'm tempted to bust out my ancient HP 200 LX (aka Billy) and see if I can get the assembly to compile on it. Then I'd have a forth interpreter I could carry around with me. Exciting thought, isn't it?

Greg's Advice To Amtrak

My buddy Greg had a terrific idea tonight, so I thought I'd share. This one is for you Amtrak - so pay attention.

Greg's suggestion: along with dining cars, trains should have singles cars. That is, cars meant for people looking to meet that special someone.

Brilliant, no? Amtrak, you can send us a nominal fee to license this idea. Greg would probably volunteer to screen the participants. At least the cute ones, anyway.

Wednesday, October 24, 2007

Videos Of The Week

Here are two entertaining videos of note.

First, from my Brother David, a news clip about one of the Israeli Defense Force's techniques for producing high quality soldiers. I'm not surprised in the least.

And here's one from Adrants . It's a compilation of all the classic viral videos over the years, and it's done superbly. Test out your Internet history skills by following along.

Making The Switch

I just Switched - no, not between Windows and Mac, or Emacs and vi. From a clipped set of note cards back to a spiral notepad.

The note cards were a worthy experiment, but at the end of the day, not as useful as a notepad.

Two reasons finally pushed me back to a pad. First, I really missed the archival nature of notepads. With the index cards I found myself constantly pruning my stack of notes, which means that there were some notes and scribbling I lost. A notepad tends to get filled and archived.

The bigger reason to switch was that I found it just a bit to tricky to flip between a clean writing surface and previous notes. It involved me unclipping and re-clipping the stack, which was a handful.

Two aspects of the cards I really liked was their heavier stock and the fact that they weren't ruled. Because of this, I found them easier to sketch and diagram on.

What I'd love to find is a small (A7 size) sketchpad friendly notepad with say 70 sheets in it. And I'd like this mythical notepad to be nice and cheap too. Any suggestions?

--Ben

Tuesday, October 23, 2007

A picture is worth 1000 signs

We must be getting close to a local election, as my route to work is choked with signs highlighting candidates names.

This year, I've notice two changes to the usual smattering of signage. First, a few candidates have super-sized their signs, deploying mini-billboards instead of the usual smallish versions. This doesn't do much for me.

The second arrival I think is more impressive. If you look at the first photo, next to the big sign is a smaller one with a red trapezoid like shape on it. This red shape is actually a graph. It shows how much taxes have gone up during the "Connelly Years."

I have no idea who Connelly is, but I'm pretty sure taxes went up during his/her term.

I find this remarkable because all the other signs I've seen want to stress simple name recognition. This sign, on the other hand, wants to tell me a story - one that I can read an appreciate driving by at 30Mph - no less. And it works.

The lesson: pictures matter, stories matter, and one should use them. And when I run for office, I'm so hiring the guy who did this signage.

--Ben

Monday, October 22, 2007

End of the line

Our England trip is officially over! Just a few hours ago our luggage was delivered to us. It only took them 3 days.

Thankfully, they were marked "rush" - or they'd probably arrive in a week or two.

--Ben

Sunday, October 21, 2007

Getting fancy with Excel: vlookup

Mr. Excel got me on the lookout for ways I can leverage good 'ol fashion Excel formulas in my day to day work. Tonight I found my first scenario where Mr. Excel's advice came in handy. Here's the problem:

The Problem

My boss sent me a spreadsheet with a few columns of data. However, one column was missing. He asked me to fill in that column by using data from database I had access to. There didn't appear to be an easy way for me to query the database and drop the results into the column. It was looking like I was going to have to run a query and manually place each value in the correct row in the column. Yuck!

The Solution

Here's what the data looked like (scrubbed, of course) before I got started:

I started off by dropping the data from the database in another part of the spreadsheet. It's important that I kept that data as its own little table.

I did two things to the data. First, I lowercased all the names. I did this to make the data a little trickier to work with (you'll see how that works in a few moments). Second, I sorted the data in descending order. This step is required - things will break in strange ways if the data off to the side isn't sorted properly.

To actually fill in the missing column, I copied the following formula to each row in that column:

 =VLOOKUP(LOWER(B5),
          $G$6:$H$12,
          2,
          TRUE)

The key to this formula is vlookup, a function which will browse through a set of data and pull you back the appropriate value given a lookup key. In this case, the key to lookup is lower(B5) and the data set to check is $G$6:$H$12. The third argument 2 says which column to pull back when you find a match - the 2nd column in this case. The final argument, TRUE is there for reasons I can't explain. Without it, things don't work properly.

Here's the final result:

This spreadsheet is nice and maintainable. If the database values were ever to change, I could drop in a new lookup table off to the side and the sheet would automatically correct itself.

This was fun! I'm so keeping an eye out for more ways I can leverage Excel.

Back in the USA

We may not have 1000 years of history, but we do have free refills. And all the free water you can drink.

I love this country.

--Ben

Saturday, October 20, 2007

A Party To Die For

Ryan and Erin put on an awesome murder mystery and Halloween party tonight.

Pictured here is the victim that kicked off the night's mystery - Shira with a gunshot wound (oozing ketchup, no less). My team (go Rob and Julie!) worked tirelessly to figure out who killed Shira and why. We figured it out, but were a few minutes late in submitting our guess, and lost out to another team.

Next year I'm bringing a whiteboard. How can you solve a murder mystery without a whiteboard?

Between the jet lag and waiting to the last minute, I didn't come up with a costume and went as myself. As expected, others did and they looked great. On the bright side, I now have plenty of ideas for other parties this season.

Ryan and Erin definitely set the bar nice and high for Halloween parties. What fun!

--Ben

Update: Gareth also has coverage of the party. He and Teresa actually dressed up in costume, and looked really good. That's inspirational for me, next year.

Friday, October 19, 2007

Getting Home: Flying Snafu

Nice shot of our plane, no?

There's one itty, bitty, teensy, weensy detail that's worth noting. The plane is American Airlines. We were supposed to be flying United.

This is just the outcome of a typical international flying snafu.

As our boarding time got closer and closer, we noticed our flight had no gate. Finally, at 11:55am, for our 12pm flight we walked over to the info desk. Apparently, a bird flew into the engine, bringing our travels to a halt. Amazing, all this technology, and we can't keep out a bunch of friggin birds? Forget the terrorists, let's work on bird control.

Things went from calm to chaos as United Airlines scrambled to get people assigned to new flights. I watched two ticket agents wonder aloud what we were supposed to do about our luggage, and how they were going to handle the hotel arrangements. It's like this was the first time a flight had ever been canceled at Heathrow.

We nearly got on a Virgin Atlantic flight back to the states, but as the guy was keying in our ticket, a man came over and said there were no more tickets available. Argh.

We had to make that classic decision - fight to get home, or surrender and try again tomorrow.

We chose to fight. We had a bittersweet victory. We got a flight home tonight, which was good. But it's through Chicago, which is another 4 hours of flying time. And then there are the little annoyances: the plane doesn't have our kosher/veggie meal request, we lost our aisle/window seats, we lost our economy plus status, our luggage may arrive in a few days or not, heck even the movie I was planning to watch isn't being shown on this flight.

What a pain.

That's enough kvetching. To finish off this post, and this mostly to save my sanity, I'm going to list 5 great things about our situation.

1. I'm traveling with the prettiest, most intelligent, sexy and adorable traveling companion in the world.

2. I was just back by the bathroom, and there was this guy snoring incredibly loudly. I'm sitting nowhere near him.

3. They gave me the *whole* can of Coke when they served me my drink.

4. There are some interesting movies to watch that I've never heard of, which should be fun.

5. American Airlines has more leg room in their economy seats than United, so our Economy seats aren't half bad.

6. I'm vertical.

Editor's note: I hate not having an aisle seat, we will never get our luggage, we are flying west to go east, I just lost my miles on United towards my next premier status and I am sitting next to Mr. "Let's look on the bright side." I guess we all see the world differently.

--Ben

Update: After 24 hours of travel, we made it home safe and sound. 2 days later, there's still no sign of our luggage. Yeah, the adventure isn't over yet.

Homeward Bound

We are boarding in just a few minutes, and then it's 8 short hours back to reality. See ya'll in DC.

Cheers!

Thursday, October 18, 2007

Day 5: Kew Gardens and The Hunt for a Sacred Object

The main event today was making my way out to Kew, to visit Kew Gardens. It's 300 acres of stuff to see, so to say that it's impressive is an understatement. I basically did a 4.75 mile hike and still didn't see everything. The sun was out and it was an absolutely perfect day to be strolling through the garden. The guidebook gives Kew Gardens 3 stars, the same as Windsor Castle, and I'd have to agree with them.

One of my favorite gardens was the Japanese rock garden. Think my neighbors would mind if I pulled up my grass and put down stones. I'd have to rake the lawn more often, but at least mowing would be a non-issue.

My Fodors tour book promised me that the British Science Museum had Tim Berners-Lee's computer, back from when he was busy inventing the World Wide Web. I figured I had a responsibility to stop by and visit this sacred device. Unfortunately, the computer isn't there (or more likely, I couldn't find it). I was still treated to seeing a chunk of Charles Babbage's Difference Engine from 1832. One could argue that he's one of the granddaddies of all computing, so I still got to visit an important site. The museum had lots of other cool things to see, so I stayed longer than I planned to. Who could turn down browsing an entire wall of vacuum cleaners on display?

We finished up this evening by seeing Wicked - a musical that picks up where the Wizard Of Oz left off. It was really well done, and quite entertaining. I can safely say it's the best musical I've seen in years (and the only one, too). It just wouldn't be a trip to London if I didn't go to the theater.

This was our last fun filled day of adventure. Tomorrow, we get on a plane back to DC and reality. Come Monday morning, I'll be back to work again. I wonder if they'll recognize me at the office?

Wednesday, October 17, 2007

Day 4: Unique London Finds

Today, I had a chance to do more site seeing around London. I started off my day with a tour of Wesminster Abbey. Wow. It's a 1000 years of history in one location - I can't even fathom that.

The Abbey, along with being a working church, is basically a walk in cemetery. Every few steps you walk over a stone inscription, many of which have burials under them. Maybe folks are used to this, but this was totally foreign to me. Jews typically bury their dead in such a way that they can decompose and return to nature as quickly as possible. So, we wouldn't opt to bury them in buildings.

What I was really lacking to appreciate this tour was a history refresher course. I'm sure it would have been much more impressive to see Queen Elizabeth I or Mary Queen of Scots' burial if I could actually remember a detail or two about their reign. Luckily, there are plenty of tombs and monuments to more familiar persons, such as Charles Darwin, Charles Dickens, and the Tomb Of The Unknown Warrior, that I could appreciate.

Continuing the trend I started yesterday, check out what I found while I was around the perimeter of the Abbey:

That, ladies and gentlemen, is the oldest door in England. It goes along with my snapshot of the oldest licensed premises in London.

This afternoon I found myself at yet another unique location: the London Apple Store. Turns out, they have the largest Apple Store in the world. I'm not just goofing off listening to an iPod, I'm enjoying future history. One day, this spot will be written up in Fodors, and no doubt given a star or two.

Oh, and I'm way overdue for a snapshot of Big Ben on the blog. So here it is:

Sidekick Roaming Hack

I usually leave my Sidekick at home when I travel outside the US. The T-mobile data roaming rates are exorbitant, and if there's one thing the Sidekick loves to do, it's transfer data.

This time, I brought along my Sidekick. mostly for the SMS support which is still fairly cheap ($0.35 a message). There's a simple checkbox on the Sidekick (Main Menu >> Settings >> Network Options >> Allow GPRS/EDGE Data Roaming) to turn off data while roaming. My plan was to land in England, turn on the phone, say to not use data while roaming, and I'd end up with an old school SMS/voice phone.

My plan quickly broke down, when I landed, turned on the phone, and seamlessly got connected to UK T-mobile network. D'oh. The system worked too well. I was in a foreign country, and wasn't roaming, I was on my home network. As a result, regardless of the roaming check-box above, my phone was happily transferring data (and running up a bill, no doubt).

Off went the phone. How ironic is that because T-mobile is so established here that I'm having problems? Frankly, I don't see why data shouldn't be free, just like it is in the US. Aftermall, I'm on the T-mobile network, and I pay these guys. Why should I pay extra charges? But I digress.

Today, I got a great tip on how to solve the problem. I turned on my Sidekick, went back to the Settings >> Network Options. I think clicked on the scan for networks button associated with Network Selection.

The phone churned for a bit and then offered me a list of networks: T-mobile, O2, Orange, and others. Naturally, they expect you to choose T-mobile. I choose Orange. It connected me, and because I'm on an alternate network, it noticed I was roaming and off went the data.

I now have a cell phone that's capable of sending and receiving text messages, but won't slurp down data without my knowledge. I can now text message T-mobile with how disappointed I am in their service over here.

Update: I just got off the phone with T-mobile. They think I'm smoking something. According to them, it's not possible for me to be in London and connect to a network without being in roaming mode. When I see UK T-mobile on my screen, it's actually a totally separate network than I'm usually on. Gah! I'm so confused. I'm keeping my don't transfer data while roaming box checked, and hoping for the best.

Update: I restarted my phone, and sure enough, it came up on the T-mobile network and started exchanging data, just like I mentioned above. I called back T-mobile, and they confirmed to me (in two systems, no less) that I was indeed roaming, even though my phone said it wasn't. So, it looks like this is a glitch with the phone - it thinks it's local, even though it's roaming.

This is bad news, because it means I don't get free data exchange like I do back home. But, on a good note, I'm (a) not crazy and (b) the above hack still stands as a way to force the phone into thinking it's roaming.

Tuesday, October 16, 2007

Day 3: Getting Lost

I spent the majority of today working. When I was done reviewing code (that's right, the team gets no rest from me just because I'm in England), I had about an hour and a half to wonder around.

I asked the concierge where I could go jewelry shopping for you know who. He suggested I go a few blocks away to Convent Gardens Market, where I would find all sorts of stores. The advice turned out to be good from the perspective of finding a new part of London to explore. It was bad from the perspective of actually buying jewelry, as there were only two nebbish jewelry stores there (where's my UK version of Jared's when I need it?).

While there, I grabbed a bite to eat. My "sidedish" was a piece of fruit. This brings us to today's quiz: what type of fruit is pictured below?.

If you guessed apple, I think you'd be right. It tasted like an apple anyway.

I exhausted the shopping and still had plenty of time to make it back to the 3 blocks back to the hotel to meet Shira. I thought I might just wander back to the hotel using - don't laugh - my own sense of direction. What an absolute joke. I walked for a bit, then checked the map and realized I was nowhere near where I thought I was. I then pointed myself in the correct direction, and walked a bit more. Looked at the map and realized I was farther off course. I did this a few times, till finally, I took out the map and walked around like a Boy Scount working on his Orienteering Merit Badge. I made it back to the hotel with minutes to spare.

The street layout here makes Washington DC look like a organized. I suppose it's London's age that make it so that the streets twist and turn, with random dead ends here or there. If I could ever get over this driving on the left business, I'd still opt of driving in London just because of the nasty traffic patterns.

On the plus side, the nice thing about getting lost in London is that there's something historic to see around every corner. For example, I found both the Freemasons Hall and the "oldest licensed premises in London" all without trying. Today I plan to do more sightseeing and less work. We'll see how that works out.

Coping with IP Conflicts

I'm on holiday in Jolly O'l England, but wanted to get a bit of work done this morning. Specifically, I wanted to ssh to some boxes back at the office. This is easy - just connect to the free WiFi, start up the VPN and ssh over.

All went well, except for the ssh part. My ssh attempts all failed with a timeout.

After a bit of diagnosis, I realized that the free WiFi of the hotel was putting me on the 192.168.x.* network, and my work network was also 192.168.x.*. The result, when I tried to ssh to my servers back home, the packets were routed to the local network.

D'oh.

Solution #1

My first attempt to resolve this issue was to setup a ssh tunnel (howto found here) back to the office. The tunnel works by allowing me to ssh to a box that's not on the 192.168.x.* network, yet have all packets end up on the 192.168.x.* machine.

To start off a tunnel, you kick off a command on your local machine like:

    ssh -L 7777:destination.host.net:22  gateway.host.net  cat -

This ssh's to a gateway box and sets up a tunnel on port 7777 to the destination box.

It's a really cool technique and allow for easy defeat of a firewall (providing you have all the right credentials).

Unfortunately, various firewalls were getting in the way, and my attempt to open up ports on the gateway box failed. Besides, I didn't have the guts to tell my sysadmin that I had defeated the firewall, even if it was for wholesome purposes, like working on my vacation.

Solution #2

After a bit more thought, I realized that my problem was actually a packet routing problem. That is, I couldn't reach the right 192.168.x.* host because the routing was taking me to the wrong destination.

Windows (and Linux, but I'm on Windows here) has a route command you can use to view the routing table for packets. Turns out, this same command can be used to change the route.

I kicked off cmd.exe and entered the following command:

   # Assume VPN is started
   ipconfig
   # I noted the Default Gateway associated the PPP adapter
   route add 192.168.x.y <IP address of PPP's gateway>

The result is that I'm explicitly routing ssh requests to the box 192.68.x.y to my VPN connection, instead of letting the default routing mechanism figure it out.

The result is that my packets are routed to the right destination and my ssh command now succeeds. For better or worse, I'm good to go and can start working.

Update: Here's a cygwin shell script I wrote up which automagically sets up the proper routes according to IP addresses I have in /etc/hosts. After connecting to the VPN, I run this shell script and I'm good to go.

#!/bin/bash

##
## $Id: post-vpn-script.sh,v 1.1 2007/10/18 08:21:32 bsimon Exp $
##
## Setup the routing around the VPN
##

USAGE="`basename $0` "

VPN_IP=<IP address of your VPN goes here>

for ip in `grep 192.168 /etc/hosts | awk '{print $1}'`
do
    echo "Setting up: $ip -> $VPN_IP"
    route add $ip $VPN_IP
done

Monday, October 15, 2007

Day Two: Hampton Court Palace and London at Night

Today, Shira and I headed off to Hampton Court Palace for a day for more history and site seeing. Before we started though, we got a quick dose of the National Gallery which was also fantastic.

The sites here really are amazing. There's just a immense amounts of history. And after years of family vacations where the goal was to see as much history, and as many starred locations as possible, I'm basically in heaven.

Here's some snapshot from the day...

On our way back from the palace, I grabbed this night shot of London.

Sunday, October 14, 2007

Our First Day in London: One Site for Ben, and One for Me

Of course, as we got to London in the morning, our hotel room was not ready, so we boarded a train and headed out of town. The plan for the day was to see Windsor Castle. We had a great tour guide and it is quite impressive.

Upon returning to town, in order to be fair, since Ben got to pick a site to see, it was now my turn. So, off to London's newest casino we went. In the heart of a Leicester Square is a 6 month old casino that I felt it my cultural duty to try out as I visit casinos all over the world. This got points for being non-smoking. They will see me again tomorrow night, after we see another site of Ben's choosing!