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: 程式語言
[HBase] security issue
error message: com.a.b.c.exception.BaseDAOException: org.apache.hadoop.hbase.security.AccessDeniedException: org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient permissions for user ‘Cowman’ (table=ABC, action=READ) in jvm conf. add “-DHADOOP_USER_NAME=webuser”
Posted in HBase, Java
Leave a comment
[HBase] convert long value to bytes
Java code:
1 2 3 4 5 6 |
public static void main(String[] args) { String stringValue = Bytes.toStringBinary(Bytes.toBytes(1532080782183l)); System.out.println(stringValue); Long longValue = Bytes.toLong(Bytes.toBytesBinary(stringValue)); System.out.println(longValue); } |
HBase shell command:
1 2 3 4 |
hbase(main):056:0> Bytes.toStringBinary(Bytes.to_bytes(1532080782183)) => "\\x00\\x00\\x01d\\xB7!{g" hbase(main):057:0> Bytes.toLong("\x00\x00\x01d\xB7!{g".to_java_bytes) => 1532080782183 |
Posted in HBase, Java
Leave a comment
[Python] fix error while loading shared libraries: libpython2.7.so.1.0
error log: /opt/rh/python27/root/usr/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory check libpython2.7.so.1.0 exist? find . -name ‘libpython2.7.so.1.0’ if the file was exist: edit the ldconfig config echo “/opt/rh/python27/root/usr/lib64” > /etc/ld.so.conf.d/python27.conf ldconfig … Continue reading
Posted in CentOS, Python
Leave a comment
[Shelll Script] check tomcat status
!/bin/bash tomcat7=$(ps -ef | grep tomcat | wc -l) echo ${#tomcat7} if [ ${#tomcat7} -gt 0 ]; then printf “tomcat is running\n” else printf “tomcat is not running\n” fi
Posted in Linux, Shell Script, Tomcat
Leave a comment
[JavaScript] cannot call methods on [Object] prior to initialization; attempted to call method ‘refresh’
try to force initialize the object first. stackOverflow: selectmenu (‘refresh’, true)
Posted in JavaScript
Leave a comment
[Windows Bash Script] convert csv to html table
source: How to find and replace a string in text file using batch file just replace “,” with html table tag.
1 2 3 4 5 6 7 8 9 10 11 12 |
@echo off setlocal enabledelayedexpansion set txtfile=%~1 set newfile=Output.html if exist "%newfile%" del /f /q "%newfile%" echo ^<table border='1'^> >> %newfile% for /f "tokens=*" %%a in (%txtfile%) do ( set newline=%%a set newline=^<tr^>^<td^>!newline:,=^</td^>^<td^>!^</td^>^</tr^> echo !newline! >> %newfile% ) echo ^</table^> >> %newfile% |
Posted in Windows Bash Script
1 Comment
[Java] Convert Hex to String
1 2 3 4 5 6 7 8 9 10 11 12 |
<code> public static byte[] hexStringToByteArray(String s) { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i &lt; len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) &lt;&lt; 4) + Character.digit(s.charAt(i+1), 16)); } return data; } </code> |
stackoverflow: Convert a string representation of a hex dump to a byte array using Java?
Posted in Java
Leave a comment
[Jersey] disable decode the URL path
use annotation “@Encoded” Ex:
1 2 |
@Path("{first}/get") public Response getYouWant(@Context HttpHeaders httpHeaders, @PathParam("first") String first, @QueryParam("second") @Encoded String second); |
Posted in Java
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
Gson usage : formJson
avoid to face the exception ‘java.lang.ClassCastException With com.google.gson.internal.LinkedTreeMap cannot be cast to…’, we use the TypeToken to convert json to List
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 |
public class Object { @SerializedName("n") private String name; @SerializedName("i") private String id; public String getName() { return name; } public Object setName(String name) { this.name = name; return this; } public String getId() { return id; } public Object setId(String id) { this.id = id; return this; } } // [{"n":"cowman","i":"cowman@xxx.com.tw"}, {"n":"cowman1","i":"cowman1@xxx.com.tw"}] List<Object> ObjectList = new Gson().fromJson(targets, new TypeToken<List<Object>>(){}.getType()); |
Posted in Java
Leave a comment