http://www.rubyweeklynews.org/20051023.html
Ruby Weekly News 17th - 23rd October 2005
···
=========================================
Ruby Weekly News is a summary of the week's activity on the ruby-talk
mailing list / the comp.lang.ruby newsgroup, brought to you by
Tim Sutherland and Christophe Grandsire.
[Contribute to the next newsletter.]
Articles and Announcements
* RubyConf 2005 Slides Hosted
-----------------------------
Ryan Davis posted a collection of slides from RubyConf 2005
presentations.
"If your presentation is not on there, please get it to me and I'll
get it up ASAP."
* WhyRuby? repository has moved to ruby-doc.org
-----------------------------------------------
Curt Hibbs noted that the "WhyRuby?" respository has moved to
http://ruby-doc.org/whyruby/.
"WhyRuby?" is a collection of advocacy material (especially
presentations) on Ruby, and Rails.
* Seeking Contributions for O'Reilly's Ruby Cookbook
----------------------------------------------------
Leonard Richardson and Lucas Carlson announced they are working on a
"Ruby Cookbook" to be published by O'Reilly.
> We've hit our stride in the writing and I'm taking on the task of
> soliciting and managing contributions from the larger Ruby
> community. I ask everyone with an idea for a recipe, an itch to do a
> bit of expository writing, or an unslakable lust for peer review to
> get in touch with me.
* ruby, that guy on the cell phone behind you, and terabytes
------------------------------------------------------------
Ara.T.Howard hosted another SciRuby interview, this one with Rick
Nooner, who's "slinging around terabytes per day" in his research to
improve the reliability of Voice-Over-IP.
Threads
Convenient way to get many hash elements at once.
-------------------------------------------------
Ron M wanted to extract a number of fields from a Hash at once, and asked
for the most succinct way of doing so.
####
h = { 'first name'=>'John', 'last name'=>'Doe', 'birthday'=>'1970-01-01',
'height'=>'5 foot'}
# Gives error about "wrong number of arguments (2 for 1)".
h['first name','last name']
# Works, producing ['John', 'Doe'], but not as readable as the above
['first name','last name'].map{ |x| h[x] }
####
Simon Strandgaard came to the rescue with
h.values_at('first name', 'last name').
[IRB Tab Completion not working on OS X after complete build]
-------------------------------------------------------------
After various problems with Ruby on Mac OS X Tiger that were amply
described in [this thread], Unnsse Khan finally got RubyGems again working
on his box, but was back at square one as irb tab completion still didn't
work.
It's Kenny Parnell who finally solved this seemingly neverending problem:
> put the following into your ~/.irbrc file:
require 'irb/completion'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
Note: this is actually a cross-platform solution, not a Mac OS X specific
one, so don't hesitate to try it if you want tab completion in irb.
namespaces implemented in ruby
------------------------------
Paul, Rich and Nathaniel were standing around at RubyConf 2005, talking
about the addition of "selector namespaces" to Ruby.
Such a feature will allow you to, for example, add some methods to the
String class that are only available to your code, so they won't intefere
with any libraries you use that add their own incompatible versions of
those methods to String.
Anyway, back to the standing around. Nathaniel had the idea of
implementing support for selector namespaces in pure-Ruby code, so that
people could play around with them without worrying about black magic in
the Ruby interpreter.
This brings us to the thread in question, in which Paul has gone ahead an
posted and implementation of this glorious feature.
Discussion followed. (But not nearly enough, yet.)
Fun with function definitions
-----------------------------
Anders Höckersten found it interesting that the following code is valid:
foo(def foo(a=nil)
puts "hello"
end)
foo
"The fact that this works seems to be a side effect of Ruby's semantics
rather than an intended feature, but maybe it's actually useful to be able
to do this?"
Stefan Holst replied with another fun functionism:
foo def foo(o); o+'o'; end || foo('f').
Oldest Ruby hacker?
-------------------
Chris McMahon's 71-year-old retired-mining-engineer Father-in-law is
learning Ruby in order to munge Excel spreadsheets; could he be the
"Oldest Ruby hacker?"
Perhaps he's not hacking Ruby quite yet, so we shall have to see.
(Cue jokes about a miner and rubies.)
RubyZilla - A demo movie for Ruby-GNOME2 and Glade2
---------------------------------------------------
Masao Mutoh created a flash movie that shows you how to create a simple
web-browser in ten minutes, using Ruby-GNOME2 and Glade2.
Christophe Grandsire: "This is awesome! I learned already a great deal
about Ruby-GNOME through it!"
(There was also some discussion around the tool used to produce the flash
movie; vnc2swf.)
Ducksay (#52)
-------------
This week's Ruby Quiz is by Jonas Pfenniger is to write a script that
"generates funny talking animals", such as the one below, using some sort
of template mechanism.
__________________________________
< Welcome to this week's Ruby Quiz >
----------------------------------
\
\ (oo)\_______
(__)\ )\/\
>>----w |
>> >>
"Best line of Ruby code ever!" said Martin DeMello in response to Dave
Burt's 'class Cow < Duck'.
Hmmm ... one quiz per week, quiz number 52, seems like a significant
number.
It's over a year now since James Edward Gray II posted
[The Solitaire Cipher (#1)] to our humble group, and it's amazing to
see how he has kept it going week after week, not only coming up with
new quizzes (though others help from time to time, which he greatly
appreciates), but also following all the solutions people post, making
suggestions and writing up superb summaries.
Oh, he's writing a book too, [Best of Ruby Quiz].
So it is with this in mind, I would like to propose a toast to Quiz
Maestro James Edward Gray II. Hooray!
New Releases
Rails 1.0: Release Candidate 2
------------------------------
David Heinemeier Hansson announced Rails 1.0 RC2.
> The release of 1.0 is near upon us! It has been a long time in the
> making, involved a heroic final sprint at RubyConf by the core team, and
> is a testament to how it's all been coming together over the last
> months. Almost three hundred bug fixes, enhancements, and new features
> have been introduced since 0.13.1 saw the light of day three months ago.
> That's on average three per day. So it's not been a while because of
> slacking off.
Roxy 0.1 - Remote Proxy Objects w/ type & method signature impersonation and
----------------------------------------------------------------------------
w/ remote block yields
----------------------
Roxy is a library similar to Ruby's standard DRb - it allows you to get a
handle on a "remote proxy object", and use its methods as though it were
local.
Jeff Wood: "There are "features" of DRb that I don't like. So, this is my
replacement project."
Ferret 0.1.0 (Port of Java Lucene) released
-------------------------------------------
David Balmain ported the full-text-search library Lucene from Java to
Ruby, producing "Ferret".
It includes a "powerful extendable query language. You can do boolean,
phrase, range, fuzzy (for misspellings etc), wildcard, sloppy phrase (out
of order phrases) and more."
There were a couple of celebrations at the announcement, followed by some
discussions of Ruby's other full-text-search engines, such as Ruby/Odeum.
usage 0.0.4 - The IO edition
----------------------------
Steve Tuckner:
> Usage is simple way to access command line parameters for quick scripts
> that you write where you don't want to even think about command line
> processing. You just need to type in what would be the Unix synopsis for
> the command and the usage does the rest.
Illumination by example...
Usage.new "[-y] [-x excluded_tags] (-z ztag) (-w warning_arg) <infile
%num_times >outfile files..." do |u|
.....
end
Lafcadio 0.9.0
--------------
Francis Hwang released the latest develpment version of Lafcadio, an
object-relational mapping library for MySQL.
Support for transactions was added, plus better support for unit testing
against mock databases.
radp 1.0 - Ruby Asterisk Dial Plan generator
--------------------------------------------
Hans Fugal created the "Ruby Asterisk Dial Plan generator", radp.
"Asterisk is incredibly cool and powerful, and until now has been
incredibly painful to configure for someone as accostumed to the beauty of
ruby as I am. That all ends today."
Introducing SwitchTower: Distributed deployment for Rails
---------------------------------------------------------
David Heinemeier Hansson introduced SwitchTower, "a utility for executing
commands in parallel on multiple machines" (for example, deploying a Rails
application consistently to multiple servers).
"Suppose something goes wrong while checking out your code-SwitchTower
will detect that and roll back the change, _on all deployed machines_.
This means it is much harder to wind up with your application out of sync
on the various boxes."
ParseTree 1.4.0
---------------
Ryan Davis released ParseTree 1.4.0.
ParseTree is a library that takes a Class or method and returns a
representation of Ruby's internal parse tree of the structure, using
arrays, strings, symbols and integers.
rPlanet 1.0b1
-------------
With pride, Joel Watson announced the first version of rPlanet, a port of
Planet, a web-based RSS feed aggregator. Have a look at the demo.