Archive for August, 2003

Tags vs. CFScript

Now that you can write functions in both tag form and as CFScript, which way are people leaning and why? I like that tags allow a level of validation in terms of data types and requirements, however I must admit that I prefer the more streamlined syntax of CFScript. What are your thoughts? Should the same advantages that one gets from writing UDFs as tags be added to CFScript? Should CFScript become ECMAScript? Server-side ActionScript? Java? What?

Macromedia Releases ColdFusion MX 6.1 Performance Briefs

Check out the new performance briefs Macromedia recently released comparing CFMX 6.1 to previous versions of ColdFusion on various platforms. Some quick numbers:

  • Windows 2000: Approximately 23 times faster than ColdFusion 4.5, 3 times faster than ColdFusion 5, and 2.5 times faster than ColdFusion MX
  • Windows 2003: Approximately 3 times faster than ColdFusion 5
  • Linux: Approximately 5 times faster than ColdFusion 5
  • Solaris: Approximately 4 times faster than ColdFusion 5
  • Dynamic email delivery capability increased as much as 50 times more than CF 5.

Using CFHTTP to Build a Query

Sorry I have been lazy about posts recently. I’ve been in Boston, meeting with various product teams. All I can say is that there is some cool stuff on the horizon.

Anyway, did you know that CFHTTP can automatically turn a comma-delimited file into a query object for you? Let’s say you have a file called data.txt that looks like this:

firstName, lastName, emailAddress
Christian, Cantrell,
Mike, Chambers,
Baby, Blue,

The following use of CFHTTP will parse the data above into a query stored in the variable “myQuery”:

<cfhttp method="GET" url="http://localhost/tests/cfhttp/data.txt" name="myQuery">

You can use the columns attribute of the CFHTTP tag to specify a different set of column headers, and you can use the firstrowasheaders attribute to include the first row as data rather than column headers. And, of course, your comma-delimited file doesn’t have to be static; the delimited values can be dynamically generated by any means.

Getting Macromedia Jimg to Work on Linux

Jimg is both a tag and component interface included on DRK 4 for manipulating all kinds of images in ColdFusion MX. From Macromedia’s website:

“Jimg is a custom tag and component wrapper for JAI (Java Advanced Imaging) which allows ColdFusion developers to manipulate images in a variety of ways. Jimg supports 10 different image operations, including scaling, cropping, rotating, tinting, drawing, filling, repeating, adding borders, and overlaying text.”

A couple of people have had problems getting Jimg to work on Linux because of well know issues with Java and the Linux graphics environment. If you are trying to get Jimg to work on Linux with JDK 1.4.1 (which is what CFMX 6.1, or Red Sky, comes with), you will find this TechNote invaluable.

Improved Email Functionality in CFMX 6.1

In case you haven’t heard, one of the coolest new features of Macromedia ColdFusion MX 6.1 is the new email functionality. First and foremost, performance has been greatly improved through the use of multithreading and connection pooling. Using multiple threads to send email means that ColdFusion can send multiple messages simultaneously rather than one at a time, and connection pooling means that ColdFusion will reuse connections between it and the mail server rather than making new connections each time it wants to send an email. Creating connections is a relatively time consuming process, so the more you can reuse existing connections, the more efficient the server is being. These two improvements mean that ColdFusion MX 6.1 is capable of sending more than 1,000,000 emails an hour!

I don’t need to send 1,000,000 emails an hour, so although I’m glad I have that capability should I ever need it, I’m actually more excited about support for multipart mail messages and the new CFMAILPART tag. There are typically two types of email that people send: text and HTML. If you don’t know what kind of email client your recipients are using, or whether they prefer text or HTML email, it used to be that you pretty much had to stick with text emails just to be on the safe side. That meant that even though most people use email clients which are fine with HTML email, and although ColdFusion supported the sending of HTML email, you would generally have to cater to the lowest common denominator and send everyone text email. Now, thanks to the CFMAILPART tag, you don’t have to compromise anymore. When you send a multipart email message, you are actually sending both a text and an HTML version which means it is up to the email client to determine which part of the email message to display to the user. That means you can send one email out to your whole user base, and make sure everyone gets the best experience their email client is configured to deliver.

So now that CFMX 6.1 can send multipart email messages, what about being able to parse multipart email messages, as well? CFPOP now supports the ability to separately retrieve either the HTML or the text portions of a multipart email message through the new textBody and htmlBody properties. The body property is still there, so existing code won’t break, but now you clearly have more options.

