Author Archives: cowman.chiang

[Tomcat] allowLinking setting (soft link)

edit the file ‘Tomcat/conf/context.xml’ change to 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 … Continue reading

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

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

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 = … Continue reading

Posted in Excel, Java | Leave a comment