16th - 22nd May 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.
Articles and Announcements
- One-Click Ruby Installer hits 90k (plus OSX news)
- Why's (Poignant) Guide to Ruby, Chapter Six: Downtown
Curt Hibbs announced that the One-Click Ruby Installer for Windows has been downloaded over 90,000 times since moving to RubyForge in April 2004.
60,000 of those downloads were in the last four months.
In other One-Click Ruby Installer news, Mark Hubbart has been working on a MacOS X version. Curt is also looking for people to begin One-Click installers for KDE and GNOME.
“I’ve been pushing Ruby since the Fall of 2001, and it is wonderful to finally see Ruby start to take off. It’s been very gratifying to have played a small part in helping Ruby push into the mainstream.”
Chapter Six, “Downtown,” rejoins the friendly foxes, the tall and the short, on their misadventures to locate their lost pickup truck. As always: much code. And now with syntax highlighting, less red.
I am extremely proud of the metaprogramming section. I hope it will aid you on Square One.
User Group News
- Hamburg.rb
- New Sydney Ruby Users Google Group
Stephan Kämper announced that Hamburg.rb are meeting on June 1st, 2005. The location is Stresemannstrasse 144, Hamburg, Germany.
Harry Ohlsen provided a link to the newly setup Sydney-Ruby-Users Google Groups mailing list.
Quote of the Week
Ruby smile by baalbek:
Mostly for the newbies who stumbles into this NG, wondering what Ruby is all about…
Well, Ruby is the digital equivalent of a big smile!
The more I learn about Ruby (modules import, the ease of extending it in C/C++, closures, tight but readable syntax, everything works like one expects, etc etc etc), the bigger the smile on my face when coding…
Threads
Doing fixups after deserializing YAML
Matthew Westcott, “for reasons best known to myself”, wanted more control over the way YAML de-serialisd his objects. In particular, he wanted to be able to automatically modify the objects after de-serialisation.
He later found the YAML.add_domain_type method which allows you to do this.
how calculate md4 hash?
Dave asked how he could calculate an MD4 hash. The openssl
library looked promising, but he hadn’t found a code sample for generating an
MD4.
WATANABE Hirofumi:
ruby -ropenssl -e 'puts OpenSSL::Digest::MD4.hexdigest("foo")'
Ruby/TK on Mac OS X Tiger?
Tom Nakamura asked if require 'tk' works by default on
MacOS X Tiger.
Mark Hubbart: “Yes! Imagine my surprise :)”
Philipp Kern added that it looks “really nice” because it uses native widgets where possible, so your Tk apps are Aquafied.
join not in Enumerable
Logan Capaldo noticed that Enumerable#join doesn’t
exist.
“I said to my self, self there is no reason that has to be Array only functionality. Why isn’t it in Enumerable?”
Ara.T.Howard gave one reason; “just because somthing is countable (Enumerable) doesn’t mean each sub-thing is singular.” For example, each iteration over aHash gives a
[key, value].
He continued,
“this is no stubling block (pun intended) for ruby however”, and
posted a version of Enumerable#join that takes
a block. An example of its use:
h = { 1 => 'one', 2 => 'two', 3 => 'three' }
s = h.join('; ') { |kv| kv.join(' -> ') }
puts(s) # outputs "1 -> 'one'; 2 -> 'two'; 3 -> 'three'"
nobu said it “Feels interesting”, and gave a patch to
enum.c implementing Ara’s version.
Not all Enumerables have a well-defined ordering.
(For example Hash.) Whether this mattered or not
was debated.
Array methods that should be added to
Enumerable,
+, size, uniq to list just a few.
David A. Black wasn’t so sure about all of these.
size for instance may not be suitable for all
Enumerables -
“partly because some of them have no particular size
and partly because even for those that do, taking the size might
cause side-effects (e.g., an I/O-based enumerable)”.
Eric Mahurin said that this was true, however it is also true
for existing methods in Enumerable.
“Using any enumerable method with IO has the same issue. You’ll
need to seek back between calls to any of the enumerable
methods on an IO.”
class C
include Enumerable
def each
loop { yield rand(100) }
end
end
as an example of a class for which size is
meaningless.
On the other hand, Eric pointed out Enumerable#sort
isn’t useful on that class either.
Uniform vector class, inheriting from Array: How to make sure that methods return a Vector and not an Array?
Thomas implemented a “Vector” class, designed
to act like Array but only allow items of the
same “type”.
He inherited from Array and over-rode a few
methods like []= and << to
validate the elements as they were added.
This worked, however Array#+ would always
return an Array, not a Vector.
He could write Vector#+ to wrap around it, but
is there a simpler way?
Vector class
was a good idea, however he suggested forwarding to the
Array instead of inheriting from it.
gabriele renzi added “this makes me think: the delegation approach is usually simpler. But is this because of an underlying fault of the inheritance mechanic or is it the obvious more simple thing?”
(Part of the problem is that methods likeArray#+ “cheat” in order to be more efficient by
avoiding calling a Ruby method on each element that is added.)
Tiling Turmoil (#33)
Greg Brown wrote this week’s Ruby Quiz. The problem is to write a program that will help Greg cover his bathroom floor with L-shaped tiles. (Well, almost.)
New Releases
icalc 0.0.4
Dr Balwinder S Dheeman released a “versatile tool for network/system administrators”. Given an IP address (or prefix, or range, or with netmask…), it calculates such things as the broadcast address and class.
AllInOneRuby 0.2.2
Erik Veenstra announced the latest version of his “just-in-time and temporary installation of Ruby” – a single compressed executable for Windows, Linux or MacOS X that includes a full Ruby runtime and libraries.
Reg 0.4.5
Caleb Clausen released a new version of Reg, a tool for pattern matching in arbitrary Ruby object graphs.
It provides matchers for Strings, Arrays, Symbols, Hashes, and several generic options for other Objects.
Rebbin 0.7
Lawrence Oluyede updated Rebbin, a “pastebin” written in Rails. It allows people to upload snippets of text (e.g. source code) for public viewing.
RSS 2.0 and Atom 0.3 feeds were added, as well as XML-RPC and SOAP support. A scheduler is now available to remove snippets older than 48 hours.
cursor-0.5
Eric Mahurin released cursor 0.5, a library that provides powerful external iterator features – “insert, delete, replace, copy, paste, move” etc. (similar to the operations supported by text editors, but not limited to Strings).
Rant 0.3.8
Stefan Lang added some new features to Rant, a flexible build tool written in Ruby.
Dependency checking for C and C++ source code is now supported, as is
functionality for installing .cmd files on Windows.
RMagick 1.8.1
Timothy Hunter made a bug-fix release of his bindings to the ImageMagick and GraphicsMagick image processing libraries.
RubyInline 3.3.2 Released
Ryan Davis lined up RubyInline 3.3.2, a library allowing you to embed C and C++ code directly in your Ruby source files. “The code is compiled and run on the fly when needed.”
It also has a tool package_inline to allow you to use
RubyInline’d code on systems which lack a C compiler.
Ruby Editor Plugin for jEdit 0.6.7
Rob improved the Ruby Editor Plugin for the jEdit editor. Method completion is more clever when adding parentheses. Indenting also now works better.
ruby-services 0.1.0
On behalf of the Win32 Utils team, Daniel Berger announced the first release of ruby-services.
This will be a collection of various programs presented as Win32 services. (Currently a WEBrick HTTPServer is the only program included.)
HighLine 0.6.0 -- Now with menus!
James Edward Gray II announced that the “latest version of HighLine comes with two massive new features. The first is the new HighLine Developer, Greg Brown.”
The second feature was a menuing system created by Greg Brown.
HighLine is a library that eases the task of doing console input and output.
Fireruby 0.3.0
Peter Wood’s FireRuby extension was updated. This is a library for use with the Firebird RDBMS.
“Once again I would like to thank Ken Kunz for his support and input to the FireRuby project. Ken performs the unit testing and creates the gem file for the Linux version of the FireRuby library.”
The API was improved in a number of ways.
RubyScript2Exe 0.3.4
Erik Veenstra released the latest RubyScript2Exe, a tool for transforming your Ruby program into a standalone compressed Windows, Linux or MacOS X executable containing your code as well as the Ruby interpreter and other libraries.
pscan 0.0.2
Dr Balwinder S Dheeman released pscan, a simple TCP/IP port scanner written in Ruby.
Ruby Facets 0.7.2
Trans posted a “ballistic” release of Ruby Facets, a “a cornicopia of extensions and additions for the Ruby programming language.”
Carats has now been merged into Facets, adding in its classes, modules and mixins to the methods Facets had before.
Other improvements include support for automatically loading methods when you first try to use them.
Syck 0.55 -- Object loading, memory leaks
why the lucky stiff fixed some memory leaks and parse errors in Syck, the YAML library for Ruby. (YAML is a humane markup language.)
Support for your own yaml_initialize and yaml_new
methods was added. “I’d say typing is done at this point.”
ParseTree 1.3.6
Ryan Davis ferreted out a new ParseTree release. ParseTree extracts the abstract syntax tree from Ruby classes or methods, returning it as an s-expression using Arrays, Strings, Symbols and Integers.
Nitro + Og 0.17.0, Og Reloaded, Elements
George Moschovitis came out with the “biggest release yet” of Nitro and Og. (Nitro is a web application framework and Og an object-relational mapper.)
There are many many (many) new features. (Seriously, lots.)
soap4r/1.5.4
NAKAMURA, Hiroshi announced an update to soap4r, the standard Ruby library for dealing with SOAP web services. (Both client and server.)
WSDL support was improved, along with .NET interoperability.
Amrita2 1.9.5
With this release of Amrita2, Taku Nakajima says the main features now work, and it is ready for “evaluation use”. He also posted the roadmap.
Amrita2 is an XHTML/XML template library, the successor to Amrita (surprise!)