Software Testing--- A fine Tuning Process

Software Testing--- A fine Tuning Process

Tuesday, 6 March 2012

UNIX & OS X COMMANDS REFERENCE

cd (change directory)
cd myfolder Changes the current working directory to "myfolder"
cd.. Go up one level to the current working directory.
cd../.. Go up two levels to the current working directory.
cd / Changes the current working directory to the root directory.
cd ~ Changes the current working directory to your home directory.
mkdir (Make directory)
mkdir Photos Create a new folder called "Photos" in the current directory.
mkdir /Photos Create a new folder called "Photos" in the root directory.
mkdir ~/Photos Create a new folder called "Photos" in your home directory.
ls (list)
ls list the file names in the current working directory.
ls -l list the file names with "long" description/information (size, privilages, etc)
ls -a list "all" file names in the current working directory including the hidden files.
lls -l *.jpg list the file names ending in ".jpg" and display it in "long" description format(-l)
cp (copy)
cp letter.txt newletter.txt Copy the file called "letter.txt" and name it "newletter.txt" in the current directory
cp my.cnf /etc/my.cnf Copy the file "my.cnf" and put it inside the root -> etc folder.
cp tax05.db ~/Taxes Copy the file name "tax05.db" and put it inside my home directory -> Taxes folder
cp ".jpg ~/Photos Copy all the files with ".jpg" extention and put them inside my home directory -> Photos folder
cp -R ~/Docs /backups/'Docs Backup' Copy the entire "Docs" directory from my home page and put it inside the root -> backups and call it "Docs backup" (use quotes if you use folder names with space. example: 'Docs Backup' (-R stands for "Recursive")
sudo cp -Rp /Users /UsersBackup Copy the entire "Users" folder including subfolders and files, preserve owner, group, permissions, and timestamps and save the new folder in the root -> UsersBackup location.
"-Rp" stands for Recursive Preserve:
Recursive: Copy include subfolders and files.
Preserve: Preserve owner, group, permissions, and timestamps information.
(use "sudo" to get root access temporarily.)
mv (Move or Rename)
mv /letter.txt ~/letter.txt Move the file "letter.txt" from the root directory to the home directory.
mv badletter.txt niceletter.txt Rename the file "badletter.txt" to "niceletter.txt" in the current directory.
mv Pictures Photos Rename the folder "Pictures" to "Photos" in the current directory.
mv *.jpg ~/Photos Move all the files with ".jpg" extention and put them inside my home directory -> Photos folder
rm (Remove)
rm letter.txt Delete the file "letter.txt" from the current directory.
rm ~/BadPhotos/*.jpg Delete all the files with the '.jpg' extention inside your home directory -> "BadPhotos" folder.
rm -R Temp Delete the "Temp" directory and all of its contents in the current directory (-R stands for "Recursive")
rm -fr Temp Delete the "Temp" directory and all of its contents including write-protected files without prompting in the current directory (-f stands for "force" -r stands for "recursive")
find (files and folders)
find ~ -name myletter.doc -print Search for the file names "myletter.doc" inside my home directory and print the result to the screen
sudo find / -name mysql -print Search for the file and folder names "mysql*" starting from the root directory and everywhere within it and print the result to the screen. (use "sudo" to get root access temporarily.)
find . -name myletter.doc -print Search for the file names "myletter.doc" inside the current directory and print the result to the screen
find . -name 'myletter*' -print Search for the file names starting "myletter" inside the current directory and print the result to the screen
locate (similar to find)
locate ~ -name myletter.doc Search for the file names "myletter.doc" inside my home directory and print the result to the screen
pwd (print working directory)
pwd Displays the pathname of the current working directory.
who (who logged in)
who Displays who is logged into the system.
who am i Displays my user name.
who -uH Displays who is logged into the system including heading "H" and idle time information.
su (set user) - type exit to switch back to your own identity
su Temporarily become the root user. (this will give you root access privilages and the most control over the OS) - it will prompt you for the administrator password.
su username Temporarily become another user called "username" (replace "username" with the user that you wish to use as your new identity - this will give you access privilages for the "username") - it will prompt you for the that user's password.
sudo (set user and do . . . . . . ) - similar to su except 'su' will give you prompt but 'sudo' you can start typing commands right after the 'sudo' command.
sudo find / -name mysql -print Temporarily changes your identity to the root user so you can search for all the files including the once that require root access privilage. It prompts you for administrator/root password
sudo Bobuser rm /Users/Bobuser/Photos/myphoto.jpg Temporarily changes your identity to the "Bobuser" identity so you can delete a photo named "myphoto.jpg" from the home directory -> Photos folder belonging to Bobuser - It prompts you for "Bobuser"'s password.
ps (running processes)
ps -ax List all running processes
ps -aux List detailed information on all running processes.
top (CPU-intensive processes currently running) - press the "q" key to quit the "top" utility
top List all running processes sorted by process id - descending and updating every second - don't forget to press the "q" key to quit, otherwise it will run continuously.
top -us10 List all running processes sorted by CPU usage - descending and updating every 10 seconds - don't forget to press the "q" key to quit, otherwise it will run continuously.
kill
kill 160 Tell the process ID #160 to terminate.
kill -9 160 Terminate the process ID # 160 at once without any hesitation.

Monday, 5 March 2012

why public static void main string args in java

The Main method is the method in which execution to any java program begins.
A main method declaration looks as follows:

public static void main(String args[]){
}


The method is public because it be accessible to the JVM to begin execution of the program.

It is Static because it be available for execution without an object instance. you may know that you need an object instance to invoke any method. So you cannot begin execution of a class without its object if the main method was not static.

It returns only a void because, once the main method execution is over, the program terminates. So there can be no data that can be returned by the Main method

The last parameter is String args[]. This is used to signify that the user may opt to enter parameters to the java program at command line. We can use both String[] args or String args[]. The Java compiler would accept both forms.

Installing Python version manager for quick python version switch

Installing Python version manager for quick python version switch
Background
Often many Linux users having to either upgrade their current Python engine version or use another Python version in parallel to the current one that is in the system. However, many Linux users (n00bs and professional users alike) don’t know or cannot find sufficient documents online to show them the best way to do download and install another Python engine. In addition, many users may need to use a newer version of Python while still having the current Python version running on their Linux Operating Systems (OS). Therefore, the pythonbrew application can be downloaded and configured to help all users to download any version of Python they desire and providing them the ability to quickly switch from one Python version to another on the fly. Feel free to follow the next steps to learn how to do just that.
Operating systems:
The tool was installed and tested in the following Operating System (OS):
root@ubersec$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: natty
Instructions
Open you terminal console and then switch user to root user by typing,
$su root
Now download python-setuptools by typing,
#apt-get -y install python-setuptools build-essential
Once you are done downloading python-setuptools, download the Python version manager by typing,
#easy_install pythonbrew
Once pythonbrew has been downloaded, type the following to complete he installation process,
#pythonbrew_install
Now you will need to add the following line source /home/user/.pythonbrew/etc/bashrc to the very end of your ~./bashrc file. For that purpose, please edit the file by using nano, vim, vi or gedit. For the purpose of this paper I have used the GNU editor.
#gedit ~/.bashrc
Now scroll all the way down and type (or copy and paste) the following line
source /home/user/.pythonbrew/etc/bashrc
Now exit and save the file and close out of your terminal windows. Now restarts you Linux OS by typing,
#shutdown –r now
Now open your terminal windows again and then logon as root once again. Then you are ready to use the pythonbrew command to download and install a new Python version. To do that, please type the following:
#pythonbrew install 2.7.2
That download and installation process should take for a while. However, if through that installation you receive an error message of any kind, please type the following and try that download and installation once again by forcing it,
#pythonbrew install --force 2.7.2
If everything has been installed as planned, type the following command to switch your python version,
#pythonbrew switch 2.7.2
In addition, you can keep downloading to your Linux OS as sorts of Python version and then switch in between each one of them as needed. If you want to see the current Python version that you have downloaded thus far, please type the following,
#pythonbrew list
If you want to see all available Python version that you can download with Pythonbrew, type the following command,
#pythonbrew list –k
To uninstall a Python that is already installed in your Linux OS use the following command,
#pythonbrew uninstall <version>
For example, to uninstall Python version 2.7.2 please type,
#pythonbrew uninstall 2.7.2
To update pythonbrew please type the following command,
#pythonbrew update
Use the below command to disable the Pythonbrew and to activate the default version of Python you Linux OS is currently use,
#pythonbrew off
You are done!