版權聲明

所有的部落格文章都可以在右邊[blog文章原始檔案]下載最原始的文字檔案,並依你高興使用 docutil 工具轉換成任何對應的格式方便離線閱覽,除了集結成書販賣歡迎任意取用,引用
顯示具有 Coding 標籤的文章。 顯示所有文章
顯示具有 Coding 標籤的文章。 顯示所有文章

Git 安裝與設定

Git

Install

到官網抓 http://git-scm.com/ 最新版本。

然後進行標準 linux 安裝程序..

gunzip git-1.6.3.3.tar
tar -xvf git-1.6.3.3.tar
make configure
./configure --prefix=/usr/local
make all
sudo make install  install-doc install-html

如果要安裝說明文件(man html..),要另外編譯因為 Git 的說明文件使用了預設可能 不會安裝的工具 asciidoc 和 xmlto,因此如果要編譯說明文件請先確認系統已經安裝 了這兩個程式。

編譯說明文件..

make doc
make install-doc

設定user name和email

git config --global user.name "myNameHere"
git config --global user.email myEmail@gmail.com

我安裝在 macbook 上 commit 會出現錯誤

error: There was a problem with the editor 'vi'.

不知道什麼原因,後來將 editor 設定成 textmate 就ok了..

git config core.editor "mate -w"

一些其他設定

上色

在 .gitconfig (HOME 目錄下面) 加上下面設定:

[color]
   branch = auto
   diff = auto
   status = auto
[color "branch"]
   current = yellow reverse
   local = yellow
   remote = green
[color "diff"]
   meta = yellow bold
   frag = magenta bold
   old = red bold
   new = green bold
[color "status"]
   added = yellow
   changed = green
   untracked = cyan

用外部Diff工具

寫一個 script 包裝工具的參數比如要使用 DiffMerge

#$2=old file   $5=new file
#依照實際環境設定可能需要明確指出DiffMerge的路徑
diffMerge $2 $5

然後到 .gitconfig 加上設定

[diff]
     #剛剛寫的scripte路徑和檔名
     external = /usr/local/bin/git-diffmerge-wrapper.sh

TortoiseSVN 使用 DiffMerge 當作diff工具

TortoiseSVN 使用 DiffMerge 當作diff工具

DiffMerge 是一套免費的 diff/merge 工具,不只免費還跨平台,又簡單不難用 所以推薦一下。

教學:如何設定DiffMerge為TortoiseSVN的Diff和Merge工具。 http://www.manik-software.co.uk/blog/post/TortoiseSVN-and-DiffMerge.aspx

:)

XCode Text Editor note

XCode Text Editor note

寫程式最常用到的就是Editor,使用時間最常所以要加快寫程式的速度, Editor的熟悉度有相當的影響,通常沒有好用的IDE環境下小弟的首選 Editor是VIM,主要是他的編輯功能實在太強大,ㄧ有些時候也會用 Emacs比如再OSX下的macVim不知道為什麼就是不好用,又怪怪的可是 Aquamacs就相當好用,這時候當然使用Aquamacs拉。

開發Cocoa程式也可以使用vim或是emacs,不過這種依附在龐大Framework 的程式開發,一個專門的IDE可以提供的方便性絕對值得我們離開慣用的 Editor來使用,這邊介紹一些比較好用的特性。

常用熱鍵

  • Cmd+double click (⌘double click):跳到定義
  • {}前後double click: 選取block
  • cmd+option+up (⌘⌥↑): head file 和 implement file 間切換
  • cmd+shift+d (⌘⇧D): 快速開檔

Focus Follow Selection

Xcode 提供的一個滿實用的功能,可以再 View->Code Folding->Focus Follow Selection 開啟或關閉,開啟後Xcode會自動判斷目前游標所在位置的程式和上下文的關係 ,比如function,if block等等。 (參考下圖)

http://www.quicksnapper.com/files/5896/9494763294A03AE2B6BE57.png

Fold

Fold 這功能幾乎都有,可以直接再Xcod text editor案右鍵從menu選擇

http://www.quicksnapper.com/files/5896/2484415514A03C2F7B6E2A_m.png

