jQuery 取得元素名稱

jQuery 
1.6以前使用.attr('tagName')取得名稱, 
1.6以後使用.prop('tagName')取得名稱.


參考
jQuery Attr: http://api.jquery.com/attr/
jQuery Prop: http://api.jquery.com/prop/

MySQL - mysqldump single column

公司突然要求匯出某個table的某個column
mysqldump又不支援只輸出一個欄位, 
山不轉路轉, 先將要輸出的欄位生成新表在dump即可~


# 假如資料表已存在刪除

DROP TABLE IF EXISTS `_database_`.`_new_table_`;
# 新增資料表
CREATE TABLE `_database_`.`_new_table_` 
SELECT `_column_`
FROM `_database_`.`_src_table_` 
WHERE ...

# 將資料dump到/tmp底下, 因為tmp寫入不受權限限制
mysqldump -u root -p -t -T/tmp --fields-enclosed-by=\" --fields-terminated-by=, --databases _databases_ --tables _new_table_;

匯出後會在/tmp底下找到2個檔
_new_table_.sql
_new_table_.txt

CodeIgniter 單一網址 多語系



看Apple用了/tw/來代取代tw.apple.com
省去了買網址的費用, 是一個很不錯的設計,
CI本身就提供Route的功能, 在參考網友的分享, 
讓http://xxx.xxx/tw/可以實現



$route['([a-zA-Z]{2})/?'] = 'welcome';
$route['([a-zA-Z]{2})/(:any)'] = '$2';



參考來源: 生活大小事

Apache 幫網頁加密







參考: http://sparc.nfu.edu.tw/teacher/htaccess/index.htm

Linux 指令 tar

tar 是壓縮/解壓縮指令

壓縮
tar -zcvf <要儲存的DIR> <要壓縮的DIR>

解壓縮
tar -zxvf <解壓縮的檔案名稱>

GitHub For Windows



  1. 安裝Git
    http://git-scm.com/download/win
  2. 打開桌面的git bash
    利用git bash產生ssh-key
    切換目錄到.ssh底下
    cd /c/Users/James/.ssh/
    ssh-keygen -t rsa -C "james@gmail.com"
    給它檔名, EX: james
    會產生james, james.pub
    ssh-add /c/users/James/.ssh/james
    登入GitHub新增SSH-key
    在回git bash測試連線
    使用ssh -T git@github.com建立know_hosts
    "Hi username! You've successfully authenticated, but GitHub does not provide shell access."
    出現以上的字串表示你已經成功串連GitHub
  3. 到GitHub新增一個repo(或是找一個存在的repo)
  4. 在本機找一個資料夾按右鍵選擇"Git Bash"開始clone你的repo.

你可以安裝TortoiseGit介面化管理你的git.
http://code.google.com/p/tortoisegit/