Using sharedObject to store data at the client machine

July 18, 2007

The sharedObject class is used to store and read data on user’s computer or on a server. Local shared objects can be used as browser cookies. You can also store custome object into the sharedObject, this problem I got resolved with the help of google flex_india group. Thanks for their quick help on this matter.

Follow the thread for discuss issue about storing the custome object in the sharedObject

You can create the local shared object with following syntax:
//Create “testLocalSharedObject”
var testSO:SharedObject = SharedObject.getLocal(“testLocalSharedObject”);

To store any data into the sharedObject use data property.

//This will store the  myname value, the same can be retrieved from it. =”vijay khambalkar”;

//To store the this data into the local file, use flush method. This method writes the content immediately to the local file.

//To destroy object from the local file, use clear method. This method clears all the data from the sharedObject and deletes the sharedObject from the disk

Cairngorm Auto Code template generator

July 12, 2007

I know there are such tools available but building one is nice experience and then using it­čÖé

We are using cairngorm framework in our project. I found generating the cairngorm module classes is repeatative and time consuming. To make my life easier, I written a small utility with PHP which allows me to generate this classes by specifying the package and module name. This one I had done for my project. This can be utilize to generate module classes for any project. Generated files needs very few modification that may differ from the personal preferences.

It help me saving the lots of copy paste time.

Click here to generate the cairngorm classes.

suggest me if anyway I can make it better.

Finding the Nth Highest Salary from table

June 2, 2007

This is the most common question asked in every interview for the database. As I am more familiar with mysql , Its so simple with the following query

SELECT * FROM employee ORDER BY salary DESC LIMIT 2,1

This query will bring the second highest salary from the table employee.

But Query should work with every database so here is the correct query and its details explaination which will bring specified highest salary from the table

select * from employee emp where 3 = (select count(*) from employee emp where a.salary <= b.salary) ;

I made a details comparision set about the operations of query.

Table employee is having the 6 record with salary ranging from 1000 to 6000

SELECT * FROM employee emp WHERE 3 = (SELECT COUNT(*) FROM employee emp WHERE a.salary <= b.salary) ;

Detail Record Condition Check
1)a <= b

2)a <= b

3)a <= b

4)a <= b

5)a <= b

6)a <= b

Result : 4000 as its count is matching the condition ie. 3

Autosuggest the Textbox in Flex

April 20, 2007

After a very long time I got time to code something. I thought what to write, various technology which one to go with PHP, Coldfusion, flex, javascript. After thinking for a min, I started with Flex. What to create? Autosuggest TextBox!.

So I created a autosuggest textbox, I quickly thought what all I need

Textbox, Allow user input.
Listbox, To hold the list the matched list from the textbox.
Tweening, Which will give a feel of panel movement comig out of the textbox with matched value.

1.Track keyUp event on the textbox which in turn filter the main array which is holding the entire values.
2.Apply regExp which will hold the format to look for.
eg. typing A, should give me all the values starting from the ‘A’ character.
3.test the regular expression against the main array by looping over each value.
4.If test successful then hold these value into the new array which in turn binded with the list box.
5.Animate the list box with resize event if filteredArray has more values into it from the step 4.

We can supply the list to main array from database, or keep it hardcoded.

You are ready with your autosuggest box.

Click here to view the Working sample

Happy coding­čÖé

Restricting the character entry into the TextInput

April 13, 2007

We were struggling from last several days about how to restrict some special character entry into TextInput field. We tried applying our own logic for implementing this functionality by tracking the keydown event and checking the ascill/regular expression but did not succeeded into this.

Finally I thought to look into the help and suprisingly we find that TextInput has restrict property to which we can supply the range of character that the TextInput should accept.

<mx:TextInput x=”104″ y=”151″ width=”190″ id=”charInput” restrict=”a-z A-Z”/>

Complex problem always has very simple solution­čÖé

Scrolling div with Javascript

March 5, 2007

You can scroll div with javascript. You need to have one mainContainer which will contain the child for it. eg.

I will have mainArea div with child div myReport.

<div id=”mainArea”>
<div id=”myReport”>


You need to fixed the height for the mainArea div with style

<div id=”mainArea” style=”height:400px;overflow:auto”>
<div id=”myReport”>


Now your div can scroll, You now need to write one line code in any javascript function

function scrollMainArea()
document.getElementById(“mainArea”).scrollTop = 0;

This will move your myReport div to show the top portion of your division.

I am using this codes in my chat application to scroll the messages automatically.

PHP base Chat Application is Up and running

February 28, 2007

I am very excited today, I have finally my chat app ready and working. I have shown my application to all my collegues they throughly enjoyed it.

Soon I will be writing the article about the entire development of this chat application.

PHP and Power of Javascript make this application possible for me. UI is not that good, the application is about functionality. I will work on UI someday Later.

I have created three user for the test.

user:tom, password:tom
user:dick, password:dick
user:harry, password:harry

After logging inside you will find a list of User on the left panel, click on the user and start sending messages to them.

So lets have a real feel of the application. Click here to start


Get every new post delivered to your Inbox.