Previous Issue Current Issue Main page Next Issue
Fusion Authority Fusion Authority
The House of Fusion Technical Magazine
Issue: 122

May 2, 2003
May 8, 2003
This is an opt-in magazine. To join, leave or change subscription mode, please visit the signup page. All content of this magazine is copyright Fusion Authority, Inc. It may not be reproduced without permission.

Community
Visit Your CFUG/MMUG and Hear Ben Forta Speak!
Fusebox 4 to be Released this Summer, More Details at CFUN-03
A Conversation with Jeremy Allaire
CFMX and Other Macromedia Products Bring Home the Awards!
 
Tech and Tags
Catching Spam: A Honey Trap
Royale: Two Sources Give Some Enticing Hints
 
Security
Path Disclosure Vulnerability in ColdFusion MX Server
 
Best of ColdFusion Talk
Best of Talk (Weekend, 5/3/03 - 5/4/03)
Best of Talk (5/2/03)
Best of Talk (5/1/03)
Best of Talk (4/30/03)
Best of Talk (4/29/03)
Best of Talk (4/28/03)
Best of Talk (Weekend, 4/26/03 - 4/27/03)
Best of Talk (4/25/03)
Best of Talk (4/23/03)
Best of Talk (4/22/03)
Best of Talk (4/21/03)
Best of Talk (Weekend, 4/19/03 - 4/20/03)
Best of Talk (4/16/03)
Best of Talk (4/15/03)
Best of Talk (4/14/03)
Best of Talk (Weekend, 4/12/03 - 4/13/03)
Best of Talk (4/11/03)
Best of Talk (4/10/03)
Best of Talk (4/9/03)
Best of Talk (4/8/03)
Best of Talk (4/7/03)
Best of Talk (Weekend, 4/5/03 - 4/6/03)
Best of Talk (4/4/03)
Best of Talk (4/3/03)
 

Community

Visit Your CFUG/MMUG and Hear Ben Forta Speak!

This Tuesday (May 13) will be the first joint online user group meeting, conducted by Ben Forta, who will be communicating with and presenting to several user groups remotely. Some of the user groups participating include the New York ColdFusion User Group, the UEMM Corporate Champions Group, the Houston Area ColdFusion User Group and the San Antonio Macromedia ColdFusion User Group. So for those who want to take part in this presentation, please contact your local user group to see if they're participating, and attend!

[Top]

Fusebox 4 to be Released this Summer, More Details at CFUN-03

