Saturday, 12 May 2012

Removing files and directories using Linux Command

You can remove particular directories or files use of " rm "command in linux

rm [options] filename


if you want to remove full directory means use these command

rmdir [options] directory


options are -r ,-rf,-v like that

Example:

  •   rm -rf  test.txt -->removes test.txt file
  •   rmdir /home/src/webapp -->removes the directory
  •   rm * --->removes every thing from that current path
  •   rm *.jsp --->rremoves all files end with jsp files from the current path






CHMOD in linux

chmod command gives access mode for users.Each time no need to go that folder directories and right click the folder and changing the permisson.just Go to the command prompt window and give the command chmod.


chmod who=permissionmode directory or folder or file


This gives “who” the specified permissionmode for a given filename.
 "who" list of representation of three different roles:
  • u is for user,
  • g is for group,
  • and o is for others.
"permissionmode" is list of representation of three different permissions:
  • r is for read permission,
  • w is for write permission,
  • x is for execute permission.
CHMOD can also to attributed by using Numeric Permissions:
  • 400 read by owner
  • 040 read by group
  • 004 read by anybody (other)
  • 200 write by owner
  • 020 write by group
  • 002 write by anybody
  • 100 execute by owner
  • 010 execute by group
  • 001 execute by anybody
use of the numeric codes use can combine any of numeric codes and form one number use of that give access mode to depend on user


List of some useful chmod by numbers

  1.         chmod  -R 777 ---->full access to everyone
  2.         chmod  -R 666 ---->read and write permission to everyone
  3.         chmod  -R 755 ----> Anyone write to the file
  4.         chmod  -R 644 ----> Read and write by owner and read by every one else

        -R is noting but recursive


Example To Form Numbers use of Numeric Codes:


  400+040+004+200+100+010+001 = 755 this represents (-rwxr-xr-x).


   chmod  -R 777 test.html means giving full access to the .html file
or you can give permission like this also
   chmod u+x test.html  which gives execute permission for user.
   Like wise you can give multiple permission also.
  

Friday, 11 May 2012

"mkdir" command in linux

'mkdir' command used for creating one or more directories .


For creating 
mkdir [options] directories


options means whether you giving permission for the directories and adding help messages and soon.
options                 explanation
-m                   giving access mode 
 -v                    Print help message for each directory created

Example:


Creating simple Directories
     1   mkdir /home/test /backup


Creating simple Directories with access mode
     1   mkdir -m 777 /home/test /backup
          Giving full access to /home/test /backup
     2   mkdir -m 666 /home/test /backup
         Giving read and write permission to /home/test /backup

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.