Parsing Arbitrary XML Namespaces in Ruby with Hpricot

(This post inspired by a Ruby.MN conversation)

I’ve burned through at least 3 different XML parsing libraries in building Cullect. I started the built-in REXML (pro: built-in, con: heavy and slow) then moved to FeedTools (pro: easily parses the most common feed formats, con: no longer in active development). I have a lot of love for FeedTools, but in the end, it didn’t want to parse XML it didn’t already know about. Then, after a series of far less memorable libraries, I found _why‘s Hpricot (pro: written by _why, con: written by _why).

Hpricot is fast, lean, and doesn’t care about expected tags, namespaces, valid XML, it just makes it easy to get the data and attributes out of the XML.

Here’s an example of how I’m grabbing a feed item’s permalink using Hpricot

doc = Hpricot.XML(feed_contents)
items = (doc/:item)
items.each do |raw_item|
link = raw_item.%('pheedo:origLink') || raw_item.%('feedburner:origLink') || raw_item.%('link')
end

Notice how Hpricot doesn’t require anything special to grab pheedo namespace links or feedburner namespace links in comparison standard links. Just tell it what the tag is you’re looking for. Fast, easy, scalable.

Lazy Libertarianism

A couple of conversations about Libertarian Paternalism came up on the iTunes this week, centered around Thaler and Sunstein’s book, Nudge: Improving Decisions About Health, Wealth, and Happiness.

The most enjoyable being the EconTalk with Richard Thaler, where Thaler does an amazing job of challenging Roberts. Not there’s enough of that on EconTalk. 😉

I found the Glenn & Helen Show with Sunstein annoyingly preachy. The conversation felt like a bad episode of The View, more interested in arguing at the surface rather than finding common ground by going in-depth.

In both, the primary challenges against Libertarian Paternalism seemed to be:
Because governments offering services vs. private firms competing in the market is an either/or proposition, governments shouldn’t be offering services, let alone deciding things for it’s citizen.

In addition to not represent reality (keep reading), this perspective just encourages bad, inefficient government. Since government exists, shouldn’t we make it the most effective, efficient, institution for providing the services it provides thereby requiring fewer resources?1

I jotted down my frustration with this perspective over at Twitter:

“garrickvanburen doesn’t understand the perspective of preventing the govt as one of many vendors in any given market (healthcare, retirement, etc)”

Privately, I received an email asking me to consider if the reverse was also true (“private firms as one of many vendors in any given govt market”)

In fact, I agree with both statements. I’m not sure what makes govt so special that they get a monopoly in some sectors and not in others – same with any private firm. If a private firm brings a competitive service to govt-dominated market – awesome. I’m also not sure why govt can’t enter some markets and not others – ‘we’ rarely tell private firms (Wal-Mart, GE, come to mind immediately) which markets they can’t enter. Feels the same.

My instincts tell me that govt should focus on the infrastructures to support; commerce, trade, security, and encourage highly-speculative new ventures that build markets (space, internet, highways, biofuels, etc). From that perspective, it’s less about what ‘business’ is and more about what belongs in the infrastructure. I’m thinking of Minneapolis’ city-wide-wifi. It was decided that internet should be part of the city’s infrastructure, and they brought a fair offering to market. It’s not the only offering, nor should it be. It’s an option and more options are better than fewer. Nor are they requiring people to sign-up for their offering, that would be anti-competitive.

To the private firms in govt markets statement, the first example that comes to mind is mail. US Postal Service is one vendor that delivers messages, FedEx, UPS, DHL are private options. Each with their own costs and benefits. And this leaves out other ways to deliver messages – email, fax, telephone, bike courier. None of which are govt offerings.

1. Mental exercise: What if taxes were the most effective way to outsource?

Elsewhere:

“Rather, opposition to these increases grows from the correct perception that a legally protected monopolist such as the United States Postal Service can keep prices higher, and service inferior, to what these would be under competition.” – Don Boudreaux

UPDATE 11 June 2008:
This perspective is why I’m all for public mass transit, national passenger rail, ubiquitous high-speed internet service, and state-level (or federal) universal health care.

RE: How Do People Find The Time To Watch Television?

