Archive for February, 2003

Couple of Useful Custom Tags

It was pointed out the other day on a list that cfinclude doesn’t let you include JSP pages and that there is no cfforward tag to forward a request on to another resource (CFM, JSP, servlet, etc.). BlueDragon apparently does have this functionality. Well, now ColdFusion does, too, with the extremely simple tags below. And ColdFusion also has getPageContext(), as well.

<!---
The includeanything tag will include any type of page, not just a
CFM template.

@attribute page (required) Relative path to the template you want
to include.
--->
<cfif thisTag.executionMode is "start">
<cfparam name="attributes.page" />
<cfscript>
getPageContext().include(attributes.page);
</cfscript>
</cfif>

<!---
The forward tag will perform a server-side redirect.

@attribute page (required) Relative path to the template you want
to forward to.
--->
<cfif thisTag.executionMode is "start">
<cfparam name="attributes.page" />
<cfscript>
getPageContext().forward(attributes.page);
</cfscript>
</cfif>

Macromedia Public Bugbase?

Macromedia has been contemplating the idea of a public bugbase for its products. I have two questions:

  1. Is this something the ColdFusion development community would consider useful? If so, why?
  2. Does anyone know of any other companies who have public bugbases for their products (not open source projects)? If you have used them, how useful did you find them to be?

cfform Work-around

There was some discussion on cf-talk today about getting cfform to work with CFMX for J2EE. The problem is that the cfform.js file does not get loaded properly. The work-around is to do one of the following three things:

  1. Copy the cfform.js file out of the CFIDE/scripts directory into some directory in your webroot and use the scriptSrc attribute of the cfform tag to reference it.
  2. Create a symbolic link in your webroot that points to to the cfform.js file in the CFIDE/scripts directory (Unix only) and reference it using the scriptSrc attribute of the cfform tag.
  3. Create a mapping in the administrator to the cfform file.

Tons of New DevNet Content

Macromedia released about 20 new DevNet articles yesterday. They don’t cover ColdFusion, but they are relevant to web development in general.

Setting Up Your PHP Server Environment Using Linux, Apache, MySQL, and PHP
David Sklar
http://www.macromedia.com/desdev/mx/dreamweaver/articles/lamp.html

Setting Up PHP for Microsoft IIS Web Server
Andrew Stopford
http://www.macromedia.com/desdev/mx/dreamweaver/articles/php_iis.html

Setting Up PHP, MySQL, and Apache on Mac OS X for Dreamweaver MX
Minh Huynh
http://www.macromedia.com/desdev/mx/dreamweaver/articles/php_macintosh.html

PHP Server-Side Graphics with Dreamweaver MX
Gareth Downes-Powell, Tim Green, Allan Kent, Bruno Mairlot, George McLachlan, Dan Radigan, Glasshaus
http://www.macromedia.com/desdev/mx/dreamweaver/articles/php_hand_coding.html

Many to Many Insert Form with ImpAKT2
Interakt
http://www.macromedia.com/desdev/mx/dreamweaver/articles/interakt/impakt2.pdf

Building a Dynamic Website with Dreamweaver MX and PHAkt
Interakt
http://www.macromedia.com/desdev/mx/dreamweaver/articles/interakt/phakt.pdf

Introduction to ASP.NET Web Form Controls
Ryan Parnell, Joel Martinez, Macromedia Press
http://www.macromedia.com/desdev/mx/dreamweaver/articles/dotnet_webform.html

Effectively Using Web Form Controls
Ryan Parnell, Joel Martinez, Macromedia Press
http://www.macromedia.com/desdev/mx/dreamweaver/articles/dotnet_webform2.html

Creating an ASP.NET User Control
Jonathan Quint, Macromedia Instructor-Led Training
http://www.macromedia.com/desdev/mx/dreamweaver/articles/dotnet_usercontrol.html

Graphing with .NET and the Dreamweaver MX Data Layer
Joel Martinez
http://www.macromedia.com/desdev/mx/dreamweaver/articles/graphing_aspnet.html

Implementing Forms-Based Authentication
Heidi Bautista
http://www.macromedia.com/desdev/mx/dreamweaver/articles/forms_authentication.html

Clydes Online-Macromedia Flash and E-Commerce
Ryan Thomas, Shea Gonyo
http://www.macromedia.com/desdev/mx/flash/articles/clydes_online.html

LOGGED IN: Dreamweaver MX: Supporting the PHP and ASP.NET platforms
George Fox
http://www.macromedia.com/desdev/logged_in/gfox_php_dotnet.html

JD’s Forum: “My Way, or the Highway!!” Technological Tolerance and Rigid Belief Systems
John Dowdell
http://www.macromedia.com/desdev/jd_forum/jd025.html

