ClickAider
You are currently browsing the General category.
RSS feed

Seattle Travel Times Web Service

With the closure of a number of I90 bridge lanes, I spent a lot of time waiting in and thinking about traffic.

The WSDOT has a Seattle Travel Times page that lists commute times between various cities in the Seattle area given the current traffic conditions. Unfortunately there wasn't any web service version of the data.

For the benefit of those wishing to build apps that use this data, I whipped up a REST web service that scrapes the data using Hpricot and formats it as JSON.

http://thebogles.com/berry/traffic/seattle/traveltimes.json gives all of the available travel times, formatted as JSON.

You can also specify optional "from" and "to" parameters to restrict the cities returned. An example: http://thebogles.com/berry/traffic/seattle/traveltimes.json?from=bellevue&to=seattle.

Implementation note: to make the JSON look pretty, I wanted an ordered hash. I'm still on Ruby 1.8, so I used the Ruby Facets class. The Dictionary class doesn't come with a to_json method, but it's easy to add one:

RUBY:
  1. require 'facets/dictionary'
  2.  
  3. class Dictionary
  4.   def to_json(ignored=nil,ignored2=nil)
  5.     "{ " + self.map { |k,v| "#{k}: #{v.to_json}"}.join(', ') + "}"
  6.   end
  7. end

Using the Picnik API from Rails

The Picnik API makes it easy to add online image editing to any site that hosts images.

For the benefit of those coding in Rails, here's a summary of how I integrated Picnik with iLike to allow our users to touch up photos after upload.

I used the "pull version" of the API, which for our purposes was simplest and provided the most control. In a nutshell, you just need to link the user to the Piknik site with URL of the image to edit and some configuration parameters. When the user is done, Picnik links the user back to your site and passes the URL of the edited image back on the query string. Very simple!

(1) First, I constructed a helper to link the user to Picnik with the appropriate parameters.

In the code below, "image_url" is the URL of the image to edit on our site. "export_url" is the URL that Picnik links back to when the user is done editing. "export_parameter" is the parameter to use for passing back the edited URL. (Note the gotcha about encoding spaces as '%20' and not '+')

RUBY:
  1. module ApplicationHelper
  2.   def picnik_edit_url(image_url, export_param, export_url)
  3.     host_name = 'YOURSITE'
  4.     params = {
  5.       :import => image_url,
  6.       :export => export_url,
  7.       :export_field => export_param,
  8.       :apikey => 'YOURAPIKEY',
  9.       :close_target => export_url,
  10.       :export_agent => 'browser',
  11.       :out_format => 'png',
  12.       :export_title => "Save and return to #{host_name}",
  13.       :exclude => 'in,create',
  14.       :host_name => host_name
  15.     }
  16.     "http://www.picnik.com/service/?#{escape_picnik_params(params)}"
  17.   end
  18.   def escape_picnik_params(params)
  19.     params.map { |k,v| 
  20.       "_#{strict_escape(k)}=#{strict_escape(v)}"
  21.     }.join("&")
  22.   end
  23.   def strict_escape(s)
  24.     # escape spaces as %20; picnik won't accept +
  25.     CGI.escape(s.to_s).gsub("+", "%20")
  26.   end
  27. end

2. Next I added links to edit images to our RHTML templates.

RUBY:
  1. <%= link_to "Edit image",
  2.     picnik_edit_url(logo_url, 'logo_file', url_for(:only_path => false)) %>

3. Finally I customized our controller action to handle an edited image parameter:

RUBY:
  1. require 'open-uri'
  2.   def settings_bannerphoto
  3.     if !params[:banner_file].blank?
  4.         image_file = open(params[:banner_file])
  5.         # do what you want with the image file (e.g. save it)
  6.     end
  7.   end

Quite simple, and we just repeat steps 2 and 3 to make additional images on our site editable.

Google Voice on the iPhone

