August 24, 2013

Node.js

Set the environment

  • NODE_ENV=env node script.js
Debug

  • node debug script.js

May 31, 2013

[git] git branching model

前情提要是這篇 A successful Git branching model

使用這個方法,理論上正式釋出的版本都會在 master branch 裡面然後加上 tag。但在使用者不願意/不能夠做大版本升級,只能上小 patch 的情況下,如果釋出後的版本要繼續維護,就有機會遇到下面的問題。

假設 master branch 上有 1.0、1.1、1.2 這幾個版本。某一天發現有個 bug 在 1.1 這個版本開始就存在,所以需要回頭去更新 1.1 跟 1.2 把問題修掉然後釋出新版。可能的作法就是從這幾版 branch 出去,把 patch 放上去以後下新 tag 成為 1.1.1,1.2.1 這樣。

只是這樣做以後,就不是所有正式釋出的版本都存在 master,經常性存在的 branch 也不會只有 master 跟 develop,還會有這些有小 patch 的 branch。

既然很有可能要有這些 branch,最後選擇的解法就是只要釋出大版本就開 branch 出去,像是 release-1.1、release-1.2,要 patch 某個版本就直接到相對應 branch 去修改。

我自己的感覺是原本 git flow 的作法是把 release 這件事視為線性的,當現實狀況不是線性而是有分支而且分支還會成長的時候就不適用了,除了這點以外,文章其他部份還是很值得參考的。

May 02, 2013

Mongo Query

from Optimizing MongoDB Compound Indexes  

  •  For indexed queries
    • nscanned: the number of index keys in the range that Mongo scanned
    • nscannedObjects: the number of documents it looked at to get the final result
    • n: matched documents
  • "optimal index" for a query
    • include all the query's filtered fields and sort fields
    • any range-filtered or sort fields in the query must come after equality fields
    • if there are multiple optimal indexes, Mongo chooses one arbitrarily

April 15, 2013

April 03, 2013

[git] delete remote tag

2017/6/10 update
git push origin --delete mytag

--
git tag -d mytag
git push origin :refs/tags/mytag

March 28, 2013

[git] change author

git commit --amend --author "New Author Name < email >"

February 04, 2013

git blame

git blame deleted line (show the revision in which a line appeared)
  • git blame --reverse start..end -- file
git blame deleted file (give the revision in which file deleted)
  • git blame REVISION~ -- file

February 01, 2013

雜感

之前在蘋果app store買了個app,用了以後發現有問題,隔天馬上嘗試了所謂的退貨步驟,半個月過去無消無息,不管是制式回信說已經收到我的回報,或是告知我這個情況下無法退款,一切就像石沉大海。

回想起兩年前在market付費升級了一個記帳軟體,因為匯入資料會當掉,寫信給開發者以後對方馬上就退我錢,後來我找到當掉原因以後告知他,就再次購買了,整件事在一天內解決。

只是不知道什麼時候才能夠不用跳板的在play store買東西阿(遠目)

January 29, 2013

處理已經被砍掉的 remote branch

清掉全部已消失的 remote branch
  • git remote prune origin
清掉特定的 remote branch
  • git push origin --delete branch (2017/11 updated)
  • git branch -d -r origin/disappear-branch

January 15, 2013

For my "Hero"

2013年的開始,用了三年多的Hero退休了。

2009年九月剛入手Hero的時候,還不像現在滿街低頭族,常有朋友借去把玩,問我好用嗎,是否值得入手。然後短短兩年內,智慧型手機就從少見到泛濫。問題也轉變成了我怎麼還在用Hero,什麼時候換手機。

隨著Hero年齡漸長,使用新的app確實是愈來愈吃力,後來我乾脆放棄更新/安裝一些對它非常不友善的東西,例如google map跟Facebook。只是生活使用上,也找不到非換不可的理由。

有時心血來潮就查查新手機的價錢,這次是pchome忽然的特價,一時衝動就下手了。現在一般中階的手機用起來就已經非常流暢,也終於可以裝一些以前想試的小東西。

留一篇文作為紀念。