http://www.rubyweeklynews.org/20050911.html

   Ruby Weekly News 5th - 11th September 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 this week by
   Tim Sutherland and Christophe Grandsire.

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

     * Ruby Debugging Article at IBM Developerworks
     ----------------------------------------------

       Time for [Debugging Ruby programs 101], thanks to Pat Eyler's latest
       IBM developerWorks article.

       Florian Gronoted the omission of ruby-breakpoint, a library that
       allows you to stop at any point in your program and attach irb.

     * Registration is CLOSING SOON for RubyConf 2005!
     -------------------------------------------------

       David A. Black: "Registration will be open until September 16, OR
       until we reach 190 *paid* registrations, whichever comes first." [/].

       | Thanks for bearing with us as we go through the process of
       | organizing a conference that is literally three times the size of
       | last year's event. We want to accomodate everyone, consistent with
       | the physical constraints of the space and the need to have definite
       | numbers in place in a timely manner.

       "If you have pre-registered for RubyConf, you still must register.
       Pre-registration != registration." [/]

     * dtrace + ruby super profiling?
     --------------------------------

       Joe Van Dyk reported on an article by Bryan Cantrill about using
       DTrace to get profiling information on Ruby applications.

       (Thanks to a patch by Rich Lowe's to allow this.)

User Group News
---------------

     * Boston.rb Goes Live!
     ----------------------

       Chris Lambert announced the very first meeting of Boston.rb, on
       Tuesday, September 13.

Quote of the Week
-----------------

     * Poetry Jam 05: A Ruby Octet
     -----------------------------

       Devin Mullins:

 ########

 $the_love_you.display \
 do not let it end
 __END__

 #requires a file called 'dark and stormy night', obviously
 1.times do
  open 'dark and stormy night' { |story|
   story.read.display
  } #the
     end
 __END__

 for once in 'my life'... 'I' do
  not know if the pain
  will end
 __END__

 #Ask the Oracle:
 /to port this code to Java will not/.require 'time'
 #=> false
 __END__

 for nicat in''      \
 do it.with.a.
              fri end
 __END__

 #I call this, 'Happy Ending'
 <<please.display
 affection
 please
 __END__

 #!`env ruby` -W0
 fork { there is no fork } unless

     unless:what?

 oh...yeah unless this is the end.to_a {
  Wachowski trilogy }
 __END__

 #5/7/5, and => true
 $capitalism.
 is_a? $system_that_promotes.
 class { separation }

 #_THE_#
 __END__

 ########

Threads
-------

  Standalone application...
  -------------------------

   Charles, using MacOS X and Linux, wanted to know whether it is possible to
   make a `standalone' Ruby application - a single executable that includes
   not only his application but also the Ruby interpreter and any other
   libraries used.

   Erik Veenstra plugged his rubyscript2exe, which is used to do exactly
   this, and also works on Windows.

   `nobody' added that exerb does the same, but only works on Windows; and
   asked why the executable resulting from exerb can be compressed with UPX,
   but the one from rubyscript2exe can't.

   The reason is a mystery, hwoever Erik pointed out that rubyscript2exe does
   its own compression, so it doesn't matter.

   Other options include Erik's tar2rubyscript, which converts a Ruby
   application into a single .rb file, but does not include the interpreter.

   Forrest Chang: "I wanna give Erik a plug. I've been succesfully using the
   bottom 2 apps to make standalone ruby apps for one of my projects. Very
   handy."

   Damphyr: "By the way the documentation on rubyscript2exe is breathtaking.
   WOW!"

  Qt, Ruby, and Windows
  ---------------------

   Gregarican asked about the status of Ruby's Qt bindings on Windows.

   | I have a project I've almost completed running on a Linux-based PDA
   | based on Qt 2.x and was trying to get it ported over to my Windows
   | clients as well.

   He found binaries against Ruby 1.6, but wanted to use 1.8.

   Richard Dale said that he and Caleb Tennis were working on the QtRuby Qt4
   interface, but need someone to do the Windows port.

   It looks like Ruby/Qt2 supports Windows, but you may need to build it from
   source. (Using msys/mingw, Microsoft Visual Studio, or Microsoft's
   freeware compiler.)

  WIN32OLE doesn't seem to support UTF-8.
  ---------------------------------------

   Bret Pettichord said that Win32OLE didn't appear to have support for UTF-8
   or other character sets.

   | I would like to access international text from Excel and Explorer using
   | WIN32OLE. But whenever i do this in Ruby, i get "????". (This code works
   | fine for English).

   nobu responded, saying that the version included in Ruby 1.8.3 has a
   codepage attribute for this purpose.

  Why? Blocks
  -----------

   Julian Leviston asked why he couldn't do this:

 ########
 c = [1,2,3,4,5,6,6,7,8,10]
 b = {|aVal| aVal / 5 == 0}
 d = c.select(b)
 ########

   Jamis Buck pointed out that he actually could, using a Proc object:

 ########
 b = Proc.new {|aVal| aVal / 5 == 0}
 d = c.select(&b)
 ########

   This led to a discussion about the meaning of the ampersand operator & in
   this case (which simply tells Ruby that the parameter is to take the place
   of the block, rather than simply be a Proc argument to the method), of
   which the most interesting comment was the comparison of the star and
   ampersand operators by Brian Schröäer:

   | A star packs and unpacks arrays, while the ampersand packs and unpacks
   | code.

   And gave the following example to illustrate his point:

 ########
 $ cat star-ampersand.rb
 def another_method(a, b, c)
   yield(:a=>a, :b => b, :c => c)
 end

 def take_block(*args, &block)
   another_method(*args,  &block)
 end

 take_block(1,2,3) do | hash | p hash end

 $ ruby star-ampersand.rb
 {:b=>2, :c=>3, :a=>1}
 ########

   Julian was so overwhelmed by the amount and clarity of the replies that he
   gave everyone {BIG VIRTUAL HUGS}.

  Detecting a hung/stalled child process
  --------------------------------------

   Chris sought to launch an external process (with `foo`), "but then kill
   that process some time later if it has not completed."

   Joel VanderWerf said that timeout was the way to go.

  RubyGems Statistics
  -------------------

   James Edward Gray II, setting forth to give an introduction to Ruby at his
   local university, asked for some RubyGems statistics.

   Jim Menard motioned at the gems.rubyforge.org stats page, which "lists all
   of the gems and the number of downloads for each."

  Kudos!
  ------

   Austin Ziegler offered his "heartfelt thanks and kudos to the developers
   of two projects": Aslak Hellesoy for MetaProject and Park Heesob for
   GMailer.

   MetaProject provides APIs for project hosting servers, issue trackers and
   SCMs (Source Control Management), as well as a `quick-release' mechanism
   for Rubyforge and others.

   GMailer is an API for Google's GMail.

   Austin is using the two projects to (almost) automate the release of new
   versions of PDF::Writer.

  katrina images generated with ruby
  ----------------------------------

   Ara.T.Howard demonstrated efficient image generation under Ruby with
   pictures of the Katrina hurricane.

   The narray and mmap libraries were used.

  RCR to modify #puts and #print inside ERB
  -----------------------------------------

   In case you didn't know, if you are using the ERb templating system and
   suddenly feel like writing puts(foo), you should instead use _erbout <<
   foo.

   This allows you to add text to the output from within a <% ... %>, for
   those cases where it's inconvenient to do <%= foo %>.

   Another nice feature involves lines that begin with %. (Feature not [yet?]
   available in Rails.)

   In this case, the entire line is treated as though it is wrapped in <% and
   %>, but looks much cleaner if you have several lines of code embedded.

  Kerberos module for ruby?
  -------------------------

   snacktime: "Is there a kerberos module anywhere for ruby? I wasn't able to
   find anything after searching around so thought I would ask here."

   The answer appeared to be "no".

   (A worthwhile project lurks.)

  Python supported for client side scripting in Mozilla.
  ------------------------------------------------------

   In future Mozilla-based browsers, you will be able to write XUL
   applications and extensions in Python, as well as Javascript.

   Erik Terpstra: "Would love to be able to do that with Ruby one day."

  Ruby Conference Hotel
  ---------------------

   "ACK! The hotel is sold out. Any suggestions?" - Matt Lawrence.

   David A. Black noted that they'd had "false alarms" in the past where the
   Hotel said they were sold out, but weren't, however it doesn't seem to be
   the case this time.

   He posted a Google Maps link showing other Hotels in the area, plus the
   RubyConfRoomShares page on rubygarden.org.

   James Edward Gray II added "as a helpful tip, not a complaint",

   | It was out of handicap accessible rooms long before this too. I checked
   | probably a month ago. It sounded to me like that hotel had very few
   | rooms that didn't involve traversing stairs to reach. That might be a
   | point conference organizers want to consider in the future.

  How to view the rdocs for gems?
  -------------------------------

   Lloyd Zusman asked how to view the rdocs documentation for Gems he'd
   installed.

   Running gem_server, then browsing to http://localhost:8808/ was the answer
   given by Austin Ziegler and Ken Kunz.

  Webrick streaming bodies
  -------------------------

   Phlip was happily using WEBrick to serve HTTP data via:

 ########
 def do_GET(req, res)
   res["content-type"] = "text/plain"
   res.body = "Hello, world.\n"
 end
 ########

   The above works well when there is only a small amount of data returned,
   but for larger amounts it would be nice to have WEBrick stream the data to
   the client so it can display it incrementally.

   Yuuzou GOTOU said that res.body can take an IO object, not just a String.
   He added, "If the content-length header field is present, HTTPResponse
   will read specified length data from the IO."

   The following example could be used by Phlip to serve a large string:

 ########
 require 'stringio'

 def do_GET(req, res)
   res["content-type"] = "text/plain"
   res.chunked = true if res.keep_alive?
   res.body = StringIO.new(@a_large_string)
 end
 ########

  Harp?
  -----

   curtis:
   | Just wanted to ask a real quick basic noob question, in some posts I see
   | "harp:" being referenced, what exactly is that? Thanks.

   According to `Irish boy' at [thebackpacker.net],

   | Right along side Guiness, Harp Lager is tops. For St. Paddy's Day, I
   | emptied a 12-pack while watching Irish documentaries. I couldn't think
   | of another beer (besides Guiness) to accompany St. Paddy's Day
   | celebration.

   North Americans beware: `Pat Liston' warns that your Harp is now brewed in
   Canada, not Ireland, and tastes completely different.

   Now it seems that Ara.T.Howard has such a fondness of Harp that it is the
   hostname of one of his machines, and subsequently is included whenever he
   pastes code from a shell prompt. There ends the mystery.

  NDiff (#46)
  -----------

   Bill Kleb posted this week's Ruby Quiz, the results of which will be used
   by NASA for testing aerothermodynamic simulation software.

   The problem is to write a version of diff that compares files numerically,
   allowing you to set a threshold beyond which two numbers are considered
   different.

   Jim Freeze posted some code to handle command-line parsing for the program
   (using the CommandLine library), so that participants can focus on the
   important part of the quiz.

  soap4r and ASP.NET problems
  ---------------------------

   See also [Interop problem after update from 1.5.3 to 1.5.4].

   Pete Elmore's was struggling to get Ruby and .NET to talk together via
   SOAP, with the following error appearing when he tried calling a .NET SOAP
   method from Ruby:

   | SOAP::FaultError: Server was unable to process request. -> Validating
   | User Name: the submitted user name contains forbidden characters: null
   | string

   His investigations revealed that soap4r 1.5.4 (as used in Ruby 1.8.3) was
   doing funny things with namespaces. Downgrading to soap4r 1.5.3 (from Ruby
   1.8.2) fixed the problem.

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

  KirbyBase 2.3 beta 1
  --------------------

   Jamey Cribbs announced beta 1 of KirbyBase 2.3, "a small, pure-Ruby
   database management system that stores it's data in plain-text files."

   A number of significant enhancements were made, including the ability to
   define one-to-one and one-to-many relationships between tables, as well as
   virtual fields and retrieving `crosstab' results.

  Arachno Ruby 0.6 for Windows
  ----------------------------

   Lothar Scholz was happy to announce version 0.6 of the (30-day trial
   available) Windows version of Arachno Ruby IDE.

   Bugs were fixed, and integration was added with RubyGems and rdoc/ri.

   0.6.1 was subsequently released.

  RMagick 1.9.1
  -------------

   Timothy Hunter's RMagick 1.9.1 hit the streets, primarily fixing bugs, but
   also adding a much faster version of Image#import_pixels.

   | RMagick is an interface to the ImageMagick (www.imagemagick.org) and
   | GraphicsMagick (www.graphicsmagick.org) image processing libraries. It
   | supports more than 90 image formats, including GIF, JPEG, and PNG.
   | RMagick now includes RVG, a high-level 2D drawing API based on SVG. The
   | package includes comprehensive HTML documentation.

  acgi-0.0.0
  ----------

   Ara.T.Howard's assiduous acgi fought its way to release.

   A drop-in replacement for Ruby's standard cgi library, it works more like
   FastCGI, but without requiring Apache or lighttpd.

   Unlike cgi, this provides persistence, speed, session affinity and more -
   all in 91 lines of Ruby code (plus a tiny amount of C).

  Units for Ruby
  --------------

   Coming up from Lucas Carlson is units, a library for converting between
   units. (Shock.)

   Par exemple,

 ########
 require 'units/standard'
 1.lb.to_ounces # => 16.0

 require 'units/currency'
 1.euro.usd # => 1.2545
 ########

   Guillaume Marcais wrote a script to grab unit conversion constants from
   Google, and Lucas released version 1.0.1 to fix some errors this revealed.

  Simple RSS for Ruby
  -------------------

   Lucas Carlson introduced Simple RSS, "a simple, flexible, extensible, and
   liberal RSS and Atom reader for Ruby. It is designed to be backwards
   compatible with the standard RSS parser, but will never do RSS
   generation."

   The API is similar to Ruby's built-in RSS parser/generator, however Simple
   RSS also handles Atom, and feeds which are not valid XML.

  gmailer 0.0.9
  -------------

   GMailer now at version 0.0.9, says developer Park Heesob. Provides
   interface to Google Mail it does.

     GMailer can fetch mails, save attachements, get cotact lists, invite
     someone or send message with file attachments. It provides edit methods
     for labels, preferece settings, starring and archiving message.

  Rio 0.3.4
  ---------

   Christopher Kleckner set out the "new and improved" Rio, "a Ruby I/O
   convenience class wrapping much of the functionality of IO, File and Dir."

   Example:

 ########
 # Copy a plain file, gzipping it
 rio('afile.gz').gzip < rio('afile')
 ########

   James Britt responded:

   | I also want to say that your announcement, with all the examples, as
   | well as those by Ara T. Howard (see his Traits release announcements),
   | are exemplary.

   Zed A. Shaw asked whether people really liked having the examples in the
   announcement email, rather than just on a webpage, to which several people
   said "yes!"

  Win32 gem for RMagick 1.9.1
  ---------------------------

   See also ANN: RMagick 1.9.1 win32 binary.

   Timothy Hunter declareareared:

   | Hot on the heels of the latest RMagick update, Kaspar Schiess has
   | uploaded a Win32 gem for RMagick 1.9.1. This gem includes ImageMagick
   | 6.2.3 as well as brand-new support for the JPEG2000 format. Thanks,
   | Kaspar!

   (RMagick is an interface to the ImageMagick and GraphicsMagick image
   processing libraries.)

  Gambit 0.1.1
  ------------

   | Let the games begin!
   |
   | This marks the first official release of Ruby's web gaming framework,
   | Gambit. Gambit was started in May of 2005 as a codefest project between
   | James Edward Gray II and Greg Brown.

  Ruby/Event 0.4.2 w/ Correct Scriptable Telnet
  ---------------------------------------------

   Zed A. Shaw released a new version of Ruby/Event, his bindings for
   libevent.

   "It has nothing to do with calendars and is about doing multiplexed I/O
   efficiently so that you can write fast as hell clients and servers."

   However, see [The Early Demise of Myriad] for some (inherent?) problems
   Zed discovered between Ruby's threads and libevent.