2015年10月6日 星期二

遊戲/APP營運常見術語~重點摘錄~




相關參考連結
http://info.localytics.com/blog/how-to-review-your-app-analytics-in-10-minutes-a-day
http://www.niaogebiji.com/article-2533-1.html
http://www.sfw.cn/xinwen/464130.html
http://baike.baidu.com/item/LTV
http://www.sykong.com/2015/07/23144
http://www.youxituoluo.com/23087.html
http://mrjamie.cc/2011/04/27/ltv-cpa/
http://www.youxituoluo.com/33753.html

http://flurrymobilechinese.tumblr.com/post/126080721245/retentionbasic
業界流傳著「40-20-10」的規則,也就是隔日回訪率(下載後隔一天會使用的,以此類推)要達到40%、七日回訪率要達到20%、三十日回訪率要達到10%,這就能稱作一個較為健康的產品狀況,當然,這些指標會因每個產品不同的屬性、內容以及使用情境而異,開發者需要自己找出最有意義的回訪週期與目標。

http://blog.talkingdata.net/?p=209
月周期Revenue = ARPPU * MAU * 付費轉換率


2015年6月2日 星期二

案例分享~摔車了!!! 能怎麼賠? (商業保險篇)

大明摔車了...所幸無明顯內外傷...
因這次事故, 來來回回進醫院檢查, 也因身體不適在家休息了幾天, 這時, 保險能怎麼賠呢?
社會保險在符合條件下, 多少能補貼一些損失...
詳見此篇: 案例分享~摔車了!!! 能怎麼賠? (社會保險篇)
那商業保襝又能幫到什麼?

商業保險-意外險

一般保意外險, 多半會有住院日額及實支實付的理賠:
  • 住院日額(傷害醫療日額): 因意外傷害造成住院, 住幾天就賠幾天的保額, 保額通常幾百到幾千
  • 實支實付(傷害醫療): 因意外傷害造成醫療費用的產生, 可理賠需要自付額的部份費用, 總額不超過保額
大明未住院, 但有去看醫生, 所以可獲得理賠如下:
  • 實支實付(傷害醫療): 可申請看病的錢, 看病的錢就又再申請一次囉!!

商業保險-醫療險

醫療主要分終身醫療及定期醫療, 只是不管終身還定期, 多數屬住院醫療, 是在有住院情況時才有理賠, 所以本例無法獲得理賠...(住院醫療目的在於轉移較大風險)

商業保險-失能險

以壽比的薪水保險保額100萬為例, 因意外造成工作失能, 重點理賠項目有:
  • 住院1個月4萬
  • 休養1個月3萬
  • 復健1個月5千
  • 失能年金: 1年起終身無法恢復工作能力, 15年每個月理貼8,333元
其屬意外險的一種, 因此也有意外身故/殘廢的給付~不但保大也保小~~

所以大明在家養病5天, 可獲得理賠如下:
  • 休養1個月3萬: 1,000/1天x5天=5,000


統計上列社會保險&商業保險例子的理賠:
  • 看醫生的錢(自費部份): 460x3次=1,380
  • 職災的傷病給付: 0.7x760x(5-3)=1,064
  • 休養1個月3萬: 1,000/1天x5天=5,000
  • 總計理賠: $7,444

雖然社會保險給付不算多, 但只要深入了解其申請條件, 爭取該有的理賠, 加減也可以補貼一些醫療費用~
商業保險便是在加強社會保險不足的部份, 以此例來看, 商業保險的理賠對於大明來說有較大的幫助, 在休養期間不但免擔心沒有薪水領, 除了有薪水補貼也補償了一些醫療費用~~讓大明可以無後顧之憂的來養傷啦~~

2015年6月1日 星期一

真糟糕~快4個月才更新文章~~

真糟糕~快4個月才更新文章~~
好像有點慘~~哈XDDD
要檢討一下了~~

TortoiseGit使用SSH Key和GitLab建立連線

何時會使用SSH Key

  1. 使用ssh連線時
  2. 不想輸入帳密時
  3. 檔案太大時

如何使用SSH Key


1. 建立SSH Key


1.1 先查看GitLab裡的教學


點選 generate it 出現如下畫面


1.2 開啟Git Bash


1.3 輸入1.1裡看到的指令ssh-keygen -t rsa -C "your email"

