Entries Tagged as 'Gotchas'

IE 8, Excel 2010 not opening content on Windows 7

ColdFusion , Gotchas , MS Office , Tips and Tricks No Comments »

Thought I'd dust the cobwebs off my blog by sharing something I came across today...

I came across an issue where a user reported that a web application was not opening Excel content they were requesting.

Basically the application was sending csv formatted text to the browser and the browser (Internet Explorer) was supposed to open this with Microsoft Excel 2010.

The template sending the content had the correct headers configured to instruct the browser to open this in Microsoft Excel and the content was valid but for some reason the new window was failing silently without promting the user to open \ save the file.  The only clue was that this was a new PC with Windows 7 and Internet Explorer 8 installed and their previous PC worked fine.

I decided to check with Firefox and voila - I was prompted to Open / Save the file.

So after diagnosing different scenarios through the code I then started looking into the settings on the PC for Internet Explorer.

Read more...

neo-cron.xml corruption issue

ColdFusion , Gotchas , Misc , Server and Hosting No Comments »

After New Years - we returned to a sickly server, and something I never came across before - so I thought I'd share this with you all!

Background

Our servers are deployed as Multiple J2EE Instances runnng the latest version of ColdFusion 9.0.1.

When we tried accessing one particular application, we got the following error:

The Cron service is not available.  
This exception is usually caused by service startup failure. Please check your server configuration.

Don't be fooled by the error message, the real issue lies in a corrupted server file.

Turns out the neo-cron.xml file was corrupted.

Read more...

Microsoft TSQL and the GO Statement

Gotchas , SQL , Tips and Tricks No Comments »

Recently I was working on some SQL scripts using TSQL in SQL Server Management Studio and from force of habit I was using the "GO" statement between each of my SQL statements to seperate them.

I then started re-factoring the SQL, creating variables where I had hardcoded values etc. and placed those variable declarations at the top of the script.

After re-factoring, I executed the scipt and got an error message saying that the variable @varName was not defined? 

I checked for any typos...none.  I then started breaking down the script to see if I could isolate the issue.  When I removed the "GO" statements, the script executed without error.

It turns out that "GO" is not a TSQL statement, but rather a command that is recognised by the sqlcmd and osql utilities and SQL Server Management Studio.  These utilities interpret the "GO" statement as a signal that it should send the current batch of TSQL statements to an instance of SQL Server.  Therefore any variables declared before the last "GO" and the next will NOT be available in the current batch of statements. 

Just for fun I then copied my TSQL into a <cfquery> and when I executed this, found that the same error was thrown.

One to watch out for if you're not familiar with the true definition of the "GO" statement. 

Full details of the "GO" statement can be found here: http://msdn.microsoft.com/en-US/library/ms188037(v=SQL.90).aspx


Bookmark and Share

<cfhttp/> Connection Failure

ColdFusion , Gotchas , IIS , Misc , Server and Hosting No Comments »

I was working on calling a remote template via <cfhttp /> recently and was experiencing a Connection Failure Error.

Scratching my head I proceeded to inspect what was going on in my code and on the wire with Firebug. 

At first I thought I had resolved the issue when I discovered my return type was a complex value (struct) but my elation was quickly drowned by the "CTRL+F5" key combination :-(

Without any luck I decided to consult the WWW.

After a quick search I discovered that it was due to the reponse being Compressed from IIS.  Apparantly the HTTPCompression algorithm used by some versions of IIS is incompatible with ColdFusion (Java).

Workaround

The work-around was to specify additional HTTP Headers telling IIS _NOT_ to use compression for that response.  See below...

<cfhttp 
    url="http://someURL.com/svcs/targetTemplate.cfm?argument1=value1&argument2=value2" 
    method="get" 
    compression="none" 
    result="remoteCallResult" >
            
        <cfhttpparam type="header" name="Accept-Encoding" value="deflate;q=0" />
            
        <cfhttpparam type="header" name="TE" value="deflate;q=0" />

</cfhttp>

OR

<cfhttp 
    url="http://someURL.com/svcs/targetTemplate.cfm?argument1=value1&argument2=value2"
    method="get" 
    compression="none" 
    result="remoteCallResult" >
            
        <cfhttpparam type="header" name="Accept-Encoding" value="*" />
            
        <cfhttpparam type="header" name="TE" value="deflate;q=0" />

</cfhttp>

That should do the trick!

Credit and a more detailed breakdown of this can be found at Steve Erat's Blog

Bookmark and Share

Using <cfexecute/> with Windows Batch Files

ColdFusion , Gotchas , Windows 3 Comments »

Recently I wrote some batch files to complement some scheduled tasks I was developing to help with automating some processes that were being carried out manually by system administrators on applications deployed in a Microsoft Windows environment.

In doing so I came across a number of minor issues that I had to figure out, so I thought I'd share them here for anyone else who's ever required to do anything similar.

I was calling the batch file using the <cfexecute /> tag and passing some arguments to keep the script cohesive enough that its functionality could be used on other servers.

The code final code I used is below but I have discussed the important parts that I had left out.

<cftry>
    <cfscript>
        args = [1];
        args[1] = "argument1Value";
        args[2] = "argument2Value";
        args[3] = "argument3Value";
    </cfscript>
    <cfexecute variable="batchScriptOutput" 
	              name="#APPLICATION.BATCH_SCRIPT_DIRECTORY#\#APPLICATION.NAME_OF_SCRIPT#" 
				  arguments="#args#" 
				  timeout="99999" 
				  errorVariable="batchScriptError" 
	/>
    <cfoutput>
         SCRIPT OUTPUT:<br />#batchScriptOutput#<br />
         ERRORS:<br />#batchScriptError#<br />
    </cfoutput>
	<cfcatch>                
	    <cfrethrow />        
	</cfcatch>
</cftry>

The issues I had were that:

  • I wanted to pass argument values that had spaces in them
  • I wanted to see the output generated by the batch file

Neither of this seemed possible without formatting the code as I have above.  If a "timeout" value wasn't set, I didn't get the output returned and it just seemed simpler to pass the arguments as an array.

If anyone has had any similar experiences or better methods of implementation, I would like to hear your thoughts.

Bookmark and Share
Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds