[Java] unicode to string

public static void main(String[] args) {
    try {
        String abc = "0043006F0077006D0061002E002E002E90808ACB";
        System.out.print(getString(abc));
    } catch (Exception e) {
        System.out.println("err");
    }
}

public static String getString(String strValue) {
    StringBuilder str = new StringBuilder();
    String temp;
    for (int i = 0; i < strValue.length(); i = i + 4) {
        temp =  strValue.substring(i, i + 4);
        str.append((char) Integer.parseInt( temp, 16 ));
    }

    return str.toString();
}
Posted in Java | Leave a comment

HBase: put byte value

put "TableName", "rowkey", "cf:fieldname", [0].pack("N")
N => byte array

put "TableName", "rowkey", "cf:fieldname", [0].pack("Q>")
Q => 64-bit unsigned, native endian

=> change endian to big endian

Posted in HBase | Leave a comment

[Linux] sudo: sorry, you must have a tty to run sudo

  1. edit /etc/sudoers
  2. find ‘requiretty’
  3. add username like this
    Defaults:webuser requiretty
Posted in Linux | Leave a comment

What I think?

I think the correct process of the information system is more important than beautiful code.

Posted in Me | Leave a comment

[CSS] Removing outline on image map area

Ref. Removing outline on image map area

HTML
<img class="map" src="..." usemap="..." hidefocus="true" />

CSS
img.map, map area{
outline: none;
}

Posted in CSS | Leave a comment

[PHP] Output debug information to console

echo "<script>console.log( 'Debug Objects: " . $data . "' );</script>";

Ref. stackoverflow: How can I write to console in PHP?

Posted in PHP | Leave a comment

[MySQL] Find in fixed string

Ref. MySQL 的 FIND_IN_SET函數

SELECT * FROM table WHERE FIND_IN_SET(ID, '2,5,6,7,8,9,11,21,33,45')

Posted in MySQL | Leave a comment

[Git] List of changed files with another branch

git diff --name-only branchname

Posted in Git | Leave a comment

[HBase] Scan with filter by partial rowkey using HBase shell

If we have these rowkey list data.

  • xx_abc
  • xx_abc_def
  • xx_abd
  • xx_abd_rfg

To get rowkey which contain “abc”
scan 'TableName', FILTER => "RowFilter(=, 'substring:abc')"

We will get these.

  • xx_abc
  • xx_abc_def

But if we want only get “xx_abc”
scan 'TableName', FILTER => "RowFilter(=, 'substring:abc')", FILTER => "RowFilter(!=, 'substring:abc_')"

Posted in HBase | Leave a comment

Add SublimeText 2 context menu to windows explorer

Ref. Github: iaian/sublimeText2_contextMenu.reg

  1. Replace the Sublime Text Directory’s path.
Posted in Sublime Text 2, Sublime Text 3 | Leave a comment