Ruby Weekly News 7th - 13th March 2005


T

Tim Sutherland

http://www.rubyweeklynews.org/20050313.html

Ruby Weekly News 7th - 13th March 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.

Special thanks this week goes to Paul van Tilburg, who converted several
weeks of newsletters from RubyGarden format to Hobix. This provided nice
syndication with RSS and Atom. I liked his work so much that I decided to
save him the trouble of doing the conversion every week and just use Hobix
myself! I intend to translate the old newsletters into this format as
well.

I'm interested in feedback on the new layout and functionality.

Articles and Announcements
--------------------------

* Ruby Central 2005 Codefest Grant recipients
---------------------------------------------

David A. Black announced that there were five recipients of the first
Ruby Central Codefest Grant program.

They each receive up to US$500, to be used for hosting "codefests",
where groups of developers meet up at the same physical location to
hack.

1. Ruby Displaytag (Dave Tiu)
2. Ruby/AGG and Ruby/View (Andrey Melnik)
3. Gambit (James Edward Gray II)
4. Ruby Bindings to Lucene Search Engine (Brian McCallister)
5. RubyGems cleanup and enhancement (Ryan Davis)

* Who wants to learn Ruby with me?
----------------------------------

Andreas Sprotte is looking for a partner to write a RubyCocoa
application for the Mac.

"I want to learn about the model view controller pattern,
object-orientation, basic networking and accessing a database. We'd
email us back and forth and would collaborate via SubEthaEdit once a
week.

The project should be something that could be completed in about 40
hours, maybe spread about 4 to 6 weeks."

* Ruby Developers in Tokyo, Japan
---------------------------------

Zev Blut posted a job announcement in the form of a Ruby program.
Several people posted patches and comments. Zev followed up with
"Thanks for all the comments and improvements to the coded request for
Ruby developers! It was certainly more fun than writing a formal job
posting. Hopefully, I will get a few resumes in my mailbox..."

* SIGHTING: Ruby article in Dr. Dobb's
--------------------------------------

Kaspar Schiess spotted an article in the February 2005 issue of Dr.
Dobbs called "Amazon.com - Web Services & Ruby". It was written by Ian
Macdonald. Kaspar reports "The article is well written and makes you
want to try out the library." (Registration required to view article.)

Quote of the Week
-----------------

We're breaking the rules here - but this is Ruby-land, so that's okay. The
quote this week isn't from the ruby-talk mailing list, it's from
RedHanded, a blog run by why the lucky stiff. (With some other
contributors from time to time.)

_why had just observed the "haha" count between the Python and Ruby lists.

In response, Wonko the semi-successful magician saw fit to declare

"It's an established scientific fact that Ruby programmers laugh five
times more per day than Python programmers, and thirty times more than
Java programmers. And unlike the mad half-a-laugh-per-week C++ crowd,
it's not all evil cackling laughs, either."

Threads
-------

Interesting threads this week included:

[Codefest Grant - RubyGems cleanup and enhancement]
---------------------------------------------------

Eric Hodel announced that the Seattle.rb users' group will host the
RubyGems codefest. "We would like to solicit your ideas on what you want
to see cleaned up or enhanced in RubyGems." "For our Codefest we do not
plan on making large changes to the way RubyGems works. One thing we would
like to focus on is making the gem command more friendly when you hit ^C,
for example."

gabriele renzi suggested "One little thing I'd appreciate is some kind of
feedback for the user like a progress bar both in downloading and
upgrading cache."

Curt Hibbs thought a GUI front-end is needed, but that it was probably too
much work for a codefest. "What I want is something like a news reader, or
windows file explorer. A desktop GUI with a tree control on the left and a
detail panel of sorts on the right. With the ability to mount and browse
multiple repositories as well as your installed gems."

Richard Lyman had created a mockup GUI front-end at one stage, but nothing
happened after that. He will have more time at the end of April, so may do
work on it then.

Jim Freeze made a different request in another thread. "I like the
versioning of libraries, but I particularly like the versioning of
applications."

