Accepted into the Adobe Community Professionals

I found out last night that I have been accepted into the newly renamed Adobe Community Professionals program. I am truly humbled to have made the list especially given some of the names on this years list!  The program used to be known as the Adobe Community Experts but was renamed this year due to some naming conflicts internal to Adobe.
So along with my work on several open-source ColdFusion applications, maintaining and adding new features to, and being active on the CFWheels mailing list, I better get back to blogging regularly as well. I have been so busy with things in both work and personal life that I havent really had the time or motivation to keep blogging over the the last several months. So Im looking at finishing several posts that I started last year as well as continuing forward in 2010.
After 11 years of developing ColdFusion applications, I think this year is going to be one of the best ever!

Fixing Railo and Resin on Snow Leopard

After upgrading to Snow Leopard, I found that my Railo install was not working anymore. I followed Luis Majano’s instructions for getting it setup on Leopard to begin with and the only way it would work for me was to switch the built-in Apache binary to the 32-but mode and then compile the mod_caucho apache module.
Well after the upgrade, that no longer worked. I couldnt get apache to start with the 64-bit architecture removed from the httpd binary so I had to find another way. After a bit of investigating, I found that the configure script checks my Java install for 64-bit compatibility and during that check it was returning that it wasnt 64-bit Java. Hmmm now wasnt Snow Leopard supposed to be all about 64-bit? So I checked my java binary for 64-bit support using the following from the terminal:

file /usr/bin/java

That returned:

