Posts

Showing posts from March, 2012

Java encoding : UTF-8, Big5, x-MS950-HKSCS

Suppose you got a file in Big5 containing some HKSCS characters (e.g. 深水埗, 赤鱲角, etc). When your environment (Ref: Charset.defaultCharset( ) ) is either UTF-8 / Big5, you will never get the things work. The proper encoding should be "x-MS950-HKSCS" This situation happens when I'm try the same pieces of code in Java console / Eclipse console and JSP @ Tomcat. While JSP works fine, but sucks in console mode. Finally I found the JSP is actually using encoding "x-MS950-HKSCS". To set environment charset in Eclipse: Right click on the file that you are going to execute (e.g. Testing.java), then "Properties" → "Run/Debug Settings" → "Common" → "Encoding". Type "x-MS950-HKSCS" in the field. What a pity!

YUI LayoutUnit collapse

One can use layout.getUnitByPosition('left').collapse() and  layout.getUnitByPosition('left').expand() to the layout units (except 'center' layout unit) in YUI's Layout. Once the layout unit is collapsed, the size is determined by the attribute 'collapseSize'.

Should I read some more about HTML5?

Let's read some more then... http://www.hksilicon.com/kb/articles/58634/HTML5 http://blog.othree.net/log/2011/01/22/html5-2011-01/ http://www.sitepoint.com/real-world-accessibility-html5-aria-and-the-modern-web/#fbid=liED5trl79M

Change Windows Update Server URL

Modify the Windows Registry to change the WSUS URL: \HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\WUServer Ref:  http://technet.microsoft.com/en-us/library/cc708554(v=ws.10).aspx

Regexp match with GenericValidator

Just a reminder to use GenericValidator for a quick way to do regexp matching in Java. boolean rslt = org.apache.commons.validator.GenericValidator.matchRegexp(str, "(?i)abc|def|ghi");