Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (50)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (1)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (79)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (7)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Category Archives: 工具軟體
AES decrypt in postman
sample code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
var CryptoJS = require("crypto-js"); let secretKey = 'yourSecretKey'; function decrypt(aesStr, key) { return CryptoJS.AES.decrypt( aesStr, CryptoJS.enc.Utf8.parse(padding(key)), { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 } ).toString(CryptoJS.enc.Utf8) } function padding(key) { return key.padEnd(32, '\0'); } //decrypt("encryptedData", secretKey) |
Here we choose AES-256 to encrypt / decrypt the secure information. When using AES, the length of the secretKey is important. The length of secretKey in AES-128 is 16 bits, and in AES-256 is 32 bits. And … Continue reading
Posted in JavaScript, Postman
Comments Off on AES decrypt in postman
Line breaks issue
When we use command “ssh” with auto-completion, we get this error result. This is because we used the editor “sublime text” to edit the config before, which used the line endings of Windows. Then we can edit the setting of … Continue reading
Posted in Mac, Sublime Text 2, Sublime Text 3
Comments Off on Line breaks issue
[VirtualBox] Host-only network is not working.
We can usually find the information about connecting to the Guest machine in VirtualBox. Most of the practices are performed using the Host-only setting method. But in version 7.0.4 of VirtualBox, the same setting does not work. This is because … Continue reading
Posted in Virtualbox
Comments Off on [VirtualBox] Host-only network is not working.
[Docker] Common commands
show all containers: docker ps -a stop all containers: docker kill $(docker ps -q) remove all containers: docker rm $(docker ps -a -q) remove all docker images: docker rmi $(docker images -q) enter docker container: docker exec -it $(container id) … Continue reading
Posted in Docker
Leave a comment
[Intellij] Checkstyle and Code Style
Checkstyle 介紹 根據定義好的規則對程式碼進行檢查,以確保程式碼的 Style 是一致的 (盡力…) Checkstyle GitHub 有提供兩種規則範例,後續套用的規則即是使用 “Google Checks” 進行修改 Sun Checks Google Checks 安裝 Checkstyle Preferences.. ➔ Plugins ➔ Browse repositories.. -> 搜尋 “CheckStyle” 安裝 “CheckStyle-IDEA” Checkstyle 規則文件說明 checkstyle/qmi_checks.xml 為 Checkstyle 主規則檔案 定義檢查的檔案格式、範圍 定義排除的規則檔案位置 (通常為 suppressions.xml) 定義檢查的項目,每一個項目可定義的屬性不固定,需檢視 … Continue reading
Posted in Intellij
Leave a comment
open external program from java for mac os x
1 2 |
String[] cmds = {"open", tempFile.getAbsolutePath(), "-a", "/Applications/Microsoft Office 2011/Microsoft Excel.app"}; Runtime.getRuntime().exec(cmds); |
Posted in Java, Mac, Office
Leave a comment
protect data validation to fail while copy and paste data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Private Sub Worksheet_Change(ByVal Target As Range) 'Does the validation range still have validation? Set range1 = Range("B2:B6500") If HasValidation(range1) Then Exit Sub Else Application.Undo MsgBox "您的操作將會被取消, " & vbCrLf & "請使用下拉選單進行選擇", vbCritical End If End Sub Private Function HasValidation(r) As Boolean ' Returns True if every cell in Range r uses Data Validation On Error Resume Next x = r.Validation.Type If Err.Number = 0 Then HasValidation = True Else HasValidation = False End Function |
source: Ensuring That Data Validation Is Not Deleted
Posted in Excel
Leave a comment
Add SublimeText 2 context menu to windows explorer
Ref. Github: iaian/sublimeText2_contextMenu.reg Replace the Sublime Text Directory’s path.
Posted in Sublime Text 2, Sublime Text 3
Leave a comment
[Sublime Text3] Enable package control
Use ctrl + ` to open console. (or View->Show console) Paste the appropriate code to enable package control function. import urllib.request,os,hashlib; h = ‘2915d1851351e5ee549c20394736b442’ + ‘8bc59f460fa1548d1514676163dafc88’; pf = ‘Package Control.sublime-package’; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( … Continue reading
Posted in Sublime Text 3
Leave a comment
[Java] Write xls files
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
public String createFile(Object object) { try { Excel excel = (Excel) object; HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); for (SheetContent sheetContent:excel.getSheets()) { HSSFSheet sheet = hssfWorkbook.createSheet(sheetContent.getName()); List<HSSFCellStyle> formats = new ArrayList<>(); /** format */ for (String format:sheetContent.getFormats()) { HSSFCellStyle cs = hssfWorkbook.createCellStyle(); HSSFDataFormat df = hssfWorkbook.createDataFormat(); cs.setDataFormat(df.getFormat(format)); formats.add(cs); } /** header */ HSSFRow headerRow = sheet.createRow(0); for (int i = 0; i < sheetContent.getHeaders().size(); i++) { HSSFCell cell = headerRow.createCell(i); cell.setCellType(HSSFCell.CELL_TYPE_STRING); cell.setCellValue(sheetContent.getHeaders().get(i)); } /** content */ for (int i = 0; i < sheetContent.getRows().size(); i ++) { HSSFRow dataRow = sheet.createRow(i + 1); for (int j = 0; j < sheetContent.getRows().get(i).getCells().size(); j++) { HSSFCell cell = dataRow.createCell(j); if (StringUtils.isNotEmpty(sheetContent.getFormats().get(j))) { cell.setCellValue(Double.parseDouble(sheetContent.getRows().get(i).getCells().get(j))); cell.setCellStyle(formats.get(j)); } else { cell.setCellType(HSSFCell.CELL_TYPE_STRING); cell.setCellValue(sheetContent.getRows().get(i).getCells().get(j)); } } } /** auto size */ for (int i = 0; i < sheet.getRow(0).getPhysicalNumberOfCells(); i++) { sheet.autoSizeColumn(i); } } FileOutputStream out = new FileOutputStream(new File("Excel.xls")); hssfWorkbook.write(out); out.close(); return "ok"; } catch (Exception e) { LOG.error(Constants.EXCEPTION_PREFIX, e); return null; } } public class Excel { List<SheetContent> sheets; public List<SheetContent> getSheets() { return sheets; } public Excel setSheets(List<SheetContent> sheets) { this.sheets = sheets; return this; } public Excel addSheets(SheetContent sheet) { if (this.sheets == null) { this.sheets = new ArrayList<>(); } this.sheets.add(sheet); return this; } } public class SheetContent { private String name; private List<String> formats; private List<String> headers; private List<Row> rows; public String getName() { return name; } public SheetContent setName(String name) { this.name = name; return this; } public List<String> getFormats() { return formats; } public SheetContent setFormats(List<String> formats) { this.formats = formats; return this; } public List<String> getHeaders() { return headers; } public SheetContent setHeaders(List<String> headers) { this.headers = headers; return this; } public List<Row> getRows() { return rows; } public SheetContent setRows(List<Row> rows) { this.rows = rows; return this; } } public class Row { private List<String> cells; public List<String> getCells() { return cells; } public Row setCells(List<String> cells) { this.cells = cells; return this; } } |
Posted in Excel, Java
Leave a comment