User talk:Andy: Difference between revisions
From KitwarePublic
Jump to navigationJump to search
(Random things that need to be put somewhere) |
(Random Python Tricks) |
||
Line 54: | Line 54: | ||
* MITK from CSiro: http://www3.ict.csiro.au/ict/content/display/0%2C%2Ca16254_b16408_d72676,00.html | * MITK from CSiro: http://www3.ict.csiro.au/ict/content/display/0%2C%2Ca16254_b16408_d72676,00.html | ||
* Fairly good C++ reference: http://www.cppreference.com/index.html | * Fairly good C++ reference: http://www.cppreference.com/index.html | ||
== Random Python Tricks == | |||
===How do I get a current line number or file name from the scrip?=== | |||
<pre> | |||
import inspect | |||
f = inspect.currentframe() | |||
print "Line number: %d" % f.f_lineno | |||
print "File name: %s" % f.f_code.co_filename | |||
</pre> | |||
Also, you can go up the stack and do the same thing: | |||
lineno = inspect.currentframe().f_back.f_lineno |
Revision as of 15:34, 28 October 2004
VIM is a great editor
Ok, so I use VIM. I used to use Emacs, but I guess the starting time was bothering me. Also, for small sysadmin edits I used VIM already and I was mixing key strokes from Emacs and VIM.
My VIM Settings
set nocompatible " We use a vim set noautoindent set tabstop=2 " Tabs are two characters set shiftwidth=2 " Indents are two charactes too set expandtab " Do not use tabs " syntax on " Turn on syntax hilighting " set hlsearch " Hilight the search results set incsearch " Incrementally search. Like Emacs set matchpairs+=<:> " Also match <> when pressing % set showmatch set laststatus=2 " " Minimalistic gui set guioptions-=T set guioptions-=m set guioptions+=f set guifont=Andale\ Mono\ 8 " colorscheme darkblue " " Add spell checking if exists("loaded_vimspell") set spell_auto_type="tex,mail,text,html,sgml,otl" :SpellAutoEnable endif " set wildmode=longest " Make tabcompletion behave correctly set selection=exclusive " Only select up to not including last character set ignorecase " Ignore case when searching lowercase set smartcase " Ignore case when searching lowercase " " set cinoptions={1s,:0,l1,g0,c0,(0,(s,m1 " VTK, ITK style indenting " " Fix for Makefiles do tabs :autocmd BufRead,BufNewFile [Mm]akefile :set noexpandtab highlight SpellErrors guibg=Red guifg=Black
Random things that need to be put somewhere
- MITK from CSiro: http://www3.ict.csiro.au/ict/content/display/0%2C%2Ca16254_b16408_d72676,00.html
- Fairly good C++ reference: http://www.cppreference.com/index.html
Random Python Tricks
How do I get a current line number or file name from the scrip?
import inspect f = inspect.currentframe() print "Line number: %d" % f.f_lineno print "File name: %s" % f.f_code.co_filename
Also, you can go up the stack and do the same thing:
lineno = inspect.currentframe().f_back.f_lineno