…for the first time, society forced on an enormous number of people the requirement to manage something they’ve never had to manage before…which was free time. And what did we do with that free time? Mostly we panicked and spent it watching TV.” – Clay Shirky

A nice reminder on what is actually active and social:

“People still spend a huge amount of time consuming passive media like television. If even a small fraction of that mental energy was diverted to more active pursuits, it could lead to the production of dozens of socially-beneficial efforts like Wikipedia. The problem isn’t finding people with time on their hands; we’ve got tens of millions of those. The challenge is finding socially-beneficial projects that they’ll enjoy participating in more than re-runs of Seinfeld.” – Timothy Lee

…And They Asked 4 Followers, And They Asked 4 Followers

Something I wrote on Twitter a couple weeks ago:

“…2 questions: a) What if there was an open source, more effective alternative to Google search? b) What if Twitter is that alternative?”

Today, Four Reasons Why Twitter is the Next Google writes:

“Not only has Twitter inadvertently taken crowdsourcing to search, it has actually taken it a step further into friendsourcing. In fact, it has created the first personalized and trusted search engine in the world.” – Mr. List

The interesting bit is that Twitter doesn’t even offer ‘search’. Search engines like Summize (how I tracked down my above tweet) et. al, are building search atop Twitters API.

Steve Gillmor was absolutely right to cut off Dan Farber. Pasting text ads (a la Google) onto Twitter is boring. That’s why we haven’t seen it. And won’t.

As more vendors like H&R Block, Joyent, and even Comcast start to invest themselves in Twitter, we get much much closer to a VRM world. A world where both customers and vendors are smart people speaking intelligently to each other.

Garrick’s SXSW 2008 Showcasing Artists Picks

Not only are these picks really late (SXSW was months ago) but unlike other years, none of the 700+ tracks grabbed me immediately. The overall tone felt like the ‘college rock’ of 20 years ago. Good, sometimes interesting, artistic even, but every song sounds um, the same.