Another important addition to the CFMAIL tag is the ability to specify a username and password for authenticating against password protected mail servers. More and more SMTP servers are being secured in order to prevent unauthorized relaying of email messages by spammers. Now, ColdFusion gives you a way to interact with secured mail servers.

To learn more about the improved email functionality of CFMX 6.1, check out Ben Forta’s new Breeze Presentation. To learn more about ColdFusion MX 6.1 in general, check out the CFMX 6.1 release notes.

Another Way to Continue in ColdFusion

Last Friday, I made a post about ColdFusion lacking a CFCONTINUE tag and showed a couple of ways to get around it. Thanks to erki for pointing out yet another method:

<cfloop from="1" to="10" index="i">
<cfif i eq 5>
<cfthrow type="continue">
This number will never be 5: #i#<br>
<cfcatch type="continue"><!--- ignore ---></cfcatch>

Installing ColdFusion MX 6.1 on OS X

I have seen a few people experience difficulties installing ColdFusion MX 6.1 on OS X. Not to worry — it works fine. You just have to make a few adjustments.

The problem people seem to be running into is with the graphical installer. There seems to be an issue with the graphical installer and Sun’s 1.4.1 JVM for OS X. There are two ways to fix this:

  1. Run the installer in console mode like this:

    % java -jar ./coldfusion-61-other.jar -i console

    (Don’t actually type the “%” — that is meant to represent your command prompt.)

    This is not as scary as it might sound. The console installer is just as user friendly as the graphical version, except for the fact that you have to type paths in rather than navigate to them.

  2. Run the graphical installer with Java 1.3.1 rather than 1.4.1. This is perfectly safe and doable on most configurations since the OS X software updater does not remove the old version of Java when installing the new version (rather, it installs the new JVM right along side the old one and simply changes some symbolic links).

    Here is the command for running the graphical installer with Java 1.3.1:

    /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Home/bin/java -jar ./coldfusion-61-other.jar -i gui

    The command above may have broken onto two lines in your browser — make sure you run it as a single line.

Red Sky is Live!

The wait is over, and all information is now public. Macromedia released Red Sky, or Macromedia ColdFusion MX 6.1, early this morning. ColdFusion MX 6.1 is a free upgrade for existing ColdFusion MX customers and delivers significant performance enhancements, improved stability, and some extremely cool new features. Check out the ColdFusion MX 6.1 Product Page, the CFMX 6.1 FAQ, and the all-important CFMX 6.1 Release Notes to find out more.

Here are a few of my favorite things about ColdFusion MX 6.1:

Continue reading…

Living Without “continue” in ColdFusion

A decided to try to implement a custom ColdFusion loop tag that would support a custom CFCONTINUE tag. To continue within a loop is similar to breaking (which you can do with CFBREAK) except rather than breaking out of the loop, execution starts again from the top of the loop on the next iteration. Unfortunately, there is no CFCONTINUE tag, so this is something you cannot do in ColdFusion. The following illustrates the use of “continue” in Java:

Continue reading…

Untangling RSS in Both Java and ColdFusion

Anyone who has dealt with RSS extensively knows that programatically accounting for all four different versions at the same time can be a little tricky. If you are dealing with a known version of RSS, there is generally no problem, as any one particular version is easy enough to parse. What is far more challenging, however, is being able to reliably parse any arbitrary RSS feed from any arbitrary source. The first problem you run into is the fact that the four versions of RSS which are actively in use (.91, .92, 1.0 and 2.0) are all somewhat different, and in some cases, considerably different. The second problem is that RSS supports several optional tags, so it’s difficult consistently rely on specific pieces of data. Problem number three is the fact that RSS has been extended to include modules, like Dublin Core. And finally, RSS is generated in so many different ways by so many different people and pieces of software that many feeds are just plain broken.

So what is an RSS aggregator to do?

RSS Untangle, or RSSU, address these problems by encapsulating the complexity of parsing and making sense of all versions of RSS. From the DRK 4 product page on Macromedia’s site:

RSS Untangle is a Java library that encapsulates the process of parsing RSS XML feeds. RSSU takes any version of RSS (0.91, 0.92, 1.0, or 2.0) and parses it into a straightforward, intuitive Java object model. Integrate RSSU into your ColdFusion applications through its custom tag interface or use it directly in your Java applications.

RSSU is implemented entirely in Java, but it comes with both a ColdFusion custom tag interface, and a ColdFusion component interface which makes working with RSS as easy as this:

Continue reading…