New O'Reilly ColdFusion MX 6.1 Book Now Available

Pardon the self-promotion, but I wanted to announce that my latest book, Programming ColdFusion MX, 2nd Edition has been released. It's worth noting that this is the only book on the market that covers ColdFusion MX 6.1.

If I was fortunate enough to have you as a reader of the first edition of this book (Programming ColdFusion), you'll be interested to know that the second edition has been completely revised and updated for ColdFusion MX 6.1. Just about every chapter has been rewritten, several of them completely. Many of the changes are the direct result of reader feedback. Four new chapters were added to deal with totally new topics introduced in ColdFusion MX. Additionally, the majority of examples used throughout the book have also been rewritten to reflect new and improved coding techniques and practices. It's worth noting that many of the changes to ColdFusion from Version 5 to MX are significant and simple to spot, while others are subtle and easy to overlook. Wherever possible, I try to point out the differences between the two versions.

JT400 4.1 Released/Back from Vacation

After a nice long week off, I'm back from vacation. Man, I can't wait for retirement ;-) Of more important note is the release of JTOpen 4.1 by IBM (an open source JDBC driver for iSeries [AS400] DB2). This is basically a maintenance release that fixes all sorts of minor issues, as well as adds some enhancements to the driver. You can download it from IBM. I've already installed it on two machines, and it's been working for a few hours on a rather large application with no apparent issues.

On Vacation/Away from Blogging

I'll be on vacation all next week, so chances are I won't be blogging much. I've got a lot to say about the MX 6.1 release when I get back, so stay tuned.

On a related note, my new O'Reilly book, Programming ColdFusion MX should be on store shelves next Wednesday (8/13). I'll try to blog an entry from the road, but if not, I'll have a lot to say about it when I return.

CF MX 6.1 Adds Millisecond Support to Time Functions

One often requested enhancement to ColdFusion has been the addition of milliseconds to ColdFusion's various date/time functions. In MX 6.1, Macromedia has finally added support via a new mask element, "l" (that's a lowercae L). This new mask can be used with the following functions:

timeFormat()
lsTimeFormat()
dateAdd()
datePart()

Wrapping with Wrap() in CF MX 6.1

I saw a question on the CF-Talk list asking about the new wrap() function in CF MX 6.1. It's not as intuitive a function as you would think. The first time I saw it, I assumed you passed it a string and a character break, and it would return a string formatted with <BR> tags at the appropriate interval. This is not what it does. Here's an explanation from my new book, Programming ColdFusion MX:

Usage: wrap(string, limit [,strip])

Specifies the maximum number of characters to allow per line in string. If a line is longer than the specified number of characters, an attempt is made to break the line by inserting a line break at the nearest whitespace character (space, tab, etc) before the character limit. If string contains no whitespace characters before the maximum number of characters per line, a line break is inserted at the maximum line length. Wrap() uses operating system specific line breaks. On Windows, it's a carriage return and newline character. On Unix/Linux, it's a newline. Optionally, you can specify a third Boolean argument to indicate whether to remove all existing carriage line breaks before wrapping the string. The default for this argument is false.

<cfset myString="This is a string that is so long, I probably would like to break it up. What do you think about that? Is it a good idea?">

<cfoutput>
<pre>#wrap(myString, 80, False)#</pre>
</cfoutput>

If you need a function that actually inserts <BR> tags for you, consider wrap() from the CFLib.org web site. Note that you'll have to rename the UDF to avoid conflicting with the new wrap() function in 6.1.

Short CNet News.com Piece on the Upcoming Flash 7 Player

CNet's News.com has a short piece on the upcoming Flash 7 player. Of particular interest is this quote:

"The new version of the Flash Player, available for download from Macromedia, concentrates on performance improvements that allow the software to process some types of Flash content as much as 10 times faster, said Lucian Beebe, Macromedia's product manager for Flash."

I've been using the beta for a week or so now, and I've noticed that it does seem to run Flash Remoting apps a bit quicker, although I don't have any real comparison numbers.

GetTickCount() in ColdFusion MX 6.1

In a blog post earlier today, Ben Forta mentions that getTickCount() returns a different value than in previous versions of ColdFusion.

With the MX 6.1 release, getTickCount() now returns the number of milliseconds from Unix Epoch (January 1, 1970, 00:00 GMT). Note that it doesn't account for your GMT offset.

OT: California Travel Suggestions?

I haven't done many off-topic posts on my blog (yet), but I figured with the number of people I know that live in California, I could tap into your collective knowledge for some suggestions.

My 5th anniversary is coming up on Aug 15th, and to celebrate, my wife Persephone and I are flying out to LA, renting a convertible and making our way up the coast to Napa/Sonoma for a day or so, and finishing up with three nights in San Francisco. What I'm looking for are some ideas on what to do in between. We're planning on making stops at the Getty Museum and the Hearst Castle, but are interested in suggestions on what sea-side towns might be worth stopping at on our way up the coast, as well as recommendations on where to stay.

Global Component Inheritance with component.cfc

Here's another interesting new feature in ColdFusion MX 6.1...

There may be cases where it would be useful to have one or more methods available to all of the components on your server. Ideas that come to mind are debugging methods, server-wide settings, etc. As of ColdFusion MX 6.1, you can modify a special component called component.cfc that all components on the server automatically extend. Out of the box, the component.cfc file can be found in the \WEB-INFcftags directory and is completely empty. Any methods or properties you place in the file are automatically available to every CFC on your server.

CFCs: Variables/Unnamed Scope Issue Fixed in MX 6.1

For those of you working with CFCs in ColdFusion MX 6.0, you'll be happy to know that the bug affecting variables scope has been fixed in MX 6.1. Now, both the variables scope, and the unnamed scope (unscoped variables) behave the same way. Here's a breakdown of how the variables/unnamed scope, the local scope (var keyword) and the this scope differ:

Variables/Unnamed Scope
Variables in the variables scope are available only within the CFC. They are available to the constructor code, and to all component methods and any pages they include. They may be prefixed with the variables prefix or left unscoped (often called the unnamed scope). Variables in the variables scope that are set within the calling page are not automatically available within the component’s variables scope. Additionally, variables in the variables scope exist as long as the component object exists. This allows them to persist between method calls.

Local Scope
This differs from variables you set in the "local" scope of a method by using the var keyword. These variables are available only to the method in which they are defined and any pages included by that method. Additionally, local variables do not last beyond the life of the method call. The local variable scope differs from other variable scopes in that there is no scope prefix used for the variable. Note that if you do not define the variable with the var keyword, the variable exists in the variables scope, not the local scope.

This Scope
The this scope is functionally equivalent to the this scope in JavaScript and ActionScript. Variables in the this scope are available to all methods within a CFC, any pages they include, and the page that calls the CFC. Within a CFC you refer to variables in the this scope using the this prefix: this.varName. Outside the CFC, you use the component name to reference variables in the this scope: myComponent.varName. Note that this applies only when the CFC is instantiated as an object via the cfobject tag or createObject( ) function, not when a component method is invoked using the cfinvoke tag, without the CFC being instantiated separately.

I hope this helps put things in perspective!