依指示輸入檔案產生的位置及密碼, 若不變更, 一直按Enter即可
紅框標示即檔案位置


2. 建立Putty Key


2.1 開啟Puttygen


2.2 載入剛剛產生的private key


檔案類型選擇All Files(*.*)


2.3 儲存剛載入的key, 將其副檔名存為.ppk



3. 使用SSH來連線


3.1 在TortoiseGit設定SSH連線

URL設定xxx@gitlab.servername:ooo.git
Putty Key載入剛存的.ppk

3.2 在GitLab設定SSH Key
即第1張圖例, 點選Add SSH Key後
Title可任意取名
Key則是把1.3產生的.pub內容(用記事本開就能看到內容)copy/paste過來即可


2015年2月24日 星期二

案例分享~摔車了!!! 能怎麼賠? (社會保險篇)

交通事故層出不窮, 騎車因擦撞, 自撞, 自摔者也不在少數...
在此分享大明的摔車案例, 在事故發生後, 社會保險以及商業保險, 能幫到什麼?

剛出社會的大明, 對工作很有熱忱, 想要把上司交待的工作做好, 但有時無法如期完成工作而加班趕進度...
某天, 大明加完班, 在騎車回家的路上, 燈光昏暗視線不明的情況下, 和另一台車發生了擦撞...而摔車了...機車還壓在身體上...(凹鳴...痛...)

送醫檢查, 所幸無明顯內外傷...
回家休息後, 身體的疼痛陸續有感, 後來再去醫院進一步檢查, 發現了有肋骨骨折的狀況...
仍然幸運的是, 骨折程度只需好好休息, 一兩個月後就會自行逐漸癒合~~

大明因這次事故, 來來回回進醫院檢查, 也因身體不適在家休息了幾天, 這時, 保險能怎麼賠呢?

社會保險-勞工保險

被保險人(勞工)在上下班途中, 發生事故而造成傷害, 此狀況便屬職業災害
此時便有機會申請職災的醫療給付及傷病給付, 主要的請領條件如下:
  • 職災的醫療給付: 有發生門診住院醫療的情況(詳細說明請點我)
  • 職災的傷病給付: 正在治療且未能取得原有薪資, 從不能工作的第4天起可申請(詳細說明請點我)
主要的給付狀況如下:
  • 職災的醫療給付: 免繳交健保規定之部分負擔醫療費用, 且住院期間30日內膳食費半數之補助(詳細說明請點我)
  • 職災的傷病給付: 
    • 第1年: 0.7x平均日投保薪資x(實際治療期間-3)
    • 第2-3年: 0.5x平均日投保薪資x實際治療期間(詳細說明請點我)
其它詳細說明可至勞保局網站查詢~~~

所以大明在家養病5天, 可獲得理賠如下:
  • 職災的醫療給付: 可申請看病的錢, 所以看病不用錢囉
  • 職災的傷病給付: 0.7x760(以22K為例的日投保薪資, 可至勞保局網站查詢)x(5-3)=1,064

類社會保險-汽機車強制險

政策性的社會保險, 政府強制汽機車持有者一定要投保的保險~
僅提供乘客和車外第三人(e.g. 路人), 不含駕駛人本身的如下保障:
  • 死殘200萬
  • 傷害醫療20萬: 同一事故每一位受害人傷害醫療總額20萬為限(各別), 原則上以實支實付處理
    • 病房費差額以每日1500元為上限
    • 膳食費每日180元
    • 看護費用以每日1200元, 最高三十日為限
    • 其它詳細可至CALI網站查詢(十、給付標準及應扣除項目 裡的第3項)
若是單獨一輛車自撞, 自摔...要有理賠的話, 則需附加駕駛人傷害險才有理賠!

所以大明可以向造成事故的另一輛車的投保單位申請理賠如下:
  • 傷害醫療: 可申請看病的錢, 所以看病的錢就再申請一次囉

商業保險-意外險, 醫療險, 失能險

詳見此篇: 案例分享~摔車了!!! 能怎麼賠? (商業保險篇)


2015年2月17日 星期二

2015年1月19日 星期一

My troubleshooting of Rails on Windows

前言

Windows上安裝Linux VM, 直接在Linux環境開發Rails網站程式(我的Rails環境安裝(CentOS)), 除了在建立環境時, 可以熟悉Linux Server上的安裝設定外, 在開發完成後, 也可以直接建立正式的Web Server環境(e.g. use nginx)來做正式環境的測試.