這邊把比較常用的熱鍵列出,小弟以為手不要離開鍵盤使用熱鍵才是家快速度的 不二法門,因此每次使用奇怪功能我一定要確認是否有hot key可以使用。

Description Key symbol
Fold method ctrl+cmd+up ⌃⌘↑
unfold method ctrl+cmd+down ⌃⌘↓
fold comment ctrl+shift+cmd+up ⌃⇧⌘↑
unfold comment ctrl+shift+cmd+down ⌃⇧⌘↓

Scope Edit

Scope edit 就是方便的 symbol rename,先點兩下要改名的symbol (變數,method name...) 然後到 Edit->Edit All in Scope (或是熱鍵 ctrl+cmd+t [⌃⌘T])修改,可以看到 整個scope中都修改了,假如想在修改前檢查,可以使用命令 Edit->Select next placehold (或是熱鍵 ctrl+/ [⌃/])跳至下一個。

Text macro

Textmate上面的超好用的功能code snippet其實xcode也是有的,再xcode editor中輸入for 然後按下esc(⎋)可以看到列舉的code complete選項

http://www.quicksnapper.com/files/5896/17253845644A03C9F5CFA6A_m.png

選擇 for loop 就可以看到 xcode已經幫你打好大部分的code,你要做的只剩填上該填的部份 即可,和Scope Edit一樣你可以使用(ctrl+/ ⌃/)來遊走每一個要填的欄位。

http://www.quicksnapper.com/files/5896/10132787144A03C9520CA78_m.png

列舉內建的縮寫

Text macro name prefix
if Block if
if/else Block ifelse
Else if Block elseif
for Loop for
for i Loop fori
While Loop while
do-while loop do
switch block switch
case block case
Enum definition enum
strunt definition struct
union definition union
type definition typedef
printf() printf
#pragma mark pm
Pragma Mark pragma
#import pim
#import(framework) pimf
#import(system) pims
#include pin
#include(system) pins
#if block pif
#ifdef block pifd
#if/else pife
#ifdef/else pifde
#if 0 pifz
copyright comment copyright
comment selection comment
separator comment cseparator
Try/Catch block @try
Catch block @catch
finally block @finally
NSLog() log
alloc/init call a
array declaration aa
Mutable Array decl ma
Array for Loop fora
Array Foreach Loop fore
nit Definition init
dealloc Definition dealloc
bind:defined bind
@interface defined @interface
@implementation @implemen
@protocol @protocol
NSString nss
NSMutableString nsms
NSArray nsa
NSMutableArray nsma
NSDictionary nsd
NSMutableDictionary nsmd

Run Shell Command

選取遇執行的指令,案熱鍵ctrl-r (⌃r)

ex: 選取ls

http://www.quicksnapper.com/files/5896/7654303914A03CE346F985.png

執行後 (ctrl + R)

http://www.quicksnapper.com/files/5896/12336378634A03CE75535DD.png

Subversion as Windows service

CMD命令

sc create svn binPath= "\"c:\Program Files\Subversion\bin\svnserve.exe\" --service -r D:\SVN" Displayname= "Subversion Server" depend= Tcpip start= auto

start: net start svn stop: net stop svn 正確的話應該可以用svn://host-name,來存取(這邊範例是本機上的repository) 修改權限 在Repository目錄下面/conf/svnserve.conf,修改如下 [general] anon-access = read auth-access = write password-db = userfile 同目錄增加檔案 userfile [users] austin = austinpassword sally = barpassword 然後遠端登入的時候記得使用建立好的username和password即可。 (TortoiseSVN會直接帶出帳號密碼 dialog給你輸入) 備份 寫batch file如下,在丟進排程軟體即可(可直接使用window內附的) REM Create sub directory called \yymmdd_hhmmss REM where yymmdd_hhmmss is a date_time stamp like 030902_134200 set hh=%time:~0,2% REM Since there is no leading zero for times before 10 am, have to put in REM a zero when this is run before 10 am. if "%time:~0,1%"==" " set hh=0%hh:~1,1% set yymmdd_hhmmss=%date:~2,2%%date:~5,2%%date:~8,2%_%hh%%time:~3,2%%time:~6,2% svnadmin dump d:/svn > d:/back/%yymmdd_hhmmss%.dump
Related Posts with Thumbnails