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

Author Archives: Peter Cooper

By Peter Cooper / February 27, 2007

Jonathan Conway of New Bamboo (more on this at the end of this post) has put together a rather comprehensive walkthrough on using mocks with Rails and using them to define your interfaces. Not having cut my teeth with mocks yet, I took the rare step of asking for a personal summary of the article by the author himself, and Jonathan delivered!

Everyone’s heard of using stubs and mocks to replace external systems or third party libraries within their applications tests, but something a lot of people don’t realise is that by stubbing and/or mocking associated models in unit tests it allows them to think more clearly about the interfaces in which they communicate with each other, hopefully leading to less coupling and a cleaner design. Read More

By Peter Cooper / February 26, 2007

Skype and Google Talk are pretty clever in the way that they still work even if all of its users are behind firewalls (or NAT systems) that block incoming connections. The way they enable two-way connections is by using a ‘firewall busting’ technique. Simply, a central server does nothing but share IP addresses (and port numbers) and clients can then ‘punch’ holes through their firewalls and trick their firewalls and routers to route incoming packets back to them if they have certain source host and port numbers.

I was playing with the technique and have put together an example client that you can run on two separate hosts that have no open incoming ports but which demonstrates two way connection to an arbitrary port (6311 in this case) with UDP. Read More

By Peter Cooper / February 25, 2007

Okay, it’s not our beloved programming language, but how often does a song called “Ruby” come around? You don’t see many songs called Python or Haskell getting in the charts, whereas we get to enjoy #1 singles, a popular girls name and precious stones. Read More

By Peter Cooper / February 23, 2007

Here’s a detailed tutorial of how to use Capistrano and Deprec (a set of add-on ‘deployment recipes’ for Capistrano) to put together a solid deployment system for your Rails applications on an Ubuntu server.

(Credit for lead: Matthew, via e-mail) Read More

By Peter Cooper / February 22, 2007

Btv

Alexey Kovyrin writes to tell me about his site BestTechVideos.com and its comprehensive collection of references to 51 different Ruby and Rails related videos and screencasts. BestTechVideos appears to be a general index for tech related videos, but I haven’t seen anything like this for Ruby videos before so it’s well worth a look! Read More

By Peter Cooper / February 22, 2007

A lot of people seem to want to reinvent the wheel where Ruby is concerned, and I wish them all luck, but Tomasz Węgrzanowski has taken the unique step of trying to make the existing C-based Ruby interpreter faster instead, with intriguing results.. He even goes as far as to hack Ruby’s source code to remove inefficiencies in how Fixnum objects are compared. I totally dig this and would love to support further efforts to implement non-damaging optimizations to the existing interpreter.

Could someone intimately familiar with the construction of the current interpreter comment on whether these techniques en masse could yield significant benefits at little re-implementation cost? Read More

By Peter Cooper / February 22, 2007

Rails’ ActionMailer library can send e-mail for you, and while it can be set up to use almost any SMTP server, special requirements by Google’s GMail SMTP server have presented Rails users from taking advantage of it. Ages ago I mentioned a solution to the problem, but it involved downloading a separate application called ‘msmtp’ and performing an ugly system call from your application.

There’s a far cleaner solution, and it’s escaped my attention for almost five months now. Anatol Pomozov has written a small library using net/smtp and OpenSSL that changes some of net/smtp’s methods to allow it to directly talk to secure SMTP servers such as GMail’s. Read More

By Peter Cooper / February 21, 2007

Snapballot

This week Bruno Bornsztein got in touch with me to mention his new Rails-powered Web application, Snapballot. It’s a quick and easy poll / survey creation service that works using Flash and Rails. I quickly realized how many projects I’d seen coming from Bruno lately (12 at the last count) and decided to quiz him on his addiction to Rails and the development of Web apps.

Ruby Inside: You started out in Web application development with FeedMarker.com, an online RSS news reader with tagging and bookmarking features. What was involved in its construction and operation?

Bruno Bornsztein: When I started building Feedmarker, I didn’t know much about web development (and I had only just heard of Rails). Read More

By Peter Cooper / February 20, 2007

Restfulrails

