+ All Categories
Home > Documents > Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology...

Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology...

Date post: 26-Dec-2015
Category:
Upload: todd-waters
View: 216 times
Download: 1 times
Share this document with a friend
72
Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002 Presented to the MD CFUG http://www.cfug-md.org
Transcript
Page 1: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling aMicroelectronic World

Getting to Know ColdFusion MXGetting to Know ColdFusion MX

Rob Brooks-BilsonWeb Technology Manager

Author, Programming ColdFusion (O’Reilly)

05/21/2002

Presented to the MD CFUGhttp://www.cfug-md.org

Page 2: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Agenda

• More than we can cover in 1 hour

• Getting started

• Infrastructure changes

• Deprecated and obsolete tags/functions

• Language changes

• New features

• Resources

• Q&A

Page 3: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Getting Started

• Installation Planning– System requirements generally greater than CF 5– Will only upgrade from CF 5

• Two installation options:– Standard

Removes CF 5 Uses existing web server

– Stand-alone Uses internal web server Port 8500 by defualt Not recommended for production Many config options in

\CFusionMX\runtime\servers\default\SERVER-INF\jrun.xml

Page 4: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Getting Started

• Supported Operating Systems– Windows

98 ME (except CF Enterprise) NT 4 2000 XP

– Linux ReaHat 6.2-7.2 SuSE 7.2-7.3

– Unix Solaris 7, 8 UPUX 11.00

Page 5: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Getting Started

• Supported Web Servers– CF MX internal web server– Apache 1.32x and 2.x– IIS 4 and 5– Netscape 3.6x– iPlanet 4.x and 6.x– Zeus 4.1 (Linux SuSE)

• Not officially supported – but it works!– WebSite Pro (forthcoming TechNote)

Page 6: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Getting Started

• Nervous about upgrading?

• Initial install can be done “stand-alone”, allowing you to run CF 5 and CF MX on the same server– Point both CF 5 and CF MX to the same web

root– When you are satisfied, you can reconfigure

MX to use your web server instead

• Code compatibility analyzer in CF Admin does a good job of identifying potential issues

Page 7: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Infrastructure Changes - Java

• ColdFusion MX is completely rewritten in Java– Ships with the Sun 1.3.1_03 JRE (1.3.1_01 on HP-UX)– You can also use the IBM JVM 1.2.2 or later– JDBC drivers for most popular databases– You can still use ODBC for DBs without JDBC drivers

• J2EE under the hood– Now shipping

Professional and Enterprise (embedded JRun)

– Available later this year CF MX for J2EE App Servers

– JRun (full version)– IBM WebSphere– BEA WebLogic– Sun One

Page 8: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Infrastructure Changes - Java

• CFML is compiled to Java byte code– Many operations execute faster than previous versions

of CF– DB operations should perform about the same. JDBC is

NOT inherently faster than ODBC• More access to underlying Java architecture – if you

want it!– JSP pages– JSP tag libraries– Servlets– EJBs– Class files

Page 9: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Infrastructure Changes - Registry

• CF MX no longer uses the registry (Windows and *nix) to store config information. Majority is now in XML config files:– The XML is WDDX– Located in \CFusionMX\lib– Examples

Scheduled tasks: neo-cron.xml DSN info: neo-query.xml Verity info: neo-verity.xml

Page 10: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Neo-cron.xml

<wddxPacket version='1.0'><header/><data><array length='2'><struct type='coldfusion.server.ConfigMap'><var name='test'><struct type='coldfusion.scheduling.CronTabEntry'><var name='path'><string></string></var><var name='file'><string></string></var><var name='resolveurl'><boolean value='false'/></var><var name='url'><string>http://test.com</string></var><var name='publish'><boolean value='false'/></var><var name='password'><string></string></var><var name='operation'><string>HTTPRequest</string></var><var name='username'><string></string></var><var name='interval'><string>ONCE</string></var><var name='start_date'><string>5/9/2002</string></var><var name='http_port'><string>80</string></var><var name='task'><string>test</string></var><var name='http_proxy_port'><string>23</string></var><var name='proxy_server'><string></string></var><var name='start_time'><string>10:24:15 PM</string></var><var name='request_time_out'><string></string></var></struct></var></struct><boolean value='false'/></array></data></wddxPacket>

