2012年11月29日 星期四

2012 簡單生活節 手機版節目表


這禮拜就是2012 SimpleLife 簡單生活節
整個華山同時有四個舞台的音樂演出
前兩屆 每次去總覺得要一直翻紙本的節目表
有點麻煩
在公司用mobile web做了簡易的手機版演出節目表
使用了AppCache 只要開啟過,離線也可正常使用
start
home

可以查詢兩日各舞台的演出節目
可即時查詢各舞台正在進行的演出


簡易的歌手介紹
http://simplelife.streetvoice.com/m/

Heart of Gold


從小唱片音響一直都是家裡重要的設備
老爸喜歡聽台語歌
喜歡聽日本歌
架上一落一落的黑膠唱片
我總是在裡面找著那些布袋戲的主題曲
然後學著我爸 放起了唱片

國中以後 有機會跟老爸去唱片行
他買了日本歌買了洪榮宏
我也有機會夾帶了一張羅大佑

在老爸的那一大疊唱片中
很難得的看到一張英文合輯
這看起來 不像是老爸聽的音樂
可能是小叔叔在家裡留下來的
這是第一次聽到了Neil Young的Heart of Gold
高中開始玩吉他
歌本裡 也一再的看到這首歌

一直到失戀的那年
才彷彿在Neil Young的音樂中 找到救贖
靠著一張一張的CD 一首一首的歌曲
走過苦悶的那一年


2012年11月5日 星期一

Git多帳號登入

在使用GitHub或BitBucket服務時,使用ssh登入是最快的方式
要如何在一台電腦上使用不同的帳號登入
一.產生各自帳號的SSH Key
執行
ssh-keygen -C "youremail@xxx"
預設會儲存為id_rsa 的key,不同的email產生key請設定使用不同檔名儲存

二設定ssh config
在~/.ssh/目錄下產生config檔
在config內設定不同host指定使用不同的ssh key
例
Host PeterBitbucket
HostName bitbucket.org
User git
IdentityFile ~/.ssh/peter_id_rsa
IdentitiesOnly yes

Host OzzyBitbucket
HostName bitbucket.org
User git
IdentityFile ~/.ssh/ozzy_id_rsa
IdentitiesOnly yes

三.設定remote
在要使用的git repos設定remote
原本設定
git remote add git@bitbucket.org:ozzy/myrepos.git
改用以下方式設定
git remote add OzzyBitbucket:ozzy/myrepos.git
另一個帳號
git remote add PeterBitbucket:peter/myrepos.git
讓不同的帳號使用不同的ssh key連線

2012年9月21日 星期五

簡易的git操作使用

git功能相當多,這裡只列出最基礎使用部份
一.環境安裝
  1. window
    到以下網址下載安裝
    http://code.google.com/p/msysgit/downloads/list?q=net+installer
    http://git-scm.com/downloads
  2. ubuntu
    sudo apt-get install git
    
二.名詞說明
  1. repostory
    有版本控制功能的目錄
  2. local remote
    local是自己的repos,主軸為master,若有分支,就會有相關branch名稱
    remote是遠端的repos,通常在多人同時維護一份程式碼的狀況
    每個人都會有一個local的repos,大家都會對應到同一個remote做
    大家的版本共同管理,預設的remote名稱是origin
  3. stage ,unstage
    把檔案加入到stage,就是讓這些檔案會在版本控制的範圍內
  4. push,pull
    pull是由remote將檔案拉下來到local上
    push是將local檔案放到remote上
  5. commit,checkout
    做commit的動作就是產生一個新的檔案版本
    checkout就是切換到指定的版本或是分支

三.本機檔案版本控制
  1. 目錄初始化
    會產生一個.git目錄,讓該目錄成為一個repostory
    在目錄下執行
    git init
    
  2. 查看目前repostory的狀態
    檔案是否有更動,是否有檔案被加到stage,是否尚未commit
    等相關狀態都可以使用這指令看到
    git status
    
  3. 查看已儲存的版本(comit)清單
    git log
    
  4. 加檔案到stage
    加入指定檔案
    git add filename
    
    全部有異動的都加入
    git add .
    
  5. 刪除檔案
    git rm filename
    
    刪除目錄
    git rm -rf dirname
    
  6. 將已經加入stage的檔案移到unstage
    git reset HEAD filename
    
  7. 產生版本
    git commit -m "xxx"
    
  8. 回復到指定版本
    git reset -hard HEAD~1
    
    數字代表回復到前幾個版本
四.與遠端Remote做版本控制
  1. 將遠端的repos複製到local
    執行指令後,會將remote的目錄,複製到目前這個目錄下
    git clone 遠端目錄
    
  2. 設定要同步的遠端remote
    local respos 加入remote後,就可以把資料放到remote上,
    或是由remote 下載回來
    git remote add  aliasName remote路徑
    
  3. 查看目前所有的remote
    local respo上可以同時設定多個remote
    git remote -v 
  4. 由remote上取回最新檔案
    git pull origin master
    
  5. 將local檔案上傳到remote
    git push origin maste
    
五.修改檔案後更新流程
當你已經修改了檔案要放到remote上,也許remote上的檔案,在這過程中已經被別人更新做
以下流程處理
  1. 先把自己的修改內容放到暫存區
    git stash
    
  2. 由remote取回最新檔案
    git pull origin master
    
  3. 合併
    git stash apply
    
    把自己放在暫存區已改過的檔案與最新拉回來的檔案merge在一起,
    若有衝突的地方,系統會自動在差異處加入註解,
    修改好再儲存
  4. 重新把檔案加入到stage
    git add .
    
  5. 產生版本
    git commit -m xxxx
    
  6. 傳回remote上
    git push origin master

六.使用Github當作remote
  1. 選擇連線方式
    在你要clone的repos上可以看到有提供ssh或是http連線方式
    提供不同的連結網址,使用http連線,每次會要求輸入連線帳號密碼
    (就是github帳號密碼)
    若使用ssh則可直接連線,但須先設定ssh key
  2. 設定ssh key
    參考https://help.github.com/articles/generating-ssh-keys
    產生ssh key並貼到github個人資料頁內,即可使用ssh直接連線
七.使用Dropbox當remote
在指定的dropbox目錄上執行
git init --bare
該目錄即可成為一個git remote

2012年9月17日 星期一

使用CoffeeScript 建立nodeJS Class與使用

一.單一檔案單個Class
1.定義class檔案
寫好class檔案,以module.exports輸出
file:myclass.coffee
class MyClass
    constructor:(@name)->
module.exports=MyClass
2.使用
require參數是實體檔案的名稱,同目錄下用./來設定路徑
可以用不同的名稱來接收require的回傳值(Class)
Rocker=require('./myclass')
rocker=new Rocker()

二.單一檔案多個Class
1.定義class檔案
好class檔案,以module.exports輸出
file:myclass.coffee
class MyClass
    constructor:(@name)->
class MyClass2
exports.Rocker=MyClass
exports.Tester=MyClass2
2.使用
MyRocker= require('./myclass').Rocker
MyTester= require('./myclass').Tester
rocker=new MyRocker('oz')