2015年10月9日 星期五

2015年9月26日 星期六

在 word 中快速加入與頁寬同寬的底線

插入水平線


有時有些很簡單做的功能,不知為何很難找到出處,微軟實在是滿妙的

2015年9月8日 星期二

在前端程式使用 Firebase 的 SOP

參考 https://www.firebase.com/tutorial/#gettingstarted

此範例為一簡單的聊天程式,沒有修改或刪除的功能。必需事先申請一 firebase 帳號並取得站點位置
  1. 引用程式庫
  2. 新建 Firebase 物件,連接(參考)到資料庫(站點位置,依所申請的firebase帳號而定)
  3. 進行操作;新增 (set / push)
  4. 聆聽事件;on('event', function (snapshot)...)
  5. 取得 snapshot 內容 (val) 呈現給使用者,進行處理、顯示
其中操作的部分,包含 CRUD ,都有近似與 RMDB 相對應的操作,但是 cross join 目前看來沒有很簡單的對應,演算法必需要出現迴圈。另一方面沒有概念直接對應到 SQL 的 where 敘述,而是採用了一種 sort-splice method 

 { orderByChild(), orderByKey(), orderByValue(), or orderByPriority() } 

 orderByKey(): 以鍵名排序
 orderByValue(): 以鍵值排序
 orderByChild(): 鍵值均為 hash ,以此 hash 中指定鍵"值"排序

 { limitToFirst(), limitToLast(), startAt(), endAt(), and equalTo() }

(參 https://www.firebase.com/docs/web/guide/retrieving-data.html)
 limitToFirst(), limitToLast(): 以序數選取,類似 sql 中的 top
 startAt(), endAt(), and equalTo(): 以值之比較選取,類似 sql 中的 where 條件

根據 2.  Understanding Data 的說明,我們可以這樣理解,firebase 所儲存的其實是一個大型的 hash of hash (of hash ..., in perl's term) 的複合資料結構,沒有原生的陣列資料,因此必需借用 hash 來實現。


2015年8月28日 星期五

ionic 內的各種小圖示列表

http://themetaro.com/omega/layout3/icon_ionicons.html

2015年8月27日 星期四

heroku上要發佈非master的branch的語法

git push heroku yourbranch:master

參見 https://devcenter.heroku.com/articles/git

2015年8月26日 星期三

github上git clone回來的專案,本地修改後才fork之後push到遠端的SOP


  1. git clone XXX
  2. 本地修改完成
  3. 在github上fork XXX為自己的XXX,並取得 clone URL,下稱YYY
  4. git add .
  5. git commit -m '...說明文字'
  6. git remote add master YYY
  7. git push master master

2015年8月25日 星期二

在 ionic / cordova / nodejs 的app中整合FB(或google / twitter / ...)帳號

登入這些帳號,有時只是需要一個 ID ,有時是要使用帳號背後的服務,這樣的需求愈來愈多
  1. [ionic + cordova] 利用 firebase 提供的服務 (重點是它先後試了authWithOAuthRedirect / authWithOAuthPopup ,這樣無論在什麼裝置都可以登入;不過 authWithOAuthRedirect 的錯誤處理目前仍然有問題,有時會死在程式裏面,或許應該等它穩定一點…), 也可看這篇 (較新,使用了 authWithOAuthToken ,只能在行動裝置登入;應先嘗試 authWithOAuthRedirect / authWithOAuthPopup , 才能在 browser 上登入);不使用 firebase 的看這篇 (只能在行動裝置登入)
  2. [nodejs] github 上的 passport 插件,號稱可登入300多種服務
  3. [cordova] 一款只能登入 FB 的插件