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

Author Archives: Peter Cooper

By Peter Cooper / June 17, 2010

For the past couple of years, Hampton Catlin (best known as the inventor of Haml) has run an annual Ruby survey and you can take the 2010 survey now. There are 23 multiple choice questions, mostly about your library and coding preferences.

At the time of posting, 3619 people have taken the survey and, interestingly, you can check out the results of the survey as it goes on – the results page is automatically updated each day.

Things that stand out in the results are the significant growth in jQuery, Ruby 1.9 (up to 24% this year from 7.6% in 2009), and Haml usage, and that 10% of respondents list Sinatra as their webapp framework of choice (up from 2.8% in 2008). Read More

By Peter Cooper / June 17, 2010

I received this e-mail today:

Who could refuse such a short, pleasant e-mail? Not me, which is why if you’re looking to soothe your soul and do some Rails work, you should check out their job listing. You need to be near to Seattle as you need to be on-site at least a day or two each week, but full-time and half-time arrangements will be considered. Read More

By Peter Cooper / June 16, 2010

If you’re using the MongoDB document oriented “NoSQL” database from Ruby at all, you owe it to yourself to try John Nunemaker’s MongoMapper – it’s practically the ActiveRecord of the MongoDB world.

The latest version is a strong step forward. ActiveRecord-esque scoping has been added, and a smart new querying DSL has been implemented that lets you do things like:

User.where(:age.gt =27).sort(:age).skip(1).limit(1).all

If you’re not using MongoDB at all and aren’t sure what all the hoopla is about, John’s Why I Think Mongo Is To Databases What Rails Was To Frameworks from December 2009 is a great high-level introduction to the concepts involved. Read More

By Peter Cooper / June 16, 2010

In Rethinking PDF Creation in Ruby, Jared takes a playful swipe at Gregory Brown’s much loved Prawn PDF generation library. He expresses a preference for converting HTML and CSS documents to PDF, rather than using the more PDF-level conventions Prawn adopts. To do this, he and some colleagues built PDFKit, a Ruby HTML-to-PDF library powered by wkhtmltopdf.

Given the “Prawn is a bit meh” tone of Jared’s article, though, Gregory Brown is not impressed and points out that Prawn gives you stronger and more precise under-the-hood control, useful particularly for building complex forms, tables and doing point-perfect positioning of on-page elements. Read More

By Peter Cooper / June 14, 2010

Developers hankering for more performance from their Rack and Rails applications are using Ruby 1.9 fibers and event-based EventMachine-driven libraries as a way to boost the performance of their applications – in opposition to scaling by merely running multiple processes or using threads.

It’s no secret that thread-based development can be Hardâ„¢, even if you didn’t have to deal with Ruby quirks like autoloading not working properly and the GIL (Global Interpreter Lock). Luckily, Ruby 1.9 provides fibers, light-weight “execution units” that are manually scheduled by their parent application.

Back in April, Mike Perham introduced Phat, an asynchronous Rails 2.3.5 app running on Ruby 1.9 and supporting “many concurrent requests in a single Ruby process.” In his explanation, he referred back to Scalable Ruby Processing with EventMachine, a talk he gave at Austin On Rails that’s worth checking out. Read More

By Peter Cooper / June 14, 2010

This is a simpler, open source equivalent to systems like New Bamboo’s Pusher, but using the Comet-like Bayeux protocol with AJAX rather than WebSockets. Start a server (based on node.js or Ruby/Rack) and then push and pull messages between clients and apps in JavaScript and Ruby. Read More

By Peter Cooper / June 12, 2010

fog is a Ruby gem by Wesley Beary to control a variety of cloud services through a unified API. It deals with both server cloud and storage based services and supports Amazon S3 and Rackspace Files; as well as servers and on Amazon EC2, Rackspace Servers, Terremark vCloud and Slicehost. Support is also available for Amazon ELB and SimpleDB.

The beauty of fog is how the same code interacts with different cloud services. It uses models, an idea familiar to anyone who has used an object mapper (like ActiveRecord), to abstract the common parts between cloud services. That leads to code that you can switch between cloud services easily. Read More

By Peter Cooper / June 11, 2010

This is a great idea. It’s still a couple of months way, but on whyday.org you can sign up for more updates, or you can follow @celebratewhyday on Twitter.

If you want to reminisce in the meantime, Ruby Inside’s link-packed A Cup Full of Why: 32 Why The Lucky Stiff Links will get you started. Read More

By Peter Cooper / June 11, 2010

The tenth RubyConf has been announced. It’ll be in New Orleans, LA between November 11-13, 2010. You can’t register yet, but there’s a button to book a room at the official hotel.

Considering how quickly RubyConf sometimes sells out, it’s worthwhile following @rubyconf on Twitter to be sure to catch when registration opens in case I don’t let you know quickly enough..! Read More

By Peter Cooper / June 10, 2010

Simone’s library public_suffix_service makes it easy to parse any domain name into its TLD, unique domain name, and subdomain portions, following the myriad of rules regarding all of the different TLDs that currently exist. Read More

By Peter Cooper / June 10, 2010

Clojure, a dialect of Lisp, seems neat, but I can’t get over the endless sea of parentheses. It’s a shame a less noisy approach hasn’t come to the fore. If Clojure floats your boat, though, check out Peepcode’s Functional Programming with Clojure screencast. Read More

By Peter Cooper / June 10, 2010

An interesting experiment with EventMachine. The number of minor Ruby webapp frameworks has now hit triple digits :-) Read More

By Peter Cooper / June 10, 2010

DHH gives an insightful and accessible 38 minute walkthrough of some of Rails 3′s differences from Rails 2.0 and explains the motivations behind them. A particular focus is given to improvements made to the routing system (both for REST and non-REST URLs).

I’ve been a bit lukewarm on Rails lately, opting instead to strongarm Sinatra into doing whatever I want, but DHH’s keynote is a compelling overview that encourages me to give it a fair look.

The final release of Rails 3.0 is expected within the next few weeks, with a release candidate in the next week or so. Read More

By Peter Cooper / June 9, 2010

DataMapper, one of the best known Ruby ORMs (Object Relational Mapper), has reached a significant landmark: version 1.0. DataMapper is typically competing against ActiveRecord and Sequel amongst Ruby developers who want to talk to databases, but DM offers a number of unique advantages and is extremely flexible and modular (even supporting Redis-based stores). Read More

By Peter Cooper / June 9, 2010

I don’t know how fast Brian’s balls are, but I could escape the jQuery source code (about 164KB) about 1000 times per second on my iMac and that seems pretty fast. It was also very easy to install on OS X (everything is done with a gem install escape_utils).

Brian claims his C-backed library is 10-20x faster than existing Ruby-based escaping techniques for HTML and 16-30x faster for JavaScript. Read More