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

Author Archives: Peter Cooper

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

By Peter Cooper / August 17, 2006

Geoffrey Grosenbach looks at how to use memcached, a fast in-memory caching daemon, from Ruby and Rails to speed up common repeated data operations, including ActiveRecord lookups. He also includes a useful install script and patch for Mac OS X users to make memcached fly on that platform. He also demonstrates the use of the cached_model gem to significantly speed up database reads from Rails applications. Read More

By Peter Cooper / August 17, 2006

Autoadmin

AutoAdmin is a new plugin for Rails that automatically generates an administration interface for your models. It’s heavily inspired by Django, where meta-data relating to the administration interface is placed directly into the models. This goes directly against David Heinemeier Hansson’s preferences, but might be perfect for your own systems.

Example model code: Read More

class Customer < ActiveRecord::Base
belongs_to :store
has_many :payments, :order => ‘payment_date DESC’

def name; first_name + ‘ ‘ + last_name; end

sort_by :last_name
search_by :first_name, :last_name
filter_by :active, :store
default_filter :active => true
list_columns :store, :first_name, :last_name

admin_fieldset do |b|
b.text_field :first_name
b.text_field :last_name
b.select :store
end
admin_child_table ‘Payments’, :payments do |b|
b.static_text :payment_date
b.static_text :amount
end
end

By Peter Cooper / August 17, 2006

Scruffy

Scruffy is a new graphing toolkit for Ruby developed by Brasten Sager. It’s highly customizable and powerful. You can change the backgrounds, mix different types of graph together, change the graphics used for the points, change the line types, etc. You can also render to different types of output. Brasten presents some code examples at his blog. For demonstration, some is repeated below:

graph = Scruffy::Graph.new
graph.title = "Comparative Agent Performance"
graph.value_formatter = Scruffy::Formatters::Percentage.new(:precision => 0)
graph.add :stacked do |stacked|
stacked.add :bar, ‘Jack’, [30, 60, 49, 29, 100, 120]
stacked.add :bar, ‘Jill’, [120, 240, 0, 100, 140, 20]
stacked.add :bar, ‘Hill’, [10, 10, 90, 20, 40, 10]
end
graph.point_markers = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']

graph.render(:width => 800, :as => ‘JPG’)

(Thanks to Brasten for fixing my sloppy cut and paste job. Read More

By Peter Cooper / August 16, 2006

Heatmap

Heat maps allow you to see where people are clicking on your Web page(s) and while some pay-for, professional systems offer this feature, David Pardo has put together a guide, including Ruby and JavaScript source, of how to create your own from scratch! Read More

By Peter Cooper / August 16, 2006

ar_mailer is a system that automatically queues outgoing mails from Rails applications (using ActionMailer) by placing them into a special database table, to then be handled by a separate process, ar_sendmail. This could be particularly ideal for systems with mass mailing applications or simply as a method to speed up certain requests in your Rails applications since only a single database write is required rather than waiting for an e-mail to finish sending. Read More

By Peter Cooper / August 16, 2006

Beast

Rick Olson and Josh Goebel have teamed up to produce Beast, a lightweight but well styled forum. Rails has sorely been lacking a good, well styled, open source forum, but Beast is great. Check out the demonstration forum or go get the code for yourself. Read More

By Peter Cooper / August 15, 2006

Rubyoneclipse

If RADRails doesn’t capture your fancy and you’d rather use regular Eclipse as your Ruby IDE, Tabrez Iqbal has a great walkthrough of setting up Eclipse and using it to develop Ruby applications along with lots of screenshots and useful information. Read More

By Peter Cooper / August 15, 2006

Grp

Juixe presents a list of 13 top Ruby on Rails presentations that you can watch, listen to, or download. Topics cover pure Rails, Rails vs Python comparisons, software design keynotes, Flex, and Java.
Note: This is one of the first entries in the “Write a post about Ruby and win $100” contest that Ruby Inside is running this week. If you want to get in on the action, learn more, and write an interesting Ruby post on your weblog before this Sunday! Read More

By Peter Cooper / August 14, 2006

Findby

Josh Susser explains exactly how Rails’ dynamic finders work (things like User.find_by_name and User.find_all_by_city). It’s a good introduction to some of the simpler abstractions taking place under the hood in Rails, and is an ideal guide if you’re thinking of creating similar abstractions of your own. Read More