21st - 27th March 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
- Getting the word to conventional programmers
- RubyForge now supports SFTP...
- RubyConf 2005 Preregistration now open!
- Ruby article on DevSource
A related DevSource article, The State of the Scripting Universe, quotes representatives from the Perl, PHP, Python, Ruby and Tcl communities.
Dave Thomas provides the Ruby viewpoint.
Tom Copeland announced that, thanks to Brian Candler, RubyForge now supports the SFTP protocol. (Like SSH+FTP.)
David A. Black announced that pre-registration for RubyConf 2005 is open. The conference is in San Diego, California, USA on October 14-16, 2005.
Several people outside the U.S. said that they would not be attending because of the current travel policies of the U.S. government. Francis Hwang (a U.S. citizen) sympathised and suggested that next year’s conference be held in Canada.
More positively, David’s post quoted Rails author David Heinemeier Hansson: “You have to come. I went last year and had the most wonderful three days in the company of most of the best Ruby hackers. I’m so most definitely going again this year. You have to come.”
Hal Fulton wrote an article for DevSource.com entitled Five Things You Didn’t Know You Could Do with Ruby.
From the article,
When DevSource asked me to write this article, I had to fight two temptations. One was to make it very language-oriented, talking about Ruby’s syntax and semantics. Another was to make it very technology-oriented, full of buzzwords such as RSS and XMLRPC.
Though I’ve used the occasional buzzword here, I took neither of those paths. I’ve tried instead to present Ruby from a high-level view, almost a management perspective, to show that Ruby is mature, powerful, versatile, and gaining industry acceptance on a daily basis.
Quote of the Week
Continuing the recent theme of having the Quote come from anywhere other than the mailing list, this week’s is from the #ruby-lang IRC channel. (2005/03/25 logs.)
Matz:
I have talked with Koichi Sasada, and he agreed to merge his YARV in the current interpreter.
I _hope_ VARV will be core engine before the end of this year.
The goal of YARV is “to develop the fastest Virtual Machine for Ruby in the world”. Koichi Sasada’s work is supported by the IPA (Information-technology Promotion Agency, Japan) “Exploratory Software Project 2004 (youth)”.
Threads
strip and its evil brother strip!
Aquila began a thread about the return value of “bang” methods (those ending in ”!”). This naming convention is used to indicate that the method modifies its receiver.
There is another convention used in the standard library: bang methods
typically return the receiver if a change was made and nil otherwise.
The discussion covered the merits of chaining bang methods
(e.g. a.strip!.upcase!).
Nikolai Weibull said that bang methods were simply an optimisation -
modifying objects in-place can be faster than creating new ones. He suggested
avoiding using bang methods at all unless there is a compelling performance reason
to do so. Nikolai also gave a benchmark where he ran line.strip.downcase
one million times, and compared it to line.strip!; line.downcase!. The former
version took 1.7 seconds, while the latter was 1.2 – not a large performance difference.
Bill Kelly pointed out a post from Matz in 2001 which said that there were two reasons for the “return nil if no change” behaviour of bang methods. The first is that it’s a cheap way of detecting modification. The second is because he wants to discourage chaining of bang methods.
koders has indexed rubyforge.org
Martin Ankerl noticed that koders.com (a site which allows you to search through web-available source code) has indexed rubyforge.org.
Hiroshi Nakamura said that the RAA has opened its own experimntal source code search interface.
prime genrator in 34 bytes
Simon Strandgaard reported that “JIX” came up with a 34 character Ruby program that
lists all prime integers: i=l=1;(l%i+=1)>i-2&&p(i)while l*=i
unifying hash and proc syntax
Joel VanderWerf had the idea of removing the distinction between Hashes
and procs.
For example, the following imaginary syntax would create an object that behaves
like a Hash with a default_proc:
{
1 => 2,
2 => 3,
3 => 4,
|x|
x + 1
}
Csaba Henk thought that the idea was clever, but a bit dubious in treating these as the same. “A hash is basicly transparent, a proc is basicly opaque.”
OO database concepts...
This thread discusses “Object-Oriented Databases”, for example ORDBMS vs OODBs.
Dwemthy's Array -- the Ruby mini_adventure
why the lucky stiff introduced the sixth chapter of Why’s (Poignant) Guide to Ruby.
“This chapter covers metaclasses and method_missing with the help of Dwemthy’s demonic list.”
Since you were a very young rabbit in little cotton pants, Dwemthy’s Array has breathed on your neck and you’re tired of it. You draw your glistening Hero’s Sword from its sheath and cut a low-circling falcon in half as a confidence building exercise. Your eyes flick about in a cool and freaky way.
You’re ready… It’s time to stare this construct in the face.
Support for 10x Productivity Increase with Rails!
Curt Hibbs related a success story from some developers who got a great productivity increase through using Ruby on Rails instead of the Java framework they were previously using. (They used Rails to re-implement a Java application.)
What makes this story special is that the developers were Bruce Tate and Justin Gehtland, and the Java framework they had been using was Spring/Hibernate.
Bruce is the author of the books “Better, Faster, Lighter Java”, “Bitter Java” and “Bitter EJBs”, and Justin “is a recognized *expert* in Spring and Hibernate” (and was a novice in both Ruby and Rails).
“Spring/Hibernate are not your typical Java framework (i.e., not Struts), but are the current best-of-breed.”
A pleasant surprise was that the Rails solution ran faster than the Java one.
As a “PS”, Curt added “Bruce Tate and David Geary (author of Core Java Server Faces, Core JSTL, and more) have signed with O’Reilly to write a “Rails Developer Notebook” (obviously one of O’Reilly’s new Developer Notebooks series).”
There were some responses thinking about the productivity differences between Rails and Java frameworks, and in particular commenting on whether Rails was being hurt by “hype”.
CD Baby:The constant hype is what kept me AWAY from Rails for so long! I just couldn’t stomach the constant self-congratulations to it all.
Now I can’t stomach the constant other-technology-bashing. (Java, PHP, etc)
Nobody wants their current beliefs insulted.
Evaluator for a mini-Ruby in Haskell
Daniel Berger spotted a simple evaluator for a subset of Ruby, written in Haskell.
It also shows how to define a Ruby method that behaves like while.
(Using retry.)
Ruby newbie: 3 week learning project
Al Abut decided to blog every day of a 3 week course in learning Ruby (using the book Sams Teach Yourself Ruby in 21 Days).
He invited others to learn with him at the same time.
FCGI 0.8.5 -- patch for major memory leaks
Kirk Haines posted a patch to fix a major memory leak in Ruby FCGI. (FastCGI, used in web application servers.) The bug only affects the C extension version, not the pure Ruby one.
Ruby, brother of VB?
Mike Cox was looking for a language to switch to from Visual Basic. After finding Ruby, he felt that “Ruby may possibly be the brother of VB, and that Ruby is the son of Algol 60. Just a cursery glance over Ruby confirmed that my beloved “begin” and “end” are there.”
Phil Tomson remarked “some might call them fight’n words”, and James Britt warned Mike to “Forget all the VB you’ve ever learned. Really. I was a VB hacker for some time. I liked it, it paid the rent, got me published. But habits acquired using VB will get in the way of using Ruby.”
English Numerals (#25)
Timothy Byrd came up with this week’s Ruby Quiz.
“While we normally write numbers using Arabic (or since Quiz #22, Roman) numerals, numbers can also be written out as English phrases.”
For example,
7 seven (the hard way)
42 forty-two (a very important number)
2001 two thousand and one (a space odyssey)
1999 (party like it’s) nineteen hundred and ninety-nine
The problem this week is taken from a Pi Mu Epsilon newsletter. (A U.S. mathematics club.)
“When the integers 1 to 10_000_000_000 are written in the English language, then sorted as strings, which odd number appears first in the list?”
The task is to write Ruby code to turn a number into its English representation, and to then write a program that solves the above problem.
Using DL on Windows
Stephan Kämper was finding that DL could not locate the DLL he was using when
he referred to it with DL.dlopen("libs/one.dll").
Dave Burt explained that DLLs need to be accessible in one of the following ways:
- in the working directory
- in the PATH
- registered (regsvr32.exe one.dll)
- referenced directly
Free Rails hosting?
Aquila was looking for free Rails web hosting. There are many free PHP hosts, why not Rails?
Dick Davies suggested hosting on your own server as an alternative to paid hosting, and Wes Moxam pointed out an article of his describing how to set up a Rails site on freeshell.org (free shell account).
Lothar Scholz said that the CPU and memory usage of Rails is comparable to Java web applications, so it isn’t well suited to free hosting.
Eric Hodel disagreed with that assessment. He manages 43 Things, which peaks at 200,000 page views per day. It runs off two servers, but can run on a single 3GHz Xeon with 2GB ram with no performance degradation. He has also heard of people running Rails in a 64MB virtual server, and thought that this could be a useful configuration for free hosts. (Doug Beaver also gave some data showing that Java solutions can work under similar memory constraints.)
Lothar thought that even 64MB was far too much for a free host. “You can without problems put 1000 PHP Users on one machine. Many free hosters have even more then this.”
A Poll
jeem started a poll, asking the following two questions:
1. Do you use Ruby in your “day job”?
a.) Yes! Lots!
b.) Some.
c.) I little bit when I can get away with it.
d.) I wish!
2. What are your one or two principal programming languages other than Ruby?
There were many responses, and Phil Tomson began a thread comment on today’s poll and more questions, noting that there were a large number of “a.) Yes! Lots!” answers. “This seems to be a marked change in the Ruby community since a year ago when the ‘a’ answer would have been much rarer.”
IORCC Crossword Puzzle Tips and Hints!
Todd Nathan announced a series of “Tips and Hints” for the IORCC Crossword Puzzle.
New Releases
Multiblocks 0.1.0 -- emulating Smalltalk type multiblock calls
Csaba Henk announced the first release of a framework which allows you to define a “callgroup”: a group of methods that behave like a single one.
Tar2RubyScript 0.4.5
Erik Veenstra made some changes to Tar2RubyScript, a tool for transforming a directory tree that contains a Ruby application into a single Ruby script.
Bangkok: Musical Chess
Jim Menard released Bangkok, much to the relief of its ten million residents. Ahem. “Bangkok reads chess game descriptions and re-play the games.”
It comes with a listener that converts the game into MIDI music.
ruby-dazuko 0.1.0
Aredridel announced ruby-dazuko, a Ruby interface to dazuko. Dazuko is a kernel module for Linux and FreeBSD that allows userspace programs to monitor file accesses, and optionally deny access.
midilib 0.8.4
Jim Menard updated midilib, a pure Ruby library for reading and writing MIDI files, and dealing with MIDI event data. There were some API improvements, plus new methods to turn note names like “32nd”, “dotted quarter” into notes.
AllInOneRuby 0.2.1
Erik also released an update to the AllInOneRuby tool. This creates a compressed executable for Windows, Linux or MacOS X that contains the Ruby interpreter and runtime libraries, providing a “just-in-time and temporary installation of Ruby”.
sys-admin 1.0.0
Daniel Berger was “happy” to announce the first release of sys-admin, intended to be
a cross-platform replacement for Etc. The win32-etc package has now been
deprecated, and will be removed from the Win32 Utils project in the near future.
RubyCocoa 0.4.1
kimura wataru delivered a new RubyCocoa release. RubyCocoa is a Ruby binding for the Cocoa API in MacOS X.
MacOS X 10.3 and Xcode are now supported. There is also a new option to allow the RubyCocoa framework to be bundled with youir application, allowing it to be used on a system that otherwise lacks RubyCocoa.
Revolution - a Ruby binding to Evolution
Tom Copeland released the first version of Revolution, a Ruby binding to the Evolution email and personal information management (PIM) application. Example uses are for extracting contact, calendar and task information.
RubyScript2Exe 0.3.3
Another release from Erik: RubyScript2Exe. This one is used to create a single executable containing your application, the Ruby interpreter and runtime libraries, easing distribution. It works on Windows, Linux and MacOS X.
Hash::MixIn and Python style Object#dict
Florian Gross wrote a quick implementation of Hash::MixIn
(“you provide .keys, .fetch, .store and .delete and get a full-blown Hash interface”), plus
Python-style access to the methods of an object.
Ruby Facets 0.6.2
TRANS announced a new version of Ruby Facets (“Fantastic Atomic Core Extensions”).
Additions includeTime methods
(3.hours and so on),
module/redirect (like alias, but wraps
methods instead of copying them) and enumerable/uniq_by.
Ruby/GtkMozEmbed 0.3
Mirko Maischberger introduced Ruby/GtkMozEmbed, a Ruby binding to GtkMozEmbed, a Gtk+ widget that embeds the Mozilla browser.
FireRuby 0.2.0
Peter Wood released the second version of FireRuby, a library that provides support for accessing the Firebird RDBMS. Queries now returnRow objects instead of arrays of data. Row
provides information like column name and row number.
eXPlain Project Management Tool - 1.0
John Wilger was “pleased” to announce the initial public release of the eXPlain Project Management Tool. It’s a web-based project management system that supports the Agile software development methodologies.
Syntax 0.7.0
Jamis Buck improved Syntax, a library for performing lexical analysis. (In particular, for syntax highlighting text.) Accuracy and robustness have been improved.
ruby-oci8 0.1.10
Takehiro Kubo released the latest Oracle8 client library. There were several changes, including improved cursor support.
Ruby wrapper for Flickr
Premshree Pillai wrote a Ruby interface to the Flickr photo-sharing site. It allows you to get and create photosets, search and tag.
Version 0.2 was later released, adding support for uploading pictures.
First release of Rant
Stefan Lang wrote a build tool, similar to Rake. “The equivalent to a Makefile for make is the Rantfile. An Rantfile is actually a valid Ruby script that is read by the rant command.”
Stefan explained the differences between Rant and Rake: Rant has built-in support for C#, and has cleaner internals.
FastCST 0.5.2 (Working Repository)
Zed A. Shaw let a “major release” of FastCST escape the laboratory. FastCST is the “Fast Change Set Tool”, which “implements a working repository that actually functions like a version control tool should”.
Rake 0.5.0
Jim Weirich “finally” came out with a new version of the Rake build tool.
Bugs have been fixed, recursive rules are now supported, and
a man documentation file was added.
The following people also contributed to this release: Tilman Sauerbeck, Brian Chandler, Eric Hodel and Jani Monoses.