Thursday 29 September 2011

Mastering vi Editor




1. Start-up
vi filename

2. vi Modes
vi has two modes

  •     Command mode: In command mode, the letters of the keyboard perform editing functions (like moving the cursor, deleting text, etc.). To enter command mode, press the escape <Esc> key. By default vi starts in command mode. 
  •     Insert mode: In insert mode, the letters you type form words and sentences. Unlike many word processors, vi starts up in command mode.

3. Entering Text
Press i
If you make a mistake, pressing <Backspace> or <Delete> may remove the error, depending on your terminal type.

4. Moving the Cursor
To move the cursor to another position, you must be in command mode. If you have just finished typing text, you are still in insert mode. Go back to command mode by pressing <Esc>. If you are not sure which mode you are in, press <Esc> once or twice until you hear a beep. When you hear the beep, you are in command mode.
The cursor is controlled with four keys: h, j, k, l.

     Key        Cursor Movement
     ---        ---------------

     h        left one space
     j        down one line
     k        up one line
     l        right one space
   
5. Undoing
To undo your most recent edit, type
     u
To undo all the edits on a single line, type
     U (uppercase)
Undoing all edits on a single line only works as long as the cursor stays on that line. Once you move the cursor off a line, you cannot use U to restore the line.

6. Closing and Saving a File
With vi, you edit a copy of the file, rather than the original file. Changes are made to the original only when you save your edits.

To save the file and quit vi, type
     ZZ
The vi editor editor is built on an earler Unix text editor called ex. ex commands can be used within vi. ex commands begin with a : (colon) and end with a <Return>. The command is displayed on the status line as you type. Some ex commands are useful when saving and closing files.

To save the edits you have made, but leave vi running and your file open:

    Press <Esc>.
    Type :w
    Press <Return>.

To quit vi, and discard any changes your have made since last saving:

    Press <Esc>.
    Type :q!
    Press <Return>.

How to search files in unix/linux env


find PATH -name 'FILE.extn'

  • find: Find is a command 
  • PATH: Where do you want to search. /home will focus the search in home directory. If you are not sure about the path, mention /. This symbol stands of root. All directories will be searched including mounted filesystems.
  • -name: This option makes the search case sensitive. -iname option to find something regardless of case.
  • 'FILE.extn': File name that you are searching
Example:


  1. find / -name 'gc.dat'
  2. find /home -name 'gc.dat'
  3. find / -iname 'gc.dat'

Wednesday 28 September 2011

Performance Testing API(s)





Functional Performance Testing - Single user access API over a period of time and captures response time during each attempt. Average response time during the time period is taken as baseline for rest of the tests.

Load Testing - Web API(s) is loaded with certain number of users to achieve targeted TPS (Transactions per sec). Typically this test is done after establishing a baseline for each transaction, and finally load testing the entire group of transactions.

Stress Testing - Users are ramped up until a failure occurs. This helps us identify breaking point of the application and to establish margin between expected traffic and failure point.

Soak (Endurance) Testing - API(s) are subjected to typical user load over a extended time with occasional spikes. The intend here is to identify problems that may occur only after a extended uptime.

Scalability TestingAPI(s) are subjected to varying user load over a period of time. The intend here is to identify the optimum user load. Here users are being varied. Scalability test can be performed even by varying any system configuration or hardware.

What does 403 error really mean?



            Every request get a status message from the server, 403 means 'Access Forbidden'. But what most of us don't know is the meaning of its sub-status. Below list gives us a clear idea of what it really means
  • 403.1 - Execute access forbidden.
  • 403.2 - Read access forbidden.
  • 403.3 - Write access forbidden.
  • 403.4 - SSL required.
  • 403.5 - SSL 128 required.
  • 403.6 - IP address rejected.
  • 403.7 - Client certificate required.
  • 403.8 - Site access denied.
  • 403.9 - Too many users.
  • 403.10 - Invalid configuration.
  • 403.11 - Password change.
  • 403.12 - Mapper denied access.
  • 403.13 - Client certificate revoked.
  • 403.14 - Directory listing denied.
  • 403.15 - Client Access Licenses exceeded.
  • 403.16 - Client certificate is untrusted or invalid.
  • 403.17 - Client certificate has expired or is not yet valid.
Source: www.wikipedia.org