Ruby Weekly News 14th - 20th November 2005


#1

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

Ruby Weekly News 14th - 20th November 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 S…

[Contribute to the next newsletter.]

Articles and Announcements

 * RedCloth mailing list
 -----------------------

   why the lucky stiff introduced a new mailing list for RedCloth, 

the
Ruby library for using the Textile humane text format.

 * Use of Ruby in Laboratory Automation
 --------------------------------------

   Neil Benn is guest-editing 'The Journal of the Association for
   Laboratory Automation', and is looking for examples of how Ruby 

is
used in this area. (Or, even better, someone to write an
article.)

   Devin M. said that Brent Roman gave a presentation on this 

topic
at RubyConf 2005 (“Embedding Ruby into a Robotic Marine
Laboratory”),
and gave links to audio & video of the talk.

   He also mentioned the [SciRuby] project, which is concerned with 

the
use of Ruby in science.

 * Ruby/SDL for Mac OS X
 -----------------------

   Duane J. wrote an article on using Ruby/SDL on Mac OS X.

   | Ruby/SDL is a binding for the Simple DirectMedia Layer, which 

is a
| library that makes 2D (and some 3D) graphics as well as sound
and
| basic keyboard/mouse support available in a cross-platform way.
| Perfect for building games with!

 * Fosdem : Developers Room, Presence
 ------------------------------------

   Thomas R. said that, with the next Fosdem (Free and 

OpenSource
Developers’ European Meeting) coming up in February 2006, we have
the
opportunity to register a “presence”, and arrange to have a room
set
aside for Ruby.

   "Any help, and remarks are welcomed."

 * Help requested: new book
 --------------------------

   Mark W. is planning on writing a new book on "Enterprise 

Ruby",
and asked for help defining the topics it will contain.

   "I am going to release this as a free PDF file under a Creative
   Commons license, but I would also like to find a publisher who 

would
make hard copy versions available to readers who want a physical
book."

User Group News

 * Learning R. Hackfest Hosted by new_haven.rb this Friday
 -----------------------------------------------------------

   Gregory B. announced a mini Hackfest run by the New Haven Ruby
   Brigade (Connecticut, U.S.) on November 18th. The aim is to pair 

up
experienced Ruby programmers with newbies and have them work
through a
Ruby Q. together.

 * London Ruby U. Group meeting - 23 Nov
 ------------------------------------------

   Rob announced the London Ruby U. Group meeting on the 23rd of
   November. "Tiest will present a summary of what happened at 

RubyConf
2005. Followed by general Ruby chat and a move to the pub."

Image of the Week

“LONELY IN THE CROWD” by napaey

Threads

Ruby, SOAP and WSDL

Henning Jansen wanted to write a Ruby server that provides a SOAP
interface, matching an already-defined WSDL specification.

He couldn’t find any tool for generating Ruby code from a WSDL file,
and
had also heard “Dyanamic languages like Ruby don’t really need WSDL”.

The the first point, Hiroshi N. referred him to wsdl2ruby.rb,
which
is part of the SOAP4R project, but not in the standard Ruby
distribution
(which only includes the runtime components).

