http://www.rubygarden.org/ruby?RubyNews/2005-02-21
Ruby Weekly News 21st - 27th February 2005
···
------------------------------------------
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).
You can [subscribe] to the RubyWeeklyNews newsletter to be emailed a text
copy of the summary once a week.
Articles and Announcements
--------------------------
* [Ruby Virtual Users Group]
There was some discussion last week on the idea of a "Virtual Ruby
Users Group" that would be made up of Ruby users from around the
world communicating over the internet. Tanner Burson created a
[rubyforge] project to try and get things started. He invites
interested Rubyists to contact him directly.
* [kde.rb: why you should use ruby]
Navindra Umanee wrote a blog post describing his experiences with
using Ruby to render [dot.kde.org]. The post was reproduced at
[planetkde.org], a site which aggregates blogs from KDE
developers.
* [London (UK) Ruby meeting, February 28]
David A. Black warned "[t]here's going to be a Ruby users meeting
in London next Monday, February 28. Crystallophobia sufferers
should avoid Callaghans pub from 7:00 PM onwards.
* [Lighting the candles on the cake?]
James Britt noticed that Ruby turned 12 on the February 24, 2005.
Happy Birthday and congratulations to Matz and all the other
contributors!
* [2005 International Obfuscated Ruby Code Contest (IORCC)]
Todd Nathan announced the first International Obfuscated Ruby Code
Contest - [IORCC]. Matz noted "[w]ell, it is a good chance to
prove them we can write pretty unreadable code as well as readable
code".
Quote of the Week
-----------------
Jean-Denis Vauguet [described] the translation route taken by the French
version of the Ruby User's Guide:
... "the French translation of the "Ruby user's Guide", written by matz.
This translation is by Alain Feler, it is based on the english translation
of matz's original text (in Japanese)"
Threads
-------
Interesting threads this week included:
[Lock on some special file reading within XML-RPC]
--------------------------------------------------
Pascal Terjan was getting a timeout on a program running under Linux. The
timeout occured while it was reading the file /proc/cmdline. William
Morgan said that this was a known problem with reading some files in the
proc psuedo-filesystem in Linux 2.6. When multiple Ruby threads exist,
Ruby uses select to avoid blocking when reading files - but on Linux 2.6
select does not have useful behaviour for many of the proc files. (This is
intentional behaviour from the kernel developers.)
There are some workarounds for this problem, but as William [blogged] in
January, the "whole point of /proc is to have a nice filesystem interface
to device driver and kernel information, and here the kernel is breaking
that facade by giving select() weird behavior."
[English-language Tofu information?]
------------------------------------
Lloyd Zusman was looking for English documentation on Tofu, a session
management framework for [WEBrick]. He had found an introductory article,
but beyond that the documentation was in Japanese. gabriele renzi
suggested asking on the WEBrick mailing list.
[killing subprocess on exit]
----------------------------
gga was using Open3.popen3 to execute some long-running applications from
a Ruby program. Unfortunately, when ctrl-c was pressed to terminate the
Ruby application, this signal was not passed to the launched processes.
gga was also concerned that zombie processes would be left running.
Csaba Henk explained that Open3.popen3 will not leave zombies - it does a
double-fork. As for controlling the (grand-)child process, there's no good
way of doing that with Open3.popen3. Csaba suggested using popen instead
(a block passed to this method will be executed in the child process).
Csaba also posted a sample usage of the 'shell' library, which gga may be
useful:
require 'shell'
sh = Shell.new
sh.transact { system("echo a") | system("tr a A") }
[parsing a time in a specific timezone]
---------------------------------------
Paul Brannan was using Time.parse to turn a timestamp String into a Time
object, but this used the local timezone instead of UTC.
require 'time'
t = Time.parse('20050103-14:31:26') # -> Mon Jan 03 14:31:26 EST 2005
Daniel Berger said that using UTC, or any other timezone, is as easy as
appending the timezone code to the end of the String, for example
require 'time'
t = Time.parse('20050103-14:31:26 UTC') # -> Mon Jan 03 14:31:26 UTC 2005
[Ruby equivalent to py2exe?]
----------------------------
patrick.down asked if Ruby had an equivalent to py2exe, a tool that
converts a Python program into a single executable that includes the
Python interpreter and all required libraries.
Shashank Date pointed at rubyscript2exe, and gene added exerb and
AllInOneRuby.
[ruby-dev summary 25709-25740]
------------------------------
Takaaki Tateishi posted a summary of the Japanese list ruby-dev. One issue
discussed was "named capture" for regular expressions. "Nishiyama proposed
that MatchData#[] receives a symbol and a string, and returns matched data
which is indicated by a label on a regular expression."
[[OT] Is anyone (else) running Rubyx?]
--------------------------------------
ES wondered who else was using the Rubyx Linux distribution (which uses
Ruby for package management, initialisation scripts and so on). George
Moschovitis asked if it was still maintained, and Danie Roux confirmed
that it was, and will reportedly have a new release soon.
Brian Mitchell noted that Rubyx is undergoing a full rewrite and will
probably be renamed to Heretix.
[License of the Ruby user's guide?]
-----------------------------------
Jean-Denis Vauguet announced, "[a] group of French ruby programmers
launched [RubyFR.org] two weeks ago, a RubyGarden-like wiki to promote
Ruby among the French-speaking community (you might utter a "yeah!" here).
For the moment, there are few pages, since we've just started to write..."
Alain Feler has translated the Ruby User's Guide into French (using an
English translation of Matz' original Japanese text!) but the group is
concerned about the license of the guide.
There was not yet a reply at the time this newsletter was written (only a
day or so has passed since the post), but hopefully we will have some
positive news next week.
[Validating XML Parser?]
------------------------
Iwan van der Kleyn is involved in a major government standardisation
process in the Netherlands which will use webservices to connect different
databases together. He has received permission to use either Ruby or
Python to develop a prototype implementation. A requirement for the
project is that a validating XML parser be used. (REXML is
non-validating.)
Several people suggested using an external stand-alone validator on the
XML and then using REXML to parse it. James Britt added that there "is
also some beta stuff in REXML for R-NG validation".
[Purpose of rb_assoc_new()]
---------------------------
Ian Macdonald had taken over maintenance of a C extension and was puzzled
by the use of rb_assoc_new(). " Is this just a convenient way to
instantiate a two element array?"
Matz: "Yes."
[[QUIZ] Phone Typing (#21)]
---------------------------
Hans Fugal came up with this week's [Ruby Quiz]:
"I am amazed whenever I see or hear about the rising generation of keypad
punchers. People that can carry on IM conversations with a 12-key phone
pad without instantly going mad; it's mind-boggling. As adaptive as the
rising generation is, the "Multitap" solution is far from efficient. For
example, I learned from Wheel of Fortune that the most common letters are
RSTLNE, only one of which (T) is the first tap on one of the keys.
Your mission then, should you choose to accept it, is to develop a more
efficient algorithm for key entry"
[[OT] Ajax: A New Approach to Web Applications]
-----------------------------------------------
Curt Hibbs noticed that someone was suggesting the name "Ajax" (as in
Asynchronous Javascript + XML) for the increasingly popular web interface
approach of having Javascript in the user's browser communicate directly
with a server via XmlHttpRequest. There was some discussion of the merits
of the name, but more relevantly, James G. Britt said he'd been working on
a library to make it easy to communicate between Ruby on the web server
and the Javascript client.
Curt added "[w]hat I think we'll see someday, a new set of smart
components integrated into web app frameworks that render GUI components
in the browser that automatically know how to talk to their corresponding
server-side objects for behind-the-scenes data transfer."
There was interest in adding support for this in Rails, and David
Heinemeier Hansson announced that he'd been doing some work in that area.
"At first, it's just about bundling a nice xmlhr javascript library and
then providing cool integration through helpers. But I'm very interested
in additional help here. So let's huddle around this."
James Britt thought that it should be framework independent, and described
the status of a project he'd been working on to do just that. "The client
code you write yourself never messes with JSON or XmlHttpRequest. It calls
server-side objects using their method names as i they were local objects,
and gets back JavaScript objects courtesy of JSON serialization." "The
server-side code need not know anything about JSON or JavaScript."
[Simple HTML Renderer / Browser?]
---------------------------------
Randy Kramer wanted to interface with a simple HTML renderer, "to get
started--eventually, I want to be able to interface to the gecko, khtml,
and possibly other renderers/browsers, but for now I'm looking for
something simple that won't be too hard for me (as a Ruby newbie) to get
working".
Alexander Kellett said that rendering HTML from Ruby using khtml was
actually very easy, and posted a 7 line program to demonstrate.
[Working with Tempfile class]
-----------------------------
RNicz had a couple of problems with Tempfile. The first was that, on
Windows, using Tempfile with binary files resulted in corrupted data since
Windows translated line endings. Tobias Peters said that using
Tempfile#binmode would solve this problem. (This is really the IO#binmode
method.)
The second problem was that instances of Tempfile were not recognised as
kind_of?(File), even though Tempfile delegates to File. RNicz suggested a
change to delegate.rb that makes kind_of? consider the object which is
delegated-to as well as the original object.
New Releases
------------
* [RubyToDot]
Martin Ankerl released a tool called RubyToDot which produces a
graph of class/module relationships for Ruby programs and
libraries.
* [webgen 0.3.0 - template based static website generator]
Thomas Leitner was "proud" to introduce the latest release of
webgen, a tool for producing static web pages from templates and
"page description files". webgen now supports Textile, Markdown,
RDOC and HTML output formats. The documentation has also been
improved.
* [fxri 0.1.0]
martinus posted a GUI front-end called fxri for reading ri
documentation. It includes syntax highlighting and
search-on-typing.
* [FreeRide 0.9.3 problems...]
Laurent Julliard heralded the next release of the FreeRide Ruby
IDE. Bugs have been fixed and fxri is included as a plugin.
* [FileSystem re-released as MockFS]
Francis Hwang announced that the FileSystem project he released
last week has been renamed to "MockFS" to avoid confusion with a
different project that was also called FileSystem. MockFS provides
"mock" implementations of File-related methods, making it easier
to write unit tests that deal with files.
* [Amrita2 initial release]
Taku Nakajima released the first version of Amrita2, the new major
version of this XML/XHTML templating library. It now has a
Amrita2-Rails bridge, allowing Amrita2 to be used in a Rails
application.
* [Rails 0.10.0: Routing, Web Services, Components, Oracle]
Speaking of Rails, David Heinemeier Hansson released another
version of this exciting web application framework. Major changes
include Routing (URL rewriting is now handled by Rails - no more
mod_rewrite), Action Web Service (for SOAP and XML-RPC web
services), Components (part or all of an action can be delegated
to other actions and controllers) and Oracle database support.
David also thanked Nicholas Seckar and Leon Breedt for their
contributions to this release. Rails 1.0.0 is tentatively
scheduled for late March or early April 2005.
* [ncurses-ruby-0.9.2]
Tobias Peters declared that "Ncurses-ruby made another small step
on its way to reach the 1.0 version number". getch and wgetch no
longer block other Ruby threads while waiting on input.
Ncurses-ruby is a Ruby interface to the ncurses
text-user-interface library.
* [IHelp 0.3.0] [IHelp 0.3.1]
Ilmari Heikkinen added "custom help renderers" to IHelp, an
interactive-help library for irb. As well as ri documentation, it
now comes with renderers for ruby-doc.org, and can show the source
code for a method (using Ryan Davis' RubyToRuby library). Another
version was quickly released, adding an HTML renderer.
* [RubyGems 0.8.5]
Jim Weirich proclaimed that the time for another RubyGems release
had come. The "[u]pdating Gem source index" process is several
times faster, bugs have been fixed, updating has been improved
(can now update all gems, specify which gems you wish to update,
or just update just RubyGems itself), and more. RubyGems is a
packaging tool for Ruby programs and libraries.
* [Kwartz-ruby 2.0.0-beta2 - a language independed template system]
kwatch released a templating system which separates presentation
data from the logic. It uses a language similar to Javascript for
describing presentation logic.
[win32-dir 0.1.0]
Daniel Berger announced the first release of win32-dir, a "series
of extra constants for the Dir class that define special folders
on Win32 systems".