I wrote an earlier post on how to replace you're cellphone's voice mail with Google Voice. That was for generic GSM phones; happily those instructions work without change on the iPhone.

I use Google Voice for my voice mail because it forwards text transcript of messages to my email, and because I can listen to the messages from any computer.

What if you don't have Google Voice? According to the New York Times, Google is sending out new Google Voice invites to some of the users who requested them .

iPhone freak mentions the imminent arrival of GV Mobile, an iPhone app that

“will allow you to dial via Google Voice (like the old GrandDialer), retrieve your call log (received, missed, made), retrieve your voicemail (an issue with the old GrandCentral), access to iPhone address book, and update account settings (phones to dial when someone calls and other misc. settings).”

It was submitted for approval a month ago so hopefully we'll see it soon.


Why I ditched my Blackberry Curve for an iPhone 3GS

I have been a long time Blackberry fan, and even wrote Beyond411, a popular local search application for the Blackberry. But with the release of the iPhone 3GS, I finally reach my personal tipping point and bought an iPhone.

My story is a common one; AppleInseder reports that 12% of early iPhone 3GS buyers are Blackberry owners

Here are some the factors that pushed me to get an iPhone.

- The overwhelming momentum of Apple's app store: Apple's position in mobile apps is similar to what Microsoft enjoyed with Windows; I don't believe RIM or any one else can catch up even if they match or exceed Apple's features. There are a number of iPhone apps that I (and my kids) find fun and compelling.

- Poor developer support from RIM: My primary interaction with Blackberry developer support was when they forced me to change the name of Berry411 to Beyond411, part of their trademark enforcement of anything related to Black or Berry. Other than their friendly trademark police, I was disappointed at how little RIM had to offer to third party developers. They wanted a $2000 fee just to join their developer program, offered limited promotional opportunities, and seemed to subservient to the wishes of their carrier partners.

- OS Bugs and uncompetitive feature set: The Storm is no iPhone in terms of features or usability. Plus the OS has hanging bugs that don't reproduce in the simulator; this makes my life as a developer miserable.

- Declining build quality: I can't tell you how many Blackberry's I've gone through. Gone are the tanks of old: as RIM has chased the consumer market, their phones have gotten cheaper and more fragile. The Curve I just replaced rebooted randomly; the two previous curves had broken USB connections, as did the 8800 before that. The Pearl style trackball is much more prone to gumming up than the jog wheel it replace. Recent keyboards are smaller and harder to type on than the older ones, again because of RIM's wish to appeal to a broad audience.

In short, RIM is watering down the features that made it special, failing to keep up with the unique features of Apple and Palm, and losing the battle for the hearts and minds of developers.

I won't pretend that there aren't features I miss in the Blackberry. A virtual keyboard is no replacement a real one. Reading mail is definitely slower on the iPhone than the Blackberry-- I have to wait several seconds the mail app to pull down new messages every time I launch it. For now I'm willing to live with these limitations in exchange for the other advantages. Blackberry could win me back, but it's not easy to divide your loyalties between two phones.

Some Blackberry converts to the iPhone have asked me if I plan to create an iPhone version of Beyond411. Now that I've got one myself, that's looking a lot more likely.

How to replace your cellphone’s voice mail with Google Voice

Google Voice offers a really compelling set of voicemail features, much better than what US cellphone carriers offer.

You can view, search, and listen to your voicemails from any phone or web browser, with textual transcripts generated using automatic speech recognition.

Assuming you're lucky enough to be on in the Google Voice beta, and have a GSM phone, here's how you can replace your regular voicemail service with Google voicemai. (The Call forwarding entry in Wikipedia has a helpful list of GSM call forwarding codes.)

1. First, call *#67# and write down the resulting number, which is your current voicemail call forwarding number. This will let you go back to your old service later if you want to.

