Ruby Weekly News 7th - 13th November 2005

Ruby Weekly News 7th - 13th November 2005



   Ruby Weekly News is a summary of the week's activity on the ruby-talk
   mailing list / comp.lang.ruby newsgroup, brought to you by
   Tim Sutherland, with contributions from Christophe Grandsire.

   [Contribute to the next newsletter.]

Articles and Announcements

     * Why the Lucky Stiff (again!) on Noboto

       As Raymond Brigleb intoned, the latest Noboto video-blog features
       Why the Lucky Stiff's soundtrack to Chapter 6 of the Poignant Guide -
       "The Belljar, the Space, and My Daughter's Organ Instructor".
       This follows the previous week's interview with Why.

     * RubyForge milestone

       Tom Copeland announced that RubyForge had reached 1000 hosted projects
       with the addition of Joseph Tremblay's Rolling Gemstone.

       "Here's to the next 1000 projects!"

     * Red: The Ruby Journal, a professional periodical for Ruby developers

       M. Samuel "Flywheel" Streicher announced a commercial journal for Ruby

       > The journal, tentatively titled "Red," will be published monthly and
       > will be distributed internationally as a stylish, high-quality, 60-
       > page PDF. Each month, Red will focus on boosting the skills and
       > productivity of all Ruby programmers-from novices to gurus-
       > providing pragmatic, practical, insightful, hands-on, and diverse
       > advice and expertise.
       > Contributors will be paid for material accepted and published in the
       > journal. Like other journals, all material will be vetted by peers
       > and experts prior to publication.

       Those interested in subscribing, writing articles, regular columns or
       advertising are invited to contact Samuel.

       Bill Guindon: "Ok, 10 points for the most ambitious 1st post I've ever
       seen on any mailing list".

       There was some discussion about the name of the journal. Pat Eyler
       popularly suggested 'Red Letter', "for no other reason that every time
       you get your copy, it will be a red letter day".

     * how the move from pdp-11 assembler to ruby took steve jenkins' breath

       This week SciRuby interviews Steve Jenkins, Principal Engineer at the
       Jet Propulsion Laboratory of the California Institute of Technology.

       "[SciRuby] What programming accomplishment are you most proud of?"

       > I wrote some code back in the early 1990s that ended up being used,
       > at least as a design concept, in the engineering effort to save the
       > Galileo mission to Jupiter after the spacecraft's high-gain antenna
       > failed to deploy. It wasn't particularly advanced programming, but
       > it was in the right place at the right time. Solving that problem is
       > part of the reason the Deep Space Network converted to a TCP/IP
       > network infrastructure when they did.

     * Ruby Forum

       Andreas Schwarz created web forums mirroring the ruby-talk and rails
       mailing lists.

       There are now (at least) four ways to read and post: through the
       ruby-talk list, the comp.lang.ruby newsgroup, the
       gmane.comp.lang.ruby.general interface or the Ruby forum.

       See also Andreas' earlier post [Mailing list <-> web forum gateway].

     * Permathreads

       James Britt created the page [RubyTalkPermaThreads] on the RubyGarden
       wiki to keep track of threads that keep popping up all the time.

       > I encourage folks with knowledge of particular areas to add
       > resources so that at least when certain (very) familiar topics rear
       > their heads every few months people can avoid rehashing the same
       > basic stuff.

User Group News

     * Refresh Phoenix (AKA Not-quite Phoenix.rb)

       James Britt announced the first "Refresh Phoenix" (Arizona) meeting,
       "a community of designers and developers working to refresh the
       creative, technical, and professional culture of Internet developers
       in the Phoenix metropolitan area" - held November 8th.

       The second meeting is on the 6th of December.

     * Ruby Group Meeting in Montreal

       David Vincelli announced a meeting on November 9th in Montreal, with a
       presentation on Rails, and perhaps more.

     * new_haven.rb Unit Testing Slideshow now online

       Gregory Brown posted his slides on unit testing from the new_haven.rb
       meeting (New Haven Ruby Brigade, in Connecticut, U.S.). The Takahashi
       method is here.

       He also said they're planning to start putting up audio recordings of
       their meetings, and maybe run IRC during them.

     * Typo chat, BBQ dinner (Sunnyvale, CA), 11/10, 7 pm

       Rich Morin forwarded a message announcing a meeting with Scott Laird,
       "a developer for Typo (blog software written in Ruby on Rails)" at a
       BBQ Dinner in the San Francisco Bay Area.

Image of the Week

  "Leaf", by Jeff Kubina

  What a pity you aren't looking at the web view of this newsletter.

