Archive for the ‘ColdFusion’ Category

I was trying to execute a .cfm page on a new CentOS 5.2 server and I received this error. Not all requests were erroring out, the CF Administrator was working fine as were other simple pages. But when I tried to load a page that instantiated some java objects, I got this error.

"coldfusion.jsp.CompilationFailedException: Errors reported by Java compiler: jikes: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

I checked to make sure libstdc++ was installed, and it was, although not version 5. I checked another one of our Linux CF8 servers, it didn’t have version 5 installed either, so I didn’t think that was the problem. I noticed the other server had some compat libs installed that I was missing though. I ran this command: yum install compat-libstdc\* which installed two RPMs: compat-libstdc++-296 and compat-libstdc++-33. Then I restarted ColdFusion, and was able to execute the page with no errors.

There may be something buggy here, or maybe I’m misunderstanding how this should work.

This code executes fine:

<cfquery name="qryListings" dbtype="query">
SELECT 1 as OrdBy, * FROM qryListings
UNION
SELECT 2 as OrdBy, * FROM qryListingsTmp
ORDER BY OrdBy
</cfquery>

But when I add a WHERE clause to the second part to filter out records that were in the first group:

<cfquery name="qryListings" dbtype="query">
SELECT 1 as OrdBy, * FROM qryListings
UNION
SELECT 2 as OrdBy, * FROM qryListingsTmp WHERE ref_num NOT IN
(#ValueList(qryListings.ref_num)#)
ORDER BY OrdBy
</cfquery>

I get a ColdFusion error about the number of columns being different between the two queries.

Continue reading ‘A bug with Query of Query and * ?’ »

I had the need to instantiate some static nested Java classes, from within ColdFusion. I was doing some searching through IMAP. The Java code I was trying to emulate went something like this:

import javax.mail.*;
import javax.mail.internet.*;
InternetAddress address = new InternetAddress();
SearchTerm toTerm = new RecipientTerm(Message.RecipientType.TO, address);
SearchTerm ccTerm = new RecipientTerm(Message.RecipientType.CC, address);
SearchTerm bccTerm = new RecipientTerm(Message.RecipientType.BCC, address);
SearchTerm[] recipientTerms = {toTerm, ccTerm, bccTerm};
SearchTerm orTerm = new OrTerm(recipientTerms);

Continue reading ‘Instantiating Nested Static Java Classes from ColdFusion’ »

I ran into this issue when adding a new datetime column to an existing table in my MySQL 5 database. I did not get the error in my production environment, only the dev environment on my local machine.

I was puzzled by this error, because I thought the all zeros value basically meant a null/unknown date value. Also I wasn’t using a type TIMESTAMP, I was using a DATETIME column type, so that threw me, too. After digging through the data a little bit, I found that the values for these new columns in the production database were NULL, but the values in my dev database were ‘0000-00-00 00:00:00’. A little googling told me that the all zeros value is what happens when an invalid date is assigned to a datetime field.

I could not see any differences in the schema, so I’m not sure how this happened. But updating my dev data to be NULL where the value was ‘0000-00-00 00:00:00’ solved the problem.

The other option, if you can’t change your data, is to add these items to your connection string value in the ColdFusion Administrator for your datasource:

noDatetimeStringSync=true&zeroDateTimeBehavior=convertToNull

This tells MySQL to return a null instead of throwing an exception when one of these values is found. This is how I initially solved the problem, until I figured out that ‘0000-00-00 00:00:00’ was not a proper value.

Today I needed to view the details for all the scheduled tasks on one of our client’s servers. I needed a print out showing the tasks including the URL, the schedule and whether the task was disabled or not. There were quite a few tasks on this machine, and I wasn’t looking forward to manually going into each task, printing it, and then ending up with a huge stack of printed pages.

So instead I wrote this short script that displays the information I need all in one page.
Continue reading ‘A one page view of scheduled task details’ »

I thought enabling the new ColdFusion 8 server monitor was not supposed to affect your applications, but apparently it can. This morning all of the sudden I could not get one of my coldfusion applications to start, it kept throwing timeout errors in weird, almost random places. When I removed the offending piece of code I would just get a timeout error somewhere else.

I finally tracked it down to the fact that someone enabled the server monitor on this server. Turning it off let the application start up just fine. This is a ModelGlue/ColdSpring application, that may have something to do with it because we had other ColdFusion apps running ok on this same server.

I was able to turn monitoring back on after the application had started. The application scope was only using 3.3kb of memory, much less than some of the other applications. My lone session in the application was taking up 76kb though, which seems kind of high.

Thoughts???

Recently I’ve had a couple occasions where I needed to clean up some data that had non-ascii or high-ascii characters in it. Usually this happens when the data originates from MS Word or Excel. The first time I was producing XML, and was getting errors when I tried to validate my feed. Thats when I noticed I wasn’t using XMLFormat(), which of couse I should be.

I added XMLFormat() around my data, but was still getting errors. Evidently XMLFormat() still leaves in a lot of characters that are just plain illegal in XML. Here is a function I wrote to give me clean data.
Continue reading ‘Cleaning up non ascii chars for XML or other uses’ »

Could it be true? Yes, check out MusicArsenal.com, a new service that allows indie managers and labels to promote their bands. It provides access to all kinds of contacts for setting up shows, radio appearances, etc, as well as organizing all aspects of managing and promoting a band.

It was built in ColdFusion 8, using Model Glue, ColdSpring and Transfer.

The basic account is free so feel free to signup and try it out. The man behind the project is Jimmy Winter, he has a blog at musicarsenal.com/blog/. And you may just bump into him at an NECFUG meeting.

music arsenal

The cfdirectory tag can be pretty slow when reading in large numbers of files. I was trying to read a directory that contained 13,000 files and it was often timing out. In my case, I only needed the names of the files, not the size or date modified or anything else that cfdirectory returns. In that case, specifying the LISTINFO=”name” attribute should speed things up considerably. That tells CF not to stat() each file to get the additional information. Unfortunately this only became available in CFMX 7, and this particular project is running on 6.1

But using java you can achieve the same result:
Continue reading ‘Fast alternative to cfdirectory for large file lists’ »

In a couple application’s I’ve found it necessary to send a user to another ColdFusion server, but still maintain their current session. Usually this is for a payment gateway, or encryption process, or some other kind of functionality that only exists on that other server. In CF5 this was pretty straight forward. You set up both servers to access the same client variables database, then provide an HTML link (or a cflocation tag) that jumps the user to the other server, keeping their CFID and CFToken on the URL. The second server will see those URL values and use them, instead of generating new CFID/CFToken values as it normally would. I had both servers setup something like this:
Continue reading ‘Using CFID and CFToken to jump between ColdFusion servers’ »