Tuesday, 2 October 2012

Wrapper Class in Java

Java platform  provides primitive data types has a class dedicated to it. These are known as wrapper classes, because they "wrap" the primitive data type into an object of that class. Often, the wrapping is done by the compiler-if you use a primitive where an object is expected, the compiler boxes the primitive in its wrapper class for you. Similarly, if you use a number object when a primitive is expected, the compiler unboxes the object for you.So, there is anInteger class that holds an int variable, there is a Double class that holds a double variable, and so on.


Example for primitive data types and classes



Primitive type           Wrapper class Constructor Arguments

    byte                          Byte                       byte or String
    short                         Short                      short or String
    int                             Integer                    int or String
    long                          Long                      long or String
    float                          Float                      float, double or String
    double                      Double                   double or String
    char                         Character               char
    boolean                    Boolean                 boolean or String

Tuesday, 21 August 2012

Recover Mysqldump Got Errno 28 On Write

     While taking Mysqldump you may got error like Backup Failed in Mysqldump Got Errno 28 On Write.
     Because of inadequate disk space to store your output file. For that you have to free up some disk space.That's all now error willl gone and working fine

Friday, 10 August 2012

BufferReader


     BufferedReader reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. It can also  read data from the files and console.It has two constructors

BufferedReader(Reader inputStream) 
BufferedReader(Reader inputStream, int bufSize)

     The first form creates a buffered character stream using a default buffer size. In the second, the size of the buffer is passed in bufSize.

     The most common Syntax for BufferedReader is

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

     This line will create a new BufferedReader object, which reads from System.in (standard input). The InputStreamReader part is used to convert System.in (which is an InputStream) to a Reader object (which can be used by BufferedReader).

     After creating br, you can read input from the user:
String input = br.readLine(); 

     That will allow the user to type in anything and hit <Enter> button, and have what they typed in stored in input.

Thursday, 12 July 2012

Ignore tables in MySQLdump

While taking mysqldump  some time error coming like databaseName.tableName crossed.meanwhile time you have to exclude that tables.And you don't want to include  some tables while taking mysqldump.


For that we can use    "--ignore-table=DbName.TableName" infront of  DbName in mysqldump command.see below dump command

mysqldump -ruserName -ppassWord  ----ignore-table=DbName.TableName DbName > DbName.sql

This command exclude which table you need to omit.

You can exclude multiple table also

mysqldump -ruserName -ppassWord --ignore-table=DbName.TableName1 --ignore-table=DbName.TableName2 > database.sql

Example:

mysqldump -rroot -proot  ----ignore-table=TEST.TEST_DATA TEST > TEST.sql



Wednesday, 11 July 2012

Secure Coping files over ssh, between Linux, Mac or Windows


scp is secure cp (copy), which means we can copy files across ssh connection. That connection will be securely encrypted.

You can use scp to copy files from or to a remote server. You can also copy files from one remote server to another remote server, without passing traffic through your PC.

You can use scp on Linux, Mac and Windows (using WinSCP).


Copy files from a local computer to  remote computer

"scp fileName username@server:PathToLocate"

Example:
 scp test.zip kumar@192.168.1.1:/home/user/

Copy files from a remote server to your local computer

"scp username@server:FilePathToCopy/fileName  PathToLocate"

Example:
 scp kumar@192.168.1.1:/home/user/test.zip  /home/user/

Copy files from a remote server to another remote computer

"scp UserName1@server1:FilePathToCopy/fileName UserName2@server2:PathToLocate"

Example:
 scp kumar@192.168.1.1:/home/user/test.zip  looser@192.168.1.5:/home/user/

Tuesday, 10 July 2012

Zip files via Command in LINUX

we can zip one or more files via command at a time.The command is

 zip -r NameToFile.zip   file1/ file2/

Example:
   zip -r  FilesToDownload.zip  fileName1/ fileName2/

then both  fileName1 and fileName2 converted as FilesToDownload.zip

Monday, 9 July 2012

Connecting ubuntu systems via SSH server

We can connect ubuntu systems using openssh-server.It helps to access other system with your system.
For that install openssh-server which system you want to access.

In command you install via below given commands...
                           sudo -apt|get install openssh-server
                            sudo update-rc.d ssh defaults
When I try to connect to the System with SSH using

ssh username@hostname
or
ssh username@ipaddress

Example:
ssh  raja@192.168.1.73