Google Ads

Wednesday, December 30, 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" );

data = ["A","B","C"]

Pop() - Pops out (removes) one element from the end of an array

var data = ["A","B","C"];

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" );

data = ["C","B","X","A"]

Shift() - Removes one element from the beginning of an array

var data = ["A","B","C"];

data = ["B","C"];

Splice() - Removes elements specified number of items from the starting index and also optionally allows insertion of items on the start index.

// array.splice(start Position,number of elements,[elements to be inserted])

var data = ["A","B","C","D"];

["B", "C"]
["A", "x", "y", "D"]

Thanks to Ben Nadel for sharing this useful piece of information.

Wednesday, December 23, 2009

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 and the series starts with 1 and 1.

Fibonacci series:
We need to create a function which calls itself again and again to generate fibonacci numbers and also to find the sum of those numbers. Let us call it 'doRecursion'.

The logic is, the function will receive two numbers as arguments. It should add up the two numbers to get the third number. But the sum of second number and third number is the fourth number and so on.

For example,
Step 1: we get two numbers 1 and 1. so the third number is
Step 2: fourth number is 2nd + 3rd number, i.e, 1+2 = 3.
Step 3: fifth number is 3rd + 4th number, i.e, 2+3 = 5.

That is, we get two numbers, whose sum is third number. But the second one among the two numbers and their sum adds to give fourth number, and the series goes on.

So, our function will take two numbers as arguments and instead of simply adding the two, add the first number to the recursive call whose input will be the second number and the sum of first and second number. The return value of the function is the first argument itself.


doRecursion(1,1); //Initiating the call

function doRecursion(value1,value2)
if(value2 LTE 50) //A simple condition to restrict the loop
/* Adding the first number with the return value of recursive call to the doRecursion function with the arguments as the second number and the sum of first and second number */
writeoutput(value1 + doRecursion(value2,value1+value2)&" ");
return value1;

First we call the function doRecursion with the arguments 1,1. Now the function will try to add the value1 with the return value of the call to function doRecursion by passing the parameters value2 and sum of value1 and value2. This function will return the first argument so that it will get added to the value1 in the main function.

Now run the code and see the result.
55 34 21 13 8 5 3 2

and... what happened? the series is in reverse...
Ok, let me explain this.
When we call the function, it will try to add the value1 to the result of another function call and so the control is never returned to the calling function until... the value2 greater than 50. In this case, the call to the function is not performed and it will return the first argument as return value to the called function which in turn completes the calculation. So, the value 55 gets displayed first because at that instance the value1 = 34 and value2=55 and value2 is greater than 50. So, the function will return the first value (34) to the calling function which was waiting to add it with it's first argument 21 and that function returns it's first argument ie, 21 to its calling function and so on.

   So, the values gets displayed in reverse order.

Now make a small change in the function.

if(value2 LTE 50) //A simple condition to restrict the loop
writeoutput(value1&" ");

Now, the result will be
1 1 2 3 5 8 13 21
Hope the logic is clear.

Wednesday, December 9, 2009

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 choice (I prefer restartCF.bat).

So, the content of the batch file as per the example will be :

"C:\ColdFusion8\runtime\bin\jrunsvc.exe" -stop "ColdFusion 8 Application Server"
"C:\ColdFusion8\runtime\bin\jrunsvc.exe" -start "ColdFusion 8 Application Server"

Just double click this file and your CF Application server will be restarted.

Wednesday, November 11, 2009

Location-Aware Browsing in Firefox 3.5

     Firefox 3.5 have incorporated the facility to let the websites identify the location of the site visitor. The technique is that, when the user browse a site that use location-aware browsing, Firefox will ask for user consent and send details like IP address to Geolocation service providers and get the location. This may not be accurate in India, but they were able to point out my location accurately to the city :-)

     More details are in Firefox site where you can also see the demo.

    I will do a demo and post the code on my site later.

Tuesday, October 6, 2009

Adobe released ColdFusion 9 at Adobe Max

Folks, for your information, Adobe has officially released Adobe ColdFusion 9 at Adobe MAX today.

