Sunday, November 18, 2012

25 Programming Quotations



·         If debugging is the process of removing software bugs, then programming must be the process of putting them in.
- 
Edsger Dijkstra (Dutch computer scientist, winner of the 1972 Turing Award)

·         Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
- Martin Golding

·         "Good code is its own best documentation" - Steve McConnell

·         “Measuring programming progress by lines of code is like measuring aircraft building progress by weight.”
- 
Bill Gates (co-founder of Microsoft)

·         “Nine people can’t make a baby in a month.” (regarding the addition of more programmers to get a project completed faster)
- 
Fred Brooks (American computer scientist, winner of the 1999 Turing Award)

·         “When debugging, novices insert corrective code; experts remove defective code.”
- Richard Pattis

·         “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
- 
Brian W. Kernighan (Canadian computer scientist, co-author of “C programming language”)

·         “C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg.”
- 
Bjarne Stroustrup (Danish computer scientist, developer of the C++ programming language)

·         “Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.”
- 
Linus Torvalds (Finnish American, software engineer and hacker, principal force behind the development of the Linux kernel)

·         “Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.”
- 
Eric S. Raymond (American programmer, open source software advocate, author of “The Cathedral and the Bazaar”)

·         “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
- 
Martin Fowler (author and speaker on software development)

·         Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?
- 
Steve McConnell (author of many software engineering books including “Code Complete”)

·         “The computing scientist’s main challenge is not to get confused by the complexities of his own making.” - E.W.Dijkstra

·         “Unix is simple. It just takes a genius to understand its simplicity.” - Dennis Ritchie

·         “Before software can be reusable it first has to be usable.” - Ralph Johnson

·         “C programmers never die. They are just cast into void.” – Anonymous

·         “Programming can be fun, so can cryptography; however they should not be combined.” - Kreitzberg and Shneiderman

·         “Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.” -Jamie Zawinski

·         “If debugging is the process of removing bugs, then programming must be the process of putting them in.” -Edsger Dijkstra

·         I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. -Bjarne Stroustrup

·         COBOL programmers understand why women hate periods. – Anonymous

·         A Perl program is correct if it gets the job done before your boss fires you. -Larry Wall

·         Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning. - Rick Cook

·         If you lie to the compiler, it will get its revenge. -Henry Spencer

·         There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. -C.A.R. Hoare

Friday, July 27, 2012

vi Editor Commands

General Startup
 To use vi: vi filename
 To exit vi and save changes: ZZ   or  :wq
 To exit vi without saving changes: :q!
 To enter vi command mode: [esc]


Counts
        A number preceding any vi command tells vi to repeat that command that many times.


Cursor Movement


h       move left (backspace)
j       move down
k       move up
l       move right (spacebar)
[return]   move to the beginning of the next line
$       last column on the current line
0       move cursor to the first column on the current line
^       move cursor to first nonblank column on the current line
w       move to the beginning of the next word or punctuation mark
W       move past the next space
b       move to the beginning of the previous word or punctuation mark
B       move to the beginning of the previous word, ignores punctuation
e       end of next word or punctuation mark
E       end of next word, ignoring punctuation
H       move cursor to the top of the screen
M       move cursor to the middle of the screen
L       move cursor to the bottom of the screen


Screen Movement
G        move to the last line in the file
xG       move to line x
z+       move current line to top of screen
z        move current line to the middle of screen
z-       move current line to the bottom of screen
^F       move forward one screen
^B       move backward one line
^D       move forward one half screen
^U       move backward one half screen
^R       redraw screen  ( does not work with VT100 type terminals )
 ^L       redraw screen  ( does not work with Televideo terminals )


Inserting
r         replace character under cursor with next character typed
R        keep replacing character until [esc] is hit
i          insert before cursor
a         append after cursor
A        append at end of line
O        open line above cursor and enter append mode


Deleting
x         delete character under cursor
dd       delete line under cursor
dw      delete word under cursor
db       delete word before cursor


Copying Code
        yy      (yank)'copies' line which may then be put by the p(put) command. Precede with a count for multiple lines.


Put Command
        brings back previous deletion or yank of lines, words, or characters
P       bring back before cursor
p       bring back after cursor


Find Commands


?      finds a word going backwards
/      finds a word going forwards
f      finds a character on the line under the cursor going forward
F      finds a character on the line under the cursor going backwards
t      find a character on the current line going forward and stop one character before it
T      find a character on the current line going backward and stop one character before it


 ; repeat last f, F, t, T


Miscellaneous Commands


 .      repeat last command
 u      undoes last command issued
 U      undoes all commands on one line
 xp    deletes first character and inserts after second (swap)
 J      join current line with the next line
 ^G    display current line number
 %      if at one parenthesis, will jump to its mate
 mx    mark current line with character x
 'x      find line marked with character x


NOTE: Marks are internal and not written to the file.


Line Editor Mode
 Any commands form the line editor ex can be issued upon entering line mode.


 To enter: type ':'
 To exit: press[return] or [esc]


ex Commands
 For a complete list consult the UNIX Programmer's Manual


READING FILES
 copies (reads) filename after cursor in file currently editing


 :r filename


WRITE FILE
 :w  saves the current file without quitting


MOVING
 :# move to line #
 :$ move to last line of file


SHELL ESCAPE
executes 'cmd' as a shell command.
:!'cmd'