$ rake --version
rake, version 0.4.15
$ rake _0.4.13_ --version
rake, version 0.4.13

Jim has a script which launches the application, and would like the user
to be able to specify which version was run. Perhaps "setenv
RUBYGEMS_USE_APP_VERSION_xyz_app 1".

[Possible ruby job in SF Bay Area]
----------------------------------

Joel VanderWerf posted a possible job position for a Ruby programmer. The
requirements included "Ruby: 2 years, responsible for at least one project
of >10K lines."

why the lucky stiff noted "I've always held to the old adage: If you've
written 10K lines of Ruby code, then you're using it wrong."

Dave Burt calculated the number of lines in some of the major Ruby
libraries and applications. Rails is 2K lines, rdoc is 16K and rexml 9K.
"So the successful applicant will have written one of the (top 5?) largest
Ruby projects in existence."

David Heinemeier Hansson (the main author of Rails) agreed with these
sentiments, saying "I, for one, wouldn't fit the description above. Number
of years is a utter lackluster indicator for job performance. Rewarding
the use of 10K lines in Ruby is also fairly questionable."

Joel defended the requirement, explaining "The app needs to interact with
3rd party software that has its own highly complex (and often poorly
designed) input/output system. It needs to do a large variety of
geometrical calculations (not difficult ones). The programmer for this job
needs to be comfortable with managing a large number of ugly details. That
skill is distinct (though of course not exclusive) from writing a lovely
little ruby library."

[Watir needs a Win32GUI library]
--------------------------------

Bret Pettichord: "We've seen growing enthusiasm for Watir, a web-testing
library that is good enough that it is convincing people to learn Ruby
just so that they can use it." He gave a number of quotes from satisfied
users.

Watir controls Internet Explorer via the COM interface, but is running
into some limits with that interface. "I'm writing to ask for help. The
biggest problem with Watir is its support for various dialogs. These
dialogs appear when you use a browser; for example, a login dialog or a
security dialog or a javascript dialog. Watir mostly works by accessing
the DOM via IE's COM interface. But there is no COM/DOM interface to these
dialogs."

Some work has been done using Win32 calls, but Bret thinks it would be
better to use a general Win32 GUI testing library that already exists. Any
suggestions?

[what about a rails-based gforge like?]
---------------------------------------

Lionel Thiry asked "isn't there a need for a rails-based gforge like
framework?". GForge is a PHP application that provides support for
collaborative software development, with forums, mailing lists, CVS, bug
tracking etc. It is used by Rubyforge.

gabriele renzi thought that it was quite a complex project, and rewriting
it in Rails wouldn't gain you much. Lionel countered this by quoting the
claim from Rails enthusiasts that web applications can be developed up to
ten times faster with Rails. (Although this claim was actually originally
made in comparison to Java frameworks, not PHP ones.)

Martin DeMello felt that GForge was not primarily a web application -
"There are a lot of complex details on the server side that would have to
be redone for very little gain."

[need for a class_attr methods collection]
------------------------------------------

Lionel Thiry suggested class_attr methods, similar to attr_reader,
attr_writer, attr_accessor but for class instance variables.

class MyClass
@a = "value"
class_attr_reader :a
end
puts Test.a # it doesn't work

ts gave the following:

class MyClass
@a = "value"
class << self
attr_reader :a
end
end

ts also reminded Lionel not to confuse "class instance variable (i.e. @a
in your example) and class variables (i.e. @@a)".

[Great Computer Language Shootout]
----------------------------------

Isaac noted that Ruby is currently missing about a dozen programs from the
Great Computer Language Shootout (a set of benchmarks for many programming
language implementations).

"If you have a few moments please contribute stylish Ruby programs."

[nonblock extension for win32?]
-------------------------------

Bill Kelly recalled reading about an issue with blocking IO on Windows,
and thought that someone had announced a library for Windows that provided
non-blocking support. Where could he find this library?

