Debugging ColdFusion 9 on shared hosting

With ColdFusion 9 debugging can be enabled on a page by page basis. This is super handy in a shared hosting environment where you don’t have access to the CFADMIN.

Step 1

Set debuggingipaddress and enablerobustexception in the THIS scope of your Application.cfc.  You can use http://www.whatismyip.com if you don’t know your ip address.

	<!--- define a debugging ip --->
	<cfset this.debuggingipaddresses="xxx.xxx.xxx.xxx">
	<!--- enable robust exception --->
	<cfset this.enablerobustexception="yes">

Step 2

Enable show debug output at the top of your page’s code.

	<!--- enable show debug output --->
	<cfsetting showdebugoutput="true">

You should now see your debugging info appended to the page.

Just to verify!

You can verify debugging is enabled by outputting the value of IsDebugMode().

	<!--- Is debugging on?  Should be yes when showdebugoutput="true" --->
	<cfoutput>#IsDebugMode()#</cfoutput>

OmniFocus Cheat Sheat

I love me some OmniFocus. I also love me some keyboard shortcuts. OmniFocus is a great tool for trying to reign in the chaos when you take the time to learn its powerful features. Here is a useful cheat sheet I came across.  Now get out there and GTD without taking your hands off the keyboard!

Saving to a database with ColdFusion using jQuery

A commenter asked me how to extend a previous jQuery post to perform the database save via ColdFusion.  It is REALLY easy (and please keep in mind this is meant to be a SIMPLE example, not production code).  From the jQuery side my example only required the following code to ship the data off to ColdFusion:

function fSave(){
you=$("#you").val();
// Try to save
$.get("adduser.cfm?"+"you="+you , function(data){
// Result
alert(data);
window.location=location.href;
});
}

The adduser.cfm page then validates and inserts the data and returns a success or failure message.

See it hereGet it here.

Use jQuery to enable submit button and set form action

I recently had to do a quick bit of coding to only accept data from a form if JavaScript was enabled.

This example starts with a form that has no action and a disabled submit button.  When jQuery’s .ready() fires though it enables the submit button and attaches the appropriate action.

Please note the example file is in ColdFusion so your mileage may vary slightly for your own use.

See it here | Get it here.

Mac Diff/Merge Utility for Dreamweaver

If you have done web development on a PC in Dreamweaver you have probably used WinMerge to check for differences between local and remote files.  Since I moved to the Mac a few years ago I have been neglectful in finding a similar tool for the Mac.  Thanks to some changes in my current day job I now have a larger team and more of a need for getting my act together on this.

The tool I have decided on in a free one called DiffMerge.  Part 1 of the install is the typical Mac install (drag a file to the Applications folder).  Part 2 is a little more detailed (but dead simple).  There is a readme.txt file in the installer image with instructions for copying 2 files to facilitate command line usage (You will need this for Dreamweaver).

Once you have done the installation and followed the readme.txt fire up Dreamweaver and click Dreamweaver > Preferences > File compare and set the path to your equivalent of the screenshot below:

DiffMerge for Dreamweaver on the Mac

Save, Format, View Dreamweaver Checked Out By Report

I wrote a post a while back about a file I created to format Dreamweaver search results for printing. Recently the need arose for me to apply that same formatting to Dreamweaver’s “Checked Out By” report.

Here is what your report will look like:

Checked Out By Report View

Download the search_results.zip file here. It contains the files to transform both “Search Results” and the “Checked Out By” report.

*** UPDATED 2/27/2015 ***

As a security measure Chrome blocks access to local files. You must open Chrome from the command line with a flag to allow access to local files.

Follow these steps to allow local file access in Chrome on the Mac:

  • If you have Chrome open, close it
  • Open a terminal window
  • Execute the command:
    open /Applications/Google Chrome.app --args --allow-file-access-from-files
  • Once Chrome opens select ‘File > Open File’ and browse to your local xml file
  • Voilà

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.