Strange component path behavior with event gateway

I am working on a client project using an SMS event gateway using CF8. I had written out a proxy API to allow the SMS gateway to talk to the core application using a shared data model that is strapped together using ColdSpring. I had written a test harness cfm template during development and just kind of assumed that I could instantiate this proxy component from my event gateway without issue and carry on about my business. For some reason, however, I am seeing some behavior that I wasn’t expecting. I have resolved this by way of using a ColdSpring mapping in the CF Admin. However, I am still curious why the following takes place.

Here is the general picture:

I have an app that sits in /www/myclientapp/www

The proxy components and event gateway component sit in /www/myclientapp/api/proxy and there is an Application.cfc in the “api” directory. I have a coldspring directory in both /www/myclientapp/www/coldspring and /www/myclientapp/api/proxy/coldspring.

When I run a testharness file in /www/myclientapp/api/proxy/testharness.cfm, I can instantiate the data model properly and there are no issues. However, when I talk to the event gateway component that sits in the …./proxy directory, I get errors instantiating ColdSpring in the Application.cfc stating
Could not find the ColdFusion Component or Interface coldspring.beans.DefaultXmlBeanFactory. — path: /www/myclientapp/api/proxy/coldspring/beans/DefaultXmlBeanFactory.cfc”.

So, digging into this a bit further I did a FileExists() test on that cfc and it returns true. HUH?

Here is my question. How can the following two statements be true:

1) FileExists(ExpandPath(“coldspring/beans/DefaultXmlBeanFactory.cfc”)) returns “true”.

2) CreateObject(“component”,”coldspring.beans.DefaultXmlBeanFactory”) errors out with the error you see above.

Hopefully someone smarter than me can shed some light on this problem!

ColdFusion in odd places – using the directory watcher on my desktop

Since recently installling yet another distro on my laptop, I was unable to get the FTP functionality of my webcam software (Camorama) to work properly. The program will save snapshots locally, but bombs on transfer. Rather than troubleshoot it to death, I decided to whip out a quick and dirty ColdFusion directory watcher event gateway and have it watch for updated images, and then push them to my webserver via FTP.

For anyone interested in this non-earth shattering bit of code, here it is. First I created a config file:

WebcamWatcher.cfg

# The directory we want to watch.
directory=/home/dshuck/Webcam_Pictures

# Do we want to recurse the directories?
recurse=no

# miliseconds between checks
interval=6000

# The comma separated list of extensions to match.
extensions=*

# component method for change events
changeFunction=onChange

# component method for add events
addFunction=onAdd

# no delete events for now
deleteFunction=

Now to create the methods in our WebcamWatcher.cfc. In short, either a changed file or an added file will trigger the putImage function which first creates the FTP connection, changes directories to my webcam directory, then pushes the file to the server. Here is the code:

WebcamWatcher.cfc

<cfcomponent output="false">
	<cffunction name="onAdd" output="false">
		<cfargument name="CFEvent" type="struct" required="yes">
		<cfset var Data=CFEvent.data />
	  	<cflog file="DirectoryWatcher" application="No"
	     	text=" ACTION: #data.type#;  FILE: #data.filename#;  calling putImage()" />
		<cfset putImage() />
	</cffunction>


	<cffunction name="onChange" output="false">
	  	<cfargument name="CFEvent" type="struct" required="yes">
	  	<cfset var data=CFEvent.data>
	  	<cflog file="DirectoryWatcher" application="No"
	      text=" ACTION: #data.type#;  FILE: #data.filename#; TIME: #timeFormat(data.lastmodified)# calling putImage();" />
		<cfset putImage() />
	</cffunction>

	<cffunction name="putImage" access="private" output="false" returntype="void">
		<cfftp action = "open"
	   		username = "joeuser"
	  		connection = "MyConnection"
	   		password = "mycoolpassword"
	   		server = "www.mywebserver.com"
	   		stopOnError = "true" />

		<cfif cfftp.Succeeded>
			<cfftp
				connection="MyConnection"
				action="changedir"
				directory="htdocs/mywebcamdirectory" />

			<cfif cfftp.Succeeded>
				<cfftp
					connection = "MyConnection"
					action = "putFile"
					name = "uploadFile"
					transferMode = "binary"
					localFile = "/home/dshuck/Webcam_Pictures/webcam.jpeg"
					remoteFile = "DaveWebcam.jpg" />
			</cfif>

		</cfif>
		<cflog file="DirectoryWatcher" application="false" text="file push to webserver...#cfftp.Succeeded#" />
	</cffunction>
</cfcomponent>

So, now the internet can yet again be graced with my “almost live” presence. I can almost hear the selective sigh of relief.

I have to consider this to be a somewhat odd place for ColdFusion and it got me thinking… What kinds of odd places do you or have you used ColdFusion?

Adding spell checking to Evolution mail client

I am not sure why I have never pusued this until today, but I for some reason have never spent the time to figure out why I didn’t have spell checking in my Evolution mail client. I knew that Evolution used the packages aspell and gnome-spell, which I already had installed, so why wasn’t it working?

When I went into my composer settings in the Evolution preferences, I saw a big empty box that was the list of dictionaries that Evolution was using.  You would think there would be some method of adding them from there, but unfortunately it isn’t quite that obvious. To add the English dictionary I had to install the package aspell-en. Once I added this I reopened Evolution and Bamn!

There it is. For the copy/paste inclined, try the following:

#sudo apt-get install aspell gnome-spell aspell-en