"One of my applications has an unusable feature on windows at present,
because I need a nonblocking way to read from a pipe returned from
popen(). Is there any nonblocking way to accomplish this in win32 ruby?"

Daniel Berger explained that the discussion had been about a patch to the
Ruby interpreter to fix problems with blocking sockets, not a separate
library. The patch has been included in CVS. As far as popen() goes, the
win32-pipe library provides a replacement that will work asynchronously
(although the API is different).

Bill said that he'd probably switch to using sockets so his code was
portable.

[Redesign 2005 Blog]
--------------------

why the lucky stiff linked to the Redesign 2005 Blog. It presents two
mockups of a new ruby-lang.org website. These were prepared by the
vit-core team.

Feedback should be posted to the blog.

[ODBC OG/ActiveRecords]
-----------------------

Luke Galea wanted to use Microsoft Access and Sybase Anywhere databases
from Ruby. There aren't any Ruby drivers for these at the moment, so he's
using Ruby-ODBC. "BUT: I would like to use a nice object-relational
library like ActiveRecord or OG.. Has anyone ever had any success using
either over ODBC?"

David Heinemeier Hansson warned that "Generic ODBC adapters are
problematic because the databases underneath might use different
strategies for stuff like auto-incremented columns. A Access or Sybase
adapter that goes through ODBC is certainly possible. I know that shashank
and a few others were looking into that for Active Record at some point."

Kirk Haines said that the Kansas ORM (Object Relational Mapper) should be
able to use ODBC connectios. "Kansas, as an ORM, has been
feature-incomplete, but stable for many months, and I use it on probably
20 different production applications. It used DBI for simplicity and
coverage, making it lightweight."

