Ruby Weekly News 6th - 12th December 2004

http://www.rubygarden.org/ruby?RubyNews/2004-12-06

                   Ruby Weekly News 6th - 12th December 2004

···

-----------------------------------------

   A summary of the week's activity on the ruby-talk mailing list / the
   comp.lang.ruby newsgroup. This summary is brought to you by Tim Sutherland
   (TimSuth).

Articles and Announcements
--------------------------

     * [Duck Images Weekly News]

           [whytheluckystiff] parodied the Ruby Weekly News in response to a
           comment from Dave Burt that [last week's RubyNews] failed to
           include the [Duck Images thread]. Your editor gets the last
           laugh(?) though, the second post in that thread wasn't until the
           6th of December, meaning it falls inside this week's summary. See
           Threads for more duck news.

     * [RMagick pre-requisite changes]

           Tim Hunter gave a "heads up" that future versions of the image
           library [RMagick] (a Ruby interface to ImageMagick and
           GraphicsMagick) will no longer be tested with versions of
           ImageMagick earlier than 6.0.0 and may cease to work with them.

     * [ruby-dev summary]

           SASADA Koichi posted the latest English summary of the Japanese
           list ruby-dev, covering messages 24959-25044.

     * [RSS, Ruby, and the Web]

           Tom Copeland reported that this month's Dr. Dobb's Journal has an
           article by Dave Thomas on [RSS, Ruby, and the Web].
           (Pay-subscription required to view the article on the web.)

     * [Dynamic Java: Sun explores dynamic languages]

           James Britt noticed that Sun is [exploring] how to better support
           dynamic languages on the Java platform. There was a meeting which
           included creators/maintainers from Perl, Python, Jython, Groovy
           and Parrot. No Ruby representative, but Ruby will benefit from any
           improvements in this area.

     * [Want to Write a Book?]

           Dave Thomas wants to launch a series of books from the Pragmatic
           Bookshelf called "Facets of Ruby". These will be small, focused,
           technical books on different aspects of Ruby. He's looking for
           writers for them - this is your opportunity to become an author!
           "The intent is to create a series of books with a deeply practical
           focus. We won't just document APIs. Instead, we want to show how
           to get _value_ from those APIs---how to solve real-world problems.
           The books will probably be 100-250 pages long, and full of code."

     * [A neat article on Rails performance...]

           Tom Copeland drew the group's attention to an article [Session
           Container Performance in Ruby on Rails] by "Scott Barron of
           EliteJournal fame".

     * [Development Assistance]

           Austin Ziegler asked for volunteers to help enhance some of the
           libraries he maintains: MIME::Types, Diff::LCS and PDF::Writer.

