coldfusion

Migrating coldfusion: data sources

I didn't find a whole lot on the web about this, aside from http://www.petefreitag.com/item/68.cfm. When migrating ColdFusion MX 7, it is good to know that the settings, including data sources, are stored in *cf_root*\lib in neo-*x*.xml files.

For example, all of the data sources can be found in neo-query.xml. If you're migrating a server to the same version of ColdFusion, I don't see why this wouldn't work. You should be able to save the old file(s) on the new installation and drop the new file in there. I would shut the service off and start again when finished.

Topics: 

Timezones and Coldfusion / JRE Time

I get into work today and have a help desk ticket stating that the time on our servers is off. Well, not quite.

The issue is the time in ColdFusion does not match the time the servers have. We "sprang forward" on Sunday, March 9th, but any time functions reported the time one hour behind. ColdFusion, it seems, forgot to spring.

Topics: 

Detecting Javascript In Coldfusion And Other Languages

I had been struggling for a while trying to find a way to detect JavaScript capability in my applications, then adjusting the application accordingly. My employer requires accessibility to all websites and web applications with JavaScript disabled. This can be done using the noscript tags with a meta refresh, but this is very, very bad form.

Using ColdFusion, I was able to solve this problem. I believe this can be done in any language which allows the setting and manipulation of cookies. Here is the code:

<cfset jscript = 0>

Dynamic Picture Generation Using ColdFusion

I had an unusual problem to solve today. One of my applications generates signed documents using Microsoft Word. The user clicks a button and is prompted to open or save the word document. The signatures are important ones, and stored outside the webroot.

I solved this by referencing a coldfusion file in the src attribute of the image tag in the html that outputs the document. The file is called dynpic.cfm. So the image tag looks like this:


<img src="https://someserver.someschool.edu/production/someapp/dynpic.cfm?pic=chair" />

Detecting A Secure Server Using ColdFusion

I needed a quick tag to detect if the page the tag resided in was called using a secure URL. Unfortunately, the CGI function was not easily found, so here it is.

<cfif CGI.HTTPS EQ "off">

<cfset NewLink = "https://" & #CGI.HTTP_HOST# & #CGI.PATH_INFO#>

<cfif #CGI.QUERY_STRING# NEQ "">
<cfset NewLink = NewLink & "?" & #CGI.QUERY_STRING#>
</cfif>

</cfif>

Some IP Parsing Fun Using ColdFusion

I know some of you have been dying for code (yeah, right) so here's a small function I made for parsing an IP address. I needed the last byte to determine if the machine calling the page was a developer's machine or not.

<cfoutput>
<cfset BegPos = 1>
<cfset EndPos = 1>
<cfset ip = #CGI.REMOTE_ADDR#>
<cfset ByteArray = ArrayNew(1)>

<cfloop index="i" from="1" to="4">
<cfset EndPos = #FIND(".", ip, BegPos)#>
<cfif EndPos GT 0>
<cfset ByteArray[i] =