7/3/2008: 4:31 pm: RobertMac, Soccer

Not realizing there was a surfeit of newline characters in a largish mysqldump file I was analyzing, I tried to open it in TextMate. After a few minutes of listening to the hard drive in my Mac thrash away, I had to kill TextMate. One obvious solution was to split it into multiple lines, but obviously I couldn’t use TextMate for that.

Fortunately, the Unix utility sed is a great tool for problems like this. My file had the character string “\n” between all the parts that were reasonable to split into separate lines. The following command did the trick:

$ cat source.txt | sed 's:\\n:\
:g' > dest.txt

First, I used the cat utility to pipe the contents of source.txt into sed. Then, I used the substitute command to replace \n (the extra backslash is needed to escape the special treatment of backslashes) with a carriage return. The \ at the end of the first line escapes the literal new line character that causes the shell to go to the next line. The g tells sed to make this substitute globally throughout the file. I then redirected the output into dest.txt.

Sweet, sweet, Unix.

7/1/2008: 5:04 pm: RobertJavascript

It seems pretty simple, but still far too many web sites don’t set the focus on the input field that users are most likely to type into when loading a page.

Let’s say you have a page with an HTML form with the ID login with fields named user and password. Here’s the HTML and JavaScript for setting the focus to the user field on page load. IE lets you get away with being a bit sloppy and not properly referencing the HTML form element, but the code below works on Firefox, Safari, and other standards-compliant browsers.

<html>
<head>
<title>Focus Test</title>
  <script>
    function setFocus() {
      var loginForm = document.getElementById("login");
      if (loginForm) {
        loginForm["user"].focus();
      }
    }
  </script>
</head>
<body onload="setFocus();">
  <form id="login" method="post" action="">
    <table>
      <tr>
        <td><div align="left">User Name:</div></td>
        <td><div align="left"><input name="user" type="text"
            size="30" maxlength="30" tabindex="1" /></div></td>
      </tr>
      <tr>
        <td><div align="left">Password:</div></td>
        <td><div align="left"><input name="password" type="password"
            size="30" maxlength="50" tabindex="2" /></div></td>
      </tr>
  </form>
</body>
</html>

You can prove to yourself it works here.

Of course, there are lots of slight variants on this. You could give the field an ID and set the focus directly on it without getting the form first.

6/26/2008: 10:38 pm: RobertSpeech

The Austin Capital Metro CIO deserves a lot of credit for owning up on the Austin CapMetro blog to some major issues with their IVR applications for bus schedules, etc. It sounds like they have some grammar definition, timeout setting and confidence level setting issues with their app, though it is harder to know for sure without taking a look at it. I would love to help, but it depends on how they have written the app.

I do have to disagree with one of his other IVR-related posts where he states that:

But when a rider calls in to find out how to get from Downtown to Highland mall in the shortest time possible, an IVR will not do a good job of handling this question (a lot of human judgment and discretion is required which an IVR just can’t muster).

You would be surprised how well a speech app can handle that kind of problem. Of course, it won’t be cheap, as you have to think through the common starting and destination points callers might use, know when to ask for more detail (downtown isn’t sufficient info for providing directions unless you are in Mayberry RFD), algorithms for computing shortest time based on the schedules, etc., but it can definitely be done. Now, there are certainly many customer service kinds of apps that are very difficult to handle with a speech app, but directions is not one of them.

In deciding whether it is worth building an app for this function, you have to look at the total number of minutes of calls like this being handled by live agents. If the number is low (and “low” varies with the complexity of the problem, and thus the solution cost, of course), then it may better to leave the calls to a small number of trained agents who can handle many other types of calls. But, once you want to offer this service beyond regular working hours or if you expect the call traffic for this type of call to be very spiky, it may be worth building an app to take the calls.

6/25/2008: 8:17 pm: RobertSoccer

Just finished watching Germany play Turkey in one of the semifinal matches of the Euro 2008 tournament. I enjoyed a smooth, malty Jubelfestbier from Bamberg during the match in support of Germany, though I’ve been very impressed by the Turkish team, and am sorry to see them go. They made some amazing comebacks, but time ran out on them tonight.

