Using jQuery style a cftooltip span

It’s not hard to figure out how to style the box that pops up when using cftooltip.  It is controlled by the .yui-tt class.

/* Tool tip styling */
.yui-tt {
color: #444;
font-size:110%;
border: 2px solid #1C64D1;
background-color: #eee;
padding: 10px;
width:250px;
cursor:help;
}

But how do you style the text that is triggering the tooltip?  cftooltip is going to generate a span around your text with the id of cf_tooltip_999999999 (where 999999999 is some random number).  I didn’t want to add another span to the mix to provide styling so I turned to jQuery for a simple, quick solution.

In the css file I added a class:

.terms{
color:#168FC0;
border-bottom:1px dashed #168FC0;
text-decoration:none;
margin-bottom:10px;
font-weight:bold;
}

In the jQuery .ready() function I added this line:

$("[id^=cf_tooltip_]").addClass("terms");

The result is that the text which triggers all cftooltips is now controlled by the .terms class.

CF quickie: cfqueryparam with SQL’s LIKE operator

If you are using cfqueryparam to build a SQL statement from a search form and need to use the SQL’s LIKE operator here is how it’s done in the most basic way:

<cfquery name="qData" datasource="myDsn">
SELECT DISTINCT last_name
FROM person
WHERE last_name LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.last_name#%">
ORDER BY last_name
</cfquery>

The magic is all in the % sign at the end of the cfqueryparam value attribute.

I’m an ACE (Adobe Certified Expert) in Advanced ColdFusion 8

Two months of studying paid off today.  I took my ACE exam for ColdFusion 8 and passed with a 98%, which also means I qualified for the Advanced status.  The Web Application Construction Kit is all you’ll ever need to become a CF Ninja.  For the exam I’d recommend reading the first volume cover to cover. Additionally I found the ColdFusion MX 7 Certified Developer Study Guide to be very useful.  Even if you don’t need it for your job challenge yourself and go for it.

ColdFusion 8 WACK ColdFusion MX 7 Certified Developer Study Guide

ColdFusion Dying… Again

So I took some database training with Global Knowledge last week.¬† My office paid for the training.¬† Apparently that “back end” training may be all for naught though since my front end programming language is on life support.

Today’s Global Knowledge newsletter letter informed me (in very cheeky fashion) that ColdFusion is # 5 on their “Dying Technology” list:

“If any of these skills are your main expertise, perhaps it’s time to retrain.”

Here’s the whole article: http://www.globalknowledge.com/training/generic.asp?pageid=2347&country=United+States

The notion of ColdFusion being dead has been debated into the ground so I’m not going to belabor it.

IMHO, ColdFusion is the best thing that ever happened to me from an IT standpoint.¬† If you want to get things done quickly, easily and reliably use it.¬† If you are thinking of ColdFusion along with COBOL, Netware, Flannel Shirts and “Grunge” Bands From Seattle, and¬† you might want step outside your house more.¬† It’s not the mid 90’s anymore.

Change background color of fckeditor / ColdFusion rich textarea

Preface: I work on a project for my office that is hosted by a third party.  Therefore, I do not have access to all the inner workings of ColdFusion.  Specifically I do not have access to the fck_editorarea.css file.

For a new form in the project I need to add a rich textarea.¬† The rich textarea will sit atop a div with a background color so I need to change the textarea’s background color to white.¬† If I can’t access fck_editorarea.css to change the style what can I do?¬† I can change it via the DOM with JavaScript.¬† For kicks I also added a border.¬† Place the following script just before the </html> tag.

<script type="text/javascript">
fckItem=document.getElementById('NEWSBODY___Frame');
// change bgcolor
fckItem.style.backgroundColor="#FFFFFF";
// add a border
fckItem.style.border="1px solid #0A0A4F";
</script>

Easy enough.

ColdFusion Idol Worship

When I was a kid I idolized athletes.  In college I idolized musicians.  As a middle aged dude I idolize superior programmers.

Today I achieved something I am very excited about. ¬†I got a couple of lines (and one of those is a comment) of code included in one of Ray Camden’s projects at RIAForge. ¬†The project is GoogleCal. ¬†It’s a ColdFusion CFC for interacting with Google’s Calendar service. ¬†My tiny, wee contribution: helping to submit an “all day” event. ¬†It is such a small, small, small, small, small (keep going), miniscule piece of Ray’s project, but just to be able to contribute ANYthing to someone who gives so much to the CF community is freaking AWESOME.

