Tuesday, March 30, 2010

VI keyboard Shortcuts

:set hlsearch (:nohl)

:set mouse=a

:set nocompatible

:set smartindent
:set nowrapscan (to disable the wrap search)

:highlight String ctermfg=red

:highlight search ctermfg=black


  • To indent a block of code, keep the cursor in any of the {} braces, and do =%
  • To comment a block of line, keep the cursor in the first line (from where you want to comment), 
          - press CTRL + v (to enter visual mode)
          - use UP DOWN arrows (or j/k keys) to select the lines
          - press I (shift + i) (this enters into visual mode)
          - type "//" 
          - Once you press ESC, the // will be applied to all the lines you selected.
  • To uncomment a block of code, keep the cursor in the first line (from where you want to uncomment)
          - press CTRL + v (to enter visual mode)
          - select RIGHT LEFT arrows to select only the "//" characters
          - press "d" (to delete all the // characters)
  • To search and replace a text ("src" to "dest"), use
          :%s/src/dest/ ==> Replaces first occurence of "src" in each line
          :%s/src/dest/g ==> Replaces all the occurences of "src" with "dest" in all the lines
          :%s/src/dest/gc ==> Asks for confirmation to replace or not for each occurence


  • Vimdiff commands:
    • ]c - to go to the next change
    • [c - to go to the previous change
    • do - diff obtain; means get the changes from other file
    • dp - diff put; means put the changes into other file

Friday, March 26, 2010

Emacs Keyboard shortcuts

Movements:

M - f  <==> Move forward by one word
M - b <==> Move backward by one word

C - f   <==> Move forward by one letter
C - b  <==> Move backward by one letter
C - p  <==> Move up by one line
C - n  <==> Move down by one line

M - v  <==> PAGE UP
C - v  <==> PAGE DOWN

M - >  <==> Goto end of the file (U have to press "SHIFT" here to enter "<" )
M - <  <==> Goto the beginning of the file (same as above)

File operations:









C - x C- f  <==> To open a file
C - x k  <==> Close the current buffer (kill buffer)


M - d  <==> Delete next word
C - k   <==> Delete current line
C - y   <==> Paste (watever copied)

C - [space] <==> Start marking the portion
C - w  <==> Cut the portion till the cursor is in currently
M - w  <==> Copy the portion till the cursor is in currently

C - x u  <==> Undo last operation

M - g g  <==> Goto the line
M - x replace-string  <==> Search and replace

C - s [string]  <==> To search a string forward
C - r [string]  <==> To search a string backward

Windows:


C - x 0   <==> Close the current window
C - x 1   <==> Close all the windows except current window
C - x 2   <==> Split the current window vertically (means top and bottom)
C - x 3   <==> Split the current window horizontally (means left and right)
C - x o ('o' for 'others')   <==> Switch between windows

Shell:

M -x shell  <==> Open shell (terminal)

Setting Tab Size:


M - x set-variable [ENTER] c-basic-offset [ENTER]  8 <==> Setting tab size to 8


Auto-Indentation:

M -x indented-text-mode   <==> set auto indent (does not work through putty)

To search for a string in all the files in a directory:


M - x grep-find [Enter]  <==> This will generate a command; at the end of the command, give the string you want to search; and also set the directory in which you wana search

Thursday, March 18, 2010

Links

http://www.catch22.net/tuts/kernel101

Basics

Courtesy: http://en.wikipedia.org/wiki/Device_driver

Device Driver
- an extension of OS
- a "bridge" between hardware and applications (and Operating Systems)
- abstracted into logical and physical layers (and hence can be categorized as Logical Device Drivers (LDD) and Physical Device Drivers (PDD))
- LDD written by OS vendors where as PDD written by device vendors

An attempt by Microsoft to reduce system instability due to poorly written device drivers by creating a new framework for driver development called "WINDOWS DRIVER FOUNDATION (WDF)".

WDF - includes UMDF (User Mode Driver Framework) and KMDF (Kernel Mode driver Framework)

1. UMDF - implements a message-based protocol for communicating with their devices - as user mode drivers.
- any malfunction on these drivers does not cause any system instability

2. KMDF - allows development of kernel-mode device drivers, but attempts 2 provide std implementations functions that are well known to cause probs, including cancellation of IO operations, power management, and PnP device support

Device Drivers on Windows, can run on *both Ring 0 and Ring 3*