Feeds:
Posts
Comments

Archive for the ‘ColdFusion’ Category

If you’re a ColdFusion or CFML junkie, reading Mod Media’s “What You Didn’t Know About CFML” won’t tell you anything new – but your employer or client might learn a thing or two ;-)

The Mod Media Infographic: Wat You Didn't Know About CFML

The Mod Media Infographic: Wat You Didn’t Know About CFML

As if to prove the point, just today I noticed two CFML-based websites. Scientific American clearly runs CFML code to display pages (page.cfm), articles (article.cfm) and more, and Belgian technology news site smartbiz.be proudly proclaims ‘ColdFusion Powered by Railo‘.

So don’t let anyone tell you that CFML is dead!

Read Full Post »

I’m still cleaning up my home office, and it will take a lot more time – I’m going about it very slowly. Anyway, this is my find of the day:

May 1999 - Free BSD and Allaire ColdFusion 4 on a single CD-ROM

May 1999 – Free BSD and Allaire ColdFusion 4 on a single CD-ROM

Strangely enough, the CD-ROM wouldn’t boot up an old PC with a 700Mhz Athlon CPU and 256KB of RAM – but that PC isn’t exactly new either, and I haven’t used it in more than a year. Recycling that PC seems to be the best option now ;-)

Read Full Post »

A plus isn’t always a positive thing, at least not in ColdFusion’s CFMAILPARAM tag. We found out today that filenames containing a plus sign in the filename for an attachment result in a failure to send an email through CFMAIL.

Documentation on the subject is scarce: the Adobe Community forums mentioned the subject in 2006, but don’t really explain the extent of the problem. Hadyn Cotton also reported the problem in 2010, and offers REReplace as a solution – but that won’t work for us, since we have to pick up files from our users computer.

In short: we will assume that the plus sign is the only one posing problems, and refuse to accept filenames containing a plus sign. Message to Adobe: the official documentation should mention this limitation!

Read Full Post »

It’s too bad I don’t have the time to attend the Brussels session of Scotch on the Rocks 2012 today. I enjoyed the 2009 session, and I’m sure that todays program is worthwhile as well.

Read Full Post »

I am testing a bit of ColdFusion 8 code calling a webservice through the CFHTTP tag. What was a REST-call in the past has been reimplemented with SOAP, but that should not be a problem, right? Just adding “<cfhttpparam type="XML" value="#SOAPBody#" />” to the call and changing the “GET” into a “POST”  should do the trick, but what I got was an error message pointing to the CFHTTPPARAM line: “The column name <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&gt; is invalid.

It took me a while to find the cause of this message:  somehow I had used the ‘name‘ attribute in the CFHTTP tag. In that situation, ColdFusion attempts to parse the body and turn it into a query. In my case there is no tabular data in the request, just XML, so that parsing is what causes the error message.

It just shows how unfamiliar I am with CFHTTP: even today, there aren’t that many webservices available within our company’s systems…

Read Full Post »

You may recall that I’m still running a series of ColdFusion servers at work, running CFMX6.1 and CF8. The CFMX servers remain active as long as I haven’t got Verity working reliably in our CF8 applications.

