Archive for the 'Productivity' Category

Track Trimet on your iPhone

Recently I started riding the bus again full time…if not to save the environment, but to save my nerves from dealing with traffic. After a few days I was reminded about one of the things that bothered me about riding the bus: I hated not knowing exactly when the next bus was going to arrive.

This time around I have my iPhone, so I am able to use the tracker on Trimet.org to see when the next bus came. Except it was really difficult to use on such a small screen. I was able to find out when the next bus came, it took me 2-3 minutes to do it.

So I decided I was going to write an iPhone app to do the same thing, but with a much simpler and easier to use interface. At first I was just going to scrape the Trimet site to get the information. But then I came to find out that Trimet actually has a really nice API to all their tracking information!

So I present to to you the Trimet Tracker, an iPhone app that allows you to easily find out when the next bus is going to arrive at your stop. Just enter your Stop ID and you’ll get a list of all the arriving buses (or MAX or Street Car), what time they will be showing up, and how long you have to wait. If you don’t know your Stop ID, you can also do a quick search by picking a route and selecting from all the stops on that route.

To make it even easier, you can also save any stop to your favorites list so you don’t have to enter a Stop ID or search for your stop again. Just hit ‘Favorites’ and select which stop you saved.

Obviously this tool isn’t for the masses…how many people are riding Trimet with an iPhone? Even if no one uses it, this tool has already saved me the a couple times from missing a bus. That’s worth the whole 4 hours it took me to develop it.

For the technically inclined, Trimet Tracker was built using the Camping microframework, IUI for the interface, and a few lines of custom Javascript.

One final thought: I now firmly believe that Portland is the geekiest city on the west coast. Even our transit system has an API.

Whois on your iPhone

I finished a quick app for the iPhone that allows you to do a whois lookup on a domain to see if it’s available or not. I’m always out and about and think of a domain name, and want to know if it’s taken.

Why don’t you just use whois.net or something, you ask? Well first of all that site is packed full of bloat and junk that makes it a pain to look something up. Secondly, I have a sneaking suspicion that sites like whois.net harvest requests and register those domains if no one else does. And no, my app does not record lookups!

I built the app using a small PHP script and IUI. Check out the app at http://whois.onmyiphone.net

Trick your computer into finding web sites on other servers

Quite often I’ve dealt with moving sites from one hosting situation to another. One issue that comes up is checking to make sure the site works on the new server, but you can’t check it because the domain is still pointing to the old server. Most clients are not okay with just waiting until the DNS switches over to the new server before finding out if their site is broken or not, so what to do? It turns out you can trick your computer into thinking the site really does live on the new server, so you can check it and verify everything is working correctly. Here’s how.

Whether you are on Windows, Linux or OS X, you can tell your computer to look for web sites at alternate IP addresses regardless of what DNS servers tell it. There is a hosts file that you can modify to do just that.

On Linux and OS X, this file is /etc/hosts, while on Windows it is the C:\WINDOWS\system32\drivers\etc\hosts file. The format is the same on both platforms, so you can use this trick no matter what OS you use. Here is the default one from OS X:

  ##
  # Host Database
  #
  # localhost is used to configure the loopback interface
  # when the system is booting.  Do not change this entry.
  ##
  127.0.0.1       localhost
  255.255.255.255 broadcasthost
  ::1             localhost

The setup is pretty simple. Enter the IP that you want your computer to point to, with the domain name you want it to use. So if you are in the process of moving www.clientwebsite.com from Dreamhost to Bluehost, then you’d find out the IP of the new server at Bluehost and enter at the end of the file like so:

  123.123.123.123 www.clientwebsite.com

Now clear out the DNS cache on your computer to make sure you’re not viewing the site from your DNS cache. On windows, open up the command line and type ipconfig /flushdns. In OS X, open up Terminal and type lookupd -flushcache. I also recommend clearing your browser cache.

Open up your browser and go to the web site you just entered in the hosts file. It should now point to the new server. If not, make sure you remembered to flush your DNS cache.

Now you can save yourself some trouble with moving sites and make sure they work before you switch them over. Your clients will be happy, and more importantly you’ll have peace of mind that you won’t be getting calls from panicking clients that their site is broken.

Validate all your HTML from a Google Sitemap

I was put in charge of going through an entire site to validate every HTML page, and the first thing I thought of was “how do I automate this?”. I noticed they had a Google sitemap, which makes it easier for Google to find and index content on a web site. Immediately I realized I could write a script to parse the sitemap file and go out and validate each page at the W3C Validator. As usual, someone has already thought about it and made a pretty web interface for it. Check out the Google Sitemap HTML Validator Tool that will open your Google sitemap and validate each page it finds and report the errors back to you. I love the Internet!