Wednesday, October 1, 2008

Tuckey Rewrite

Note to self, Tomcat mailing list recommends a Url rewrite filter for a servlet container called Tuckey UrlRewrite. It functions similarly to the popular apache mod_rewrite. I speculate it may be helpful in a RESTful application to map requests to JSPs.

Wednesday, September 3, 2008

$5 multifactor authentication for OpenID

Paypal provides a $5 unique password security key which works with Verisign OpenID provider, according to blog "i like ellipses". Get it while the introduction price makes it a better deal than the $30 Verisign's own security key.

Availability of this key is a great news because using a unique password key makes your OpenID identity much more trustworthy.

Monday, July 21, 2008

Changing fan on Thinkpad T41

After four years in service, the fan of my Thinkpad T41 started to fail. The computer either wouldn't boot with "fan error" message at boot time if the fan doesn't start or the fan would whine causing video card to overheat, freezing X11. Time to change the fan.

I found the fan part number at IBM's website, it was "CPU Fan Long", FRU 13N5341. I searched online shops for the part, finding several listing the fan from anywhere from $30 to $80. At three different cheapest stores, I tried to order the fan and failed, each time the store canceling my order because the fan was out of stock. Then, I found the IBM parts store, 1-800-388-7080. At the IBM store, the fan was $58 and 1-2 day shipping via DHL was $15, an amazing deal. They just changed the part number to 91P9252. I ordered the fan on Friday. On Monday I received a new looking fan, nicely packaged, with thermal gel intact (covered with a removable film) and thermal grease pre-applied in the right place (gel above the video card heat sink and the grease above the CPU).

The hardest part was removing the old fan. I had to find just the right screwdriver (Philips #1 from my toolkit having Ph 0..3) and applying drops of WD-40 to the fan screws. Once the fan was out, putting new fan and closing the laptop was a piece of cake. The laptop booted just fine and noise disappeared. Let's hope the thermal gel and grease adhere correctly, but it looks like IBM still got the chops. Let's hope new Chinese owners (Lenovo) won't screw it up.

Friday, July 11, 2008

NoClassDefFoundError: oracle/gss/util/NLSLocale

When I upgraded my Oracle JDBC driver to, Oracle XSQL Utility started giving me the following exception when using "-encoding UTF-8"

Exception in thread "main" java.lang.NoClassDefFoundError: oracle/gss/util/NLSLocale
at oracle.xml.sql.XSULocale.getJavaCharset(
at OracleXML.To_XML(
at OracleXML.ExecuteGetXML(
at OracleXML.main(

Ok, it turns out that in Oracle, some classes that used to be in
orai18n.jar got separated into their own jars, which are shipped with Oracle
XDK, not with Oracle JDBC drivers. For example, oracle.gss.util.NLSLocale is now in $XDKHOME/jlib/orai18n-mapping.jar.

Wednesday, June 11, 2008

LCD text in NetBeans

Finally figured out how to enable sub-pixel rendering (also known as LCD text) in NetBeans. Just add -J-Dawt.useSystemAAFontSettings=lcd to netbeans_default_options variable in your ~/.netbeans/6.1/etc/netbeans.conf

Tuesday, March 18, 2008

Bash Random Shuffle

Here is a bash function which returns a random permutation of the input lines of text.

#****f* shadegrowncode/randomShuffle
# randomShuffle - prints random permutation of lines in standard input
# Prints all or the first N lines of a random permutation of the
# lines of standard input. The random permutation is obtained using
# Durstenfeld shuffle algorithm. Performance is O(N) in memory and
# CPU. Limit the input to 32768 lines or rewrite using a different
# random generator.
# * 1 - (optional) return only the first N of the random lines of input
function randomShuffle
typeset -a elements
typeset length=0
while read line
length=$(($length + 1))
typeset firstN=${1:-$length}
if [ $firstN -gt $length ]
for ((i=0; $i < $firstN; i++))
randPos=$(($RANDOM % ($length - $i) ))
printf "%s\n" "${elements[$randPos]}"
elements[$randPos]=${elements[$length - $i - 1]}

Usage examples:
Print three random users from the password file:
$ cut -d: -f1 /etc/passwd | randomShuffle 3

Print a random permutation of digits:
$ echo $(printf "%s\n" 0 1 2 3 4 5 6 7 8 9 | randomShuffle)
4 1 0 6 8 7 2 5 3 9

Friday, February 15, 2008

Volkerding says KDE4 better than MacOS

Patrick Volkerding (Slackware Project Lead) gives glowing thumbs up to KDE4 and slates it for inclusion into Slackware 14. Slackware is currently at version 12 and releases once a year. At this rate, KDE4 will be in Slackware in 2009. Among other things, Patrick says the following.

The look of the new [KDE] desktop is stunning, and the use of SVG and hardware acceleration gives (IMHO) even something like MacOS a run for its money in terms of appearance and user-friendliness. We look forward with great anticipation to merging KDE4 when it is mature enough (and it's getting there fast), and then watching it just get better and better.
The full quote can be found in Slackware ChangeLog.

Thursday, January 10, 2008

Reason to switch to Linux #11

Windows taskbar clock cannot display seconds since Windows 95.
Why? Because when installed on a 4 Mb machine, Windows 95 was too slow to display seconds. This and other lame excuses are blogged at MSDN. There is a whole shareware industry around Windows to fix this problem. If you want to measure time, use online javascript stop watch or US atomic clock at