Welcome!

ColdFusion Authors: Maureen O'Gara, Hovhannes Avoyan, Yakov Fain, Pat Romanski, Liz McMillan

Related Topics: ColdFusion

ColdFusion: Article

cfx_kmSuite From Hopkins Technology, LLC

cfx_kmSuite From Hopkins Technology, LLC

Being thrifty, I like to do my own basic car repairs. However, on some of my shade-tree repair jobs, I've run into the problem of not having a specific, but necessary, tool.

I often find myself in the same predicament developing applications for my clients' Web sites. I'm cruising along, happily coding away, when out of the blue I suddenly need to do something I've never had to do before.

ColdFusion, of course, makes it easy when you run into a problem. You just write a custom tag to do the job, throwing in Java or anything else that catches your fancy, and continue on with life. Sometimes, though, deadlines loom and budgets are tight. That's when you find yourself haunting the CF Tag Gallery or Java sites, trying to find that quick-and-dirty (and most especially, free) function to get you back on track. It would save a lot of time if some common functions were collected and ready to go, right?

The cfx_kmSuite from Hopkins Technology, LLC, has a number of useful functions, rolled together into a few CFX tags. If you're self-hosted, colocated, or at least on a dedicated server, you may want to consider this suite. Those of you who (like me) are hosted at national providers may not see this suite, since it includes some potentially hazardous system-access functions.

I suppose to call the cfx_kmSuite tags is too simple. It's more like a collection of modules, grouped by function (system, math, string, etc.). Each module will accept parameters to determine the function you'd like to perform.

How to Call Functions
When I first viewed the online documentation, for a moment I didn't comprehend that I was looking at a collection of modules covering 12 subject areas: Calendar, Convert, Format, Graphic, HTML, List, Math, Misc, Query, Security, String, and System.

Take, for example, Convert. These functions convert from English to metric and back. Now I suppose you could write a chunk of code that converts miles to kilometers:

<cfset miles = 2>
<cfset kilometers = evaluate( miles * 1.61)>
In cfx_kmSuite, the cfx_kmConvert tag lets you do this, as well as mass, volume, area, and temperature conversions. In the suite, the function could be called as:
<cfx_kmConvert V=kilometers F=Length VALUE=2 FROM=mi TO=km FORMAT="%.2f km">

Result: 3.22 km

In the example above, we're doing the following:
  1. Using the Convert module
  2. Setting the output variable (kilometers)
  3. Specifying the conversion function to be performed (length)
  4. Setting the value to be converted (2)
  5. Specifying that the conversion be from miles to kilometers
  6. Specifying the format of the output: (%) = the result, (.2f) = 2 fixed decimal places, (km) = text label for the formatted output. This frees you from the Number-Format() function.
This Convert example is typical of the functions in the suite, depending on the complexity of the task. It frees you from constantly writing those same little (and a few not-so-little) chunks of code to handle the job. It may even include some you've always wanted.

For instance it may be just as easy to haunt the Tag Gallery for a tag that validates a 16-digit credit-card number. If that's all you're looking for, then this suite is not for you. For serious developers, the suite expands on a few existing CF tags. cfx_kmList, for instance, duplicates the list functions that already exist. Included, however, is the ListBestMatch function, which uses a similarity algorithm to find an item most like a supplied value. Or consider the ListIntersection function, which compares two lists and returns a third showing items found in both (perhaps finding which items in your online store were most popular this month).

A Really Neat "Almost" Mini-App
I was doing a Web site for a local art gallery some time ago. They requested a calendar of events, and asked that it be made available ASAP. If cfx_kmSuite had been available, it might have saved some headache.

Included with the suite is an innocuous-sounding function called BasicMonth. When I first saw it in the documentation, I thought it was fairly cool: give it a date, and it creates an HTML table for that month. What was even cooler was that you could specify an HREF for each day, thus creating a link to another page (presumably to display an event for that day). Here, half-built and just waiting for a database table and a little code, was a compact events calendar that could be easily inserted into an existing site design or application.

Conclusion
Since these tools are in compiled DLLs, you'll need to have access to your server. As I mentioned at the outset, the suite includes system-access functions that may make some hosts a little leery. Check with your provider and see if they would install this suite.

If you have your own server, rejoice! The tools you need to finish (or perhaps start) the job are close at hand!

VITALS
cfx_kmSuite
Hopkins Technology, LLC

Address: 421 Hazel Lane
Hopkins, MN 55343-7116

Web: www.hoptechno.com/kmtools/

E-mail: kmtools@hoptechno.com

Test Environment:
Windows 98 with Personal Web Server and CF4.5

Pricing: A perpetual license is available for purchase at $250 for one server ($49 each additional at a single physical site) including e-mail and Web support. Once payment clears, we will send download URL and Key.

More Stories By Carey Lilly

Carey Lilly is an associate with a Web site– development firm based in the New York area. He has been developing with ColdFusion since 1997 and has 10 years’ experience with relational databases.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.