It is also possible to simply call driver =
SOAP::WSDLDriverFactory.new(“http://some/foo.wsdl”).create_driver to
load
the WSDL at runtime, instead of generating code.

As to whether Ruby needs WSDL, Ryan L. said that being a
dynamic
language it can intercept and create methods “on the fly”, so it
isn’t
necessary to know what the target methods are at `compile time’.

James B. noted that WSDL is more than just method/type
declarations; it
also provides information on what services are available, and how to
invoke them.

Equvialent of RoboCode and/or Terrarium for Ruby?

Kyle H. wondered if Ruby had any equivalents to “RoboCode” or
“Terrarium” (or RoboWar), multi-player systems where developers
create AI
to compete with each other.

Dave B. said there wasn’t, yet. “Tim Bates started work on Rubots,
and I
have early-stages code and ideas based on RoboCode, but that’s the
extent
of it.”

There was lots of discussion and interest in creating such systems.

ruby’s weird operators (||=)

Mark asked what was with all the “weird” operators in Ruby like ||=
?

Guillaume M. said that they’re not so weird; a = b is just a
shorter way of writing a = a b.

For example, x ||= 3 means x = x || 3, in other words, set x to 3 if
it is
not defined, is nil, or is false.

why the lucky stiff noted the [FunnySymbolsInCode] page on
RubyGarden.

Converting between Time and DateTime

This thread discussed the difference between Time, Date and DateTime,
and
in particular how to convert between Time and DateTime.

One technique was given by David A. Black, although it was observed
that
it works by generating and parsing intermediate string
representations,
which is less efficient than a more `direct’ approach of initialising
one
via the fields of another.

time = … some Time

date_time = … some DateTime

d = DateTime.parse(time.iso8601)
t = Time.parse(date_time.strftime("%c"))

Kirk H. said that this works because the parse method for both
classes
is based on a single shared method, while an alternative approach was
given by Daniel S.: (although it doesn’t handle timezones,
fractional seconds etc.)

class DateTime
def to_time
Time.mktime(year, mon, day, hour, min, sec)
end
end

class Time
def to_datetime
DateTime.civil(year, mon, day, hour, min, sec)
end
end

As to the reason for the separate classes, Kirk said that they are in
fact
different in significant ways.

| Time and Date/DateTime use two entirely different mechanisms for
keeping
| track of the passage of time. Time utilizes seconds since the start
of
| 1970-standard Unix time tracking.
|
| Date/DateTime uses keeps tracks of days and fractions of days using
| Rational, and it’s start of time is about the start of the year in
4712
| B.C.

Ron M, noting limitations with Time on systems where time_t is
32-bits,
thought it would be good if Time would automatically convert to some
sort
of BigTime object when the year is out of range. (In the same way
that
Fixnum converts to Bignum.)

“Today, that’s not the case, and selecting fields representing a
200-year-lease throws an error when done through DBI.”

Tanaka A. said that this would be hard, since Time just uses the
underlying operating system’s time support, from which information on
out-of-range years is not readily available.

A solution is to use an operating system that has 64-bit time_t.

In the Time out of range when selecting from database? thread, Kirk
said
that it wouldn’t be too difficult to make DBI::Timestamp behave
nicely
when the time doesn’t fit in a Time.

Euchre Hands (#55)

James Edward G. II introduced Ruby Q. number 55, “Euchre Hands”.

The problem is to write a program that determines the “trump suit”
for
hands in the card game Euchre.

Small practice programs

dark2: “For someone with some programming background and an interest
in
learning Ruby, what are a few good “practice” programs to write?”

Gregory B.: http://www.rubyquiz.com/.

James B.: “Do you use a computer on a regular basis? Do you find
yourself doing the same little things over and over, by hand? Write
Ruby
code to automate or simply them.”

Crash Course on Speed for Ruby

Damphyr and his colleagues will be providing a three-hour
introduction to
Ruby for a group of “high calibre, experienced professionals with
very
good theoretical and practical background, so we only need to provide
a
highspeed hands-on tour of Ruby and let nature take it’s course”.

Has anyone already prepared material suitable for a three-hour
workshop?

Edwin van Leeuwen suggested the [WhyRuby] repository.

A dRuby application running as a Windows service?

Dominic M. asked how he could turn a druby (distributed Ruby)
application into a Windows service.

Jamey C. pointed out an example he’d written which uses the
win32-service Ruby library.

New Releases

isi.rb Version 0.8

Takeshi Nishimatsu announced for “Rubies and TeXnichians” a new
version of
the ISI Export Format to BibTeX Format convertor.

Brian Schröder added a “shameless plug” for his rbibtex, a Ruby library
for manipulating BibTeX.

Ruby-GNOME2-0.14.1

Ruby-GNOME2-0.14.1 was announced by Masao M., fixing some serious
memory leaks. All users of 0.14.0 are advised to upgrade.

Ruby-GNOME2 is a set of Ruby bindings for the GNOME 2 development
environment.

Ruby RTF 0.1.0

Peter Wood released the first version of Ruby RTF, a library for
creating
RTF (Rich Text Format) files.

ruby-feedparser : RSS/Atom feed parser

Lucas N. said that ruby-feedparser had been extracted from the
Feed2Imap project and is now available as a standalone library. It is
used
to parse Atom and RSS feeds, and is designed to be robust in the face
of
invalid input.

No formal release has been made, but the SVN (Subversion repository)
version is usable.

rctool-1.1.0

rubikitch announced the latest version of his tool allowing
developers to
programatically update `rcfiles’ (e.g. “.emacs”), while providing
notifications and control to users.

Nitro + Og 0.25.0 Og scope, dynamic finders, evolution, helpers, bug
fixes

George M. was pleased to announce new versions of Nitro and
Og, a
web application framework and object-relational mapping library,
respectively.

The focus of the release was on stability, but features were also
added,
including “constrained / scoped queries”, dynamic finders/generators,
and
an experimental schema evolution system.

Ruby/GD2 1.0

Rob L. improved the API of Ruby/GD2, a wrapper around the library
for
creating images.

Documentation was also added.

Ferret 0.2.1 (port of Apache Lucene to pure ruby)

David B. updated Ferret, his port of the Apache Lucene searching
and
indexing library to Ruby.

The query interface now supports searching across multiple fields at
the
same time, the library is threadsafe, and simple interfaces for
updating
and deleting documents are provided. Primary keys were also added.

ruby-growl 1.0.1

Eric H. fixed ruby-growl to work with the version of Ruby
distributed
with Mac OS X Tiger.

“Growl is a global notification system for Mac OS X. Applications can
register messages which Growl displays on the screen in a variety of
ways
depending upon your preferences.”

ruby-growl allows you to send growl messages from non-Mac OS systems
(but
not receive them).

Nihongo Benkyo 0.3

Mathieu B. let out a new release of Nihongo Benkyo, a tool for
use
with Japanese dictionary files.

Ruport 0.2.5: Enumerable DataSets, and things that go bump in the
night

Gregory B. bumped through the “I’m releasing too often” edition of
Ruport, a report generation framework.

Robert Canieso has joined the project, and will be working on the
Ruport::Format module.

The query interface has been improved in this release.

Reg - Ruby Extended Grammar 0.4.6

Caleb C. made a new release of Reg, a mini-language for
“matching
patterns in ruby object graphs”.

“Reg provides matchers for Strings (via Regexps), Symbols, Hashes,
and
several alternatives for matching Objects, but the main feature is
the
ability to match Arrays of arbitrary ruby data using vaguely
Regexp-like
syntax.”

FasterCSV 0.1.3–CSV parsing without the wait!

James Edward G. II posted another version of FasterCSV, a library
intended to be a faster (currently ~ 10x) parser of CSV than the
`csv’
library that comes standard with Ruby, while remaining pure-Ruby
code.