Tellme Studio developer Ross Fubini wrote an application that 
provides CalTrain train times based on a starting point, 
destination, and travel day. We talked to Ross about his phone 
application and his development experience, and asked him to share
some tips'n'tricks. Check out extension, TRAIN (87246). Contact 
Ross at Extension FUBIN (38246).

Q: What does the "CalTrain" phone application do?

The application tells you what time CalTrain are arriving between 
different stations. So, you call in and say a starting station, a 
destination station, and the day of travel, and it tells you the 
times the train will be at the destination station.


Q: What inspired you to write this application?

[laugh] Well, basically I'm really lazy! And while you can carry 
around a paper copy [of the schedule] or have a copy on your Pilot 
or you can learn the schedule, I happen to 
always have my cell phone with me. So I don't have to print out 
anything and I never have to download a program to my Pilot or have 
[my Pilot] with me. I could memorize the schedule but I'm not always 
going to the same places or leaving from the same places. Sometimes 
I may go and meet friends for dinner or go to a meeting somewhere 
else and I want to know the train times there or from there.

The way the app works is it asks you what station you're leaving from 
and checks your response against a grammar of all possible stations. 
Then it asks what station you're going to and does the same thing. 
And then it asks what day you're going on because the schedules 
vary whether you're going on a week day, weekend, or holiday. Then 
it goes out to the CalTrain site and gets that information; it returns 
a page which I can then "screen scrape" for all the different times.

The reason this was really neat was that it was exactly like a Web 
page. What happens in VoiceXML is that you can specify questions the 
same way you would on a form. It says, "What's the station," and it 
gets the match and stores a variable using JavaScript, "now get the 
next station," it stores another JavaScript variable... Now you said a 
week day and I'm going to know the fact that it's a weekday. Now I 
have all the required parameters and I can put them into name-value 
pairs and send them off, using Perl, to the CalTrain site, just the 
same way as if I was using a browser. Then I can easily scrape the 
page I get back, using Perl (the HTML Parser module), to pull out 
all the important bits of data and just print it right out in VoiceXML. 
So it's very easy.

Q: Are you planning any enhancements to your application?

I'm working on enhancements now, for example, for the UI. It's amazing 
how there are some really subtle UI issues which you don't realize. But 
you have some certain ways of working with phones, some expectations. 
For example, everyone I've given [the application] to never says, 
"Monday, Tuesday, Wednesday," when the application asks, "What day 
are you leaving?" They all say "today." Everyone! So I have to go 
put in "today" because 99% of them respond that way.

And the other thing is that right now the application spits out all 
the train times. So I want to make it smarter because it's really 
frustrating for me now. I'll be standing at the CalTrain station 
and I'll give [the application] the station names. Then it plays 
back times, starting from the morning times and going all the way 
down the list - and I really only want the next train! Otherwise 
it's in there for like 10 minutes and it goes through 50 different 
trains So I'm going to improve that!

The pages I get back have a bunch of times listed out and I just put 
the times in an