As in previous years, these are track that are both new to me, struck me, and will keep me in the zone while working. This time around, inspired by J Wynia approach last year, I set up a smart playlist in iTunes that automatically removed tracks after 5 skips. The theory is that this would bias more long term listening enjoyment, rather than short term first impressions – a reverse Pepsi Challenge. I blame this approach and how iTunes counts ‘skips’1 as part of the reason this list took forever to compile.

  1. Obvious by Watershed
    I haven’t heard this mixture of poppy, light-hearted post-punk and “I’d rather be at the bar with you than on stage” since Too Much Joy’s “Gods Make Love” or Ben Folds’ “One Down”.
  2. Toes by Zac Brown Band
    Yes, it’s a blatant rip off of Jimmy Buffet’s “Five O’Clock Somewhere” with the working class country vibe turned to 11. The last couple lines make the song.
  3. Come On, Claire by Aberfeldy
    The kid in Fountains of Wayne’s Stacy’s Mom is now in college…
  4. Juliet by Army of Freshman
    …but he’s still hanging out at the mall.
  5. Set the Table by Screaming Cyn Cyn and The Pons
    Screaming atop a very catchy, if simplistic riff. Makes Madison a much cooler town. This will either annoy you or get you dancing. Continues to do both for me.
  6. Everybody Knows by The Gougers
    Catchy little Country tune in the vein of Joni Mitchell’s Big Yellow Taxi.
  7. The Mountain by Lucero
    I’m a Lucero junky.
  8. So Long to the Red River Valley by The Quebe Sisters Band
    Every now and again, I’m in the mood for the Western in Country & Western. This is such a great example of modernizing that sound. Reminds me of listening to The Lone Ranger and old radio dramas.
  9. Mean Son of a Gun by Kitty, Daisy and Lewis
    The theme song to a old time radio drama about Calamity Jane
  10. Everyone’s Got’em by White Ghost Shivers
    The jazz tune playing in a secret speakeasy right before the cops busted in.
  11. Cooler than Me by Ari Shine
    A much hipper version of Billy Joe’s ‘Uptown Girl’
  12. I Wanna Be Ignored by Ezra Furman & The Harpoons
    Bouncy, bouncy, bouncy.
  13. Electric Bird by Sia
    This song is a picnic blanket in sun-filled valley.
  14. How Lucky We Are by Meiko
    Such an optimistic song about the day after tomorrow and the person you’ve committed to join you there.
  15. Fascination by Correatown
    The break up side of ‘How Lucky We Are’
  16. See and Be Seen by The Hard Lessons
    This is Facebook and MySpace…put to a beat far less than annoying than either.
  17. All My Love for You by The Emeralds
    Another great track from a typical American 3-piece garage rock band. But from a garage in Yokohama, Japan.
  18. Fireflies by Search/Rescue
    This is the lead track from John Hughes’ next teen romantic comedy.
  19. Clandestine by Brooklyn
    Early Beatles with a French attitude.
  20. Shut Up by Shellshag
    This is closest I’ll get to hardcore punk these days, there’s no way I can take these guys seriously. I imagine this is what it was like to deal with me as an angst-ridden teen.
  21. Champagne Girls I have known by Johnny Foreigner
    Yelpy, like Tullycraft with undertones of Oasis
  22. Only Fooling Myself by Kate Voegele
    Inclusion of this song betrays that I still enjoy listening to Wilson Philips’ ‘Hold On’.
  23. You, Me, and the Bourgeoisie by The Submarines
    This reminds me a lot of Redd Kross, if it was fronted by Aimee Mann
  24. 1906 by Songs for Moms
    An all-woman, 3-piece, folk-punk. Had me at folk-punk.
  25. Balboa by Cruiserweight
    I’m a sucker for Stella Maxwell’s voice.
  26. Oh Man! by Sybris
    and for whomever’s voice this is.
  27. So Down by Jen Lane
    Jen’s a Canadian signer-songwriter. That’s a magic combination.
  28. Half My Kingdon by Alina Simone
    A Ukranian April March. Except she’s really Ukranian.
  29. Blinkandyou’llmissit! by Bo Pepper
    Highly dance-able smack-down dropped by some distorted female vocals.
  30. Smoking Gun by The Tennessee Boltsmokers
    A finger-picking discussion on the dangers of following fashion trends.
  31. 4th of July by Stephen Kellogg & The Sixers
    A stereotypical Country song about loss, patriotism, and vans. Includes the great line, “Ever think maybe if you’re not happy it’s because of you.”
  32. Blue Canoe by Blue Mountain
    I’ve never heard a song about going fishing in a canoe. You have? With a distorted guitar?
  33. Secretary’s Day by TAB the band
    A great example of the blues-based, guitar-driven rock I remember as a kid.
  34. Stand Up by Thurogood Wordsmith
    I’m very critical about hip hop rhymes. This one made the list with: “I came to clean house, kick ass, and take names / Like white Anglo-Saxons across the Great Plains.”
  35. Do It Again by You, Me, and Everyone We Know
    If Ben Folds was backed by Blink182
  36. Tu Boca Lo Quita by Alex Cuba
    A rocking mash-up of electric guitar, ska, steel drums, and an amazing voice.
  37. No Matter How Bad It Gets by The Barker Band
    A poppy little tune for eating buckets of shellfish.
  38. Hello Friend by Cheveu
    Guitars and distorted vocals. Over before reaching a climax. Like a cheap midway ride.
  39. Inmovil (Wrong ID) by Le Baron
    A solid early-90s rock track from a typical 4-piece American indie rock band. But from Mexico.
  40. International Flight by Le Concorde
    The theme song to a fantastic new sitcom about an American girl falling in love with a London record store owner.
  41. Nono by Ze Dos Frangos
    I keep expecting this to be that sappy, overexposed Moldy Peaches track. It’s not. It’s Portuguese. Just that makes it better.
  42. Exodus Honey by Honeycut
    A softer, mellower Strawberry Fields.
  43. Mina do condominio by Pierre Aderne
    For those days when your life is a walk on the beach.
  44. Negative Thinking by TheDeathSet
    Vocals of a cheap punk band and a crisp, jumpy, electronica beat.
  45. Namida Vacuum Sound by Ketchup Mania
    Love song by a very, very angry Manga character.
  46. Morningside Heights by The Strugglers
    Dirt roads, melancholy, and violins
  47. American Hearts by A. A. Bondy
    As honest and patriotic as any Dylan, but intelligible.
  48. Nickels and Dimes by Scissors for Lefty
    “Hey, hey, nickels and dimes are all we need to rock tonight.” Yeah!, that lines earns automatic inclusion.
  49. Let’s Get Crazy by Limbeck
    Finally, a song with clapping. Just not enough songs with clapping in them this year.
  50. Dirty Blonde by Greta Gaines
    One of those tracks that feels like college rock from the late ’80s.
  51. Julia, we don’t live in the 60s by The Indelicates
    Here’s another.
  52. EXTINCTION by The Muslims
    Here’s a punky third.