Check it GoogleCal out here.

Using Dreamweaver to work with .cfmail files

I had a BIG problem recently at a hosting company for a project I work on. They had “something go wrong” during an upgrade to ColdFusion 8 and they lost our site’s settings from ColdFusion 7. Rather than wasting valuable time trying to get them to restore a backup and redo the upgrade I forged on trying to set everything right.

One of the problems I came across was that the hosting company set the mail server to be a different one than what we had for CF7. Why did this matter? Well, there were about 300 messages sitting in the “Undelivr” folder that needed to go out. In each of those messages was the old (now incorrect) mail server info. Since I was under the gun to get the mail out I pulled them all down via FTP to parse through them with Dreamweaver.

I used this article to configure Dreamweaver to edit my extensions.txt file to be able to open and perform search and replace on .cfmail files:

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16410

Here is a what the extensions.txt file looks like:

Dreamweaver\'s extensions.txt file

Once I got all of the .cfmail files updated, I FTP’d them back into the spool folder for re-processing. No dice. ColdFusion moved it all back to the “Undelivr” folder with a cryptic error:

The ColdFusion Mail Spool Encountered An Invalid Spool File In The Spool Directory. The invalid file MailXXXXXX.cfmail was moved to the undeliverable directory.

The next step… Hot Fix. Read about it here.

After the Hot Fix I again dropped the .cfmail files back into the spool folder for re-processing. This time… Sweet Success.

Enabling SSL on the ColdFusion 8 built-in web server

This tutorial assumes default install location for ColdFusion 8 on Windows XP.

The first thing you need to do is to create a keystore. This can be done with the keytool utility. I used the one that is part of ColdFusion 8.

Open a command prompt.

Execute the following command:
cd C:\ColdFusion8\runtime\jre\bin

Create the keystore with this command:
keytool -genkey -dname "cn=127.0.0.1, ou=CF, o=cfchimp, L=Decatur, ST=GA, C=US" -keyalg rsa -keystore mykey

If you have previously configured a keystore you might run into this error:
keytool error: java.lang.Exception: Key pair not generated, alias already exists

If you got the “already exists” error run this command to list the keystores:
keytool -list -v | more

If you got the “already exists” error run this command to delete the keystore:
keytool -delete -alias mykey

If you got the “already exists” error re-run the command to create the keystore.

Enter in a password when prompted (2 times)

Move the keystore file (mykey) to C:\ColdFusion8\runtime\lib\

Edit the config file C:\ColdFusion8\runtime\servers\coldfusion\SERVER-INF\jrun.xml with an xml editor of choice. This file is VERY sensitive so be sure to not screw up the syntax of it. You should probably make a copy of it before you edit it.


<!-- Uncomment this service to use SSL with the JRun Web Server
Note that you MUST create your own keystore before using this service -->
<service class="jrun.servlet.http.SSLService" name="SSLService">
<attribute name="enabled">true </attribute>
<attribute name="interface">* </attribute>
<attribute name="port">9100 </attribute>
<attribute name="keyStore">{jrun.rootdir}/lib/mykey </attribute>
<attribute name="keyStorePassword">mypassword </attribute>
<attribute name="trustStore">{jrun.rootdir}/lib/trustStore </attribute>
<attribute name="socketFactoryName">jrun.servlet.http.JRunSSLServerSocketFactory </attribute>
</service>

Restart the ColdFusion8 application service.

Create a test page in the ColdFusion 8 wwwroot and opening it in a web browser using: https://127.0.0.1:9100/testpage.cfm

You should be good to go.

REFERENCES:
For some keytool commands: http://www.instantssl.com/ssl-certificate-support/server_faq/ssl-server-certificate-java.html
Adobe instructions: http://www.adobe.com/support/coldfusion/using/ssl_with_cf_web_server/ssl_with_cf_web_server03.html

Coldfusion Administrator (CFAdmin) Improperly Framed

Has anyone ever logged into the Colfusion Administrator to find it improperly framed? Once you click a link in the outermost frame the problem goes away. Initially, it looks like this:

Coldfusion Administrator (CFAdmin) Improperly Framed

If you have seen this (and know how to fix it) PLEASE let me know. It has looked like this on our server at work since CF6 and I have finally grown weary of it.

Thanks!