<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gruchalski.com &#187; CFML</title>
	<atom:link href="http://gruchalski.com/category/cfml/feed/" rel="self" type="application/rss+xml" />
	<link>http://gruchalski.com</link>
	<description>confessions of a ria developer</description>
	<lastBuildDate>Tue, 15 Dec 2009 23:41:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ColdFusion compiler is broken</title>
		<link>http://gruchalski.com/2009/09/22/coldfusion-compiler-is-broken/</link>
		<comments>http://gruchalski.com/2009/09/22/coldfusion-compiler-is-broken/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 10:09:33 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=363</guid>
		<description><![CDATA[Following on a tweet from Sean Corfield, I couldn&#8217;t believe it is possible to create a function called if, else, while and so on as well as declare variable called var. Here is the code that may hurt your head:


&#60;cffunction name=&#34;if&#34;&#62;
	&#60;cfargument name=&#34;val1&#34; /&#62;
	&#60;cfargument name=&#34;val2&#34; /&#62;
	&#60;cfif val1 eq val2&#62;
		&#60;cfreturn true /&#62;
	&#60;/cfif&#62;
	&#60;cfreturn false /&#62;
&#60;/cffunction&#62;
&#60;cffunction name=&#34;hello&#34;&#62;
	&#60;cfset var var [...]]]></description>
			<content:encoded><![CDATA[<p>Following on <a href="http://twitter.com/seancorfield/status/4113568458">a tweet</a> from Sean Corfield, I couldn&#8217;t believe it is possible to create a function called <em>if</em>, <em>else</em>, <em>while</em> and so on as well as declare variable called <em>var</em>. Here is the code that may hurt your head:</p>
<pre>
<pre class="brush: cf;">
&lt;cffunction name=&quot;if&quot;&gt;
	&lt;cfargument name=&quot;val1&quot; /&gt;
	&lt;cfargument name=&quot;val2&quot; /&gt;
	&lt;cfif val1 eq val2&gt;
		&lt;cfreturn true /&gt;
	&lt;/cfif&gt;
	&lt;cfreturn false /&gt;
&lt;/cffunction&gt;
&lt;cffunction name=&quot;hello&quot;&gt;
	&lt;cfset var var = 2 /&gt;
	&lt;cfreturn var /&gt;
&lt;/cffunction&gt;
&lt;cfif if( hello(), 2 )&gt;
	LOL
&lt;/cfif&gt;
</pre>
</pre>
<p>How cool is that ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/09/22/coldfusion-compiler-is-broken/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ColdFusion to Flex serializer needs better error messages</title>
		<link>http://gruchalski.com/2009/09/02/coldfusion-to-flex-serializer-needs-better-error-messages/</link>
		<comments>http://gruchalski.com/2009/09/02/coldfusion-to-flex-serializer-needs-better-error-messages/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 09:44:03 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Moan]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=353</guid>
		<description><![CDATA[I&#8217;m using Flex with ColdFusion for a long time now but sometimes I really can&#8217;t stand these two products together. I&#8217;m sending nested CFCs through the remote object back to Flex so ColdFusion has to serialize them to the form that may be understood by Flex. But I&#8217;ve got an error, somewhere I have an [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using Flex with ColdFusion for a long time now but sometimes I really can&#8217;t stand these two products together. I&#8217;m sending nested CFCs through the remote object back to Flex so ColdFusion has to serialize them to the form that may be understood by Flex. But I&#8217;ve got an error, somewhere I have an empty string where number is expected. You would expect that CF is smart enough to tell you what the problem is? Nope, it says:</p>
<p><code>Unable to invoke CFC - The value '' cannot be converted to a number.</code></p>
<p>And here is the stack trace:</p>
<pre>
<pre class="brush: cf;">
        [0] &quot;coldfusion.runtime.Cast._double(Cast.java:652)&quot;
        [1] &quot;coldfusion.runtime.Cast._double(Cast.java:632)&quot;
        [2] &quot;coldfusion.runtime.Cast._double(Cast.java:786)&quot;
        [3] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:545)&quot;
        [4] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:494)&quot;
        [5] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:387)&quot;
        [6] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:81)&quot;
        [7] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:512)&quot;
        [8] &quot;coldfusion.flash.messaging.io.amf.Translator.CFASSerializer.translate(CFASSerializer.java:494)&quot;
        [9] &quot;coldfusion.flash.filter.CFCInvokeFilter.invoke(CFCInvokeFilter.java:160)&quot;
        [10] &quot;coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)&quot;
        [11] &quot;coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)&quot;
        [12] &quot;coldfusion.flash.filter.CFCInvokeDebugFilter.invoke(CFCInvokeDebugFilter.java:54)&quot;
        [13] &quot;coldfusion.flash.filter.CFCInvokePathFilter.invoke(CFCInvokePathFilter.java:70)&quot;
        [14] &quot;coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)&quot;
        [15] &quot;coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)&quot;
        [16] &quot;coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)&quot;
        [17] &quot;coldfusion.flash.messaging.ColdFusionAdapter.invoke(ColdFusionAdapter.java:223)&quot;
        [18] &quot;flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:173)&quot;
        [19] &quot;flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1165)&quot;
        [20] &quot;flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:757)&quot;
        [21] &quot;flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:117)&quot;
        [22] &quot;flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)&quot;
        [23] &quot;flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:48)&quot;
        [24] &quot;flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)&quot;
        [25] &quot;flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:145)&quot;
        [26] &quot;flex.messaging.endpoints.AMFEndpoint.service(AMFEndpoint.java:122)&quot;
        [27] &quot;flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java:438)&quot;
        [28] &quot;coldfusion.flex.ColdFusionMessageBrokerServlet.service(ColdFusionMessageBrokerServlet.java:50)&quot;
        [29] &quot;javax.servlet.http.HttpServlet.service(HttpServlet.java:853)&quot;
        [30] &quot;coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)&quot;
        [31] &quot;jrun.servlet.FilterChain.doFilter(FilterChain.java:86)&quot;
        [32] &quot;coldfusion.filter.FlashRequestControlFilter.doFilter(FlashRequestControlFilter.java:71)&quot;
        [33] &quot;coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)&quot;
        [34] &quot;jrun.servlet.FilterChain.doFilter(FilterChain.java:94)&quot;
        [35] &quot;jrun.servlet.FilterChain.service(FilterChain.java:101)&quot;
        [36] &quot;jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)&quot;
        [37] &quot;jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)&quot;
        [38] &quot;jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)&quot;
        [39] &quot;jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)&quot;
        [40] &quot;jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)&quot;
        [41] &quot;jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)&quot;
        [42] &quot;jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)&quot;
        [43] &quot;jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)&quot;
        [44] &quot;jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)&quot;
