One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man

Thursday, February 10, 2011

Shell Scripting - Tutorials

To view the full size image, you have to click on the image.......

01. This example coding gives you a clear idea about how to write a switch statements and how to get user inputs in shell script. 

Write a menu driven shell script to perform the following tasks
        [1] Show Today's date/time
        [2] Show file in current directory
        [3] Show calender
        [4] Start editor to write letters
        [5] Exit/Stop
02.This example coding is helpful to you to understand how to use advance for-loops


Write a shell script to display the even numbers 2,4,6,......100
04. Suppose you have a text file named dirList containing a list of directories. Write a shell script that goes to each of them, execute the command make and comes back to the working directory
05. How to perform real number calculation? How to calculate 5.12 + 2.5 real number calculation at $ prompt in shell?
                echo 5.12 + 2.5 | bc


Thursday, February 3, 2011

java - Methods to manipulate characters



I will give you examples to get a clear idea about each and every method


1. isDigit()                                 - check whether the character is a digit or not
2. isLetter()                               - check whether the chatacter is a letter or not
3. isLowerCase()                       - check whether the character is a lowercase or not
4. isUpperCase()                       - check whether the character is a uppercase or not
5. toLowerCase()                      - convert the uppercase character to lowercase character
6. toUpperCase()                      - convert the Lowercase character to Uppercase character
7. isWhiteSpace()                     -  check whether the character is a space, tab or newline or not
8. isSpaceChar()                       - check whether the character is a space or not


01)  isDigit() and isLetter()


class hsp{
public static void main(String args[]){
System.out.println(Character.isDigit('a'));
System.out.println(Character.isDigit('2'));
System.out.println(Character.isLetter('a'));
System.out.println(Character.isLetter('2'));
}
}


you have to use covering class to use these methds


Character.isDigit('a')
Character.isLetter('a')


output : 














02)  isLowerCase() and isUpperCase()


class hsp{
public static void main(String args[]){
System.out.println(Character.isLowerCase('a'));
System.out.println(Character.isLowerCase('A'));
System.out.println(Character.isLowerCase('2'));
System.out.println(Character.isUpperCase('a'));
System.out.println(Character.isUpperCase('A'));
System.out.println(Character.isUpperCase('2'));
}
}


Output:
















03)  toLowerCase() and toUpperCase()


class hsp{
public static void main(String args[]){
System.out.println(Character.toLowerCase('a'));
System.out.println(Character.toLowerCase('A'));
System.out.println(Character.toLowerCase('2'));
System.out.println(Character.toUpperCase('a'));
System.out.println(Character.toUpperCase('A'));
System.out.println(Character.toUpperCase('2'));
}
}


Output:
















04)  isSpaceChar()


class hsp{
public static void main(String args[]){
System.out.println(Character.isSpaceChar('a'));
System.out.println(Character.isSpaceChar('A'));
System.out.println(Character.isSpaceChar('2'));
System.out.println(Character.isSpaceChar('\t'));
System.out.println(Character.isSpaceChar(' '));
  }
}


Output:
















05)  isWhitespace()


class hsp{
public static void main(String args[]){
System.out.println(Character.isWhitespace('a'));
System.out.println(Character.isWhitespace('A'));
System.out.println(Character.isWhitespace('2'));
System.out.println(Character.isWhitespace('\t'));
System.out.println(Character.isWhitespace('\n'));
System.out.println(Character.isWhitespace(' '));
}
}


Remember the "space" word in the "isWhitespace()" keyword is lower case.


Output: