Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Author Archives: Peter Cooper

By Peter Cooper / December 18, 2006

Errxmas

Chris Wanstrath laments that the Ruby Inside Advent Calendar isn’t Rails-specific, and since Rails does ‘everything faster’, he has produced an entire Rails Advent Calendar in one post! Curiously though, Planet Err has 39 days leading up to their Christmas.. but regardless, Chris presents 39 choice Rails snippets. Read More

By Peter Cooper / December 17, 2006

Wirble
If you haven’t got tab-completion and syntax coloring in your irb, you owe it to yourself to follow these instructions right away (should work for Linux, OS X, and Cygwin users). First, install the Wirble gem:

sudo gem install -y wirble

Next, create or edit a file called .irbrc in your home folder (~/.irbrc), and make sure these lines are included there:

require ‘rubygems’
require ‘wirble’
Wirble.init
Wirble.colorize

Now play with irb and see joy similar to that in the screenshot above. Try tab-completion too. It’s great! Read More

By Peter Cooper / December 17, 2006

Imagescience

Almost anyone who’s tried to install Image/GraphicsMagick and RMagick on several different systems has experienced the pains of compilation, having to download this and that, and inconsistencies here and there. When all you want to do is produce some quick thumbnails from your Rails app, you can quickly feel it’s a bit overkill.

Enter ImageScience, a “clean and happy” Ruby library focused on producing thumbnails quickly and easily. According to the author it “kicks the living crap out of RMagick” and “doesn’t leak memory like a sieve”. I haven’t experienced any issues with RMagick myself, beyond the installation of its dependencies, but I haven’t been paying attention. Read More

By Peter Cooper / December 17, 2006

css_dryer is a Rails plugin by Andrew Stewart that makes putting together stylesheets for your Rails applications more efficient than ever before. It supports nesting and basic variable interpolation. For example, here’s an example of nesting:

div {
/* comment for div */
color: green;
p {
/* comment for div p */
color: red;
b { color: blue; }
}
}

And using variables makes it easy to update constants in your stylesheet:

<% sleek_grey = ‘#fefefe’ %>
#sidebar { border: 1px solid <%= sleek_grey %> }
#footer { footer: 1px dashed <%= sleek_grey %> }

Andrew has put together some great instructions on how to get it all going here. Read More

By Peter Cooper / December 16, 2006

Given the audience that Ruby Inside has, I think there’s a potential for us to make some big changes in the Ruby world. I propose accepting some advertising and sponsorship on Ruby Inside, and in return I will publicly disclose the amounts and give all of the money back (minus any forced costs, such as tax) to the Ruby community as donation to Ruby-related projects, offered as bounties, and/or pay for even better articles and tutorials. Rest assured, it will not be money that will sit in a big pot waiting for decisions to be made. The choice of where the money will go will be influenced by Ruby Inside readers, naturally. Read More

By Peter Cooper / December 15, 2006

Dhaka is a set of tools written in Ruby by Mushfeq Khan that can generate tokenizers, parsers, and evaluators of context-free grammars (my own shabby contribution in this field was posted to RubyInside recently!). Dhaka’s ultimate goal is to make a pure Ruby, flexible parser generator. From the official site:

Dhaka provides DSLs specialized for specifying grammars, tokenizers and evaluation rules. It can take a grammar and generate a finite-state automaton for parsing it. The generated parser can then be ‘compiled’ to ruby source-code so that it need not be generated again. Dhaka also supports exporting generated parsers to the GraphViz dot format for visualizing states and actions. Read More

By Peter Cooper / December 14, 2006

Devpals

DevPals is a brand-new ‘questions and answers’ site for programmers. As well as covering Ruby, it also covers Java, .Net, and PHP. Developer Pat Toner asked if I’d link to it in the Ruby Inside sidebar, and I said it’d also be good to do a mini interview. I was intrigued as to why Ruby was included alongside the other admittedly more popular languages at the expense of, say, JavaScript, Python, or VB. Read More

By Peter Cooper / December 13, 2006

Exactly one year ago David Heinemeier Hansson and the rest of the Rails core team (smaller back then!) unveiled Rails 1.0, the first ‘production quality’ release of Ruby on Rails. Alongside the release came an entirely new Rails Web site, the same as the one we’re familiar with now. The next day, December 14, DHH followed up with some brief insight and wondered: “I can’t wait to see where this will all go in 2006.” Read More

By Peter Cooper / December 12, 2006

Vdbex

Ilya Grigorik has put together a great article explaining how he has used Ruby, along with the Scruffy graphing library, to develop a basic visual database explorer.

