2012/07/15

Haskell

apt-get install haskell-platform

http://hackage.haskell.org/platform/linux.html
http://www.vex.net/~trebla/haskell/haskell-platform.xhtml
http://www.haskell.org/ghc/

http://yannesposito.com/Scratch/en/blog/Yesod-tutorial-for-newbies/

2012/07/14

RHEL 6 安裝 LDAP



同事 Peter Lai 寫了篇非常清楚的 LDAP Wiki,一定要 Open Source 一下的!
LDAP 服務
LDAP 為輕量級名錄存取協定(Lightweight Directory Access Protocol)的簡稱。
若要簡單的說,LDAP是一種存取資料的方式。 LDAP 伺服器存放著特定格式的資料,提供給許多下游來查詢。 我們可將 LDAP 視為一種特別的資料庫,只是它存放資料的方法較為不同。
名錄資訊樹與項目
LDAP 中所儲存的資料被稱為名錄資訊樹(Directory Information Tree, DIT), 是由多個項目(entry)以階層方式所組成的樹狀資料結構。
物件類別與屬性
每一個項目可以被指派至少一個以上的的物件類別(objectClass), LDAP 已經內建許多物件類別,以供設計出不同類型的項目。
舉例來說,當我們需要設計一個項目用以存放組織或單位資訊,就可指派內建的 organizationalUnit 物件類別給該項目; 若是我們需要有關存放人事資料的資訊,例如員工基本資料,內建的 person 物件類別便是個不錯的選擇。 當然,LDAP 也支援自訂的物件類別。
不同的物件類別可以賦予擁有該類別的項目不同的屬性群(attributes) 在這些屬性群中,有些屬性是一定要存在的,稱為必要屬性(MUST attribute) 而其他不一定要存在的的則稱為選用屬性(MAY attribute) 屬性的值便是我們會在 LDAP 中儲存的資料。
如圖1-2,我們可以看到項目 D 被指派的物件類別為 person 而 person 物件類別被定義可擁有的屬性有: cn, sn, userPassword, telephoneNumber, seeAlso, description,其中 cn 與 sn 為必要的屬性。 值得一提的是,一個 DIT 的根項目(此例中的項目A),必須指派為 domain 物件類別,其必要屬性 dc 屬性。
相對識別名稱與識別名稱
每一個項目都都會有個自己的名字,稱作 相對識別名稱(relative distinguished name, RDN) 是取用項目數個(通常只用一個)屬性名稱與屬性值作為該項目的 RDN
例如項目 D 的 RDN 便可取作 “cn=Peter Lai”(cn 指的是 commonName) 此外,每一個項目在整個 DIT 中亦具有一個 唯一 的名字,稱為 識別名稱(distinguished name, DN) DN 是取用自根項目至該項目中所有項目節點之 RDN,將其以逗號(,)串接而成的字串。
如圖 1-3,我們假設: 項目 A 的 RDN 為 “dc=cwb,dc=gov” 項目 B 的 RDN 為 “ou=mfc”(ou 指的是 organizationUnit) 項目 D 的 RDN 為 “cn=Peter Lai” 則項目 D 的 DN 便為 “cn=Peter Lai,ou=mfc,dc=cwb,dc=gov”
在 DIT 中,項目間的 RND 可能也可以重複,但是 DN 必定是唯一的。 藉由 DN 我們可以找到 DIT 中特定的項目,再取出其中某個屬性值來取得資料。

yum install openldap openldap-clients openldap-servers
yum install httpd php php-ldap
yum insatll phpldapadmin

Reference:
http://tutarticle.com/linux/rhel-6-ldap-server
http://serverfault.com/questions/323497/how-do-i-configure-ldap-on-centos-6-for-user-authentication-in-the-most-secure-a

2012/07/06

gitflow

git-flow 下載:

git clone https://github.com/nvie/gitflow.git


git-flow 有綁一個 submodule 叫 shFlags(https://github.com/nvie/shFlags)
必須執行以下指令來設定:

git submodule init && git submodule update


如果無法執行 git submodule update
可以直接切換到剛 clone 下來的 gitflow 內,手動下載 shFlags:

cd gitflow
rm -rf shFlags
git clone https://github.com/nvie/shFlags.git


git-flow 安裝:

cd gitflow
sudo make install


使用說明:
http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/
http://codesherpas.com/screencasts/on_the_path_gitflow.mov
http://vimeo.com/16018419

Reference:
01. https://github.com/nvie/gitflow
02. http://ihower.tw/blog/archives/5140
03. https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh

Guard Livereload

apt-get install mpdcron
apt-get install libreadline-dev
apt-get install google-chrome-stable

Chrome Extension
http://download.livereload.com/2.0.8/LiveReload.crx

rvm install 1.9.3
rvm use 1.9.3 --default

gem install rails
gem install bundler
gem install em-websocket
gem install guard
gem install guard-livereload

rails new TEST
cd TEST
vim Gemfile 加入 gem 'guard' 和 gem 'rb-readline'
bundle exec guard init livereload
guard start

https://github.com/mockko/livereload/issues/91
http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-
http://stackoverflow.com/questions/9340497/cannot-load-such-file-readline-loaderror-when-running-heroku-create-stack