</pre>
</pre>
<p>Helpful, heh?</p>
<p>Why, WHY! it does not say what property is causing the problem? Surely it knows, it just keeps it for itself. Adobe &#8211; please fix!</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/09/02/coldfusion-to-flex-serializer-needs-better-error-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Railo, BlazeDS and CFC instances</title>
		<link>http://gruchalski.com/2009/04/20/railo-blazeds-and-cfc-instances/</link>
		<comments>http://gruchalski.com/2009/04/20/railo-blazeds-and-cfc-instances/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:34:09 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[Railo]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=103</guid>
		<description><![CDATA[There is a lot of buzz recently around Railo since version 3.1 finally went open source and many well known CF developers joined the project. This gave me the motivation to finally see how Railo really works. I decided to give it a shot on one of already running applications. The choice was made, I [...]]]></description>
			<content:encoded><![CDATA[<p>There is a lot of buzz recently around <em><a href="http://getrailo.org">Railo</a></em> since version 3.1 finally went open source and many <a href="http://www.markdrew.co.uk">well</a> <a href="http://www.pbell.com">known</a> <a href="http://corfield.org">CF developers</a> joined the project. This gave me the motivation to finally see how Railo really works. I decided to give it a shot on one of already running applications. The choice was made, I selected a Flex application powered by ColdFusion 8.1 utilizing Adobe ColdFusion classes, providing 20 different gateways, using ODBC data sources and operated with very rich and sophisticated Flex UI exchanging data using typed VOs.</p>
<p>First experience was great. No issues at all, application started very quickly, what takes about 20 seconds on ColdFusion is almost immediate on Railo. All CFCs worked fine, even those using internal ColdFusion classes. Overall performance was fantastic, all JDBC ODBC connections running smoothly. I have to admit that Railo guys have done really great job.</p>
<p>It was time to test Flex UI, a major issue popped out straight away. Railo provides integration with Adobe&#8217;s open source Blaze Data Services. It&nbsp;appears to work perfectly fine with all standard CFML types, strings, structures, arrays, etc., however not with CFCs. At the current state Railo is not able to serialize and deserialize them. Below is the sample test case.</p>
<p><em>Service.cfc</em> that Flex talks to:</p>
<pre>
<pre class="brush: cf;">
&lt;cfcomponent&gt;

  &lt;!---
    Accepts a CFC instance: ---&gt;
  &lt;cffunction name=&quot;getCfc&quot; access=&quot;remote&quot; output=&quot;false&quot; returntype=&quot;string&quot;&gt;
    &lt;cfargument name=&quot;inst&quot; type=&quot;com.gruchalski.railo.test.TestCFC&quot; required=&quot;true&quot; /&gt;
    &lt;cfreturn &quot;ok&quot; /&gt;
  &lt;/cffunction&gt;

  &lt;!---
    Returns a CFC instance on request: ---&gt;
  &lt;cffunction name=&quot;outCfc&quot; access=&quot;remote&quot; output=&quot;false&quot; returntype=&quot;com.gruchalski.railo.test.TestCFC&quot;&gt;
   &lt;cfset var inst = createObject(&quot;component&quot;, &quot;com.gruchalski.railo.test.TestCFC&quot;) /&gt;
   &lt;cfset inst.property1 = &quot;Hello from Railo&quot; /&gt;
   &lt;cfset inst.property2 = 20 /&gt;
   &lt;cfreturn inst /&gt;
  &lt;/cffunction&gt;

&lt;/cfcomponent&gt;
</pre>
</pre>
<p>And here is the source of <em>com.gruchalski.railo.test.TestCFC</em>:</p>
<pre>
<pre class="brush: cf;">
&lt;cfcomponent&gt;
  &lt;cfproperty name=&quot;property1&quot; type=&quot;string&quot; /&gt;
  &lt;cfproperty name=&quot;property2&quot; type=&quot;numeric&quot; /&gt;
  &lt;cfset this.property1 = &quot;&quot; /&gt;
  &lt;cfset this.property2 = 0 /&gt;
&lt;/cfcomponent&gt;
</pre>
</pre>
<p>To access the service I am using following Flex application:</p>
<pre>
<pre class="brush: as3;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;&gt;

  &lt;mx:Script&gt;
    &lt;![CDATA[
      import mx.utils.ObjectUtil;
      import mx.rpc.events.ResultEvent;
      import mx.controls.Alert;
      import mx.rpc.events.FaultEvent;
      import com.gruchalski.railo.test.TestCFC;

      private function sendInst():void {
        var inst:TestCFC = new TestCFC();
        inst.property1 = &quot;Ħello Railo!&quot;;
        inst.property2 = 10;
        testService.getCfc( inst );
      }

      private function loadInst():void {
        testService.outCfc();
      }

      private function onFault(event:FaultEvent):void {
        Alert.show(event.fault.message);
      }
      private function onResult(event:ResultEvent):void {
        Alert.show( ObjectUtil.toString( event.result ) );
      }

    ]]&gt;
  &lt;/mx:Script&gt;

  &lt;mx:RemoteObject id=&quot;testService&quot; source=&quot;Service&quot; destination=&quot;ColdFusion&quot;
    endpoint=&quot;http://localhost:8888/flex2gateway&quot;
    fault=&quot;onFault(event);&quot;
    result=&quot;onResult(event);&quot; /&gt;

  &lt;mx:Button label=&quot;Get CFC from Railo&quot; click=&quot;loadInst();&quot; /&gt;
  &lt;mx:Button label=&quot;Send CFC to Railo&quot; click=&quot;sendInst();&quot; /&gt;

&lt;/mx:Application&gt;
</pre>
</pre>
<p>with this <em>com.gruchalski.railo.test.TestCFC</em> VO:</p>
<pre>
<pre class="brush: as3;">
package com.gruchalski.railo.test {

  [RemoteClass(alias=&quot;com.gruchalski.railo.test.TestCFC&quot;)]
  public class TestCFC {
    public var property1:String = &quot;&quot;;
    public var property2:Number = 0;
  }
}
</pre>
</pre>
<p>When loading a CFC instance following issue is reported:</p>
<p><q><em>faultCode:Server.Processing faultString:&#8217;An error occurred while serializing server response(s).&#8217; faultDetail:&#8217;null&#8217;</em></q></p>
<p>In case of sending a VO:</p>
<p><q><em>faultCode:Server.Processing faultString:&#8217;flex.messaging.MessageException: railo.runtime.exp.UDFCasterException : invalid call of the function getCfc, first Argument (INST) is of invalid type, can&#8217;t cast Object type [Struct] to a&nbsp;value of type [com.gruchalski.railo.test.TestCFC]&#8216; faultDetail:&#8217;null&#8217;</em></q></p>
<p>First one is obvious, BlazeDS does not know how to serialize CFC provided by Railo. Second issue is probably caused by the fact that Railo does not treat <em>magic structures</em> as CFCs. What I call a <em>magic structure</em> looks like this:</p>
<pre>
<pre class="brush: cf;">
&lt;cfscript&gt;
  struct = structNew();
  struct.property1 = &quot;Some property&quot;;
  struct.property2 = 20;
  struct.__type__ = &quot;com.gruchalski.railo.test.TestCFC&quot;;
&lt;/cfscript&gt;
</pre>
</pre>
<p>When structure like that comes from the outside world or is being sent to outside world (for example BlazeDS iteraction or SOAP request) Adobe ColdFusion treats it as a CFC instance.</p>
<p>Despite the issue I think Railo is a very good choice in its current state. For most small applications current BlazeDS integration level is enough, new applications can easily use what is there right now. And I&nbsp;am sure that Railo team is working hard to enable full support.</p>
<p>It is good however to know the limitations before making the switch to Railo, specially when so many people consider to do so.</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/04/20/railo-blazeds-and-cfc-instances/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Local function variables and parameters in ColdFusion and Railo</title>
		<link>http://gruchalski.com/2009/04/16/local-function-variables-and-parameters-in-coldfusion-and-railo/</link>
		<comments>http://gruchalski.com/2009/04/16/local-function-variables-and-parameters-in-coldfusion-and-railo/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:21:25 +0000</pubDate>
		<dc:creator>radekg</dc:creator>
				<category><![CDATA[CFML]]></category>

		<guid isPermaLink="false">http://gruchalski.com/?p=72</guid>
		<description><![CDATA[Today I was doing some heavy refactoring on a project I am working for quite a long time. Moving methods, changing arguments, removing unnecessary CFCs. We are using PDF and XML merging so the project utilizes Adobe ColdFusion. Now, I am using Adobe CF for like 7 years now, I thought I know it well. [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was doing some heavy refactoring on a project I am working for quite a long time. Moving methods, changing arguments, removing unnecessary CFCs. We are using PDF and XML merging so the project utilizes Adobe ColdFusion. Now, I am using Adobe CF for like 7 years now, I thought I know it well. While testing changes I have been stopped by an error saying &quot;local variable X declared twice&#038;quot. Something wasn&#8217;t right there, I just moved few methods to different components and changed few argument names. It took me good 5 minutes to figure out (even though, what I found out later, the error message was explicitly saying it) that the problem was caused bu using the same function parameter and local variable names. This was very confusing, in any other programming language I used before such an issue doesn&#8217;t exist, that was probably why I did not notice I am doing something wrong. To make sure I am right I created this sample CFC.</p>
<pre>
<pre class="brush: cf;">
&lt;cfcomponent&gt;
  &lt;cffunction name=&quot;testFunc&quot;&gt;
    &lt;cfargument name=&quot;arg1&quot; type=&quot;numeric&quot; /&gt;
    &lt;cfset var arg1 = &quot;&quot; /&gt;
  &lt;/cffunction&gt;
&lt;/cfcomponent&gt;
</pre>
</pre>
<p>And I called it in the browser. ColdFusion confirmed my assumption. My first thought was &quot;hang on, is this a general CFML issue or just another bit that isn&#8217;t working correctly just in Adobe ColdFusion&quot;? I started Railo and created exactly the same CFC. It appears that in Railo it is working as expected, calling the CFC with <em>?wsdl</em> option returns WSDL definition.</p>
<p>Definitely a hint to remember.</p>
]]></content:encoded>
			<wfw:commentRss>http://gruchalski.com/2009/04/16/local-function-variables-and-parameters-in-coldfusion-and-railo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