這樣的做法, 便是在模擬Production Server的狀況, 在建立環境以及開發過程中, 就能及早發現可能會遇到的問題, 進而及早解決.

雖然我已經是這麼做了, 但有時不免會覺得等個VM開啟, 之後在console環境下寫程式, 有點累...XP...所以...我終於決定在要Windows環境上建立個Rails開發環境啦~~~

在Windows安裝Rails開發環境並不難, 安裝檔下載完後, 點一點下一步就能完成了...
本來預想, Linux上開發好的專案目錄整個載回Windows後, 下指令bundle install之後rails s就能測試網站了...但...果然發生了一連串的問題!!!
問題多半在於gem的安裝(未安裝或版本跟Linux環境略有差異)以及其相關的設定...

將問題以及解決方法筆記起來幫助自己記憶, 也分享給遇到相同狀況的人~~:)


Troubleshooting

1. bundle install時, 出現Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
這錯誤多半是在compile某段程式時, 找不到相依的程式(gem), 所以就報錯啦...
報錯的stack trace丫里丫雜很長, 好加在最後它都會說哪個gem出了什麼問題, 按照指示尋找蛛絲馬跡, 就有機會解決問題啦!

案例一
明明有libv8的gem, 怎麼報錯了呢
D:/RailsInstaller/Ruby2.1.0/bin/ruby.exe extconf.rb
creating Makefile
系統找不到指定的路徑。
系統找不到指定的路徑。
系統找不到指定的路徑。
D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:58:in `setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently not available (RuntimeError)
        from D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:42:in `block in build_libv8!'
...
Gem files will remain installed in D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3 for inspection.
Results logged to D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/libv8-3.16.14.3/gem_make.out
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
解決方法, 就在於後面的option設定
# gem install libv8 -v '3.16.14.3' -- --with-system-v8
相關說明可參考此連結: https://github.com/cowboyd/libv8#bring-your-own-v8

案例二
用到mysql的功能, 但缺了什麼設定呢
D:/RailsInstaller/Ruby2.1.0/bin/ruby.exe extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
...
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check the mkmf.log file for more details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=D:/RailsInstaller/Ruby2.1.0/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
...
Gem files will remain installed in D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/mysql2-0.3.16 for inspection.
Results logged to D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/mysql2-0.3.16/gem_make.out
An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.

Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.
解決方法, 就在於安裝mysql2的套件, 需設定開發環境上的MySQL Server路徑, 讓其可成功的建置並安裝
# gem install mysql2 -v '0.3.16' -- '--with-mysql-dir="MySQL Server installed path" --with-mysql-lib="MySQL Server installed path\lib" --with-mysql-include="MySQL Server installed path\include"'

案例三
therubyracer你怎麼了???
D:/RailsInstaller/Ruby2.1.0/bin/ruby.exe extconf.rb
checking for main() in -lpthread... no
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check the mkmf.log file for more details.  You may need configuration options.
...
D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': 
You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError) and *not* the one that is bundle with the libv8 rubygem. 
However, it could not be located. please make sure you have a version of v8 that is compatible with 3.16.14.3 installed. 
You may need to special --with-v8-dir options if it is in a non-standard location
...
Gem files will remain installed in D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/therubyracer-0.12.1 for inspection.
Results logged to D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/therubyracer-0.12.1/gem_make.out
An error occurred while installing therubyracer (0.12.1), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.1'` succeeds before bundling.
解決方法, 不使用therubyracer
在Gemfile裡, therubyracer預設是被註解起來的...會被註解起來, 一定有其道理, 所以不要隨便把他打開呀XD
若要使用JavaScript runtime, 可以安裝其它的runtime, e.g. Node.js
# sudo yum install nodejs -y
相關說明可參考此連結: http://stackoverflow.com/questions/18687575/why-is-the-gem-therubyracer-commented-out-by-default-in-gemfile


2. rails s後, 出現找不到什麼東西的狀況...
比如會看到的錯誤有: 找不到指定的模組, cannot load such file...etc.
就如報錯所說, 就是找不到那些東西, 所以把那些東西補齊就能解決問題啦~XD

