Rails Reading - Oct 7, 2009
Better Gem Publishing with Gemcutter : Freelancing Gods
f you’re working with Ruby and have been paying attention to Twitter or RSS feeds, then you’ve probably heard of Gemcutter. If not, it’s the latest flavour for publishing gems, and I’m finding the simplicity of it a delight.
Its appearance is doubly useful, as since GitHub has moved to Rackspace, automated gem building from projects has been disabled, perhaps never to return.
Formtastic: Forms Made Crazy Easy for Rails Developers
Formtastic is a Rails plugin by Justin French that aims to take the headaches out of building forms in Rails views. To build it, Justin wrote down how he’d like a form creation DSL to look and then worked backwards to building the code necessary to implement that DSL. The result is a very obvious and straightforward form creation DSL.
Ruby Best Practices - Structs inside out
Today we’re back to normal blog mode, where each article stands for itself. Muppet Labs are closed and we will be continuing our journey across the Ruby universe starting with an indepth look at Ruby’s Struct class — Ruby’s Swiss army knife for structured data.
Struct can be used without any additional require statement — it’s just there. This means it comes with zero additional overhead during initial interpreter startup — one of the many advantage of using Struct. But first let’s look at the basics.
Getting started with Cucumber, RSpec, Webrat and multiruby : The If Works
Songkick uses Cucumber for acceptance testing, with help from RSpec, Webrat and factory_girl. The test suite is huge, so needless to say I’ve spent a lot of time getting up to speed on these tools so I can get to work.
While these tools have great support for various web frameworks, I wanted to get down to basics so I can try them out for non-Rails (and non-web) projects. I’m going to go through all the setup you need to start writing Cucumber features by writing a quick test for checking Google search results.
A List Apart: Articles: Internal Site Search Analysis: Simple, Effective, Life Altering!
Understanding of your site visitors’ intent is one of the most delightful parts of web data analysis. In this article, we’ll learn five ways to analyze your internal site-search data—data that’s easy to get, to understand, and to act on.
A List Apart: Articles: Testing Search for Relevancy and Precision
Despite the fact that site search often receives the most traffic, it’s also the place where the user experience designer bears the least influence. Few tools exist to appraise the quality of the search experience, much less strategize ways to improve it. When it comes to site search, user experience designers are often sidelined like the single person at an old flame’s wedding: Everything seems to be moving along without you, and if you slipped out halfway through, chances are no one would notice. But relevancy testing and precision testing offer hope. These are two tools you can use to analyze and improve the search user experience.
Easy Rails API Authentication Using restful-authentication | Compulsivo
You’ve got a Rails application and you’d like to add an API. This tutorial assumes you are using restful-authentication.
QuarkRuby: UTF-8 and html screen scraping in Ruby on Rails
Before I start, if you have any doubts or you are unaware about character sets (i.e. you are not familiar with words like utf-8, unicode etc), I would recommend you to read Joel’s The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
The problem statement of this article is How to handle foreign or accented characters in html screen scraping. We encountered it while working on our website information project Quarkbase.com
nirvdrum’s weblog :: Lessons Learned in Large Computations with Ruby
This is the follow-up post to my GitHub Contest Recap post that I promised. As mentioned, I submitted two entries for the GitHub contest, starting with Ruby and then rewriting in Java. This post summarizes why I ultimately dropped Ruby in favor of Java for this particular task. I apologize for its length, but it is divided into discrete sections and can be read in chunks without great loss of continuity.
Informative Slides from a talk on data extraction, modifying and reporting @ Lonestar Ruby Conference.
Lazy Enumerators in Ruby « Autodidact
I gave a talk on Ruby’s Enumerators at the DC Ruby Users Group in August. I’ve posted my slides from the presentation, if you’re interested. Basically, I discovered that enumerators make lazy evaluation easy to implement in Ruby, and applying lazy techniques with enumerators may yield more efficient and elegant code.
I have not really used Ruby much. I’ve written a few tutorials, messed around with RSpec and Test::Unit and even Rails a bit, but I really don’t know Ruby that well. I get Ruby (the MOP, instances, blocks, open classes, …) but there’s a difference between understanding that stuff and using it day-to-day.
Last night we had a Dojo in Oklahoma City and I wanted to get refreshed with RSpec, so I decided to jump in and do the bowling game kata.
Ruby Enterprise Edition 1.8.7 Released – Lower Memory Usage, Increased Speed
Today Phusion has announced the release of Ruby Enterprise Edition (REE) 1.8.7 (more specifically, 1.8.7-20090928). Once considered a bit of a joke, given the name, REE has proven itself to be anything but, with significant memory usage and speed improvements over the stock “MRI” Ruby implementation (achieved by way of patches to the MRI code). The key development with this release is compatibility with Ruby 1.8.7, rather than the 1.8.6 of previous versions.
Dav invited the GitHub team down to Yahoo! recently to talk about one of our favorite subjects (Git) and one of our favorite sites (GitHub). Tom Preston-Werner, Chris Wanstrath and Scott Chacon all stopped by and conducted an excellent tag-team tech talk. Video from that session is now up on YUI Theater with a full transcript. Thanks to the GitHub guys for coming down and letting us share this content with everyone on video.
Real-Time Web Protocol PubSubHubbub Explained
Real-time web protocol PubSubHubbub’s co-creator Brett Slatkin, an engineer at Google, gave a talk at Facebook headquarters today about how the new information delivery system works and how Facebook can support it.
He’s published his deck on his blog and we’ve embedded it below as our Real-Time Web Article of the Day. If you’re interested in making your content available in real time or more efficiently using real-time content syndicated from elsewhere, this presentation is a must-see.
Jeff’s Blog - Introducing Switchboard: Easy to use global ActiveRecord event listeners
At first this looks like a great place for ActiveRecord Observers. However, after working with Observers there are a few things I dislike - namely that you can’t easily apply observers to all of your models, and you can’t selectively turn them on and off in tests. To remedy that problem, I created Switchboard.
Switchboard is a simple, global ActiveRecord event listener framework, using a middleware-esque architecture that can easily be turned on and off.
MonkeySupport: Boosting Rails With Patches of C
MonkeySupport (or GitHub repo) is an intriguing new project by Burke Libbey that attempts to inject some crazy C power into Rails.
As you probably know, it’s possible to use C to write Ruby extensions and even to use C inline with Ruby if you have RubyInline installed. MonkeySupport uses Ruby’s C integration provisions to provide super-fast C equivalents of Rails’ ActiveSupport library.
TweetStream: Use the Twitter Streaming API from Ruby
A couple of weeks ago, popular micro-blogging service Twitter unveiled a beta “streaming API.” Twitter’s nature means they get hammered with polling requests so they’ve begun to experiment with the concept of streaming relevant data within a single HTTP request (in a Comet style). TweetStream (or GitHub repo) is a new Ruby library by Michael Bleigh to handle interacting with Twitter streams from Ruby.
Correcting Testing Mistakes: Taking Test Suite Runtime From 3 Hours to 14 Seconds
Last week, my development team and I ran across a problem with a library we had written several months before that parsed spreadsheets given to us by one of our clients and inserted the data provided into the database. At the time we weren’t sure what the problem was. We decided to run the tests and two frustratingly useless things occurred. First, all of the tests passed. Second, the test suite took 3 hours to run.
Here’s what we had done in our “unit tests.” We had placed several of these spreadsheets as examples into our fixtures folder. Then, we had created the importer object and told it to import. We then checked the results. These tests take a long time, specifically because an import can sometimes take 15 minutes depending on the amount of data we need to import. So, how do you fix something like that? Here are some ideas.
The TWiT Netcast Network with Leo Laporte
Extreme Prgramming With Kent Beck
Hosts: Randal Schwartz and Leo Laporte
Extreme programming, a software engineering methodology that advocates frequent releases in short development cycles.
I’ve had a running debate with Dietrich for two years now. He thinks that Pair Programming is the number one most important part of an agile team. I think it’s testing. That said, I do think pairing can be a nutritious part of your agile breakfast. But it’s tricky to do right and easy to do wrong.
Earlier this month, we talked about RVM, a little piece of software to switch between different versions of Ruby on Linux or OSX systems. However, Windows users were left out in the cold. Not anymore, Pik aims to provide the same functionality (minus the compilation of Ruby interpreters) for Windows users. Pik 0.1.0 has just been released and is in quite an unfinished state, implementing support for only MRI (the official Ruby interpreter). Support for jRuby and IronRuby (Ruby on .net) will come in the future.
script/nginx : Freelancing Gods
This morning I decided to get Nginx and Passenger set up in my local dev environment. I needed an easier way to test of Thinking Sphinx in such environments, but also, I find Nginx configuration syntax so much easier than Apache.
And of course, if I’ve got these components there, it would be great to use them to serve my development versions of rails applications, much like script/server. So I’ve got a script/nginx file that manages that as well. Sit tight, and let’s run through how to make this happen on your machine.
Pair Programming: Lone Programmer Shoots Back | Pathfinder Development | Software Developers | Blogs
I got a few angry and scolding comments on my last post on pair programming. Let me address each of the issues in turn:
EuRuKo 2009 Barcelona 9-10 May. EuRuKo 2009 videos, ou yeah!
With a little delay, and we are sorry for that, we already can offer to every of you the videos of the talks on the EuRuKo2009 conference.
An Engineer’s Guide to Bandwidth (Yahoo! Developer Network Blog)
Web app developers spend most of our time not thinking about how data is actually transmitted through the bowels of the network stack. Abstractions at the application layer let us pretend that networks read and write whole messages as smooth streams of bytes. Generally this is a good thing. But knowing what’s going underneath is crucial to performance tuning and application design. The character of our users’ internet connections is changing and some of the rules of thumb we rely on may need to be revised.
WindyCityRails 2009 Videos
paperplanes. How Not To Design An API
I’ve had the dubious pleasure of working with a certain library. It’s a layer to talk to most of the Amazon Web Services APIs. While working with web services usually is a particular awful experience, this library doesn’t make much of an effort to hide their awkwardness, in fact, in some ways it even makes it worse. It’s pretty old news that I enjoy bitching about code I don’t like, but I also like to keep it positive in at least thinking about how it could be improved.
Let’s take a moment and have a look at what part of their API is particularly nasty and how the situation could be improved. We actually wrote a micro-wrapper around that library to make things a bit less awful for us, and to at least keep their code out of ours.
How Ravelry Scales to 10 Million Requests Using Rails | High Scalability
Tim Bray has a wonderful interview with Casey Forbes, creator of Ravelry, a Ruby on Rails site supporting a 400,000+ strong community of dedicated knitters and crocheters.
Casey and his small team have done great things with Ravelry. It is a very focused site that provides a lot of value for users. And users absolutely adore the site. That’s obvious from their enthusiastic comments and rocket fast adoption of Ravelry.
Corpus Adamicum - Beware the frumious nested attribute
Nested attribute assignment is one of the recent additions to Rails that made a great deal of sense, and made a lot of people happy. Chances are you’ve either used nested attribute assignment by now, or you worked on an older project that really could have used it. If you haven’t yet, check it out and see what you think.
Unfortunately, not all is well in Railstown. Nested attribute assignment is slick, and the related implementation of #fields_for makes it even slicker, but #fields_for can cause you some headaches if you’re not careful. Possibly if you are careful as well.
Carsonified » OpenSocial Tutorial
Want to reach more than 500 million users with your social app? OpenSocial is the key. The OpenSocial standard will allow you to build apps that work across a number of massive social networks, including MySpace, Orkut, Ning, hi5 and LinkedIn (complete list).
Preoccupations - Jim Remsik - For Writing Software, a Buddy System - NYTimes.com
I’M a programmer at Hashrocket, a Web development firm in Florida. Our style of working is called pair programming, which has been popular for years in some software design companies. Two of us sit side by side at a computer workstation to develop a program that is the backbone of an interactive Web site.
vox dolo dot me | Given Due Consideration
As alluded to by veez, the undercurrent from some of us at Hashrocket has been decidedly anti-cucumber. Here’s my brief littany:
* A well developed cucumber suite is invariably slow to run
* For me, at least, it makes development feel slower (this is almost certainly perceptual, but that doesn’t mean it’s not actual as well)
* The indirection makes debugging laborious
* Matching plain english to executable code via regular expressions just feels wrong
All of these things (and more) have been excused for quite some time because Cucumber is thought of as a necessary tax. If you want to do full stack integration testing in Ruby… this is how it’s done.
Here’s the good news: it’s not the only way!
From Cake to Rails | Blog | Jimmy Cuadra Web Services
Now that I have finished a large project in Ruby on Rails, I think it’s time to document some of my thoughts on how it compares to CakePHP. I’m in the unique position of having built the exact same application twice, once in CakePHP and now once in Rails. My findings were that Rails is superior in most aspects, but a lot of this has to do with the superiority of the Ruby programming language over PHP.
This entry was posted on Wednesday, October 7th, 2009 at 11:24 am and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


