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:


txmt://open/?url=file://#catch.tagcontext[idx].template#&line=#catch.tagcontext[idx].line#

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.

Project.cfc


and now our Ticket.cfc


Now normally if you were adding a ticket, you could use a URL like this:
localhost/tickets/new
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.
localhost/project/1/tickets/new
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!

My Server Is Now Running On Railo

After considering it for a long time, I have finally converted my server over to Railo 3 Community Edition. I have been running ColdFusion 7 on it forever and I just couldn’t justify the upgrade costs to run my couple little blog sites and open-source projects. Fortunately everything went well with only a few unexpected hiccups that I will outline further in a minute. I must say that Im really impressed with Railo so far. I love how the admin is separated by site so each application can have its own settings.
Im one of the folks who has always criticized ColdFusion for not having a “Community Edition” for non-commercial applications like blogs and open-source applications. Im so glad to see that Gert and the guys at Railo have joined forces to open-source Railo and make it more available for developers.
On a few of the hiccups, well, the Skeegee.com site is down completely. I expected that since it uses Transfer and I know they are compatible now, but I haven’t had time to work out the issues. Since Im running Mango, the Captcha on the comment form was being displayed as broken image. After posting to the Mango forums, I solution was posted to just install the CF8 Captcha plugin which fixed it right up.
Im really looking forward to writing some apps that can really push Railo and see what its made of.

Im Going To Flex Camp Miami

Yes, Im going to brave the 95 for some 300+ miles headed south to Coral Gables for Flex Camp Miami. Why not? Its a full day of Flex goodness for a measly $30 and that includes lunch! Seriously though, Brian Rinaldi is known for putting on killer Flex Camps. The speaker line-up is top notch so you know your going to learn something. I think Im most excited that Laura Arguello from ASFusion is going to be there presenting about her Flex framework entitled Mate. I have looked at a few other Flex frameworks in the past and I wasnt really keen on any of them, however, from what I have seen of Mate, Im seriously impressed!
So c’mon! If you are in Florida and even remotely interested in Flex, you owe it to yourself to register and take a short trip to Miami. On that note, if you are interested in carpooling, let me know. I will be leaving from Jacksonville and have room for 4 people. I drive a 2007 Nissan Titan 4-door so there is plenty of room. I even have DVD players in the head rests so the guys in the backseat can watch movies on the way down! ha ha!

Skweegee Has Moved To GitHub

I have decided to take the plunge headfirst with git. Im really digging the distributed nature of it and the fact that I can make small commits to my local repo, then squash them into one atomic commit and push that to the master. It seems to really fit my workflow better.
Due to this switch, I have moved the Skweegee SVN repository over to GitHub. Importing it from SVN wasnt trivial as the GitHub importer failed constantly without telling me why. So I found svn2git and installed the gem. This made it pretty simple and it kept all of the history.
The Skweegee repo can be found here
The SVN repo is still up for now but will not be committed to unless I can find a way to mirror my git commits back to SVN automatically. If I cant, I will pull the SVN repo down later this month.

Need CF Telecommuter For Contract

One of my clients is looking to bring on another ColdFusion consultant for a new project. This developer would need to be able to start within the next 2 weeks if at all possible. I will not be working on this project but will be managing it from a high-level as well as being involved and available for questions, troubleshooting, etc.
We are looking for someone who can work on their own that has experience working with jQuery and AJAX as well as being extremely proficient on ColdFusion. Experience with any of the major CF frameworks would be great and if it happens to be ColdBox, all the better. High level of knowledge of working with CFC’s is a must! This project is utilizing SQL Server 2008 and ColdFusion 8 so you will be on the latest and greatest. 
If you are interested or have more questions, feel free to email me at russ@angry-fly.com and we can discuss. Your rate/terms are to be discussed with the client. Im just trying to find the best person for the project.

ColdBox Training in Southern California

ColdBox Platform Official Training Seminars Announces Early-Bird Special Pricing for March 14-15 2008 CBOX 101- Core ColdBox Seminar in Ontario, California.  Welcome to where it’s sunny and warm!

ColdBox Platform Official Training Seminars today announces an Early-Bird Special discount registration price of just $895 for our March 14-15th, 2009 ColdBox Platform 101 seminar to be held in Ontario, California.  Registrants can take advantage of this early bird savings over the full seminar price of $1,100 by completing their registration before 5PM (Pacific Daylight Time) on February 8th, 2009. (Discounts available for groups of 5 or more)

The ColdBox Platform 101 Seminar is a 2-Day Introduction to ColdBox and ColdBox Platform Application Development providing 16+ hours of intense, hands-on training with ColdBox author Luis Majano in an intimate setting with only 15-20 seats available.  The skills learned in this seminar can be immediately applied to a developer’s daily tasks.

For more information on ColdBox Platform Training or to register, please visit the ColdBox Training web site.

Code Formatting, How Do You Roll?

There’s something that has been bugging me for quite some time. I dont mean like a little nagging annoyance, Im talking about an inch long splinter in the bottom of your foot and having to walk around all day on it kind of bugging!
Code formatting. There I said it.
Now call me OC or what have you but yes I admit Im quite anal when it comes to code formatting. There is nothing I hate more about coding than to open up someone’s code and see poorly formatted code. Is there a reason to try and cram as much crap on one line as humanly possible when coding? What is it about some CF coders that makes them code this way?
I try to make my code as readable as possible. This includes breaking at a reasonable column so as not to run too far off the side of the screen. But why do some people code so that it takes a 30″ widescreen monitor to read the whole line?

And whats with code like this:

Username:


Im not sure if BlogCFC will wrap that code or not but Im looking at an application right now that has that very code in it, and its all on one line with the exception of the closing table tag. Now is that really necessary?
Isnt this much more readable?

Username:

Sorry for ranting but its just been that kind of day!! What are your thoughts on code formatting? Do you see alot of this sort of thing? Are you guilty of it yourself? If so, why? Im really curious.