13th - 19th February 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.
Articles and Announcements
- Rubuntu LiveCD I need vim/emacs configs!
- russian RUBY forum
Ezra Zygmuntowicz is putting together a Linux LiveCD called Rubuntu, that is Ruby and Rails centric.
What I really need some help with is killer ruby configs for vim, emacs and jedit. And anything else you would like to see included, please drop me a note and any pointers you have for configuration that would be best suited for this.
A Russian-language Ruby forum was announced by an anonymous person, and Michael Shigorin noted a Russian mailing list that has been around since 2002.
Threads
SAFE levels
During a discussion on tainting, David Vallner posted output from an irb session, including
irb(main):005:0> foo % "bar" => "bar\n" irb(main):006:0> _.tainted? => true irb(main):007:0>
He was asked what the ”_” was about, and replied “irb automatically populates the _ variable with the result of the last line executed. __ is two lines past, ___ three lines past.”
You actually need to set an option in ~/.irbrc to enable this, see Irb/TipsAndTricks on the Rubygarden wiki for the details.
neuroimage software - scientific computing and visualization
Darren L. Weber asked about Matlab vs Ruby for scientific programming.I’m looking at Ruby for scripting/programming of scientific computing for neuroimaging. This includes time-series plots and analysis, image volume segmentation and rendering, surface modeling, visualization and morphing, and animating scalar and vector quanities on surfaces. Also linear algrebra methods and spatial transformations, almost any scientific computation you can imagine, especially large scale statistical analysis (including permutations).
There was a chorus of people saying Matlab is better for this area. Chris noted that Matlab is expensive, while Ruby is free, so if you can’t afford it, or just want to use open-source software, you should use … Octave, “the open source equivalent to Matlab”.
Darren himself listed some useful links for scientific programming in Ruby; NArray library’s homepage, Ruby/GSL library’s homepage and SciRuby.
couple quick questions about YARV
Joshua Haberman said “I know YARV is far from finished,” but what is the likely startup cost, and will existing Ruby extensions work?
Matz posted startup times for ruby1.8 and ruby.yarv. 0.009s vs 0.006s. i.e. no increase in startup cost.
He also said that Ruby extensions can work currently, but “No promise for the future.”
stijn asked, as long as we were discussing YARV, how much speedup could be expected. “I’ve seen Koichi’s slides and they look impressive but if I am not mistaken the optimizations looked to be concerned with basic math operations and so on.”
Matz: “YARV runs much faster on calls and basic operations. But it runs slower on eval()’ing. Ko1 is now working on it, I think.”
David Vallner wondered if this might just discourage people from eval(”...”), so they use define_method etc. instead.
“Is something like smalltalkish “clean” blocks being pondered to make calls like define_method less prone to leak memory keeping local scopes from being GCed?”
Garbage collection schemes were also mentioned.
OT: Is this worth a try?
gregarican asked how people felt about the Eiffel language. Is it worth learning?
Jim Weirich:
I played around with Eiffel for 3 years before switching to Ruby. In 6 months I wrote more Ruby code than in the entire 3 years of Eiffel. Productivity is way higher in Ruby.
However, the concepts learned in Eiffel were valuable for me. No, you are probably not going to land your next big job because you know Eiffel, but learning to use Eiffel well will help you write better code in any OO language, IMHO.
There was some discussion of Eiffel’s design-by-constract features by “twenty closet Eiffel freaks” (wrote Logan Capaldo with a smiley), and David Vallner said that Eiffel is the “prime example of a bondage and discipline language. Which you might or might not like”.
Guido Kollerie noted that the Arachno Ruby IDE is written in Eiffel.
Adam Sanderson suggested learning Io instead.
From the website, “Io is a small, prototype-based programming language. The ideas in Io are mostly inspired by Smalltalk (all values are objects), Self (prototype-based), NewtonScript (differential inheritance), Act1 (actors and futures for concurrency), LISP (code is a runtime inspectable/modifiable tree) and Lua (small, embeddable).”
Adam:
It took me a few hits on their site before I really looked at it, and then a little longer to appreciate it, but once I did, wow.
Each language allows a different framework for solving a problem, and will enrich your understanding of all other languages through the similarities and differences.
Writing Secure Web Services
Scott asked about creating a secure (encrypted / authenticated) web service in Ruby.
Roland Schmitt:[an] idea is using wss4r with ActiveWebService. You can then encrypt and/or sign the requests/responses from both client and server. WSS4R uses certificates for signing and encryption. Another advantage is that it is conform to some web service specs, so you can use other clients like java or .NET.
(wss4r is a Ruby implementation of the WS-Security standards, and built on top of soap4r. Roland created wss4r.)
ActiveRecord or OG?
“Avid lurker” jansenh asked for advice on which ORM (object-relational mapper) to use: ActiveRecord (as used in Rails), or Og (as used with Nitro).
The application was a web service that deals with data coming in, stores it in a database, applies business rules etc.
One obvious answer might be: “Try both…”, but I dont have the capacity to do that.
James Britt: “Well, you probably do. They are both pretty straightforward to use.”
Wilson Bilkovich gave a great rule-of-thumb:
One way to decide is by choosing which of these two statements seems more ‘right’ to you.
1. Ruby objects are wrappers around rows in my database.
2. The database is where my Ruby objects go when they are sleepy.
#1 is ActiveRecord, #2 is ObjectGraph.
New Releases
Ruby GUI Debugger
mitchell created Mr. Guid, a GUI front-end to Ruby’s built-in debugger, using Ruby/Gtk2.
It already supports all the features of the underlying debug library, and looks very nice and usable.
FYI, “Mr. Guid” is a pseudo-acronym for Mitchell’s Ruby GUI Debugger.
Weft QDA 1.0.0 released
Alex Fenton announced the 1.0.0 release of Weft QDA, an “open-source tool for analysis of textual qualitative data”, for social anthropology, sociology, etc.
“It can and has been used successfully for a wide variety of real-life research projects. it’s particularly suitable for teaching and learning CAQDAS (Computer-Assisted Qualitative Data Analysis)”.
lazy.rb 0.9.5 -- transparent futures!
MenTaLguY introduced a new version of lazy.rb, featuring thread safety and “transparent futures”.
As well as the usual delayed evaluation:
x = promise { 3 + 5 } # in practice, some slow algorithm
p x # => #<Lazy::Promise computation=#<Proc:...>>
p x * 3 # => 24
p x # => 8
there are now ‘futures’, which are “blocks of code that are evaluated immediately, but in a background thread.”
x = future { 3 + 5 }
# all the while the block is being run in the background
do_something_else()
# below will wait for the value to be ready
p x * 3 # => 24
“Again, silly for 3 + 5 perhaps, but I’m sure you can see how this might come in handy for more involved computations.”
Ruby/DBI 0.1.0: Not Dead Yet
Francis Hwang: “After a long, deep slumber of more than 18 months, Ruby/DBI awakens and lumbers forward into the countryside. Rise, Ruby/DBI, rise! Strike terror deep in the hearts of Rubyists everywhere! Ahem.”
Michael Neumann has handed off the reins to Daniel Berger, Kirk Haines, Patrick May, and myself. This first release is fairly modest, cleaning up a few small bugs and doing lots of behind-the-scenese reorganization.
SwitchTower 1.0.0
Jamis Buck announced SwitchTower 1.0.0, “a utility that can execute commands in parallel on multiple servers.”
An example use is for deploying a Rails application, especially if it is split over multiple servers.