Entries Tagged as 'ColdFusion'
I just tried below step and what ... it work fine for me.
1. Download coldfire project and unzip it.
2. Find coldfire.xpi and extract it using 7zip.
3. Open install.rdf file and replace maxVersion tag with <em:maxVersion>5.*</em:maxVersion>.
4. replace em:version with <em:version>1.7.207.240</em:version>.
5. Zip again and later change extension to 'xpi'.
6. Remove exiting firebug and coldfire from firefox extension.
7. Download Firebug 1.7.3 (Not 1.8.* beta).
8. Drag and drop new .xpi file to firefox. Once installed restart it.
SOTR#2011 is running on scotland but I am not such lucky fellow who attend it. I have my twitter friends who keep giving me updates on this lol. Just read blog from Raymond Camden (I dont know who is he) who wrote update on meeting.
Quick updates are ...
1. Varity will be removed. - Really do not care about it as I am aleady using SOLR.
2. JRun is being removed in favor of Tomcat. - Like it. I was working with Tomcat and ColdFusion 9 and really loved it. Recently post about So it is good know that Adobe is favoring my thought :D.
3. Webservices updated to Axis 2. - Work lot with webservices in my one of project but really do not care about Axis 1 or Axis 2.
4. Scheduled tasks updated. - Really like chaining and other options Ray has mentioned.
5. Jobs : Something like cfthread.. I always had hard time with thread, I am familiar with concept of thread and how it is run but it was always difficult for me to work with. Hope cfjob will make things easy for me.
6. Java loader/proxies. : Thats Ok... Do not need java loader anymore but I always thankful Mark Mandel for this.
7. Closures : Even I do not know much about it (You are not alone Ray). Will go into detail.
8. HTML5/jquery: This is what really I like it. I am very good fan of Jquery, I had used extJs but now exhausted with complex framework (May be not much complex but not so easy as jQuery).
Overall good number of changes in ColdFusion X. Excited ... Really excited
I love cfschedule tag to create/update/delete schedule and use one file to create all schedules. This is really help whenever you switch server and require to transfer all schedule task from one hosting server to another one. As we all know Standard coldfusion server doesn't allow export facility and I am using around 25 schedule task to perform different scehdule operation. Whenever I need to add schedule file I add cfschedule tag in my cfm page and run it on server and it works great for me. But once programmer added tag and run file on server but it doesn't create schedule task and he is in under impression that task is created. I am not sure why it is not created and even doesn't display any error in this case but this push my mind to think on this single file shcule creation file.
I decided to list all schedule tasks once file run so team-mate can review it but later I realize that there is no list action available in CFSCHEDULE tag.. Darn!!!!. After little bit google I find out way to listing all schedule tasks.
<cfscript>
alltask=ArrayNew(1);
taskService=createobject('java','coldfusion.server.ServiceFactory').getCronService();
alltask=taskservice.listall();
</cfscript>
Above code return array of all tasks with relevant property.

I used to create application variables for my cfc object which usually called many times from my coldfusion pages. This will help you to save execution time required to create object everytime. But it is highly recommand that you use local scope for all function local variables or there will be change your variables scope value may overwrite by other function. As a best practice it is always advisable to use local scope for function but by nature of programmer we always avoid to use it specially need faster development. Again this is not GOOD.
I have created sample example which gives you better understanding between local scope and Variables scope in function. I have one CFC and two CFM page which called CFC object.
scrible.cfc
One function having one argument and loop through it
to consume some time and at last return i (index of loop) which should
be arg1 + 1. Please note that index variable 'i' not defined in local
scope so it will consider under variables scope.
<cfcomponent output="false"> <cffunction name="testMe" access="public" output="false" returntype="any"> <cfargument name="arg1" required="true" /> <!--- Loop to consume some time. ---> <cfloop from="1" to="#arguments.arg1#" index="i"> </cfloop> <cfreturn i> </cffunction> </cfcomponent>
scribble.cfm
Simply create object of component scribble.cfc and store in application variable so I doesn't need to create everytime. Generally I used to create objects in Application.cfc's OnApplicationStart function. Called function testMe from component and print return value.
<cfset m = 0>
<cfset application.mycfc = createObject("component","scribble")>
<cfset m = application.mycfc.testMe(100000000)>
<cfoutput>#m#</cfoutput>
Expected Output:
100000001
scribble2.cfm
Same as previous cfml file. Doesn't created component as I am going to run scribble.cfm page first so object will be in application variables and arguments passed in function called lesser than first one so I get output earlier than first file.
<cfset m = application.mycfc.testMe(1000000)> <cfoutput>#m#</cfoutput>
Expected Output:
1000001
Actual Output:
15636065
or
33935923
or
may any other number between 1 to 100000000
This is because index variable 'i' which return from function is in variables scope and will be share by both function call. Keep in mind that function called from different pages so their variables will not overwrite by other page variables but to call function we have use same object (application.mycfc) so any variables scope value can be overwritten by another function call and this is what actually happen in this case.
When I run first scribble.cfm it started loop through upto 100000000 and later I run scribble2.cfm which take less execution time then first one because lesser number passed in arguments. Now both function call sharing variables.i and overwrite each other and finally prior to one function call return value another function overwrite value of 'i' and gives you wrong output.
Now just add one more statement
<cfset var i = 0>
under argument tag and see result.
Hope this example give idea of how important to define local scope variable in function.
For one of our client had requirement to download photos in zip format and it was working file with cfzip tag. Although I have some performance issue with cfzip tag as cfzip doesn’t allow you to zip with list of files. We can create zip for whole folder, add single file but can’t have ability to add list of files at single instance. In my case I have around 50 images which I need to add into zip file and I have only one way to do so is adding one by one file. I was looking for alternative solution for creating zip which gives faster performance with adding file list.
Recent Comments