Page 11: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Infrastructure Changes - Clustering

• Hardware load-balancers are no longer supported within the CF Admin

• Cisco’s DFP supported via ClusterCATS

• ClusterCATS updated for CF MX

• For new features and configuration, see new Using ClusterCATS book in the CF Docs

Page 12: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Deprecated and Obsolete Tags

• Deprecated (works now, but wont in future releases)– CFGRAPH– CFGRAPHDATA– CFREGISTRY (*nix only)– CFSERVLET– CFSERVLETPARAM

• Obsolete (these no longer work in MX)– CFINTERNALADMINSEC

URITY– CFAUTHENTICATE– CFIMPERSONATE– CFINTERNALDEBUG– CFNEWINTERNALADMIN

SECURITY

Page 13: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Deprecated and Obsolete Functions

• Deprecated– GetTemplatePath()

– ParameterExists()

• Obsolete– AuthenticatedContext()– AuthenticatedUser()– CF_GetDataSourceUserName()– CF_IsColdFusionDataSource()– CF_SetDataSourcePassword()– CF_SetDataSourceUserName()– CFusion_DBConnections_Flush()– CFusion_Disable_DBConnections()– CFusion_GetODBCDSN()– CFusion_GetODBCINI()– CFusion_SetODBCINI()– CFusion_Settings_Refresh()– CFusion_VerifyMail()– IsAuthenticated()– IsAuthorized()– IsProtected

Page 14: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Comments

• New comment rules– Within tags– Inside custom tag calls– Within function parameters (not inside string

quotes)– Between pound signs– Nested comments

Page 15: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Comments

<CFSET x = 1 <!--- I am valid --->>

