Archive

Archive for the ‘ColdFusion’ Category

Be careful with the ‘local’ scope when migrating from CF8 to CF9

February 8th, 2010 Dan Skaggs 7 comments

One of the really nice “fixes” included in ColdFusion 9 from a developer’s perspective is the inclusion of an implicit “local” variable scope into which variables created within the body of a <cffunction> tag are placed by default. Previously, developers had to manually add a “var” keyword to variables that should only exist within the confines of the function.

One of the ways of simplifying this that gained some traction among various developers prior to the release of ColdFusion 9 was to “var” a single variable at the top of the function as an empty structure then store any additional variables needed in the function inside it. Many folks, myself included, named this structure “local” so that it would be readily apparent that the values inside were local to that function. This approach worked fine and dandy on ColdFusion 8 and below.
Read more…

Categories: ColdFusion, Javascript

ColdFusion 9 caching settings to watch out for

January 31st, 2010 Dan Skaggs No comments

Like a lot of developers, I’ve got this pet project I’m working on in whatever spare time I can find between client engagements, home maintenance, family obligations, etc. I’m using it as an opportunity to work with some of the new features of ColdFusion 9 (ORM mainly), ColdFusion Builder Beta and features in development for the next release of ModelGlue 3.

Recently, Bob Silverburg has been working on a significant overhaul of the scaffolding feature used by ModelGlue to automatically create CRUD forms for the various data objects in your application. Particularly exciting to me is that you can now override the built-in code templates with your own. Bob wrote a proof-of-concept application that uses the excellent cfUniform custom tag library to build standardized forms and validations (see my previous post on cfUniform if you’re not familiar with it). Since I’m pretty particular about how my project files are arranged, I proceeded to place the css, javascript and image assets into the folders where I wanted them and use ColdSpring to create a configuration bean to pass to cfUniform when I called it. That’s where the trouble began.

I had to make a couple of changes to the code generated in the custom scaffold CFC in order to have cfUniform see the custom configuration that I had set up. No matter what I did, when the scaffolding engine generated the code for the view and the XML fragment for the event-handler, the changes I made inside the CFC weren’t included. I spent a couple hours scratching my head, tracing the request cycle, restarting my local ColdFusion instance and always got the exact same code that was in Bob’s original example CFC. Finally, I decided to change the name of the CFC and update the associated bean configuration in ColdSpring. On the next refresh, I saw my changes reflected in the code generated by the scaffold!

With that in mind, I checked the settings on the Caching page of that instance’s CF Administrator. Sure enough, the Cache Template In Request, Component cache, and Save class files options were checked. I cleared those check boxes, pressed the Clear Template Cache Now and Clear Component Cache Now buttons below and have had no trouble since. Obviously there are situations where you want these enabled, but rarely ever should they be needed on a local system being used for development.

So, the moral of my painful story–if you’re making changes to code that’s not being reflected when you test browse your application, don’t forget to check the settings on the Caching page in CF Admin. It just might save you a couple hours and a few gray hairs.

Categories: ColdFusion, ModelGlue

Going beyond CFPDF with iText

November 19th, 2009 Dan Skaggs 4 comments

This week I was working on a proof-of-concept for a customer in which we wanted to extract attachments from a fillable PDF form after its submission. After trying the usual CFPDF tags, reading the documentation, and getting nowhere, we decided to try to attempt to use the iText PDF library for Java from within ColdFusion to extract the attachments.

After doing some reading through the JavaDocs for iText, I found that it includes a class called ExtractAttachments that “…lets you extract the attachemnts of a PDF.” Since this is precisely what we wanted to do, I thought for sure this would be a simple affair and I’d be able to finish what I needed to do and turn in early for the evening. Not quite!
Read more…

Categories: ColdFusion

Slides from my ColdSpring session at CFinNC

October 18th, 2009 Dan Skaggs No comments

I’ve attached my slides from the my CFinNC session called “ColdSpring: Solution to a Problem You May Not Know You Have”. I’ve also included the example files that I referenced during the presentation.

The slides have been uploaded to SlideSix.com or you can view them below. A PDF version of the slides is also available for download.

Thanks to all those folks that attended my session. Also a huge thanks and a job well done to the conference committee and volunteers that made the conference happen.

Want to learn ModelGlue….for (nearly) free?

September 29th, 2009 Dan Skaggs 1 comment

Have you ever been curious about building CFML applications using the ModelGlue framework but just not had time to sit down and learn it on your own? If your answer is yes, then October 24th is your lucky day my friend. That’s the date for the BFusion half of the BFusion/BFlex conference in Bloomington, IN.

Dan Wilson will be giving an all-day training session on ModelGlue. Dan is the managing director of the ModelGlue project so you’ll be getting training from one of the main folks responsible for the framework. I have the honor of filling the role of teaching assistant for the class and I am really excited about the event.

Cost for BFusion/BFlex is $10 per person per day so it’s nearly as close to free training as you’re going to find. Registration is not open as of this writing, so be sure to watch the BFusion/BFlex site for more details as they become available.