Washington Business Journal on AirBanking

Main Street BankThe Washington Business Journal interviews Main Street Bank exec Jeff Dick about his AirBanking initiative. AirBanking mixes online banking, blogging and social media to attract young professionals. David Keener is the architect and social media expert assisting Main Street Bank with their strategies.

Jeff Casimir’s Educational Talk

I just finished editing and uploading Jeff Casimir’s top-rated education talk, “How to Teach Anything to Anybody, Even Your Dev Team.” The talk is now available online at rubynation.blip.tv. Check it out now!

New Photo Contest Goes Live

A new photo contest, entitled “A Single Drop of Water,” has just launched using the new Votridea Contest Platform that I helped create. The contest is sponsored by Statement Arts, a New York charity that promotes education in the arts for disadvantaged youths. Check out the contest now. [Editor: Link removed; the contest is over.] They’re offering real cash prizes!

A Single Drop of Water - A Photo Contest created for a charity

January 6, 2011: Submissions and community voting for this contest closed right before Christmas, and the judging is going on right now. Despite the fact that it cost money to enter the contest, there were 175 photo submissions.

During the contest, more than 2100 people logged into the platform using Facebook, allowing them to vote and comment on entries. Note that all entries could be freely viewed — logging in was only required if people want to participate by voting or commenting. More than 5600 votes were cast, augmented by almost 1000 comments. Truly a great social media event for Statement Arts.

Recipe: Parsing RSS and Atom Feeds

Sometimes it’s desirable to be able to ingest a remote RSS or Atom feed in order to make content available within a web application. Clearly, the easiest way to expand the content offerings of a web site is to incorporate content from other sources. Standards like RSS and Atom were designed precisely to support the syndication of content in this fashion.

The first thing that pops into the heads of developers when this kind of requirement comes up is the dawning realization that they may have to create some really ugly XML-parsing code. It just sounds like one of hose dreary, painful programming tasks that occasionally come down the pike.

The Problem

Ingest RSS or Atom feeds and parse the content so that it can be repurposed for the needs of a Rails web application.

The Solution

The HTTParty gem makes it almost trivial to parse both RSS and Atom feeds. Listing 1 shows the Ruby code for the Feed class.

Listing 1: The Feed Class

  class Feed
    include HTTParty
    format :xml

    def initialize(feed_url)
      @feed_url = feed_url
    end
  
    def feed_url
      @feed_url
    end
  
    def url
      uri = URI.parse(@feed_url)
      strip_feed_extension(uri.scheme + '://' + uri.host + uri.path)
    end

    def latest(params={})
      response = {}
      begin
        response = Feed.get(@feed_url)
      rescue REXML::ParseException => e
        RAILS_DEFAULT_LOGGER.warn("forum feed parse error: " + e.message)
        response["feed"] = ""
      end
    
      response["feed"]
    end
  
    private
  
      def strip_feed_extension(uri)
        str = uri.sub(/.atom/, '')
        str.sub(/.rss/, '')
      end
  end

Place the feed.rb class in the lib directory of your Rails application. Then run script/console to bring up a console.

> f = Feed.new('https://www.keenertech.com/articles.atom')
> feed = f.latest

That’s all there is to it. The feed has been parsed already. So, let’s view some summary information about the feed.

> feed['title']
KeenerTech.com
> feed['link']['href']
https://www.keenertech.com/articles.atom

Well, that’s great, but what about the entries?

> entries = feed['entry']
[ {}, {}, …]
> e = entries[0]
> e['title']
Leveraging Rails to Build Facebook Apps
> e['author']['name']
David Keener
> e['link']['href']
https://www.keenertech.com/articles/2010/09/29/leveraging-rails-to-build-facebook-apps
> e['summary']
My presentation on "Leveraging Rails to Build Facebook Apps," which I just gave at SunnyConf, is now available online. This presentation is a distillation of some of the practical tactics that my development team at MetroStar Systems has used to create highly successful…

Now, to quote SpiderMan, “with great power comes great responsibility.” HTTParty is just using REXML to do the parsing, which isn’t the speediest parser around but it’s more than good enough for most processing tasks.

Still, for performance reasons, you wouldn’t want to parse a remote XML feed every time a particular web page was requested. So, this is the type of task that demands some form of data caching, whether memcache or simply storing feed data in the database for later use.

DevIgnition 2010 Poster

Here’s the poster for DevIgnition. We’ll print a few of these posters for display at the conference, plus this design will be featured on the conference T-shirts. Well, actually, the DevIgnition logo will appear on the front, and the white-on-black rocket and text will appear on the back.

Stylized rocket ship design with DevIgnition logo.

Feb 11, 2011: I think the rocket design is excellent. It worked really well on the DevIgnition T-shirts, which only the speakers, organizers and a few attendees got this year.

NOVARUG 50th Meeting

The Northern Virginia Ruby Users Group (NOVARUG) is hosting its 50th meeting tonight. David Keener will be one of the speakers at the event, and his topic will be “Web Services Specification.”

Final DevIgnition Logo

Tickets for the DevIgnition Conference on December 3, 2010 are selling briskly, so get yours now. Meanwhile, here’s a look at the final version of the conference logo, compliments of Don Anderson. Note that color has been added for impact, and the rocket looks a little bit less like a lawn dart.

Final DevIgnition Logo.

I think this final logo is a big improvement on the original draft concept, affectionately known as the “Lawn Dart” version:

Original draft design, the "Lawn Dart" version.