1. 用docker起sonarqube
(1) docker pull sonarqube
(2) docker run -d --name sonarqube -p 9096:9000 -p 9094:9094 sonarqube
(先不管db 用embedded的)
(3) http://ip:9096/about 用admin/admin可登入 知道起成功了
2. eclipse安裝SonarLint套件
(1) 依步驟設定指向剛建好的server
(2) 專案按右建SonarLint→Analyze就能分析專案了,但結果只會在本機,不會上到server
3. 非maven專案要把scan結果上到server:需另外下載scanner
(https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner)
(1) Expand the downloaded file into the directory of your choice. We'll refer to it as <install_directory> in the next steps.
(2) Update the global settings to point to your SonarQube server by editing <install_directory>/conf/sonar-scanner.properties:
#----- Default SonarQube server
#sonar.host.url=http://localhost:9000
(3) Add the <install_directory>/bin directory to your path.
(4) Create a configuration file in the root directory of the project: sonar-project.properties
sonar-project.properties
# must be unique in a given SonarQube instance
sonar.projectKey=my:project
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=My project
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
(5) Run the following command from the project base directory to launch the analysis:
sonar-scanner
(6) 執行成功就能在server 的web ui上看到這個project了
4. maven專案要把scan結果上到server
(1) 在setting裡設定以下
<settings>
<pluginGroups>
<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Optional URL to server. Default value is http://localhost:9000 -->
<sonar.host.url>
http://myserver:9000
</sonar.host.url>
</properties>
</profile>
</profiles>
</settings>
(2) 執行maven時 goal寫clean install sonar:sonar 就能在server web ui上看到了
WEB UI的基本講解
https://blog.gss.com.tw/index.php/2017/04/21/sonarqube2/
2018年9月7日
[CSS] 表格字體變粗變小 又不想表格變大變小 動來動去
用bold 會讓表格自己變大
偷吃步1
偷吃步2 用shadow
偷吃步1
letter-spacing: -0.5px;
但我不愛這招 因為感覺得出來變擠了偷吃步2 用shadow
text-shadow: .25px 0px .1px,
-.25px 0px .1px;
chown – 改變檔案及目錄擁有者
將檔案 test.txt 的擁有者改為 newuser:
chown newuser test.txt
將 testdir/ 目錄的擁有者改為 newuser:
chown newuser testdir
將 testdir/ 目錄下的所有檔案及目錄, 改擁有者為 newuser
chown -R newuser testdir/
REF:
https://www.phpini.com/linux/chown-change-file-dir-owner
chown newuser test.txt
將 testdir/ 目錄的擁有者改為 newuser:
chown newuser testdir
將 testdir/ 目錄下的所有檔案及目錄, 改擁有者為 newuser
chown -R newuser testdir/
REF:
https://www.phpini.com/linux/chown-change-file-dir-owner
mybatis instr 字串 要串接 字串裡又有雙引號
<select id="selectLatestTemplateByVolume" parameterType="String" resultMap="ccpAsyncJobResultMap">
<bind name="jobCmdInfo" value="'volumeId":"'+_parameter+'"'" /><!-- volumeId":_parameter" -->
SELECT * FROM cloud.async_job
where instance_type='Template'
and job_cmd='org.apache.cloudstack.api.command.user.template.CreateTemplateCmd'
<![CDATA[ and instr(job_cmd_info,#{jobCmdInfo})>0 ]]>
order by id desc
limit 1
</select>
如果傳入是個map ( accountId=1, volumeUuid="123123123")
寫法又不太一樣
<select id="selectLatestTemplateByVolume" parameterType="Map" resultMap="ccpAsyncJobResultMap">
<bind name="jobCmdInfo" value="'volumeId":"'+volumeUuid+'"'" /><!-- volumeId":#{volumeUuid}" -->
SELECT * FROM cloud.async_job
where instance_type='Template'
and job_cmd='org.apache.cloudstack.api.command.user.template.CreateTemplateCmd'
<![CDATA[ and instr(job_cmd_info,#{jobCmdInfo})>0 ]]>
order by id desc
limit 1
</select>
<bind name="jobCmdInfo" value="'volumeId":"'+_parameter+'"'" /><!-- volumeId":_parameter" -->
SELECT * FROM cloud.async_job
where instance_type='Template'
and job_cmd='org.apache.cloudstack.api.command.user.template.CreateTemplateCmd'
<![CDATA[ and instr(job_cmd_info,#{jobCmdInfo})>0 ]]>
order by id desc
limit 1
</select>
如果傳入是個map ( accountId=1, volumeUuid="123123123")
寫法又不太一樣
<select id="selectLatestTemplateByVolume" parameterType="Map" resultMap="ccpAsyncJobResultMap">
<bind name="jobCmdInfo" value="'volumeId":"'+volumeUuid+'"'" /><!-- volumeId":#{volumeUuid}" -->
SELECT * FROM cloud.async_job
where instance_type='Template'
and job_cmd='org.apache.cloudstack.api.command.user.template.CreateTemplateCmd'
<![CDATA[ and instr(job_cmd_info,#{jobCmdInfo})>0 ]]>
order by id desc
limit 1
</select>
2018年6月1日
[JAVA] 利用POI 建立excel的簡單範例
public void createWorkBook() throws IOException {
//建excel活頁簿
XSSFWorkbook workBook = new XSSFWorkbook();
//建第一個sheet,命名為 new sheet
XSSFSheet sheet = workBook.createSheet("first sheet");
// 建一row,在sheet上
Row row = sheet.createRow(0);
// 在row上建一個cell
Cell cell = row.createCell(0);
//設cell裡的值
cell.setCellValue("第一個cell");
// Or do it on one line.
row.createCell(1).setCellValue("第一列的第2個cell");
row.createCell(2).setCellValue(new Date());
row.createCell(3).setCellValue(true);
row.createCell(4).setCellValue(2);
//file命名為myExcekbook.xlsx
FileOutputStream fileOut = new FileOutputStream("d:/myExcekbook.xlsx");
// 把workBook寫進FileOutputStream
workBook.write(fileOut);
//關閉FileOutputStream
fileOut.close();
}
2018年5月17日
XCODE 快速鍵
command+= xcode幫調大小 (ex變更label字型後要自動調)
ommand+w 關掉模擬器
ommand+← /→ 模擬時把device往左或往右轉
control+k 刪除游標後的一整行
command+delete 刪除游標前的一整行
option+delete 刪除一個單字(游標前)
option+command+← 縮合並反白一整個method (游標在method內的任一處都可)
control+i 排版程式碼
control+space 程式碼提示
ommand+w 關掉模擬器
ommand+← /→ 模擬時把device往左或往右轉
control+k 刪除游標後的一整行
command+delete 刪除游標前的一整行
option+delete 刪除一個單字(游標前)
option+command+← 縮合並反白一整個method (游標在method內的任一處都可)
control+i 排版程式碼
control+space 程式碼提示
2018年5月3日
更方便用postman測api
postman 有環境參設的設定很方便
但 如果是要先取token的api 每次複製貼上還是覺得有點煩
原來有更方便的方法
在Tests的地方 可以加入設定
ex 有個取token的api 回傳的token 會是在「access_token」欄位裡
那就在 Tests的地方 輸入下面:
這樣以後只要 就先run 取token的api 直接再run其他要token的api就好了
不用去複製貼上了 oya
但 如果是要先取token的api 每次複製貼上還是覺得有點煩
原來有更方便的方法
在Tests的地方 可以加入設定
ex 有個取token的api 回傳的token 會是在「access_token」欄位裡
那就在 Tests的地方 輸入下面:
var data = JSON.parse(responseBody);
postman.setEnvironmentVariable("token",data.access_token);
這樣以後只要 就先run 取token的api 直接再run其他要token的api就好了
不用去複製貼上了 oya
[Quartz]刪除quartz的trigger 在mysql裡的設定
1.QRTZ_CRON_TRIGGERS
2.QRTZ_TRIGGERS
3.QRTZ_JOB_DETAILS
2和3相反會刪不掉,因為有constraints的問題
資料來源:
https://mritd.me/2016/06/07/Quartz-%E4%BB%BB%E5%8A%A1%E5%BC%BA%E5%88%B6%E5%88%A0%E9%99%A4/
2.QRTZ_TRIGGERS
3.QRTZ_JOB_DETAILS
2和3相反會刪不掉,因為有constraints的問題
資料來源:
https://mritd.me/2016/06/07/Quartz-%E4%BB%BB%E5%8A%A1%E5%BC%BA%E5%88%B6%E5%88%A0%E9%99%A4/
訂閱:
文章 (Atom)