There have been some incredibly exciting matches in this year’s tournament. From the complete domination of the Dutch over Italy and France, Turkey’s astonishing last minute heroics against the Czech Republic and Croatia, to the skillful attacking from both sides in Germany versus Portugal, it’s been a great tournament for a neutral spectator.

In today’s match, Germany’s Philip Lahm was burned time after time on defense, especially on the Turk’s second goal. On the other hand, the referee should have awarded the Germans a penalty kick when a Turkish defender clattered into Lahm just inside the penalty box. Instead, he didn’t even call a foul. But at the end, Lahm became the hero by scoring a brilliant goal in the last minute of regular time.

I would normally pick Spain to easily defeat Russia in the other semifinal (after all, they already beat them 4-1 in group play), but the Russians have pulled themselves together and are playing great soccer. This is by far the best Russian team I’ve ever seen, but I still think the Spaniards are the best team and have the best chance to win it all.

6/8/2008: 11:33 pm: RobertTahoe Cabin

I finally got around to posting some photos from the epic cabin fire. Since I’m not keen on image crawlers indexing my photos, you’ll need to copy this into the location box on your browser after that http:// thingie.

www.wombatnation.com/gallery/cabin_fire/

Here’s a couple samples. The first is the fire raging full on in the attic. The silver bars are the reflective parts of one of the fire trucks parked out front. Thanks to the fireman, parts of the house were actually saved.

Flames Leaping out of Attic

This is what happens if you watch too many reality shows.

Molten TV

6/4/2008: 11:33 pm: RobertThe Unusual and the Weird

Sometimes there are obvious connections between the books I read consecutively, but I never expected a fistula-based connection. A month or so ago I finished reading the bicep builder Quicksilver (Volume One of the Baroque Cycle) by Neal Stephenson. I don’t often read 900+ page books, but this one was worth it. Not sure I will make it through the similarly long volumes two and three, though. Life is only so long.

Quicksilver is a historical novel set in Europe covering a few decades around the year 1700. The Sun King, Louis XIV, plays a small, but very influential, role. Louis also has an anal fistula removed using state of the art medical practices for that time. That is, a doctor performing the operation the first time using a pair of scissors. Although based on historical events, Quicksilver is, of course, fiction. The retelling of the surgery is fiction, but the actual operation really did happen.

Next up, I decided to read Stiff: The Curious Lives of Human Cadavers by fellow Oakland resident Mary Roach. So far, I’m finding Stiff to be even more enjoyable than Spook: Science Tackles the Afterlife.

Well, stuff my mouth with biscuits if not more than 28 pages into Stiff I’m reading about Louis’ anal fistula operation again.

By the way, I recommend all three books. While Amazon reviewers agree with me on Stiff, Quicksilver and Spook get only 3.5 stars. Poor Neal is condemned like William Gibson to get bad reviews for not writing every book to be exactly like earlier cyberpunk novels. Spook gets dinged for making fun of the people she interviews and writes about. Excuse me, but those people are looney. I’m amazed she gave them the benefit of the doubt for more than ten minutes. I think she did a great job with the topic.

5/24/2008: 10:51 pm: RobertTahoe Cabin

There was flame and smoke at our cabin in the Tahoe National Forest early this morning, and it wasn’t from the Incinolet burning off the remains of a burrito. An electrical fire in the wall upstairs resulted in about 2/3 of the cabin suffering major damage. The new part of the cabin didn’t burn, but I suspect the smoke damage is probably pretty bad.

The most important thing, though, is no one was injured. My step-niece and her husband unfortunately had to be the ones up there when it happened. Nothing like arriving late at night while it’s snowing, turning on the lights, smelling that distinct ozone odor, then watching in horror as smoke and flames start coming out of the walls.

5/18/2008: 12:06 am: RobertFood and Drink, Reviews

