What’s In Your Junk Drawer?
Continuing my recent theme of utilities and the like that I can't do without...
For as long as I've been programming, I've built up a junk drawer of useful functions that I carry from project to project. The Ruby iteration of this is currently implemented as a Rails plugin that is one of the first things I add to each new project.
Here are a few of the utensils that I keep jammed in the back of the drawer.
Topics: Ruby on Rails
Selling Git on the Business End
![]()
Today I gave a presentation on why Git makes sense for an agile consultancy like ours. It was more challenging than I initially imagined; there are many, many blog posts out there discussing why Git is technically superior to Subversion. But when I searched for posts discussing the business merits of Git I came up short. Git is faster, branches better, it has a local copy of the repository, it's small and cheap, but these are points that sell an engineer. What sells the administrators, the business analysts, the project managers?
I came up with a few cool scenarios to illustrate why we, as a business, should adopt Git -- essentially, why it makes not only my life easier, but why it will make the decision makers incredibly happy too. Then my colleague Jason Sendelbach and I gave a short talk on not only the why of the Git, but how we can start using it. Here I'll summarize our presentation. If you want to use Git in your company, but you have problems selling it to the administration, feel free to crib liberally. These points worked great for me.
Topics: Git
IE8 Beta 2 Released
I like it. Give me more browser improvements! With the news of Firefox 3.1's JIT JavaScript beasty TraceMonkey, is it too much to hope that IE8 Beta 2 has some similar improvements under the hood?
First you have to find the appropriate page among the 300 or so flogging IE8 Beta 2 in the MS redundaverse. Drilling down into performance, you find the terse:
...the script engine in Internet Explorer 8 is significantly faster than in previous versions, minimizing the load time for webpages based on JavaScript or Asynchronous JavaScript and XML (AJAX).
OK. Faster. Faster how? How much faster?
It used to be that JavaScript engines were so slow that benchmarks served mostly to show that they weren't suitable for anything serious (slow and slower). It's time for some head-to-head benchmarks. Stay tuned.
Topics: IE8, Javascript
Faster JavaScript for Firefox 3.1 Thru JIT
I was expecting the next major advance in JavaScript for Firefox to come from replacing SpiderMonkey with Tamarin, Adobe's donated VM for ECMAScript 4. In fact, Tamarin can already do some JIT.
Now surprise, surprise -- SpiderMonkey can do JIT as well, as Brendan Eich, Mozilla's CTO describes in his blog. The technique used in both Tamarin and SpiderMonkey is called tracing, where during code execution, each hotspot (code that is executed a whole lot) is traced and compiled, so the next time it is executed, the compiled version is used. The beasty is called TraceMonkey and boasts several orders of magnitude improvements over the old SpiderMonkey.
Since this JIT involved actual compilation, you have to look at which architectures TraceMonkey supports. Again from Brendan's blog:
We have, right now, x86, x86-64, and ARM support in TraceMonkey. This means we are ready for mobile and desktop target platforms out of the box.
Sweet. I guess that means the Intel Macs are supported.
There are still some bugs, of course, but this is great news for sophisticated Ajax apps on Firefox. Will Microsoft respond? Is a JavaScript JIT upgrade in the works for IE? This is an arms race I can get excited about.
Update: John Resig of JQuery has some more details and demos about TraceMonkey.
Topics: Firefox, Javascript, JIT, SpiderMonkey, Tamarin, TraceMonkey
Implementing linked multiselects with jQuery, LiveQuery, and Low Pro: Part 2: First pass at the actual code
In last week's post, I introduced the linked multiselect widget I was asked to implement on a tight deadline for an unexpected project assignment. I showed some demo code in action and discussed the user experience issues that shaped my requirements. This week, I'll walk through the actual code - or at least my first pass at it.
Like a lot of developers who should know better, I sometimes shirk the technical design phase on quick projects, then regret it later. The code I handed off for this project got the job done, but it wasn't very DRY or elegant. Luckily, I've continued to refine it into something I'm not ashamed to blog about. Next week, I'll show off the final, refactored code and try to draw some conclusions about the entire experience. But first - the original, unrefactored code:
Topics: Ajax, Design Patterns, Javascript, jQuery
I’m Cranky Because I’m Not Getting Enough REST
Can we talk about REST?
It's been about two years since the Simply RESTful plugin was added to Rails edge core, in that time I think I've learned the following two things:
- REST is a very elegant way to structure an external web-service interface to a web application.
- REST is kind of an awkward way to manage the internal structure of an Ajax-heavy web application.
I think you are going to have one of three responses. I'm betting on the middle one:
- "Everybody knows that"
- "You are a loser who has obviously not grasped the zen essence of REST."
- "You have totally changed my way of thinking"
So here's where I get into RESTful trouble...
Continue reading »
Topics: Ruby on Rails
Flex Gauge Component Example with source
This example covers how to build a simple 360 degrees gauge Flex component. It has public properties that allow you to easily adjust the appearance of the component for colors, size, font size, guideline thickness and such. It also fires a custom "angleChanged" event that helps you integrate it with the rest of your app.
Topics: Flex, Gauge Component
Plugging Some Cool Tools

