# Ruby Weekly News 5th - 11th June 2006

**URL:** <https://www.ruby-forum.com/t/ruby-weekly-news-5th-11th-june-2006/63344>\
**Category:** Ruby\
**Created:** [June 14, 2006, 12:16pm UTC](https://www.ruby-forum.com/t/ruby-weekly-news-5th-11th-june-2006/63344 "2006-06-14T12:16:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![weliwarmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@weliwarmer](https://www.ruby-forum.com/u/weliwarmer)\
**Post date:** [June 14, 2006, 12:16pm UTC](https://www.ruby-forum.com/t/ruby-weekly-news-5th-11th-june-2006/63344/1 "2006-06-14T12:16:37Z")

</div>

[http://www.rubyweeklynews.org/20060611.html](http://www.rubyweeklynews.org/20060611.html)

Use the link above for a nicer version of this newsletter that’s  
formatted for  
the web, including links to threads and other sites. You can also  
subscribe  
to a newsletter-only mailing list, or to RSS/Atom feeds.

# Ruby Weekly News 5th - 11th June 2006

Ruby Weekly News is a summary of the week’s activity for the  
ruby-talk  
mailing list (and its mirror equivalents the ruby-talk google group  
and  
the Ruby forum) and the comp.lang.ruby newsgroup.

This week’s newsletter is brought to you by Tim S…

[Contribute to the next newsletter]

# Articles and Announcements

```
 * Ruby Whitepapers (ruby-talk)
 ------------------------------

   Eric A. wrote a series of articles Ruby Makes My Head 

```

Explode  
in a one-week spree:

```
      * Ruby Rocks!
      * Rake Rocks!
      * Getting Started in Ruby
      * Installing Ruby (Linux info added by John G.)
      * Installing Ruby Gems
      * Adding Ruby Extensions
      * Which GUI Language to Use? (FxRuby vs. WxRuby)

 * Feel like contributing? (comp.lang.ruby)
 ------------------------------------------

   Gregarican asks for help completing a Ruby telephony library he'd 

```

been  
working on before running out of time.

```
   "It provides a working telephony library that communicates with 

```

PBX  
systems for call detail reporting, call control, etc. It’s maybe  
50-75% complete and hasn’t been updated by me since November  
2005.  
This _isn’t_ a VoIP project. It’s CTI."

# User Group News

```
 * Phoenix Ruby U. Group meeting this Monday, June 12 (ruby-talk)
 -------------------------------------------------------------------

   The Phoenix Ruby U. Group had their June meeting on the 12th.

```

# Link of the Week

```
 * Ruby Inside: Daily Ruby tips, news, code and frivolity
 --------------------------------------------------------

   Ruby Inside is a blog by Peter C. that's been running for a 

```

couple  
of weeks. So far it’s had multiple interesting posts every day,  
ranging from original overviews of little-known Ruby libraries,  
to  
announcements of new tools, libraries and articles.

```
   Worth a look.

```

# Threads

## Another Look at SELECTOR NAMESPACES (ruby-talk)

Trans posted some simple code adding partial support for selector  
namespaces in Ruby. It works by making copies of top-level constants,  
and  
is only for demonstration purposes.

## XML Parsing Speed - ruby libxml & REXML (comp.lang.ruby)

subimage’s code was taking too long to parse XML files (some of which  
were  
400MB). He tried using libxml instead of REXML, and this helped, but  
it  
was still too slow.

rcoder explained that he should use stream (event) parsing for large  
XML  
documents, instead of parsing entire documents into memory at once  
(and to  
make things worse, then using XPath to select nodes).

After switching to REXML’s stream-parsing mode, subimage remarked “Ok  
so I  
finally dug into the stream parser and this is lightning fast!”

Finally, Mathieu B. tested the expat bindings for Ruby a few  
months  
ago and found its stream-parser to be up to 20 times faster than  
REXML’s.

## Can Ruby play with COM ? (ruby-talk)

Can Ruby talk to Windows software that has a COM interface?  
Absolutely,  
with the standard library `win32ole’.

## Runtime debugging tools needed?!! (comp.lang.ruby)

The web-testing tool Watir brought Jonathan Ni to Ruby, and he now  
has  
some ideas for speeding up test development. His company has a large  
and  
complex set of Watir tests for their web application, and need to  
constantly modify the tests as the application they’re developing  
changes.

They’re finding the `run test suite', `fix error in test’, `re-run’  
cycle  
takes too long (partly due to it taking a long time to set up the  
test  
data), so Jonathan would like to run the tests and have them pause  
whenever an error occurs, allow him to edit the test code, and  
continue  
without restarting.

Andrew McDonagh suggested he instead consider whether all his tests  
really  
need to be “end-to-end” (i.e. act exactly like a normal user, going  
through a web browser). “A more reliable, flexible, less maintenance  
approach is to partition the tests so that very few actually go  
end-to-end.” He gave some examples of what he means by tests that  
aren’t  
end-to-end.

Jonathan could also look into making the tests more independent, so  
he can  
fix and re-run each small test without having to wait for the whole  
lot to  
complete.

The original debug/fix/continue idea is a good one though. It would  
be  
worth looking into the various Ruby debuggers out there. Perhaps the  
ruby-talk readers have some ideas? (It’s worth raising awareness that  
a  
lot of programmers are coming to Ruby through Watir.)

## Ruby Weekly News 29th May - 4th June 2006 (ruby-talk)

In the thread announcing last week’s Ruby Weekly News, James Edward  
Gray  
II said he was “90% sure” he’d found a new host for the ruby-talk  
mailing  
list comp.lang.ruby newsgroup gateway. “Give me a couple of weeks to  
iron  
out all the details…”, then hopefully the list and newsgroup will  
be  
mirrored again.

## Ruby for Highschoolers? (ruby-talk)

This thread discussed the relative merits of Scheme and Ruby as  
languages  
for a high-school introductory programming course.

Scheme is a smaller, simpler language, and there is a lot of teaching  
material already prepared for it. While Ruby has many features (e.g.  
plenty of syntactic sugar) that make it nice to develop in once you  
know  
the language, these can be confusing to beginners.

There were also arguments that Ruby is an excellent language for  
beginners. Curt H. points out “Learn To Program” by Chris P.,  
a book (and online tutorial) that’s geared towards those who have  
never  
programmed before. It teaches programming using Ruby.

Ruby has an advantage over Scheme in that it has a rich collection of  
libraries, so even new programmers can write useful, real (as well as  
fun)  
programs - great for motivation.

## iterative question (ruby-talk)

Joe wants to get an array of all Dates in a range.

Daniel S. said (start\_date…end\_date).to\_a would do the  
trick, and  
Chris showed an alternative approach, using Date#upto to iterate over  
the  
date range.

## Ruby Q. Wins Contest (ruby-talk)

Last week’s Ruby Q., “Hash to OpenStruct (#81)” by Hans F. had  
enough entries to qualify for a signed copy of James Edward G. II’s  
“Best of Ruby Q.” book.

Cool.

## Anyone aware of a Ruby-module for ICQ? (ruby-talk)

Groleo M. wanted to know if Ruby has any libraries for talking to  
ICQ.

Net::IM by Paul Vaillant will support the protocol in the future, and  
Francis C. has implemented Oscar/AOL (the AOL instant  
messaging  
protocol, including ICQ) in Ruby, and has it running on several large  
sites, but has not released the code.

In the end, Groleo decided to port the Perl library Net::Oscar to  
Ruby.

## [ruby-forum.com](http://ruby-forum.com) (ruby-talk)

[ruby-forum.com](http://ruby-forum.com) is a collection of web forums that are gateways to  
Ruby-related mailing lists. (Posts to the lists show up on the  
forums, and  
posts from the forums show up on the lists.)

Unfortunately, many users of the Ruby web forum apparently don’t  
realise  
their messages are sent to the ruby-talk list, so they do things  
(like not  
quoting messages) which make perfect sense on a web forum, but cause  
inconvenience for everyone else. In addition, posters from the forum  
are  
often newbies who ask questions that have been answered many times  
before.

Matthew S. suggests the forum have links to [ruby-doc.org](http://ruby-doc.org) and  
others,  
to encourage ruby-forum users to check the documentation before  
posting  
questions.

> […] I’m also of the view that the quality and tone of the  
> questions  
> from ruby-forum often leave something to be desired.
> 
> I have a hunch this is because google groups and mailing lists tend  
> to  
> be used by people who already know what they’re looking for, and  
> already  
> know where the docs live. I’d bet that a number of the people  
> posting  
> from the forum are probably not aware of all the resources  
> available to  
> them.

The thread turned into a discussion of how to read ruby-talk, which  
now  
receives over 4000 messages per month. (Eric H. linked to some  
code of  
his for using statistical techniques for selecting “interesting”  
posts.)

Dave B.: “Does anyone read all 4000 posts per month?” Austin  
Ziegler and  
Hal F. say they try. Your Ruby Weekly News editor reads almost  
every  
subject line 🙂

## How can I pin a Ruby object in memory? (ruby-talk)

A C extension question: in .NET your C code can’t simply store a  
pointer  
to a managed object, since the .NET garbage collector can move  
objects  
around in memory (the main implementation has a compacting garbage  
collector), so you sometimes have to wrap objects in a GCHandle,  
which is  
guaranteed not to move.

John L. asked if the same is required in Ruby C extensions. Minkoo  
Seo  
said no, since Ruby’s collector is not a compacting one.

(C extensions are allowed to depend on this fact. At least, objects  
referenced by VALUEs on the stack or in registers, or those  
referenced by  
rb\_gc\_mark in C extensions, are guaranteed not to move. It would be  
possible in the future to change Ruby to use a partially-collecting  
garbage collector that could move objects not referenced by C  
extensions.)

Mauricio F. also posted some information on navigating the  
source  
code of the Ruby interpreter.

## Serious YAML bug (comp.lang.ruby)

Frantisek Fuka found a bug with YAML in Ruby 1.8.4 (2005-12-24)  
shipped  
with his Dapper Drake Linux distribution (Ubuntu) where it is limited  
to  
reading files \< 4096 characters long.

ts said the bug is fixed with more recent versions of 1.8.4 that you  
can  
download from CVS.

Francis H.:

> If you need to stick with YAML, I’d recommend getting Ruby from CVS  
> head; it’s supposed to contain a newer version of Syck. If you can  
> get  
> away with it, though, I’d suggest using Marshal instead. It’s less  
> cool  
> than YAML, but pretty solid otherwise.

## Problems with rb\_struct\_define and 64 bit Ruby (ruby-talk)

ts: “Well, the architecture x86\_64 was created to make in sort that C  
programmer understand the difference between (int)0 and (void \*)0”.

Read this thread if you don’t think there’s a difference, or that it  
doesn’t matter.

## Modules / Documentation / CPAN like repository?? (ruby-talk)

Paul D. Kraus wondered if Ruby has an equivalent to perldoc - a  
command-line tool for displaying documentation information on  
standard  
libraries as well as those installed separately.

James Edward G. II said that ri is the Ruby command, for example  
“ri Find” or “ri String#split”. He noted that documentation is not  
always automatically installed for Ruby, or for third-party  
libraries.  
“If you build from source, it’s important to make install-all.”

James B. added that [ruby-doc.org](http://ruby-doc.org) has online documentation.

## Calling a Class Method with a class name (comp.lang.ruby)

This thread (and a couple of others), asked how to get a class from  
its  
name, without using eval(class\_name). The solution is  
Object.const\_get(class\_name). If you’re using Rails, you can also use  
class\_name.constantize, which has the benefit of working even when  
class\_name is e.g. “A:🅱:C”.

## Running Coach (#82) (ruby-talk)

Ruby Q. this week is inspired by Benjohn B. and his  
girlfriend’s  
jogging programme, which includes periods of jogging, brisk walking  
and  
resting.

“I was explaining to a friend that it’s incredibly difficult for me  
to  
look at a stop watch and work out in my head if we’re supposed to be  
jogging or walking, how many more jogs we’ve got to do, and when I  
can  
stop and rest. He suggested: `why not tape yourself giving prompts  
about  
when to start and stop’.”

Being programmers, we should of course automate this.

> Write a program to create the tracks for each of the eight weeks.  
> Make  
> it give helpful and enthusiastic advice like “you’ve got to run for  
> another minute / 30 seconds / 15 seconds …”, “walk now for two  
> minutes, you’ve got three jogs left”, “you’re on jog 2 of 6”, or  
> “well  
> done, that’s your last jog. Don’t forget to cool down and stretch!”

## ruby qt (comp.lang.ruby)

Shea M. asked if the Ruby/Qt bindings were unmaintained, since  
all the  
references to it are old, but Richard J. Dale explained that it’s due  
to a  
name change:

Bindings for Qt1 and Qt2 were called Ruby/Qt, while the Qt3 and Qt4  
bindings are called QtRuby. The latter is complete and is actively  
maintained.

The book “Rapid GUI Development with QtRuby” was also recommended.

## Which encoding causes fewest problems in Ruby 1.8.2? (ruby-talk)

Jim S. wants to know which string encoding works best with Ruby:  
UTF-8,  
ISO-8859-1 or ISO-8859-15.

Matz said that all of them will work (with the appropriate -K? option  
to  
set the encoding), but for UTF-8 you need to be careful when doing  
character-based operations (length and indexing) - use Regexp-based  
methods for these instead of String ones.

(For example, String#length may return an incorrect value for a UTF-8  
string, but mystring.split(/./).length returns the correct value.  
Future  
Ruby releases will have better support for different encodings.)

## Set minimum for random number generator (comp.lang.ruby)

In Python, random.randint(min, max) returns a random integer between  
min  
and max (inclusive). OrganicFreeStyle asked what the Ruby equivalent  
to  
this is. “Rand allows you to set the max, but what about the min?”

ZeD replied: min + rand(max-min)

That’s the exclusive form; you need min + rand(max-min+1) to include  
the  
maximum in the possible range of values.

There have been discussions in the past about having a Range#rand  
method  
that would behave sensibly for a range of integers. For example,  
(1…10).rand would return an integer between 1 and 10 inclusve if the  
following code was defined:

class Range  
def rand  
min + Kernel.rand(max-min+1)  
end  
end

(The above naïve version won’t work with ranges of anything other than  
integers - not even floats.)

## Creating a future date (comp.lang.ruby)

How to create the date for a year from today? JimC posted a nice  
solution  
that uses Date#\>\>(n), a method that shifts a date by n months.

require ‘date’  
next\_year = Date.today \>\> 12

## Getting a list of Processes (ruby-talk)

Ways of getting a list of running processes in Windows: use the  
`sys/proctable' library, or use win32ole and `winmgmts’.

An example of the latter was given by Brad:

def get\_process\_info()  
procs = WIN32OLE.connect(“winmgmts:\\.”)  
procs.InstancesOf(“win32\_process”).each do |p|  
puts p.name.to\_s.downcase  
end  
end

## I love Ruby - But how bright is Ruby’s Future? (ruby-talk)

A poster asks about Ruby’s future - are lots of people using it, will  
it  
be maintained, has he made the right decision in starting to learn  
Ruby.

Jim F. said “stay tuned, you have made a good choice”, and asked  
if  
he’d noticed all the press lately (particularly around Rails). Linux  
Journal (cover), Dr. Dobbs (cover), Business Week, Wired, Newsweek,  
and so  
on.

“The press hype may die down, but the infrastructure that is being  
built  
(and the fact that people like the language) pretty much secure  
Ruby’s  
existence for some time to come.”

Many posts in the thread say that it’s worthwhile learning new  
languages,  
regardless of their popularity, and others discuss the corporate  
acceptance (and acceptability) of Ruby compared with Python.  
(Coverage in  
business magazines certainly helps.)

## reading data from excel (ruby-talk)

Parvinder G. wants to read data from Excel files using Ruby, and  
was  
recommended to either use Win32OLE to get Excel itself to read the  
files,  
or to use the `parseexcel’ library.

## EURUKO 2006 (ruby-talk)

Stephan Kämper pondered the location for EURUKO 2006 (European Ruby  
Conference), saying he would quite like Hamburg or Copenhagen, but  
wouldn’t mind Munich again.

Others “voted” on these locations, with Tim B. adding Köln (Cologne)  
as an option, and Laurent S. suggesting Brussels, noting that  
FOSDEM (Free and Open Source Developers European Meeting) is  
successfully  
held there every year.

Robert K. said the location will ultimately be up to whichever  
person  
or organisation makes the effort to organise it.

# New Releases

Releases this week include …

## DRMAA for Ruby (ruby-talk)

“DRMAA is an interface standard for job submission and control to  
Distributed Resource Manager (DRM) systems such as Condor,  
PBS/OpenPBS/Torque, Platform LSF, Sun’s N1 Grid Engine and others.”

Andreas Haas created DRMAA bindings for Ruby (with Ruby/DL).

## Ruby-GetText-Package-1.6.0 (ruby-talk)

Masao M. released a new Ruby-GetText-Package (a localisation  
library  
and tool similar to GNU gettext - it assists developers in creating  
programs that can output messages in different languages).

Chinese (zh\_CN) and Italian (it) translations are now included, and  
the  
management of textdomains is improved.

## RbYAML 0.2: Pure Ruby YAML 1.1 parser and emitter (ruby-talk)

The pure-Ruby YAML parser and emitter, RbYAML, had a major release,  
with  
performance improvements, better test cases, bugfixes and more.

## Mongrel Pre-Release 0.3.13 – Katana Suicide Concurrency (ruby-talk)

A Mongrel pre-release (Mongrel is a web server for Rails, Camping and  
Nitro web applications) was announced by Zed S… The official  
0.3.13  
will be out soon, and will be followed by 0.4 (aka “Enterprisey  
Edition  
1.2”).

## Ruby Reports 0.4.5 (ruby-talk)

Ruby Reports 0.4.4 and 0.4.5, the “Hey, I’ve got a brand new  
formatting  
engine” and “Arbitrary Additions to DataSet” editions were released  
by  
Gregory B…

Ruby Reports is a 2006 Google Summer of Code project, and Gregory is  
aiming to have a release every 10 days for the rest of (Northern  
Hemisphere) summer.

Acknowledgements: “Dudley F. for his excellent work on DataSets  
in  
this release.”

## Madeleine 0.7.3 (ruby-talk)

“Madeleine is a Ruby implementation of Object Prevalence: Transparent  
persistence of business objects using command logging and snapshots.”

This release fixes a win32 bug introduced in the last. “The other  
news is  
that we’re moving to Rich Kilmer’s basement, i.e. RubyForge, so  
update  
your links!”

## rubyrss-1.0 (ruby-talk)

RubyRSS is a new tool for parsing and generating RSS feeds. Kouhei  
Sutou  
noted that it is similar to RSS Maker, which is part of Ruby’s  
standard  
library.

## FreeRIDE 0.9.6 - The Free Ruby IDE (ruby-talk)

Laurent J. announced a bugfix release of FreeRIDE.

“FreeRIDE aims to be a full-featured, first-class IDE on a par with  
those  
available for other languages, with all the best-of-breed features  
that  
you would expect in a high-end IDE.”

## ruby-prof for windows (ruby-talk)

Charlie S. ported Shugo M.'s fast Ruby profiler “ruby-prof” to  
Windows, including a binary for easy installation.

“ruby-prof is a code profiler like the built-in ruby profiler but is  
orders of magnitude faster.”

## slave-0.0.1 (ruby-talk)

Ara.T.Howard issued the first slave release, a library for creating  
master-child processes that communicate via DRb, with heartbeat  
monitoring.

“The purpose of Slaves is to be able to easily set up a collection of  
objects communicating via drb protocols instead of having to use  
IPC.”

## rq-2.3.3 (ruby-talk)

“ruby queue (rq) is a zero-admin zero-configuration tool used to  
create  
instant unix clusters.”

Ara.T.Howard fixed some bugs, added the ability to dump  
stdin/stderr/stdout and made `rotate’ more robust.

---

<div class="post-metadata">

**Author:** ![weliwarmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@weliwarmer](https://www.ruby-forum.com/u/weliwarmer)\
**Post date:** [June 14, 2006, 4:18pm UTC](https://www.ruby-forum.com/t/ruby-weekly-news-5th-11th-june-2006/63344/2 "2006-06-14T16:18:26Z")

</div>

Tim S. wrote:

> The original debug/fix/continue idea is a good one though. It would be  
> worth looking into the various Ruby debuggers out there. Perhaps the  
> ruby-talk readers have some ideas? (It’s worth raising awareness that a  
> lot of programmers are coming to Ruby through Watir.)

I’d really like to do this with ruby-breakpoint. Having it automatically  
issue a breakpoint when a Test::Unit test fails. If things go as planned  
you will then be able to use the GUI client to fix things. I’m just not  
yet sure if editing the code (and saving it back to the disk) and  
continuing executing the code just after the breakpoint will be  
possible. I think it might be possible with redo and a trace\_func that  
skips over code, but I’m not yet 100% sure.