1. Play duration longer than 2 seconds but shorter than 20 seconds. Personally, I found it can take a solid minute to find a song distracting.

Fermenting Alpha: Bavarian Hefe Weizen

This weekend, I invited Christopher, the Master in Fermentation Sciences, over to walk me through brewing up a batch of Bavarian Hefe Weizen from Northern Brewer. While I’m sure the extract kit didn’t take full advantage of his expertise, we had an excellent time and I picked up a few tips1 and got a better understanding of the chemistry behind the instruction sheet.

Here’s some shots of the initial fermentation:

1. Question: How much of the kitchen I can expect the wort to cover if it boils over?
Answer: All of it.

Update July 18 2008.
I haven’t written about this batch. It wasn’t anywhere near what I expected in a Hefe Weizen. It was full with just a hint of the banana-y flavor I expected. I would have preferred the other way around. Unless you knew it was supposed to be a Hefe Weizen, you’d would have been able to identify it. Not good. Glad there’s only a few bottles left.

Thinking About iPhone Web Apps for the Enterprise

Apple’s initial iPhone application model (build a decent website) is brilliant. Websites are easily the fastest, most compatible, most maintainable, most popular, way to create software applications. Once Apple supported adding specific website’s to the icons on the iPhone’s home screen, you’ve got the equivalent of applications on the Palm Treo – with internet access required, sure.

Doesn’t (or shouldn’t) this model cover 97% of all software?

The alternative is learning Objective-C, the development language in OS X and the amazingly popular GNUStep. Um. While not exactly wide reaching, this should increase the demand for ObjC developers.

For the commitment to ObjC, what to you get?
Some deeper ties into the iPhone’s hardware capabilities and iTunes as only distribution method.

In a client meeting earlier this week the team mentioned how the project needed to be available on mobile devices for internal use.


This brought to mind the Symbol barcode scanner running Palm’s OS and the handheld devices package delivery people at UPS and FedEx use.

Could they be replaced with an iPhone?

Maybe.

“Most road warriors could use Web-based tools with little loss in productivity.” – Phil Windley

Scanning an object’s barcode and manipulating data about it by multi-touch is a very compelling vision – whether on sales floor or in the warehouse.

On the flip side, I have a hard time imaging signing for a package on an iPhone…or enterprises IT departments agreeing to push out updates to a iPhone-native app via iTunes.

Unexpired Potential – Domains I Own

Inspired by Rex’s unused domain list, here’s my list of yet-to-be-released projects:

  • BlockByBlog.com
  • CoffeeHacks.com
  • Dashcaster.com
  • ExpiredPotential.com
  • Limble.com
  • LunchForBrains.com
  • Nusability.com
  • Unlistened.com
  • PodcastCalling.com
  • RedBallThankYou.com
  • SLAReporter.com

Update June 3, 2008.
A few more I’ve picked up since we last talked:

  • DroidWarehouse.com
  • Kernest.com (Launched July 17, 2009)
  • MSGCTRL.com
  • NeuPost.com

Update October 21, 2008.
Just added:

  • BroadcastCulture.com

Update February 8, 2009.
Just added:

  • Crumbl.es
  • Crumbl.us

Update March 4, 2009.
Just added:

  • Unbrkn.com

Update June 13 2009
Recent Acquisition:

  • KidStoryReviews.com
  • PressOnRails.com

Update Sept 16 2009
Recent Acquisition:

  • Smirkless.com
  • Fontue.com
  • Woffly.com
  • AdOrNews.com

Update Sept 30 2009
Recent Acquisition:

  • WallTales.org

Looking at the list and remembering the projects behind them, I’m pleasantly surprised;

  • how much these ideas still interest me
  • how some of these ideas are far easier to execute today then when I purchased them,
  • how diverse these ideas are.

All good things.