chapter31

development in a land far far away…

at the moment

History is not what happened. History is what was written down.

Archive for March, 2006

How to find the size of a directory?

Friday, March 31st, 2006

Here is an article from coldfusion cookbook.

select sum(size) as size from cfDir

#numberFormat(sizeMB,”,.99″)#
Note the ‘recurse’ option, this will get the size of the current and all sub-directories. If you only need the size of the current directory, change recurse to false.

Read the rest of this entry »

An article from coldfusion cookbook using jSStringFormat():
“If you are dynamically populating a JavaScript variable, you may find that your code breaks with “unterminated string constant” or similar error messages. This is probably a case of your JavaScript variables containing characters that are considers to be “special” characters by JavaScript. You will need to “escape” these […]

Read the rest of this entry »

cfstoredproc vs cfquery

Thursday, March 16th, 2006

There are of course pros and cons to using each method to perform CRUD operations on a database.
cfstoredproc Pros:

With stored procedures you can control security in the database as well as the web pages.
Transactions are handled at the database level, stored procedures are ideal here.
Stored procedures provide greater performance, because the execution plan for the […]

Read the rest of this entry »

In CFMX7 Macromedia introduced a new (and optional) attribute to the cfstoredproc tag called “result” which specifies a name for the structure in which cfstoredproc returns the statusCode and ExecutionTime variables. If set, this value replaces cfstoredproc as the prefix to use when accessing those variables.
The result attribute provides a way for stored procedures that […]

Read the rest of this entry »

Double-checked locking

Tuesday, March 14th, 2006

Mark Kruger has a nice article (with mention from Sean Corfield) on APPLICATION variable locking.
Sean basically added that in the initial example (BAD code) if 2 users hit the <cfif> condition at the same time, only one will have a lock on the code while the other will wait.
The problem lies in the fact that […]

Read the rest of this entry »