2018年4月24日 星期二
2018年1月19日 星期五
使用 awk 來抽離 csv 檔案中的部分欄位
使用 awk 來抽離 csv 檔案中的部分欄位
參考:
gawk -F, '{OFS=","} {print $1, $2}' 4c-students.csv > 4c-stud-import.csv會將 4c-students.csv 中的第一及第二 column 抽離出來, 並以逗號作為分隔字元. OFS (Output File Separator) 是內建的變數, 設定輸出時使用的分隔字元.
參考:
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
方便人類閱讀的日期時間類別: java.time.LocalDate, java.time.LocalTime, java.time.LocalDateTime; java.time.Period
2017年6月17日 星期六
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.
1. (M)Teams > Pull > Remote...
2. 選擇 Git Repository Location
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.
例如有以下的資料:
資料中,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.
訂閱:
意見 (Atom)




