By paddloPayday loans

What’s New in CF9

ORM Support

  • Object Relational Mapping is key to RAD (you find it in Ruby, CFWheels, etc)
    Hibernate: the number one ORM tool is included with CF9 (requires additional tool on development side –CFBuilder or others)
  • Requires use of application.cfc (will not work in application.cfm)
  • At the very least, use of hibernate with a tool like cfbuilder will write 2/3 of your database queries for you. Frequently more than that.

FLEX and AIR Support

  • More Flash Remote commands available without purchasing Flex. (Great for Flash users)
  • Now integrated with Adobe Air allowing you to use your ColdFusion to power your Air apps.

Language Enhancements

  • More commands available within CFScript (You can now write most of your app within cfscript):
    • Basic language constructs: throw, writedump, writelog, location and trace
    • Script functions: query, mail, http, storedprod, pdf and ftp
    • Keywords: abort, exit, include, param, property, rethrow, throw
      Operations: import and new
  • New onServerStart() method to run only when server starts. Useful for configuring logging, instantiating applications, and setting up scheduler.
  • Nested CFTRANSACTIONS
  • Udf/cfc name conflict resolution
  • Local scope/Var scope (helps with name conflicts between application and function) – also can use var anywhere within a cfc and not just at the top.
  • Local is now a reserved word!
  • Implicit getters and setters for cfproperty!

Product Integration

  • Ajax Controls – extJS 3 now embedded (was extJS 2.x), google maps now embedded,.
  • SharePoint integration: can use sharepoint signon in cf, can load sharepoint actions in CF application, can create web parts for sharepoint.
  • MS Office interoperability – now can use cfspreadsheet and cfpresentation rather than cfcontent. Can convert word and powerpoint to pdf with cfdocument.
  • OpenOffice support: if installed and the proper attribute is used, cfdocument will use openoffice engine to create pdf rather than cf engine.
  • Search using Apache Solr rather than Verity!!

Performance Enhancements

  • Improved clustering: supports serialization of query, array and datetime types in a cfc.
  • Granular control over cacheing (can cache fragments of page, can cache in memory, can cache specific objects, etc)
  • In-memory files: simplify execution of dynamic code.
  • Other: Faster cfcs, faster java method invocation

Database Enhancements

  • Now uses DataDirect 4.0 sp 1
    • Support MySQL(enterprise and commercial), Oracle 11g, Informix 11, SQL Server 2008
    • Support IPv6 (Internet Protocol).
    • Set default query timeout value.
  • Datasource attribute is now optional for cfquery, cfinsert, cfupdate, and cfdbinfo.

Code Analyzer

  • Helps migrate from CF7 and 8 to CF9

Service Features

  • More CF can be exposed as web service: cfpdf, cfimage, cfdocument, cfmail, cfpop, cfchart

Other Enhancements

  • Server Manager – desktop version of CF Admin (runs on Adobe Air) with limited availability
  • Built-in support for portlet standards: supports JSR-168, JSR-286, WSRP to help build cf powered portal content.
  • PDF functionality: can support FDF, PDF Package, size optimization, headers and footers (in cfpdf), RGB/ARGB and cfimage support in cfpdf, improved thumbnails, image extraction from pdfs.
  • IMAP support – can query imap servers for email, can run imap items like delete mail/folder, mark multiple as read, and manage folders.
  • JRE specifications – JRE 6 update 14 for all platforms except solaris which uses JRE 6 update 12.

New and Updated Functions

  • Visit livedocs for the full list
  • Most notable: spreadsheet functions and isIPV6().

New Tags

  • Visit livedocs for the full list
  • Most notable: CFFINALLY: brings try/catch up to date with Java allowing a portion of code to run regardless of an error being caught.

Notes

  • With the exception of extJS 3 from extJS 2, existing apps are unlikely to require many changes to continue to function.

Useful Regular Expressions in CF

Have you ever said “Sure, i can take out all that stuff that MSWord puts in when you paste from word” Or “I’m sure I can just find the bits that i don’t need and get rid of them before saving.” If you did, did you regret it immediately?

Or did you wait till you hit the search engines and found the perfect regular expression only when you pasted it to your “ReReplace()” it turned out to be formatted incorrectly for CF?

First things first, there are regular expressions, and there are CF regular expressions. Most systems, from unix shell to Ruby on Rails have a means of using regular expressions, but not all of them look the same.

for instance, in powerGREP you say:

\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b

in order to find an email address, but in cold fusion, a number of elements have different uses, so you then have to write the following.

ReFind("[^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,4})");

In addition, there is a great deal covered on taking HTML out, including these two, which i’ve used frequently:

The First:

function stripHTML(str) { new_str = REReplaceNoCase(str,"","","ALL"); return REReplaceNoCase(new_str,"<[^>]*>","","ALL"); }

Now this one focuses directly on Microsoft, which likes to put some conditional code in that runs depending on your browser, and inside of which are styles as well as html. In addition it fills up standard html tags with a number of attributes that are really just for Microsoft.

The first REReplace looks for those <!–.if blocks with any text between them and the end if. Replaces all of them with nothing.

the second REReplace then finds EVERY set of text and whatnot between a < and a > and takes it right out. Note that this will remove EVERY tag, including ones that it might be relatively wise to keep.

In testing, this took the HTML version of a Word document and removed as many as 84% of the characters, thus shrinking it down to something more usable in a ‘text’ field.

Of course, most of us actually want rich text, we provide rich text editors for that purpose. So we probably don’t want to completely remove everything.

The Second:

function stripHTML2(str) { new_str = REReplaceNoCase(str,"","","ALL"); return REReplaceNoCase(new_str,"<(?!\/?(br|b|table|tr|td|i|em|strong|p))[^>]*>", "","ALL"); }

 
So ; all these | serve as “or” and so you’re effectively only removing those tags that do NOT contain br, b, table, tr, td, i, em, strong, or p.

As written, this function will do exactly that, but it does leave in attributes added by Microsoft to support much of what you removed already.

So you could take the above regular expression, and modify it to search out these styles and whatnot that would be added between the < and >.

Of course, most of this, you could probably get elsewhere, and in fact, there’s a function i was able to get at CFLib.org that will do even more than that, and make your data safe.