Saturday, July 27, 2013

URL path segment encoding

Java's URLEncoder class is not suitable for encoding path segments in URLs. It's not even really suitable for encoding GET parameters in the query part of a URL, e.g. it encodes unreserved URI characters, which should not be encoded, such as tilde (~).

Spring has a good encoder. Now Play does too. :)

RFC 1738 is obsolete, so don't just go and percent-encode the characters it lists as unsafe. Encoding such characters may violate the newer RFC 3986. Ignore instructions that say otherwise!

Thursday, July 18, 2013

100% CPU with UserEventAgent

My Mac laptop has been running hot, with the UserEventAgent process pegged at 100% CPU.

This is apparently due to a bug in the interaction between the AppleHIDMouseAgent and some mice and keyboards. In my case it is probably my Kinesis keyboard.

The fix is to disable the AppleHIDMouseAgent plugin and restart the computer.

sudo mkdir /System/Library/UserEventPlugins.disabled
sudo mv /System/Library/UserEventPlugins/AppleHIDMouseAgent.plugin /System/Library/UserEventPlugins.disabled

Note: renaming the AppleHIDMouseAgent.plugin within the same directory won't work—it will simply prevent your computer from booting. :)