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

By Peter Cooper / August 29, 2006

This isn’t particularly new, alas, but still interesting:

Got 15,842 records that you’d like to export to a file? Using the standard the Rails ActiveRecord::Base#find method will load all 15,842 into memory all at once and return them all in an array. If your app is running on a shared host, or if you’re keeping your app on a memory budget, this is a big problem for you. So you could load each record one by one, but that’ll kill your db server. Wouldn’t it be sweet if #find could return an enumerable that would load your records in batches of say 1,500 records? Read More

By Peter Cooper / August 29, 2006

Prolific PuneRuby blogger Satish Talim has just begun a course of free Ruby lessons. They’re open to anyone who wants to get involved, and so far 43 people are signed up! The lessons have already begun, but you can still get in on the action. The syllabus is available to check out, and to register to receive the lessons you only have to e-mail Satish at satish.talim /at\ gmail.com. This might be an ideal chance to get those friends who keep asking you questions about Ruby off your back ;-)

(E-mail address fixed. Sorry!) Read More

By Peter Cooper / August 27, 2006

#!/usr/bin/ruby
require ‘rubyhp’
__END__
<html>
<body>
<% cgi.params.each do |key, value| %>
<%= key %>: <%= value %><br />
<% end %>
<% if cgi.params.empty? %>
Sorry, please enter some cgi parameters. How about "?foo=baz"?
<% end %>
</body>
</html>

Christopher Cyll has put together a great little example of how to quickly create templated Web pages with Ruby without requiring any frameworks. It relies on CGI, but sometimes that’s all you need, and it makes throwing together tiny Ruby-powered Web pages possible as easy as creating a simple PHP page. Read More

By Peter Cooper / August 25, 2006

It’s not mentioned on the official Ruby homepage yet, but Matz has just announced the release of Ruby 1.8.5 on the Ruby mailing list. He claims there are no big changes from 1.8.4 and cites stability as the main benefit of upgrading. Unless you’re having problems with 1.8.4, however, I’d wait a few weeks to see how it pans out, but if you’re itching to try it out get it from http://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz Read More

By Peter Cooper / August 24, 2006

Today I read JesusPhreak’s “Of snakes and rubies; Or why I chose Python over Ruby” and it highlighted a few of the feelings that have been running around in my head lately regarding Ruby. He points out Python’s wealth and depth of libraries, style guides, and how Python is wider used and less dependent on a single technology to promote it. While Rails is good, he seems to feel that Rails is defining the entire Ruby experience too much. I’m inclined to, sadly, agree.

While Ruby has a large life outside of Rails, Rails tends to define the experience for a great deal of new users. Read More

By Peter Cooper / August 24, 2006

Testingcheatsheet

Geoffrey Grosenbach is unstoppable! He’s put together a simple, but effective, cheatsheet for Ruby and Rails testing that’s full of assertion references. Enjoy.

Link now fixed. Thanks Mike! Read More

By Peter Cooper / August 24, 2006

The entries and the numbers associated with them were shown in the last post, so choosing a winner is as simple as using ‘rand’. For the first prize $100 drawing:

irb(main):001:0> rand(24) + 1
=> 19

1st prize of $100 goes to Duncan Beevers with Using Simile Timeline with Ruby on Rails Views. A well deserved win too, as it’s a particularly cool demonstration of how to use a JavaScript / AJAX library to show timelines on your Web pages.

And for the second drawing:

irb(main):002:0> rand(6) + 1
=> 3

2nd prize of $15 goes to Tim Shadel.

Thanks for all of the entries folks, and I hope those of you who didn’t win will still enjoy checking out the 24 great articles and resources created for the contest. Read More

By Peter Cooper / August 24, 2006

These are all the valid entries into the first prize contest from which one random winner will be chosen:

1. Setting Up a Rails Development Environment and Deploying to Textdrive by Jordan McKible.
2. Anatomy of an Attack Against Rails 1.1.4 by Evan Weaver.
3. Top 13 Ruby on Rails Presentations from TechKnow Zenze.
4. Noobies First Impression of His First RoR Project by Shane Thomas.
5. Ruby/Tk Client for SOAP Server by Satish Talim.
6. Ruby-Prof and Call Graphs by Pat Eyler.
7. Profile and Ruby-Prof: Getting Specific by Pat Eyler.
8. Security Threat Last Week by Nick Seiger.
9. Read More

By Peter Cooper / August 23, 2006

Rubyphone

RubyPhone is the first Ruby project I’ve seen relating to telephony (although if you can leave links to others in the comments, please do!) but this code example struck me as particularly interesting:

phone.answer(call) if phone.ringing?

They say it’s ultra-alpha quality, but if you’re getting into this area, it’s worth a look. Read More

By Peter Cooper / August 22, 2006

Alex Bradbury has developed Ariel, a library that uses predefined examples to work out how to extract information from other documents. It was a Google Summer of Code project and was mentioned by Austin Ziegler. More directly from Alex:

Ariel is a library that allows you to extract information from semi-structured documents (such as websites). It is different to existing tools because rather than expecting the developer to write rules to extract the desired information, Ariel will use a small number of labeled examples to generate and learn effective extraction rules. It is developed by Alex Bradbury and released under the MIT license. Read More

By Peter Cooper / August 22, 2006

Scott Laird looks at how to profile memory leaks in Rails:

One of my long-running problems with Rails (and Ruby in general) is that it’s difficult to debug memory leaks. I’ve had a number of cases where I’ve stuck something into a long-lived array or hash and discovered much later that my Ruby process was eating over 100 MB of RAM. While ps makes it easy to see when Ruby’s using lots of RAM, actually figuring out where it went is a lot harder. Read More

By Peter Cooper / August 21, 2006

>> story.description = "Peter flippin’ _Cooper_"
=> "Peter flippin’ _Cooper_"

>> story.description
=> "<p>Peter flippin&#8217; <em>Cooper</em></p>"

>> story.textiled = false
=> false

>> story.description
=> "Peter flippin’ _Cooper_"

Chris Wanstrath has created acts_as_textiled, a new plugin for Rails that allows you to specify columns on your model to be automatically parsed as Textile content. Read More

By Peter Cooper / August 20, 2006

Hiveminds Magazine has a long article about using Ruby’s DBI library to connect to databases, along with installation instructions. Read More

By Peter Cooper / August 18, 2006

Some readers have checked out the little publicized chatroom that’s always been linked to from Ruby Inside, but it’s been really flaky. Luckily, however, new Web 2.0 startup, Lingr, provide an absolutely amazing, fast, and easy to use chatroom and I’ve set it up for Ruby Inside right away.

Lingr

So without further ado, check out the new Ruby Inside chatroom. Everything is on-topic, but if you want to talk Ruby, all the better. I’ll be on there for the next few hours until I go to sleep tonight. Wow! Thanks to all the people who dropped by.. including, goatsmilk, bricolage, atmos, lazyat0m, THOMAS, jonbaer, DerGuteMoritz, UncleD, PabloC, *** ****, lpjkuytx, jakecutter, cdcarter, cboone, dema, defunkt, and Richard Livsey. Read More

By Peter Cooper / August 18, 2006

Ruby Inside is running a $100 contest for people who write a Ruby or Rails related article, resource post, or tutorial this week. There’s still just over 24 hours left to run so get your entries in quickly if you want a chance at winning the $100. So far there have been 16 entries and they’re all pretty good. But.. there are only two entries for the second prize so far, so if you want some great odds at winning the $15 second prize, link to the contest and let us know about it!

Here are the 16 entries for the top prize so far:

1. Read More

Recently Popular Posts