Railo 3.1 is out

At the and arrived the day of the release of Railo 3.1. This is a milestone due to the fact that from this date Railo is officialy Open Source and most important joins a wide supported  project like Jboss.

Many news that I think will make the fortune of Railo that I am starting to consider any day more like my choice for the future:

Running Mango on Railo. Preserve single quotes issue.

mango blogTrying mangoblog on my Railo installation I found at once a bug that invole the different way that railo and cf have to preserve the single quotes in sql syntax where the sql statement is represented by variables.

Mango Blog use a class called QueryInterface where most of the query devoted to collect data ara executed and cached so to speed up teh next identical request.

The used method is this:

<code class="coldfusion">

<cffunction name="makeQuery" access="public" output="false" returntype="any">       
        <cfargument name="query" required="true" type="string">
        <cfargument name="cacheMinutes" required="false" type="numeric" default="-1">
        <cfargument name="returnResult" required="false" type="boolean" default="true">
       
        <cfset var customQuery = queryNew('id')/>
        <cfset var queryStatement = trim(arguments.query)>

        <cfif arguments.cacheMinutes GT -1 AND arguments.returnResult>
            <cfquery name="customQuery" datasource="#variables.datasource.name#"  username="#variables.datasource.username#" password="#variables.datasource.password#" cachedwithin="#createtimespan(0,0,arguments.cacheMinutes,0)#">
            #toString(queryStatement)#
            </cfquery>
        <cfelse>
            <cfquery name="customQuery" datasource="#variables.datasource.name#" username="#variables.datasource.username#" password="#variables.datasource.password#">
            #toString(queryStatement)#
            </cfquery>
        </cfif>
       
        <cfif arguments.returnResult>
            <cfreturn customQuery />
        </cfif>
       
    </cffunction>

</code>

As you see the sql syntax is represented by the variable queryStatement.

To be sure that the essential sinqle quotes are preserved Railo add an psq attribute:

<code class="coldfusion">
<cfquery name="q" datasource="dsn" psq="true">
.................

</code>

Since from cf8 this code is accettable also in coldfusion due to the added ability to pass an argumentcollection to most of the tags where only the recognized attributes are evaluated while the others are skipped.

But I didn't want to loose cf7 compatibility ( this will crash trying to evaluate the psq attributes )  so i tried to use, also for Railo ,the preserveSingleQuotes() function and surprise....is working just fine. Following Railo docs "psq" attributes should be the safest way but after about 2 weeks of runnign Mango with this change I am now convinced that preserveSingleQuotes() will server us ok in this case.

<code class="coldfusion"><cfif arguments.cacheMinutes GT -1 AND arguments.returnResult>
            <cfquery name="customQuery" datasource="#variables.datasource.name#"  username="#variables.datasource.username#" password="#variables.datasource.password#" cachedwithin="#createtimespan(0,0,arguments.cacheMinutes,0)#">
            #preserveSingleQuotes(queryStatement)#
            </cfquery>
        <cfelse>
            <cfquery name="customQuery" datasource="#variables.datasource.name#" username="#variables.datasource.username#" password="#variables.datasource.password#">
            #preserveSingleQuotes(queryStatement)#
            </cfquery>
        </cfif>

</code>

In this way we keep a full compaitbility from on cf7, cf8 and Railo too.

 

Jquery Ui 1.7

jqueryHas been released today version 1.7 of jquery UI library. I  have never used it so much but from this realease i think that UI becomes a valid options.

In my opinion the library has a big lack that is the fact that looks like the jquery team is not interested in developing also a data management tool to be use with the UI widgets but .... we can mix it with spry dataset or extjs stores.

