Renovatio

2009年4月6日 #

bash常用快捷键备忘

摘自http://linuxhelp.blogspot.com/2005/08/bash-shell-shortcuts.html
____________CTRL Key Bound_____________
Ctrl + a - Jump to the start of the line
Ctrl + b - Move back a char
Ctrl + c - Terminate the command
Ctrl + d - Delete from under the cursor
Ctrl + e - Jump to the end of the line
Ctrl + f - Move forward a char
Ctrl + k - Delete to EOL
Ctrl + l - Clear the screen
Ctrl + r - Search the history backwards
Ctrl + R - Search the history backwards with multi occurrence
Ctrl + u - Delete backward from cursor
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command
____________ALT Key Bound___________
Alt + < - Move to the first line in the history
Alt + > - Move to the last line in the history
Alt + ? - Show current completion list
Alt + * - Insert all possible completions
Alt + / - Attempt to complete filename
Alt + . - Yank last argument to previous command
Alt + b - Move backward
Alt + c - Capitalize the word
Alt + d - Delete word
Alt + f - Move forward
Alt + l - Make word lowercase
Alt + n - Search the history forwards non-incremental
Alt + p - Search the history backwards non-incremental
Alt + r - Recall command
Alt + t - Move words around
Alt + u - Make word uppercase
Alt + back-space - Delete backward from cursor

高亮的是觉的有用但之前不太熟悉的

posted @ 2009-04-06 21:49 win2cs 阅读(161) | 评论 (0)编辑 收藏

2008年12月6日 #

C++中动态分配与释放多维数组

以三维数组(N*N*N)为例

方法1:

分配

int (*a)[N][N] = new int [N][N][N];

释放

delete [] a;
= NULL;


方法2:

分配

    int *** a = new int ** [N];
    
for(int i = 0; i < N; ++i){
        a[i] 
= new int * [N];
        
for(int j = 0; j < N; ++j)
            a[i][j] 
= new int[N];
    }

释放

  for(int i = 0; i < N; ++i){
      
for(int j = 0; j < N; ++j)
          delete [] (a[i][j]);
      delete []a[i];
  }
  delete [] a;
  a 
= NULL;

效率:实验表明方法1较方法2快,原因大概是new operator的调用开销大,且其开销以调用次数为主要衡量标准

posted @ 2008-12-06 21:53 win2cs 阅读(499) | 评论 (0)编辑 收藏

仅列出标题