3rd - 9th 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, with contributions by Christophe Grandsire.

A note from Tim: Over the last couple of weeks, there have been many posts on ruby-talk and (more-so) ruby-core concerning the pending addition of the RubyGems packaging system to the standard Ruby library.

A particular point of dispute has been around the role of people who package libraries and applications for other systems (such as RPMs or DEB packages), and the impact that even-more-popular RubyGems will have on this work.

(For example, the relative difficulty of repackaging a gem as a different type of package, versus starting from a tarball; how to deal with depdendencies when some libraries are installed via RubyGems, others by tarball, and others by RPM.)

The problem with popular topics is that they are also hard to summarise, and so often the most popular threads are ignored in the newsletter, while those with one or two posts are given attention. That’s happened with the RubyGems threads, with the exception of this meta-summary :-)

Articles and Announcements

  • Looking for book reviewers
  • Dave Thomas asked for volunteers to review the draft of Chris Pine’s book “Learn to Program with Ruby”.

    “However, before you all rush to sign up, there’s a catch. I’m really looking for folks who are the book’s target audience: folks with little or no programming experience who want to learn how to code. They’ll probably be from mid teens on up, curious, and happy to give honest feedback as they go through the book.”

  • ruby.codefetch.com offers API and books search
  • cosmo announced Ruby support for the Codefetch website. It now allows you to search for Ruby code contained in publically available source code from Ruby books.

  • Tutorial: Rails + RubyScript2Exe = Executable
  • Erik Veenstra had been getting a lot of emails from people asking how to package their Rails applications up as a single executable, using RubyScript2Exe.

    So he wrote a tutorial ...

    GROOVY Following the instructions, you can turn your app into an executable (on Windows, Linux or MacOS X). Run it, and the application runs, allowing you to connect to it from your web browser, all without the need to install Ruby, Rails, a database system or configure a web server.

User Group News

  • Beer & Pizza SIG; 8 pm, 10/4, San Francisco, CA, USA
  • Rich Morin announced a last minute meeting of the “Bay Area Ruby Beer & Pizza SIG”.

    Oops, it was on October 4th, so if you depend on the Ruby Weekly News for your user-group meeting announcements, then you missed it by at least a week.

  • Johannesburg, SA (and surrounding areas) Ruby Users Group
  • Luke Randall is guaging interest in setting up a Ruby Users Group in Johannesburg, South Africa.

    “[I]f you live in Jo’burg (or Pretoria, etc. and are willing to travel), please reply on or off list so that I can see how many people are interested, and we can hopefully get this started.”

  • Boston Ruby Users Group is tomorrow (Tuesday) at 7PM!
  • Boston.rb hold Ruby User Group meetings on the first Tuesday of every month.

    Greg Brown:

    I think it would be cool if UNH.rb (University of New Haven) took a field trip of sorts up to Boston for one of your meetings some time in the near future. What do you think? If it worked out well, maybe we could return the favor some time for your group and host you down here in Connecticut.

Link of the Week

  • Ruby Code & Style
  • Ruby Code & Style is a peer-reviewed, online journal for the Ruby community. We will focus on bringing a steady stream of high quality articles written by Rubyists all over the world which will showcase the strengths of this language and the ingenuity of its users in solving some real-life non-trivial problems.

    The editors are James Britt and Shashank Daté, and the journal also has an advisory board comprising many well known Rubyists, including Matz.

    “PS: Writers wanted. We’re looking for experienced Rubyists to write articles covering the sort of hard-core technical stuff that’s currently hard to find.”

    (See also the comp.lang.ruby announcement.)

Threads