Last night I wrote a quick database explorer for one of my projects (screenshot above). I had a database of lead stories for BBC, Yahoo News and NY Times over a period spanning Sept. 2004 to Aug. 2005 and I wanted to juxtapose and visualize different queries. The concept is simple, given two words (ex: war / peace), I wanted to see some aggregate calculations over the available document corpus.

At first, I wanted to write about a great Ruby graphing library (Scruffy) I found, but later realized that I could nail three different concepts at once: writing a simple threaded web-server, interfacing with a database, and generating live graphs (SVG/XML). Read More

By Peter Cooper / December 11, 2006

The JRuby team has just announced the release of JRuby 0.9.2 (download). Despite being a minor point release, a lot of things have been tweaked and added. Direct from the team:

This release has some great improvements:

Extensions openssl and readline now working
Code for a new graphical irb console
Partial support for iconv and bigdecimal extensions
RSpec now supported
Improved Rails support
Fixed all known block and scoping bugs
Enhanced parser performance
More compiler and performance work
Refactored variable scoping logic
127 Jira issues resolved since 0.9.1

Congratulations to the JRuby team for their continuing efforts! Read More

By Peter Cooper / December 11, 2006

Arduino

After reading this interesting post about using Ruby and a microcontroller for homebrew electronics projects, I discovered Ruby/SerialPort. It’s a Ruby library that works on Windows, Linux, BSD, OS X, and other POSIX operating systems. It’s reasonably old, but as demonstrated in the first link, works on OS X pretty well even now in 2006. There’s some code demonstrating its use here.

Using Ruby/SerialPort and Arduino, an open-source physical computing platform (basically a microcontroller with a standardized serial interface, it seems), it’s pretty easy to connect Ruby to electronics circuits. Tied up with a nice LED display or mini text display, this could become a cute tool for building desktop display devices for showing RSS, weather, etc. Read More

By Peter Cooper / December 10, 2006

Tiobedec2006

Another month, another step up the TIOBE Programming Community Index! Just last month we reported that Ruby had moved from 13th to 12th, and now it’s up one more, to 11. The TIOBE Programming Community Index isn’t the most official chart in the world, but is one of the most objective. Ruby has moved up from 27th in September 2004, to 11th now.

For those who are not familiar with the index:

The TIOBE Programming Community index gives an indication of the popularity of programming languages. The index is updated once a month. The ratings are based on the world-wide availability of skilled engineers, courses and third party vendors. Read More

By Peter Cooper / December 8, 2006

There was no “Troll of the Month” feature in November, because I couldn’t find any. December has started off strong, though, with two articles: Why Django Kicks Ruby on Rails’ Collective Ass and Constructive Reasons to use Django Instead of Rails. While the first is definitely the most inflammatory, both make bizarre arguments (amongst some good ones, admittedly) and seem to be nothing but “let’s bitch about Rails to make Django look better”-fests.

One key argument is, essentially: ‘Django is better because Python is better’. This seems as wise as ‘God must exist because the Bible says so’. Just because somebody thinks Python ‘is’ better doesn’t mean that it is. Read More

By Peter Cooper / December 7, 2006

Doodlekit-1 Doodlekit2-1

Doodlekit is a cute looking Rails-powered Web application developed by Doodlebit. It’s a complete Web design and hosting system in one, aimed at small businesses and families. Features include a WYSIWYG editor, a photo album (with all resizing and tagging), blog system (with WYSIWYG editor, again), discussion forums, and contact form. The system is entirely hosted by Doodlekit, but you can create entire, powerful Web sites through their control panel, and even host them on your own domain name. Plans range from $9 to $45 per month.

I decided to give developer Ben Kittrell a quick interview to get a bit of background on Doodlekit, its development, and his opinions on Rails:

Ruby Inside: Hi Ben. Read More

By Peter Cooper / December 6, 2006

Evan Weaver has leaped to the rescue with a hotfix (installable as a gem) for the cgi.rb DoS vulnerabilities. This hotfix is ideal for those who don’t want to install Ruby or patch again. Evan’s site has been having some DNS issues (related to the EveryDNS outages) so I hope he doesn’t mind me repeating part of his post here:

I’ve constructed a hotfix for the cgi.rb vulnerability of yesterday. First, make sure you have the Hoe gem installed. Then:

sudo gem install cgi_multipart_eof_fix –source blog.evanweaver.com

Run the included test to verify the flaw is corrected. To apply the fix, you must require the gem in every affected application, as follows:

require ‘rubygems’
require ‘cgi_multipart_eof_fix’

If you only use mongrel_rails for application hosting, you may install mongrel like so:

sudo gem install mongrel –source=http://mongrel.rubyforge.org/releases

Then mongrel will require the fix for you, provided you have installed version 2.0.0 of this gem. Read More