Friday, 11 May 2012

COPY command in Linux

You can copy files from one directory to another directory using command prompt window .The following commands used to copying the files


"cp" --->Copies files from one location to another.


cp sourceDirectory desinationDirectory

"cp test.txt desinationDirectory"

         Copies test.txt in the current directory to the desinationDirectory directory.

"cp /home/public/test.txt /home/public/backup/test.html"

         Copies the test.txt file in the public directory into the public/backup directory as test.html The files are identical however have different names.

"cp *.txt desinationDirectory"

        Copy all files ending in .txt into the desinationDirectory directory.

"cp -r /home/public/files/* /home/public/backup"

         Copies all the files, directories, and subdirectories in the files directory into the backup directory.

"yes | cp /home/public/test/* /home/public/target"

         Copies all the files and subdirectories in test into the target directory. If files with the same name exist or it's prompted to overwrite the file it answers yes.



Wednesday, 2 May 2012

Setting background color and font display color dynamically for LabelField in Extjs

We can set colors for LabelField dynamically in Extjs by use of the function setText().
Example :


 var test = new Ext.form.LabelField({
id: 'name',
                fieldLabel:'Name',
                width: 200,              
                height: 100,
                xtype: 'label',
});


normally it displays like these



in runtime you dynamically apply colors for "back -ground"  and "fonts" use these field id

Ext.getCmp('name').setText('<span id="ot" style="back-ground:yellow;color: red; display: block"><center><b>Welcome to My Blogspot </b></center></span>',false);
In runtime it shows




The false argument will prevent the html tags from being mangled by the function.


you can apply all HTML tags inside of these function

Adding Tomcat server inside Eclipse

We can Tomcat Server inside Eclipse and run run your program use of that server.For adding tomcat inside  of eclipse just we have do following steps:

STEP 1 : Before Configure of tomcat in your eclipse just download tomcat and install it any location of your computer.

STEP 2 : Then in Eclipse project Explorer just right click New->Others->Server

STEP 3 : now inside of Server choose server then click next

                                   

STEP 4 : In Apache choose Version of Tomcat then click to next

                                         

STEP 5 : Just browse the location where is tomcat installed in your hard drive then click finish


                                             
       now  inside of project explorer of ecplise server coming like these

                   

          You can add via window-->preferences -->server -->runtime environment-->add server and remaining steps are same as follow from third steps      

What's difference between SET and LIST in Java?

"SET" never allows duplicate elemements.It contains element in unique and stores elements in an         unordered way.In Set we retrive  data only in forward direction.

"LIST"  allows duplicate elemements.It contains element in non-unique and stores elements in an ordered                                   way.In List you can retrive both forward and backward direction.

Saturday, 28 April 2012

REMOVE ':' infront label in ExtJs

Normally in ExtJs  ' : ' will be displaying infront of label.we can remove that by giving by use of labelSeparator. or we can use any label separator as your wise

Example:


       new Ext.form.TextField({
id:applyId,
mode: 'local',
applyTo: applyId,
triggerAction : 'all',        
selectOnFocus:  true,
forceSelection: true,
                 labelSeparator: '  '

});

in that label separator you can give arrow mark ,dot,etc...

Wednesday, 28 March 2012

Comparing files of two folders in UNIX

Normally you can't find how many files are different in two folders.It is possible only less amount of  files inside of two folders.If number of file increase means we can't compare whether present in both folders.For that we use below the command .It shows how many files are present in folder1 not in folder2 same as vice-versa


 diff  -r  pathOfFolder1   pathOfFolder2

Example :
folder1 constains t1,t2 and
folder2 contains t1,t4  means that output will like this

Only in pathOfFolder1 : t2
Only in pathOfFolder2 : t4

Monday, 26 March 2012

callback function use in Ext.data.Store


        In ExtJs some application displaying value only at combobox sometime.Because of it take long time fetch label for that value from store .For that we can use setTimeout  function to solve this issue.But it is not proper way to solve this issue.Because time delay  differs based on different browser and browser version.
        Instand of setTimeout function we use "callback" function in "store.load" .This quickly fetch label for that value and displaying label value.

EXAMPLE:
         var testStore = new Ext.data.Store({
                 autoLoad: true,
                proxy: new Ext.data.HttpProxy({
                url: 'applicationURL'}),
                reader: new Ext.data.JsonReader({ root: 'rootElementOfJson'}, [{ name: 'value' }, { name: 'label'}])
     });

testStore.load({
callback: function(rec, options, success) {
Ext.getCmp('comboFieldId').setValue(document.getElementById('fileldId').value);
}

callback function is applicable for only proxy method of store loading