From an functional point of view, the situation is certainly workable. But the server administrators want to replace Win2000 by a more recent version – and that means I have to reinstall CFMX6.1 as well. ColdFusion is not a problem, but in a country called Belgium English is not the only language. And I no longer have a copy of the supplementary language pack for Verity, specifically the pack for Asian and European languages. The Adobe website still has a link to this download (i.e.https://www.adobe.com/bin/verity_download.cgi?OS=Windows&L=asia-eur), but returns an error 500 rather than the requested file.

I have contacted Adobe about this, but I suppose they are working on “Zeus” – which is totally understandable. But that doesn’t help me, of course. So if you happen to know someone who can correct this missing link or send me a copy of the file, that would mean a lot to me – I need to reinstall this server fast. Thanks!

Read Full Post »

Yes, I need to write this down – it’s too easy not to do it. But it’s good advice to use CFQUERYPARAM to enhance the performance of the Oracle DB (and other DB engines probably as well) … and to simplify your code at the same time.

Why the better performance? Because CFQUERYPARAM translates your parameters into “bind variables” instead of “hard-coding” them into the SQL statement. With “bind variables”, the SQL statement doesn’t change between calls with different parameters, and that means that Oracle doesn’t have to parse the SQL statement each time it is called – Oracle can actually cache them and reply faster.

And how does that simplify your code? It simplifies your code when you’re using the WHERE ... IN ( .... ) clause with a list: CFQUERYPARAM takes care of quoting the values in the list, so you don’t have to do it by hand with loops or REReplaces. Here’s an example:

<cfset codes = "01,03,08,09,12" />
<cfquery datasource="XXX" name="q">
SELECT "CODE", count( * )
FROM "XXX"."SOMETABLE"
WHERE "CODE" IN ( <cfqueryparam value="#codes#" list="yes" separator="," /> )
GROUP BY "CODE"
</cfquery>
>

That code sends the following SQL code to Oracle:

SELECT "CODE", count( * )
FROM "XXX"."SOMETABLE"
WHERE
"CODE" IN ( ?,?,?,?,? )
GROUP BY "CODE"

Query Parameter Value(s) –
Parameter #1(CF_SQL_CHAR) = 01
Parameter #2(CF_SQL_CHAR) = 03
Parameter #3(CF_SQL_CHAR) = 08
Parameter #4(CF_SQL_CHAR) = 09
Parameter #5(CF_SQL_CHAR) = 12

Before you ask: yes, it also works when there’s just a single item in the list (when the list is empty you shouldn’t be calling the query, right?).

There’s more to CFQUERYPARAM than this, of course: you can easily defer a part of your data validation to CFQUERYPARAM, but that’s another matter.

PS. My apologies to all Oracle specialists if I have used inprecise or incorrect terminology in this post – I hope the essence of my tip remains valid.

Read Full Post »

We’re having a bit of trouble with our ColdFusion applications (intranet apps, to be specific): at seemingly random intervals, the response of the application that is most used “degrades significantly”, to put it mildly. I don’t have a definitive and complete explanation at this time, but I’m certain that there’s a mix of multiple causes at play:

  • the number of users has grown during the last few years;
  • the infrastructure has become more complex;
  • the quality and structure of the code isn’t ideal for its current purpose.

All that means that we may well have hit a limit in the default ColdFusion 8 configuration parameters. And then there are the “bugs” as well, of course: superfluous code, duplicated method calls, inefficient database queries, etc.

I have been reading up a bit about CF and JVM configuration and debugging, and I certainly want to remember and (re)read the following items:

In 2009, I attended an excellent lecture by Grant Straker on the subject of CF performance tuning; unfortunately his book on the subject (at http://www.cfperformance.com) was rather specific on the CFMX family and is no longer available online – too bad ;-)

Of course, I’ll gladly accept references to other worthwhile material on this subject!

Read Full Post »

Just a quick note: I did finally find the time to re-test the ntlmHTTP project for ColdFusion after the installation of .NET 3.5 on our ColdFusion test server (check out my earlier posts on the subject). And yes, ntlmHTTP works – at least for accessing web pages that are protected by “Windows Integrated Authentication”. Next trials will try to access SharePoint 2010…

Read Full Post »

My ‘DotnetRuntimeEnvironment’ component for ColdFusion managed to surprise me: after installing the .NET framework 3.5 the ‘GetSystemVersion()‘ method still returned ‘2.0.50727‘, rather than the ‘3.5‘ or so I expected. It took some digging to find a decent explanation, but the reason appears to be mundane (at least for .NET experts): my component actually returns the version for the Common Language Runtime (CLR), and not for the whole framework (thank you, Jon Skeet!). The CLR is the runtime for the bytecode, comparable to the JVM in the Java universe.

This also means that more is needed to tell the exact .NET framework version you’re actively using – I suppose that trying to instantiate a class that first appeared in a given framework version would be a sufficient indicator. Oh well, back to the coding board, eh?

For completeness sake I can report that the code I published last week continues to work when multiple versions of .NET (CLR and/or framework) are installed on your machine.

Read Full Post »

I have been testing the ‘DotnetRuntimeEnvironment’ component I wrote about a week ago. Doing so also pointed to a better, more robust version. Here it is (the » symbol again means you should put what follows on the preceding line):

<cfcomponent name="DotnetRuntimeEnvironment" >

  <cfset VARIABLES.noruntime = "NORUNTIME" />
  <cfset init() />

  <cffunction name="init" access="private" returntype="void" output="false" >
    <cftry>
        <cfset VARIABLES.re = CreateObject( "dotnet",
             » "System.Runtime.InteropServices.RuntimeEnvironment" ) />
      <cfcatch type="any" >
        <cfset VARIABLES.runtime = "" />
      </cfcatch>
    </cftry>
  </cffunction>

  <cffunction name="isRunning" access="public" returntype="boolean" output="false" >
    <cfreturn IsObject( VARIABLES.runtime ) />
  </cffunction>

  <cffunction name="GetRuntimeDirectory" access="public" returntype="string" output="false" >
    <cfif IsObject( VARIABLES.runtime ) >
      <cfreturn VARIABLES.runtime.GetRuntimeDirectory() />
    <cfelse>
      <cfreturn "NONE" />
    </cfif>
  </cffunction>

  <cffunction name="GetSystemVersion" access="public" returntype="string" output="false" >
    <cfif IsObject( VARIABLES.runtime ) >
      <cfreturn VARIABLES.runtime.GetSystemVersion() />
    <cfelse>
      <cfreturn "NONE" />
    </cfif>
  </cffunction>

</cfcomponent>

This version will run on any platform, and give a reasonable answer for any method called – even when no .NET runtime can be found. The ‘isRunning()‘ method allows you to check  the existence of a .NET runtime before you try to work with other methods. As always, suggestions or additions are welcome!

Read Full Post »

Kevin Benore has attended a sneak preview of Zeus aka CF 10, and he has published a list of features of the next version of ColdFusion. I hope the final release (when?) will contain all items mentioned here (and more, of course). For me, the replacement of JRun by Tomcat and better WebService support are the most interesting and most wanted features.

Read Full Post »

I have had a bit of trouble to get ntmlHTTP running correctly on our servers. In response to my ticket on RiaForge, Nick Harvey clarified the dependence of the DLL on .NET version 3.5 (or higher, I suppose). I’m not a Windows nor a .NET specialist, and I don’t have many rights on the servers at work, so it took me and my collegue a bit of time to conclude that we were trying to run Nicks code on a .NET 2.0 base – and that didn’t work out, of course.

I already have a few ColdFusion pages with diagnostics about our servers, so I decided to do the right thing and add the .NET version to the existing diagnostics. It took me a while to find the exact class and method in the .NET runtime, but it turned out to be simple. So I have created a small ColdFusion CFC to help me (the » symbol means you should put what follows on the preceding line):

<cfcomponent
   name="DotnetRuntime" >

   <cfset VARIABLES.re = CreateObject( "dotnet",
             » "System.Runtime.InteropServices.RuntimeEnvironment" ) />

   <cffunction
      name="GetRuntimeDirectory"
      access="public"
      returntype="string"
      output="false" >

      <cfreturn VARIABLES.re.GetRuntimeDirectory() />

   </cffunction>

   <cffunction
      name="GetSystemVersion"
      access="public"
      returntype="string"
      output="false" >

      <cfreturn VARIABLES.re.GetSystemVersion() />

   </cffunction>

</cfcomponent>

Once you have that component, it’s pretty simple to use it – just put this in a .CFM (I’m supposing you have called your CFC ‘DotnetRuntime.cfc‘ in the current directory):

<cfsilent>
    <cfset dotnet = CreateObject( "component", "DotnetRuntime" ) />
</cfsilent>

<cfoutput>
   <html>
   <body>
      <h1>Dotnet Runtime Environment</h1>

      <p>
         This ColdFusion server is currently running <b>.NET version #dotnet.GetsystemVersion()#</b>
         from directory '<code>#dotnet.GetRuntimeDirectory()#</code>'
      </p>
   </body>
   </html>
</cfoutput>

So there you have it. I know this works in our setup, but I don’t know what will happen when there are multiple .NET runtimes on your machine… That’s why I wrapped the code into a CFC –  functions to detect specific versions of .NET, handle multiple runtimes, etc. can thus be added in a single component for easy versioning and maximum reuse. Suggestions or additions are welcome!

PS. I have left the “hint” attributes out of the code above, because I haven’t yet found a good way to publish program code in WordPress.

Read Full Post »

We have been trying out the 0.2 version of the ntlmHTTP project for ColdFusion, in order to see if we could call the SharePoint webservices. Unfortunately, POSTing a SOAP request never works: we always end up with a nasty error message for any of the new methods. Here’s a sample message:

System.MissingMethodException:
Could not find the generic method Com.Bluemini.CF.NetHttpRequest.setUsername

Decompiling the .class files that ColdFusion generates to integrate the DLL shows that the methods are there, just like a CFDUMP of the object we create. But CF8 (on a Windows 2003 server) seems unable to call them… I’ll download the source code and pass it on to our local .NET guru for examination. I’ll keep you posted about the results of our investigations (that may take a few days, though).

Read Full Post »

At work, we have tried the initial version of the ntlmhttp project on RiaForge (see my post from last week as well). We’re (still!) on CF8, installed in a minimal way, so I had to install the .NET integration layer first. But that is fairly simple:

When that is done, you just download the ntlmHTTP component.

  • Put the DLL on your file system, and write down the path.
  • Now run this script to check your installation:
    <cfset NetRequest = CreateObject( "dotnet", "Com.Bluemini.CF.NetHttpRequest", "/path/to/your/NetHttpRequest.dll") />
    <cfdump var="#NetRequest#" />

So far, so good: calling a (secured) webpage worked too. From the almost non-existent documentation it isn’t clear to me how we might use this to issue a SOAP request – we’ll see about that later.

When trying out the component with a web service call, I need to remember not to add the domain prefix to the username required in the call parameters. That’s different from what we need for our CFHTTP calls, but not too hard to do. I just wonder: is it the component that makes it possible to skip the domain name, or is it the configuration of our Windows network?

Read Full Post »

« Newer Posts - Older Posts »