20th - 26th June 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.
This edition covers two weeks due to there being no edition for 13th – 19th June.
Articles and Announcements
- Congrats to why_
- Ruby at OSCON
- FreeRIDE project - Call for help
James Britt read a post about the book The Best Software Writing I: Selected and Introduced by Joel Spolsky.
why the lucky stiff’s A Quick (and Hopefully Painless) Ride Through Ruby was of course included.
_why himself responded:
And acres of jubilant thanks to all of you fine helpers. It’s been well over a year since I started this particular brand of poignancy and there’s no end to the new flow of kind people who are still just becoming acquainted with the elf, his pet ham, the time-travelling uncle and his dead niece, the goat, the foxes tall and small, et al. I doubt the import or effectiveness of what I’m doing constantly, but I feel compelled to do it. In fact, there’s something very compelling about working on something of such dubious relevance!!
I’m also happy to say that I’ve just reorganized my waking hours and malloc’d a huge chunk of time each week to work on the book. Forthcoming: a sparkly magic beard for cats and a spaceship full of married couples and one panda.
Phil Tomson posted the “top 10 OSCON tutorials based on attendee signups so far.”
Third was a tutorial on Rails and eighth was an introduction to Ruby.
He also announced that the PDX.rb user group were organising some activities around OSCON, on Wednesday afternoon/evening.
Anyone attending on that day should contact him. If your Ruby talk was rejected for OSCON, please contact Phil if you’d like to present your talk to the group and friends.
In other conference news, Tanaka Akira was at LinuxTag 2005 and posted a message asking who else would be there.
Laurent Julliard posted a “call for help” for the FreeRIDE project.
“Since its inception in September 2001, FreeRIDE, the 100% Ruby IDE, has made a lot of progress (http://freeride.rubyforge.org). The current version has quite a large number features and, above all, the underlying plugin architecture (FreeBASE databus) has proven to be stable and perfectly suited for this type of application.”
Currently, the only active project members are Laurent and Curt Hibbs, both of whom have limited time for FreeRIDE at the moment.
Laurent posted some areas which need help - documentation, Windows platform, MacOS X platform and testing. Adding support for collaborative programming was later mentioned.
Quote of the Week
Harry Ohlsen recalled ...
Twenty odd years ago, I was sitting in front of the console of a Unix system, using nroff to write a paper for uni.
Since the printer was in the same room, and I was the only person there (it was about 0300) I was just piping the output of the nroff command directly to it.
After having successfully done this four or five times, I ran another nroff command to print the latest copy for proof reading … then I waited … and waited … and waited.
After about five minutes, this came out on the line printer:
The world will end!
As you can imagine, this freaked me out just a little. At that point, I decided that the last version I had was good enough :-).
It wasn’t until about five years later, when I was reading the eqn manual … eqn is the filter that formats mathematics for nroff … and saw the following:
“All rows of the matrix must contain the same number of columns, or the world will end”
It took me about ten minutes to stop laughing.
Link of the Week
YubNub: http://www.yubnub.org/.
Described by its author Jon Aquino as “a (social) command line for the web”, YubNub takes URL web commands away from web browser software and onto the web page. Why? Now commands are shared with everyone.
“YubNub is a command-line for the web. After setting it up on your browser, you simply type “gim porsche 911” to do a Google Image Search for pictures of Porsche 911 sports cars. Type “random 49” to return random numbers between 1 and 49, courtesy of random.org. And best of all, you can make a new command by giving YubNub an appropriate URL.”
More complex commands are possible, for example “xe -amount 100 -from USD -to EUR”.
Best of all, YubNub was created as an entry into the Rails Day contest - a well-sponsored competition to write the coolest web application in 24 hours, using the Ruby on Rails web framework. (Results out soon!)
Threads
Anybody using Ruby 1.6.x?
Timothy Hunter: “With Ruby 1.8.3 on the horizon, should I continue to support building RMagick for Ruby 1.6.7 and 1.6.8? Is anybody still using these versions? Is any commonly-used Linux distro shipping with one of these versions of Ruby?”
Ara.T.Howard: “yes. all the redhat enterprise linux distros. this is the official government os for certain departments – we have thousands of machines running 1.6.8, which is the official redhat rpm. it’s the bane of my existence. anyone know who to talk to at redhat to convice them to use a more modern ruby?”
Dir[] and Windows Network Addresses
Brian Takita asked how he could get the contents of a Windows network directory using theDir interface.
Daniel Berger noticed something interesting with
Dir on Windows that
Charles Mills summarised as
Dir['C:\\*.*'] returning an empty array,
while Dir['C:/*.*'] returned some
filenames.
nobu replied that this wasn’t a bug -
backslash is a meta-character in Dir.[]
(an alias of Dir.glob).
For example, Dir.glob("*.{rb,h}")
matches all files in the current directory with
extensions rb or h.
Backslashes are then used to represent e.g. literal ‘{’ characters.
The solution therefore is to always use forward slashes:
Dir.entries("//vadevweb/public")
XHTML with WEBrick
R. Mark Volkmann asked “How can I configure WEBrick to treat requests for XHTML files just like HTML files? I think what I need is for it to correctly set the content type of the response so that the web browser renders it correctly.”
He answered his own question a few hours later:
mimeTypes = server.config[:MimeTypes]
mimeTypes['xhtml'] = 'text/html'
ICFP 2005 Programming Contest
Ryan Leavengood thought it would be fun to compete in this year’s ICFP Programming Contest.
Other people expressed interest in forming a team.
ASP.NET vs Ruby on Rails
Stephen Kellett asked if anyone had used both ASP.NET and Ruby on Rails. “Care to compare and constrast?”
Dema was working with both platforms, and said that they “approach different ways for building web apps, but both manage to do it in a very high quality manner.”
“In the end, it’s much more about developer’s taste and less about technical issues.”
Tobin Harris had also used both. He found that ASP.NET has a lot of power and flexibility, but it isn’t always easy to get things done.
“I think it lacks the high level of abstraction that Rails has.” “I think one of the main reasons I like Rails is that the framework makes a lot of decisions for me.”
Joseph Graham preferred ASP.NET because of its “component driven architecture”, and other reasons, including having more control over the format of URLs.
ActiveRecord + Jabber + PostgreSQL
Tom Copeland: “It’s entirely possible that I’m the only person in the universe using the above combination. However, on the off chance that someone else is too, here are some notes on getting Jabber 1.4.4 set up to log to a PostgreSQL database schema that can be nicely read by ActiveRecord.”
finding differences between dates
Joseph Paish wanted to find the number of days between two dates in “mm/dd/yyyy” format.
Paul Brannan said he should use the Date class.
irb(main):008:0> require 'date'
=> true
irb(main):009:0> Date.parse('11/05/1994') - Date.parse('3/7/1988')
=> Rational(2434, 1)
Chess Variants (II) (#36)
James Edward Gray II posted part two of the Chess Variants Ruby Quiz.
Part one was to create a program having a basic user interface for playing chess and verifying that moves are valid.
Part two introduces 7 variants of chess, including “Fibonacci Chess”, “Gun Chess” and “Madhouse Chess”.
The task is to modify your original program to support the variants. (Or modify someone else’s original!)
Best way to parse/update HTML file?
Bucco asked for advice on parsing an HTML file. He’d tried REXML (an XML parser), however this didn’t work because the file in question wasn’t properly formed XML.
daz said that the ‘ruby-htmltools’ package was a good bet.
Ruby/Java Bridge running on Windows
See also Ruby and Java.
Both these threads discussed how to glue together Ruby and Java code.
One option is RJB (RubyJava Bridge). It lets you communicate via runtime reflection.
Jason Foreman: “It works pretty well, but can be a bit ‘low level’ sometimes, due to the nature of its implementation. IE, sometimes you need to know how to construct java method signatures and such (not a big deal)”.
ruby-dev summary 26223-26324
Kazuo Saito summarised the ruby-dev Japanese mailing list.
It reported that Shugo Maeda had ported the patch that allows Ruby to use libedit instead of GNU readline. It is now available on 1.8 as well as CVS HEAD. The new version works on Mac OS X Tiger.
Ruby/REXML vs XSLT
John Carter wrote:I’m just looking at 5000 lines of the gnarliest XSLT that generates out of XML some C to pack and unpack a serial protocol.
Ooo, it’s ugly, ugly, ugly.
Anyone ever tried to do something in both Ruby REXML and the samething in XSLT?
Was it prettier in Ruby?
Was it easier? Fewer lines of Code? (by what ratio)
How about speed? The XSLT is chewing on 14500 lines of XML in (almost) too long a time.
James Britt had begun using XSLT at one stage, but switched to the REXML stream parser when he ran into issues.
Logic in XSLT requires an appreciation of functional programming. XSLT is really quite good at complex matching and templating, especially if you need to grab and match stuff from all over the document, or when you are not quite sure where something will be.
But for highly regular data sources then it can be overkill.
R. Mark Volkmann said that “the best thing about XSLT is XPath”. XQuery also supports XPath, but unlike XSLT doesn’t have XML syntax.
New Releases
Net::SSH 1.0.1, Net::SFTP 1.0.0
Jamis Buck set forth a maintenance release of Net::SSH. It “fixes a bug that caused data to be sent twice in some circumstances”. It also adds a timeout option and (possibly) allows the Putty Agent to be used under Windows.
“Net::SFTP 1.0.0 is the more-or-less stable, more-or-less final release of Net::SFTP.”
Tar2RubyScript 0.4.7
Erik Veenstra fixed a “serious bug” in Tar2RubyScript, relating to the error message ‘doesn’t contain an init.rb’.
Tar2RubyScript transforms a directory tree containing your Ruby application into a single Ruby script that can be executed.
“It’s Ruby’s JAR”.
De.linque.nt: An irresponsible metaweb posting tool
James Britt destroying the web:
Here’s the premise: Del.icio.us, the social bookmarking site, lets you create posts that assign a set of tags to a URL. The post also provides a description field as well as an area for extended information.
Usually, Del.icio.us posts refer to some other Web resource, but the act of creating a Del.icio.us post also creates a new Web resource: the Del.icio.us URL for the new post.
Since this Del.icio.us post is a Web resource it can itself be the target of a Del.icio.us post. In fact, one can create posts for Del.icio.us resources that do not exist until the post is created, i.e., the post URL you bookmark is the one that will refer to the bookmark you are creating. And that is what De.linque.nt does.
Freaky.
ruby-ftgl 0.1 (True type font rendering in OpenGL)
Bill Kelly announced the first version of ruby-ftgl.
“Ilmari Heikkinen and I have created Ruby bindings for the FTGL library. FTGL is a C++ library that uses the freetype2 library to render true type fonts in OpenGL using various methods. (Outline, Polygon, Texture, Bitmap, Pixmap, and Extruded.)”
A new japanese dictionary and learning tool in Ruby
Mathieu Blondel unleashed the first version of Nihongo Benkyo. It is a dictionary and learning tool for Japanese.
Its interface supports English and French and “Searches words from kanji, kana, romaji or translation.”
traits-0.4.0 - the coffee release
Ara.T.Howard shook out a new traits release. “i wasn’t drinking enough coffee while coding the 0.3.0 release. this is a remedy release.”
“traits.rb aims to be a better set of attr_* methods and encourages better living through meta-programming and uniform access priciples.”
ruby-ldapserver-0.1
Brian Candler released ruby-ldapserver, “a lightweight, pure Ruby skeleton for implementing LDAP server applications. It is intended primarily for when you wish to build a gateway from LDAP queries into some other protocol or database; it does not attempt to be a full implementation of the standard LDAP data model itself (although you could build one using this as a frontend)”.
FixedPt-0.0.1
Phil Tomson introduced FixedPt, a class for representing fixed point numbers.
“This class is not very useful unless you are trying to model hardware - if you’re doing that it can be very useful.”
irb-history 1.0.0: Persistent, shared Readline history for IRB
Sam Stephenson announced irb-history. It provides a persistent, shared readline history for irb.
AllInOneRuby 0.2.5
Erik Veenstra released the latest version of AllInOneRuby. It provides a compressed executable for each of Windows, Linux and Mac OS X that includes the Ruby interpreter and libraries.
“Why? Because it’s sometimes not easy, or possible, or desirable, or allowed to do a complete Ruby installation. That’s where AllInOneRuby comes in. I always have a USB-memory stick with AllInOneRuby in my pocket.”
A bug to do with ’—site’ was fixed.
Text::Format 1.0.0
Austin Ziegler announced Text::Format 1.0.0. It “provides the ability to nicely format fixed-width text with knowledge of the writeable space (number of columns), margins, and indentation settings.”
Ruby/Odeum 0.4.1 -- Bug Fix & Index Server
Zed A. Shaw made a “quick bugfix release” of the Ruby/Odeum full-text search library.
ri2ref 0.0.1 - reference manual genarator based on ri
speakillof was pleased to release ri2ref. It generates reference manuals using the ri documentation tool.
“I don’t think RDoc’s HTML frame is preferable. ri2ref generates HTML pages without frame and has some features.”
webgen 0.3.5
Thomas Leitner added some features to webgen, a tool for generating web pages from page description and template files.
Nitro + Og 0.19.0: Og reloaded part2!
George Moschovitis released new versions of the Nitro web application framework and Og object-relational mapper.
“Og reloaded part 2: Another superb release introducing a balanced mix of innovative new features, common but useful stuff and bug fixes.”
Important changes include “Og polymorphic relations” such as ‘belongs_to’ and ‘has_many’.
As usual, there were many more features.
Google Maps Hacks
Ben Giddings released an early version of ‘Google Maps Hacks’, some Ruby code for working with Google’s Satellite Map service.
“So, here’s what I have. I can create an XML file that contains a “polyline” element. This draws a blue line on the map like the one you can get when you ask for directions.”
tree 0.3
Dave released version 0.3 of tree, a KDE application used to share YAML data over a secure network.
Syntax 1.0.0
Jamis Buck roared “INTRODUCING SYNTAX 1.0! IT’S EXPLOSIVE! IT’LL MAKE A REAL PROGRAMMER OUT OF YOU! IT’LL EAT YOUR DOG AND DISCOVER URANIUM IN YOUR BACKYARD!”
Okay, it’s a lexical analysis framework, targeted at producing syntax highlighted source code output.