2. Next call the following numbers, where [phone number] is your Google voice phone number. (I'm assuming that you have your Google Voice account set up to go directly to voice mail.)

*67*[phone number]# (forward if busy)
*61*[phone number]# (forward if not answered)
*62*[phone number]# (forward if out of reach)

3. That's it, your carrier will automatically forward calls to Google Voice when you can't be reached. To undo the forwarding, just redo these steps, replacing phone number with your original voicemail number.

Avoid superproxy.co.uk

For my work, I've been looking for a good proxy in the UK so that I can test our geoip lookup.

superproxy.co.uk is definitely to be avoided for most applications.

First, it's not a proper HTTP proxy; instead it's a CGI script that you access via a web page.

Second, it doesn't support https pages. That means that you can't access most sites that require a login via https. (If it were a true proxy, you could at least login without the proxy and then enable it, but the web page proxy doesn't have access to your browser cookies for the site.)

Finally, superproxy.co.uk refused my request for a refund.

The Proxy does not claim to be SSL and as such is as claimed on the site.
I am very sorry that you did nto take the time to read the website before signing up.

The site simply doesn't describe the limitations of their offering.

I'm continuing to dispute the charge via PayPal but am not optimistic about my chances.

Beyond411 back up after down downtime.

The Beyond411 server went down and one of the mysql tables used by Beyond411 is in need of repair; I'll post when Beyond411 is back up.

Update: Mostly back up, autocompletions are still not fully repaired but most will be served out of cache so you might no notice.

Modernizing online newspapers

The Seattle PI is now America's largest online-only daily "paper". Going online only provides an opportunity that most newspapers don't have-- the ability to use a modern, link-rich writing style. But most of the articles at the PI are still written in a dead-tree, link-free style, unfriendly to both readers and crawlers.

For example, an article Eastside light rail has only two links. A properly linked paragraph might look more like:

Owners of businesses and homes along some proposed routes told Sound Transit's board Thursday that the line should go elsewhere; Bellevue business owners and city officials agreed on the need for a tunnel through their downtown, but not on the type or location of the tunnel...

"Done right, East Link will be a great addition to the region," Bellevue Mayor Grant Degginger told the board Thursday.

Linking to related content on the PI and elsewhere would be a great chance to promote their own articles and become the link-authority for content related to the Seattle area. Using a few well-chosen rel tags, they could start to become a semantic web for local information.

Updated Beyond411 for the Storm fixes GPS issues (v4.31)

A new version of Beyond411 for the Storm is now available at http://thebogles.com/storm/berry411.jad

Version 4.31 should [*] enable Blackberry Storm users to use GPS. It also fixes a bug on the plugins settings screen in which buttons were not clickable.

[*] I don't have an actual storm, so I have only been able to test on a simulator.

Update: Unfortunately, there have been numerous issues running on the real Storm which I can't reproduce on the simulator. I'm going to have to put Storm development on hold unless the simulator becomes more accurate or unless RIM or somebody is kind enough to loan me a Storm to verify on.



Technical Details :

I stumbled on this thread on the Blackberry support forums which includes the particular magical LocationProvider criteria needed to make GPS work on the Storm:

     Criteria criteria = new Criteria();
     criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_MEDIUM);
     criteria.setPreferredResponseTime(16);
     criteria.setHorizontalAccuracy(100);
     criteria.setCostAllowed(false);

Test build of Beyond411 for the Blackberry Storm is now available

Hot off the presses, I'm pleased to announce the first release of a version of Beyond411 for the Blackberry Storm.

I don't have a Storm, so I've been able to run this under a simulator; it's possible that it won't work at all on actual Storm or that there will be usability issues.

Update 11:34pm: Sure enough, there was a deployment issue that caused an error on download. I've now corrected this.

If you're adventurous and want to give it a try, point your phone at http://thebogles.com/storm/berry411.jad

Please send me a note letting me know of any issues you encounter or suggestions for improvement.

Screenshot of Beyond411 on the Blackberry Storm