http://www.rubygarden.org/ruby?RubyNews/2005-02-07
Ruby Weekly News 7th - 13rd 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).
Articles and Announcements
--------------------------
* [[WANTED] Feedback and developers for Win32 Utils]
Daniel Berger announced that the "Win32 Utils Team is looking for
a little help". Firstly, input from people using Ruby on Windows as
to which functionality needs to be added. Secondly, they're looking
for developers who can help with writing interfaces to the Windows
API. Example projects to be done are adding image support to the
win32-clipboard package and writing a port of the Win32::Screenshot
Perl module.
* [raleigh.rb February Meeting]
Nathaniel Talbott reminded Rubyists in North Carolina that the
Raleigh-area Ruby Brigade (raleigh.rb) are having another user
group meeting on the 10th of March.
* [extra Seattle.rb meeting]
In other user group news, pat eyler announced that there's an
extra Seatte.rb meeting coming up in a different location from
usual. "Since there are some Seattle.rb folks who live south of
Seattle, we've decided to get together for a hacking
session/meeting in Kent this Saturday."
* [Ruby developers in Argentina]
Michel Martens would like to be able to get in contact with Ruby
developers in Argentina, and encouraged them to sign up at the
BuenosAiresGroup wiki page.
Quote of the Week
-----------------
Jeremy Henty [sputtered] "Look, I'm *not* addicted to Ruby! I could give
up writing Ruby code any time I wanted to, just like that! I just don't
*want* to!"
Threads
-------
Interesting threads this week included:
[Stopping a thread]
-------------------
Bill Atkins had an instance variable @thread that referred to some Thread.
He wanted to know how to stop @thread from the main thread. Assaph Mehr
said that @thread.kill was what he wanted.
[a Ruby pdf writer that supports images]
----------------------------------------
Artotoy has a website that produces invoices as PDFs, using PDF::Writer,
but recently discovered that PDF::Writer seemed not to have support for
images.
Dan Fitzpatrick said that he was working on porting the PHP FPDF library
to Ruby. It was working for simple cases but needed a few weeks to work
out the bugs and add more advanced features.
Fredrik Jagenheim pointed out that the CVS version of PDF::Writer did have
support for images, through a method add_jpeg_from_file. The library's
author, Austin Ziegler, just hasn't got around to releasing a new version
yet.
[How come this doesn't work as expected?]
-----------------------------------------
Chris Gehlker was curious as to why the code
"testAry = testAry.each { |n| n.to_i }"
didn't modify testAry. Several people explained that each just
returns the original receiver and does not keep the block return-values
around. map (a.k.a. collect) should be used instead.
[Object#to_ruby and Object#to_c]
--------------------------------
Ben Giddings saw [a post] on the Ruby blog [RedHanded] that he thought was
interesting. (That post quoted Ryan Davis' blog, so you're now reading
this fourth-handed: a summary of a post that pointed to a blog that quoted
another blog that actually said something.)
It shows how ParseTree and RubyToC can be used to add to_c and to_ruby
methods to any Method. For example,
class Example
def example(arg1)
return "Blah: " + arg1.to_s
end
end
e = Example.new
puts(e.method(:example).to_ruby)
results in
def example(arg1)
return "Blah: " + arg1.to_s
end
[access to process list]
------------------------
Sven Bauhan wanted to get a list of system processes from within Ruby and
wondered if there was a better way than "proclist = `ps ax`". Daniel
Berger said that a library called sys-proctable is available for this.
[Performance of CGI::Cookie]
----------------------------
benny found that his web application was three times slower when
CGI::Cookie was used. He discovered a post on ruby-talk that linked the
problem to the CGI::Cookie's use of SimpleDelegator. Matz said that the
fix would be merged into Ruby 1.8.3. The patch is as simple as
- class Cookie < SimpleDelegator
+ class Cookie < DelegateClass(Array)
The reason for the big performance difference is that with
SimpleDelegator, every time you create an instance of Cookie it has to
define all the delegated methods on itself. In comparison,
DelegateClass(someClass) defines these methods just once.
[[SUMMARY] Solving Tactics (#18)]
---------------------------------
James Edward Gray II summarised last week's [Ruby Quiz]. The problem was
to take a simple board game and determine who would win if both players
chose optimal moves: the first player or the second.
From the [original quiz description] by Bob Sidebotham, "There's a little
pencil and paper game, Tactics, played on a 4x4 grid. The play starts with
an empty grid. On each turn, a player can fill in one to four adjacent
squares, either horizontally or vertically. The player who fills in the
last square loses."
They key optimisation in the solutions was to recognise that since squares
are either "on" or "off", the board state can be represented as a 16-bit
integer. That means there are only 65536 board we need to consider. The
rest of the solution simply determines which boards will result in
eventual wins for the first player and which will end in eventual losses.
(It uses the "dynamic programming" algorithmic technique.)
[ruby-dev summary 25481-25641]
------------------------------
Kazuo Saito summarised the Japanese list ruby-dev. One of the items was
about the process of merging the Ruby/DL2 library into Ruby 1.9.
[Amazon + 43Things]
-------------------
martinus heard that Amazon was investing in [43 Things], a website well
known to many in the community for its use of the [Ruby on Rails] web
framework. If you've seen recent news articles about Amazon investing in a
"blog site", this is the site they're talking about.
As Tobias Luetke observed, "[t]he future of Ruby on Rails is indeed bright
on so many levels its not even funny".
[[QUIZ] Yahtzee (#19)]
----------------------
James Edward Gray II posted this week's [Ruby Quiz]: to make a game that
plays the game "Yahtzee" dice game.
For those looking for an extra challenge, adding an AI player or
implementing "Triple Yahtzee" were suggested.
[A Ruby-relevant quote from Alan Kay]
-------------------------------------
Curt Hibbs quoted Alan Kay (the creator of Smalltalk) in a recent ACM
Queue interview: "Even if you're designing for professional programmers,
in the end your programming language is basically a user-interface design.
You will get much better results regardless of what you're trying to do if
you think of it as a user-interface design."
Curt felt that this was the approach Matz took in designing Ruby.
PA posted an old [page] that quotes some tongue-in-cheek comments by Steve
Wart on "why Smalltalk never caught on". Also on the page was the
following quote
"
>So, yes, in Smalltalk you can definitely dig your own grave.
>But you can also climb out of it.
>At least Smalltalk gives me a shovel and ladder.
I'm not sure that's a good metaphor. It conjures up images of an army of
once-dead Smalltalk zombies digging themselves out of their graves and
terrorising the Land of the Statically Typed.
"
New Releases
------------
* [LXL (Like Excel) 0.2.0 - A mini-language that mimics Microsoft Excel
formulas]
* [LXL (Like Excel) 0.3.0]
Kevin Howe improved quoting and parsing in [LXL], an evaluator for
a language similar to that used for formulas in Microsoft Excel.
He later released version 0.3.0 which added some major new
features: namespaces, ranges, percentages and deferred function
calls. It is also now installable as a gem.
* [Net::SSH 1.0.0]
Jamis Buck released the one-dot-oh-dot-oh version of Net::SSH, a
library that implements the SSH2 client protocol. Some bugs were
fixed, and the project is now in maintenance mode, with no new
features planned.
* [Daemons 0.0.1: control your daemon scripts with start/stop commands]
Thomas Uehlinger was "proud to release the first version of
Daemons", a tool that allows you to run Ruby scripts in the
background, providing commands to start, stop and restart them.
* [Syck 0.50 -- The new YAML is here for testing]
why the lucky stiff announced that the new Syck branch is ready
for testing. This is a library for dealing with the YAML markup
format. It's several times faster than the old version, and _why
expects that there will be no major API changes between now and
the 1.0 release. "Finally, I can go back to drawing ponies out on
the bridge by the old reservoir..."
* [rubydium 0.3 and nanovm 0.1]
Alexander Kellett released a complete rewrite of the first
rubydium - it is now aiming to be a fast Ruby interpreter written
in Ruby.
* [Recipe Browser 0.4]
Belorion rewrote his Recipe Browser to use the [Rails] web
framework.
* [RedCloth 3.0.3 -- Humane Text for Ruby]
why the lucky stiff put out some small fixes for RedCloth, a
library that processes the humane text-formats Textile and a
Markdown-subset into XHTML (and soon LaTeX and PDF). "Humane" text
formats are those often used in Wikis, forums and blogs to allow
people to write text that ends up formatted without having to use
ugly tags (for example, many humane formats turn '*foo*' into
bold-text 'foo').
* [Announcing a respawned rcairo]
Øyvind Kolås announced Ruby support for Cairo, "a resolution and
device independent vector graphics drawing library, which provides
a postscript like drawing model".
* [ParseTree 1.3.4 Released]
Ryan Davis released a new version of [ParseTree], a "little brown
stinky ferret that digs down a hole and violently rips the AST
away from the warm bosom of ruby" (to [quote] Ryan in another
thread). In other words, it extracts the parse-tree for a class or
method from the Ruby interpreter and returns it as an s-expression
using Arrays, Strings, Symbols and Integers. A couple of bugs were
fixed in this release.
* [Samizdat RDF Storage 0.1]
Dmitri Borodaenko announced the first release of Samizdat RDF
Storage as a stand-alone library. It provides optimised storage of
RDF data in relational databases.
* [Numeric Integration Library (calculus, analysis)]
beng released a new library for doing numerical integration of
single-variable functions. It includes several different
integration methods, including Simpson's, Monte Carlo sampling,
Gauss', Adaptive Quadrature, and Romberg's.
* [RubyTorrent 0.3 (beta)]
William Morgan was "happy" to announce the first beta of
RubyTorrent, a peer library for BitTorrent.