Daylight Saving Time Revisited

I've posted about DST issues in the past, but we recently had an issue at work so I thought I'd share my findings again. According to the Adobe Technote "Working with daylight savings [sic] time in ColdFusion MX":

The current time is calculated correctly in Macromedia ColdFusion MX and higher, regardless of whether the Automatically Adjust Clock for Daylight Saving Changes option is enabled or disabled in the computer's Control panel Date/Time Properties. In previous versions of ColdFusion, the current time would be offset by one hour when this option was disabled.

[More]

cfObjective

I just signed up for cfObjective! I'm looking forward to the conference as this will be the first one I've attended since CFUN 04. The sessions look awesome and it will be great to get a chance to meet some of the folks in CF community face to face. I hope to see some of you there...

Reactor and MS SQL uniqueidentifiers

I ran into an issue last week while trying to use MGU scaffolding with a table which had a uniqueidentifer primary key. If a uniqueidentifer field has a default value of "(newid())" then it seemed to me that the reactor generated project TO should set a default value for that field, however this was not happening. I did some digging and found that due to a bug in the MS SQL ObjectDao.cfc the field's default value is not properly set. The problem is that the ObjectDao's getDefault method has a case statement based on the cfDataType of the field, however the case near line 128 is for the dbDataType "uniqueidentifier." I updated that case statement to the following and it seemed to resolve the issue.

<cfcase value="guid">
<cfif ReFindNoCase("'*newId()'*", arguments.sqlDefaultValue)>
<cfreturn "##Insert(""-"",CreateUUID(),23)##" />
<cfelse>
<cfreturn "" />
</cfif>
</cfcase>

This code will create valid MS GUIDs for the TO default value. Given this and the fact that the validator will check that TO uniqueidentifier fields match the MS GUID format, I also simplified the dao.project.xsl by removing the statements for uniqueidentifer dbdatatypes. (The uniqueidentifer values should be valid MS GUIDs so there is no need to do conversion in the DAO.)

I submitted this as Reactor Ticket #122 if you care to track this issue or download the actual patches.

Reactor and Aliased Linked Relationships

Earlier today Doug Sims posted about the difference between "relate" and "link" in Reactor's XML configuration. After reading Doug's post I thought I'd share an issue I ran into earlier this week using linked relationships.

[More]

CF Debug Copy for FireFox

Well, now that the classic debug output has been render obsolete by Ray Camden and Adam Podolnick's ColdFire I have finally finished the FireFox version of CF Debug Copy. To install just click the link below.

Install CF Debug Copy for FireFox

This version has one minor improvement over the IE version: if the number of question marks in the query doesn't match the number of queryparams found the copied content is left unchanged. Otherwise it should work just like the IE version.

As always let me know if you have any problems. Also, I'm thinking about moving these projects to RIAForge, I just need to figure out which license to use.

Update 5/17/2007

I've updated the extension to work with frames.

Fun Night In Philly

Tonight was a pretty fun night for me here in Philly. It started out with the Philly CFUG Meeting where I got to hear Adam Lehman talk about building Flex applications with ColdFusion. It was a great presentation especially for those who, like me, haven't taken a look at Flex 2 yet. After seeing this talk Flex is definitely on my list of things to check out soon.

After the CFUG meeting my wife and I were off to the Electric Factory to see the Shins play. This was my first time to the Electric Factory -- in fact this was the first show I've been to in Philly. The Shins were pretty good, and the Electric Factory was OK. I've seen better Shins shows and the venue was a little big for my taste, but it was still a blast.

At the end of the night I ended up with a cool Adobe Flex 2.0 t-shirt which I won in a drawing at the CFUG meeting and my daughter ended up with a very cool Shins onesie which my wife and I bought for her at the show. (This was the first show my wife and I have been to since our daughter was born so when we saw the onesies there was no we were going home without one.)

CF Debug Copy for Internet Explorer

So I've been using my CF Debug Extension for SQL Explorer for a few months now. It works great when I just need to run a query to see the results. However, when I need to actually refine a query, which is quite often, I find that I usually end up copying the query from SQL Explorer to MS SQL Query Analyzer. This is because I have the excellent SQL Prompt plugin for Query Analyzer which makes looking up tables and columns a snap. (SQL Explorer is supposed to have code assistance but I haven't been able to get this to work.) I've found myself doing this double copy and paste more and more over the past few weeks so I decided to put something together that would let me skip the SQL Explorer step entirely. Introducing CF Debug Copy for Internet Explorer.

[More]

ajaxCFC and 0 Return Values

I've been using ajaxCFC on a project at work and I ran into an issue today which I thought I'd share.

Say you have a simple ajax component:

<cfcomponent extends="ajax">   
   <cffunction name="echo" output="no" access="private">
      <cfargument name="num" required="yes" type="numeric">      
      <cfreturn val(arguments.num) />
   </cffunction>
</cfcomponent>

You set up a call to this method like so:

<html>
<head>
   <title>echo number example</title>
   <script type='text/javascript'>
      _ajaxConfig = {   '_cfscriptLocation':'echoNumber.cfc',
                  '_jsscriptFolder':'../js',
                  'debug':true};
   </script>
   <script type='text/javascript' src='../js/ajax.js'></script>
   <script type="text/javascript">
      function doEcho()   {
         DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'echo', 0, doEchoResult);
      }

      // call back function       function doEchoResult (r) {
         alert(r);
      }

   </script>
</head>
<body onload="doEcho();">
   <p>Nothing Happens!</p>
</body>
</html>

This results in the following response:

HTTP/1.1 200 OK
Connection: close
Date: Wed, 07 Mar 2007 18:14:36 GMT
Server: Microsoft-IIS/6.0
Content-Type: text/html; charset=UTF-8


_3952_1173291282046 = 0;

DWREngine._handleResponse('3952_1173291282046', _3952_1173291282046);

This looks fine, however the callback function doEchoResult never gets called. The reason is the DWREngine._handleRespone function checks the result before calling the callback function.

DWREngine._handleResponse = function(id, reply) {
...
if (handlers && reply) {
...
try {
if (handlers.callback) handlers.callback(reply);
}
catch (ex) {
DWREngine._handleMetaDataError(handlers, ex);
}
}
...
}

The problem here is that the reply argument (the _3952_1173291282046 variable in this example) will be evaluated to false so the callback never gets called.

Now the DWREngine code could be updated to handle this by checking that reply != null, however I'm a little leary of changing core framework code. Plus I haven't really taken a good look at the DWREngine code to know if this will cause any other issues. In the end I decided to modify my component function to work around this issue rather than change the core ajaxCFC files. I've submitted a bug to the RIAForge project, so this may get fixed in a future release. (Or maybe Rob Gonda will chime in and tell me I'm doing things all wrong. :)

Another CF Debug SQL Explorer Extension Update

Here is another update for the CF Debug Extension to the SQL Explorer Plugin. The extension wasn't properly handling yes/no true/false values for cf_sql_bit queryparams. This update fixes the issue.

To get the latest version of the extension click the download link at the bottom of this entry, between the send and del.icio.us links. (You may need to right click and "Save Link As...")

Web Services and Nulls

With all of the talk about null values today I thought I'd throw my hat in the ring and talk about one other area where null values can be an issue: web services. Some web services may expect null values for empty arguments and others may expect the empty argument to be left out of the request completely. Fortunately ColdFusion has a way of handling this via omit attribute of the <cfinvokeargument> tag.

[More]

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.