Obtaining updates for CF and CF Studio 4 and 5 releases
If you find yourself needing to reinstall your CF 4,4.5+, or 5 or Studio 4.5+ software, you may find that your install from the base CDs leaves you needing any of several updates or patches. You may have to struggle to find things, such as Studio 4.5.2 to update your Studio 4.5 install (for those still sticking it out at that release), or some Studio hotfixes, or the tag updater for making CF5 tags and help available in a 4.5+ copy of Studio.
See the page http://www.macromedia.com/support/coldfusion/downloads_updates.html.
It also lists all the CF server service packs, updates, and hot fixes for both for 4.0.1 and 4.5.1, as well as links to some security patches.
And if you're looking for an updater that provides a way to add CFMX support to Studio 4.5, 5 for the tag insight, tag edit, tag help, tag completion, and related features, see http://www.macromedia.com/software/coldfusionstudio/productinfo/resources/tag_updaters/.
Thursday, August 01, 2002
Zip Code database
Folks, if you've wanted to perform zip code based calculations (find zips within a given distance from a zip code), there's a free database (well, a txt file) with that info being offered at http://www.cfdynamics.com/zipbase/. The site offers it free and looks forward to updates from users (and a note of how you're using it).
There's no code offered there showing how to use it in any particular way. There are some CF custom tags that perform distance processing with the latitude and longitude values (also there), though none are offered on that site. See below for the details.
Still other possibilities include using the zipcode to perform lookups in data entry applications to avoid the user having to enter their city and state (be careful not to rely on this data but instead simply use it as a tool to aid data entry). I can't get into the details here, but one way it to use javascript and hidden frames, a technique that has been discussed in various CFDJ article and other resources.
Also, since it's a .txt file, you either need to import that into a DBMS or leverage any of the choices available for processing text files.
Following is some code that will at least allow you to process the file as a text file, should you want to do so, using the new CF5 Merant text drivers. Note that the first line sets the file and path name for the zip_codes.txt file that you'd download at the above site.
<cfset zipcode_filepath = "E:\INETPUB\WWWROOT\cfdemo\ZIP_CODES.txt">
<cfquery name="get" dbtype="dynamic"
connectstring="Driver={MERANT 3.70 ColdFusion OEM 32-BIT TextFile (*.*)};TableType=comma;FirstLineNames=0;IntlSort=1;ApplicationUsingThreads=1;UndefinedTable=guess" cachedwithin="#createtimespan(1,0,0,1)#">
select
field_1 as ZIP,
field_2 as LATITUDE,
field_3 as LONGITUDE,
field_4 as CITY,
field_5 as STATE,
field_6 as COUNTY,
field_7 as ZIP_CLASS
from #zipcode_filepath#
</cfquery>
<cfoutput query="get" maxrows="5">
#zip# - #city# (#county#), #state# ( #latitude#, #longitude#) [#zip_class#]<br>
</cfoutput>
Notes:
- I'm using the MAXROWS attribute of the CFOUTPUT to limit how many records are displayed in the loop
- I'm using the "connectstring" approach for referring to a datasource, which means I don't need to create a DSN in the administrator.
- Since this file has no column names listed in the first line of the file, the Merant driver finds them and by default names then field_1 thru field_x. I've renamed them with an alias in the SELECT to make them more useful later in the code.
- I've used the CachedWithin attribute on the CFQUERY, since the file would not change often. Be aware that this file is 3mb, so loading the entire thing into memory may have some performance impact (likely modest in most systems).
- Finally, this Merant text driver may or may not work in CFMX. My CFMX system is unavailable at the moment so I can't test this right now myself.
Again, rather than process it as a text file, if you're going to search it often, you may as well import it into a database and leverage the indexing possible there.
If I do create or find some code to extend the process of working with these zips, latitudes, longitudes, etc, I'll share it.
For those motivated to get a head start, the GreatCircle and FreeZip custom tags at the MM Dev Exchange look promising. The former does calculations of miles between given lat/lon pairs (though I'm having some trouble with it) and the latter is tied to its own included 1990 census zip code DB. The logic in it could be pulled out to work with this zipcode file.
Folks, if you've wanted to perform zip code based calculations (find zips within a given distance from a zip code), there's a free database (well, a txt file) with that info being offered at http://www.cfdynamics.com/zipbase/. The site offers it free and looks forward to updates from users (and a note of how you're using it).
There's no code offered there showing how to use it in any particular way. There are some CF custom tags that perform distance processing with the latitude and longitude values (also there), though none are offered on that site. See below for the details.
Still other possibilities include using the zipcode to perform lookups in data entry applications to avoid the user having to enter their city and state (be careful not to rely on this data but instead simply use it as a tool to aid data entry). I can't get into the details here, but one way it to use javascript and hidden frames, a technique that has been discussed in various CFDJ article and other resources.
Also, since it's a .txt file, you either need to import that into a DBMS or leverage any of the choices available for processing text files.
Following is some code that will at least allow you to process the file as a text file, should you want to do so, using the new CF5 Merant text drivers. Note that the first line sets the file and path name for the zip_codes.txt file that you'd download at the above site.
<cfset zipcode_filepath = "E:\INETPUB\WWWROOT\cfdemo\ZIP_CODES.txt">
<cfquery name="get" dbtype="dynamic"
connectstring="Driver={MERANT 3.70 ColdFusion OEM 32-BIT TextFile (*.*)};TableType=comma;FirstLineNames=0;IntlSort=1;ApplicationUsingThreads=1;UndefinedTable=guess" cachedwithin="#createtimespan(1,0,0,1)#">
select
field_1 as ZIP,
field_2 as LATITUDE,
field_3 as LONGITUDE,
field_4 as CITY,
field_5 as STATE,
field_6 as COUNTY,
field_7 as ZIP_CLASS
from #zipcode_filepath#
</cfquery>
<cfoutput query="get" maxrows="5">
#zip# - #city# (#county#), #state# ( #latitude#, #longitude#) [#zip_class#]<br>
</cfoutput>
Notes:
- I'm using the MAXROWS attribute of the CFOUTPUT to limit how many records are displayed in the loop
- I'm using the "connectstring" approach for referring to a datasource, which means I don't need to create a DSN in the administrator.
- Since this file has no column names listed in the first line of the file, the Merant driver finds them and by default names then field_1 thru field_x. I've renamed them with an alias in the SELECT to make them more useful later in the code.
- I've used the CachedWithin attribute on the CFQUERY, since the file would not change often. Be aware that this file is 3mb, so loading the entire thing into memory may have some performance impact (likely modest in most systems).
- Finally, this Merant text driver may or may not work in CFMX. My CFMX system is unavailable at the moment so I can't test this right now myself.
Again, rather than process it as a text file, if you're going to search it often, you may as well import it into a database and leverage the indexing possible there.
If I do create or find some code to extend the process of working with these zips, latitudes, longitudes, etc, I'll share it.
For those motivated to get a head start, the GreatCircle and FreeZip custom tags at the MM Dev Exchange look promising. The former does calculations of miles between given lat/lon pairs (though I'm having some trouble with it) and the latter is tied to its own included 1990 census zip code DB. The logic in it could be pulled out to work with this zipcode file.
Validating Form Input With Regular Expressions
OK, so this one's not new to CFMX, but it's a CF5 feature that many missed.
If you've ever wanted to validate form input such as email addresses and phone numbers, but have found the built-in validations of CFFORM to be lacking, note that CF5 has added new functionality to perform regular expression validation within CFINPUT. All you need is the right expression. If you're not familiar with them, no worries. Here's how to validate both a phone number and email address. The key is the new VALIDATE="regular_expression" and associated PATTERN attributes.
<CFFORM ACTION="">
Phone: <CFINPUT TYPE="Text" NAME="phone" VALIDATE="regular_expression" PATTERN="^(\(?\d{3}\)?)?\s?\d{3}[\s\-]?\d{4}$" MESSAGE="Phone is improperly formatted">
Email: <cfinput type="text" name="email" message="Email address is impoperly formatted." validate="regular_expression" pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$">
<INPUT TYPE="Submit">
</CFFORM>
You can actually run that example, leaving the ACTION="". It will just try to submit to itself. If you give it a valid email and phone, it will submit. If you don't, it won't and will offer an error mesage. Of course, you can change the MESSAGE to suit your taste and would want to change the ACTION and NAME values to those appropriate to your application.
For more information, see my article in the Dec 2001 CDFJ, "Validating Input with Regular Expressions: Little Known Features of CF 5 ". You can read all 30+ of my CFDJ articles online from the "articles" link on my site, www.systemanage.com. Note, however, that the expressions offered above differ slightly from those offered in the article. I have offered these corrected versions in the "comments" area at the front page of the online article.
OK, so this one's not new to CFMX, but it's a CF5 feature that many missed.
If you've ever wanted to validate form input such as email addresses and phone numbers, but have found the built-in validations of CFFORM to be lacking, note that CF5 has added new functionality to perform regular expression validation within CFINPUT. All you need is the right expression. If you're not familiar with them, no worries. Here's how to validate both a phone number and email address. The key is the new VALIDATE="regular_expression" and associated PATTERN attributes.
<CFFORM ACTION="">
Phone: <CFINPUT TYPE="Text" NAME="phone" VALIDATE="regular_expression" PATTERN="^(\(?\d{3}\)?)?\s?\d{3}[\s\-]?\d{4}$" MESSAGE="Phone is improperly formatted">
Email: <cfinput type="text" name="email" message="Email address is impoperly formatted." validate="regular_expression" pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$">
<INPUT TYPE="Submit">
</CFFORM>
You can actually run that example, leaving the ACTION="". It will just try to submit to itself. If you give it a valid email and phone, it will submit. If you don't, it won't and will offer an error mesage. Of course, you can change the MESSAGE to suit your taste and would want to change the ACTION and NAME values to those appropriate to your application.
For more information, see my article in the Dec 2001 CDFJ, "Validating Input with Regular Expressions: Little Known Features of CF 5 ". You can read all 30+ of my CFDJ articles online from the "articles" link on my site, www.systemanage.com. Note, however, that the expressions offered above differ slightly from those offered in the article. I have offered these corrected versions in the "comments" area at the front page of the online article.
Friday, July 05, 2002
Update to CFMX Release Notes
There has been a recent posting of an updated set of release notes for CFMX. Sadly, the document shows no date of update, and you may miss how to identify what's changed. There is a "late breaking news" section which indicates how the release notes differ from the one installed with CFMX, but in the middle of the document. It's also a cumulative list, so there are updates listed there as "new" which were in the last update to the release notes. Still, there are just a few listed so you can simply review all the sections it points to.
There has been a recent posting of an updated set of release notes for CFMX. Sadly, the document shows no date of update, and you may miss how to identify what's changed. There is a "late breaking news" section which indicates how the release notes differ from the one installed with CFMX, but in the middle of the document. It's also a cumulative list, so there are updates listed there as "new" which were in the last update to the release notes. Still, there are just a few listed so you can simply review all the sections it points to.
Subscribe to:
Posts (Atom)