I have fond memories of Shiner Bock from when I lived in Austin, and I always have a bottle or two when I go back to visit my brother. I agree with Stan at Appellation Beer that while Shiner doesn’t make the greatest of beers, they are better than a lot of people give them credit for. I didn’t see the Helles anywhere when I was in Austin a few weeks ago. I’ll have to look for it next time.

The Bohemian Black Lager, which I had had before, was available at Artz Rib House. I developed an appreciation for Schwarzbiers during a couple of trips to Germany. The Bohemian Black has a very nice malty flavor, but lacks somewhat the intense roasted coffee flavor of the Schwarzbiers I tried in Germany.

This Shiner ad that Stan linked to is also pretty great.

I also went to the Independence Brewing brewery when I was in Austin. The 1st Saturday of each month they give out free beer samples at the brewery. $5 gets you a logo pint glass, which then gets you free refills. They make very nice amber and brown ales, as well as a pale ale that sounds like it would be very similar to Sierra Nevada. I tried the Southside Special Ale and really wanted to like it, but just couldn’t get excited about it. Perhaps it was the “hint of cardamom” that was throwing me.

The tour was excellent and very educational, as you get to walk up close to all the brewery equipment and owner Rob will answer just about any question about how they brew their beer. Go to El Meson for lunch and then show up at Independence at about 1:15. The initial crush of people will have already gotten in and started on their first beer.

5/15/2008: 11:20 pm: RobertTravel

Roof of Peabody Hotel Orlando

While in Orlando visiting a prospective client this week, I stayed at the Peabody Hotel. This chain of three hotels is famous for having ducks march down a red carpet and hop into a fountain in the morning. In the late afternoon, they hop out and head back up the red carpet to a more private location in the hotel.

In case it’s not obvious, the photo to the left is the roof of part of the hotel.

Ducks on their fountain

I had seen video footage of the ducks doing a leisurely waddle down the red carpet at the original Peabody in Memphis, but the Orlando ducks were doing something closer to running. And I swear I was not making any comments about making my famous smoked duck and andouille sausage gumbo. At least, not in a language they would have understood.

5/11/2008: 9:37 pm: RobertJava

I went to JavaOne last week and was once again amazed by the number of attendees. I heard someone say 15,000 people had registered. I believe it. Other programming languages like Python and Ruby might be gaining in popularity on Java, but Java is still pretty dominant.

And just like last year, the queues for getting into the sessions were chaos. The people trying to organize the queues were trying hard (well, a few were), but the space where people lined up for the biggest sessions was the least conducive to organization. Someone at Sun needs to go to a major theme park and take lots of notes. Theme parks figured this out long ago.

And then the last thing you want to hear about happening when you were recently in a crowded space with 15,000 of your best friends did happen. On Friday I got an email from Sun that about 70 of those best buddies (actually, almost all of the 70 were workers not included in the registrant head count) caught a highly contagious norovirus.

I shared my pass with some co-workers, so I was there only on Tuesday. Fortunately, none of us got sick. The best sessions I attended were:

  • More Effective Java
  • Defective Java™ Code: Turning WTF Code into a Learning Experience
  • Let’s Resync: What’s New for Concurrency on the Java™ Platform, Standard Edition
  • Real World, Not Hello World: GWT Development for Java™ Technology Shops

I was really impressed by the quality of the web apps that had been built with GWT. I co-developed an app at work using GWT, but the part of the UI I developed was not nearly as cool as what these two companies built. It made me want to do some more work with GWT.

While I was impressed with JavaFX Script, the presentation Tuesday morning went at much too slow of a pace. Although 50 minutes had elapsed, I felt like only about 15 minutes of material had been covered.

The EBay presentation was also sort of interesting, but it felt too much like “here’s a little bit of info about a lot of cool technologies we have developed, but it won’t be much use to you since there are a lot of interdependencies and it’s closed source.” In the Q&A session they said they were considering open sourcing some of it, but I would understand if they didn’t. It would probably take a very large amount of work to unwind all the internal dependencies on their other infrastructure.