Text Image (#50)

James Edward Gray II’s Ruby Quiz #50 was to create a program that converts images into ASCII-art.

Several people posted delightfully simple solutions that used the RMagick library to do all the work of reading the image, resizing it and changing the colour depth.

Ruby for Palm OS?

Brian Le Roy wondered if it is possible to run Ruby on Palm OS devices.

Matz said no, not with the current Ruby implementation, as it requires POSIX system calls that are not available on that platform. He recommended the Linux-based Zaurus instead for Ruby-on-small-devices.

New ruby-lang website?

Vincent Foley asked about the status of the ruby-lang.org website redesign – there was a flurry of activity at the start of the year, then silence.

Curt Hibbs reported:

It hasn’t disappeared. There has been sporadic progress over the past few months. The visual design was set and the recent efforts have been on implementing the design and populating it with initial content.

“I know that from the outside it just looks like nothing is happen, but please be patient.”

RubyConf2005Facebook page on RubyGarden wiki

Francis Hwang:

“Maybe I’m just vain and want everyone to see my face, but I thought it might be useful to have a publically viewable page of photos of people who are going to be at RubyConf this year.”

fun with splats

Martin DeMello posted some code that shows that the * (splat) operator works even when you might not expect it to.

class A
  include Enumerable

  def each
    yield :foo
    yield :bar
    yield :baz
  end
end

a = A.new
b = *a #=> [:foo, :bar, :baz] 

He explained that it does the right thing because * works by calling to_a, which is defined by Enumerable.

Neato.

select! not present but reject! is

Geert Fannes found it strange that Array#reject! exists, but Array#select! does not. Why is there this discrepancy?

Mark Hubbart gave a good explanation:

The english words “select” and “reject” are not opposites. “reject” and “keep” might be, as someone else suggested.

Going back, say you have a box of apples, some of which are shiny, the rest of which are dull. You don’t want the dull ones. If you say:

apple_box.reject! {|apple| apple.dull?}

..it sounds like you want to reject, or throw out, any dull apples, leaving only the shiny ones. The opposite would be:

apple_box.keep! {|apple| apple.shiny?}

..because you want to keep only the shiny ones. “keep” implies that the rest are not kept, and are thrown out.

On the other hand, if you said:

apple_box.select! {|apple| apple.shiny?}

It implies that you want to keep both; you remove the selected ones from the box, and leave the unselected ones behind.

(The name keep! was suggested by Jacob Fugal, who nonetheless thought that Array#select! should be included in the standard library. Jacob also introduced us to shiny apples.)

A similar argument was put forward by David A. Black, who felt that it is unnatural to associate “selecting” with a destructive operation. Matz agreed with this reason, but noted that Array#map! used to not exist for the same reason. “Now we have map! in Array class. Same thing could happen on select!”

David also mused about the possibility of a Array#delete_unless method, to pair with Array#delete_if.

There were almost fifty posts in the thread, with a mixture of views. (In spite of this summary focusing on those against adding the method.)

Much of the discussion was around the philosophy of ‘bang-method’s (those whose name ends in ’!’), with some proponents of Array#select! saying that (for Array at least), bang-methods are by convention simply in-place variants of their non-bang counterparts, and that intuitive arguments around the meaning of the word ‘select’ are therefore irrelevant – all that matters for select! is that it’s an alternative to select.

RubyConf video, audio, streams and recordings?

ES was sad.

Sadly, I cannot attend this year (I will send you pictures from my COBOL Retreat in the Rockies) but I sensed a definite lack of any firm understanding of the state of capturing the wonderful essences of rubydom on redistributable media?

Following some requests for help, and responses to the same, it was reported that mp3s of the sessions will be posted after the conference. Hurrah!

Can ruby replace c?

Q: Can Ruby replace the C programming language?

A: No. :-)

ruby-dev summary 27103-27392

Takaaki Tateishi posted the latest summary of the Japanese list ruby-dev.

The Santa Matz tradition is alive and well, with Ruby 1.8.4 due on December 24.

YARV Compile and Disassemble CGI

Son-shi Koichi Sasada created a simple web application to demonstrate YARV: enter Ruby code and bytecode comes out.

YARV is “Yet Another Ruby VM”; a humble name for a very important project that Matz says will be the VM for Ruby 2.0.

ActiveRecord and FXRuby..

Graham Foster wanted to know if there was anything stopping him using the ActiveRecord object-relational mapper library (popularised for its role in Rails) with an FXRuby GUI application?

David Naseby said that it would work, in fact he had used it in exactly this scenario.

I’ve built a beer brewing helper in FXRuby/ActiveRecord with a SQLite db to keep it all nice and file-y. No problems, no conflicts. Almost got to the stage where I built scaffolding, before I remembered I was building the program to help me brew beer, rather than brewing beer to help me program.

The only difference between using ActiveRecord inside of Rails, and using it outside, is that in the latter case you’d typically call ActiveRecord.establish_connection directly with the database connection information (such as driver, username, host, password), rather than relying on a config/database.yml file.

New Releases

Ruby Win32 Drag and Drop 0.5

Wayne Vucenic released “Ruby Win32 Drag and Drop” version 0.5, a Windows Explorer Drop Handler allowing one to drag and drop files and text onto a .rb program.

rctool-1.0.0

rubikitch released rctool 1.0.0, a library for projects that need to modify other programs’ rcfiles (such as .bashrc, .emacs).

Users are shown the changes that will be made to their files before going through with the alteration.

el4r-0.9.2 - EmacsLisp for Ruby

rubikitch announced the latest version of El4r, with which you can write Emacs programs in EmacsRuby instead of EmacsLisp.

Configuration is now automatic, it works in Windows, can be installed to any directory, and more.

Rake 0.6.2

Jim Weirich posted a small update to the Rake build tool. This version fixes a compatibility problem with Rails projects.

Ruby for Rose RealTime v0.2.0

Damphyr introduced “Ruby for Rose RealTime”, a library that enables you to access models in IBM Rational Rose RealTime on Windows.

KirbyBase 2.3 beta 2

Jamey Cribbs announced beta2 of KirbyBase, a pure-Ruby database management system that stores its data as plain-text files.

Changes include a new YAML column type, automatic use of indices when they exist (resulting in queries being much faster in some cases), and bug fixes.