CFUnited Day 2 - CFML Enhancements - Rupesh Kumar
Yesterday there were a few problems with the network connections here at the conference. It seems thay have 4 lines this year versus the one they had last year but its still overloaded.
The first session I attended was a session on CFML enhancements by Rupesh Kumar one of the Adobe CF Developers.
Syntax enhancements
There are a number of new operators in CF8, like ++ and --, to increment and decrement. You can also use more traditional comparison operators within CFScript.
There are new ways to define arrays and structures with what is called implicit array definition.
You can now write somthing like:
<cfset myStruct = {one="win",two=2,three=3}>
You can use an attribute collection with many of the old and new tags in CF8. This makes it much easier to add attributes conditionally.
You can now call precisionEvaluate() Function to ensure that rounding does not result in small value error.
You can loop over an array and a file with array= and file= in the cfloop tag.
CFC Enhancements
New tag is called cfinterface to create a new interface. It will contain a cffunction which only contains
IsInstanceOf(comp, type) allows you to check the type of an object.
GetComponentMetadata() returns the metadata without instantiation.
CFCs are seriualizable so that can be saved in a session and passed from server to server within a java cluster.
You can use duplicate to copy CFCs.
OnMissingMethod can be used to handle errors when a method does not exist. This can be used to create generic getter and setter methods.
OnMissingTemplate method in Application.cfc can be used to catch 404 errors.
Per application settings
You can define mappings by application in the application.cfc in a structure this.mappings
Multi-threading
Multi-threading can be used to improve application performance. For example if you had to get data from several remote web servers, you can spawn multiple threads to work in parallel and get results from multiple servers.
When passing data to threads you should use attributes and with the thread use attributes scope.
Join will cause one thread to wait until another finishes.
Terminate can be used to terminate another thread.
You can also share data using thread scope. Each thread has its own scope. The owner thread can write this scope but all other threads can read this scope using threadname.varname.
Threads also have var scope which hides the variables within it, within a thread variables are in var scope by default.
Any error within a thread does not stop the main request.
File I/O
You can also use functions FileOpen() FileReadLine() and FileWrite and FileClose() and FileEOF to check for end of the file. FileCopy() FileMove(), FileDelete, FilesSetAttribute(), GetFileInfo().
You can use cfloop with file= to read a file line by line, or by a set number of characters.
Database Enhancements
Can now retrieve an auto generated key
Transaction has been enhanced to create save points, which can be rolled back to at a later place.
cfdbinfo can be used to introspect the database tables.
cfdump enhancements
Lots of additional enhancements to allow data to be selected from the structure or query being dumped.
cfobject now supports .NET objects.
cfzip tag can be used to add and remove files from a zip or jar archive.
File uploads can be of any size as they are no longer kept in memory.

There are no comments for this entry.
[Add Comment]