A better rubygems lister

I’m in the process of teaching myself ruby – first by dealing with the language core and stdlib by just writing ruby (no frameworks) to replace my myriad of crappy shell scripts that I’m using for various things. I can do a lot more quickly in a ruby (or perl or even php) than I can in any of the shell languages. And it’s a great way to learn ruby.

One of the first things I’m doing is fixing a huge annoyance I have with rubygems – namely that the

gem list

command has no terse output. A standard gem list gives you something like:

*** LOCAL GEMS ***    actionmailer (1.2.5)    Service layer for easy email delivery and testing.    actionpack (1.12.5)    Web-flow and rendering framework putting the VC in MVC.    actionwebservice (1.1.6)    Web service support for Action Pack....

And I could give a flying rip what each does after I’ve read the descriptions the first time. So I’m taking advantage of a cool thing in rubygems – that it’s a modular library implemented as a rubygem itself – and reverse-engineering things a bit with it to give me something like:

$ ./gemver.rbactionmailer: 1.2.5actionpack: 1.12.5actionwebservice: 1.1.6...

Here’s what I ended up with:

require 'rubygems'    if ARGV[0] then  @searchgem = ARGV[0]else  @searchgem = ''end    # get full local list of gems@gemversions = {}searchresult = Gem::cache.search(@searchgem)    # walk through returned gemspecs and build a hash of found gems and version(s) in GEM::Version formatsearchresult.each{  |gemspec|  if @gemversions.key?(gemspec.name) then    @gemversions[gemspec.name].push(gemspec.version)  else    @gemversions[gemspec.name] = [gemspec.version]  end}    # walk through the hash and print out the results@gemlist = @gemversions.keys.sort@gemlist.each{|gemname|  if @gemversions[gemname].size <= 1 then    print "#{gemname}: ",@gemversions[gemname][0].to_s,"n"  else    # for gems with multiple versions, sort the versions in reverse order, GEM::Version implements a sort_by method    print "#{gemname}(multiple): "    versionsarray = @gemversions[gemname].sort_by { |arrayitem| arrayitem.version }.reverse    printlist = []    versionsarray.each{|eachversion| printlist.push(eachversion.to_s)}    print printlist.join(",")    print "n"  end}

Not completely bad for only my third day or so poking at ruby for replacing my system/service scripts (I’m actually using this in a comprehensive script to mail me periodic information about the configuration for each of my servers. This is actually an offshoot of a script to compare installed gems with a expected list of gems and versions – which I’ll post later)

One of the 50 billion reasons

That web development is so hard.

Understanding HTML, XHTML, and XML

(also, one of the reasons that I stay subscribed to the Surfin’ Safari blog)

[Updated] – Edited “Hyatt Safari” to be “Surfin Safari” – I completely missed that folks other than Dave Hyatt were posting to the blog – which is what I get for not having the author column turned on for some blogs in NetNewsWire. The article I linked to was written by Maciej Stachowiak. Sorry about that webkit crew

How to shoot yourself in the foot with your post

So, we are a burgeoning Ruby on Rails shop. But, I’m a system administrator first, and a pseudo-developer second (which means that I troubleshoot and debug like nobody’s business, but forget about me really writing great code. Although I do comment my code, which covers for a lot of that 🙂 ) So, while I think RoR is neat. I’d be the first to admit where I think it needs work. Serious work. (like starting with the Capistrano peeps that think it’s real cool to put chmod’s in the thing when they are useless on my server and give me fits when the devs actually think they should work)

But it’s damn sure making a lot of sites go right now.

So that’s when I was a bit surprised to read Joel Spolsky’s Language Wars

And, Joel, I know you have to, like, pimp your products and all. But when you write a whole missive on the “Language to Pick” and diss RoR because it’s not built for “Serious Business Stuff”…

Well, you might want to take that gigantic plank out of your eye first. See, I’m a Fogbugz customer. And I like it and all (though I don’t know that we’ll stay with it in the long haul). And your so-called fantastic “Wasabi” language? – well, I’m sure that’s cool and all.

But it produces PHP that blows up in my very admittedly non-very-supported configuration. Like, when it tries to include adodb multiple times and blows up in PHP5 with “Cannot redeclare class” errors. And don’t get me started about your single-tasking php maintenance script that has to beat the mail server and mysql so hard I had to move it away from anything remotely considered production. And the hacks I’ve done and found to make it do SSL right. So much for serious business stuff. Which is fine, it’s a product by and for developers. And system admivelopers make stuff work – especially when we drift from your carefully constructed script silos.

But really. Get a clue.

Oh – and see also what Hanson said.

(though I’m not sure that “Upgrade your Rails NOW NOW NOW” qualifies as a Enterprisy Thingy either)

The Stripper (with picture)

So, the fellas threw me a bachelor party the other evening, my “man shower” leading up to the wedding. It was a rather tame affair, some football watching and beans and hotdogs and hamburgers and things.

Well, there was the stripper.

You know, I’m really not the stripper type.

But it was my man shower. And that only happens once. A man has got to sow some leftover wild oats, you know?

The stripper was fast and easy and a little dangerous. Just what you’d want.

The only real issue came when I took the stripper home. I mean, really, I wanted pictures, and we needed some privacy. The fiance really didn’t understand at first.

stripper.jpg

But she eventually did. And was rather amused.