I love the new widgety stuff in Coldfusion 8. The Cfwindow tag caught my attention right away. it seemed like a quick and easy way to frame content on a page and make it manageable. For example, I had a list of items that appear on the home page of our tracking system. It's the "hotlist" - a list of open and active work orders and projects. I decided to use Cfwindow to make it draggable and re-sizable. It was easy.
Since I loved the little drop shadow thingy I decided I would use it on the right hand side menu as well - just to frame in the menu with a header. Oops... this turned out to be quite difficult. Why? Because there is no way to anchor the window to the layout. The layout is dynamic on the right. The right hand menu "clings" to the right side of the screen - meaning the X and Y coordinates are different for each screen size. But the Cfwindow appears over whatever is on the screen and the "x" and "y" coordinates make it's position absolute. I went hunting for an answer.Read More
Recently I got an error I had never seen before. That's news in itself. This error was especially cryptic. The template in question made a CreateObject() call to a CFC that was quite lengthy. In fact, this CFC was over 2000 lines of code (Coldfusion 7). When it tried to compile the code it threw an error that said branch target offset too large for short. You know you are a true geek when seeing an error you have never seen before raises your pulse. I started hunting for a solution - and I found one.Read More
Everyone should have regular backups and a plan for restoring a server if something goes wrong. But let's say, for the sake of argument, that you have a problem with a server where all you have is the old drive with the Coldfusion install directory (c:\cfusionmx7\ for the sake of our scenario). If you have to do a reinstall, is there a way to get back all that careful tuning, datasources (there can be a lot of these), debugging IPs, settings, CFX tags, Mail settings, etc.? Actually it is not as hard as you think.
Do a fresh install to the same location as before (C:\CfusionMX7 in this case) being careful not to overwrite the old directory. You may need to rename that old directory if you are using the same drive over again. Once CF is completely installed and running, stop the server and any associated services like search, odbc server etc. Then install the "old" directory over the new. Use a rename if you like. The main issue is that the old directory should replace the new. Restart the services and log into the CF admin. If the admin fails to come up may have to rerun the "connector" script for your web server (found in CfusionMX7/bin/connetors). These magic scripts set ports and other things that "hook" your Coldfusion server into your web server.
Now before you add mean comments please know that I am aware there are other ways of doing this. You can grab several config files and anything that is an XML file from the old directory and simply copy them into the new directory and it will work. You can use wsconfig to recreate the services - possibly without a reinstall. I'm sure there are clever people out there that have all kinds of nifty tricks. This is just one trick that takes care of this scenario. But this trick is especially useful when you have to walk an inexperienced tech through it over the phone. The concepts are easy to understand and easy to guide someone through.
Perhaps you've used my previous blog on IIS and missing file handlers to solve the problem of dynamically named folders or files. You might think that using the 404 handler in IIS in conjunction with your site wide missing template handler (set in the CFIDE Administrator) is your only option. What if you are on a shared server? Is there a way to implement a site by site missing template handler? Why yes Virginia there is.Read More
If you have read my previous posts on "Execution Plans" and Data Binding you know I am a big believer in using Cfqueryparam for performance as well as security. Today I picked up a tip on this topic from harelmalka.com (a blog I had never read before). I had never considered it before, but a query with no "WHERE" clause does not using binding because it lacks the opportunity. Therefore, a statement like:
If you read my previous post, I presume what you mean is "how do I make sure the file is what it says it is". Unfortunately this is not as easy as it seems. MIME, as it turns out, has little to do with the file. It's an attribute that tells an OS what to do with content after it's been transmitted. In fact, MIME was originally designated as a way of setting up boundary containers in an email message to facilitate attachments. As you may know, SMTP only handles character data - not binary data. When you send an attachment it is actually encoded as character data. The MIME type tells the receiving client to put the file back together as a certain type of file. That's pretty much where MIME ends...Read More
Sometimes you need to be able to specify the MIME type using Cfcontent or inline headers to force the file to open in the proper application. If you have a document storage application or a data export application you know what I mean. For example, an engineering firm might upload CAD files, Office files, PDFs, images, and proprietary formats that you have never seen before. If you are like me, you end up writing code that switches against the file extension to set the mime type. Yesterday I saw a note from Dan Switzer from Pengoworks (of qForms fame) that can get the mime type using the file path. It's not perfect as I'll explain - but here it is:Read More
Ben Forta posted this item on CF-Talk while discussing the nuances of moving to a multi-server instance. I thought it was a great illustration of some of the uses of CF Multi-server.
I especially love the idea of a specialized instance for verity indexes. Re-indexing Verity collections is a huge resource hog, and larger collections can cause problems. I don't know why I never considered this approach before - very ingenious.