May 7, 2003 -- Hal Helms and John Quarto-vonTivadar announced the upcoming release of Fusebox version 4 at the Atlanta ColdFusion User Group (http://www.acfug.org), and demoed the methodology to a live audience of over 70 people and a reported virtual audience of over 150 listeners on the Macromedia Flash Communications Server MX. Helms said that the Fusebox 4 beta will run from early May through the end of July, when a final version will be released for the public on http://www.fusebox.org.

Fusebox 4 has developed in two different forms, Fusebox 4 with XML (FB4) and Fusebox MX with CFCs (FBMX). Both forms adds new features and serve different purposes. FB4 puts the logic and control of the application into XML, replacing the fbxSwitch file with an enhanced equivalent in XML and allowing the programmer to write their "fuses" in any language they choose. This makes Fusebox a methodology completely independent of any language. FBMX is a form of Fusebox that leverages CFCs to explore what Fusebox could become and how well Fusebox and CFCs can work together.

FB4 also includes many ideas from FuseQ, the version of Fusebox written by John Quarto-vonTivadar that allows for multiple fuseactions and streamed output into CSS and Flash front ends.

If you couldn't make it to Atlanta, you can view the presentation on CD, courtesy of Adam Howitt of the Atlanta ColdFusion User Group, for a $10 donation. Anyone who wants a copy should email him at adamhowitt@yahoo.com with the subject "Fusebox CD." And to get a deeper understanding, you might want to attend the four talks on Fusebox 4 that will be given at CFUN-03. The speakers include Hal Helms, Jeff Peters, John Quarto-vonTivadar and Sandra Clark. For more information see http://www.cfconf.org/cfun-03/.

Meanwhile, you can download the Fusebox 4 core files and documentation and find out more at http://beta.fusebox.org. Enjoy!

[Top]

A Conversation with Jeremy Allaire

Thanks to S. Isaac Dealey for pointing us to this interview with Jeremy Allaire. It gives a great overview of ColdFusion's history and a personal look at Jeremy Allaire and how he and his brother J.J. created ColdFusion.

A Conversation with Jeremy Allaire (Meet-the-Makers.com, May 7, 2003)

[Top]

CFMX and Other Macromedia Products Bring Home the Awards!

May 7 -- Macromedia announced that Flash MX, Flash Communications Server MX and JRun won the highly coveted SIIA Codie Awards at a reception in San Francisco on May 6th. The Codie Awards, run by the Software and Information Industry Association (SIIA), honor creativity and innovation in the software and information industry.

The winners were:

This news comes not long after ColdFusion MX won a Productivity Award in the Business Integration and Data Tools category at the 13th Annual Jolt Product Excellence and Productivity Awards, given by the editors of Software Development magazine.

Macromedia Flash, JRun Win SIIA Codie Awards (Macromedia.com, May 7, 2003)

[Top]



Tech and Tags

Catching Spam: A Honey Trap

by Michael Dinowitz

Before we try to understand spam, we should try to get some. Yes, I know this sounds like a silly thing to say as anyone with email gets spam, but what I'm going to describe is a way to get a particular type of spam: spam from page scrapers.

Page scraping is when a spammer has a web agent or the like visit your web site, download all of your web pages and look for anything that is in a mailto link or is structured like an email address. When a page scraper gets such an address, it is sure to be sent spam in no time at all.

If the last article described how to defeat screen scraping, then how do we expect to catch screen scrapers now? That's easy. We create a few email addresses inside of HTML comment tags and place them on the site. Any mail to these addresses MUST be from screen scrapers and will be our 'baseline' for spam. This will be important later but for now it'll help us determine which domains and IPs send spam. How do we find this information? It's in the mail header, which we will examine in detail in the next issue.

[Top]

Royale: Two Sources Give Some Enticing Hints

An interview in Infoworld gives some interesting hints about an upcoming product called Royale that Macromedia hopes to deliver later this year. Burgess describes it as "Flash for Programmers." Back in March, Mike Chambers talked about it in his blog entry for a demonstration at FlashForward of some code used to build a Flash form that was written in XML ... While the official word about Royale is under NDA, these small public "hints" make it obvious that Royale is something to watch for.

Interview: Macromedia CEO Discusses Upcoming Royale Tool (Infoworld, May 8, 2003)

FlashForward Keynote : Royale Sneak Peak (Mike Chambers' Blog, March 27, 2003)

[Top]


Security

Path Disclosure Vulnerability in ColdFusion MX Server

A vulnerability in Macromedia Coldfusion MX Server's default installation can result in the inadvertent disclosure of the physical path of the server installation. In a default installation, the Enable Robust Exception Information setting is enabled under Debugging Settings. According to Macromedia, this setting should be cleared on production systems.

(Thanks to Chris Montgomery for sending us this article!)

Path Disclosure Vulnerability in ColdFusion MX Server

[Top]


Best of ColdFusion Talk

Best of Talk (Weekend, 5/3/03 - 5/4/03)

by Dina Hess

Title: Another Way OT But I Need Help
Date: 05/04/03      17 Posts
Summary: Need a few pointers about how to completely reformat a hard drive partitioned as NTFS under Win2K Server before installing Win XP? Booting from a Win98 disk is a quick way to create FAT32 partitions and formats. You can then change the partition type to NTFS during the Win XP install process.
 
Title: Date and Time Calendar Custom Tag
Date: 05/04/03      14 Posts
Summary: Searching for a popup calendar that lets the user select a date and a time? Find custom tag recommendations and code that integrates with a CFC.
 
Title: Loop in CFMX
Date: 05/03/03      4 Posts
Summary: Trying to display database columns grouped by table? Use nested index loops with the TO attribute set to the query's recordcount:

   <cfloop from="1" to="#qTable.RecordCount#" index="i">
      #qTable.table_name[i]#
      <cfquery name="qColumn" datasource="dsn">
         sp_columns '#qTable.table_name[i]#'
      </cfquery>
      <cfloop from="1" to="#qColumn.RecordCount#" index="j">
         #qTable.table_name[i]# #qColumn.column_name[j]#
      </cfloop>
   </cfloop>
 

[Top]

Best of Talk (5/2/03)

by Dina Hess

Title: Deleting List Values
Date: 05/02/03      9 Posts
Summary: Need to delete records based on a list of values returned in a form's checkbox field?

   DELETE FROM myTable 
   WHERE myField IN (0#FORM.formfield#)
The zero keeps the query from breaking if the list is empty. Caveat: This code breaks ORACLE if the list contains more than 1,000 values.
 
Title: HTML2PDF
Date: 05/02/03      23 Posts
Summary: Several developers compare notes about their experiences installing and configuring HTML2PDF, which is used as a custom tag and was recently highlighted in CFDJ. Note that the .EXE download is a compressed file that must be decompressed for the tag to work.
 
Title: Locking Issues and CFCs
Date: 05/02/03      9 Posts
Summary: In this excellent thread, CF experts discuss several advantages to storing queries in persistent CFCs, such as having all of the SQL in one place and being able to easily purge a single cached query. And since persistent CFCs are thread-safe, it is unnecessary to lock when writing to variables.

 

[Top]

Best of Talk (5/1/03)

by Dina Hess

Title: CFMX/Java Vulnerability
Date: 05/01/03      15 Posts
Summary: CF gurus take a look at code that could reportedly generate a denial of service (DOS) attack on CFMX. Their evaluation? The ability to crash a server does not generally represent a security problem. And although the ability to send malformed data to a CF program does present a security risk, that is unlikely with this code. A hacker would need file system access to the web root on a server with CFOBJECT enabled for this code to present a threat. Visit SecuriTeam.com for more information about JVM vulnerabilities that are fixed with JDK 1.4.1_02.
 
Title: Form Fields
Date: 05/01/03      14 Posts
Summary: Is there any way to preserve user input in form fields, even if they hit F5 to refresh the page? Suggestions include querying the database, as you would in an edit mode, or populating session variables with the form field values. A custom tag is also recommended.
 
Title: How Can I Make SQL Server Do the Work?
Date: 05/01/03      10 Posts
Summary: Need to return the number of orders that occur for each day of the week?

   SELECT 
      Datepart(dw,Orderdate) AS WeekDay, 
      COUNT(Order_id) AS total
   FROM Orders 
   WHERE ....
   GROUP BY Datepart(dw,Orderdate)
To count orders that occur each hour in a 24-hour day, just change the datepart in the above query to "hh."
 
Title: Is This a "correct" Way to Use CFCATCH?
Date: 05/01/03      9 Posts
Summary: Looking for a CFTRY/CFCATCH code example? Find it here along with suggestions to make it even better.
 
Title: SQL NOT Question...So Lost
Date: 05/01/03      16 Posts
Summary: SQL experts debate whether it is faster to to pull a date range using the BETWEEN operator or "<=" and ">=." This thread also includes a strategy for returning daily inventory levels within a given date range for each group of items.
 

[Top]

Best of Talk (4/30/03)

by Dina Hess

Title: Can CFLOGIN Work Across Browser Instances?
Date: 04/30/03      13 Posts
Summary: CF gurus discuss why CFLOGIN, which relies on a "session" cookie, should or should not work across multiple browser sessions on a single client. A reference to RFC 2965 is included as a resource for standards on state maintenence.
 
Title: DateFormat() Question
Date: 04/30/03      15 Posts
Summary: You can update dates stored in a varchar field with irregular formats like SEP 02, DEC98, or SEPT98  to a "YYYY, MMMM" format using:

   #DateFormat(left(myVar, len(myVar) - 2) & " 1, "
      & right(myVar,2), "yyyy, mmmm")#
 
Title: Evaluate() and CFIF
Date: 04/30/03      9 Posts
Summary: In a list loop over FORM.fieldnames, you can skip a block of code where the fieldname is an empty string by using <cfif len(trim(form[i]))>. Array syntax is suggested as a replacement for Evaluate(). A brief tutorial that compares structures to arrays is included.
 
Title: Handling MS Word "Smart Quotes"
Date: 04/30/03      12 Posts
Summary: Scrub "smart quotes" from data that has been cut from a Word document by replacing the offending characters with their ASCII decimal equivalents. But if your application and database are configured to handle the Unicode character set, "smart quotes" shouldn't be a problem.
Related: 8000+ ASCII Range?
 
Title: MIME Type of Image/pjpeg?
Date: 04/30/03      12 Posts
Summary: PJPEG stands for "progressive JPEG" and uses a distinct "image/jpeg" MIME type. You can specify multiple acceptable file types in CFFILE by providing a comma-delimited list of MIME types.
 
Title: The evils of Evaulate()
Date: 04/30/03      13 Posts
Summary: Evaluate() is generally used to determine the value of a dynamic variable name, so you don't need to apply it to a mathematical expression like this:

#url.StartSearch + (getTickets.RecordCount - 1)#

And although CFMX supports the direct CFOUTPUT of this type of expression, CF 5 developers will need to use the following method to output:

<CFSET num = url.StartSearch + getTickets.Recount -1> <CFOUTPUT>#num#</CFOUTPUT>

 

[Top]

Best of Talk (4/29/03)

by Dina Hess

Title: Checking if Field is Empty
Date: 04/29/03      15 Posts
Summary: Is it possible to validate form fields on a field-by-field basis rather than waiting until the form is submitted? Yes, but it isn't recommended because users find it annoying. Find several code snippets here to use as a guide and a recommendation for an open-source JavaScript API that is reported to make form validation easy.
 
Title: Searching DB Date Fields in ColdFusion
Date: 04/29/03      17 Posts
Summary: Code "datepart" options in a <SELECT> dropdown to store numeric values (i.e. 1 for JAN), even if you display a string. Use CreateODBCDate(CreateDate(FORM.year,FORM.month,FORM.day) ) to create a date for use inside a SQL statement. If you are searching the database for a date range, use the BETWEEN keyword; and if your search is filtered dynamically, add WHERE 1=1 before your conditional AND clauses.
 
Title: SQL Issue with NULL
Date: 04/29/03      31 Posts
Summary: Although you can use an IS NOT NULL clause in a CFMX Query of Queries, you will need this workaround in CF 5:

   SELECT isNull(convert(varchar, Response_DT), '')
 

[Top]

Best of Talk (4/28/03)

by Dina Hess

Title: CFLOGIN Driving Me Up the Wall...
Date: 04/28/03      7 Posts
Summary: Looking for pseodo code for a typical CFLOGIN? Find it here along with a brief overview of how CFLOGIN is implemented.
 
Title: Client Variable Wierdness
Date: 04/28/03      14 Posts
Summary: As a developer tries to discover why an application using client variables suddenly seems to have stopped setting cookies, his peers offer some suggestions, which include disabling "SetDomainCookies" in CFAPPLICATION, using a separate datasource for each logical server arrangement, and testing for the existence of "session" cookies.
 
Title: Next Dumb ?
Date: 04/28/03      10 Posts
Summary: How can you display a random record from the database? If you are using SQL Server, it's as easy as this:

   USE pubs 
   SELECT TOP 1 au_fname
   FROM authors
   ORDER BY NEWID()
Refer to the following pseudo code for the Access solution, as well as a fully working code block and a brief overview of caching included in this thread:

  • Get the Recordset
  • Get the Recordset.RecordCount
  • Get a RAND number using the Recordset.RecordCount as a ceilng
  • Select the Row using bracket notation
 
Title: Storing Images in SQL Via CF
Date: 04/28/03      20 Posts
Summary: Some say the trend now is to store binary image data in the database rather than the image filename, especially for large file systems and applications that require a highly dynamic image exchange. Doing so also creates a centralized image repository. Others don't agree, and caution that this is generally not recommended unless you need transactional control over images.
 
Title: Web Services and Complex Data
Date: 04/28/03      12 Posts
Summary: Can ColdFusion consume complex data from non-CF web services? Yes, it can. Since all SOAP web services return XML, you just need to CFINVOKE the web service in CFMX. A working code block is provided.
 

[Top]

Best of Talk (Weekend, 4/26/03 - 4/27/03)

by Dina Hess

Title: Regex gurus
Date: 04/27/03      7 Posts
Summary: Need a regular expression to remove any characters in a string that are not standard characters? Try this:

   REreplace(string, '[^a-zA-Z0-9"<>=_/\\-]', "", "all")
 
Title: Format of Date Data type
Date: 04/26/03      9 Posts
Summary: To insert a date into an ODBC database, use #CreateODBCDate(theDate)#. Note that ColdFusion offers several functions to handle data for globalization.
Related: Newbie Question 2 and 3
 
Title: Great DB Schema Resource
Date: 04/26/03      1 Posts
Summary: Searching for a good resource to guide your design of a database schema? Take a look at Database Answers to choose from a wide selection of application models.
 
Title: INSERT and Get It's ID
Date: 04/26/03      17 Posts
Summary: Need to get the ID of a record after it has been inserted into Access? Since Access does not support ISOLATION="serializable," try using a named lock inside CFTRANSACTION tags to single-thread queries that INSERT and SELECT max(id) (or @@identity). But "the most universal, resource-unintensive method is to store a UUID, then query back for the UUID to get the ID number."
 

[Top]

Best of Talk (4/25/03)

by Dina Hess

Title: Best Pratice FB3 Question
Date: 04/25/03      15 Posts
Summary: Get advice about adding "admin" functionality and security to a Fusebox 3 application. The Model-View-Controller (MVC) framework is also mentioned.
 
Title: Keeping up with CFFlush
Date: 04/25/03      8 Posts
Summary: You can use JavaScript with URL fragments to move focus to the bottom of a long page load that is displayed with CFFLUSH. Several code snippets are provided.
 
Title: mySQL Backups
Date: 04/25/03      7 Posts
Summary: How can you schedule backups of a mySQL database on a shared Windows host? The best approach would be to set up a replication slave in a different location for real-time backups. Barring that, you could try mysqldump or mysqlhotcopy and use WinCron for scheduling.
 
Title: Query Recordsets Aren't Structures?
Date: 04/25/03      31 Posts
Summary: Query recordsets are not structures. They are more like a structure of arrays. In fact, you can display recordset data without knowing the column names using syntax like this:

   <cfoutput query="q">
      <cfloop index="col" list="#q.columnList#">
         #q[col][currentRow]#
      </cfloop>
      <p>
   </cfoutput>
You can also use QueryAddRow() and QuerySetCell() to add data to an existing recordset. To transfer recordset data into a structure of arrays, try the QueryToArrayOfStructures() UDF available at cflib.org. Use ORDER BY if the order of the recordset is important. An in-depth discussion of row order is included.
 
Title: Tricky?
Date: 04/25/03      7 Posts
Summary: Looking for a query to join "employee" and "mail" tables to return all employees and a count of their unread messages? This thread provides the solution with a query that makes use of LEFT JOIN and COUNT() to return the desired recordset.
 

[Top]

Best of Talk (4/23/03)

by Dina Hess

Title: FileExists Always Returns NO
Date: 04/23/03      11 Posts
Summary: If you are using FileExists from a development box in a networked Windows environment, make sure the ColdFusion service is running under an account with permissions on the file's directory. Otherwise, even though you may be able to access the file under your account, if ColdFusion is running under the default LOCALSYSTEM account, it generally can not.
 
Title: Is everyone afraid of <CFHTTP>?
Date: 04/23/03      13 Posts
Summary: Many developers use CFHTTP only with servers they can control because of the cryptic error messages returned by CFHTTP.StatusCode, like "Location Code 26," which, by the way, means the server is busy. For clearer error messages. set THROWONERROR to "Yes" and wrap CFTRY/CFCATCH tags around the CFHTTP call. CFX_HTTP is an alternative to CFHTTP.
 
Title: Posting Raw XML w/CFMX
Date: 04/23/03      8 Posts
Summary: Use CFHTTPPARAM TYPE="xml" to post raw XML. Note that Updater 3 fixed the problem with GetHttpRequestData() for receiving raw XML.
 
Title: Why is This Query Not Working?
Date: 04/23/03      8 Posts
Summary: Concatenating two fields in a SQL statement? Remember...SQL uses "+," not "&" for concatenation.
 

[Top]

Best of Talk (4/22/03)

by Dina Hess

Title: Expiring a Session
Date: 04/22/03      12 Posts
Summary: StructClear(session) will delete all of a user's session variables whereas StructDelete(session, "keyname") will delete only one.
 
Title: Global Error handling
Date: 04/22/03      4 Posts
Summary: If you use site-wide error handling, you can email error messages by accessing the ERROR structure. For more information about error handling, visit http://cfhub.com/advanced/error_handling/.
 
Title: Matching Form Fields
Date: 04/22/03      5 Posts
Summary: How would you determine if two form fields match? Validate first on the client side by calling a JavaScript function from the FORM tag's onSubmit event. The Compare() function can then be used to validate with ColdFusion on the server side. Code snippets are included.
 
Title: RegEx for Valid Email Address
Date: 04/22/03      13 Posts
Summary: Looking for a regular expression pattern to validate an email address? You'll find several suggestions here along with a UDF resource. A regex mini-lesson is also included.
 

[Top]

Best of Talk (4/21/03)

by Dina Hess

Title: Integer Arguments Been Converted to String?
Date: 04/21/03      3 Posts
Summary: CFARGUMENT takes the data type NUMERIC for integers. If MX doesn't recognize the data type, it will process the argument as a CFC name.
 
Title: Null Null CFMX Error
Date: 04/21/03      7 Posts
Summary: If you haven't yet applied the CFMX Updater, you may be seeing error messages for issues that have already been resolved. Updater 3 should fix the "null null" error and Updater 1 fixed the "stack trace" error.
Related: CFMX Error Msg
 
Title: Running CFMX Template From Command Line?
Date: 04/21/03      3 Posts
Summary: To bypass CFSCHEDULE, try using WGET to execute a CFM template from the command line.
 
Title: Search Engine on Load Balanced Servers
Date: 04/21/03      5 Posts
Summary: Need some advice about using Verity in a load-balanced server environment? Here are a few tips to point you in the right direction.
 

[Top]

Best of Talk (Weekend, 4/19/03 - 4/20/03)

by Dina Hess

Title: CFMX Virtual Domain Wierdness
Date: 04/19/03      7 Posts
Summary: If ColdFusion MX is installed in a multi-hosting environment, edit the application server's jrun.xml file to disable the stand-alone web server and pathname caching. Instructions are included.
 
Title: Max Files and Directories in W2K
Date: 04/19/03      8 Posts
Summary: Although an image directory of 1,000+ files won't make a significant difference in file processing, there is a noticeable difference in Windows Explorer navigation speed with bulky directories. You can work around this problem by creating a group of subdirectories based on dates or primary key ranges. A UDF is included.
 
Title: MultiSelect Drama
Date: 04/19/03      8 Posts
Summary: Need to "select" dynamic options pulled from one query based on the IDs returned by another? Rather than implementing a nested query loop, try creating a list of the IDs by applying the ValueList() function. You can then use ListFind() to determine if there's a match.
 
Title: Outputting Code and Dependancies
Date: 04/19/03      3 Posts
Summary: Is there a way to list file dependencies in the order in which they are executed? If you're using MX, you can change the "Debugging Settings" in CF Administrator to use "dockable.cfm" rather than "classic.cfm," with "tree" rather than "summary" as the output mode.
 
Title: Client Variables
Date: 04/20/03      11 Posts
Summary: Need to purge client variables from your registry after moving them to a database? Change the purge interval in CF Administrator to one day. If you are using CF 5, however, you may need to manually change this value in the registry. Links to Macromedia support documents are included.
 
Title: Regex
Date: 04/20/03      15 Posts
Summary: Regex "ninjas" rush to the rescue of developers — one who needs to replace two adjacent commas in a string and another who needs to remove everything from the first "<" to "<>." Solutions include a UDF.
 

[Top]

Best of Talk (4/16/03)

by Dina Hess

Title: ASP Equiv of CFHTTP?
Date: 04/16/03      15 Posts
Summary: Looking for a CFHTTP equivalent in ASP? You can use MSXML for this. CF code samples are included.
 
Title: CFCs: Can I Return More Than One Variable?
Date: 04/16/03      3 Posts
Summary: A CFC can return only one variable. Therefore, if you want to return several values, use a complex variable like a list, array, or structure.
 
Title: I Hadnt Thought About This...CFQUERY Question...
Date: 04/16/03      6 Posts
Summary: Searching for a way to view the SQL statement for a dynamic query? Find several suggestions that tap into MX server's ServiceFactory. Code is included.
 
Title: Need Tips for Improving CF MX Server Stability (I h...
Date: 04/16/03      6 Posts
Summary: Developers using an ORACLE database will find this thread particularly helpful. It includes several performance tips. The MAXROWS, BLOCKFACTOR, and TIMEOUT attributes of CFQUERY are discussed. A SQL statement that shows how to limit the number of records returned is also included.
Related: Need Tips for Improving CF MX Server Stability (I h...
 
Title: Using a Dash in a Variable Value
Date: 04/16/03      8 Posts
Summary: If you set a value that includes a dash like this, <cfset clientName = "#companyName#-#ipAddress#">, MX will generate an error because it sees the dash as an operator. You can work around this by concatenating the strings that comprise the value, like this: <cfset clientName = companyName & "-" & ipAddress>.
 
Title: What am I Missing Here with CFSWITCH
Date: 04/16/03      6 Posts
Summary: Remember that a CFCASE value must match the expression in CFSWITCH exactly. Therefore, be sure to apply the Trim() function to remove extra spaces.
 

[Top]

Best of Talk (4/15/03)

by Dina Hess

Title: Automatic Save to Database
Date: 04/15/03      48 Posts
Summary: How can you autosave user values entered on a long form? Find several JavaScript solutions based on iframes, pop-up windows, and the onBlur and onChange events. Code snippets are included as well as a custom tag recommendation and the URL to an article explaining the basic concepts behind autosave solutions.
 
Title: Homesite v. Dreamweaver
Date: 04/15/03      19 Posts
Summary: How does Homesite compare to Dreamweaver? Dreamweaver has better PHP support, a CFC explorer with drag/drop functionality, and a convenient "design view" for HTML coding. Unfortunately, it is sluggish on older computers and some "design view" features are missing in "code view." Homesite, on the other hand, is more of a CF-Studio-like environment. It allows developers to deploy to multiple environments and provides support for drag and drop links. Note that Homesite+ comes with every license of DWMX.
 
Title: Variable Scopes in CFCs
Date: 04/15/03      10 Posts
Summary: Many developers are working around a CFC "bug" that occurs when method arguments have the same name as instance variables by creating an "instance" structure within the CFC. Non-public instance variables can then be scoped as instance.variable_name. A big advantage to this particular workaround is that you can CFDUMP your non-public instance variables. This thread also includes clarification of CFC scopes and terms.
 

[Top]

Best of Talk (4/14/03)

by Dina Hess

Title: How to Create an Appointment in Outlook...
Date: 04/14/03      3 Posts
Summary: Find information about vCalendar files and download a zip file to help you discover how to create an appointment in MS Outlook even when it's not installed on the server.
Related: How to Create an Appointment in Outlook...
 
Title: Overloading Methods
Date: 04/14/03      15 Posts
Summary: Can CFC methods with different arguments share the same name? While it may be possible to simulate overloading in CFMX, it probably isn't best. Overloading adds needless overhead. And using a distinct name for each method is clearer. There's also an interesting discussion here about the level of OO functionality implemented in CFMX.
 
Title: Query on an Array?
Date: 04/14/03      6 Posts
Summary: Need to find the number of items in an array that match a specific value? Check out ArrayFind() at www.cflib.org for the inspiration to write your own UDF.
 
Title: Quick SQL Question...
Date: 04/14/03      6 Posts
Summary: If your CFQUERY contains a SELECT statement that uses a fieldname alias, the alias won't be recognized by a subsequent WHERE clause. Use the original fieldname or expression when you reference it, like this:

   SELECT product_id, price - wsprice AS Difference
   FROM products
   WHERE (price - wsprice) <= 1
 

[Top]

Best of Talk (Weekend, 4/12/03 - 4/13/03)

by Dina Hess

Title: Help with "from" in Email Code
Date: 04/12/03      5 Posts
Summary: How would you display an alias instead of the required email address in CFMAIL's FROM attribute?

   FROM="#form.name# <#form.email#>"
Related: _help_with_"from"_in_email_code
 
Title: Carrying Form Variables
Date: 04/13/03      7 Posts
Summary: Looking for an efficient way to pass form fields from page to page?

   <cfloop collection="#form#" item="fieldname">
      <input type="hidden" name="#fieldname#"
         value="#HTMLEditFormat(FORM[fieldname])#">
   </cfloop>
 
Title: Replacing Smart Quotes in CF
Date: 04/13/03      4 Posts
Summary: Need to scrub data that has been copied from MS Word? You will find several recommendations here. Code for a UDF is included.
 

[Top]

Best of Talk (4/11/03)

by Dina Hess

Title: CFSQLTYPE
Date: 04/11/03      14 Posts
Summary: Within CFQUERYPARAM, MS Access "Yes/No" datatypes should be referenced as CFSQLType="CF_SQL_BIT."
 
Title: Dynamic Radio Button Submission
Date: 04/11/03      9 Posts
Summary: Need to update the status field of a database table based on a dynamically-created radio button selection? An efficient way to approach this problem is to set the NAME attribute of each INPUT TYPE="radio" button to the status (i.e., approved, declined, reopen) and set the VALUE attribute to the table record's identifying field. You can then loop over the "status" list on the action page to do the update.
 
Title: Mail Help
Date: 04/11/03      5 Posts
Summary: Set CFMAILPARAM's NAME attribute to "return-path" to bounce an email back to the original sender's account. Check the RFC at http://www.ietf.org/rfc/rfc2076.txt for a list of available mail parameters.
 
Title: New Line in ColdFusion Strings
Date: 04/11/03      12 Posts
Summary: To add a line break within a concatenated series of substrings, use any one of the following solutions:
  1. <br />
  2. <cfoutput>#chr(13)##chr(10)#</cfoutput>
  3. <cfset lb = chr(13) & chr(10)> <cfoutput>#lb#</cfoutput>
Note that the character representation for a new line is dependent on the operating system in use on the server:
  • Windows (\r\n): #chr(13)##chr(10)#
  • Unix (\n): #chr(10)#
  • MacOS 9 and earlier (\r): #chr(13)#
 

[Top]

Best of Talk (4/10/03)

by Dina Hess

Title: Alternative to CFSCHEDULE?
Date: 04/10/03      17 Posts
Summary: How can you execute CFM templates in MX without opening a browser window? You can try tools like wget.exe, curl.exe and CoolFusion's scheduler as alternatives to CFSCHEDULE.
 
Title: Creating Datasource
Date: 04/10/03      10 Posts
Summary: Looking for a way to set the dynamic variable name of a datasource based on a session variable? You can use concatenation in combination with the LEFT() string function, like this:

   <cfset DataSourceName="substring_1" & 
      #left(session.variablename,1)# & substring_2">
 
Title: What's the Approach for Using CFLOGIN with Cookies?
Date: 04/10/03      4 Posts
Summary: CF gurus chime in with their "best practice" approaches for using CFLOGIN with a "remember me" option.
 

[Top]

Best of Talk (4/9/03)

by Dina Hess

Title: CFScript Question
Date: 04/09/03      13 Posts
Summary: Although you can't use CFLOCK directly within a CFSCRIPT block, the CFFUNCTION tag in CFMX opens up a new range of possiblities. Locate several good resources here for learning more about CFSCRIPT.
 
Title: Payment Processing
Date: 04/09/03      15 Posts
Summary: Searching for payment processors that do not require a merchant account? Take a look at PayPal for low volume traffic and SureFire for medium to high volume traffic. Note that PayPal has an Instant Payment Notification (IPN) option...URL is included.
 
Title: Returning Primary Key Correctly?
Date: 04/09/03      11 Posts
Summary: Looking for the best way to bring back a database-generated primary key inserted into a SQL Server 2000 table? Here are a variety of suggestions to consider that make use of UUID, @@IDENTITY, SCOPE_IDENTITY, and IDENT_CURRENT.
 
Title: Using Cookies for Auto-Login
Date: 04/09/03      10 Posts
Summary: If you've considered implementing an auto-login system by storing a hashed password in a cookie..don't! There are too many security risks. Check the thread for details...
 
Title: What Do You Think About CFMX's XML Support
Date: 04/09/03      24 Posts
Summary: How can XML be used in your day-to-day development work? While XML is the obvious choice for passing data between disparate systems, it can also be used to store the configuration data you might normally put in Application.cfm and more...
 

[Top]

Best of Talk (4/8/03)

by Dina Hess

Title: CF Based Bandwidth Test
Date: 04/08/03      17 Posts
Summary: Looking for a CF-based bandwidth test like the tool CNET uses? You'll find an efficient code snippet here that will do just that.
 
Title: Kiosk & CF
Date: 04/08/03      19 Posts
Summary: Check this thread out for a few tips about how you might go about implementing a kiosk.
 
Title: QueryDeleteRow?
Date: 04/08/03      3 Posts
Summary: Need an efficient way to delete a row from an existing query recordset? Here's a UDF that will do the trick: http://www.cflib.org/udf.cfm?ID=11.
 
Title: Warning: Page Has Expired (How to Stop?)
Date: 04/08/03      5 Posts
Summary: A "page has expired" message is generated when a user hits the back button for form results. To fix this, you can manually set the cache control on your form page, like this:

   <CFHeader name="Cache-control" value="7200">
This is a known issue...the URL is provided.
 

[Top]

Best of Talk (4/7/03)

by Dina Hess

Title: (Photo) Gallery for ColdFusion?
Date: 04/07/03      14 Posts
Summary: Need a photo gallery along the lines of Gallery, a PHP open source project? JSP/Java has excellent image control resources. Beyond that, ImageMajick can be used to manipulate images on-the-fly...there's even a custom tag that automates its use. This thread also includes a discussion about resizing to thumbnails for bandwidth savings.
 
Title: Clearing Form Input Fields
Date: 04/07/03      32 Posts
Summary: Several developers team up to perfect a solution for clearing or resetting form fields when the user clicks an image. Some of the suggestions are evaluated for their usefulness in older browsers or browsers where JavaScript is not enabled.
 
Title: Import Datasources?
Date: 04/07/03      6 Posts
Summary: Need to move your datasources from one Windows box to another? Find the solution in the blog entry on March 18 at http://cfm.blogspot.com.
 

[Top]

Best of Talk (Weekend, 4/5/03 - 4/6/03)

by Dina Hess

Title: Back With More Looping
Date: 04/05/03      4 Posts
Summary: Code for a dynamic insert form that lets users add as many records as they want is tweaked to perfection. There's also some discussion about using associative array syntax for structures like FORM.
Related: Back With More Looping ~~SOLVED~~Thanks List
 
Title: Get the Size of an Image
Date: 04/05/03      11 Posts
Summary: Here's a code snippet that leverages the Java engine underpinning CFMX to find the width and height of an image. Pointers for setting up a dynamic image gallery are also included.
 
Title: Online User Tracking
Date: 04/06/03      6 Posts
Summary: This thread offers two excellent resources for an online session tracker. One is a CFDJ article available at http://www.sys-con.com/coldfusion/article.cfm?id=136 and the other is the code for a Flash version, available in the archives of Raymond Camden's blog.
 

[Top]

Best of Talk (4/4/03)

by Dina Hess

Title: Clearing All Sessions in an Application
Date: 04/04/03      10 Posts
Summary: Need to clear all sessions in an application? Try the code snippet included in this thread, which uses CreateUUID() to set an application- and session-scoped UUID. Session variables are then reset if the application-scoped UUID is different than the session-scoped UUID.
 
Title: Count(*) Query
Date: 04/04/03      10 Posts
Summary: Use the COUNT() aggregate with a GROUP BY clause to get a count of distinct items in a table column:

   SELECT number, COUNT(*) AS total
   FROM table
   GROUP BY number
   ORDER BY number
 
Title: Hiding Javascript Codes
Date: 04/04/03      15 Posts
Summary: There is really no way to hide the JavaScript code used on a website. You can prevent the code from displaying in View | Source by using the SRC attribute of the SCRIPT tag, but the code can still be found in the browser's internet cache.
 
Title: How can I "ORDER BY RANDOM" ?
Date: 04/04/03      23 Posts
Summary: How would you sort by one table column, yet return a randomized sort on another? If you are using SQL Server, here is a simple, yet effective, solution:

   SELECT col_1, col_2
   FROM table
   ORDER BY col_1, NewID()
In MS Access, you can do this:

   SELECT col_1, col_2
   FROM table
   ORDER BY col_1, rnd(primary_key)
 
Title: Time Format Question
Date: 04/04/03      12 Posts
Summary: Several developers suggest offering users select list options as opposed to letting them specify a time mask. Alternately, to strip off all characters that are not part of the allowable time mask character set, you might use a regular expression like this:

   REReplaceNoCase(str,"[^tmhs:]","","all")
 

[Top]

Best of Talk (4/3/03)

by Dina Hess

Title: <cfquery> UPDATE
Date: 04/03/03      12 Posts
Summary: Take care with the WHERE clause of an UPDATE query, which specifies the records to be changed, and remember to use CFQUERYPARAM for *all* parameters passed into CFQUERY. Note that INPUT TYPE="password" is used for password masking.
 
Title: Call Just Page Name?
Date: 04/03/03      6 Posts
Summary: The best way to reference the current template is ListLast(cgi.script_name,"/"). This method eliminates domain subdirectories.
 
Title: CFCs - Get'ers Vs. Return Object
Date: 04/03/03      33 Posts
Summary: Is it "best practice" to write multiple CFC getters (one for each variable) or write a single getter to return a query or custom object? A good way to eliminate endless database requests is to write one method that loads all of the data and another method that runs that method only if the data is not already cached. This thread also contains a grab bag of tips about everything from whether or not CFCs should be placed in a web accessible directory to the appropriate use of CFMX tools.
 
Title: Learned Something Today (Oracle)
Date: 04/03/03      14 Posts
Summary: SQL gurus hone in on a performance problem involving a primary key typed as VARCHAR but containing numeric data. If the primary key value is referenced as a number in a WHERE clause, the query takes 40 seconds to run. Yet when the value is referenced as a string, it processes in milliseconds. While the likely cause of this performance drain is an index of type VARCHAR on the primary key, ORACLE provides an excellent means for evaluating slow-running queries...the explain plan. A resource is provided.
 
Title: -OT- Javascript and Combo Boxes
Date: 04/03/03      13 Posts
Summary: Here's a JavaScript function that will change the selected option in multiple child list boxes to match the selection in the parent list box.
 
Title: thisTag.generatedContent
Date: 04/03/03      7 Posts
Summary: If you are checking thisTag.ExecutionMode to display content, be sure to do your processing in the END mode. Output the results of your processing, then CFSET thisTag.GeneratedContent to an empty string.
 

[Top]



This is an opt-in magazine. To join, leave or change subscription mode, please visit the signup page. All content of this magazine is copyright Fusion Authority, Inc. It may not be reproduced without permission.