/usr/bin/java: Mach-O universal binary with 3 architectures
/usr/bin/java (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/java (for architecture i386): Mach-O executable i386
/usr/bin/java (for architecture ppc): Mach-0 executable ppc

It was showing 64-bit support, so what was the issue? So back into the configure script I went. It turns out that it was checking a symlink which points to the current JVM install.


In my case, the symlink “Current” was pointing to a folder in the same directory named simply “A”. I have no idea where that came from since I never mess with the built-in Java on my mac. There was however several other directories and symlinks in the same folder that pointed to the “1.6.0” directory. So I simply deleted the “Current” symlink and recreated it to point to the 1.6.0 directory.

[russ@Prime:/System/Library/Frameworks/JavaVM.framework/Versions]$ sudo ln -s 1.6.0 Current

That created a symlink pointing to the newest JVM on my system. Then back in my Railo install directory which happened to be /Applications/railo, I ran the configure script again.

./configure --with-apxs=/usr/sbin/apxs --enable-64bit

After checking the output of the configure script, I found this line:

-n checking if Java is 64-bit... yes

Success! Then I simply ran make then make install to install the newly compiled 64-bit mod_caucho module and restarted apache.
Now Railo is up and running again on Snow Leopard!


Although there are many downsides to being unemployed, there are a few upsides to it as well. One of which is that you have a TON of time to play with code and learn new things. After almost 3 months between projects now, I started getting the fever to launch something. So I was playing around with CFWheels at that time and decided to throw something together.
The result is Its not nearly feature complete, but I wanted to get something out there and start playing around. Its basically a site that allows CFML developers to create profiles, recommend other developers, etc. The idea is not mine, Most of the functionality is heavily “borrowed” from the Rails site I just thought it would be a cool project and wanted to see how much i could get done with Wheels.
Currently I have around 45 man hours in the site, that includes bug-fixing the last couple days. Its running on the latest version of Railo and was written with version 0.9.3 of CFWheels
If you are so inclined, create profile and share. If you happen to run into any issues, or if you can think of a feature that you would like added, please let me know. Afterall, I dont have much else to do right now. 😉

Linking To Files In ColdFusion Errors

Its been well over a year ago that I dropped developing with CFEclipse. I grew tired of the endless resources it consumed and it always seem very slow. Of course this wasnt due to the the CFEclipse plugin, it was the Eclipse platform that it was built on. Now with Adobe releasing the beta of ColdFusion Builder I decided I would give it a try again. But after an hour or so of playing with it, I still wasnt sold.
So, it was back to Textmate for me. Using Textmate for devlopment has been a pure joy. Its so easy to add new functionality specific to the language you are using with its Bundles that I find myself looking for new ways to make everything faster. I have created a bundle for CFWheels that provides function insight along with snippets for just about everything in the framework. This runs on top of the excellent ColdFusion Bundle that Rob Rohan is working on. I have hotkeys for just about everything I need with the exception of getting me another cup of coffee.
I have heard from guys on mailing lists time and time again talk about the productivity they have gained since moving to Textmate or its port to Windows called “E-Texteditor”.
I came across a feature in the Textmate manual yesterday that I was interested in and wanted to see if I could exploit it in some way. This feature was the ability to link directly to files on your dev machine from other applications, even in html. Hmmm, so does this mean I could create an error page that would link directly to my development files?
So, since I use Railo for my local development mainly, I opened up the web admin and found the Error section to see which error file I was using for this particular project. I was using the error-neo.cfm template that mimics the output of the ColdFusion error pages, so I opened it up in Textmate to see how the file list was output.
Now Im not going to gaurantee that the ColdFusion error code is the same as the Railo error code but its probably pretty similar and should work just as well. So this is what I found for the error output:

The error occurred in #catch.tagcontext[idx].template#: line #catch.tagcontext[idx].line#
Called from #catch.tagcontext[idx].template#: line #catch.tagcontext[idx].line#

Wow, that looks simple enough. So back to the Textmate documentation I went to see exactly “how” I build out the link structure. The URL structure in HTML is pretty simple. There are only 3 parts to it that you have to build out.

  • url – the (file) URL to open
  • line – the line number to jump to an place the cursor when the file is opened
  • column – the column to place the cursor when the file is opened

Now going back and looking at our error code. We know the code is outputting the full path to the file and its also displaying the line number. So we have 2 of what we need. The Column attribute is optional and we dont really need it.
So here is what our link should actually look like using the Textmate format and our CFCATCH variables:


Pretty simple right? Now here is the same code block with the URL’s in-place to allow you to open any of the files in the error stack.

The error occurred in #catch.tagcontext[idx].template#: line #catch.tagcontext[idx].line#
Called from #catch.tagcontext[idx].template#: line #catch.tagcontext[idx].line#

Now when you encounter an error in your application and the cfcatch message is displayed with the file listing. You can simply click on the file and it will open to the exact line in Textmate. No digging through the file list to find the file.

Handling Nested Resources in CFWheels

Several frameworks these days are including a routing system to make it easy to implement user friendly urls, or as some like to call them, search engine safe urls. These routing systems can also make refactoring much simpler as well if you use them properly.
I have been playing around with CFWheels lately and was wondering how I could take advantage of nested resources in this framework. Nested resources is something I picked up while working on some Rails projects, its a way to automatically handle related objects in your forms. Let me show you a quick example.
Say we are building a bug tracker. We have 2 objects, a Projects object and a Ticket object. Here is how the associations are setup.


and now our Ticket.cfc

Now normally if you were adding a ticket, you could use a URL like this:
And you could pass in the projectID as a hidden field or something like that to handle the association.
But, there is a much easier way to handle this. First lets take advantage of the routing system and create a few routes. I like named routes in my applications much better than the defaults. If I ever refactor a controller and rename an action, etc. I can change the route and every link in my site that points to that route is automatically updated for me. Hows that for a time saver?

These 3 routes handle the nesting for us. Notice how the project part of the url is always first? Then the nested resource since tickets belong to projects. This URL structure will ensure that our projectID is always available in the params scope. Our URl will now look like this if we are adding a ticket to a project.
Heres a typical link that would point to our form to create a new ticket.

#linkTo(text="New Ticket", route="new_project_ticket", projectid=params.projectid)

To setup our form for the new ticket an automatically populate the projectID hidden field, we can write our controller action like this.

That takes advantage of the built-in associations in Wheels and builds the new ticket object through the project object for us. You form would be a standard Wheels form but will automatically have the projectID set in the hidden field for you.

Where are all the ColdFusion SaaS Apps?

Since I have been “between projects” for the last 7 weeks or so, I have been spending most of my time working on some open source stuff and surfing the web. Trying to keep up with all of the happenings in the CFML community. One thing Im noticing a major lack of is SaaS (Software as a Service) applications focused toward CFML developers.
In a community such as the Rails community, there are tons of SaaS apps focused on helping the Rails developer community. Things like wireframe tools, rapid prototyping tools, bug trackers, project management apps. All applications built and aimed primarily at the Rails developer community.
It made me start wondering why there were really no applications like that in our community. Would the CFML community not support such an effort? Are we so used to just using the freely available tools written in other languages and settling for that?
Just yesterday I saw a ColdFusion developer (I wont mention his name but he is pretty well known in the community) mention on Twitter that he was considering purchasing a project management/bug tracking tool that was written in PHP. I would be curious to know how many CFML developers are paying for those services right now. Using an application written in Rails or something else besides CFML.
What do you think? In your opinion, would the CFML community support such an undertaking if the app was good enough?
Do you know of any CFML SaaS applications on the web now? Let me know about them. Im interested in checking some out!

Great Intro To Git

I have been asked by several folks lately in the ColdFusion community about Git. It seems that alot of the CF developers are so in-grained with SVN that they either wont consider Git or are afraid of it. Not sure which is the case. But I will say that Git has completely changed the way I look at source control. Ric Roberts has posted a really nice intro to Git that anyone interested in Git should have a look at.
Im planning to do a presentation on Git for the Online CF Meetup as soon as I get time to get the slides together so hopefully that will help de-mystify Git for some of you as well.

Updates to Related_Selects plugin

Two weeks ago, Corey Ehmke sent a pull request for some updates he made to the related_selects plugin on GitHub. Im actually quite late in pulling these but I have been extremely busy with work and family stuff. Here is what Corey said about the changes:

I made a couple of changes that you will hopefully incorporate:

1) Expanded support for include_blank to match behaviour of standard Rails form options helper. You can now pass an :include_blank attribute consisting of true, false (default), a string, or a two-element array, just like the standard Rails select form helper. If you do not set this attribute, the related select will default to the first option.