案例一
找不到libmysql.dll
D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `require': 126: 找不到指定的模組。   - D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/mysql2-0.3.16/mysql2/mysql2.so (LoadError)
        from D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `'
...
解決方法, 將MySQL Server目錄裡的libmysql.dll複製到Ruby\bin的目錄下
相關說明可參考此連結: https://github.com/brianmario/mysql2#windows

案例二
tzinfo找不到data(TZInfo::DataSourceNotFound)
D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/tzinfo-1.2.2/lib/tzinfo/dat
a_source.rb:182:in `rescue in create_default_data_source': No source of timezone
 data could be found. (TZInfo::DataSourceNotFound)
Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving th
is error.
        from D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/tzinfo-1.2.2/l
ib/tzinfo/data_source.rb:179:in `create_default_data_source'
        from D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/tzinfo-1.2.2/l
ib/tzinfo/data_source.rb:40:in `block in get'
...
解決方法, Gemfile加入下列gem
gem 'tzinfo-data'
細節設定請參考此連結: https://putshello.wordpress.com/2014/01/06/tzinfodatasourcenotfound-no-timezone-data-source-could-be-found/

案例三
找不到相依的bcrypt
D:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- bcrypt_ext (LoadError)
...
解決方法, 升級bcrypt至3.1.9
# bundle update bcrypt
在Gemfile, 設定bcrypt使用3.1.9的版本
gem 'bcrypt', '~> 3.1.9'
相關說明可參考此連結: https://github.com/codahale/bcrypt-ruby/issues/102


3. Could not find a valid gem 'xxx' or Could not find gem 'xxx' ...
表示gem沒下載或安裝成功, 範例錯誤如下
ERROR:  Could not find a valid gem 'bootstrap-sass' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/latest_specs.4.8.gz)
...
Could not find gem 'bootstrap-sass (~> 3.3.1) x86-mingw32' in the gems available on this machine.
...
解決方法, 增加一個可以下載的gem source後, 下載gem
# gem source -a http://rubygems.org/
# gem install bootstrap-sass


最後, 相依的gem都無誤後, 我要把專案的db建立起來(not migrate)
# bundle exec rake db:reset
or
# bundle exec rake db:drop
# bundle exec rake db:create
# bundle exec rake db:schema:load
# bundle exec rake db:seed
再次rails s, 並實際連到網頁, 確認是否還有類似的問題, 再去解決囉~~~


4. 網頁實際執行, 用到某些套件功能時, 出錯了...Orz
通常是某些gem的版本在windows上不支援...只能在報錯中尋找蛛絲馬跡了...

案例一
TypeError: 物件不支援此屬性或方法
用中文, google大神查不到資料呢XD, 用英文, TypeError: Object doesn't support this property or method, 就查到相關解決方案了...
解決方法, Gemfile加入下列gem
gem 'coffee-script-source', '1.8.0'
接下來執行
bundle update coffee-script-source
相關說明可參考此連結: http://stackoverflow.com/questions/28312460/object-doesnt-support-this-property-or-method-rails-windows-64bit


2015年1月18日 星期日

產險的意外險獲賠後片面被解約!!!


之前看到這則新聞, 來分享一下個人學習經驗...

產險的意外險, 通常是俗夠大碗, 不但價錢漂亮, 保障範圍也廣~~~
但...多數是「不保證續保」, 通常健康狀況改變申請過理賠, 產險公司是可以單方面決定不續保的!
保障範圍雖廣但不深, 若考量大的風險發生, 需要長期住院醫療時, 產險的意外險就有可能顧不到, 因為有的只理賠90天或180天...

其實保障內容在契約及商品條款都會清楚載明, 只是保險人員(業務員或經紀人)不一定會特別去提...



壽險公司的意外險, 價格相對高貴一些, 但其實也相對較有保障~~~
「保證續保」, 只要職業危險等級未提高至不承保, 且保戶願意繼續繳費, 多數壽險公司的商品是保證續約的, 理賠天數多半也都比較長

不管是產險還是壽險公司, 其提供的保障內容百百種, 雖大同小異, 但組合方式不同, 結果就會不同; 有的只理賠90天, 有的理賠365天; 有的有高額喪葬費, 有的有殘障年金; 有的有保證續保, 有的沒有...

除了找對人投保外, 呼應新聞的結尾, 在投保前, 還是要多多注意合約內容, 才不會吃悶虧囉~~~