Today on the program, I'm going to discuss a few Rails development tools that I've had the pleasure of using recently.
Footnotes
If you're like me, you like starting paragraphs with the phrase "if you're like me". You also used to use the TextMate footnotes plugin, then got frustrated with it in the Rails 2.0 timeframe when it didn't get updated for a while. Every now and then you'd sigh, and remember the days when you could click on a stack trace in your browser and open the associated file.
Topics: Ruby on Rails
Implementing linked multiselects with jQuery, LiveQuery, and Low Pro: Part 1: Requirements and interaction design
Last week I spent a couple of days lashing together a UI widget for a project that needed a little Ajax assistance. As always, I looked for an opportunity to learn something along the way, so I got signoff on using jQuery and some plugins I hadn't previously employed.
The result? A down-and-dirty mini-project that let me test drive Color Animations, jqModal and Low Pro for jQuery while employing tried-and-true solutions such as jQuery Templates and Live Query. What's more, the requirements for the widget itself left room for some careful consideration of user experience design.
In the end, I built a client-side demo in just a few days and handed it off to the project lead for integration with a complex back end. Now I'm free to refine my deadline-constrained code into something a little more OO and share the results.
This week, I'll talk about the project's complex usability requirements and Pathfinder's user-centered solution to those requirements. Next week, I'll walk you through our first pass at building custom code, roping in open-source libraries and making it all work together on a tight deadline. Finally, I'll walk you through the refactoring process so you can see the final, properly factored and reusable version.
Topics: Ajax, Javascript, jQuery, Low Pro, OOP
Many Varied Components, or… Multi Variable Complexity, or… Mainly Vanilla Coding
(Image comes from the Rails Envy MVC public service announcements -- and I hope they don't mind)
Here's the question:
Describe the MVC design pattern as it is implemented in Ruby on Rails.
And the followup:
In an MVC design, where would you place complex business logic?
This is part of the standard phone screen we give to potential Rails developers. The expected answer goes something like this:
MVC stands for Model, View, Controller, each of which represents a section of the application. The model manages data and often persistence, the view manages presentation, and the controller mediates between user actions and associated models and views. Each of these three subsystems should have as little interaction with the others as possible. Complex business logic should go in the model, since that is the section that deals with business objects.
If your doing a phone screen with us after this, at least have the decency to phrase that in your own words...
I don't think of that as particularly controversial, although I suppose you could pick at the wording and details to taste. Interestingly, or oddly, or something, the recent stretch of phone interviews has had a nearly unanimous answer to the followup question: Controller (sometimes, to be fair, the answer would be controller and model, but with controller as the primary answer).
After a brief time-out to check my sanity and calibrate with some other people (like the video with guys from the picture), I came out of the process with the following few thoughts:
Topics: Ruby on Rails
Custom Flex 3 Lightweight Preloader with source code
Here we have a demonstration to an age old problem in Flash (inherited in Flex) - the Preloader. I think that the Flex community has long ago grown bored with the default preloader, which I am very thankful to Adobe engineers for providing us in the first place. It's just that we keep seeing it over and over and over...
Topics: Flex, lightweight, preloader
Mass Assigning Inheritance Column Values for ActiveRecord STI with Rails
One of the security features in Rails is to prevent mass assigning values for certain columns (when passing a hash to #new, #attributes=, and #update_attributes). This is to ensure that a malicious user can't exploit the system by passing in values for certain attributes you really don't want them to change.
In Rails 2.1, one of the attributes that will always be protected from mass assignment is the inheritance_column. In most cases, protecting inheritance_column; is desired because we don't want (for example) someone to change their user type by specifying type = 'Admin' when posting a form. Despite this, there are some cases where we do want to allow the user to specify the type.
However, even if we specify #attr_accessible on the inheritance_column, we will not be able to mass assign a value to it. Rails will not allow it unless we put in a little hack to work around this feature.
Topics: activerecord, Ruby on Rails, STI
Working effectively as a team of one: Five tips for front-end developers on Agile teams
Most UI engineers - a.k.a. front-end folks - have worked in environments where they're a shared resource of one person. I often did so early in my career, when I played "webmaster" to a team of writers, editors and visual designers at various online publications.
Now that I'm the Ajax lead at a small, Agile software development firm, I'm no longer the only technical person in the room. But I'm still just as specialized. It's not that my JavaScript, CSS and JSP skills are any more important than somebody else's SQL, Java or Swing skills. It's just that I'm a team of one, so utilizing me effectively takes a little more planning. Everybody at Pathfinder wears multiple hats, but I was hired specifically to wear the same hat all the time.
Many projects at Pathfinder seek my input, but my attention can only be parceled up into so many chunks. I can't serve as an actual development resource on every project. Over time, I've realized that the following strategies help me deliver the value I need for my company:
Topics: Ajax, CSS, front end, Javascript
Ruby on Rails with Windows - How I made it work
I have been developing with Ruby on Rails over the last few weeks. Coming from the ASP .NET/C#/VB world, I am a total stranger to a programming language like Ruby. Any new programming language is fun to learn! Ruby was even more exciting cause it was a new kinda language to me. Though I think Ruby is not as user-friendly as C# or Java, it is as powerful and flexible if not better. Combined with Rails, Ruby becomes a platform that facilitates quick and efficient development of database-driven web applications.
Project Website Part 5: Morph in 11 steps or so

Eventually in the course of developing the Project Website application, it was time to put the project on a staging server for client viewing.
Often we'll host that ourselves, but in this case I decided to try out Morph, which provides a relatively inexpensive virtual hosting environment for Rails applications, using the Amazon Web Services cloud. Even better, Morph allows you to set up a development environment for free. (The free version is limited in size and bandwidth, and they also apparently will shut down the server if you don't deploy for 30 days -- a limitation obviously not shared by the paid environments).
I was able to go from total Morph ignoramus to running deployed app in under two hours. After reading this you should be able to do it even faster. (Full disclosure: Morph and Pathfinder are co-sponsers of the WindyCityRails conference September 20, 2008. That doesn't really have anything to do with anything, I just wanted to mention the convference)
Here are the steps:
Topics: Project Website, Ruby on Rails
About Pathfinder
Follow the Blog
-
Get a monthly update on best practices for delivering successful software.
Subscribe via email
Subscribe via RSS
Categories
Topics
Archives
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
Blogroll
Recent
- Elements of Testing Style
- Aesthetics and Web Design
- Asterisk-Java Testing with Groovy
- 3 Misuses of Code Comments
- Fluently NHibernate
- Digging a Hole and Covering it with Leaves — The Software Development Version
- The Importance of User Experience - Do You Understand It in Your Bones?
- Writing Your Own Protocol With NSURLProtocol
- What’s In Your Dock: iPhone edition
- Feature Fatigue