2) I also edited the README and replaced the original examples with the (much more concise and comprehensible) example from your post on

This is great! Thanks again for the updates Corey!

Related_Select plugin update for Rails 2.3

Last night I was looking for a solution that would allow me to easily create a setup of related select boxes. I needed 3 of them to be exact. You know the ones that always seem to pop-up from time to time where the contents of one select box are populated after selecting a value on the first select box.
I started googling for a solution and came across a Rails plugin called related_select_forms that was written by Dimitrij Denissenko back in 2007. I figured “what the heck” it looks easy enough. Well after installing it from the svn repo on google code and setting up my initial form fields, I was welcomed by a plethora of errors. So I started digging into the plugin to find the issues and ended up fixing everything so that it now works with Rails 2.3.2.
I sent an email to Dimitrij asking about the status of the plugin but I havent heard back from him as of yet. I created a GitHub repo for the plugin to allow me to share my fixes with everyone. It can be found here:
Let me take just a second to show you how easy it was for me to create 3 related select boxes in my form with this plugin.
Consider the following models:

class Metro < ActiveRecord::Base

   has_many :areas


class Area < ActiveRecord::Base

   belongs_to :metro

   has_many :neighborhoods


class Neighborhood < ActiveRecord::Base
   belongs_to :area

Just looking at the models it should be plain to see how the selects should be related. You must first select a Metro, then that will populate the Areas. Once you select the area, that will populate the Neighborhoods.
Normally this would take a lot of handwritten Javascript to accomplish. And I know there are probably some super simple jQuery plugins for this thing, but this application is using the standard Prototype/Scriptaculous combo that ships with Rails.
So here is the how simple the form fields are using the plugin.

<%= f.label :metro_id, ', :class => 'title' %>
<%= f.collection_select :metro_id, Metro.find(:all, :order => "name"), :id, :name, :include_blank => true %>

<%= f.label :area_id, ', :class => 'title' %>
<%= related_collection_select(:sales_contact, :area_id, [:sales_contact_metro, :id], Area.find(:all,:order => "area" ), :id, :area, :metro_id) %>

<%= f.label :neighborhood_id, ', :class => "title" %>
<%= related_collection_select(:sales_contact, :neighborhood_id, [:sales_contact_area, :id], Neighborhood.find(:all,:order => "title"), :id, :title, :area_id) %>

Notice the first select is a standard collection_select then for each related field. We make calls to the plugin. The method signature is very similar to the standard collection_select with the addition of a couple parent related arguments.
Super simple!
If you have any improvements or additions, feel free to fork the repo and send me a pull request.

Deployment Gotchas – Git And Capistrano

Im just starting to take the leap with Capistrano and so far Im loving it. It simplifies deployment task down to a single command-line call. In my book, that beats syncing the FTP, manually running migrations, etc. One issue I ran into last night though, was during my deployment, I clone my git repository to get the latest version of the application. Thats baked into Capistrano, very simple stuff. However, I kept getting an error that ‘git-index-pack‘ was not a git command.
I spent literally hours googling, reading mailing-list archives, tweaking, updating git, reinstaliing git, etc. Nothing I did made one bit of difference. Being up until 5am probably didnt help me to think clearly either. So after a few hours sleep, I started investigating again. This time it hit me. It hit me like an Amtrak train at full speed.
I host on my own dedicated servers, with that being the case, I have my CentOS servers setup to use Jail-Shell by default for all new accounts in the web group. I completely forgot to change the shell for my deployment user so of course git was failing! Doh!
As soon as I changed the default shell for that user to bash and ran ‘cap deploy:update‘ it worked like a charm!
So if you are deploying to a shared host and running into this issue, make sure to check your shell. I know there are hosts out there that will Jail-Shell you by default.