(Send your suggestions in for next week's image.)


  Function Variable and Return Value References

   Eric Hofreiter was confused about the semantics of variable passing and
   return values in Ruby, wondering in which case those were done by
   reference or by value.

   > At first, I thought variables were always pointers, and things such as
   > a = b meant that if you change a, you change b. It seems now that this
   > is in fact never the case.

   Hal Fulton explained that Eric had a few misunderstandings concerning
   variables, which except in cases of "immediate" objects do hold references
   to objects, and with assignment, which only binds a variable to an object.

   > So any operation that actually changes the object will behave as you
   > expect.

    a = "Hello"
    a = b
    b << " there!"
    puts a # "Hello there!"
    puts b # "Hello there!"

   > However, any operation that binds a variable to a new/different object
   > won't show that effect.

    a = "Hello"
    a = b
    b += " there!"
    puts a # "Hello"
    puts b # "Hello there!"

   > You might think at first glance that x << y and x += y do the same thing
   > for strings. And indeed they result in the same value.
   > But x += y is just syntax sugar for x = x + y (i.e., they mean exactly
   > the same thing). So += is actually an assignment, and thus doesn't
   > change an object-it just binds a variable to a new or different object.

   Eric Mahurin added a line-by-line comparison between Hal's example and the
   equivalent in C++, to illustrate the semantics of assignment, and
   indicated that variables in Ruby are lightweight, which makes it easy to
   optimise them but difficult to get a reference to the variables

  Index and Query (#54)

   This week's Ruby Quiz (by Lyndon Samson) challenges you to build a simple
   indexer/query system for finding words in text documents.

   As usual, anyone can take part and post their solution after the 48-hour
   "no-spoiler" period, which is followed by discussions around the different

  Numeric <=>

   ChrisH asked why Numeric implements <=> so it returns 0 or nil, rather
   than the usual -1, 0 and 1, while it also includes Comparable. Eric Hodel
   replied that Numeric being an abstract class, its subclasses just need to
   override the spaceship operator appropriately, but the question remained
   why it should be implemented at all. As Robert Klemme said:

   > Including Comparable is not a reason IMHO because that will break either
   > way (i.e. with missing <=> and with incomplete implemented <=>).

   This was followed by a discussion about whether having the safety net of a
   partially implemented <=> was better than simply raising an "undefined
   method" error when performing a comparison (or a sort). The opinions on
   the subject were divided and no clear conclusion came out.


   "What's rubyholic?", asked Joe Van Dyk.

   JB Eriksson explained that it's someone who consumes large quantities of

   If you experience three or more of the following in the same 12-month
   period, then you may be a rubyholic:

     * You write larger amounts of Ruby code, or over a longer period than
     * Your Ruby coding interferes with family, friends, or job.
     * You develop tolerance, meaning that over time it takes [more concise
       code] to satisfy you than it used to.
     * You experience withdrawal, meaning that you have unpleasant symptoms
       if you stop coding Ruby.

   If you're ready to ask for help, then start by seeing if there is a
   [rubyholics group] in your area. There you can share your experiences with
   others who are going through the same challenges.

  Better way to build string

   Marcus asked for a better way to write the following code:

def build_query_string(properties, prop_type)
   result = ""

   properties.each do |item|
     if prop_type == "tag"
       result += " #{}=#{item.value}"
       if result == ""
         result = "?"
         result += "&"
       result += "#{}=#{item.value}"


   Peter Ertl gave a nice solution using map and join:

def build_query_string(properties, prop_type)
   query = {|p| "#{}=#{p.value}"}
   case prop_type
     when "tag": (" " + query.join(" "))
     else ("?" + query.join("&"))

   In general, it's clearer to use declarative methods like map and join
   rather than each-with-side-effects.

  RFC: Audio

   Hans Fugal noticed a lot of people asking audio questions about Ruby, and
   felt that this was an area where Ruby still needs a lot of work.

   To this end, he began working on wrapping "libsndfile, libsamplerate, and
   possibly portaudio. Combined with ladspar, midilib, and other ruby audio
   libs that exist, this should get us well on the way."

   He is likely to run the project under the SciRuby site. "About me: I'm a
   PhD student in Computer Science who finally gets to say that music and
   audio stuff is on-topic, as my research area is Computer Music."

   Hugh Sasse noted that Python has for some time included audio libraries in
   its standard library, and suggested these could be used for inspiration.

  ruby-dev summary 27542-27662

   Kazuo Saito summarised the latest discussions from the Japanese list

   Among the issues discussed was a request for people to test the 1.8.4
   preview1 build and unit tests on a variety of platforms.

New Releases


   Ara.T.Howard posted a program for running Ruby as a selectable user on
   unix systems, with e.g. setuidruby ahoward ./a.rb.

  RubyCocoa 0.4.2

   Kimura Wataru released RubyCocoa 0.4.2, the bindings to Mac OS X's Cocoa

   It now works with Mac OS X 10.4 and 10.3, and continues to work on 10.2.
   "Core Data" support was added.

  Ruby Web Bench 0.0.0 (RWB)

   Pat Eyler created a new web performance / load testing tool as an
   alternative to Apache's ab, featuring the ability to thrash a weighted
   list of URLs.

   Bob Hutchison: "This looks really quite handy-I think I've had the same
   issues as you have had with ab."

   0.0.1 and 0.0.2 were later released. The latter added warmup support.

  Stomp Client Release

   Brian McCallister released 1.0.0 of a client for "Stomp" (a text-oriented
   messaging protocol, "Message Oriented Middleware" if you will).

   Jim Freeze asked how it was different to DRb, and Brian explained "DRb is
   a synchronous RPC style system whereas stomp is asynchronous message
   passing (though you can ask for a reply)."

  Net::DICT 0.9.0

   Nikolai Weibull announced a client-side implementation of the Dictionary
   Server Protocol (RFC2229).

  Ruby/ZOOM 0.2.2

   Laurent Sansonetti's Ruby/ZOOM was updated, fixing a couple of bugs in

   > Ruby/ZOOM provides a Ruby binding to the Z39.50 Object-Orientation Model
   > (ZOOM), an abstract object-oriented programming interface to a subset of
   > the services specified by the Z39.50 standard, also known as the
   > international standard ISO 23950.

  CommandLine-0.7.9 Update

   Jim Freeze's CommandLine library now features a lower-case gem name, new
   documentation and a refined API.


   Ara.T.Howard added a gem, and a method for atomically creating and opening
   a file, to lockfile, "a ruby library for creating NFS safe lockfiles".

  TeSLa 0.2.0 is out

   Obscured by code announced the release of TeSLa version 0.2.0. Among many
   changes, TeSLa is now able to handle Test-Driven Development by failing
   gracefully when a tested method doesn't exist yet. A full release article
   can be found here.

   TeSLa is a DSL devoted to unit testing.

  eric3 3.8.0 released

   Detlev Offenbach released eric3 version 3.8.0. eric3 is a Python and Ruby
   IDE written in Python.

  KirbyBase 2.4

   Jamey Cribbs set out KirbyBase 2.4, a pure-Ruby database management system
   that uses plain-text files.

   Memos and Blobs are now writable, many-many associations can be defined,
   the manual was extensively revised, and more.

   Ezra Zygmuntowicz: "I really love kirbybase as a lightweight pure ruby db.
   Keep up the great work Jamie!"

  Net::SSH 1.0.3

   A Windows-specific maintenance release of Net::SSH fixes a problem with
   connections failing when the PuTTy pageant was not running.

   Jamis Buck's Net::SSH is "a pure-Ruby implementation of the SSH2 client
   protocol, allowing Ruby scripts to interact with remote processes via

  Ruport 0.2.0

   Gregory Brown introduced the second version of Ruport, "the release that
   was just supposed to be minor bug fixes but exploded into a whole lot
   more" (the API was completely redesigned).

   This release was followed three days later by minor update 0.2.2. This
   update is a bug fix and clean up of the codebase.

   Ruport is a pure-Ruby report generation framework.

  SMC - State Machine Compiler v. 4.3.0

   Charles Rapp announced the latest version of the State Machine Compiler
   (SMC) which takes a file describing a state machine and outputs code to
   implement it in a variety of languages, including Ruby.

  Rails 1.0 RC4 (0.14.3): It's the final countdown!

   David Heinemeier Hansson announced the (hopefully) final preview of Rails
   before version 1.0.


   > Comrades, we are so close to the goal that the relieve should be
   > tastable. The mythical 1.0 release is now penned to be the very next
   > release once we rattle out the heinous bugs from this one. So we need
   > every man, woman, and child at work testing the living daylights out of
   > this final release candidate. Upgrade your apps, start new ones, kick
   > the tires, rev the engine, do it all!

   Many additions were made, despite the last-preview status. They include
   the use of lighttpd in development mode if it is available (automatically
   run through script/server), script/plugin to help manage plugins, more
   ActiveRecord dynamic finder goodness, "extensions for association
   collections" (so you can do e.g. account.people.my_method), redirect_to
   :back, and more.

   Oh yeah, and upgrading is easier, so there are no excuses.

   Now how about getting ready for some Rails Release Parties?


  Function Variable and Return Value References


The two examples having "a = b" should be "b = a" instead.

Thanks to Derek Mahar for catching the error.


In article <>, Tim Sutherland wrote: