September 25th, 2007
A few weeks ago I saw an interesting post on Dzone about what you shouldn’t do in Python. (See the article here.)
This got me thinking about what features/types of code/practices should be avoided in ColdFusion.
Some are obvious - for example, not using deprecated code. Did you know that CFML Reference guide contains a list of deprecated code for both tags and functions? Also listed are obsolete tags and functions. These functions/tags won’t work at all in ColdFusion 8.
But what else would you add to this list? I do not want to turn this entry into a “bash CF” entry (obviously, I love ColdFusion!). If you don’t like a feature, I don’t want to hear about it as we all have features we don’t like. But what things would you caution developers against? Or at least warn them? What tags/functions throw a red flag in your mind when you see the code.
Read the rest of this entry »
Posted by Raymond Camden| No Comments »
September 12th, 2007
Many moons ago, I reported on how you could write a template to parse your server.log file for slow page reports.
In case you didn’t know - the ColdFusion Administrator lets you log files that take too long to process. This setting is found in the Logging Settings page as seen in the following screen shot:

Read the rest of this entry »
Posted by Raymond Camden| No Comments »
August 27th, 2007
I’ve been using FeedBurner for quite sometime now to host my RSS feeds, and when they bought Blogbeat, I was even happier since Blogbeat was a great blog-stats tool.
Now I get both feed and general item stats all from one source. FeedBurner has an API to retrieve information about your stats so I decided to wrap up some of the API into a nice little CFC. FeedBurner.cfc supports getting both general feed data as well as item data. For example:
<cfset fb = createObject("component", "feedburner")>
<cfdump var="#fb.getFeedData('RaymondCamdensColdFusionBlog')#" label="No date, will be yesterday">
This will retrieve the most current stats from the API, which will be yesterday. To get a week of data:
<cfset date = dateAdd("d", -8, now())>
<cfset last7 = fb.getFeedData(uri='RaymondCamdensColdFusionBlog',
dateBegin=date)>
<cfdump var="#last7#" label="7 Days of Info">
And finally last month:
<cfset date = dateAdd("m", -1, now())>
<cfset dateBegin = createDate(year(date), month(date), 1)>
<cfset dateEnd = createDate(year(date), month(date), daysInMonth(date))>
<cfset lastm = fb.getFeedData(uri='RaymondCamdensColdFusionBlog',
dateBegin=dateBegin,dateEnd=dateEnd)>
<cfdump var="#lastm#" label="Last Month">
This data then can easily be dumped into a chart:

Read the rest of this entry »
Posted by Raymond Camden| No Comments »
August 22nd, 2007
I’m working on a tutorial for a client involving file uploads (which I’ll be sharing on the blog). In the tutorial I talk a bit about monitoring the number of uploads and how much space they are taking.
I was curious what methods exist for finding out how much space is being used on a drive and how much space is available.
Finding out the space used by a directory is possible with CFDIRECTORY and query of query:
Read the rest of this entry »
Posted by Raymond Camden| No Comments »
August 8th, 2007
A quick and simple tip - ColdFusion 8 lets you set a default selected tab by using selected=”true” in the tab.
Here is a simple example:
<cflayout type="tab">
<cflayoutarea title=”Tab 1″>
<p>
This is the first tab.
</p>
</cflayoutarea>
<cflayoutarea title=”Tab 2″ selected=”true”>
<p>
This is the second tab.
</p>
</cflayoutarea>
</cflayout>
In this example, the second tab will be selected when the page loads, as opposed to the first one which is the default. But what if you wanted more control over the selected tab? Here is a way to do it so that you can control the selected tab in the URL itself.
Read the rest of this entry »
Posted by Raymond Camden| No Comments »
July 25th, 2007
So once again I’m messing with ColdFusionBloggers to show off some ColdFusion 8 AJAX goodness.
This time the idea came from Todd Sharp. He suggested making the paging AJAX based. That way when you move from page to page, only the content is loaded. Turns out the change was rather simple.
My original code simply got the data and displayed it inside a layout custom tag. I began by changing my index.cfm page to this:
<cfajaximport tags="cftooltip">
<cf_layout title=”coldfusionBloggers”>
<cfdiv bind=”url:content.cfm” id=”content” />
</cf_layout>
I’ll explain the import in a sec. But basically I moved all of the content into a new file. I then used cfidv and bound it to my new file, content.cfm.
Read the rest of this entry »
Posted by Raymond Camden| No Comments »
July 11th, 2007
Ok, time for a little revelation. This may prevent me from ever working for Adobe, but I have to be honest.
PDFs are boring.
Ok, ok, I get it. They look nice. They are powerful. But… outside of that, when I hear folks talk about PDF as a technology, I have to stifle a yawn. Not because I don’t like PDFs. I like them just fine. But to me they are about as exciting as, well, other file formats. As long as they work, I’m not too bothered to really care about the internals.
Read the rest of this entry »
Posted by Raymond Camden| No Comments »
June 27th, 2007
Other people have talked about CFTHREAD (see Ben Nadel’s excellent post on the topic) so I’m not going to bother with a full description of the tag.
Instead I wanted to show a quick example of where I’ve already put it to use in production, and I wanted to share a warning about how you have to be careful when using the tag.
BlogCFC makes use of a ping feature when posting entries. This lets you inform blog aggregators that you’ve written a new blog post. This way your latest devotional on Paris Hilton won’t be missed by the masses.
Most aggregators simply take a simple HTTP hit, while others take a bit more work. BlogCFC supports simple HTTP pings, as well as Technorati, Weblogs, and Icerocket. The code is rather simple. You pass in the URLs you want to ping and this code block loops over them:
Read the rest of this entry »
Posted by Raymond Camden| No Comments »