[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

[Tomcat] allowLinking setting (soft link)

  1. edit the file ‘Tomcat/conf/context.xml’

    change

    to

  2. restart Tomcat.

Ref. Tomcat軟連接訪問配置symbol link

Posted in Tomcat | Leave a comment

[WordPress] Avoid xmlrpc attack

  • add below code in the functions.php in your themes.
add_filter('xmlrpc_enabled', '__return_false');
  • edit .htaccess
#protect xmlrpc
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>
  • delete the xmlrpc.php file

Ref. 解決WordPress被利用xmlrpc.php文件攻擊導致內存超負荷

Posted in WordPress | Leave a comment

[Java, HBase] Hostname is very important!

If the connection is failed, try to check the hdfs uri setting, it might be used hostname.

Posted in HBase, Java | Leave a comment

[Java] Connect LDAP (subdomain).

Ref. referrals & global catalog, AD Child Domain Referral Searches by Rajnish Bhatia

If you want to search all subdomain, the port of ‘PROVIDER_URL’ might be use in 3268.

Posted in Java | 1 Comment

[LDAP] Port information.

Global Catalog port: 3268
Normal LDAP port: 389

Posted in LDAP | Leave a comment

[Mac] Port in use..

lsof -n -i4TCP:$PORT | grep LISTEN

Ref: stackoverflow: Who is listening on a given TCP port on Mac OS X?

Posted in Mac | Leave a comment

[Java] Check apache poi version

Ref: The Apache POI project – Frequently Asked Questions: My code uses some new feature, compiles fine but fails when live with a “MethodNotFoundException” or “IncompatibleClassChangeError”

    ClassLoader classloader = org.apache.poi.poifs.filesystem.POIFSFileSystem.class.getClassLoader();
    URL res = classloader.getResource("org/apache/poi/poifs/filesystem/POIFSFileSystem.class");
    String path = res.getPath();
    System.out.println("Core POI came from " + path);
Posted in Java | Leave a comment

[HBase] Use SingleColumnFilter in shell.

scan 'TABLENAME', {FILTER=>"(SingleColumnValueFilter('CF', ‘CQ', =, 'binary:VALUE', true, true))”}

the first true means filterIfColumnMissing
the second true means setLatestVersionOnly

Ref. Spinning Thoughts: Applying Filters in HBase shell

Posted in HBase | 2 Comments

[Sublime Text3] Enable package control

  1. Use ctrl + ` to open console. (or View->Show console)

  2. 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( ‘http://packagecontrol.io/’ + pf.replace(‘ ‘, ‘%20’)).read(); dh = hashlib.sha256(by).hexdigest(); print(‘Error validating download (got %s instead of %s), please try manual install’ % (dh, h)) if dh != h else open(os.path.join( ipp, pf), ‘wb’ ).write(by)

    Ref. Sublime Text Package Control Installation

  3. Restart Sublime Text3

Posted in Sublime Text 3 | Leave a comment