2011年4月20日 星期三

vim function already exists

現在設定vim當修改了_vimrc(或.vimrc)後,會重新load新的vim設定。

在設定完後,會出現一個錯誤訊息,
vim function already exists

是說自定的function又被重覆定義了一次~
這個時候只需要在定義的function後面加入一個!
如下:

function! MySys ()
return "linux"
endfunction


這樣在reload _vimrc時,就不會出現重覆定義的錯誤訊息了

參考資料:
Suppressing function already exist warnings ?

2011年4月12日 星期二

陣列特有的特性

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
  int a[3][4] = {
                {0, 1, 2, 3},
                {4, 5, 6, 7},
                {8, 9, 10, 11}
                };
  printf ("%d\n", a[2][1]);
  printf ("%d\n", *a[2] + 1);
  printf ("%d\n", *(*(a + 2) + 1));
  printf ("%d\n", *(*a + 9));
  system ("PAUSE");
  return 0;
}


參考資料:
(原創) 二維陣列與字串陣列有什麼差異? (C/C++) (C)
(原創) 為什麼將二維陣列傳入函數時,還要傳入column數? (C/C++) (C)
在函數中傳入二維陣列

2011年4月3日 星期日

VIM自定函式集合

判斷目前的Platform平台
" Platform
function! MySys()
if has("win32")
return "windows"
else
return "linux"
endif
endfunction

VIM的內建的變數

$VIMRUNTIME
表示vim的主程式的目錄

2011年3月16日 星期三

Findstr

先把註解行拿掉
findstr -v "^#" oemconfig.template

再把空白行拿掉
findstr -v "^#" oemconfig.template | findstr -v "^#"

把結果存到oemconfig_remove_mark.temp
findstr -v "^#" oemconfig.template | findstr -v "^$" > oemconfig_remove_mark.temp

透過FOR把每一行印出來
FOR /F "delims=" %i in (oemconfig_remove_mark.temp) do echo %i

把文件中,若有符合H19_EFI_BOOT_BLOCK_SIGN_CHECK = NO
則把H19_EFI_BOOT_BLOCK_SIGN_CHECK = YES
印出來
findstr -v "^#" oemconfig_remove_mark.temp | findstr "^H19_EFI_BOOT_BLOCK_SIGN_CHECK *= *NO *" > NUL && echo H19_EFI_BOOT_BLOCK_SIGN_CHECK = YES

參考資料:
如何從 SQL 錯誤記錄檔或 DBCC 輸出中掃描出錯誤
FINDSTR進階用法
Batch files - FINDSTR

2011年3月11日 星期五

設定pipe以ANSI格式或Unicode格式導向pipe或檔案

CMD

/A 將內部命令輸出結果以 ANSI 格式導向 pipe 或檔案
/U 將內部命令輸出結果以 Unicode 格式導向 pipe 或檔案

參考資料:
unicode console?

2011年3月2日 星期三

修改電腦地區語言

有時候在測試機在build code的時候,會發現compiler error

但是,在我的工作機上build code卻沒有問題。

問題的原因在於電腦的地區語言的選項有問題。

另一個常遇到的是執行檔到測試機上執行會是亂碼!

如何在Win 7 Home Premium改變地區語言哩~

Control Panel→Change keyboards or other input methods
選擇第四個Label: Administrative
Language for non-Unicode programs改為Chinese(Traditional, Taiwan)

參考資料:
詢問-關於S125