T
Tim Sutherland
Ruby Weekly News 28th March - 3rd April 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.
Articles and Announcements
--------------------------
* TRUG 3 April 2005 Meeting
Mike Stok announced that the Toronto Ruby User Group was having a
meeting on April 3, 2005. If this is the first you've heard of it,
sorry but you missed the meeting!
* Ruby Internship Request
Shalev NessAiver is looking for an internship over the summer,
preferably doing Ruby web programming. "My primary goal in seeking
this internship is to gain more experience. Specifically, I would like
to gain more experience in the area of web/interface design."
* Ruby RDF-Redland
Dominic Sisneros hasn't had much time lately to work on RDF-Redland (a
Ruby binding for the Redland Application Framework - related to the
"semantic web" idea). His job has meant he's travelling around, with a
Windows laptop, but he hasn't been able to build RDF-Redland on a
Windows system.
He plans to do more work on it, as soon as he can get it to compile.
Help wanted!
* IORCC 2005 entries
Vincent Foley noted that the IORCC 2005 entries have been put online.
IORCC is the International Obfuscated Ruby Coding Contest. Check out
the madness.
* 2005 IORCC PC Voting is now OPEN!
Todd Nathan announced that the People's Choice voting for the IORCC
was open. Anyone may vote on the entries they think are best
(according to the guidelines).
* Translation into spanish of Ruby Quiz
James Edward Gray II shared the news that Imobach González Sosa will
be translating each week's Ruby Quiz into Spanish.
* libxml and libxslt CVS
Trans adopted the libxml2 and libxslt libraries, which appeared to be
abandoned by the previous maintainer. They're now part of the
XML:Tools project.
* Hamburg.rb meeting...
Stephan Kämper announced that Hamburg (in Germany) now has a Ruby User
Group. The first meeting is on April 6, 2005.
Quote of the Week
-----------------
I'm going to be lazy and give it to the entire "emerald 0.1" thread.
Threads
-------
Interesting threads this week included...
Ruby performance question
-------------------------
Jaypee benchmarked the following code on a 1GHz G4 and on dual 2GHz G5s,
both with the same version of Ruby and 1GB RAM.
class Integer
def factorial
(1..self).inject(1) { |f, n| f * n }
end
end
puts 100000.factorial
It was only 33% faster in the dual G5 system.
James Edward Gray II pointed out that Ruby was only using one CPU in the
dual system. Even if the code was changed to use Threads, Ruby would still
only use one CPU because Ruby uses its own user-land thread system.
Even so, with one 2GHz G5, the second system should be over twice as fast
as the first. (Shalev NessAiver reported that the G5 has a much faster bus
and memory speed than the G4.)
No further explanation was forthcoming.
SOAP Server WSDL generation
---------------------------
Patrick Hurley had successfully set up a Ruby client and server for SOAP.
(A protocol for remote procedure calls - web services.)
In both cases he had to tell the SOAP library which methods the interface
should provide. "Using ruby soap, can the server "auto discover" the
methods in a particular class and expose them?"
A second question was as to whether a Ruby SOAP server could generate a
WSDL file.
There was no response to the first question. For the second, Leon Breedt
brought up Rail's ActionWebService. It does WSDL generation but does need
annotations to declare the types of method parameters and return values.
Modifying boolean values
------------------------
Farrel Lifson wondered whether it was possible to make an object behave
like true or false. (With the aim to create a different type of boolean
whose #to_s method returns "0" or "1".)
Florian Gross explained that in Ruby, nil and false are "false", and every
other object is "true".
So it's easy to make an object behave like true (you don't need to do
anything), however it is not possible to have one which behaves like
false. Understanding why requires some knowledge of how the Ruby
interpreter works.
Every Ruby object is represented by a VALUE, which is an unsigned long.
Some VALUEs correspond to addresses, while others (like nil and false) are
"immediate" objects.
Boolean truth is evaluated in the interpreter via the RTEST macro, which
simply checks if the VALUE is either the nil or false special constant.
Christoph referred to a patch he wrote three years ago which added a
"false flag" to objects, allowing users to define their own boolean values
without sacrificing performance.
attr :<symbol>?
---------------
Luke Renn had seen code like "attr :foo" when using ActiveRecord. He wanted
to know what the name for them was, and how he could write his own things
like attr. Were they just class methods?
John Wilger confirmed that attr is indeed simply a class method. "In Ruby
(unlike many other languages) the code that defines a class is much more
than just a "definition". The code between "class Foo ... end" is executed
just like any other part of your program."
James Britt and Florian Gross posted bits of code that define new methods
like attr, and there was some discussion of the differences between their
implementations. (eval vs define_method.)
Please tell me what this means? self.<method> in a class
--------------------------------------------------------
Glenn Smith asked what def self.foo meant in the following code:
class Test
def foo
end
def Test.foo
end
def self.foo
end
end
David Corbin explained that it was redefining Test.foo.
David A. Black added that in general, anytime you write "def obj.method"
you are adding a singleton method to obj. In the above example, self in the
class definition corresponds to the class, i.e. Test. So "def self.foo"
was defining a singleton method of Test. Brian Candler pointed to a
tutorial on singleton methods.
Robert Klemme noted that the reason why it's better to write self.foo
instead of Test.foo is that it allows you to change the name of the class
in the future without having to modify the method declarations.
zip a directory, unzip a zip file
---------------------------------
itsme213 wanted to write Ruby code that zips up a directory, and can then
unzip it.
Stefan Lang suggested the archive-tar-minitar library, and Thomas
Sondergaard mentioned his own library, rubyzip.
An example of zipping up some directories using rubyzip:
Zip::ZipFile:pen("all.zip", true) { |zf|
Dir['{test,lib}/**/*'].each { |f| zf.add(f, f) }
}
Getting process status
----------------------
Joe Van Dyk had a process id, and wanted to get a Process::Status object
for it. The goal was to be able to check whether the process was still
running.
Leon Breedt said that you can check this via Process#kill(0, pid).
SNIPPET: YamlToHtml.rb
----------------------
Phlip wrote some code to convert YAML lists into HTML tables.
"The goal of the goals is to allow a Wiki-style web site convert YAML into
simple tables, essentially the way some Wikis convert
|nebulous|specifications| into tables."
"But is the world ready for "YASTL Ain't a Structured Transformation
Language" yet?"
Last Chance 2005 IORCC Entries
------------------------------
Todd Nathan warned that your last chance for entering the 2005
International Obfuscated Ruby Coding Contest (IORCC) was nearing. (You
missed it!)
Phil Tomson remarked on the number of sponsors and prizes the IORCC had
managed to get, and wondered whether we could run a IERCC ("International
Elegant Ruby Code contest") or BRICC ("Beautiful Ruby International Code
Contest").
Todd said that this is already being worked on.
PDF Writer UTF-8 Support
------------------------
Brian Schröder was having difficulting getting PDF::Writer to work with
his UTF-8 text.
The library's author, Austin Ziegler, explained that this wasn't an area
PDF::Writer had addressed yet, but there is a workaround that involves
some effort.
Poor efficency of Ruby...
--------------------------
JZ ran a Rails application as a CGI and found performance was poor. David
Heinemeier Hansson explained that he should use FastCGI instead.
The reason why PHP performs reasonably under CGI and Rails does not is
that Rails does quite a bit of initialisation - for example reflecting
over database tables to set up the ORM (Object-Relational Mapper). If you
use CGI, Rails has to perform this initialisation for every single
request.
With FastCGI, it is done just once.
ActiveState Ruby 1.8.2
----------------------
Thursday asked if anyone knew whether ActiveState were interested in doing
work on Ruby. They currently have "distributions" and support for Perl,
Python and Tcl.
Pat Eyler spoke to them at OSCON last year. They would like their Komodo
IDE to support debugging in Ruby, but don't currently have in-house Ruby
expertise.
ruby-dev summary 25781-25961
----------------------------
Kazuo Saito posted the summary of the Japanese list ruby-dev.
It said that Matz brought up the idea for changing the way method search
occurs. David A. Black clarified the comments with an example:
class C
def process
util # will always call C#util, even if overridden
self.util # will call subclass's #util, if present
end
def util
end
end
Currently, util and self.util both do the same thing - they will call the
subclass' method if one exists.
ruby lib that will receive email
--------------------------------
Peña, Botp asked whether there were Ruby libraries for receiving email.
Florian Gross said that Net:OP and Net::IMAP from Ruby's standard
library could be used here, and Shalev NessAiver said that ActionMailer
from Rails was recently extended to deal with retrieving mail.
Peña clarified that they wanted e.g. an IMAP server written in Ruby, not a
client. Aredridel had previously thought of using the EXIM mail server
design in creating a Ruby mail server.
Glenn Parker nodded, "It sounds like a fun project to me, too. It might
also be fun to have pure (or mostly pure) Ruby servers for LDAP, DNS, FTP,
NIS, SSH, telnet, syslog, crontab, NFS..."
Open letter to anyone developing a Ruby IDE
-------------------------------------------
Adelle Hartley had some ideas for adding a heuristic to do "intellisense"
or "autocomplete" in Ruby IDEs.
There was discussion around existing solutions used in IDEs. Rob reminded
the group of a solution he came up with that has been discussed previously
in Ruby Weekly News. It's still a cool idea, so is worth repeating:
"For completion I infer the possible classes of a variable, based on what
methods have already been called on it. Then I provide a popup of the
combined set of methods available for those classes, i.e. if it quacks
like a duck, it will probably waddle like one two."
Another technique is to rely on actually executing code before method
information is available. One way to achieve this is through running unit
tests on the code.
Code Cleaning
-------------
James Edward Gray II posted this week's Ruby Quiz.
I'm always very vocal about how Ruby Quiz isn't interested in golf and
obfuscation. It's my own private fight for clean code.
To be fair though, you can really learn a lot from practices like golf
and obfuscation. It'll teach you a surprising number of details about
the inner workings of your language of choice. Still principals are
principals and if I bend, word will quickly get out that I've given up
the fight. Can't allow that!
Here's my compromise.
This week's challenge is to utterly clean some famous examples of
compressed Ruby code. Refactor the code until it's as readable as
possible, whatever that means to you.
MySQL under latest one-click installer
--------------------------------------
R. Mark Volkmann was finding it difficult to getting Ruby on Windows to
work with MySQL. Lothar Scholz suggested he use the pure-Ruby MySQL client
library, rather than trying to install the one that wraps the C library.
James Britt posted instructions for how to do this, and the original
poster managed to get everything working.
look-behind regexp ?
--------------------
Shajith asked if there were plans to support "look-behind" in Ruby's
regular expression engine.
Matz said that the engine used in Ruby 1.9 (Oniguruma) already supports
this.
There was discussion as to why a new engine was written, rather than using
e.g. Perl's engine. Matz gave one reason; Perl's only supports UTF-8 while
Oniguruma works with "UTF-8, UTF-16, ISO-8859-*, EUC-JP, Shift_JIS, and
lot more".
Best way to get latest ruby on OS X?
------------------------------------
Dennis Roberts wanted to know the best way of getting the latest stable
Ruby release on MacOS X. Darwinports seemed to be the answer.
emerald 0.1
-----------
Matz wrote:
"I'm pleased to announce you the first public release of emerald at
http://rubyurl.com/b5JtE
Emerald is an object oriented language with constraints and logic
features, inspired from prolog, Oz, CSP and Hyper/J.
I started this as an hack since ruby is becoming less fun. It will not
be as good as ruby, but please try it out while we wait for Rite."
Hal Fulton responded, "Very nice... but will it scale?"
Tom Copeland:
"With this language, Ruby is fin-ished.
Now all we can do is flounder about.
I feel gill-ty for recommending Ruby now.
Emerald will be fast; if anyone can tuna language, it's Matz."
The puns just got worse from there ;-)
PS: Matz posted his message on April 1st.
Active Record and different field names
---------------------------------------
JZ was using ActiveRecord with Rails, but had tables that didn't use id
for their primary keys. How do you tell ActiveRecord which field it should
use?
David Heinemeier Hansson said that set_primary_key should be used in this
case.
Getting Ruby approved
---------------------
Joe Van Dyk was "trying to get Ruby added to one of the "supported" OSS
tools at Boeing". Jim Freeze posted what he'd learnt from his (successful)
attempt to introduce Ruby to a company he was working at.
There were almost 50 articles in the thread, with many people contributing
their ideas.
Ruby Weekly News 21st - 27th March 2005
---------------------------------------
Yes, a thread starting with last week's Ruby Weekly News. Be thankful that
it isn't this week's! (A time machine written in Ruby?)
Last week's Quote of the Week was Matz announcing that the YARV virtual
machine would be merged into the main Ruby implementation this year.
After a few days with no comment, Tim Sutherland tried to stir up a
reaction with "I'm surprised no-one has commented on this yet... I was
expecting a chorus of "wow!"s."
Nikolai Weibull said "wow!", and also questioned how YARV relates to Rite
and Ruby 1.9. (Rite was intended to be "Ruby done Right", a complete
rewrite of the Ruby interpreter to get a faster implementation. The
language would also change with Rite. The language changes are being
implemented in Ruby 1.9, without the better implementation.)
Matz explained, "Since YARV engine would achieve what I wanted by complete
rewrite, I'd call YARV merged 1.9 as Rite."
There were comments on the possible benefits and disadvantages of merging
YARV.
Shiny balls with OpenGL
-----------------------
This thread provides some examples of OpenGL graphics implemented in Ruby.
New Releases
------------
* RubyGems 0.8.10
Jim Weirich announced a bug-fix release of RubyGems. An issue where it
could become confused between different versions of the same library
has been addressed.
* KirbyBase 2.0
Jamey Cribbs released a new major version of KirbyBase, a small
database management system that stores its data in plain-text files.
The API has been changed to be more "Rubyish". (For example, using
blocks.) Jamey also thanked Hal Fulton for feedback on the previous
release.
* Ruby-GetText-Package-0.8.1
Masao Mutoh updated the Ruby-GetText library. This provides Native
Language Support (text in multiple languages etc.) and is based on GNU
gettext. Bugs have been fixed and a new translation, pt_BR, has been
added by Joao Pedrosa.
* FastCST 0.6.5
Zed A. Shaw added a "whole whack" of features to his FastCST version
control tool. There is now better safety and security, as well as
merge features. The repository layout format has been changed, meaning
that this release cannot be used with repositories created in earlier
versions. Zed believes this will be the last such change for a while.
* Production Log Analyzer 1.1.0
Eric Hodel made the first public release of the Production Log
Analyzer. It is used to analyse the logs of a web application, to
determine which pages are taking up a lot of resources.
* color-tools 1.0.0
Austin Ziegler was pleased to announce the first release of
color-tools. It provides support for the RGB and CMYK colour models,
with "148 named RGB colours that are commonly supported and used in
HTML, colour manipulation operations, and a monochromatic contrasting
palette generator."
It will be used in future PDF::Writer releases.
* QtRuby 1.0.8/Korundum 3.4.0/KDevelop 3.2.0
Richard Dale let it be known that there were new QtRuby, Korundum and
KDevelop releases. The first two are Ruby bindings for the Qt and KDE
APIs, while the latter is an IDE. Bugs were fixed in the bindings.
KDevelop includes Ruby support for features like creating GUIs
graphically, debugging and a class browser.
* FireRuby 0.2.1
Peter Wood fixed some bugs in FireRuby, a binding for the FireBird
RDBMS.
* Amrita 1.0.2 + XML + amrita_id fix
Aredridel posted a patch to allow Amrita 1.0.2 to work with REXML.
(New users should use Amrita2 instead.)
* RMagick 1.7.4 released
Timothy Hunter released a new version of RMagick to enable it to work
with the latest ImageMagick release (6.2.1). "RMagick is an interface
to the ImageMagick and GraphicsMagick image processing libraries.
Supports more than 80 image formats, including GIF, JPEG, PNG.
Includes 2D drawing API."
* MuraveyWeb 0.2-tons of new stuff
Dmitry V. Sabanin added many new features to MuraveyWeb, a CMS
(Content Management System) written with Ruby on Rails. New features
include document revision management and a staging area for files.
* MiniRubyWiki 1.0.0
Phlip announced an important milestone in MiniRubyWiki development:
version 1.0.0. This is a Wiki implementation with "the most advanced
emergent features available in wikidom. You can import raw text or
html into wiki pages, execute commands to populate wiki pages, and you
ran run, organize, and annotate thousands of pages of test resources."
* SimpleXML for you
Aleksi ported the PHP SimpleXML library to Ruby. James Britt suggested
looking at the XmlSimple library, which is based on Perl's
XML::Simple.
--------------------------------------------
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.
Articles and Announcements
--------------------------
* TRUG 3 April 2005 Meeting
Mike Stok announced that the Toronto Ruby User Group was having a
meeting on April 3, 2005. If this is the first you've heard of it,
sorry but you missed the meeting!
* Ruby Internship Request
Shalev NessAiver is looking for an internship over the summer,
preferably doing Ruby web programming. "My primary goal in seeking
this internship is to gain more experience. Specifically, I would like
to gain more experience in the area of web/interface design."
* Ruby RDF-Redland
Dominic Sisneros hasn't had much time lately to work on RDF-Redland (a
Ruby binding for the Redland Application Framework - related to the
"semantic web" idea). His job has meant he's travelling around, with a
Windows laptop, but he hasn't been able to build RDF-Redland on a
Windows system.
He plans to do more work on it, as soon as he can get it to compile.
Help wanted!
* IORCC 2005 entries
Vincent Foley noted that the IORCC 2005 entries have been put online.
IORCC is the International Obfuscated Ruby Coding Contest. Check out
the madness.
* 2005 IORCC PC Voting is now OPEN!
Todd Nathan announced that the People's Choice voting for the IORCC
was open. Anyone may vote on the entries they think are best
(according to the guidelines).
* Translation into spanish of Ruby Quiz
James Edward Gray II shared the news that Imobach González Sosa will
be translating each week's Ruby Quiz into Spanish.
* libxml and libxslt CVS
Trans adopted the libxml2 and libxslt libraries, which appeared to be
abandoned by the previous maintainer. They're now part of the
XML:Tools project.
* Hamburg.rb meeting...
Stephan Kämper announced that Hamburg (in Germany) now has a Ruby User
Group. The first meeting is on April 6, 2005.
Quote of the Week
-----------------
I'm going to be lazy and give it to the entire "emerald 0.1" thread.
Threads
-------
Interesting threads this week included...
Ruby performance question
-------------------------
Jaypee benchmarked the following code on a 1GHz G4 and on dual 2GHz G5s,
both with the same version of Ruby and 1GB RAM.
class Integer
def factorial
(1..self).inject(1) { |f, n| f * n }
end
end
puts 100000.factorial
It was only 33% faster in the dual G5 system.
James Edward Gray II pointed out that Ruby was only using one CPU in the
dual system. Even if the code was changed to use Threads, Ruby would still
only use one CPU because Ruby uses its own user-land thread system.
Even so, with one 2GHz G5, the second system should be over twice as fast
as the first. (Shalev NessAiver reported that the G5 has a much faster bus
and memory speed than the G4.)
No further explanation was forthcoming.
SOAP Server WSDL generation
---------------------------
Patrick Hurley had successfully set up a Ruby client and server for SOAP.
(A protocol for remote procedure calls - web services.)
In both cases he had to tell the SOAP library which methods the interface
should provide. "Using ruby soap, can the server "auto discover" the
methods in a particular class and expose them?"
A second question was as to whether a Ruby SOAP server could generate a
WSDL file.
There was no response to the first question. For the second, Leon Breedt
brought up Rail's ActionWebService. It does WSDL generation but does need
annotations to declare the types of method parameters and return values.
Modifying boolean values
------------------------
Farrel Lifson wondered whether it was possible to make an object behave
like true or false. (With the aim to create a different type of boolean
whose #to_s method returns "0" or "1".)
Florian Gross explained that in Ruby, nil and false are "false", and every
other object is "true".
So it's easy to make an object behave like true (you don't need to do
anything), however it is not possible to have one which behaves like
false. Understanding why requires some knowledge of how the Ruby
interpreter works.
Every Ruby object is represented by a VALUE, which is an unsigned long.
Some VALUEs correspond to addresses, while others (like nil and false) are
"immediate" objects.
Boolean truth is evaluated in the interpreter via the RTEST macro, which
simply checks if the VALUE is either the nil or false special constant.
Christoph referred to a patch he wrote three years ago which added a
"false flag" to objects, allowing users to define their own boolean values
without sacrificing performance.
attr :<symbol>?
---------------
Luke Renn had seen code like "attr :foo" when using ActiveRecord. He wanted
to know what the name for them was, and how he could write his own things
like attr. Were they just class methods?
John Wilger confirmed that attr is indeed simply a class method. "In Ruby
(unlike many other languages) the code that defines a class is much more
than just a "definition". The code between "class Foo ... end" is executed
just like any other part of your program."
James Britt and Florian Gross posted bits of code that define new methods
like attr, and there was some discussion of the differences between their
implementations. (eval vs define_method.)
Please tell me what this means? self.<method> in a class
--------------------------------------------------------
Glenn Smith asked what def self.foo meant in the following code:
class Test
def foo
end
def Test.foo
end
def self.foo
end
end
David Corbin explained that it was redefining Test.foo.
David A. Black added that in general, anytime you write "def obj.method"
you are adding a singleton method to obj. In the above example, self in the
class definition corresponds to the class, i.e. Test. So "def self.foo"
was defining a singleton method of Test. Brian Candler pointed to a
tutorial on singleton methods.
Robert Klemme noted that the reason why it's better to write self.foo
instead of Test.foo is that it allows you to change the name of the class
in the future without having to modify the method declarations.
zip a directory, unzip a zip file
---------------------------------
itsme213 wanted to write Ruby code that zips up a directory, and can then
unzip it.
Stefan Lang suggested the archive-tar-minitar library, and Thomas
Sondergaard mentioned his own library, rubyzip.
An example of zipping up some directories using rubyzip:
Zip::ZipFile:pen("all.zip", true) { |zf|
Dir['{test,lib}/**/*'].each { |f| zf.add(f, f) }
}
Getting process status
----------------------
Joe Van Dyk had a process id, and wanted to get a Process::Status object
for it. The goal was to be able to check whether the process was still
running.
Leon Breedt said that you can check this via Process#kill(0, pid).
SNIPPET: YamlToHtml.rb
----------------------
Phlip wrote some code to convert YAML lists into HTML tables.
"The goal of the goals is to allow a Wiki-style web site convert YAML into
simple tables, essentially the way some Wikis convert
|nebulous|specifications| into tables."
"But is the world ready for "YASTL Ain't a Structured Transformation
Language" yet?"
Last Chance 2005 IORCC Entries
------------------------------
Todd Nathan warned that your last chance for entering the 2005
International Obfuscated Ruby Coding Contest (IORCC) was nearing. (You
missed it!)
Phil Tomson remarked on the number of sponsors and prizes the IORCC had
managed to get, and wondered whether we could run a IERCC ("International
Elegant Ruby Code contest") or BRICC ("Beautiful Ruby International Code
Contest").
Todd said that this is already being worked on.
PDF Writer UTF-8 Support
------------------------
Brian Schröder was having difficulting getting PDF::Writer to work with
his UTF-8 text.
The library's author, Austin Ziegler, explained that this wasn't an area
PDF::Writer had addressed yet, but there is a workaround that involves
some effort.
Poor efficency of Ruby...
--------------------------
JZ ran a Rails application as a CGI and found performance was poor. David
Heinemeier Hansson explained that he should use FastCGI instead.
The reason why PHP performs reasonably under CGI and Rails does not is
that Rails does quite a bit of initialisation - for example reflecting
over database tables to set up the ORM (Object-Relational Mapper). If you
use CGI, Rails has to perform this initialisation for every single
request.
With FastCGI, it is done just once.
ActiveState Ruby 1.8.2
----------------------
Thursday asked if anyone knew whether ActiveState were interested in doing
work on Ruby. They currently have "distributions" and support for Perl,
Python and Tcl.
Pat Eyler spoke to them at OSCON last year. They would like their Komodo
IDE to support debugging in Ruby, but don't currently have in-house Ruby
expertise.
ruby-dev summary 25781-25961
----------------------------
Kazuo Saito posted the summary of the Japanese list ruby-dev.
It said that Matz brought up the idea for changing the way method search
occurs. David A. Black clarified the comments with an example:
class C
def process
util # will always call C#util, even if overridden
self.util # will call subclass's #util, if present
end
def util
end
end
Currently, util and self.util both do the same thing - they will call the
subclass' method if one exists.
ruby lib that will receive email
--------------------------------
Peña, Botp asked whether there were Ruby libraries for receiving email.
Florian Gross said that Net:OP and Net::IMAP from Ruby's standard
library could be used here, and Shalev NessAiver said that ActionMailer
from Rails was recently extended to deal with retrieving mail.
Peña clarified that they wanted e.g. an IMAP server written in Ruby, not a
client. Aredridel had previously thought of using the EXIM mail server
design in creating a Ruby mail server.
Glenn Parker nodded, "It sounds like a fun project to me, too. It might
also be fun to have pure (or mostly pure) Ruby servers for LDAP, DNS, FTP,
NIS, SSH, telnet, syslog, crontab, NFS..."
Open letter to anyone developing a Ruby IDE
-------------------------------------------
Adelle Hartley had some ideas for adding a heuristic to do "intellisense"
or "autocomplete" in Ruby IDEs.
There was discussion around existing solutions used in IDEs. Rob reminded
the group of a solution he came up with that has been discussed previously
in Ruby Weekly News. It's still a cool idea, so is worth repeating:
"For completion I infer the possible classes of a variable, based on what
methods have already been called on it. Then I provide a popup of the
combined set of methods available for those classes, i.e. if it quacks
like a duck, it will probably waddle like one two."
Another technique is to rely on actually executing code before method
information is available. One way to achieve this is through running unit
tests on the code.
Code Cleaning
-------------
James Edward Gray II posted this week's Ruby Quiz.
I'm always very vocal about how Ruby Quiz isn't interested in golf and
obfuscation. It's my own private fight for clean code.
To be fair though, you can really learn a lot from practices like golf
and obfuscation. It'll teach you a surprising number of details about
the inner workings of your language of choice. Still principals are
principals and if I bend, word will quickly get out that I've given up
the fight. Can't allow that!
Here's my compromise.
This week's challenge is to utterly clean some famous examples of
compressed Ruby code. Refactor the code until it's as readable as
possible, whatever that means to you.
MySQL under latest one-click installer
--------------------------------------
R. Mark Volkmann was finding it difficult to getting Ruby on Windows to
work with MySQL. Lothar Scholz suggested he use the pure-Ruby MySQL client
library, rather than trying to install the one that wraps the C library.
James Britt posted instructions for how to do this, and the original
poster managed to get everything working.
look-behind regexp ?
--------------------
Shajith asked if there were plans to support "look-behind" in Ruby's
regular expression engine.
Matz said that the engine used in Ruby 1.9 (Oniguruma) already supports
this.
There was discussion as to why a new engine was written, rather than using
e.g. Perl's engine. Matz gave one reason; Perl's only supports UTF-8 while
Oniguruma works with "UTF-8, UTF-16, ISO-8859-*, EUC-JP, Shift_JIS, and
lot more".
Best way to get latest ruby on OS X?
------------------------------------
Dennis Roberts wanted to know the best way of getting the latest stable
Ruby release on MacOS X. Darwinports seemed to be the answer.
emerald 0.1
-----------
Matz wrote:
"I'm pleased to announce you the first public release of emerald at
http://rubyurl.com/b5JtE
Emerald is an object oriented language with constraints and logic
features, inspired from prolog, Oz, CSP and Hyper/J.
I started this as an hack since ruby is becoming less fun. It will not
be as good as ruby, but please try it out while we wait for Rite."
Hal Fulton responded, "Very nice... but will it scale?"
Tom Copeland:
"With this language, Ruby is fin-ished.
Now all we can do is flounder about.
I feel gill-ty for recommending Ruby now.
Emerald will be fast; if anyone can tuna language, it's Matz."
The puns just got worse from there ;-)
PS: Matz posted his message on April 1st.
Active Record and different field names
---------------------------------------
JZ was using ActiveRecord with Rails, but had tables that didn't use id
for their primary keys. How do you tell ActiveRecord which field it should
use?
David Heinemeier Hansson said that set_primary_key should be used in this
case.
Getting Ruby approved
---------------------
Joe Van Dyk was "trying to get Ruby added to one of the "supported" OSS
tools at Boeing". Jim Freeze posted what he'd learnt from his (successful)
attempt to introduce Ruby to a company he was working at.
There were almost 50 articles in the thread, with many people contributing
their ideas.
Ruby Weekly News 21st - 27th March 2005
---------------------------------------
Yes, a thread starting with last week's Ruby Weekly News. Be thankful that
it isn't this week's! (A time machine written in Ruby?)
Last week's Quote of the Week was Matz announcing that the YARV virtual
machine would be merged into the main Ruby implementation this year.
After a few days with no comment, Tim Sutherland tried to stir up a
reaction with "I'm surprised no-one has commented on this yet... I was
expecting a chorus of "wow!"s."
Nikolai Weibull said "wow!", and also questioned how YARV relates to Rite
and Ruby 1.9. (Rite was intended to be "Ruby done Right", a complete
rewrite of the Ruby interpreter to get a faster implementation. The
language would also change with Rite. The language changes are being
implemented in Ruby 1.9, without the better implementation.)
Matz explained, "Since YARV engine would achieve what I wanted by complete
rewrite, I'd call YARV merged 1.9 as Rite."
There were comments on the possible benefits and disadvantages of merging
YARV.
Shiny balls with OpenGL
-----------------------
This thread provides some examples of OpenGL graphics implemented in Ruby.
New Releases
------------
* RubyGems 0.8.10
Jim Weirich announced a bug-fix release of RubyGems. An issue where it
could become confused between different versions of the same library
has been addressed.
* KirbyBase 2.0
Jamey Cribbs released a new major version of KirbyBase, a small
database management system that stores its data in plain-text files.
The API has been changed to be more "Rubyish". (For example, using
blocks.) Jamey also thanked Hal Fulton for feedback on the previous
release.
* Ruby-GetText-Package-0.8.1
Masao Mutoh updated the Ruby-GetText library. This provides Native
Language Support (text in multiple languages etc.) and is based on GNU
gettext. Bugs have been fixed and a new translation, pt_BR, has been
added by Joao Pedrosa.
* FastCST 0.6.5
Zed A. Shaw added a "whole whack" of features to his FastCST version
control tool. There is now better safety and security, as well as
merge features. The repository layout format has been changed, meaning
that this release cannot be used with repositories created in earlier
versions. Zed believes this will be the last such change for a while.
* Production Log Analyzer 1.1.0
Eric Hodel made the first public release of the Production Log
Analyzer. It is used to analyse the logs of a web application, to
determine which pages are taking up a lot of resources.
* color-tools 1.0.0
Austin Ziegler was pleased to announce the first release of
color-tools. It provides support for the RGB and CMYK colour models,
with "148 named RGB colours that are commonly supported and used in
HTML, colour manipulation operations, and a monochromatic contrasting
palette generator."
It will be used in future PDF::Writer releases.
* QtRuby 1.0.8/Korundum 3.4.0/KDevelop 3.2.0
Richard Dale let it be known that there were new QtRuby, Korundum and
KDevelop releases. The first two are Ruby bindings for the Qt and KDE
APIs, while the latter is an IDE. Bugs were fixed in the bindings.
KDevelop includes Ruby support for features like creating GUIs
graphically, debugging and a class browser.
* FireRuby 0.2.1
Peter Wood fixed some bugs in FireRuby, a binding for the FireBird
RDBMS.
* Amrita 1.0.2 + XML + amrita_id fix
Aredridel posted a patch to allow Amrita 1.0.2 to work with REXML.
(New users should use Amrita2 instead.)
* RMagick 1.7.4 released
Timothy Hunter released a new version of RMagick to enable it to work
with the latest ImageMagick release (6.2.1). "RMagick is an interface
to the ImageMagick and GraphicsMagick image processing libraries.
Supports more than 80 image formats, including GIF, JPEG, PNG.
Includes 2D drawing API."
* MuraveyWeb 0.2-tons of new stuff
Dmitry V. Sabanin added many new features to MuraveyWeb, a CMS
(Content Management System) written with Ruby on Rails. New features
include document revision management and a staging area for files.
* MiniRubyWiki 1.0.0
Phlip announced an important milestone in MiniRubyWiki development:
version 1.0.0. This is a Wiki implementation with "the most advanced
emergent features available in wikidom. You can import raw text or
html into wiki pages, execute commands to populate wiki pages, and you
ran run, organize, and annotate thousands of pages of test resources."
* SimpleXML for you
Aleksi ported the PHP SimpleXML library to Ruby. James Britt suggested
looking at the XmlSimple library, which is based on Perl's
XML::Simple.