Controlling Button States: Template Parameters and Expressions
Murray Summers, Brad Halstead
http://www.macromedia.com/desdev/mx/dreamweaver/articles/button_states.html

Using Parameters and Expressions to Make a Breadcrumb Trail
Murray Summers, Brad Halstead
http://www.macromedia.com/desdev/mx/dreamweaver/articles/crumb_trail.html

Embedding Macromedia Flash While Supporting Standards
Drew McLellan
http://www.macromedia.com/desdev/mx/dreamweaver/articles/flash_satay.html

Winter Olympics: Multimedia Created in Director
Dean Utian
http://www.macromedia.com/desdev/mx/director/articles/olympics.html

Take Control of Connections
Kristopher Schultz
http://www.macromedia.com/desdev/mx/flashcom/articles/connections.html

DevNet Professional EULA Summary

I saw some questions on a mailing list about the DevNet Professional End User License Agreement (EULA). I finally got a chance to discuss it in detail with the right people at Macromedia, and basically what it comes down to is that the servers included with DevNet Professional are only meant for you to experiment and develop with. The term “testing” in the EULA is meant to describe the kind of testing that naturally occurs during development. You can let your QA team test software against your development environment and you can demo your software to clients on your development environment, but you can’t install the server software on additional machines specifically for QA testing, load testing, or software demos. If you want to have a separate set of servers for QA testing, load testing or software demos, you have to purchase additional licenses. Anyone who uses the servers in a development capacity (in other words, anyone who directly accesses source code) must be a DevNet Professional subscriber.

You can find more information about DevNet licensing here:
http://www.macromedia.com/desdev/subscriptions/licensing.html

You can find the entire DevNet EULA here:
http://www.macromedia.com/desdev/subscriptions/resources/eula.html

Three New TechNotes

Macromedia releases 3 new Tech Notes on ColdFusion MX:

ColdFusion MX fails to start with a HotSpot Virtual Machine error:
http://www.macromedia.com/v1/Handlers/index.cfm?ID=23805&Method=Full

ColdFusion MX: Configuring the Default-error and Default-out log files:
http://www.macromedia.com/v1/Handlers/index.cfm?ID=23809&Method=Full

Installation wizard does not give option to configure available web servers:
http://www.macromedia.com/v1/Handlers/index.cfm?ID=23815&Method=Full

Don’t Forget About “contains”

I have seen several people use functions like find, findNoCase and findOneOf to search strings for substrings. Don’t forget about the “contains” comparison operator. It lets you do things like this:

<cfif string1 contains string2>
It's in there.
</cfif>

… as opposed to …

<cfif findNoCase(string1, string2) neq 0>
It's in there.
</cfif>

Keep in mind that “contains” does not compare case.

Big Blogging News

I guess everyone knows about Google buying Pyra Labs by now. If not, you can read about it here:
http://weblog.siliconvalley.com/column/dangillmor/archives/000802.shtml

Now Microsoft is getting in on the action, as well. Read about their new product here:
http://www.microsoft-watch.com/article2/0,4248,894255,00.asp

Not to be left behind, AOL is talking about blogging, as well:
http://www.goodexperience.com/columns/02/1211.aol.html

Why Use cftry and cfcatch?

Someone on a mailing list asked today for an explanation of cftry and cfcatch, and examples of when to use them. Although I don’t think it ever made it to the list (the server seems to be down), this was my response:

I have found the try/catch framework to be most useful in two circumstances:

  1. When your code could encounter an error that you either expect or can recover from, you can trap and handle it with cftry and cfcatch. For instance, I wrote some code recently that checks if a specific file exists on the file system. If it does, the file gets included, but if it doesn’t exist, I just include another file that I know will exist. I put a cftry and cfcatch around the include code to accomplish this.
  2. If you want to add more information to an error. At any particular point in your code, you usually know more about the code than the CF server would if it were to throw an error at that particular point. Usually, that’s fine because the chance of an error being thrown is very small, or the additional information you have would not necessarily be useful in fixing the error, however sometimes you might want to include this additional information in the even of an error. For instance, if you are trying to include a page with a URL from a database, rather than just hoping that the page exists or letting ColdFusion formulate an error message if it is not there, you might wrap your cfinclude in a try/catch block, then re-throw the error (assuming you have no way to recover from it) with an additional message explaining that the URL that was retrieved from the database (might even include database information like the data source and the query) is out of synch with the file system.

(OT) Footage of Extreme Weather on Presidents’ Day

These are some pictures I took around my neighborhood today. We got about 30 to 32 inches of snow here which kept me pretty busy Sunday and Monday. We shoveled until we ran out places to put the snow. My street has still not been plowed, so nobody is going anywhere for a while.