Threads
-------

   Interesting threads this week included:

  [Duck images]
  -------------

   Dave Burt wrote:

  "Phil Tomson recently suggested developing a duck image to represent ruby
  instead of the standard red stone thing.
   
  Nikolai Weibull said this has been proposed before, but copyright
  encumbrance has been an issue."

   The duck, of course, refers to DuckTyping (coined by Dave Thomas), the
   notion that the "type" of an object in Ruby should be seen in terms of the
   capabilities and methods it supports rather than its class - if it walks
   like a duck and quacks like a duck then it's a duck. (This is a well-known
   saying in the English language.)

   Dave Burt continued, announcing that whytheluckystiff had heard the cries
   for help and used his artistic skills to create [The Only Copyrightless
   Duck In Recent History].

   The thread began with a small ASCII-art version of whytheluckystiff's
   duck. Dave also posted a larger version using a short program he wrote
   (img2ascii.rb) that used the [ruby-gd] library to automatically convert
   the original image to ASCII. T. Onoma gave an alternative that was
   constructed with [Jave] (Java ASCII Versatile Editor).

   whytheluckystiff:

  "I'm amazed at the progress that has been made in just the last 12
  hours. If you'd like to start using any of these ducks, in the form of
  a one-line signature, here's a DRb line:
   
  ruby -rdrb -e
  'DRb.start_service;duck=DRbObject.new(nil,
  "druby://whytheluckystiff.net:6503");puts duck.daves'
   
  Several other ducks are available at this service, try "puts duck.toms"
  or "puts duck.on_the_water". For a complete list: "puts duck.list".
   
  Think of it. In time, we could amass ducks to use them as currency on
  the global markets. I think we can take Switzerland."

   Combining duck images with the idea of Ruby code in signatures for email
   and newsgroups (see the Previous RubyNews), Florian Frank gave three lines
   of Ruby that produce an animated duck swimming on water and quacking. Many
   people began going back and forth making it shorter. Jannis Harder posted
   one in 108 characters:

  i=1;loop{puts"\e[2J\e[;11H_\n%9s(*)____,\n%9s(` =~~/
  #{'~^~'[i%=2,2]*9}"%[i>0?'<':'Quack! >',''];i+=sleep 1}

  [Ruby (quiz?) simulation idea]
  ------------------------------

   Hal Fulton had an idea for a future Ruby Quiz: write a program that models
   a population of living creatures (similar to Conway's Life) as a grid of
   squares with moving critters who can mate and produce offspring with
   different genes. The program would determine when (if ever?) the genotype
   frequencies of the population stabilised, using two different methods - by
   running the simulation and also by using mathematics to predict the time
   when equilibrium occurs. James Edward Gray II (the Ruby Quiz organiser)
   thought that coming up with the mathematics could be left for
   "extra-credit", saying "Some of us are easily pleased and would be content
   watching little dots move around and multiply."

   Brian Schröder had heard of an example of evolution using bats:

  "I'd like to propose something a bit different that stresses the fact that
  evolution is _not_ survival of the _strongest_ but survival of the _fittest
  population_.
  ...
  A bat may share the blood it has gathered through the night with another bat
  that had no success. But why should it? If it shares, it needs to gather
  successfully the next night, otherwise it will starve. So it diminusishes its
  strength and helps a rival, whose genes will have a better chance to spread.
  Wouldn't it be better off being egoistic and increasing its survival
  possibility?
   
  In practice, the bats developed some kind of "tit for tat" algorithm. So it is
  _for the population with this trait_ an evolutionary positive trait to be
  altruistic."

   Ducks, bats, [foxes]! What other animals will be co-opted for nefarious
   Ruby uses next?

  [[SUMMARY] Crosswords (#10)]
  ----------------------------

   James Edward Gray II summarised the solutions to last week's Ruby
   Quiz (turning a crossword layout description into an ASCII-art
   format). One interesting solution was Pit Capitain's, whose code
   includes a method String#gsub2! which uses two-dimensional regular
   expressions!

  [[QUIZ] Learning Tic-Tac-Toe (#11)]
  -----------------------------------

   The latest installment in the adventures of [Ruby Quiz] began with our
   narrator (James Edward Gray II)...

  "This week's Ruby Quiz is to implement an AI for playing Tic-Tac-Toe, with a
  catch: You're not allowed to embed any knowledge of the game into your
  creation beyond how to make legal moves and recognizing that it has won or
  lost.
   
  Your program is expected to "learn" from the games it plays, until it masters
  the game and can play flawlessly."

   Jannis Harder posted a special signature for the occasion. You'll have to
   run it to see what it does!

  "bp6siZmijp5CiZlCiW5CgAAChpbiiZYiiZZCi5aCZ2bs".unpack("m")[0].
  unpack("C*").map{|x|x.chr}.join.unpack("B*")[0].scan(/.{24}/){i=7
  $&.scan(/..../){print"\e[3#{i-=1};1;40m ";$&.each_byte{|z|
  print" #"[z-?0,1]*2}};puts"\e[0m"}

   People posted their solutions under the same thread.

  [IOWA book ideas]
  -----------------

   Stefan Schmiedl received positive feedback on his idea of writing a book
   on the [IOWA] web application framework. He invited more comments on what
   chapters people want in the book, listing some ideas he had.

  [Wiki Spam Report]
  ------------------

   Jim Weirich reported on the status of efforts to free the RubyGarden Wiki
   from spam.

  "Spammers are automatically routed to a wiki tarpit. The tarpit is an
  (almost) exact copy of the real RubyGarden wiki. Making changes to
  the tarpit looks as if you are making changes to the real wiki. And
  since spammers get their pages from the wiki, it looks like (to them)
  that they have successfully spammed our site."

   This technique appears to be working very well.

  [Hash freezes String keys are returns copy]
  -------------------------------------------

   Michael Neumann noticed that Hashes seem to behave differently with keys
   that are Strings compared to other objects. If you try to get back the
   String (e.g. with Hash#each or Hash#keys) a frozen-copy of the original
   String is returned.

   ts explained:

  "this is made volontary for efficienty : otherwise each time that you
  modify an object, used as a key, ruby will need to re-hash the hash if you
  don't want to have strange result like the example that I've given
   
  In reality when you write
   
    a = "test"
    hash[a] = "test"
   
  the key and `a' share the same string, but `a' is marked copy-on-write"

   Robert Klemme added:

  "Yes, it's a special optimization for string keys. You can get your original
  out if you freeze it before putting it into the hash. :slight_smile: In fact, that
  might be a performance optimization if you put *a lot* string keys into the
  hash.
   
  Because copying an instance is relatively expensive this pattern was not
  adopted generally, i.e. you have to take care of Array and other keys
  yourself. Note also, that you need to rehash if you change your array
  instance after using it as Hash key."

New Releases
------------

     * [RubyGems 0.8.3]

           Jim Weirich announced the latest version of the [RubyGems] package
           management system, fixing some annoying bugs, including a
           workaround for the "string contains null byte" error several
           people have reported seeing. Over 150 Ruby libraries or
           applications are now available as gems.

     * [ParseTree 1.3.0]

           Ryan Davis wrote "[ParseTree] is a C extension (using RubyInline)
           that extracts the parse tree for an entire class or a specific
           method and returns it as a s-expression (aka sexp) using ruby's
           arrays, strings, symbols, and integers." This release features
           improved debugging messages and more nodes.

     * [RubyScript2Exe 0.2.0]

           Erik Veenstra updated [RubyScript2Exe]. This is a tool that
           transforms a Ruby program into a single executable that includes
           it along with the Ruby interpreter and necessary libraries,
           simplifying deployment. It works in Windows and Linux. There was
           some discussion on how to make this work with libraries that are
           loaded with RubyGems.

     * [Ruby/Extensions v0.6.0]

           Gavin Sinclair was pleased to announce a new version of
           [Ruby/Extensions], a set of additional methods for Ruby's standard
           classes. New methods in this release include Array#rand for
           selecting a random item from an Array, Array#one? and Array#none?.
           require_relative was also added.

     * [RPA completion for bash: 12/08/04]

           Brian Schröder issued an improved [RPA Completion], a tool that
           allows the bash shell to do tab-completion for RPA packages.
           Within an hour of the announcement, Mauricio Fernández had
           included the new version in RPA. An interesting feature of the
           [RPA Completion homepage] is an animated image at the top which
           demonstrates the use of RPA Completion. This is something that
           other developers may find useful for their sites.

     * [Jabber-RPC] [Jabber-RPC 0.1.0]

           Massimiliano Mirra created a new library called [Jabber-RPC]. This
           makes it easy to do RPC (remote-procedure-calls) over the Jabber
           instant-messaging system. An update was later [announced], fixing
           the example code and removing the dependency on expat.
           Subsequently, version 0.1.0 was released with further changes.

     * [ruby-sphere-0.1.0]

           Daigo Tomono announced the first release of [ruby-sphere], a set
           of libraries and tools for calculating the apparent position of
           stars. This can be used for planning astronomical observations.

     * [TeX::Hyphen 0.4.0]

           Austin Ziegler had great pleasure in announcing a new version of
           [TeX::Hyphen]. This is the last planned release of the library - a
           replacement will be created to enable support of non-US
           hyphenation definitions.

     * [Nitro 0.6.0]

           George Moschovitis announced a preview of the next version of the
           [Nitro] web application framework. George invited people to email
           him concerning the new logo (see the top of the [Nitro homepage]).

     * [DBus/Ruby 0.1.7] [DBus/Ruby 0.1.8]

           Leon Breedt fixed some bugs that could result in crashes in
           [DBus/Ruby], a Ruby interface to the D-BUS message bus system.

     * [FreeRIDE 0.9.2]

           Laurent Julliard announced version 0.9.2 of the Free Ruby IDE
           [FreeRIDE]. A number of bugs have been fixed. In the thread Curt
           Hibbs lists possible enhancements that the community could
           contribute to FreeRIDE.

     * [ruby-growl]

           Eric Hodel created [ruby-growl], a platform-independent system for
           generating [Growl] messages. Growl is a notification system for
           MacOS X. Applications use it to display messages on the screen.

     * [vflow 0.2 beta]

           jm wrote "[Vflow] is a netflow processing library for ruby similar
           to Cflow (perl) and pyflowtool (python) for use with flow-tools".
           Stability problems have been fixed in this release.

http://www.rubygarden.org/ruby?RubyNews/2004-12-06

[...]

[Hash freezes String keys are returns copy]

[...]

    * [ruby-growl]

[...]

    * [vflow 0.2 beta]

I was a bit "naughty" this week and included some posts that were from
_this_ week (Monday/Tuesday) rather than the Monday-Sunday of last week. I
blame the google groups beta!

Watch for next week's RubyNews when I forget all about this and accidently
repost some of these :slight_smile:

···

In article <slrncrtafk.klv.timsuth@europa.zone>, Tim Sutherland wrote:

Thanks again for the news, Tim.

Just to correct a couple of factual errors, all in this paragraph:

Tim Sutherland, Ruby Weekly News 6th - 12th December 2004:

  The thread began with a small ASCII-art version of whytheluckystiff's
  duck. Dave also posted a larger version using a short program he wrote
  (img2ascii.rb) that used the [ruby-gd] library to automatically convert
  the original image to ASCII. T. Onoma gave an alternative that was
  constructed with [Jave] (Java ASCII Versatile Editor).

I've changed the paragraph on RubyGarden to the following:

The thread began with a small ASCII-art version of whytheluckystiff's duck.
T. Onoma posted a larger ASCII-art version, generated from
whytheluckystiff's image. Dave posted a short program ([img2ascii.rb]) that
used the [ruby-gd] library to automatically convert the original image to
ASCII, and an alternative big ASCII-art duck that was constructed with
[Jave] (Java ASCII Versatile Editor).

The latest Ruby Weekly News is still at:

Cheers,
Dave

That's good. But why did you not credit yourself? Isn't that final large-ascii
version your doing?

T.

···

On Tuesday 14 December 2004 04:27 am, Dave Burt wrote:

I've changed the paragraph on RubyGarden to the following:

The thread began with a small ASCII-art version of whytheluckystiff's duck.
T. Onoma posted a larger ASCII-art version, generated from
whytheluckystiff's image. Dave posted a short program ([img2ascii.rb]) that
used the [ruby-gd] library to automatically convert the original image to
ASCII, and an alternative big ASCII-art duck that was constructed with
[Jave] (Java ASCII Versatile Editor).

The latest Ruby Weekly News is still at:
http://www.rubygarden.org/ruby?RubyNews/2004-12-06

"trans. (T. Onoma)" <transami@runbox.com> wrote...

> ... Dave posted a short program ([img2ascii.rb]) that
> used the [ruby-gd] library to automatically convert the original image
to
> ASCII, and an alternative big ASCII-art duck that was constructed with
> [Jave] (Java ASCII Versatile Editor).

That's good. But why did you not credit yourself? Isn't that final
large-ascii
version your doing?

I don't know how much credit I can take for "Dave's duck":
ruby -rdrb -e "DRb.start_service;duck=DRbObject.new(nil,
'druby://whytheluckystiff.net:6503');puts duck.daves"

Why the lucky stiff drew it, and some software I found turned it into ASCII
with a bit of configurification by me.

But I did claim to have posted it:
"Dave posted ..., and an alternative big ASCII-art duck that was ..."

Feel free to improve this text if it's unclear.

Cheers,
Dave

ruby -rdrb -e "DRb.start_service;duck=DRbObject.new(nil,
'druby://whytheluckystiff.net:6503');puts duck.squirrel"
# it's mine, all mine, ya hear!

···

On Tuesday 14 December 2004 04:27 am, Dave Burt wrote:

Oops. Never mind. I misread as:

  ASCII. And an alternative big ASCII-art duck was constructed with
  [Jave] (Java ASCII Versatile Editor).

Silly me.

T.

···

On Tuesday 14 December 2004 07:32 am, Dave Burt wrote:

"trans. (T. Onoma)" <transami@runbox.com> wrote...

> On Tuesday 14 December 2004 04:27 am, Dave Burt wrote:
> > ... Dave posted a short program ([img2ascii.rb]) that
> > used the [ruby-gd] library to automatically convert the original image
>
> to
>
> > ASCII, and an alternative big ASCII-art duck that was constructed with
> > [Jave] (Java ASCII Versatile Editor).
>
> That's good. But why did you not credit yourself? Isn't that final
> large-ascii
> version your doing?

I don't know how much credit I can take for "Dave's duck":
ruby -rdrb -e "DRb.start_service;duck=DRbObject.new(nil,
'druby://whytheluckystiff.net:6503');puts duck.daves"

Why the lucky stiff drew it, and some software I found turned it into ASCII
with a bit of configurification by me.

But I did claim to have posted it:
"Dave posted ..., and an alternative big ASCII-art duck that was ..."

Feel free to improve this text if it's unclear.

Dave Burt wrote:

I don't know how much credit I can take for "Dave's duck":
ruby -rdrb -e "DRb.start_service;duck=DRbObject.new(nil, 'druby://whytheluckystiff.net:6503');puts duck.daves"

Why the lucky stiff drew it, and some software I found turned it into ASCII with a bit of configurification by me.

I know how thankless a job rendering ducks is. Believe me, we're all applauding. And this cheering throng is looking at you, Dave. You.

Geesh. Humility on ruby-talk is so old school.

_why