What do you mean don't hard code your path in ColdFusion ? ... use ExpandPath()!

Many years ago, I was told "Don't hard code your path" in ColdFusion when reading or writing files to your server.

 

So, I DID NOT "hard code" my paths. Or so I thought. Sample below of what I considered "hard coded"

 

<cffile destination="C:\Inetpub\wwwroot\myfiles\">

Instead I used application variables to hard code my paths.

 

<cffile destination="#application.myfilesPath#">

 

What a mistake! that i recently had to rectify.

 

My move to a Mac and setting up a local development environment brought this mistake to a head. I'm running ColdFusion Developer Edition, Apache, Eclipse, and Subversion. Fire up my browser to test out my local.domain.com and noticed that file upload is broken.

 

Those paths set as application variables work fine on Windows with backslashes, but won't work on my UNIX based Mac which wants /Applications/xampp/xampfiles/htdocs/myfiles

 

Enter the function I'd used before, but not committed to my daily life.

 

ExpandPath()

 

Many ... many ... hours later the site now runs on my mac AND on the windows server.

 

Point to the webroot #ExpandPath('/')#

 

Point to the "myfiles" a subdirectory of the webroot #ExpandPath('/myfiles')#

 

Point to the "otherfiles" not in the webroot #ExpandPath('../otherfiles')#

 

 

Problem connecting to VMWare Fusion for Mac as a host server

I'm running Windows 2003 server on VMWare Fusion for the Mac. Windows has IIS installed along with ColdFusion 8. When I try to ping the server via IP address, I get the error message "the network is down".

 

What was most puzzling was that I could reach the internet from a browser running inside VMWare.

 

To fix the problem. Open up Terminal application on your Mac.

 

sudo /sbin/ifconfig vmnet8 up

 

Microsoft dumps Sienfeld Ads?

The third ad by Microsoft has dropped Jerry Seinfeld in favor of a direct rebuttal to Apple's "Mac and PC" ads. Microsoft creatively calls it "I'm a PC". It shows a lot of regular folks as well as celebrities saying "I'm a PC". They even had an employee from Microsoft who is a know off for John Hodgman (PC from the Apple Ads).

 

My response... lame

 

Really, you're dumping Jerry and going with this lame response to Apple.

 

My post about the first Microsoft/Sienfeld ad said ...

 

"Version 3.0 of their commercial should finally hit the mark.
Or at least suck less."

 

Looks like we've got a Microsoft BOB on our hands. Seinfeld won't make it into a third commercial.

 

Who's running this ad campaign for Microsoft? John McCain's team?

 

New BACFUG Logo

I broke out my "designer" hat and put together a new logo for the Bay Area ColdFusion User Group.

 

Started with some nice vector art from www.istockphoto.com. By the way, love this site. I use them regularly when looking for inexpensive stock photography.

 

Here is the final logo...

 

 

ColdFusion 8 date chooser image doesn't appear in CFDIV or CFWINDOW

I've been using the nifty date chooser widget in ColdFusion 8 and love it. Using the <cfform> tag and a <cfinput> tag you simply add the type="datefield" and mask="MM/DD/YYYY". You'll see a small image of a calendar appear next to your input form and when you click on it a nice calendar date chooser will appear.

 

My problems begain when I tried to use this same code inside a .cfm page and used the bind (cfdiv) or source (cfwindow) attribute to point to this separate page. The small calendar image would not appear. I thought this had something to do with the asynchronous nature of cfdivs and cfwindows.

 

But, I've descovered the problem.

 

1. I did not map the CFIDE directory and instead copied all the content of /CFIDE/scripts/ into a directory off the root called /js/cf8/. Then I used <cfajaximport scriptSrc="/js/cf8" tags="cfform,cfdiv,cfinput-datefield">. This SHOULD work. But it didn't. Thanks to the FireBug plug-in (Love this plug-in, if you don't have it running in Firefox 3 get it now). Firebug allowed me to see the source of my external.cfm file. I found the problem.

 

Here is the image tag for my main page calendar icon.

 

<img id="myDatemyForm_cf_button" src="/js/cf8/ajax/resources/cf/images/DateChooser.png"/>

 

