August 4, 2008, 8:59 pm
The major problem my CaltrainJS application had with iPhone was that the page stretched too big and the iPhone browser zoomed so much it was impossible to read any text or operate the controls without continually zooming in and out. After checking some other pages optimized for the iPhone I noticed there was a meta tag I had not seen before. Doing some searches I finally found the Apple page that describes how to set the viewport so that iPhone displays the page in a more mobile friendly way. Now my application works in iPhone too.
August 1, 2008, 10:56 pm
I finally decided to sit down and fix some annoyances in my Caltrain schedule applications written in Python and Javascript. I added the ability to filter trains that don’t stop at either your departure or destination stations. For the Python version I also added the ability to install the package simply with easy_install caltrain. Even nicer, when you have setuptools installed (as you do when using easy_install), the installer will place a script named caltrain in your $PATH, which makes it a snap to launch the application. The magic part in setup.py for the script is simply:
setup_args["entry_points"] = {
"gui_scripts": [
"caltrain = caltrain:gui",
]
}
where the line "caltrain = caltrain:gui" means that the script will be named caltrain, and it will call the calltrain.gui function (caltrain is the module).
I also finally made a proper page describing the project. Much nicer than needing to find the last post on this blog about the topic.
I noticed Caltrain has a page listing mobile applications. I wonder what it would take to get them to include my little apps there. I quite prefer the UI in my applications to all the others (except for the PalmOS version). This is what the latest Javascript version looks like:

Online Caltrain Schedule Application for Windows Mobile in Javascript
March 14, 2008, 7:42 pm
Great news for Caltrain commuters since developers now have easier access to the Caltrain schedules in Google Transit Feed Specification (GTFS) format, which should result in better applications.
The feed itself is available here, and the developer license is short and sweet.
I hear we can thank Elliott Schwartz (maybe this guy?) for requesting the feed from Caltrain in the first place. I believe the people at the recent TransitCampBayArea are to thank for this service. Unfortunately I missed the event.
There is some Python code available to handle the feeds at Google Code.
March 5, 2008, 3:21 pm
I released a new version of CaltrainPy and CaltrainJS yesterday. Caltrain changed schedules on March 3, 2008 and these releases incorporate the new schedule information. Incidentally, I found two errors in the official Caltrain online timetables, and this release fixes those as well. The issues are:
- Train 146 (weekday southbound) from Menlo Park to Santa Clara has times 13:XX (should be 1:XX).
- Train 195 (weekday northbound) arrives in San Francisco at 10:01 (should be 11:01).
This change also fixes the AM/PM bugs in the previous releases. The algorithm to determine AM/PMness of entries is much clearer now (and correct!).
You can download the package from Cheeseshop. To install, you must do: python setup.py install. easy_install does not work. I have also updated http://caltrain.heikkitoivonen.net/.
If you want to stay notified of updates for this software, I recommend you subscribe to the CaltrainPy Freshmeat project page.
Update: I forgot to mention that I contacted Caltrain about the schedule errors. Train 195 is already fixed, and they also acknowledged the errors with train 146, so that will probably get fixed soon.
January 18, 2008, 12:44 am
After I had released CaltrainPy 0.2 I started thinking about making a web version. I now have CaltrainJS 0.2 running. Ironically it seems to work OK everywhere except where I most want it to work: Internet Explorer Mobile. The Javascript and CSS support in that browser leaves much to be desired.
There are some refinements I could do for other browsers, like putting the schedule in a scrollable box so that the header would stay in place, but I put that work on hold until I get it working in IE Mobile. (I did have the scrollable area working reasonably well in Firefox.)
Update: I resorted to using innerHTML to (re)write the complete table on each update, since modifying a table dynamically in IE Mobile does not seem to be possible. Marked it CaltrainJS 0.2.1.
Update 2: I just released 0.3 to update to the March 3, 2008 schedules, and fixed the AM/PM bugs.
January 16, 2008, 12:54 am
I dusted up my Caltrain schedule program by adding schedule parsing (so it can be used as a library), adding AM/PM indicators and train types, changing the license to the MIT License and adding a setup.py file. Download from Cheeseshop. easy_install does not seem to like it, but the old style python setup.py install works.
The source is in Subversion repository, http://svn.heikkitoivonen.net/caltrain/trunk.

May 23, 2007, 11:59 pm
I recently ditched my first generation Palm-based phone, and bought a Cingular 8525. It runs Windows Mobile, so I unfortunately had to give up the excellent Caltrain+ program, and find something else to show me Caltrain schedules. Unfortunately the offerings don’t seem very good. I found two Java programs, one of which I failed to install and the other has such a terrible UI I finally decided to roll my own.
Having worked with Python for a few years I really did not like the idea of writing a native C++ application, and besides, I am not sure if it is even possible to do that without shelling some bucks for Visual Studio. Luckily there is a Python port for Windows Mobile. I could not find a version of wxPython - of which I have some experience - for WM, so I settled on Tkinter. Over about three days (maybe 12 hours total or so) I finally got an application that is just about usable, and even runs on my device, albeit slowly. I give you CaltrainPy 0.1!