Tuesday, September 8, 2009

Create a twitter reader using JQuery

  The year of JavaScript has come and JQuery is one of the powerful JavaScript libraries out there. We could perform a multitude of tasks using these libraries. I have created a twitter reader that displays a user's timeline using JQuery. The implementation is very simple.
See the code below.  

<title>Twitter Reader</title>
<script src="jquery.js" language="javascript"></script>
<body align="center" bgcolor="#181C21">
<script language="javascript" type="text/javascript">
$.each(data,function(i, item){
$("<div style='color:#865833'>"+item.text+"</div>").appendTo("body");
return (index % 2 == 0);
return (index > 0 && index % 2 != 0);
<div id="twitterResponseDiv" name="twitterResponseDiv" style="font-family:verdana;color:green;background-color:#CBF2FF;width:30%">
Twitter Response Div

I have included the jquery.js file to the page and then used the getJSON method to load JSON data using an HTTP GET request. On receipt of data, it is looped and the text is displayed in different divs which is attached to the body element.

For showing different colors for alternating divs. I have used the filter function available with JQuery.

References :

Thursday, August 13, 2009

Remove unnecessary blank lines from the ColdFusion output

ColdFusion outputs blank lines on the data sent to the browser which can sometimes get higher that it will be many times higher than actual output lines. In some cases this will eat into the bandwidth. To avoid this, check the 'Enable Whitespace Management' under 'Settings' in ColdFusion Administrator. This will remove many of the extra spaces, tabs, and carriage returns that ColdFusion might otherwise persist from the CFML source file. Enabling this could lead to a minor performance issue with the CF Server, but compare with the bandwidth gain and decide to use this feature.

Friday, July 17, 2009

OpenSearch - enabling your site with OpenSearch

You must have seen list of search engines in mozilla search bar (usually to the right end after address bar). There are a list of sites like Google, Yahoo, Wikipedia on the list from which we can choose the default search engine. These sites are OpenSearch enabled. The Mozilla browser can directly send search queries from the search bar to these sites. There are lot of sites which are OpenSearch enabled. We can easily identify a site is OpenSearch by looking at the arrow icon on the search bar in Mozilla.
If the site is OpenSearch enabled, there will be glow for the arrow icon
You can click the arrow to see the option "Add " so that the search the site will also get listed in the search engine list. You can search that site by directly entering the search term on the mozilla browser search box and selecting the site from the list of search engines.
More details, the demo and how to enable OpenSearch on the following link

Sunday, July 5, 2009

Adobe Product Security Incident Response Team (PSIRT)

blog of Adobe Product Security Incident Response Team (PSIRT)

SAAS and other online free services - How to save your data remotely and access from anywhere?

The new model of software application development cannot ignore the methodology of SAAS that is beneficial for both the customers and companies. In SAAS method, you only pay for what you use, unlike buying the whole suite of applications in which you rarely use options other than a few. If you get MS Office as a SAAS app, you can pay for the Excel or Word and only for the time you use.

Coming to the main point of this blog post, “How to save your data remotely and access from anywhere?” I remember the time around 10 years back when I bought my first PC. The Internet was available only for the elite community at a premium and that too dialup. We have to literally pray for the connection to get successful and pray more for not getting disconnected in between. With a little over 8 kbps max speed, you can browse a lot of static sites and check your mails. Hotmail was the free service that give you 2 MB which was more than enough, and who was out there to spam you?

Things have changed with Google entering the email arena with unlimited storage space. By that time broadband came down to households. Now you have thousands of MP3, hundreds of movies and hopefully very little useful data on your hard disk.

But if one day, your hard disk breaks down or your OS gets corrupted. All the data and customizations you made are lost!!! No. you have a 500 GB backup hard drive and you keep a backup of everything you do in that. You can simply restore everything from the backup. Good idea, but you always have to sync the data, keep the versions and also carry it everywhere you go.

The other way is to store everything, at least your documents, to the web and access from anywhere, anytime, but with an internet connection.

The applications / services noted below can be accessed with Mozilla, which is available on Windows, Linux and Mac.

1. Google Docs and Gears engine (

Create, edit and save your documents using Google Docs. It has a word processor, spread sheet and presentation support. We can also share these documents with friends and track the changes. Also, export them to different formats like pdf, ods, doc etc.

If you are a frequent traveler and don’t get access to net while traveling, you can enable Google Gears support to Google Docs so that the documents are available offline and are synced when we get online.

For using Google Docs you need a Google account.

Similar Services:

a. Adobe Acrobat

2. X-Marks – bookmark sharing (

x-marks provides synchronization facility for your bookmarks automatically. For using x-marks you just need to install the plug-in for FireFox and create and x-marks account. Now you can access your bookmarks from any machine and synchronize it. You also can view the bookmarks online at x-marks site. The add-on is available for IE and Safari too.

3. Online storage

x-Drive was one of the popular online free storage service provider, but have been closed recently after being acquired by AOL. There are more players out there, one is Adobe Acrobat. By creating an account on Adobe, you can get a multitude of features like word processor, free storage, desktop sharing, and file sharing using the Adobe Acrobat AIR application that gets automatically installed along with Adobe Acrobat 9.

4. Calendar

Online calendars are a best place to track your appointments. Google Calendar offers facilities like sending SMS reminder, sending email reminders, XML import and sharing calendar with friends. If you are using Thunderbird with Lightning ( plug-in, you can add the Google calendar to your Thunderbird. But you should be online while using this feature. For MS Outlook, Google is providing a free synchronization application ( that will synchronize the GCal data to Outlook. Additionally, if you own a Nokia Mobile, you can synchronize the data with all these services using PC Suite.

Wednesday, June 3, 2009

Y! = why not = Yahoo

Just came to my mind the Y! that is usually seen in Yahoo sites. Does that mean Why Not ? I'm not sure... but that will be nice to find out.

Wednesday, April 29, 2009

How to show blurry images first and then progressively show clear image

We have a slow net connection and when we browse our site we can see that the images are loaded line by line from top to bottom. We can change this behaviour by saving the image as Progressive (jpeg) or Interlaced (gif). We can achieve this using GIMP or there are lot of free image editing softwares out there.
The Interlaced image will have a bit more size than normal image, but the user will have a better experience.
Try loading the two images in different window and see the difference.
The Interlaced image will first load the whole image, but the image will be blurred. This will get sharper and finally the clearer image will be displayed.
In case of normal image, the section of image loaded will be sharp, but the whole image will not be loaded at once.

Wednesday, April 8, 2009

Sava CMS - first impression

I tried setting up SAVA CMS standard in my machine. The installation was very easy. Just gave the required setup mappings in the ColdFusion administrator and DataBase and the site was up.
The WYSIWYG editor is cool to use. I tried creating inner pages and links. They are displaying very nice. It even creates a bread crumbs.
Try uploading items to Gallery. It will display very neatly. Click on the item, you can see the implementation of Shadow box.
The team have surely done a nice work in bringing SAVA CMS.

Free ColdFusion CMS

Sava has released a free CMS in ColdFusion. More details after I try it...

Thursday, April 2, 2009

Even adobe don't test site properly

See the screengrab from on April 02, 2009. The commented out code is not proper....

Thursday, March 19, 2009

Easily viewable wallpaper

Sometimes the icons on your desktop will not be easily recognizable due to the color of wallpaper. Just try this method to blur the part of wallpaper where the icons appear. You can easily view the desktop icons without much effect on the wallpaper. Using Photoshop or GIMP, select a rectangular area where the icons come and apply Gaussian Blur. Now use this image as wallpaper and see the difference. 

Eco friendly printing

Why not save ink while printing? Here is the Eco friendly font that is designed specially to save ink. It is free to download and use. Tip: If you are using mono laser printer, another way to save ink is to change the font color to red. This will reduce the amount of ink used while printing.

Printer friendly page

Usually we see links in web pages to show another version of page that is printer friendly. But, we can create a page such that it will display correctly in browser, but while printing, we can decide which all content to be printed. This is achieved with CSS. The method is simple. You create a style sheet such that the content that you do not want to appear in print will be given the attribute 'display:none'. This style sheet is add to you page with an additional attribute media="print". So, when the user choose to print the page, this style sheet will be considered and the content that are given the display:none attribute will be hidden.

'Simple' difference between Proprietory and Free software

See the two images from Visual Studio and Eclipse. While Studio tells 'Close all but this', Eclipse simply tells 'Close Others'.

Monday, March 16, 2009

IT magazine stops print edition

The magazine I.T from the efy group had sent out his last print issue. In the editorial of the Mar 2009 issue they have informed the subscribers about their decision to stop print and move entirely to web which will be available for free.
The existing users will get an option to get a refund of the remaining subscription amount or switch to another magazine from the group.

Tuesday, March 10, 2009

Flash Movie always on top in browser

If you happen to embed a Flash / Flex .swf file in a HTML page and also put a full screen Div over the content, you could probably see that the flash file is on top of the Div even though you set the z-index of the Div. The solution is simple. Add the wmode param while setting the swf Object to the page.
This will make the flash file appear below your Div.

Tuesday, March 3, 2009

IIS very slow after ColdFusion 8 service is stopped.

This is a technote from my experience. I had ColdFusion 8 server installed on my machine. After I stopped ColdFusion service (change to start manually) and restarted the machine, IIS was responding very slow. I was not aware that CF8 had created this issue. I tried to find the reason using the tools provided by Microsoft (DebugDiag.msi and ApplicationVerifier.x86.msi) and found that the JRun of CF server is making the IIS unresponsive.
The solution was simple. Just start the CF server service on the machine and IIS will be back to normal.

Tuesday, February 17, 2009

Danger from Space Debris

As man had reached to outer space, so do the waste. Now the amount of space debris had reached to a serious level that UN had issued a warning about them causing danger to space flights. Space debris often are created by the remains of rockets, parts of satellites and even defunct satellites. Recently, an Iridium communication satellite had collided with a defunct Russian satellite above Sibera. The Iridium communication satellite was a part of the 66 satellites that are used to provide satellite communication. 
The debris that fall to earth usually get burned out in outer atmosphere itself, but some metals like Ti will not be burned out and can cause damage to earthly objects. In years to come the amount of debris will only increase which will create considerable safety problems to the ISS.

Saturday, February 14, 2009

Relaunched my site

Finding time for updating my site was a bit difficult. But I have completed the homepage and projects page of my new site and uploaded as per schedule. 
If we have to find time for something, then you will. After all, all the great achievers had 24 hours a day.

Thursday, February 5, 2009

QR (Quick Response codes)

You have seen about barcodes. They provide with basic information about a product. Now comes the QR (Quick Response) code that can store lot more information.
QR code is having a matrix structure or can be called as a two-dimensional barcode.
QR code is open and we can create one by visiting one of the free code generating sites.

Monday, February 2, 2009


I just had a quick search on the Polar satellites and Geo stationary satellites. 
PSLV is used to launch satellites to Polar orbits. That means the satellite passes above or nearly above both the poles. Also, these satellites passes over a point in earth at the same local time. for eg:, the satellite passes over any point in earth at 1 P.M local time. They are usually used for earth mapping, observation and some weather data collection.
GSLV is used to launch satellites to Geo stationary orbits.  Geo stationary orbits means the satellite's orbit will be directly above the equator and will have a period or revolution equal to the period of rotation of earth. The orbit will be roughly 35,786 km above equator. They are usually used for Satellite communications, weather data collection and GPS.

Sunday, February 1, 2009

Google's explanation to the "This site may harm your computer" on every search result error that occurred yesterday

Google's explanation to the "This site may harm your computer" on every search result error that occurred yesterday

a good feature in search. Want wallpapers that fit your current resolution ? Search images in and refine search by size -> Desktop.

Hello World!

Hello World! Wow! The same old Hello World!. So, I have started blogging.... :-) more to come...