ColdFusion in odd places - using the directory watcher on my desktop
ColdFusion, InstantSpot, Tips and TricksSince 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
Ubuntu, Tips and TricksI 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-enPublishing blog entries with ScribeFire using XMLRPC API
InstantSpot, Tips and TricksOn the most recent release of InstantSpot, we added in XMLRPC support so that blog administration can happen anywhere, using any client that supports XMLRPC. We are thinking it might be fun to create an AIR app for this purpose down the line (or better yet... someone else! hint...hint...), but until that time, there are a variety of clients that can be used, since we followed the MetaWeblog API standards.
I am actually trying this out for the first time on our live instance with this blog entry by using a *sweet* Firefox plugin called ScribeFire. Considering that we haven't really published this ability, I thought it might make sense to do a walk through of setting it up and using it.
First, let's walk through the ScribeFire Account Wizard. One you have installed the ScribeFire plugin (available here), click on the little text pad icon in the bottom corner of your browser window and start the Account Wizard. You should see a window that looks like the one below. Choose "Manually Configure" and continue.

You will then be presented with a number of options of various

On the screen you see below, choose "MetaWeblog API" and enter this URL into the Server API URL input box: http://www.instantspot.com/gospot/remote.metaweblogAPI
Leave "Advanced Settings" unchecked and continue.

On the following screen you will be prompted for your username and password. Since the new release of InstantSpot, your email address is now used as your username.

That's it! If you did this correctly you should see your blog listed in the following screen like this:

Now, you should see a list of your categories (labeled in the interface as "tags"), blogposts, and in the future, saved "Notes" which are drafts stored locally by ScribeFire to the right of the ScribeFire window like this:

From here, the interface is pretty simple. One thing that is noteworthy is that we even support the ability for you to upload and insert images through ScribeFire. When you click on the image icon on the editor, you will see a window that looks like this:

Choose "Image Upload", then after browsing to your file, select "Upload Via API".

When it completes you will see the following window. Choose "Insert Image" and you will see your image inserted into your text.

Now you can start posting away to your heart's content!
Powered by ScribeFire.





Loading....