In this previous post detailing how to manipulate mail headers there was some lively discussion as to whether this was really ethical or not. Just today CF Guru Brian Rideout mentioned that he was having trouble getting ColdFusion mail past a declude filter (a common spam filtering technology supported by many mail servers) due to the mention of ColdFusion in the mail headers. Brian came back and indicated it was actually something else - and his tip bears repeating.
When you specify an email server, either in the CF administrator or in the cfmail tag, make sure you use a fully qualified domain name. It is not advisable to use an IP address here. Remember that many IP addresses you might use are actually "internal" to your network and not public IPs (like 10.1.5.15 or 192.168.1.10 or even 127.0.0.1). When you think about it, it makes sense that declude would hold an IP address against you. It would expect mail to come from a public server. In fact, there are many technologies that analyze the origin - spf, dkim, reverse lookup etc. So make sure and use a real FLQDN - even if you have to edit the hosts file on the server to get it to resolve :).
Over the past few days on CF Talk Ian Skinner has been struggling tuning an application that makes use of CFTHREAD. In his application a process spawns threads for creating report files. Ian Reports that the process would spawn the threads, but the threads themselves would neither complete gracefully nor respond to a "terminate" action (<cfthread action="terminate" ...>). No suggestions from the muse or anyone else seemed to help. Finally he upgraded to ColdFusion 8.0.1 and the problem appears to be resolved. Threads complete gracefully without hanging around.
Nothing in the 8.0.1 release notes raises any red flags with me that would indicate why updated to 8.0.1 resolved the issue. I suspect that something very specific about his JVM was causing it. Still, it's nice to know if you run into this ticklish issue there is a way around it.
It's pretty common to use the application scope to cache components. If your component is a collection of methods or data access functions it's often faster to put them into the application scope than it is to create an instance with each request. Now you probably know that you should quality all of the variables in a function with the "var" key word. This insures that the variable exists inside the "scope" of the function call. This allows multiple function calls to be made to the same instance without one set of variables over writing the other.
One of the areas where this can be difficult to manage is when using a ColdFusion tag that creates its own scope. Take CFHTTP as an example.Read More
Recently a colleague was lamenting the fact that the rich text editor that ships with CF8 seems to load slowly and have a few other problems that are causing consternation for his users. His exact comment was that he wished Adobe would "fix" or "patch" the FCK editor that underpins the rich text editor. I certainly sympathize with his desire to fix the behavior he is experiencing for his users, but I would hasten to point out that the underlying libraries for FCK editor are not from Adobe. Instead, along with copies other script libraries for Ajax, window behaviors and the like, they are open source libraries - many of them from Yahoo.
Of course this is one of the bugaboos of these new "client side" widgets that ship with Coldfusion 8 and in a way they put Adobe in a difficult position. In CF8, Adobe encapsulated a bunch of cool client side functionality into new tags like cfwindow, cfajax, the rich text editor etc. This is not new for Coldfusion - cfform, cfgrid, etc have been around for since the beginning. The biggest difference is that there is a lot more of them and they are exponentially more capable with the advent of Ajax, binding, and Cfajaxyproxy. In fact, Ajax and Cfajaxproxy really continues the trend of blurring the line between the server and the browser - a trend already in full fury in the Flex world. Adobe is seemingly caught between the two worlds of client and server.Read More
The phrase "memory leak" can cause shivers to run down the spine of the most seasoned developer. Having some process on your server that is gloaming onto memory and failing to release it is a guaranteed all nighter lurking somewhere in your future. Recently we were debugging a new, soon to be released application. We discovered what looked like a memory leak. The JVM memory used would climb steadily toward the maximum heap size. When the runtime garbage collection kicked in it would reduce the memory only by about a third of the increase. So, for example, memory use would climb from 300 megs to 600 megs and then GC would reduce usage back to 500 megs and so on. This situation would inevitably lock up the server with out of memory errors. What follows is a recap of our troubleshooting journey.Read More
I'm not a huge fan of upgrading software. I have found, in the words of Sam Gamgee's gaffer, that "Short cuts make long delays." In my view you will usually save time troubleshooting by doing a full install rather than an upgrade. Recently we needed to upgrade a customer from Coldfusion 7 to Coldfusion 8. It was a single server installation and we needed a minimum of downtime so, after writing a rollback plan and prepping the server we chose the "upgrade". All seemed to go well. All the data sources, services and settings ported over to the new Coldfusion 8 installation and the server fired up just fine. We thought we were home free until....Read More
Here's a tricky little bug that I missed during a recent upgrade. The customer had Coldfusion 6.1 and we were tasked with moving them to Coldfusion 8. After reviewing the code and determining that no changes would be necessary, we did the upgrade. After we were finished everything seemed fine except one obscure task that was set up to run periodically. It was a command line task using Cfexecute. The task accessed the mysqlump.exe file to create periodic backups of the mysql database. The code (which was working on CF 6.1) looked like this:
So if you are troubleshooting Cfexecute after an upgrade to 7 or 8 and you are getting missing file exceptions and scratching your head. Check to see if you are using the old style Cfexecute syntax where the executable and the arguments are all on the same line and passed in the "name" argument. If you are, take the "arguments" portion of the command line and move them to the "arguments" attribute of the cfexecute tag. That might do the trick.
In previous posts I have lauded the "new" ability of the Javacast function to handle arrays of primitive objects. David Stamm pointed out that javacast is capable of handling complex java types as well - and you can cast them as arrays! In his example he used the "java.net.URL" class and created an array of them, then cast the whole thing as an array of complex java objects. I'll show you his working example in a moment, but first let's talk about why would you ever need this?
If you are working with Java libraries there are many times that they require as an argument an array of objects of a certain type. Let's say you have a payroll system written in Java and one of the functions is "runPayroll()". This function takes an array of employee objects. To keep it simple let's just say that each employee object contains properties for pay amount and vacation accrual. Internally, runPayroll() loops through the employees and calls emp.getPayAmt() and emp.getAccrual() and populates some batch job or whatever. This is fairly standard stuff in Java. If you wanted to make use of the runPayroll() function how would you accomplish it?Read More