Developer Week Slides and Code

Sorry for the delay in getting this posted. Here are the slides and the sample code from my ColdFusion Developer Week 2012 presentation; User Experience upgrade through HTML5 charts and videos.

The sample code does contain the sample videos as well so it is a bit large (45mb).

Download Sample Code

Till next time...


ColdFusion 9 - Deleting all items in VFS

Deleting all files from a directory or the entire directory tree has become very trivial. Especially since ColdFusion 7 when the recurse attribute was added. With VFS (ram drive) you can use all the same tags to manage drive contents as you would with a physical drive.

So... to remove the entire content of the VFS you can use one line of code:

view plain print about
1<cfdirectory action="delete" directory="ram://" recurse="true" >

However, in doing so ColdFusion throws an error:

The specified directory attribute ram:/// cannot be deleted.
You may not have permissions to delete this directory. The exception occurred during a cfdirectory action="delete".

The essence of the error is true. You can't delete the "ram://" root. So, all you have to do is suppress this error using cftry. But be careful this will not only suppress the error we expect but any unexpected errors as well.

Till next time....


ColdFusion 9 - CFScript Examples - QUERY

For those that don't know, I am a cfscript nut. I write almost everything in script. I find it much better to read, understand and it just flows better.

So, you can only imagine my excitement when I found out about the ColdFusion 9 enhancements to cfscript. I had been creating my own functions for a while to add functionality to cfscript. But now they have gone and done it for me.

So, here is a first in a series of code examples for cfscript. This example I will focus on running queries. One thing you will notice in the example code that I don't define a datasource. This is because the datasource is defined in application.cfc. This is done by adding "this.datasource = 'cfbookclub';" to your application.cfc.

All these examples use the "cfbookclub" sample datasource that is instlled with CodFusion.

There are multiple ways to run a query inside cfscript.