2017年9月16日 星期六

Java 8 的 Date 及 Time 的處理

方便機器處理的日期時間類別 java.time.Instant; java.time.Duration.

方便人類閱讀的日期時間類別: java.time.LocalDate, java.time.LocalTime, java.time.LocalDateTime; java.time.Period

2017年6月17日 星期六

PrimeFaces p:calendar 元件套用 bootstrap form-control 樣式

技術問題

PrimeFaces p:calendar 套用 bootstrap .form-control 是無法正確顯示。p:calendar 的輸入外框會超出元件邊界外框,如下圖所示:


2017年6月10日 星期六

EJB 3.1 Embeddable API + Junit 技術心得整理

簡介

在 Junit 中使用 Embedded GlassFish Server 做爲 EJB 元件的測試環境。The EJB 3.1 Embeddable API is designed for unit testing of EJB modules.

參考範例 Using the Embedded EJB Container to Test Enterprise Applications (https://netbeans.org/kb/docs/javaee/javaee-entapp-junit.html?print=yes)


2017年5月14日 星期日

Netbeans 中 pull 特定的 remote branch

要 pull 特定的  remote branch 到本地端:

1. (M)Teams > Pull > Remote...
2. 選擇 Git Repository Location
 
3. 選擇要 pull 的 remote branch
4. OK.

2017年4月28日 星期五

melt() 使用時 measure variable 的型態要一致

使用 melt() 來 reshape 資料時, measure variable 的型態要一致,否則會出現警告。

例如有以下的資料:


資料中,subject 欄位為 factor。若使用 subject 為 id.var 進行 melt,則會出現以下警告訊息:


因為,第一個欄位為 Factor 型態,melt() 把後面其他的欄位也視為 Factor,造成轉換時的錯誤。


Reference:
[1] thiagogm, 2013. Reshape and aggregate data with the R package reshape2, www.r-bloggers.com.

2017年4月27日 星期四

ui:debug 和 flash.keep 的衝突

若在 facelet 中使用 ui:debug,則在同一個 facelet 中使用 flash.keep 時無法正常顯示 flash scope 中的變數。

測試資料

References:
[1] ui:debug
[2] Flash class

2017年4月15日 星期六

Expectation-Maximization (EM) Algorithm 介紹


演算法,用來計算混合模型(Mixture Model)下的 Maximum Likelyhood 估計。

混合模型(Mixture Model):
觀察到的資料點(Data Point) 來自於兩個分配(Distribution), 哪些資料點是屬於那個分配呢?




Youtube 影片介紹
EM Algorithm: How it works (1) by Victor Lavrenco
EM Algorithm: How it words (2) by Victor Lavrenco