Posts

Showing posts from August, 2009

perl convert a string to a number

All you have to do is call int to change a string to a int

my $someint = int($somestring);

python print standard error

Printing is very simple to the standard error

sys.stderr.write('Printing to the stderr')

vim insert mode

To get into vim insert mode

Just type the letter i

This will put you in insert mode when you are in command mode.

By default your in command mode when you enter vim. To get into command mode just type the escape key ESC

python else if statement

Is actually a elif statement. Here is an example below

python else if statement


>>> x = int(raw_input("Please enter a number: "))
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'

python elsif statement

python else if statement


>>> x = int(raw_input("Please enter a number: "))
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'

vim how to highlight

vim how to highlight

You can turn on syntax highlighting by typing:
>:syntax enable

vim how to go to the end of file

vim how to go to the end of file.

Just type:
>g

Where is is meant to say you hold down the shift key while pressing g

vim how to quit

vim how to quit.

That's another easy one. Just type:
>:q

To quit without saving type:
>:q!

To save then quit type:
>:wq

vim how to save

Vim how to save a file easy.

Just type ESC key (this put you in command mode)

If you open a file using something like vim SOMEFILENAME
Then type
>:w

If it's a new file just type
>:w SOMEFILENAME

Vim how to open a file to edit

All you need to do is type the vim command :edit or you can use the shortcut :e will open the file for editing.

How to escape single quotes bash

Just use my web page that I setup to escape single quotes in bash

http://www.stevemorin.com/utils/bashEscape.html

Open Source Message Queues AMQP

AMQP http://www.amqp.org
http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol

Downtown San Francisco Beginner Yoga

I have started beginner Yoga in downtown San Francisco and love it.

I go to http://www.itsyoga.net

307 5th Street Suite A San Francisco, CA 94107
(415) 543-1970

If your a beginner and want a great class you should come.

Steve

python for loop example

Python for loop

>>> for i in range(10):
... print i
...
0
1
2
3
4
5
6
7
8
9
>>>

Programming Perl Pages

I put programming perls in google by accident and this link came up

http://homepages.cwi.nl/~tromp/pearls.html

Have a few compact and cool programs in particular a cool prime sieve.

Steve