搜尋此網誌

2019年2月21日 星期四

Windows工作排程器無法執行

1.設定開始位置的目錄

2.選擇「只有使用者登入時才執行」,取消「以最高權限執行」

2019年1月29日 星期二

常見的型態轉換問題(無現成套件)

常發生於DB撈取資料為null時
  • 數字型態(如int, double)輸入null的轉換
  • 日期格式(如date, datetime)輸入null的轉換

2019年1月16日 星期三

解決Intellij console亂碼問題

開啟Intellij安裝目錄下/bin/idea.exe.vmoptions或idea64.exe.vmoptions
增加-Dfile.encoding=UTF-8

2019年1月8日 星期二

2018年10月12日 星期五

Java常用套件

1.Lombok
自動產生bean的getter和setter
intellij有支援可直接安裝
https://projectlombok.org/

2.POI
匯入匯出Office功能
https://poi.apache.org/

3.FreeMarker
生成網頁或文件或電子郵件原始碼
https://freemarker.apache.org/

4.MyBatis
ORM框架
http://www.mybatis.org/mybatis-3/

5.HiKari
數據連接池
http://brettwooldridge.github.io/HikariCP/

6.jsoup
解析html、xml
https://jsoup.org/

2017年9月5日 星期二

Java小數點格式化

1.BigDecimal

import java.math.BigDecimal;
import java.math.RoundingMode;

BigDecimal bd = new BigDecimal(輸入);
bd = bd.setScale(小數位數, RoundingMode.HALF_UP);


2.DecimalFormat

import java.math.RoundingMode;
import java.text.DecimalFormat;

DecimalFormat df = new DecimalFormat("0.00");
df.setRoundingMode(RoundingMode.HALF_UP);
df.format(輸入);


MySQL參數

wait_timeout
等待非交互式連接的秒數

interactive_timeout
等待交互式連接的秒數
交互式客戶端定義為在mysql_real_connect()中使用CLIENT_INTERACTIVE選項的客戶端