[HBase] get/scan String or Integer value

get String Value

get 'Table_Name', 'RowKey', {COLUMNS=>'Column_Family:Qualify:toString'}

get Integer Value

get 'Table_Name', 'RowKey', {COLUMNS=>'Column_Family:Qualify:toInt'}

scan and get String Value

scan 'Table_Name', {COLUMNS=>'Column_Family:Qualify:toString'}

scan and get Integer Value

scan 'Table_Name', {COLUMNS=>'Column_Family:Qualify:toInt'}
Posted in HBase | Leave a comment

[HBase] run hbase command by ruby

echo 'list.each {|t| truncate t}; quit;' | hbase shell

or Drop Table

echo 'list.each {|t| disable t; drop t}; quit;' | hbase shell

Scan Table

list.each {|t| print t; scan t, {LIMIT=>1};}
Posted in HBase, Ruby | Leave a comment

Delete the specific files in all subdirectories

  1. check the find result

    find . -name “*.bak” -type f

  2. delete it

    find . -name “*.bak” -type f -delete

Ref. ask Ubuntu: How can I recursively delete all files of a specific extension in the current directory?

Posted in Linux | Leave a comment

Get SSL cert file from the LDAP Server

Ref. stackoverflow: How to save the LDAP SSL Certificate from OpenSSL

echo -n | openssl s_client -connect ldapServer:636 | sed -ne ‘/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p’ > ldapserver.pem

Posted in LDAP | Leave a comment

[Linux] Sort the disk usage

du -B M --max-depth=1 | sort -g

Ref.: [ubuntu] 利用du搭配sort來查看磁碟使用空間]1

Posted in Linux | Leave a comment

[MySQL] Resolve duplicate entry error in MySQL Replication

while [ 1 ]; do if [ $(mysql -uroot -ppassword -e"show slave status G;" | grep "Duplicate entry" | wc -l) -eq 1 ] ; then mysql -uroot -ppassword -e"stop slave; set global sql_slave_skip_counter=1; start slave;"; fi; sleep 1; mysql -uroot -ppassword -e"show slave statusG"; done

Ref. MySQL Replication Error 1062: ‘Duplicate entry for PRIMARY key’

Posted in MySQL | Leave a comment

[jsTree] Populating the tree using JSON

  • Using Json

    $('#using_json').jstree({ 'core' : 
    {
        'data' : [
            'Simple root node',
            {
                'text' : 'Root node 2',
                'state' : {
                    'opened' : true,
                    'selected' : true
                },
                'children' : [
                    { 'text' : 'Child 1' },
                    'Child 2'
                ]
            }
        ]
    } });
    
  • Using the alternative JSON format

    $('#using_json').jstree({ 'core' : {
        'data' : [
            { "id" : "ajson1", "parent" : "#", "text" : "Simple root node" },
            { "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
            { "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" },
            { "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" },
        ]
    } });
    

Ref. Populating the tree using JSON

Posted in jsTree | Leave a comment

[jsTree] Expand and collapse buttons.

<input type="button" value="Expand All" onclick="$(‘#jsTreeID').jstree('open_all');">
<input type="button" value="Collapse All" onclick="$('#jsTreeID').jstree('close_all');">

Ref: jsTree: adding Expand All and Collapse All buttons

Posted in jsTree | Leave a comment

[Apache] Redirect 80 to 8080

  1. enable proxy_module, proxy_http_module, rewrite_module

  2. set < Directory path > in apache config

    RewriteEngine on
    AllowOverride All

  3. edit .htaccess in your folder

    < IfModule mod_rewrite.c >
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(.+)$ http://localhost:8080/jwebadm/$1 [P,L]
    < /IfModule >

  4. restart apache

Posted in Apache | Leave a comment

[JavaScript][jQuery] How to enable/disable select field?

[jQuery]

$('input[type=radio][name=ldap-sync-type]').change(function() {
    if (this.value == '0') {
        $("select[name=day-option]").prop("disabled", true);
        $("select[name=clock-option]").prop("disabled", true);
    } else if (this.value == '1') {
        $("select[name=day-option]").prop("disabled", false);
        $("select[name=clock-option]").prop("disabled", false);
    }
});

[JavaScript]

$('input[type=radio][name=ldap-sync-type]').change(function() {
    if (this.value == '0') {
        $("select[name=day-option]").attr("disabled", "disabled");
        $("select[name=clock-option]").attr("disabled", "disabled");
    } else if (this.value == '1') {
        $("select[name=day-option]").removeAttr("disabled");
        $("select[name=clock-option]").removeAttr("disabled");
    }
});
Posted in JavaScript, jQuery | Leave a comment