Entries Tagged as 'Coldfusion9'

Submit form to CFWINDOW

Posted by Pritesh on January 24, 2012
  0 comments

 

This may be wrost title. Basically I need to submit form and submit page should render in cfwindow object, another issue was there are some javascript code/function on my submit page as well which should be render to. 

Normally CFWINDOW will execute script of rendering page and you many not able to call function defined in rendering page. Below code how you can submit form to CFWINDOW with loading script as well.

 




Work around ColdFusion local scope

Posted by Vikas on August 19, 2011
  0 comments

Hi friends,

 

These days am working as a tester. I never thought that developer can also do that if they really take interest in testing! Infect someone can also learn from the testing, even testing can also test their understanding for knowledge.

 

While testing I saw one case where I get more variable in the array object other then I defined. Then I again take a look and I came to know that local variable was causing an issue.

Let me give you some examples and exercise. Make sure that before you see the output just think what would be the output. Consider that all following code is written in sample cfml page and we are using ColdFusion 9.




Bug - count() function in ColdFusion query of query

Posted by Vikas on August 17, 2011
  0 comments

 

Hi,

It has been a great time since I started working on ColdFusion. I must say that it is the easiest language in the world and yet it is a powerful and can be compared to any major programming language.

In last few days, I was using ColdBox and MockBox framework in our current project. I was using query of query which is very similar to SQL query, and we can use it over query object in ColdFusion.

Count() is a math function, but if we use it with select statement like count(*), it returns a number of rows fetched in select query. I used it query of query, and it was giving me the correct count if my select statement is returning some rows, but if it is not returning any row then ideally it should give 0 as output, but it gives [empty string].

 




How to use query of query in cfscript

Posted by Nirav Patel on August 06, 2011
  0 comments

We can use queries of queries in cfscript with the Query.cfc. But this is possible in Coldfusion 9 because Query.cfc has introduced in Coldfusion 9.

Let's see the following code.

<cfquery name="qRead" datasource="#application.dsn#" username="#application.dbuid#" password="#application.dbpwd#">
    SELECT employeeId,fistName,LastName FROM employees
</cfquery>
<cfscript>
    qoq = new Query(sql="select * FROM qRead WHERE employeeId=1", dbtype="query", qRead = qRead);
    qList = qoq.execute().getResult();
</cfscript>

I am just passing the my sql statement to sql argument and the dbtype value will be the 'query'. Here I'm pass qRead as the 3rd argument. If I am not pass this qRead then I got error as :

Error Executing Database Query. Query Of Queries runtime error. 
Table named qRead was not found in memory. The name is misspelled or the table is not defined.

This is because, I have the qRead in my cfml page's variable scope but I'm trying to execute the query of query on the Query.cfc and qRead was not on cfc's variable scope. Both the cfml page's variable scope and the cfc's variable scope are different and they do not have access to eachother.

But when I'm passing the qRead as argument, the init() function of the Query.cfc copy the named arguments into the local Variables scope and then while executing the query of query qRead available in the variable scope of the Query.cfc and we got the result.

 

For better understanding please see the blog from Ben Nadel:

http://www.bennadel.com/blog/2224-Performing-Query-Of-Queries-Using-ColdFusion-9-s-Query-cfc-Component.htm




Load balancing with Apache Tomcat on ColdFusion standard version

Posted by Pritesh on February 25, 2011
  0 comments

This one is actually part-ii of my first blog “Running multiple tomcat instances with Coldfusion standard version - Part I” but to make it more meaningful I have changed title of this Post.


In previous post we have run single site on two instance of tomcat and on different port. Now time to run both instance under single website URI with load balancing for high availability under Apache server.


Let's install Apache http server using downloaded .msi, to avoid security issue and spacing in path I prefer to install “C:\Apache2.2” [APACHE_HOME] and make sure it is pointing to port 80. Once finish with installing browse URL http://localhost to make sure Apache server is configured and running correctly. To perform load balancing on two tomcat instance download mod_jk. Use Binary releases link and choose your appropriate platform and download file mod_jk-1.2.31-httpd-2.2.3.so. Copy it to APACHE_HOME/modules folder and rename it to mod_jk.so.




Running multiple tomcat instances with Coldfusion standard version - Part I

Posted by Pritesh on February 25, 2011
  0 comments

Since couple of weeks I was working with Railo and ColdFusion 9 (standard edition) to clustering and load balancing. I have started with Railo as I was new to Railo and keen to work around it. I wrote several post about Railo installation
Installing RAILO Tomcat on windows step by step
Installing RAILO Tomcat on windows step by step - part ii
Running multiple instances of RAILO on tomcat.

Now it turn of ColdFusion for load balancing. I have googled it about but mostly found articles with enterprise edition and it is easy to implement but I want to work with developer/standard edition. Below is step by step instruction to running multiple ColdFusion (standard edition) instances on one computer.




Updating coldfusion 9.0.0 to 9.0.1

Posted by Pritesh on December 13, 2010
  0 comments

Updation of ColdFusion is always painful for me. I am working on ERP level projects which is build on ColdFusion and we have heavily used ColdFusion inbuilt AJAX funtionality, everybody knows that CF use EXTJS for their new ajax component and my favorites are cfgrid, cflayout. But what CF is provide is not always sufficient for client specially working with large project. I have modified cfgrid to put header toolbar and in footer I want to display number of records available etc.

I have started this in ColdFusion 8 and I found really easy to implement it using EXTJS API but when we update it to 9.0 we face lots of issue because of Adobe has started using EXTJS 3.0 instead 1.0 (see blog ) and now again in version 9.0.1 they started using 3.1 and this raise some issue again. This time CF team make this little bit easier for me, they have added new coldfusion javascript function to get header element of cfgrid (ColdFusion.Grid.getTopToolbar).

Below will the code for adding header toolbar in CFGRID.



    var Qcomm = ColdFusion.Grid.getTopToolbar('testgrid');
    Qcomm.add(
            {
                text:"<img src='/images/remove_filter.jpg' title='Remove Filter'>",
                cls:"x-btn-text",
                tooltip:"Remove Filter",
                handler: function(){//code to remove filter.}
              },
            {
             text:"<img src='/images/icon_refresh.gif' title='Refresh'>",
               cls:"x-btn-text",
               tooltip:"Refresh",
               handler: function(){ColdFusion.Grid.refresh('testgrid');}
              },
            {
             text:"<img src='/images/acceptall.gif' title='Accept Communication(s)'>",
               cls:"x-btn-text",
               tooltip:"Accept Invoice(s)",
               handler: function(){}
            }
    );
    
    ColdFusion.Grid.showTopToolbar(this.gridName);


First line get header of cfgrid and then added extjs element into toolbar and finally call showTopToolbar function to render it on grid.

 

Hope this help...

PS.: this code only work with update 9.0.1 as getTopToolbar function introduce in this function.




Automated tests using Ant integration of testing frameworks - cfunit, cfcunit and mxunit

Posted by Vikas on September 24, 2010
  0 comments

If you have seen my previos post, then you might want to automate testing. You can automate all three popular testing frameworks (cfunit, cfcunit and mxunit) with ant.

I've tested in eclipse 3.6 version, but it will aslo work in Adobe ColdFusion Builder.




cfajaxproxy issue with ColdFusion 9.0.1

Posted by Pritesh on July 15, 2010
  0 comments

I was really happy when I heard about coldfusion 9.0.1 update and specially because of Amazon S3 could support. Recently I have started working with Amazon S3 Cloud service and writing function for all API call, when I see that new update for ColdFusion having amazon S3 cloud support and I can not stop myself to update it on my development server and my hard time start from here...