Some of the biggest news from the jquery blog:

  • jQuery 1.3 compatibility

    jQuery 1.7 is the first release that is compatible with jQuery 1.3. That’s a good thing (if you can make the switch), since jQuery 1.3 brings major performance improvements to many areas of jQuery UI. Specifically, firing events, DOM operations, and getting element offsets have had massive performance improvements. More about the jQuery 1.3 release

  • Revamped and optimized plugins

    In addition to a long list of bug fixes and improvements, we’ve refactored and optimized each plugin to use the cleanest HTML possible, with a flexible set of options to make it easy for developers to extend and tweak widgets. We’ve also added a new progress bar plugin in this release.

  • CSS framework

    jQuery UI 1.7 is built upon a brand new and powerful CSS framework that is designed to support not only jQuery UI’s own plugins, but also custom plugin development, so any developer can easily make their plugins ThemeRoller ready. It is a special kind of CSS framework that is aimed specifically at user interface development as opposed to overall page layout. The framework provides classes for commonly used UI elements, states, containers and icons and is manipulated by jQuery UI ThemeRoller. More about the jQuery UI CSS Framework

  • Themeroller v2

    ThemeRoller has been completely redesigned to complement the new CSS framework and widget designs. ThemeRoller now resides in a vertical sidebar and has loads of new features. We also created a ThemeRoller Developer Tool (a bookmarklet, so you can bring ThemeRoller into any web page) and a Theme Switcher (so you can switch between themes with a simple drop-down box).

  • Demos & Documentation

    Maybe you’ve seen it already: We merged the top navigation links “Demos” and “Documentation” into a unified Demos & Documentation section, so it’s easy to browse demos and read the documentation all in one integrated experience. We’ve grouped demos of similar features and options together so you can easily tab from one to another and compare. As you navigate within a page, we update the URL to ensure accurate bookmarking and deep linking.

  • Full offline documentation

    Full documentation for each plugin is now included in the release. Just take a look at the /docs/ folder in the development bundle. There’s a separate (and simple) html file for each jQuery UI plugin method. There’s no styesheet for these files yet, but they’re quite functional even without. We’ll see about making it a little more like the website Demos & Documentation in a future release.

  • Major website improvements

    We refactored the download builder (using progressive enhancement, so it now works with JavaScript disabled) and integrated a base theme into the download along with a demo html file of all the widgets for easy integration. We refactored and improved the landing pages for the Development and Support sections to be more information-rich and up-to-date.

  • CSS framework and themes on Google AJAX Libraries API

    As before, the latest stable release of jQuery UI (now 1.7) is hosted on Google’s CDN. New in this release, however, Google is also hosting the new jQuery UI CSS Framework, as well as our current suite of pre-built themes: base, black-tie, blitzer, cupertino, dot-luv, excite-bike, hot-sneaks, humanity, mint-choc, redmond, smoothness, south-street, start, swanky-purse, trontastic, ui-darkness, ui-lightness, and vader.

  • Themes bundle

    You can now download all the ThemeRoller Gallery themes at once: jquery-ui-themes-1.7.zip. Or if you’re savvy with svn: http://jquery-ui.googlecode.com/svn/tags/1.7/themes/.

  • A new dedicated blog

    If you’re reading this, you probably know it already. We finally made the switch to our very own blog at http://blog.jqueryui.com/, where we’ll regularly blog about development, theming, and more during each release. To link the jQuery and jQuery UI blogs, Richard Worth is starting a “This week in jQuery UI” series on the jQuery UI blog, while Karl Swedberg (of learningjquery.com) will do a “This week in jQuery” series on the jQuery blog, and they will link to eachother.

 

Ses Url on railo and coldfusion on Jrun 4

Going on working with my new multiserver installation I falled into an issue that took me a bit of time to go throught.

I could normaly run my application using cf, railo and openbd but all the application was failing trying to call a ses url like:

<code class="coldfusion">http://railo/index.cfm/mypage/
</code>

The server is simply not able to find the .cfm mapping and just do not invoke any cfm engine like .cfm mapping was not in the url.... what made me think is that this happen only with the instances I added to jrun but not to the main cfusion server ( the ones that I installed jrun with ; in my case cf8 ).

I started look around and especially in the web.xml ( placed under the web-inf folder of any server instance ) file where mapping and settings for the jrun server instance are placed ( In my case file is here : C:JRun4serverscf7cfusion.earcfusion.warWEB-INFweb.xml) . With my surprise I found that in any cf instance added to Jrun this code is commented by default:

<code class="coldfusion"><!--Start Ses
  <servlet-mapping id="coldfusion_mapping_6">
     <servlet-name>CfmServlet</servlet-name>
     <url-pattern>*.cfml/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping id="coldfusion_mapping_7">
    <servlet-name>CfmServlet</servlet-name>
    <url-pattern>*.cfm/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping id="coldfusion_mapping_8">
    <servlet-name>CFCServlet</servlet-name>
    <url-pattern>*.cfc/*</url-pattern>
  </servlet-mapping>
  End Ses -->
</code>

Basically if you uncomment this code and restart the server also a mapping like : .cfm/page make the server invoking the coldfusion engine while before the jrun server simply was not able to recognize the mapping and was answering that no application was setted up to answer to the request.

While I solved the cf issue I found more problems to set up railo mapping cause as we all know jrun is not the railo "first choice" and settings are a bit different as in the default railo installation under Resin .... After some testing I added this code to C:JRun4servers ailoWEB-INFweb.xml , restared the server and also railo started to respond correctly...

<code class="coldfusion"><!--Start Ses -->
  <servlet-mapping>
     <servlet-name>CFMLServlet</servlet-name>
     <url-pattern>*.cfml/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>CFMLServlet</servlet-name>
    <url-pattern>*.cfm/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>CFMLServlet</servlet-name>
    <url-pattern>*.cfc/*</url-pattern>
  </servlet-mapping>
  <!--End Ses -->   
</code>

Please note that I need to restart completely Jrun and not only the railo instance to make chanhges being recognized. I am not sure wht ( probbaly some kind of main config cache ) but after restarting jrun also Railo instance started to work fine with ses url.

I have not yet solved the matter with openBd but I plan to look into it soon.

Xml parsing issue on railo and openbd.

RailoOpen bluedragon

As per my previous post I have installed Railo and Open BlueDragon on Jrun 4 as instances of a multiserver installation that also support cf8 and cf7.

Starting my tests I noted that both Railo and OpenBd in this particular configuration shows issues performing xml parse operations.

I got errors on both servers running code like:

<code class="coldfusion">
var xml = xmlParse(xml);
result = xmlSearch(xml,'/items/');
</code>

Googling around I discovered that Jrun miss some classes/configurations that both Railo and OpenBd native installtion provide.

I added this line in the java.config file as java.args ( I cut it for making it readable  but you must add it all in one line with no spaces ).

<code class="coldfusion">
-Djavax.xml.parsers.DocumentBuilderFactory=
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
</code>

Restart the server and the xml functionalities will be regulary available.

Installing Railo and Open BlueDragon with ColdFusion 8 Multiserver on JRUN4

RailoIn the last meeting of the Italian CFUG we got a very interesting speach about the ability to install coldfusion as multiserver ( Jrun 4 platform )  and the convenience to deploy under it more instances of coldfusion or  of any other JAVA J2EE Web or Enterprise Application. I so started my tests for setting up my personal test environment with Adobe cf, Railo and Openbd all deployed under the same multiserver installation.

I started my test installing Cf8 as multiserver and the process ended succesfully. Cf8 is now installed in c:\jrun4serverscfusion

At this poit Jrun 4 is installed and is reachable through port 8000.

I use IIS 7 locally so I decided to let coldfusion installer take care  of the appropriate settings over my default web site. Up to here nothing really changed in the ways I use cf: iis is correctly mapped, cf admin is always reachable through cfide an so on. What change is the fact the cf8 is now a single instance of a JRUN multiserver installation ready to receive and manage more applications.

Jrun 4

I downloaded Railo War file from here.

Back to the Jrun4 administrator I created e new server ( I called it Railo ) and this was confirmed on port 8302.

On the Pictures you see my Jrun4 with many instances already deployed so just keep them as example.

Follow the next steps:

1) Change the Railo.war file extension to .zip and unzip that.

2) Go to your {jrun4 folder}/servers/Railo/ and delete the default-ear folder. ( Optional but recomended )

3) In the Jrun4 admin panel select the railo server ( if is not running switch it on ) .Go to the J2EE Componenets tab and click on deploy in the Web Application Area .

Railo on jrun

4) Search the folder where you unzipped the war file and confirm. Wait the time jrun need to deploy railo and....maybe looks too easy but.....you are done. Railo is deployed and ready to serve your cfm pages.

You can now reach your railo installation like http://localhost:{installation port}/{server name - railo in my case}/railo-context/admin/server.cfm.

Railo on jrun

 

Now I have Railo installed and working but I want to set up a real test suite that gives me the ability to test the same code with different engine with no files copy or syncro.

1) Craete a new site in IIS ( I have IIS 7 on Vista ). Point it to your webroot ( in my case d:wwwroot ) and add a custom header like 'railo'.

2) In the Jrun administrator go in the J2EE components tab and click on the server name. In the Web Application Overviewwhere change your context root to "/" and point the document root to the position of your IIS wwwroot  ( d:wwwroot for me).

Railo on jrun

3) Now we need to set up our web server. In your jrun installation folder go in the bin folder and open the wsconfig file. A java tool will open up.
Click on Add. Select railo as jrun host, IIS as web server and railo as the site name we want to configure. Click on advanced and add .cfm and .cfc as mimtypes. Confirming the  tool will add the correct mapping to your IIS 7 so that the railo web site will use railo engine and not cf8 for processing cfm and cfc files.

4) As last step open your host file .
On vista should be something like : C:WindowsSystem32driversetchosts

Add this 2 line :

127.0.0.1        railo
127.0.0.1        cf8

Save and close the file.

Now if you open your browser and try to call http://cf8/ the call will be directed to 127.0.0.1 and in my case will call the IIS default web site.

But if I call http://railo/ my IIS is setted to recognice railo as railo web site header and process cfml using railo engine.

For testing it I simply put an index.cfm file under wwwroot with this call inside:

Testing jdk 1.6.0_11

I have made a fast speed test to see how much the new jdk has increased my cf8 speed.

The test was very easy and consisting on the looping 1000 times around a createObject statement and run a simple init method on each like following:

Learning Ext.js

learning ext

I have recently read the first book written about the js library Ext.js.

The book is written bye : Shea Frederick, Steve 'Cutter' Blades and Colin Ramsay.

I was a bit afraid of bying the very first book about Ext and honestly I have to say that after the first 2 chapters my doubts were growing very fast.

Infact the book in the firsts chapters tends to treat really basic arguments with a very scholastic approach. Many writer tend to start their books with quite basic staff but in this case  think the first 30/40 pages could have a had a better use.

After that things start to get interesting. The book analize Ext approaching the Form api passing then to Grids, Tree, Layout Drag and Drops etc... Any macro area of the Api is analyzed with some working example and many suggestion and tips.

The examples for any argument are well documented and explained.

I also appreciated the fact that the authors spent a lot of pages giving tips or ideas on how the example could be coded in a different way pushing the reader to explore more the Ext Api.

And here was the big surprise about Ext. Following the book examples I found a lot of Ext features that are are documented only in the api  with no higlight in extjs web site or forums.

I so discovered how really work the store class and the easy that is to implement your application ( also without usign ext widgets ) using the Store class as your dataset repository. This makes your app really agnostic about the data format you are receiving. Ext map the data using a reader class and makes your application not coupled to the kind of data format ( array, json, xml ) that your application is receiving.

I was also impressed about the gris and especially working with the inline editing. Ext is able to make your data persist on client marking as dirty the modified elements up to the data commit. Amazing.

So. I was surprised about Ext power and  stability.

I have already started to play with the library widgets ( but I am also considering the Ext Data funsctionality with no Ext widget support )  and I really want to recomend the book that can really open your eyes to the Ext powerfull World.

 

 

jdk1.6.0_11 speed up coldfusion createObject

During 2008 many posts in the cf community proved how a bug in the java 1.6 jdks was slowing down the creation of coldfusion objects.

Jquery 1.3 and Sizzle

One of the most interesting thing of the new jquery release ( 1.3.1 with bug fixing ) is the new css selctor engine called "Sizzle".