slashk on December 22nd, 2008

Just a quick update on some development activity here at MTBcalendar headquarters:

Dashboard Widget

I’ve upgrade the Mac Dashboard widget to version 0.43 and created a dedicated documentation page to it on this site and at GitHub. The newest version fixes some bandwidth / request issues and adds a little more polish.

Grab the newest version here.

Oh, it also has a new icon. Thanks Pixelmator.

Javascript Widget

I didn’t really announce this here, but I now have a basic javascript badge that will put regional races on your blog/website. I described the process for this on my NorCal MTB Racing blog but I also have put up a page here about it. I’ll update the page here with more details later this week.

I have a lot of ideas for badges, especially ones that show your personal race schedule. However, I am short on design experience so these might have to wait.


I’m slowly putting the final touches on the website to officially launch around January 1st, 2009 (yes, that means I have been in beta for about 1 year). However, this has let me get to a point where everything basically works and I can work more on user experience than just hoping the site stays up.

Top on my list of todos:

  1. clean up account page
  2. add more documentation to event entry page
  3. add tour of features/documentation to site (so people actually know how to use the features

Since I am off work for until next year, you’ll probably read here a lot more about this.

Tags: , , ,

slashk on December 14th, 2008

I’ve done a bit of tweaking on the MTB Calendar widget for Mac OS X Dashboard and uploaded it to release directory on my github repository. Go here to see all of the releases or just download the 0.41 version from this link:


The only really obvious change is that I’ve put it on a diet and it now takes up a fraction of the screen real estate:


You can see the entire instructions and changes in the README file.

As always, you can check out the source code at my GitHub repository (mtb-calendar-widget). For those of you down with git, the public clone URL is git:// and I am certainly cool with patches.

Tags: , , , , , ,

slashk on December 12th, 2008

Just a quick note about the downtime that we experienced this week …

We ran into a strange interaction between Ubuntu 07.04, RubyGems and Rails. I kicked off this chain-reaction train wreck by updating my code to use the new Rails 2.0 feature for gem dependency checking in environments.rb: do |config|
  # Gem Dependencies
  config.gem 'icalendar', :version => '>= 1.0.2' #any version >= to 2.0.1
  config.gem 'mislav-will_paginate', :lib => 'will_paginate', :version => '>=2.3.6'
  config.gem 'RedCloth', :version => '>= 4.1.1'
  config.gem 'timcharper-CalendarDateSelect', 
		:lib => 'calendar_date_select' , :version => '>=1.11.1'

This allows me to more easily verify that I have the correct gems and gem versions on my production box. And it works. At least it worked fine on my MacBook in development. So I went ahead and deployed it into production with my capistrano script.

And everything came crashing down.

Well, not really crashing down, but certainly to a complete halt. That is, Rails wouldn’t start because RubyGems was complaining about “too many arguments” in it’s load routines. A few minutes of debugging and comparison with my MacBook showed that I was several versions back on RubyGems in production (version 1.2 instead of 1.3.1). After much gnashing of teeth and RTFG’s I discovered the following nugget of wisdom (#293 gem dependencies broken in 2.1.0 – Ruby on Rails – rails):

“What I discovered running an upgrade from ubuntu 7.04 to 8.04 was that there was two versions of rubygems installed somehow. Rails ended up choosing and older version of Gem::DependencyList. This was causing the wrong number of arguments error for me.

To solve this, I removed the old version of rubygems from apt-get, reinstalled rubygems from source, and updated my path. Once I did this, the newer version of DependencyList was loaded, and I didn’t get any more errors.”

Of course, this was much easier said than down. In the end, it required uninstalling the the apt-get gems package, reinstalling gems from source and then eliminating the rogue gems library directory with prejudice. However, it certainly fixed the problem and forced me to look harder at maintaining the production environment.

For any of you following at home, the website is currently running revision 235 (“re-education through labor”) which boasts some slight performance improvements, a few bug fixes for the entry forms and some new functionality for widgets (both dashboard and blogs).

Tags: , , , ,

slashk on December 10th, 2008

UPDATE (12:52 PM): And we are back. Sorry for the interruption folks but we ran into a strange rubygems versus Ubuntu 7.10 issue. I’ll post something on it later. We will try not to do this again.

Woof. Decided to slip a small update to the code into production this morning (11:43 PT) and my mongrels have gone all higgly-piggly on me.


We should be back online in a little bit.

slashk on December 4th, 2008

For the better part of the last week (and much of my Thanksgiving vacation), I have struggled mightily with the beasts known as Javascript and Dashcode to bring you (well … mostly me) an easy way to always have your local MTB racing calendar at the touch of a button. And while the battle was long, I have bested the Apple-ian beast and bring you … MTB Calendar on your Mac OS X dashboard.


If you would like some of this action, download the widget:

Uncompress it and add it to your dashboard. If you click the (i) button in the lower right corner, you can choose which region’s races you would like to view. It updates about every 15 minutes and only shows upcoming races. If you need more info on any race, just click on it’s name.

Sadly, as you can probably already guessed by the description above, this is Mac only. However, I am looking at creating a clone of this in Yahoo! widgets when I get some free time. Also, I have a version of this almost ready for your website (blogger, myspace, etc.) but I need to add a few more options. Expect it later this month.

github_logo.pngI’ll be posting more about the coding aspects of my journey later this week (I’ve learned a lot of lessons about Apple’s Dashcode). In the meantime, you can check out the source code at my GitHub repository (mtb-calendar-widget). For those of you down with git, the public clone URL is git:// and I am certainly cool with patches.

Tags: , , , , ,

slashk on November 18th, 2008

While you weren’t looking, I slipped a new release of the website online (For those of you following at home, this is version 217 – “blue hawaii”). It was mostly born of a vacation (and attached air travel) to Oahu early this month.

It boasts some new YUI Library CSS Tools, which have somewhat cleaned up the mess that I called a website design. The most helpful part of the toolkit was the YUI Grids CSS which provided me with a fairly bombproof layout with a minimum of effort. Thank you Yahooligans.

There are also quite a few usability and bug fixes. Gone are the broken URLs in the “add to google calendar” button. No more strange google maps shenanigans. Even some of the geocoding has been improved (but is still problematic).

Overall, I think this has taken quite a few steps to become a beta product. Enjoy — and don’t forget to comment or send an email if you find something b0rk3d.

Tags: ,

slashk on October 29th, 2008

Just a quick note: We’re getting some irregularities on the geocoding results for new events on the site. This takes the form of events showing up as “N CAROLINA” instead of “NC” for example. I think that this is due to a change in one of the geocoders that I am using. Or it could be Google geocoder failing and another geocoder returning their default value, I haven’t been able to dig that far into it.

In a nutshell, I use the very nice GeoKit rails plugin to handle all the geocoding for Geocoding allows me to take any address (like “Los Gatos, CA”) and returns latitude and longitude coordinates, which I can then easily overlay on the map. In addition to these coordinates, it also returns a bunch of other information like proper state. This allows me to fairly easily create the state and regional search pages (in addition to some tags).

This is the pertinent code:

  def try_to_geocode
    res = MultiGeocoder.geocode(self.location)
    if res.success =
      self.lng = res.lng
      if res.state.nil?
        # if google screws us by geocoding without giving us the state or province,
        # try to it geocode again with the lat, lng (basically reverse geocode lookup)
        res = MultiGeocoder.geocode([,self.lng])
        if res.success
          self.state = res.state
        self.state = res.state
      self.state = abbr_state(self.state) if !self.state.nil? && self.state.length > 2
      self.region_id = identify_region_id(self.state,,self.lng) unless self.state.nil?

The line that I have had to add is line 16, which is basically a big, ugly case statement with “irregular” states.

Net/net on this: while I track down the issue (and write a fix), you’ll have to live with some poor searching. My apologies.

Tags: , , , ,

slashk on October 26th, 2008

Granny Gear Productions, purveyors of fine 24 hour MTB racing, has announced their pared back 2009 schedule:

06/13/09: 24 Hours of Big Bear (WV)
07/25/09: 24 Hours of 9 Mile (WI)
10/10/09: 24 Hours of Moab (UT)

Gone are the Missouri, Georgia and a few other events. But in their place comes the 24 Hours of 9 Mile.

Tags: , , , ,

slashk on October 13th, 2008

Last week, I quietly rolled out a new release (r188 or the “return of metallica“) to MTB Calendar, but alas it didn’t turn out exactly as planned. Although many of the new features are fine, it appears that we have a slight bug … err … regression in the iCal department. For those of you who have subscribed to a iCal feed, I changed the formatting to more closely follow the iCal standard (RFC 2445). This says (paraphrasing here) that you make all day events from 12AM on the date of start to 12AM on the date of end (exclusive).

So I made that change.

Unfortunately, Apple’s iCal does not share my interpretation — it converted the all day events to timed ones (which ran from 24 hours from 12AM to 12AM the next day). Since I hate this, I’ve rolled back this change.

It gets geeky here.

My problem was that I wasn’t passing the correct property parameter for the DTSTART or DTEND properties that iCal, Google Calendar and everyone seems to want. Google shows it best:

SUMMARY:Independence Day

Digging into the icalendar gem documentation, I found the correct way to do this (see the event.dtstart line):

  def to_ical_event
    # the alldayevent sets up the parameter
    alldayevent = {"VALUE" =>["DATE"]}
    event =
    event.klass       "PUBLIC"
    # add the alldayevent to end of dtstart,dtend
    event.dtstart     start_date.to_date, alldayevent
    event.dtend       end_date.tomorrow.to_date, alldayevent
    event.summary     name
    event.description description.gsub(/\s+$/, $/) unless description.nil?
    event.location    location.gsub(/\s+$/, $/) unless location.nil?
    event.dtstamp     created_at.to_datetime
    event.url         "{}"
    event.uid         "mtb-event-#{}"
    return event

Net/net: you should know be able to use the ical feeds in iCal, Google Calendar or anywhere else you please. Look for easy add buttons for Google Calendar and Outlook to come soon.

Tags: , , ,

slashk on October 5th, 2008

I’ve added a few more of the 2009 schedules to the calendar:

2009 USA Cycling Ultra Endurance

2009 AMBC

I’ll have the 2009 USA XC calendar up sometime later this weekend.

Tags: , , , ,