Showing posts from December, 2009

Array functions in JavaScript

Here are some of the functions useful for array operations Push() - Appends one or more elements to the end of an array var data = [ "A" ]; data.push( "B" ); data.push( "C" ); Result data = ["A","B","C"] Pop() - Pops out (removes) one element from the end of an array var data = ["A","B","C"]; data.pop(); Result data = ["A","B"]; Unshift() - Adds one or more elements to the beginning of an array var data = [ "A" ]; data.unshift( "B","X" ); data.unshift( "C" ); Result data = ["C","B","X","A"] Shift() - Removes one element from the beginning of an array var data = ["A","B","C"]; data.shift(); Result data = ["B","C"]; Splice() - Removes elements specified number of items from the starting index and also op

Generate Fibonacci series using recursion with ColdFusion

Recursion is a method which has been popular from the earlier age of computing. In simple terms, recursion is the process in which a function/method calls itself again and again till a condition is satisfied. It is mainly used to generate or find the sum of series of numbers like Fibonacci series. I seldom had chance to implement the recursion in programming. Lately I had to create a dynamic menu structure using Ext JS and I found recursion was the answer. I was able to neatly create the menu dynamically to 'n' levels. As the creation of menu includes Ext JS and other dependencies, I will try to explain the concept with generating Fibonacci series numbers in ColdFusion . As noted before, recursion is the process of a function calling itself again and again. It is infinite, so we will restrict our demo to values till 50 . Let us first look what a fibonacci series is. The series propagates in a manner such that a number in the series is the sum of two preceeding numbers an

Create shortcut for restarting ColdFusion 8 server

     While developing applications in ColdFusion we may have to restart the CF server occasionally. We have to go to "Windows Services" and then restart the server. This can easily be achieved by creating a shortcut for the restarting process so that you can just click and restart the CF application server without going to the windows services window.      For this, you have to first find out the location of jrunsvc.exe. You can find this by going to Services window (by running services.msc) and open the ColdFusion 8 Application Server. Take the whole path from "Path to executable" along with quotes. Also take the "Service name" (this should be "ColdFusion 8 Application Server"). Now, open a notepad and enter two lines as below. <"Path to executable"> -stop <"Service name"> <"Path to executable"> -start <"Service name"> and save the file as a batch file with a name of your c