And here is the image tag for my external page calendar icon.

 

<img id="myExternalDatemyExternalForm_cf_button" src="/CFIDE/scripts/ajax/resources/cf/images/DateChooser.png"/>

 

No good!

 

So, my solution. Create the directory "/CFIDE/scripts/ajax/resources/cf/images/" off my webroot and copy the image contents.

 

Voila! the calendar image appears and the date chooser works great.

Happy coding.

 

First Microsoft ad featuring Jerry Seinfield

I was surprised to see the first add for Microsoft featuring comedian Jerry Seinfeld. Just a few weeks ago they announced the deal that would pay Seinfeld $10 million to appear in a series of Microsoft ads. People speculated the ads would respond to the negative image of Vista.

 

All I can way is "What is Microsoft thinking?"

 

Here is a run down of the commercial. Seinfeld finds Bill Gates at a discount shoe store and give him advice on his shoe purchase. At the register Bill pulls out his discount card with the notorious photo of Bill taken in his twenties, but he looks fourteen and very geeky. Ok, ha ha. Bill and Seinfeld leave the mall eating chiros. Seinfeld asks Bill is computers will be moist and chewy so we can eat them. Bill stops to adjust his underwear to signal yes. The windows logo appears.

 

 

Huh? What was that?

 

I hit rewind on the DVR to show my wife the commercial. Her reaction was the same as mine and after a short discussion. I can only guess that Microsoft was trying to create a "Seinfeld-like" commericial. The TV show known to be about nothing.

 

Not a smart move. Look at what Apple has done in the Mac/PC ads. The PC is sneezing. He tells Mac to stay back, he's got the latest virus. Mac assures him he won't catch it. Bravo apple. You've taken a problem many computer users encounter and demonstrate how the Mac differs from the PC all in a humorous and memorable way.

 

 

Hopefully, future Microsoft ads will follow their software development trends. Version 3.0 of their commercial should finally hit the mark. Or at least suck less.

 

My 30onMAX Video

Decided to upload a video for the MAX North America Conference.

 

This will be my third time attending MAX. When the conference ends, I am energized by all the great sessions and walk away with quite a few "ah-ha" moments.

Flex 360 Conference less than a month away

I'm very excited about the upcoming Flex 360 Conference. It's been 18 months since I attended the first 360 conference in San Jose. It only cost $100. An amazing deal for a 2 day conference. It was hosted at the eBay campus and I believe subsidized by eBay as well. About 400 people attended.

 

This year is a bit more expensive ($480), but is 3 days long and includes a pre-conference on Sunday included in the price. They've got both beginner and advanced tracks setup. Lynda.com is hosting the Flex 101 pre conference event for Sunday.

 

Thanks to Tom and John for all the effort they put into this conference.

 

cfmodule displays content twice

I was a bit baffled when I encountered this error. While generating multiple pdfs I used the cfcontentsave wrapped around a cfmodule tag and passed in an id as an attribute. I thought simple enough. But my cfmodule would output the content twice.

 

As we all drift towards XHMTML compliance we begin adding a slash at the end of tags. For example, <img src="foo.jpg" />. In the past we didn't worry about that ending slash.

 

So, my cfmodule was <cfmodule template="foo.cfm" id="1" />

 

It was the darn closing slash that told ColdFusion to output the content twice.

 

ColdFusion.setSubmitChecked Javascript Error

I recently encountered the error "ColdFusion.setSubmitChecked" when loading a page that contained a cfform inside a cfdiv. Below is an example of the code I was using.

 

<cfdiv>

<cfform>

<cfinput type="submit" name="thisButton" id="thisButton" value="submit">

</cfform>

</cfdiv>

 

I had recently updated to version 8.01 of ColdFusion. The thought of that update jogged my memory. This project is using copy of the "scripts" in the root directory. I was NOT pointing to the "scripts" directory under the CFIDE directory. I thought why not? So I archived my old ajax files and moved a fresh copy over from /CFIDE/scripts/. What do you know that solved the problem.

 

That's two bugs I've found AFTER they have been fixed. Guess I'm just lucky that way.

 

 

More Entries