Skip to main content

Posts

Showing posts from 2009

Cookie handling with Apache XML-RPC

The example on the Apache website that explains how to pass cookies when calling an XML-RPC service is unfortunately... a bit b0rked. It doesn't compile, for starters. It's also quite a bit more complicated (and handwavy) than it needs to be. I don't know if this is because the API has changed over time. I tend to think it has suffered the copy-paste equivalent of chinese whispers from an origin in some mailing list. Anyway, I needed to send a single sign on (SSO) cookie to an XML-RPC service recently. I'm using Apache XML-RPC 3.1 (I notice in the Javadoc that this code might be slightly different if you're using a later version). Here's roughly what I did: First, the standard, boring stuff: XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL("https://myservice.com/api")); XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Now, the juicy part. It's really, really easy. Look, ma, so much less …

Find a file inside a zip

Brutally simple shell script I often use to find a class file that I know exists somewhere in a directory tree full of jar files (but generally useful for finding files somewhere in a directory tree of zips): #!/bin/bash for zip in $* do echo $zip for file in $(unzip -Z -1 $zip) do echo "$zip:$file" done …

Listing Chinese Words by Frequency of Use

A commenter on my previous blog entry, Yong Huang, pointed me to some wonderful research he did using search engine results to compile a list of Chinese characters in frequency order. I managed to miss his comment when he posted it back in March (d'oh. I really should have paid more attention to my blogger settings), but it's an interesting read and technique:http://yong321.freeshell.org/misc/ChineseCharFrequency.html

Getting serious about Mandarin

I'm finally making a big effort to learn mandarin properly. In addition to taking formal lessons at UC Berkley starting in February, and learning about usage from Cindy, I'm using flash cards to increase my knowledge of Chinese characters and their mandarin pronunciation (including the tones, which I've had a hard job remembering up till now while picking up mandarin informally through random conversation). I've been using some tricks to memorize characters, and this technique seems to work well for me. Here's the first set of characters. The first ten are numbers, and mostly pretty easy. 一 二 三 one (yi1), two (er4), three (san1). These are quite possibly the simplest Chinese characters ever. :) 四 four (si4). This one is kind of easy for me to remember, since I visited sichuan last year, and this character was everywhere :) It's also a box with four sides. 五 five (wu3). I convinced myself that this character has five distinct lines in it, which made it easy to remembe…