<CFSET y = DateFormat(Now(), 'mm/dd/yyyy' <!--- I'm valid too --->)>

<CFSET z = (1 + 2<!--- still valid --->)>

<CF_MyTag VAR="x" <!--- I'm valid too --->>

<CFOUTPUT>

#y<!---I'm valid as well, although this looks weird--->#

</CFOUTPUT>

<H2>Open the file Comments.cfm to see what I'm doing</H2>

Page 16: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – Variable Scope Structs

• New “scope” structures:– Variables (local) scope– Server– Caller (custom tags)

• Use CFDUMP to see the contents of any of the scope structures

• Be careful when calling variable names that are also scope structures such as URL, FILE, etc.

Page 17: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Variable Scope Structs

<CFSET VARIABLES.x=1>

<CFSET CALLER.y="test the caller">

<CFDUMP VAR="#VARIABLES#">

<P>

<CFDUMP VAR="#CALLER#">

<P>

<CFDUMP VAR="#SERVER#">

Page 18: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – Variable Names

• Additional structure changes– Compound variable names delimited with

periods now auto create structures:

In CF 5:<CFSET Employee.Name=“Joe”>Created a variable called Employee.Name

In CF MX, it creates a structure called Employee and a key called Name with the value “Employee”

– Auto generated structures like this can’t be more than 3 levels deep: my.var.name

Page 19: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Auto Generating a Structure

<CFSET Employee.Name = "Joe Blow">

<CFSET Employee.Age = "30">

<CFDUMP VAR="#Employee#">

Page 20: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – Variables

• Duplicate URL parameters now come across as a comma delimited list of values. – ?a=2&a=2 returns 1,2 in MX– In CF 5, only the last value is passed

• Compound expressions can now be evaluated inline without the use of the Evaluate() function:<CFSET a=1+2><CFSET b=(10*5)+32>

Page 21: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Duplicate URL Variable Names

<CFIF IsDefined('URL.a')>

a=<CFOUTPUT>#URL.a#</CFOUTPUT>

<P>

</CFIF>

<CFOUTPUT>

<A HREF="#CGI.Script_Name#?a=1&a=2">Click me</A>

</CFOUTPUT>

Page 22: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – Dates and Times

• New Short, Medium, Long, and Full masks in DateFormat() and TimeFormat()

• “gg” mask (era) is now supported in DateFormat()• Date functions support years in the range 100 AD –

9999 AD• Two digit years:

– JRE and current locale determine how to process – For most locales, two digit years are processed relative

to the current century. Two digit years are interpreted to within 80 years before

the current date and 20 years after. Exceptions

– Within 72 years before the current date, and 28 years after: English (Australian), English (New Zealand), German (Austrian), German (Standard), German (Swiss), Portuguese (Brazilian), Portuguese (Standard), Swedish.

Page 23: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: DateFormat()

<CFSET TheDate = Now()>

<CFOUTPUT>

TheDate = #DateFormat(TheDate, 'mm/dd/yyyy')#

<P>

These formats are new in ColdFusion MX:<BR>

short: #DateFormat(TheDate, 'short')#<BR>

medium: #DateFormat(TheDate, 'medium')#<BR>

long: #DateFormat(TheDate, 'long')#<BR>

full: #DateFormat(TheDate, 'full')#<BR>

</CFOUTPUT>

Page 24: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: TimeFormat()

<CFSET TheTime = Now()>

<CFOUTPUT>

TheTime = #TimeFormat(TheTime,'hh:mm:ss tt')#<P>

<P>

These formats are new in ColdFusion MX:<BR>

short: #TimeFormat(TheTime, 'short')#<BR>

medium: #TimeFormat(TheTime, 'medium')#<BR>

long: #TimeFormat(TheTime, 'long')#<BR>

full: #TimeFormat(TheTime, 'full')#<BR>

</CFOUTPUT>

Page 25: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - RequestTimeOut

• RequestTimeOut URL parameter is no longer supported in MX

• Instead, CFSETTING now has a REQUESTTIMEOUT parameter– Allows you to set timeouts on a page-by-page

basis– Place in your Application.cfm for application

wide setting• You can support “legacy” code like this:

<CFIF IsDefined(‘URL.RequestTimeOut’)> <CFSETTING REQUESTTIMEOUT = “#URL.RequestTimeOut#”></CFIF>

Page 26: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - CFQUERY

• TIMEOUT attribute is now in seconds and not milliseconds as in CF 5. Also applies to each part of query, not the whole operation.

• CONNECTSTRING attribute is no longer supported due to JDBC issues. This means you can no longer make DSN-less connections.

• DNNAME, DBSERVER, PROVIDER, and PROVIDERDSN are all obsolete

• DBTYPE attribute is no longer supported except for DBTYPE=“Query”

• CF now properly escapes single quotes in values passed to CFQUERY

Page 27: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Query Objects

• Query objects created manually (via QueryNew()) can contain complex data types as individual cell values– Can’t be used for query of queries– Can’t be saved to DB without first serializing

compex data types into WDDX or other string format

– Invalid names passed to QueryAddNew() now throw an error (CF 5 let them go)

Page 28: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Query Cell Containing an Array

<CFSET Colors = ArrayNew(1)>

<CFSET Colors[1]="Red">

<CFSET Colors[2]="Silver">

<CFSET Colors[3]="Blue">

<CFSET Products = QueryNew("ProductName, Color, Price, Qty")>

<CFSET NewRows = QueryAddRow(Products, 2)>

<CFSET QuerySetCell(Products, "ProductName", "Widget", 1)>

<CFSET QuerySetCell(Products, "Color", Colors, 1)>

<CFSET QuerySetCell(Products, "Price", "19.99", 1)>

<CFSET QuerySetCell(Products, "Qty", "46", 1)>

<CFSET QuerySetCell(Products, "ProductName", "Thingy", 2)>

<CFSET QuerySetCell(Products, "Color", Colors, 2)>

<CFSET QuerySetCell(Products, "Price", "34.99", 2)>

<CFSET QuerySetCell(Products, "Qty", "12", 2)>

<CFDUMP VAR="#Products#">

Page 29: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – Query of Queries

• Improved performance– Orders of magnitude for many operations– Recommended upper limit for records is now

50,000 rows. CF 5 was 10,000• Column aliases in ORDER BY, GROUP BY,

and HAVING• Neither MX nor CF 5 support table aliases• Full support for LIKE• Arbitrary expressions can be:

– Grouped– In aggregate functions– Additionally, arbitrary functions are allowed in

aggregate functions

Page 30: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – Query of Queries

• Upper() and Lower() scalar functions for case insensitive matching

• Addition and subtraction can be performed on DATE types

• Improved error messages

• != may be used instead of <> for comparisons

Page 31: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - CFMAIL

• New SPOOLENABLE attribute – two options– Yes (default): Copy of message is queued to

disk until it can be sent. Same behavior as CF 5.

– No: Messages are queued in memory until they can be sent

• GROUP attribute now works correctly

Page 32: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – Binary

• Binary strings are now represented as byte-arrays

• You can use standard CF string functions for manipulating binary data without having to Base 64 encode

• CFDUMP can dump the contents of binary objects, or you can use CFLOOP to iterate over the byte-array

Page 33: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Manipulating Binary

<CFINCLUDE TEMPLATE="_TwosCompToDec.cfm">

<CFSET flnm="d:\cfusionmx\wwwroot\cfide\administrator\images\cfmx.gif">

<CFFILE ACTION="ReadBinary" FILE="#flnm#" VARIABLE="TheFile">

<CFSET Width = TwosCompToDec((TheFile[7]) + (TheFile[8] * 256), 8)>

<CFSET Height = TwosCompToDec((TheFile[9]) + (TheFile[10] * 256), 8)>

<H2>GIF Dimensions</H2>

<CFOUTPUT>

Width: #Width#<BR>

Height: #Height#<BR>

</CFOUTPUT>

<CFDUMP VAR="#TheFile#">

Page 34: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - CFSCRIPT

• Try/Catch exception handling added– Syntax a bit different than CFTRY/CFCATCH– Catch statements coded outside Try block– No CFCATCH structure. You get to define

your own to hold error information– No CFTHROW or CFRETHROW equivalent

• For-in loop can now be used to loop over COM collections

Page 35: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Try/Catch in CFScript

<CFSCRIPT>

try {

x=y+1;

}

catch("Expression" exception) {

writeOutput("Expression Error: " & exception.Message);

}

catch("Any" exception) {

writeOutput("General Error: " & exception.Message);

}

</CFSCRIPT>

Page 36: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: For-in Loop over COM in CFScript

<cfscript>

fso = CreateObject("COM", "Scripting.FileSystemObject");

for (i in fso.drives) {

WriteOutput(i.DriveLetter &"<br>");

}

</cfscript>

Page 37: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – Regular Expressions

• MX Introduces a totally new regular expression engine

• “Perl” compatible

• More special characters and escape sequences

• Case conversion in replacement strings

• Minimal matching

Page 38: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Regular Expressions

<CFSET String="I want to go to to the park.">

<CFOUTPUT>

From the CF Docs:<BR>

#REReplaceNoCase(String, "([A-Za-z]+)[ ]+\1","\1","ALL")#

<P>

Should be:<BR>

#ReReplaceNoCase(String, "\b([a-z]+)[ ]+\1", "\1", "All")#

</CFOUTPUT>

Page 39: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Unicode

• CF MX Supports Unicode!– MX supports Java UCS-2 character code

values in the range 0-65535– CF 5 only supported characters in the range 1-

255– Character set support is a function of the

underlying JRE

• Default encoding is UTF-8

Page 40: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Unicode

• CFPROCESSINGDIRECTIVE tag can now set the encoding for a page– The most common character sets are UTF-8, UTF-16,

UTF-16BE, UTF-16LE, US-ASCII, and ISO-8859-1– You may use any character set supported by your JRE

• Many tags and functions have a new CHARSET attribute/prameter– CFCONTENT– CFFILE– CFHTTP– ToBase64()– ToString()– UrlDecode()– UrlEncodedFormat()

Page 41: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes – LS Functions

• Locales are defined by your JRE– Locales may be different than in CF 5– LSEuroCurrencyFormat() now only returns

EUR as the currency symbol for locales that support it

– LSCurrencyFormat() does not return EUR as the currency symbol for any locale – even those supporting the Euro

• There are several other changes to LS functions. Consult the CF Docs for more info.

Page 42: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Locking

• Contrary to rumor, CFLOCK is not gone – just different– If you don’t lock access to shared scope

variables (application, session, server), CF MX won’t experience the memory corruption that could occur in previous versions

– However, race conditions as well as overwriting of values can still occur.

– In many (most?) cases, you’ll continue to want to lock

Page 43: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Verity

• All Tags (CFCOLLECTION, CFINDEX, CFSEARCH): – Collection names may now contain spaces– New SearchEngine exception type is thrown

when an error occurs with CFINDEX, CFCOLLECTION, and CFSEARCH

Page 44: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Verity

• Changes to CFCOLLECTION– ACTION is now required– New ACTION=“List”. Returns query with

names of all registered collections – VDK and K2

– ACTION=“Map” is no longer necessary as MX automatically detects mapped collections

Page 45: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Verity

• Changes to CFINDEX– ACTION=“Optimize” is obsolete in MX– EXTERNAL attribute is no longer necessary as

MX automatically detects mapped collections. Do not use it.

Page 46: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Verity

• Changes to CFSEARCH– Now allows fully qualified (absolute) path

names in the COLLECTION attribute– EXTERNAL attribute is no longer necessary as

MX automatically detects mapped collections. Do not use it.

Page 47: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Language Changes - Verity

• New K2 Server functions– GetK2ServerDocCount()– GetK2ServerDocCountLimit()– IsK2ServerABroker()– IsK2ServerOnline()

Page 48: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features - CFHTTP

• Can now post raw XML using new “XML” CFHTTPPARAM Type

• New FIRSTROWASHEADERS attribute solves problem with first row in delimited file always being lost

• CFHTTP follows a maximum of 4 redirects. CF 5 would follow up to 5

• Response headers return structures when multiple keys have same name. CF 5 returned arrays

• Certain behaviors such as SSL support vary depending on your JRE

• See the Release Notes for more info

Page 49: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features - Security

• Advanced Security (SiteMinder) is gone

• Replaced with new security framework Application based security

– New tags CFLOGIN CFLOGINUSER CFLOGOUT

– New Functions IsUserInRole() GetAuthUser()

Sandbox Security– Lock-down tags, functions, databases, files,

directoriesm and IP addresses and ports based on directory

Page 50: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – Charting and Graphing

• CFGRAPH and CFGRAPHDATA are deprecated.

• Still functional. However, may produce unexpected output.

• Run the code compatibility analyzer in the CF Admin to find templates containing these tags

• Replaced by CFCHART, CFCHARTSERIES, and CFCHARTDATA

Page 51: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – Charting and Graphing

• CFCHART offers the following– 11 chart/graph types with 2 and 3 dimensional

versions of each– Flash, JPG, or PNG format (no GIF due to

licensing issues)– More interactive display options than

CFGRAPH– Multiple series– Ability to overlay different chart types– Charts can be cached to memory or disk

Page 52: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Super Basic CFCHART

<CFQUERY NAME="GetSalary" DATASOURCE="ProgrammingCF">

SELECT Department, AVG(Salary) AS AvgSalary FROM EmployeeDirectory

GROUP BY Department

</CFQUERY>

<CFCHART FORMAT="Flash">

<CFCHARTSERIES QUERY="GetSalary" TYPE="bar" VALUECOLUMN="AvgSalary"

ITEMCOLUMN="Department">

<CFCHARTSERIES QUERY="GetSalary" TYPE="line" VALUECOLUMN="AvgSalary"

ITEMCOLUMN="Department">

</CFCHART>

Page 53: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – UDFs

• MX now supports tag based UDFs– Opens up a ton of new UDF possibilities– THREE new tags

CFFUNCTION CFARGUMENT CFRETURN

– Local function variables are created with new Var attribute: <CFSET Var x=1>

• Arguments is now available as an array AND a structure

• Function parameters can now be named: Person(Name=“Joe”, Age=“30”)

Page 54: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Tag based UDFs

<CFFUNCTION NAME="IsScheduledTask" RETURN="Boolean">

<CFARGUMENT NAME="TaskName" REQUIRED="True" TYPE="String">

<!--- var local vars for the func --->

<CFSET Var TaskXML="">

<CFSET Var GetTasks="">

<!--- get the scheduler xml file. It's stored as WDDX --->

<CFFILE ACTION="Read“ FILE="#Server.ColdFusion.RootDir#\lib\neo-cron.xml“ VARIABLE="TaskXML">

<!--- convert the WDDX to CFML - and array of structs --->

<CFWDDX ACTION="WDDX2CFML" INPUT="#TaskXML#" OUTPUT="GetTasks">

<!--- search the array of structs for the name passed to the func --->

<CFIF ListContainsNoCase(StructKeyList(GetTasks[1]), Arguments.TaskName) EQ 0>

<CFRETURN False>

<CFELSE>

<CFRETURN True>

</CFIF>

</CFFUNCTION>

<CFOUTPUT>Is "Test" a scheduled task? #IsScheduledTask("test")#<BR>

Is "Jest" a scheduled task? #IsScheduledTask("jest")#</CFOUTPUT>

Page 55: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – Native XML Handling

• New XML Document Object data type– Builds a DOM using native ColdFusion data

types such as arrays and structures– Can be manipulated with new XML functions,

structure functions, and array functions

• CFDUMP displays an extremely useful representation of the XML document object

Page 56: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: XML Document Object

<CFFILE ACTION="Read" FILE="d:\cfusionmx\wwwroot\mdcfug\MacromediaXmlFeed.xml" VARIABLE="MyXML">

<CFSET DesDev = XmlParse(MyXML)>

<CFDUMP VAR="#DesDev#">

Page 57: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – Native XML Capabilities

• Read an existing XML file and convert it to an XML document object

• Add,update, and delete elements and data from an XML document object

• Transform XML document objects using XSLT

• Search and extract data using Xpath

• Generate XML files from XML document objects

Page 58: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – XML Tags and Functions

• Tags– CFXML

• Functions– IsXmlDoc()– IsXmlElement()– IsXmlRoot()– XmlChildPos()– XmlElemNew()– XmlFormat()– XmlNew()– XmlParse()– XmlSearch()– XmlTransform()

Page 59: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Manipulating XML

<CFFILE ACTION="Read" FILE="d:\cfusionmx\wwwroot\mdcfug\MacromediaXmlFeed.xml" VARIABLE="MyXML">

<CFSET DesDev = XmlParse(MyXML)>

<CFSET Size = ArrayLen(DesDev.Macromedia_Resources.XmlChildren)>

<CFSET MyQuery = QueryNew("resource, title, author, url, product") >

<CFSET QueryAddRow(MyQuery, Size)>

<CFLOOP INDEX="i" FROM="1" TO="#Size#">

<CFSET ThisProd = "">

<CFSET QuerySetCell(MyQuery, "resource", DesDev.Macromedia_Resources.Resource[i].XmlAttributes.Type, i)>

<CFSET QuerySetCell(MyQuery, "title", DesDev.Macromedia_Resources.Resource[i].Title.XmlText, i)>

<CFSET QuerySetCell(MyQuery, "author", DesDev.Macromedia_Resources.Resource[i].Author.XmlText, i)>

<CFSET QuerySetCell(MyQuery, "url", DesDev.Macromedia_Resources.Resource[i].Url.XmlText, i)>

<!--- get the number of products by looping over the entire XMLChildren array and pulling out only product items. This is necessary because

an item can pertain to more than one product. --->

<CFSET NumOfProd = ArrayLen(DesDev.Macromedia_Resources.XmlChildren[i].XmlChildren)>

<CFLOOP INDEX="j" FROM="1" TO="#NumOfProd#">

<CFIF DesDev.Macromedia_Resources.XmlChildren[i].XmlChildren[j].XmlName IS "product">

<CFSET ThisProd = ListAppend(ThisProd, DesDev.Macromedia_Resources.XmlChildren[i].XmlChildren[j].XmlAttributes.Name)>

</CFIF>

</CFLOOP>

</CFLOOP>

<CFDUMP VAR="#MyQuery#">

Page 60: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features - CFIMPORT

• Four uses:– Import JSP Tag Libraries– Import “libraries” of custom tags

Allows you to store and call your custom tags anywhere on the server

Allows custom prefixes

– Import web services– Adaptive tags

Page 61: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – Adaptive Tags

• Use CFIMPORT with PREFIX=“”

• Modify existing HTML/CFML tags to do new and interesting things

Page 62: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: CFIMPORT and Adaptive Tags

<CFIMPORT PREFIX="" TAGLIB="/mdcfug/adaptivetags">

<BLINK>Fill me out!</BLINK>

<FORM MEDHOD="Post" ACTION="<CFOUTPUT>#CGI.Script_Name#</CFOUTPUT>">

State: <INPUT TYPE="State" NAME="State"><BR>

Name: <INPUT TYPE="Text" NAME="Name" WIDTH="15" MAXLENGTH="255"><BR>

<INPUT TYPE="Submit" NAME="Submit" VALUE="Submit">

</FORM>

Page 63: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features - CFCs

• CFC = ColdFusion Component

• A lot more to them than we can cover here

• CFC’s are objects that allow “pseudo” object-oriented programming in CF MX– CFC’s have methods you can call– Limited inheritance– Introspection

• New variable scope in CFCs – This

• Use the CFCexplorer!

Page 64: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features - CFCs

• New tags and functions for creating and working with components:– CFCOMPONENT– CFFUNCTION– CFARGUMENT– CFPROPERTY– CFRETURN– CFINVOKE/CFINVOKEARGUMENT– CFOBJECT– GetMetaData()

Page 65: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features - CFCs

• Can be called in a number of ways:– CFINVOKE tag– CFOBJECT tag– CFSCRIPT (CreateObject)– URL– FORM– Flash Remoting– As a Web Service

• To see what a CFC has to offer, enter it’s URL (secured by RDS password)

Page 66: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features - CFCs

• CFC security is handled with the ROLES and ACCESS attributes– Roles specify WHO can access the CFC and

correspond with roles defined within the CF security architecture

– ACCESS specifies HOW the CFC can be accessed:

Public Private Package Remote

Page 67: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: CFINVOKE a CFC

<!--- call with CFINVOKE, filter on multiple products, sort it, and return as

a query object --->

<cfinvoke component="GetDesDevFeed"

method="GetFeed"

product="ColdFusion,Macromedia_Flash" <!--- no space between items --->

sortOrder="Title DESC"

returnVariable="MyQuery">

<cfdump var="#MyQuery#">

Page 68: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – Web Services

• CF MX has built in support for SOAP based web services via the Apache Axis server under the hood

• Both production and consumption are supported:– CFINVOKE/CFINVOKEARGUMENT or

CreateObject() to consume– Set ACCESS to “Remote” in a CFC to produce

– it’s that easy!• WSDL file is automatically created when

producing a web service• Web services can be registered in the CF

Admin to avoid having to always specify the full path to the WSDL file

Page 69: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Example: Invoking a Web Service

<cfinvoke

webservice="http://localhost:8500/mdcfug/getdesdevfeed.cfc?wsdl"

method="getFeed"

returnvariable="aQuery">

<cfinvokeargument name="product" value="ColdFusion"/>

<cfinvokeargument name="author" value=""/>

<cfinvokeargument name="resource" value=""/>

<cfinvokeargument name="sortOrder" value=""/>

</cfinvoke>

<CFDUMP VAR="#aQuery#">

Page 70: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

New Features – Web Services

• Security for web services is the same as that for CFCs

• If you have Dreamweaver MX, there are all sorts of goodies for auto-generating code for producing and consuming web services in ColdFusion

Page 71: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Resources

• MX Release Notes: http://www.macromedia.com/support/coldfusion/releasenotes/mx/releasenotes_mx.html

• MX Doc Updates: http://www.macromedia.com/v1/Handlers/index.cfm?ID=22811&Method=Full

• MX Doc Additions: http://www.macromedia.com/v1/handlers/index.cfm?id=22993&method=full

• MX LiveDocs: http://livedocs.macromedia.com/cfmxdocs/

• Macromedia Designer & Developer Center: http://www.macromedia.com/desdev/mx/coldfusion/

• CFLib.org: http://www.cflib.org• CFCzone: http://www.cfczone.org

Page 72: Enabling a Microelectronic World Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002.

Enabling a Microelectronic World© 2002 Amkor Technology, Inc.

Q&A

• Feel free to email me questions at [email protected]

• This presentation is available for download from http://www.cfug-md.org


Recommended