Thursday, May 03, 2007
Monday, April 30, 2007
VIM tips
Seven habits of VIM
Habit 1: Moving around quickly
/argc n, n, n ... => : set hlsearch *
=> Put :set hlsearch in .vimrc; use * again again
Habit 2: Don't type it twice.
type XpmCreatePixmapFromData() => type CTRL-N on word (word completion)
Habit 3: Fix it when it is wrong.
mis-spell => :iabbrev teh the
:syntax keyword WordError teh
Habit 4: A file seldom comes alone.
:!ctags -R
:tag init
:tnext
:grep "\" **/*.h <- search
:cnext
or gf => Go to file on header file names (work for http)
=> make sure the path option is set correctly.
[I => find the word under cursor to include files.
[ => Jump there.
Habit 5: Let's work together
Working with MsWord
=> set Vim with :set tw=0; wrap linebreak
Copy the text between app and Vim through clipboard.
Seven habits of VIM
Habit 1: Moving around quickly
/argc n, n, n ... => : set hlsearch *
=> Put :set hlsearch in .vimrc; use * again again
Habit 2: Don't type it twice.
type XpmCreatePixmapFromData() => type CTRL-N on word (word completion)
Habit 3: Fix it when it is wrong.
mis-spell => :iabbrev teh the
:syntax keyword WordError teh
Habit 4: A file seldom comes alone.
:!ctags -R
:tag init
:tnext
:grep "\
:cnext
or gf => Go to file on header file names (work for http)
=> make sure the path option is set correctly.
[I => find the word under cursor to include files.
[
Habit 5: Let's work together
Working with MsWord
=> set Vim with :set tw=0; wrap linebreak
Copy the text between app and Vim through clipboard.
Monday, April 16, 2007
Thursday, April 05, 2007
If we have a following block,
{
int i = 20;
int j = 40;
...
int k = i * j;
printf("k = %d, i = %d, j = %d\n", k, i, j);
}
Then the compiler would optimize this block in a way that i, j, and k variables never exist, since the block only uses values of them. Also, these values are within the scope of the block too. Thus, the compiler simply replaces the variables with constants. However, if the block ever uses reference or addresses, then it is illegal for compiler to optimize them. In this case, the compiler wouldn't optimize those variables away.
{
int i = 20;
int j = 40;
...
int k = i * j;
printf("k = %d, i = %d, j = %d\n", k, i, j);
}
Then the compiler would optimize this block in a way that i, j, and k variables never exist, since the block only uses values of them. Also, these values are within the scope of the block too. Thus, the compiler simply replaces the variables with constants. However, if the block ever uses reference or addresses, then it is illegal for compiler to optimize them. In this case, the compiler wouldn't optimize those variables away.
Saturday, March 31, 2007
Monday, March 26, 2007
Wednesday, March 21, 2007
Law of Demeter
When I refactor a class and feel that this class is doing too much,
then I have to say that there might be a better way of dealing with this.
http://en.wikipedia.org/wiki/Law_of_Demeter
then I have to say that there might be a better way of dealing with this.
http://en.wikipedia.org/wiki/Law_of_Demeter
powered by performancing firefox
Monday, February 26, 2007
Combine multiple pdfs into one pdf
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=chem120_assnt1.pdf -dBATCH ./1638_001.pdf ./1638_002.pdf ./1638_003.pdf ./1638_004.pdf ./1638_005.pdf ./1638_006.pdf ./1638_007.pdf ./1638_008.pdf ./1638_009.pdf ./1638_010.pdf ./1638_011.pdf ./1638_012.pdf ./1638_013.pdf ./1638_014.pdf ./1638_015.pdf ./1638_016.pdf
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=chem120_assnt1.pdf -dBATCH ./1638_001.pdf ./1638_002.pdf ./1638_003.pdf ./1638_004.pdf ./1638_005.pdf ./1638_006.pdf ./1638_007.pdf ./1638_008.pdf ./1638_009.pdf ./1638_010.pdf ./1638_011.pdf ./1638_012.pdf ./1638_013.pdf ./1638_014.pdf ./1638_015.pdf ./1638_016.pdf
Subscribe to:
Comments (Atom)