A month ago I reported on the release of a PDF (in German) covering Rails’ REST abilities by Ralf Wirdemann and Thomas Baustert (the authors of the first German Rails book, “Rapid Web Development mit Ruby on Rails“). With the help of Florian Görsdorf and Adam Groves, they’ve produced a fine English translation titled “RESTful Rails Development”. It’s still free (although donations are accepted).

It’s only about thirty pages long, but in that space it packs in a lot of information about Rails and REST, including REST routing, URLs, view techniques, path methods, and how to nest resources. Read More

By Peter Cooper / February 19, 2007

Ferret
(photo credit: mrpattersonsir)

Gregg Pollack and Jason Seifer have just launched a new Rails blog called Rails Envy, and to kick things off Gregg has written an in-depth acts_as_ferret tutorial.

Ferret is a Ruby port of the Apache Lucene high-speed search library, and acts_as_ferret (created by Jens Kramer) is a plugin that makes it ridiculously easy to add search features to most Rails applications. You can add search capabilities with just a few lines of code in your models (to specify which columns to index) and by using some special finders. Gregg walks through the installation and use of acts_as_ferret and demonstrates how to integrate it into an existing Rails project. Read More

By Peter Cooper / February 19, 2007

If you were in the Rails community six months ago, you might remember the Caboose Rails Documentation Project, a drive to raise $5,000 USD to spend on improving the Rails documentation. It turns out they actually ended up with $15,000 due to the overwhelming support of the community, but the process got mired in debate about what to do with the cash.

No matter, though, as things are now moving and Jamie van Dyke has been hired for one day per week to work on Rails documentation. Jamie is now looking for ideas from the community on what he should be working on specifically. Read More

By Peter Cooper / February 18, 2007

Snippets-1

Last week I sold Code Snippets to DZone (known as the “Digg for developers” and providers of Ruby Inside’s “Latest Ruby Links” sidebar). I have not heard of many Rails powered sites selling, so I thought I’d throw out my own story of how it happened.

Code Snippets dates from early 2005 when I’d only been using Rails for a little while. I saw a video made by Sam Stephenson demonstrating an as-then unreleased content tagging system and as the code wasn’t available it inspired me to create a tagging and storage site for bits of code. Short of time, I knocked up Snippets in two days, and got to experience Rails’ ultra-fast prototyping abilities (and this was before plugins for doing tagging or authentication!). Read More

By Peter Cooper / February 17, 2007

This post just links to a few Ruby videos I’ve found on Google Video that I hadn’t seen before.

How to Design A Domain Specific Language with David Pollak. 1 hour 2 minutes. Slides easy to read, camera is close to projector. David kicks things off with a surprising answer to “What is the world’s most popular programming language?” that grabbed my attention straight away.

Code Generation With Ruby with Jack Herrington. 50 minutes. Interestingly, a product manager from Google suggests Ruby will “in the long run” become “more and more popular here”, which is good.

Ruby and Google Maps with Andre Lewis. Read More

By Peter Cooper / February 16, 2007

Steve Odom writes about how he uses Capistrano and Amazon’s Elastic Compute Cloud to deploy a Rails application to a fresh server within minutes. He includes the scripts and techniques he uses.

This article makes me think of the possibilities of using Pound and perhaps even a database outside of EC2 and then seamlessly deploying Rails instances within EC2 and letting Pound do the balancing. The infrastructure problem is getting easier every day it seems.

(Thanks to Robert Rasmussen for this lead) Read More

By Peter Cooper / February 15, 2007

Picture 2-5

Pete Forde of Unspace, a Canadian Rails consultancy, writes:

We just posted a video of Ryan (McMinn) from Unspace doing a talk on building a successful business being a Rails consulting shop.

He talks about freedom, passionate developers, and the importance of hiring musicians.

I thought that it might be of interest to your readers, since working full time on Ruby projects is likely a dream many people have. They need to watch this video, finish dreaming, and quit their crappy day jobs.

It’s only 15 minutes and the recording quality is pretty good. If you have any thoughts on building a Rails consultancy or breaking away from your day job to become a full-time Rails developer, check it out. Read More