27th March - 2nd April 2006
Ruby Weekly News is a summary of the week’s activity on the ruby-talk mailing list / the comp.lang.ruby newsgroup / Ruby forum, brought to you by Tim Sutherland.
Dear readers,
Sorry about the lack of updates over the last month and a half. The good news is that normal service will be resuming, starting with a newsletter for 22nd – 28th May. Thanks for your understanding!
- Tim Sutherland
Articles and Announcements
- Italy on Rails - First Europe Ruby on Rails Conference
- Article: An Exercise in Metaprogramming with Ruby
- Brazilian Portuguese Ruby Book
- Ruby and RoR Book Roundup
Nathaniel Brown announced the first Ruby on Rails Conference in Europe. It will be held in Rome in late 2006, and run by Open Source Path.
Hal Fulton wrote an article in February called An Exercise in Metaprogramming with Ruby, but neglected to post a link to it on ruby-talk.
My editor said it “didn’t do that well” in terms of page views. And I said, well, I should have posted it to ruby-talk. And she said: Do that now, and we’ll see what effect it has.
So there you have it. No bots or artificial inflation, please. ;)
The article was well received by the group.
Eustaquio Rangel de Oliveira J announced his Brazilian Portuguese Ruby book, to be released on April 5.
The book was added to the RubyGarden RubyBookList page.
Com um texto orientado para quem já programa em alguma outra linguagem, este livro apresenta exemplos claros que podem ser facilmente assimilados, servindo de guia para o conhecimento e aprendizado da linguagem Ruby.
Rob Sanheim, “a big bookworm”, put together a list of Ruby books coming up in 2006.
User Group News
- The San Diego Ruby Users Group lives!
- Ruby Social Club - 1st April Milan Meeting
- April Meeting of the Phoenix Ruby Users Group
Daniel Amelang claimed that the San Diego Ruby Users Group lives! “After some false starts, we’ve decided to do this thing for real now. Calling all San Diego Rubyists!”
Chiaro Scuro: “The Ruby Social Club is getting up to speed and spreading fast. After the first two meetings in Rome we are going to meet up in Milan on the evening of saturday the first of April.”
James Britt announced that the Phoenix Ruby Users Group will be meeting on April 10, and will likely discuss new features in Rails 1.1, and old features in Ruby’s built-in unit testing library. “And I’m sure we’ll make stuff up as we go.”
Quote of the Week
- Blixy Tee Bus Stop
So I was wearing my chunky bacon Blixy Tee http://www.cafepress.com/blixytees.10116504 at the School bus stop the other day, and my son (5yrs) gets up on his tip toes and starts trying to read foxspeak: "Chunky?... bacon? Chunky Bacon... Come on, seriously... Chunky. Bacon. Chunky Bacon. [repeated ad nauseam]" Pretty soon all the kids were chanting. It was fun. Thanks Why, Bil Kleb
Threads
ruby-dev summary 28274-28600
Furuhashi Apuri summarised the Japanese mailing list ruby-dev, which had ideas around regexp named captures, __method__ to hold the name of the currently executing method, and a proposal for multi-method support.
The latter would allow you to write
class Bar
def foo(String x)
"a string"
end
def foo(Integer x)
"an integer"
end
end
b = Bar.new
b.foo("hello") # -> "a string"
b.foo(5) # -> "an integer"
The String or Integer or … is just anything that has an === method. “Matz said he agrees and this can be committed to 1.9 if it is fast implementation.”
Update 2006-04-05: Mauricio Fernandez points out that this is an April Fools joke. Doh!
Ruby Goes to the Sun
April Fools’ jokes. Hansson’s getting the band back together. Mmmbop.
Testing DiGraph (#73)
Robert Feldt posted this week’s Ruby Quiz.
“In this week’s Ruby Quiz you will not only have fun and (hopefully) learn something; you will also contribute to a research project evaluating automated testing techniques. So please read on and then take the quiz!”
“The goal of this quiz is to write a good and extensive test suite for a Ruby DiGraph (directed graph) class.”
WIN32OLE#[] and WIN32OLE#[]= method in Ruby 1.9 (or later)
Win32OLE author Masaki Suketa said he was considering changing the behaviour of WIN32OLE#[] and WIN32OLE#[]= “in Ruby 1.9 or later.”
“I have not commited the change yet. Before commiting it, I want suggestions or opinions from Win32OLE users.”
Currently, [] and []= map to method calls, so that excel.visible = true and excel['visible'] = true are equivalent. The change is to make them act on properties, so you can write code like worksheet.cells[1,2] = 10.
Excellent! This makes a lot more sense than the existing function of [] and []=.
When I first used WIN32OLE, I was surprised that you couldn’t use [] to access index operations.
Rails 1.1
In a thread noting the release of Rails 1.1, Jim Weirich commented “The CVS head of rubygems will do incremental downloads of the index file. We are working out the details of testing this on a large site like RubyForge.”
This will greatly improve the speed of the “Updating Gem source index” action when installing or upgrading gems.
Ruby Black Belt
Dmitry Buzdin posted a draft Ruby exam, having decided to create a Ruby equivalent of JavaBlackBelt.com.
“What we need is a feedback of experienced Ruby enthusiasts (means You).”
James Edward Gray II posted a list of errors in the draft exam, while Justin Collins asked what the purpose of the exam was, given that previously “most people expressed a strong dislike for anything resembling Ruby ‘certification’.”
Dmitry: “What we are talking here about is a bit different, than traditional certification. The main purpose is learning. You pass the exam and see that You don’t know some answers.”
Listrecv: “One of the problems I’d have with a certification of this sort is that it focuses only on the least important aspects of the language - syntax, nomenclature, conventions, etc.”
Peter Szinek mentioned The Python Challenge – a set of programming riddles where you must apply some Python programming techniques to advance to the next level.
I came to know a LOT of non-programmers through python challange – i have been mailing on a (nearly) dayly basis with an US (non programmer) girl (i think se was a lawyer) up to the 18th or something level. When she begun she did nothing about programming at all, after 1 week he has been posting about regexps, after 2 weeks about bzip2 from python, after 3 weeks cookies and HTTP, well you get the idea… She was really enthusiastic to learn this stuff (which is IMHO not typical for a non technical person) just to see the next screen… And she was not the only one…
This made Bill Kelly think of _why’s Try Ruby! web-based interactive interpreter. It has an on-line tutorial where you type code into your web browser and see what happens.
Pistos Christou: “I tentatively agree with the others about official certification, but this idea of some sort of online interface that covers all (or many) of the features, tools, libs, etc. of Ruby in an interactive, educational fashion sounds appealing.”
Ruby Quiz was mentioned several times as a resource for improving your Ruby skills.
Calling R from Ruby
AlexG created a simple bridge between Ruby and R (a statistical package / language), allowing him to use R libraries from Ruby.
The thread also discussed advantages and disadvantages of using either of the languages over the other, for example R has a fast matrix library (but so does Ruby, via NArray), R is “Procedural, with highly limited function support”, but
Au contraire! R is at heart a functional language with a Lisp ancestry! What’s different about R (and S) is two different ways of doing objects and classes, neither one of which is remotely like a Java or Ruby programmer’s idea of objects and classes. [M. Edward Borasky]
Going back to the original topic, Thomas said that if you’re on Windows then you can access R through Win32OLE.
Round floats to N decimal places?
Pat Maddox:I’m doing some math that results in floats with ~10 decimal places, but I’d like to round them to 2 places. Is there a built in way of doing this? Right now I’m doing format(”%0.2f”, the_float).to_f, which seems to work fine but it seems like an ugly way of doing it.
Dave Burt said that the Facets project defines Numeric#round_at(d) and Numeric#round_to(n) methods for this purpose, and suggested that Ruby’s built-in Numeric#round method be altered to accept an optional parameter for degrees of rounding.
Karl Brodowsky suggested Pat take a look at the LongDecimal library, which is “specialized for doing calculations with a defined number of digits after the decimal point.”
B & E (#72)
Stephen Waits created (last) week’s Ruby Quiz – find the least number of security codes you need to try to break a system where the code passes whenever the last sequences of key-presses matches the codes, without any reset between.
Get the size in pixels for a string
Stéphane Thibaudeau asked how to get the pixel width and height of a string rendered with a particular font.
Chris Alfeld:
require 'tk'
f = TkFont.new('Courier 10')
width = f.measure("Hi There!")
height = f.metrics.assoc('linespace')[1]
New Releases
JRuby 0.8.3
Thomas E Enebo said that JRuby 0.8.3 was released. “JRuby is a project to provide a Java implementation of the Ruby language and interpreter.”
jirb now works, using Java classes from Ruby is “dramatically” faster, several important bugs were fixed and more.
Mongrel Web Server 0.3.12 -- Pre-Release
Zed Shaw: “Mongrel is due for a 0.3.12 release which will feature some pretty insane goodies for everyone. There’s talk of IOWA support, lots of speed improvements (including sendfile support), a great Configurator which makes configuring Mongrel a snap (especially for framework implementers), and a ton of debugging stuff.”
“DON’T CRY” (it’s a pre-release).
“Mongrel now has sponsorship from Eastmedia (http://www.eastmedia.com) in partnership with Verisign (http://www.verisign.com/) to make Mongrel fast and stable enough for enterprise class loads (meaning “gigantic”, not “Java style”).”
Rake 0.7.1
Jim Weirich put out a new Rake release, fixing a bug on Windows and adding a few features.
Instant Rails 1.1
Curt Hibbs announced Instant Rails 1.1 an update of the “one-stop Rails runtime solution containing Ruby, Rails, Apache, and MySQL, all preconfigured and ready to run”. Unsurprisingly, this release features Rails 1.1.
ZenTest 3.1.0
Ryan Davis exposed ZenTest 3.1.0, with updated versions of zentest, unit_diff, autotest and multiruby.
RJS, Active Record++, respond_to, integration tests, and 500 other things!
Hoho, it’s Rails 1.1.
“The biggest upgrade in Rails history has finally arrived. Rails 1.1 boasts more than 500 fixes, tweaks, and features from more than 100 contributors. Most of the updates just make everyday life a little smoother, a little rounder, and a little more joyful.”—David Heinemeier Hansson.
Ruby-FLTK 0.9.3
Jeremy Henty announced a new version of the Ruby-FLTK bindings, “Yes, it’s been a while!”.