Wednesday, August 19, 2015

How to open a tar file in Unix

How to open or Untar a "tar.gz" file in Unix:

Assume your file is myfile.tar.gz 
Type below command to first unzip the gz file
     tar -zxvf myfile.tar.gz
It will extract the all files to current directory.  You can also specify a different directory to extract to using -C parameter and a path to the directory as follows:
     tar -C /pathToFolder -zxvf myfile.tar.gz

How to open or Untar a "tar" file in Linux or Unix:

Type  below command to extract file. It will extract file to the current directory
     tar -xvf myfile.tar
Or to extract the file to the another directory
     tar -C /pathToFolder -xvf myfile.tar

Thursday, July 16, 2015

Sql query to get nth highest salary

  • Query 1

  • SELECT DISTINCT(salary) FROM table_name tn1 WHERE (n-1) = (SELECT COUNT( DISTINCT( tn2.salary )) FROM table_name tn2 WHERE tn2.salary > tn1.salary
  • Query 2

  • SELECT TOP 1 salary FROM (SELECT DISTINCT TOP n FROM table_name ORDER BY saalary DESC) tn ORDER BY salary

Wednesday, July 15, 2015

Delete duplicate record from database table

  • Query 1
          DELETE FROM table_name WHERE id NOT IN ( SELECT MAX(ID) FROM table_name GROUP BY duplicate_col_1, duplicate_col_2, duplicate_col_3)

  • Query 2
          CREATE TABLE AS new_table_name AS SELECT DISTINCT * FROM original_table_name;
          DROP TABLE original_table_name;
          RENAME new_table_name TO original_table_name;

How to create or delete branch using Git Bash

In order to create new branch, you have to first clone existing repository to your local machine and then modify/add your cloned codebase as required. Once you are done with changes, commit changes to repository with new branch name.

Below are the steps to create new branch

Create New Branch

Clone existing repository:
  • Open git bash window
  •  Move to your work location or where you want to clone your code
              $ cd “c:\users\<loginId>\GitWorkArea"
  • Clone repository to local
             $ git clone <git project url>
  • Get inside your repository folder, in my case it is TestRepo
             $ cd TestRepo
  • Checkout branch to be clone, for me it is develop_test
            $ git checkout develop_test
            Branch develop_test set up to track remote branch develop_test from origin.
            Switch to a new branch develop_test
  •  Fetch latest from repository
            $ git fetch
            $ git pull origin

Now you are done with cloning.
Its time to push newly created clone to repository to create new branch
  • Create New branch
             $ git checkout –b <branchName>
  •  Push new branch to repository
            $ git push origin
  • Commit file to repository
            Step 1 : Add modified/added files to staging area
             $ git add .
            Step 2 : commit changes to local repository
             $ git commit –m “commit message”
            Step 3 : push commit changes to remote repository
             $ git push origin


Delete branch

It is two step procedure, first delete from local and then push to repository to delete from remote.
  • Delete from local file system
                $ git branchName –d
  •  Delete branch from repository
                $ git push origin


Software Testing Life Cycle

Defect life cycle or, Bug life cycle
Below are life cycle steps:
  • New: Defect logged for the first time to system
  • Assign: Once bug is approved by lead then bug is assigned to developer,
  • Open: Developers starts analysis and start working on bug
  • Fixed: code fix implemented.
  • Restest: As soon as bug is fixed, and send to qa for testing
  • Verify: After bug fix, tester test the bug again. If bug is not present in software , then state changed to Verified 
  • Reopen: if bug still exists ever after fix, state of bug changed to reopen state
  • Duplicate: two or more bug in system mentioned same concept/issue.
  • Reject: after discussion with stake holder, if bug is not genuine, state of bug changed to rejected
  • Deffered: Bug has expected to be fixed in next release
  • close: if bug has removed from system, state changed to close.