Monday, May 7, 2012, 21:51

Ronnie O’Sullivan

Snooker World Champion 2012

“Ronnie O’Sullivan can win as many world titles as he wants to, he’s got more talent than any human being deserves to have, he’s been sprinkled with star dust.”
-John Parrott

“The balance in his game is magnificent and when he plays like that he truly is the greatest player ever to play the game. He’s a demi-god with what he can do with a cue in his hand.”
-Steve Davis

Thursday, April 26, 2012, 11:12

CFFTP in CF8 does not list files and folders modified on 29 February!

The title says it all, but I will detail.
IF
-you are on ColdFusion 8
-and using the CFFTP tag with action=”listdir”
-and the remote FTP folder is on a UNIX system
THEN
-CFFTP will not list the files and folders having last modification date 29 February.

Why this happens?

Apparently, because of a bug in the FTP client used by ColdFusion. The FTP client is Apache Commons NET – FTPClient, and according to this article:

The Unix ftp server returns the date in the format “MMM d HH:mm”. No year info is supplied.
This caused problems, of course, since Feb 29 is not a valid day in the default year 1970.

When was this discovered?

According to this thread on Adobe Forum, it was first reported on 29 February 2008:

CFFTP from one Red Hat AS 4 server to another Red Hat AS 4 server is not retrieving files with modification dates of February 29 2008. The files simply don’t show up in the listing. They do show up in every other FTP and SFTP program I’ve tried, including command-line FTP from the system trying to CFFTP and from other systems on the network. It appears to only be affecting CFFTP TO a unix/linux system.

When was this bug fixed?

Today, 26 April 2012, the bug is still present. As one users points out:

It happened again in 2012!
On windows 2003 server with CF 8
Come on Adobe. Neglected this one for 4 years cost me 5 hours of work today.

One can argue that it is not a ColdFusion bug, it’s an Apache FTPClient bug. But when this bug is affecting the correct function of ColdFusion, then an action is necessary. Moreover, when behind ColdFusion is a company the size of Adobe, there’s really no excuse for not fixing it for more than 4 years.

Monday, March 19, 2012, 15:57

Coldfusion: cfinvoke timeout

Consider the following scenario: you make a cfinvoke to a remote web service, that takes a long time to execute. In the same, you want to be in control of your script, and present a timeout error message. The natural thing to do in this case is to use cfsetting requestTimeout.
Or, you can use the cfinvoke’s timeout attribute, as in the example below.

I created a ColdFusion component, to be used a web service: sleeping.cfc. This component has only one method – sleepit – that simulates a long process. In our case, it sleeps for 5 seconds.
The client – call_sleeping.cfm – is using the cfinvoke tag to call the sleepit() method, but it will only wait for 2 seconds (timeout=2). The error received after 2 seconds will be:

Could not perform web service invocation “sleepit”.

The code below. Read more >>

Friday, March 16, 2012, 15:44

Refresh ColdFusion web services

ColdFusion caches the WSDL. In order to flush this cache, you have the following options:

  1. ColdFusion administrator
  2. Programatically:
    In ColdFusion 8, you have two options:
    1. Cfinvoke’s refreshWSDL attribute:
            <cfinvoke webservice="#wsdl#" method="method" returnvariable="rv" refreshWSDL="yes">
              <cfinvokeargument name="arg" value="1"/>
            </cfinvoke>
            
    2. Cfobject’s arguments structure
            <cfscript>
            wsargs = structnew();
            wsargs.refreshwsdl="yes";
            somevar = createobject("webservice",
      "http://[server]/[webserviceurl]",wsargs);
            ...
            </cfscript>
            

    In ColdFusion 7, however, you can use the following solution:

    <cfset wsAddress = "http://your.web/service/url.cfc?wsdl">
    <!--- CF7 --->
    <cfset createObject("java", "coldfusion.server.ServiceFactory").
    XmlRpcService.refreshWebService(wsAddress) />
    

Read more

  1. CF8 Hidden Gem: Refreshing Web Service WSDL and CF proxy/stub with new RefreshWSDL option
  2. CF8 Hidden Gem: New ArgStruct argument for createObject with web services
  3. Flushing a cached web service (see also first comment)
  4. Refreshing Cached ColdFusion Webservices Through the Back Door (ignore the Comic Sans typeface)
Friday, March 9, 2012, 22:57

29 February Bug

This is just to log a funny bug I encountered a few days ago, on the 29th of February 2012. There was a piece of code that was comparing if a certain date is older than a year or not.
The algorithm to compare the date was creating the ‘one-year-ago date’ by substracting one unit from the current year. Something like:

<cfset aYearAgo = CreateDate(year-1,month,day)>

Obviously, this algorithm was failing on the 29th of February on the leap years (like 2012).
The solution is quite simple: instead of substracting one unit from the year, substract 365 days from the current date, using Coldfusion’s dateAdd function:

<cfset aYearAgo = DateAdd('d', -365, Now())>


Credit photo: Smashing Magazine’s Desktop Wallpaper Calendar February 2012

Pages:123456789»