[Quoted Printable (#23)]
------------------------

James Edward Gray II set out this week's Ruby Quiz. The task is to write a
filter that handles the "quoted printable" encoding. (This encoding is
primarily used in email.)

For example, the character "<" becomes "=3C".

[Roman Numerals (#22)]
----------------------

James also summarised last week's quiz, to write a convertor between Roman
and Arabic numerals.

One interesting technique was used by Dave Burt. He defined
Object.const_missing so that constants like IX would automatically be
converted into RomanNumeral objects.

"My thanks go out to friends and Romans alike."

[Malformed UTF-8?]
------------------

Ian Macdonald had recently been getting ArgumentError exceptions from a
calendar library. The error messages states that the calendar event
contains malforned UTF-8. Ian gave an example of text that gets rejected
by String#unpack("U*").

Simon Strandgaard pointed out the error in the text - it was indeed
invalid UTF-8.

Nikolai Weibull posted a program that checks whether text is properly
formed UTF-8. Unlike String#unpack, this program gives the actual position
of the first invalid character.

[YAML obj merging]
------------------

gga wanted to merge two Hash objects in a `recursive' way, e.g.

irb> a = { 'A' => { 'A1' => 'a' } }
irb> b = { 'A' => { 'B1' => 'b' } }
irb> b.mix(a) # ficticious method
{"A"=>{"A1"=>"a", "B1" => 'b' }}

Trans said that Ruby Facets provides a weave method which "does what you
wish and a little more".

[Is iterating in lock-step possible?]
-------------------------------------

This thread considered external vs internal iteration.

# External
while g.next?; foo(g.next); end

# Internal
g.each { |x| foo(x) }

The Generator class can be used to convert internal iterators into
external ones, but it is slow. (1000 times slower according to William
Morgan's benchmarks.)

Roshan James wanted to iterate over two Enumerable in parallel, without
first converting each into an Array. Enumerable#zip can be used for
parallel iteration, but it converts its arguments into Arrays.

ts gave the example of

%w(eins zwei drei).zip([1,2,3]) {|a, b| puts "#{a} #{b}" }

It was felt that Generator was indeed the right way to go. If it was too
slow then the objects being iterated over could be changed to have an
external iterator interface.

[DRb for dummies !]
-------------------

Svend-Erik Kjær Madsen had a problem using the ACL (access-control list)
class with drb (distributed Ruby). The solution was as simple as require
'drb/acl', but the thread gives us a good excuse to demonstrate ACL.

Quoting part of Svend-Erik's code, with the extra require,

require 'drb'
require 'drb/acl'

acl = ACL.new( %w[deny all
allow 192.168.1.*
allow localhost ] )

DRb.install_acl(acl)

[Simple extension question]
---------------------------

Mark Probert asked what the simplest way of clearing an Array from C was,
i.e. the C equivalent of foo.clear.

Daniel Berger replied: rb_ary_clear(foo).

"Tricky, eh? :p For a complete list of methods, take a look at intern.h."

[Encoding a multipart/form-data for posting via HTTP]
-----------------------------------------------------

Dema announced "After googling around (with no luck) for a while for a
function that would encode a hash into a multipart/form-data to be sent to
a HTTP server via POST, I decided to read the RFC and write my own." It
does not yet handle complex cases.

Dave Burt thought this should be in Net::HTTP::post.

New Releases
------------

* Fast Change Set Tool

Zed A. Shaw announced the first release of a revision control tool
he's been working on. FastCST allows you to create full changesets
between two directories and apply them.

* GeoIP.rb

Clifford Heath translated some of the GeoIP C library into Ruby. GeoIP
is "Geographic database by IP address" and tells you which country the
user of an IP address is probably in.

* Rubilicious 0.1.4

Paul Duncan improved Rubilicious, a Ruby interface to the social
bookmarking site del.icio.us. #delete and #update are now supported,
and #all is much more efficient.

* Imlib2-Ruby 0.5.0

Paul Duncan also released his latest bindings to the Imlib2 image
processing library. Packaging and documentation were improved and an
issue that came up when using Imlib2-Ruby with Rails was resolved.

* Amrita2-1.9.3

Taku Nakajima issued forth a new version of Amrita2, an XHTML/XML
templating library. Support for rich client-side Javascript interfaces
has been added - Amrita2 now generates both Ruby and Javascript code
from the template.

* Irb enhancements

Cs. Henk made some enhancements to irb, including bash-style
multi-line editing and context-sensitive history completion. These
features were met with great enthusiasm.

* priority queue using RBTree

Joel VanderWerf "patched" together a PriorityQueue implementation
using Queue and RBTree (a Ruby red-black tree implementation). He also
thought that RBTree should be part of the standard Ruby distribution,
and a couple of people concurred.

* TkRTTimer class

This is not exactly a "new release", since Ruby/Tk is part of the
standard distribution, however: Hidetoshi NAGAI announced the addition
of the TkRTTimer class to Ruby/Tk. It can be used in place of TkTimer
and provides something that is closer to a realtime timer.

* new eric3 snapshot

Detlev Offenbach announced a new snapshot of eric3, an IDE that
supports Ruby. A Ruby debugger was added.

* Kwartz-ruby 2.0.0-beta3 - a template system for Ruby, PHP, and Java

kwatch enhanced his multi-language templating system. It now includes
include support.

* Nitro + Og 0.12.0

George Moschovitis delivered "A careful blend of new features and
subtle improvements to the existing infrastructure." Nitro is a web
application framework, while Og is an object-relational mapper.

Nitro now allows action meta-data. This is used for example to provide
routing (rewrite) rules. The templating engine can also now be used
standalone from the rest of the system.

A new Og feature is automatic generation of finders for all
properties.

* Rails 0.10.1: FCGI stability, WS generator, tons of fixes

David Heinemeier Hansson announced the latest version of the Rails web
application framework. "Action Web Service has seen the most
interesting improvements feature-wise with a new generator and tie-ins
with the testing setup." XML-RPC support has been improved.
 
Ad

Advertisements

C

Curt Hibbs

This is awesome, Tim. I don't know how you find the time, but *please* keep
up the good work!

Curt
-----Original Message-----
From: Tim Sutherland [mailto:[email protected]]
Sent: Tuesday, March 15, 2005 7:58 AM
To: ruby-talk ML
Subject: Ruby Weekly News 7th - 13th March 2005
Importance: High


http://www.rubyweeklynews.org/20050313.html

Ruby Weekly News 7th - 13th March 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.

Special thanks this week goes to Paul van Tilburg, who
converted several
weeks of newsletters from RubyGarden format to Hobix. This
provided nice
syndication with RSS and Atom. I liked his work so much that I
decided to
save him the trouble of doing the conversion every week and
just use Hobix
myself! I intend to translate the old newsletters into this format as
well.

I'm interested in feedback on the new layout and functionality.

Articles and Announcements
--------------------------

* Ruby Central 2005 Codefest Grant recipients
---------------------------------------------

David A. Black announced that there were five recipients
of the first
Ruby Central Codefest Grant program.

They each receive up to US$500, to be used for hosting "codefests",
where groups of developers meet up at the same physical location to
hack.

1. Ruby Displaytag (Dave Tiu)
2. Ruby/AGG and Ruby/View (Andrey Melnik)
3. Gambit (James Edward Gray II)
4. Ruby Bindings to Lucene Search Engine (Brian McCallister)
5. RubyGems cleanup and enhancement (Ryan Davis)

* Who wants to learn Ruby with me?
----------------------------------

Andreas Sprotte is looking for a partner to write a RubyCocoa
application for the Mac.

"I want to learn about the model view controller pattern,
object-orientation, basic networking and accessing a database. We'd
email us back and forth and would collaborate via
SubEthaEdit once a
week.

The project should be something that could be completed in about 40
hours, maybe spread about 4 to 6 weeks."

* Ruby Developers in Tokyo, Japan
---------------------------------

Zev Blut posted a job announcement in the form of a Ruby program.
Several people posted patches and comments. Zev followed up with
"Thanks for all the comments and improvements to the coded
request for
Ruby developers! It was certainly more fun than writing a
formal job
posting. Hopefully, I will get a few resumes in my mailbox..."

* SIGHTING: Ruby article in Dr. Dobb's
--------------------------------------

Kaspar Schiess spotted an article in the February 2005 issue of Dr.
Dobbs called "Amazon.com - Web Services & Ruby". It was
written by Ian
Macdonald. Kaspar reports "The article is well written and
makes you
want to try out the library." (Registration required to
view article.)

Quote of the Week
-----------------

We're breaking the rules here - but this is Ruby-land, so
that's okay. The
quote this week isn't from the ruby-talk mailing list, it's from
RedHanded, a blog run by why the lucky stiff. (With some other
contributors from time to time.)

_why had just observed the "haha" count between the Python and
Ruby lists.

In response, Wonko the semi-successful magician saw fit to declare

"It's an established scientific fact that Ruby programmers laugh five
times more per day than Python programmers, and thirty times
more than
Java programmers. And unlike the mad half-a-laugh-per-week C++ crowd,
it's not all evil cackling laughs, either."

Threads
-------

Interesting threads this week included:

[Codefest Grant - RubyGems cleanup and enhancement]
---------------------------------------------------

Eric Hodel announced that the Seattle.rb users' group will host the
RubyGems codefest. "We would like to solicit your ideas on
what you want
to see cleaned up or enhanced in RubyGems." "For our Codefest we do not
plan on making large changes to the way RubyGems works. One
thing we would
like to focus on is making the gem command more friendly when
you hit ^C,
for example."

gabriele renzi suggested "One little thing I'd appreciate is
some kind of
feedback for the user like a progress bar both in downloading and
upgrading cache."

Curt Hibbs thought a GUI front-end is needed, but that it was
probably too
much work for a codefest. "What I want is something like a
news reader, or
windows file explorer. A desktop GUI with a tree control on
the left and a
detail panel of sorts on the right. With the ability to mount
and browse
multiple repositories as well as your installed gems."

Richard Lyman had created a mockup GUI front-end at one stage,
but nothing
happened after that. He will have more time at the end of
April, so may do
work on it then.

Jim Freeze made a different request in another thread. "I like the
versioning of libraries, but I particularly like the versioning of
applications."

$ rake --version
rake, version 0.4.15
$ rake _0.4.13_ --version
rake, version 0.4.13

Jim has a script which launches the application, and would
like the user
to be able to specify which version was run. Perhaps "setenv
RUBYGEMS_USE_APP_VERSION_xyz_app 1".

[Possible ruby job in SF Bay Area]
----------------------------------

Joel VanderWerf posted a possible job position for a Ruby
programmer. The
requirements included "Ruby: 2 years, responsible for at least
one project
of >10K lines."

why the lucky stiff noted "I've always held to the old adage: If you've
written 10K lines of Ruby code, then you're using it wrong."

Dave Burt calculated the number of lines in some of the major Ruby
libraries and applications. Rails is 2K lines, rdoc is 16K and
rexml 9K.
"So the successful applicant will have written one of the (top
5?) largest
Ruby projects in existence."

David Heinemeier Hansson (the main author of Rails) agreed with these
sentiments, saying "I, for one, wouldn't fit the description
above. Number
of years is a utter lackluster indicator for job performance. Rewarding
the use of 10K lines in Ruby is also fairly questionable."

Joel defended the requirement, explaining "The app needs to
interact with
3rd party software that has its own highly complex (and often poorly
designed) input/output system. It needs to do a large variety of
geometrical calculations (not difficult ones). The programmer
for this job
needs to be comfortable with managing a large number of ugly
details. That
skill is distinct (though of course not exclusive) from
writing a lovely
little ruby library."

[Watir needs a Win32GUI library]
--------------------------------

Bret Pettichord: "We've seen growing enthusiasm for Watir, a
web-testing
library that is good enough that it is convincing people to learn Ruby
just so that they can use it." He gave a number of quotes from
satisfied
users.

Watir controls Internet Explorer via the COM interface, but is running
into some limits with that interface. "I'm writing to ask for help. The
biggest problem with Watir is its support for various dialogs. These
dialogs appear when you use a browser; for example, a login dialog or a
security dialog or a javascript dialog. Watir mostly works by accessing
the DOM via IE's COM interface. But there is no COM/DOM
interface to these
dialogs."

Some work has been done using Win32 calls, but Bret thinks it would be
better to use a general Win32 GUI testing library that already
exists. Any
suggestions?

[what about a rails-based gforge like?]
---------------------------------------

Lionel Thiry asked "isn't there a need for a rails-based gforge like
framework?". GForge is a PHP application that provides support for
collaborative software development, with forums, mailing
lists, CVS, bug
tracking etc. It is used by Rubyforge.

gabriele renzi thought that it was quite a complex project,
and rewriting
it in Rails wouldn't gain you much. Lionel countered this by
quoting the
claim from Rails enthusiasts that web applications can be
developed up to
ten times faster with Rails. (Although this claim was actually
originally
made in comparison to Java frameworks, not PHP ones.)

Martin DeMello felt that GForge was not primarily a web application -
"There are a lot of complex details on the server side that
would have to
be redone for very little gain."

[need for a class_attr methods collection]
------------------------------------------

Lionel Thiry suggested class_attr methods, similar to attr_reader,
attr_writer, attr_accessor but for class instance variables.

class MyClass
@a = "value"
class_attr_reader :a
end
puts Test.a # it doesn't work

ts gave the following:

class MyClass
@a = "value"
class << self
attr_reader :a
end
end

ts also reminded Lionel not to confuse "class instance
variable (i.e. @a
in your example) and class variables (i.e. @@a)".

[Great Computer Language Shootout]
----------------------------------

Isaac noted that Ruby is currently missing about a dozen
programs from the
Great Computer Language Shootout (a set of benchmarks for many
programming
language implementations).

"If you have a few moments please contribute stylish Ruby programs."

[nonblock extension for win32?]
-------------------------------

Bill Kelly recalled reading about an issue with blocking IO on Windows,
and thought that someone had announced a library for Windows
that provided
non-blocking support. Where could he find this library?

"One of my applications has an unusable feature on windows at present,
because I need a nonblocking way to read from a pipe returned from
popen(). Is there any nonblocking way to accomplish this in
win32 ruby?"

Daniel Berger explained that the discussion had been about a
patch to the
Ruby interpreter to fix problems with blocking sockets, not a separate
library. The patch has been included in CVS. As far as popen()
goes, the
win32-pipe library provides a replacement that will work asynchronously
(although the API is different).

Bill said that he'd probably switch to using sockets so his code was
portable.

[Redesign 2005 Blog]
--------------------

why the lucky stiff linked to the Redesign 2005 Blog. It presents two
mockups of a new ruby-lang.org website. These were prepared by the
vit-core team.

Feedback should be posted to the blog.

[ODBC OG/ActiveRecords]
-----------------------

Luke Galea wanted to use Microsoft Access and Sybase Anywhere databases
from Ruby. There aren't any Ruby drivers for these at the
moment, so he's
using Ruby-ODBC. "BUT: I would like to use a nice object-relational
library like ActiveRecord or OG.. Has anyone ever had any success using
either over ODBC?"

David Heinemeier Hansson warned that "Generic ODBC adapters are
problematic because the databases underneath might use different
strategies for stuff like auto-incremented columns. A Access or Sybase
adapter that goes through ODBC is certainly possible. I know
that shashank
and a few others were looking into that for Active Record at
some point."

Kirk Haines said that the Kansas ORM (Object Relational
Mapper) should be
able to use ODBC connectios. "Kansas, as an ORM, has been
feature-incomplete, but stable for many months, and I use it
on probably
20 different production applications. It used DBI for simplicity and
coverage, making it lightweight."

[Quoted Printable (#23)]
------------------------

James Edward Gray II set out this week's Ruby Quiz. The task
is to write a
filter that handles the "quoted printable" encoding. (This encoding is
primarily used in email.)

For example, the character "<" becomes "=3C".

[Roman Numerals (#22)]
----------------------

James also summarised last week's quiz, to write a convertor
between Roman
and Arabic numerals.

One interesting technique was used by Dave Burt. He defined
Object.const_missing so that constants like IX would automatically be
converted into RomanNumeral objects.

"My thanks go out to friends and Romans alike."

[Malformed UTF-8?]
------------------

Ian Macdonald had recently been getting ArgumentError exceptions from a
calendar library. The error messages states that the calendar event
contains malforned UTF-8. Ian gave an example of text that
gets rejected
by String#unpack("U*").

Simon Strandgaard pointed out the error in the text - it was indeed
invalid UTF-8.

Nikolai Weibull posted a program that checks whether text is properly
formed UTF-8. Unlike String#unpack, this program gives the
actual position
of the first invalid character.

[YAML obj merging]
------------------

gga wanted to merge two Hash objects in a `recursive' way, e.g.

irb> a = { 'A' => { 'A1' => 'a' } }
irb> b = { 'A' => { 'B1' => 'b' } }
irb> b.mix(a) # ficticious method
{"A"=>{"A1"=>"a", "B1" => 'b' }}

Trans said that Ruby Facets provides a weave method which
"does what you
wish and a little more".

[Is iterating in lock-step possible?]
-------------------------------------

This thread considered external vs internal iteration.

# External
while g.next?; foo(g.next); end

# Internal
g.each { |x| foo(x) }

The Generator class can be used to convert internal iterators into
external ones, but it is slow. (1000 times slower according to William
Morgan's benchmarks.)

Roshan James wanted to iterate over two Enumerable in parallel, without
first converting each into an Array. Enumerable#zip can be used for
parallel iteration, but it converts its arguments into Arrays.

ts gave the example of

%w(eins zwei drei).zip([1,2,3]) {|a, b| puts "#{a} #{b}" }

It was felt that Generator was indeed the right way to go. If
it was too
slow then the objects being iterated over could be changed to have an
external iterator interface.

[DRb for dummies !]
-------------------

Svend-Erik Kjær Madsen had a problem using the ACL
(access-control list)
class with drb (distributed Ruby). The solution was as simple
as require
'drb/acl', but the thread gives us a good excuse to demonstrate ACL.

Quoting part of Svend-Erik's code, with the extra require,

require 'drb'
require 'drb/acl'

acl = ACL.new( %w[deny all
allow 192.168.1.*
allow localhost ] )

DRb.install_acl(acl)

[Simple extension question]
---------------------------

Mark Probert asked what the simplest way of clearing an Array
from C was,
i.e. the C equivalent of foo.clear.

Daniel Berger replied: rb_ary_clear(foo).

"Tricky, eh? :p For a complete list of methods, take a look
at intern.h."

[Encoding a multipart/form-data for posting via HTTP]
-----------------------------------------------------

Dema announced "After googling around (with no luck) for a while for a
function that would encode a hash into a multipart/form-data
to be sent to
a HTTP server via POST, I decided to read the RFC and write my own." It
does not yet handle complex cases.

Dave Burt thought this should be in Net::HTTP::post.

New Releases
------------

* Fast Change Set Tool

Zed A. Shaw announced the first release of a revision control tool
he's been working on. FastCST allows you to create full changesets
between two directories and apply them.

* GeoIP.rb

Clifford Heath translated some of the GeoIP C library into
Ruby. GeoIP
is "Geographic database by IP address" and tells you which
country the
user of an IP address is probably in.

* Rubilicious 0.1.4

Paul Duncan improved Rubilicious, a Ruby interface to the social
bookmarking site del.icio.us. #delete and #update are now
supported,
and #all is much more efficient.

* Imlib2-Ruby 0.5.0

Paul Duncan also released his latest bindings to the Imlib2 image
processing library. Packaging and documentation were
improved and an
issue that came up when using Imlib2-Ruby with Rails was resolved.

* Amrita2-1.9.3

Taku Nakajima issued forth a new version of Amrita2, an XHTML/XML
templating library. Support for rich client-side
Javascript interfaces
has been added - Amrita2 now generates both Ruby and
Javascript code
from the template.

* Irb enhancements

Cs. Henk made some enhancements to irb, including bash-style
multi-line editing and context-sensitive history completion. These
features were met with great enthusiasm.

* priority queue using RBTree

Joel VanderWerf "patched" together a PriorityQueue implementation
using Queue and RBTree (a Ruby red-black tree
implementation). He also
thought that RBTree should be part of the standard Ruby
distribution,
and a couple of people concurred.

* TkRTTimer class

This is not exactly a "new release", since Ruby/Tk is part of the
standard distribution, however: Hidetoshi NAGAI announced
the addition
of the TkRTTimer class to Ruby/Tk. It can be used in place
of TkTimer
and provides something that is closer to a realtime timer.

* new eric3 snapshot

Detlev Offenbach announced a new snapshot of eric3, an IDE that
supports Ruby. A Ruby debugger was added.

* Kwartz-ruby 2.0.0-beta3 - a template system for Ruby, PHP, and Java

kwatch enhanced his multi-language templating system. It
now includes
include support.

* Nitro + Og 0.12.0

George Moschovitis delivered "A careful blend of new features and
subtle improvements to the existing infrastructure." Nitro is a web
application framework, while Og is an object-relational mapper.

Nitro now allows action meta-data. This is used for
example to provide
routing (rewrite) rules. The templating engine can also now be used
standalone from the rest of the system.

A new Og feature is automatic generation of finders for all
properties.

* Rails 0.10.1: FCGI stability, WS generator, tons of fixes

David Heinemeier Hansson announced the latest version of
the Rails web
application framework. "Action Web Service has seen the most
interesting improvements feature-wise with a new generator
and tie-ins
with the testing setup." XML-RPC support has been improved.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top