September 2008 Archives

Eric Berry

AddThis Social Bookmark Button

As a Rails programmer, I have been using Prototype and Scriptaculous for over a year and a half, solely because it comes packages with Rails and has helpers. About 3 months ago, I discovered JQuery, which is another Javascript library that combines the powers of Prototype and Scriptaculous into one. JQuery is very easy to install for your web app and has a TON of cool things you can do with it.

In this article, I will show you how to create a simple slide show using JQuery and the jQuery Cycle Lite plugin.

Eric Berry

AddThis Social Bookmark Button

I’ve worked with a ton of programmers in the past, and most of them don’t know a lot about web design. My brother, for example, is an insanely good programmer. However, every time I see his web applications, I have a hard time seeing past how ugly they are (sorry Mark).

I believe this may be an issue with a lot of programmers out there, perhaps most of them. In an effort to help all my colleagues out, I have decided to share a quick tutorial on how create a ’sexy’ layout for your applications without having to be a design guru.

Eric Berry

AddThis Social Bookmark Button

I recently ran in to a blog article which referenced an online application called HopToad (http://www.hoptoadapp.com).

HopToad is an online application that plugs directly into your Rails application and collects all errors that are thrown in your app in a neat and readable UI. I have about 15 Rails applications out there right now, and HopToad is a life-saver for me.

The best thing is, it’s free. Go to http://www.hoptoadapp.com to try it out.

AddThis Social Bookmark Button

Sometimes a test case must detect when production code creates new records, as a side-effect. assert_latest{} detects all new records of a given type, and returns them like this:

    f1, f2 = assert_latest Foo do
               2.times{ Foo.create }
             end

    assert 'items return ordered by id' do
      f1.id > 0 and f2.id > f1.id
    end

This post shows how to use assert_latest{} in more advanced configurations. It can detect records of more than one type, and can detect records that belong to only one association. Our platform is Ruby on Rails, yet - as usual - the lessons apply to any unit tests.

AddThis Social Bookmark Button

Object-Relational Models, like Rails’s ActiveRecord, help generate very complex queries. Sometimes we need that complexity - without slow execution times! We might not notice when our queries have grown beyond our databases’s tuning and indices.

This post shows how to trap, interpret, and EXPLAIN SQL SELECT statements under MySQL. Our platform is Ruby on Rails, yet the lessons apply to any ORM.

AddThis Social Bookmark Button

This post is not about your boss growling at you. Another title could have been “whisper-driven development”. It’s about your code whispering its status to you.

To learn this newfangled kind of development, whip out an Apple computer, and start a project using Test-Driven Development. We use Rails, but you can use any platform you like. (You can use any computer you like, so long as you can find and configure a Growl-style program for it. See below.)

In Rails, use ZenTest’s autotest command, or write your own batch file, that triggers a test run each time you save any source files. I have one here; it’s a little more “generic” than ZenTest’s version. “Generic” is a programming euphemism for “scrappy - a fixer-upper”.