Rails Reading - Sept 21, 2009
Railscasts - Finding Unused CSS
Finding Unused CSS
Over time a CSS file can become large and filled with unused selectors. In this episode I show how to use the Deadweight gem to determine which CSS selects you can remove.
Create a simple API with Ruby on Rails - Arthur Chang
Here are the few easy steps to creating a simple API in a Ruby on Rails project.
Looks Good Works Well: Designing for Interesting Moments Talk
I gave a talk on Designing for Interesting Moments at Microsoft for the UX team as well as at the Ruby Meetup Group at CMU and finally this week at The Ajax Experience in Boston.
Here is the longer version of the talk.
A Deeper Look at mod_rewrite for Apache - Nettuts+
When people think of .htaccess configuration the first thing that pops into most people’s minds is URL manipulation with mod_rewrite. People typically get frustrated with mod_rewrite’s complexity. This tutorial will walk you through everything you need to know for the most common mod_rewrite tasks.
As the number of tests goes up in your Rails project, you’ll find yourself spending more and more time staring at the field of green dots waiting for the RSpec to finish.
You may notice some pauses, and be tempted to tail the test log file to figure out what’s slowing things down, but thankfully there’s a better way.
Profiling All Examples
Passing the –profile flag to RSpec produces some additional output, namely the running times of the ten slowest examples in your specs. So this:
spec -p spec/*/*_spec.rb –colour –format profile
Code Monkeyism: Essential storage tradeoff: Simple Reads vs. Simple Writes
When I studied computer science with a focus on databases, the holy scripture said only to use normalized data. For my exam I had to study 2NF and 3NF. And now it seems this is all wrong for large scale operations. From my education, I still have a strong feeling towards the pureness of normalized databases – and detect this feeling in many developers. In reality denormalized schemas are the way to go.
8 Lessons From Corey Haines’ Performance Kata
Gregg Pollack posted this video to the Envy Labs Blog. It’s a terrific example of Test Driven Development. Here is the video and 8 lessons you should learn from it
and another thing… - Simple DRY Validations
Here’s a handy trick for making custom validations easily reusable.
PaulBarry.com - Why Rails 3 Will Require Ruby 1.8.7
This past weekend I attended the Windy City Rails conference. It was in a great location in the heart of downtown Chicago and seemed to have a pretty good turn out. There were many great talks but this blog post will be focusing on a specific talk, and more precisely, part of a talk. Yehuda Katz gave a talk on the status of Rails 3. One of the things that he mentioned, which you may have already heard, is that Rails 3 will require Ruby 1.8.7 or higher, dropping support for Ruby 1.8.6. He also mentioned why they are doing this and I found the reason to be interesting. It’s not that the Rails core team wants to try to take advantage of any specific new features, it’s that Ruby 1.8.6 has a bug which has been fixed in 1.8.7.
Carsonified » Why You Should Switch from Subversion to Git
Now, this isn’t really a how-to on Git – I won’t be going over a lot of specific commands or get you up and running. This is a list of arguments on why you should be seriously considering Git if you’re currently using SVN.
Gamasutra - News - GDC Austin: An Inside Look At The Universe Of Warcraft
Within the World of Warcraft team, there are some 30 department leads. There are three tiers of management, with France Pierce (Executive Producer) on top. Production Director Brack and Game Director Tom Chilton are below him, and below those two men are arrayed 8 lower-level managers. Brack notes that they try to structure the teams around the people, and not the other way around. They feel strongly that employee strengths should dictate organizational structure, and as a result all reporting structures within the company vary by team.
Rails 2.3.4 includes a conventional way to add seed data to your application - no more including it in the migration files.
I wrote previously that we always keep the documentation at a minimum. How can we then avoid documenting things like build procedures or deployment procedures?
How To Create Your Own Programming Language (Using Ruby and/or Java)
Create Your Own Programming Language is a interesting new information product and community by Marc-André Cournoyer (of Thin fame) that promises to teach you how to create a simple programming language. The official site is well worth checking out, even if you don’t want to buy it, as it’s a great example of how to sell a product like this. Create Your Own Programming Language costs $39.99 and has a two month money back guarantee.
FriendlyID: A Slugging and Permalink Plugin for ActiveRecord
FriendlyID, a plugin by Normal Clarke, Adrian Mugnolo, and Emilio Tagua, describes itself as “the Swiss Army bulldozer of slugging and permalink plugins for ActiveRecord.” In layman’s terms, FriendlyID helps you get out of numerical ID hell and into an easily organized heaven of well formatted, textual slugs and IDs for your Rails apps.
Keep Your Friends Close, But Your Test Data Closer | Viget Extend
While this is good practice for production code, the tests in your application can benefit from refactoring as well. Often, it is the setup phase of the unit testing cycle where you will encounter the most duplication. The following example was extracted from Tweets of Fury (go play now, I’ll wait) – I’m using both Shoulda and Matchy for the tests:
Carl and Richard talk to Leon Gersing about his love afair with Ruby, which he so elequently spoke of as an audience member at DevLink in Nashville (show #476).
redirect_to :hack » Distinguish your environments with favicons
When I developed SalsaJungle.com, I was sometimes confusing my development and production websites. I know it doesn’t sound too clever but there are times when I reloaded a page after a fix only to realize that I was looking at the production site. That’s what happen when you multitask between development and client support.
The RunCodeRun Blog - Get to Green on Ruby 1.9
Ruby 1.9 is a terrific step forward from 1.8, and it is high time to start looking at moving your code there. (If you’re a Rails developer, you’ve probably heard that Rails 3 won’t just work on Ruby 1.9; it will prefer Ruby 1.9.) Of course, it isn’t just about your own code. What about all those gems and plugins you depend on? Will they work on 1.9? Community feedback, such as that organized at isitruby19.com, is one great way to see what’s working on 1.9.
RubyEnRails 2009 - The Dutch Ruby And Rails Conference
Welcome to RubyEnRails Amsterdam 2009
On October 30th it is time for the fourth annual RubyAndRails conference! This year we even have a two day conference. After the conference day on friday, we have an extra ‘Geek-day’ on saturday!
GitHub is Moving to Rackspace! - GitHub
In just a few short weeks we will be moving GitHub to a new home at Rackspace. We’re aware of the current stability and performance issues, and we want to let you know what we’re doing about it. After all, we’re GitHub users too! The move to Rackspace will bring about a new backend architecture and a lot more servers, leading to a much improved user experience for everyone. Thanks for sticking with us through our growing pains!
Pragmatic Studio: Interview: Dave and Chad on Advanced Ruby
The Advanced Ruby Studio is coming up next month (early registration ends soon!), and folks often ask what to expect in our advanced classes. So I asked Dave Thomas and Chad Fowler (the instructors) to share a few of their thoughts on the Advanced Ruby class.
Keep a Paper Trail with Paper Trail | Linux Magazine
In general, coders should audit transactions whenever possible. While a regular backup plan hedges against data loss, audits safeguard against information loss. It’s fairly easy to cook up a solution—say, hook the CRUD functions in your application—but if you’re a Rails developer, there are a good number of capable gems and plug-ins ready for use. Ryan Bates looked at vestal versions in a recent Railscast, and acts_as_versioned has been available for quite some time. Here, I want to look at another impressive solution called, aptly, Paper Trail.
Corners of the Rubyverse: RVM and MacRuby | Pathfinder Software Development | Blogs
I wanted to talk about two cool corners of the Ruby universe that I started using as a result of my Snow Leopard installation: MacRuby and RVM
Rails Envy Podcast – Episode #092: 09/17/2009 | Rails Envy
Episode #092. I’m joined again by Dan Benjamin and we have quite a fun time. You may know Dan from his compiling Ruby, Rails, and MySQL guides, cork’d, and most recently Playgrounder. We’ve got a ton of news this week and I promise to have a song stuck in your head by the time you finish.
Ruby on Rails Code Quality Checklist - Matthew Paul Moore
As ThriveSmart hires more developers - not all of them Ruby or Ruby on Rails experts - there’s a growing need to ensure that code and design strategies maintain an extremely high level of quality across different projects. My good friend Dan and I assembled this checklist that all of our teams are expected to sign off on for each of their projects. It’s an evolving list, but here’s a snapshot of it.
Why Ruby is an acceptable LISP
it turns out, Ruby compares well as a functional language, and it fakes macros better than I’d thought.
Alex Young: Deployment: Diffs and Dependencies
We moved house recently, so my daily development machine was packed up for a few weeks while I worked off a laptop and a 3G card. It was like being on holiday except I still had to work. Anyway, I found a few deployment-related scripts I was working on for my Agile Deployment series of articles (visit the agiledeployment tag for more).
Cucumber, if you haven’t heard, is the Next Big Thing™. It affords developers the ability to write human-readable integration tests. Even though it’s only at version 0.3.101, it’s full-featured with a handful of hidden gems. Here are five of my favorites.
John Resig - Talks at the 2009 jQuery Conference
Nearly the entire jQuery project team had the opportunity to meet for two days prior to the conference and hash a number of things out - figuring out most of the planning for the upcoming year. The core dev team also had the opportunity to meet and work for two days just after the conference. We’re much closer to shipping 1.3.3 now (which is likely to become 1.4, with all the new features that’re being added).
Logger - simple, yet powerful Rails debugging tool : Witold Rugowski aka NetManiac
Here comes AnnotatedLogger for a rescue. The idea is to take each message and prefix it with PID of Rails process. As long You don’t run Rails in multithread mode, this is unique ID which will make log entry distinguishable.
The Rake’s Progress – Part II - Mike Nichols - Son Of Nun Technology - Devlicio.us
Some things I have loved so far about working with rake/ruby:
* File enumeration
* Blending regular expressions where it makes things more readable
* Testability
After checking out lots of other rake files, it is easy to see how much simpler ruby can make things. Along the way I am picking up some idiom’s that (seem) more acceptable and concise.
Yehuda Katz — Dmitry Belitsky blog. Web development, freelance, happy life.
Again, get started in open source. There are a number of great app projects that are open source (like Radiant, Spree, or even Beast) if you want to dive into app development. There are also plenty of opportunities to build or help with adapters for existing libraries, like Sphinx, MongoDB, or anything else. If you’re new to Ruby but an expert in some other project, why not dive in and improve the Ruby integration with that project?
To self. or not to self. - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS
I prefer to qualify all public instance method calls with self.. I’m one to lean towards being explicit versus implicit, and self. helps me achieve this goal. This also makes coworkers (or any other individual reading the code) aware of whether the method call is an attribute defined by ActiveRecord or a public instance method on the class. The reason this is an issue is because local or block-level variables will never be prefixed with self. - it’s much easier on the eyes to be able to tell immediately whether you’re dealing with one or the other.
Why I’m Done Making Desktop Applications: MicroISV on a Shoestring
Breaking up has always been difficult for me. I tend to fall in love with being in love, and continue a relationship well past the point of futility. And so it is with my oldest love, writing desktop software.
I’m sorry, desktop apps. We just don’t have a future together anymore. Its not you, its me.
Deploy or Configure Rails on a Ubuntu Server | Dhaval Parikh
I have configured many servers till now on different OS. Like CentOs, Fedora and Ubuntu. From all the Operating systems Ubuntu is my favorite. The reason is its rails friendly according to me. Also Fedora is also good but I like Ubuntu more might be just bcoz I am more used to it
![]()
Talking about configuring rails app on an Ubuntu server takes following steps on a plain slice
Catch a tiger by the tail - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS
Rails’ logs contain valuable information
AutomateIt: Open source server automation
AutomateIt is an open source tool for automating the setup and maintenance of servers, applications and their dependencies. It provides a surprisingly simple, yet powerful, way to manage files, packages, services, networks, accounts, roles, templates and more. AutomateIt’s faster, more efficient systems management helps you run circles around competitors, deliver higher-quality service, and sleep better at night.
3 Sets of Programming Exercises to Polish Your Skills
Yesterday at the last URUG meeting, one of the presenters talked to us about Ruby threading and then got us started on an exercise building a chat server using threading. The exercise was enlightening and really cemented the concepts for a lot of the people there. So, I thought I’d share three sites that provide programming exercises to help you become a better programmer.
redirect_to :hack » Blog Archive » 5 tips for a viral Facebook Connect application
This fourth and last article about Facebook Connect gives you a few tricks to gain a viral effect with your application on Facebook. This is basically done by getting friends of your users to notice your application.
Emphasized Insanity: Find where to index your tables on a Rails app
@mrkris offered a very nice, simple and clean solution for that problem and created a short script to solve it by trying to assume foreign key usage around the application. Works? yes. Always? dunno, just pointing out that if i used a custom foreign key name, one that does not end with a _id, this script won’t recognize it. TOO BAD MRKRIS.
![]()
From Two 2 Twelve | 8 Tips To Supercharge Your Rails App
Ruby on Rails is a elegant framework with an abundance of built in functions. However, sometimes finding and implementing the right ones for your project isn’t always easy. Here, we’ll review 8 lesser-known tips that will enable you to get the most out of your dynamic web application.
Key-Value Stores for Ruby (Part 4): To Redis or Not To Redis? | Engine Yard Blog
Welcome to another post in our key value series! This week, Redis! Redis is a persistent in-memory key-value store written in C by Salvatore Sanfilippo. It’s currently in version 1.0. So let’s get down to it, “To Redis or Not to Redis?” that’s the question…
You’ve Got Mail - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS
There are just some days when you want to interact with real data from a Rails application that you wrote. Doing a database dump, saving the output locally, and loading that data in is the ideal method, but once you do that, you’ve got live data locally. This can be a Bad Thing™ if you’re sending email.
Bullet: An Eager Loading Adviser Plugin
Bullet is a new Rails plugin (developed by Richard Huang) that helps you reduce the number of queries your Rails app makes, thus increasing its performance.
Essentially, Bullet “watches” the queries your Rails app makes through ActiveRecord and notifies you as to where you should add eager loading or where eager loading is being taking place but not providing any benefits (so you can disable it). It’s advised you run Bullet only in development mode while you’re working on the app as it’s principally for the developer’s use.
Today, lots of Web applications have “social” features. A consequence of this is that whenever I look at content or a user in that service, there is always additional content from other users that also needs to be pulled in to page. When you visit the typical profile on a social network like Facebook or MySpace, data for all the people that are friends with that user needs to be pulled in. Or when you visit a shared bookmark on del.icio.us you need data for all the users who have tagged and bookmarked that URL as well. Performing a query across the entire user base for “all the users who are friends with Robert Scoble” or “all the users who have bookmarked this blog link” is expensive even with caching. It is orders of magnitude faster to return the data if it is precalculated and all written to the same place.
Quacking like an ActiveRecord in Rails 2.3.4 - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS
You know everything about pretending to be an ActiveRecord::Base object, and especially the bit about ActiveRecord::Errors. That part’s really cool.
What we are doing here is making an object that quacks like an ActiveRecord::Base object but has no database table backing it. As examples: a search object, a credit card object, or a remote user object. To do this, you need id, new_record?, and the attributes must work in a specific fashion. You can also have errors produce an ActiveRecord::Errors instance so user errors will show in forms and whatnot.
This entry was posted on Monday, September 21st, 2009 at 3:59 pm and is filed under Ruby on Rails. 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.


