java

ant,XMLPropertyでプロパティに空文字列を指定する

<xmlproperty file="hage.properties.xml" semanticattributes="true" keeproot="false" /> <hoge> <emptystring></emptystring> </hoge> とかやってもhoge.emptystringプロパティは定義されない。パースのやりかたを考えるとまあ妥当な仕様ではある。 属性使ってもプロパティが定義できるので、空文字列を入れたいときは <hoge emptystring=""> </hoge> …</xmlproperty>

Java、hprofで無限ループしてる位置を特定する

デバッガ使えや……とおっしゃるかもしれませんがantタスクをアタッチする方法がよくわからなかったので。 JVMのオプションに -agentlib:hprof=cpu=samplesを指定。この指定方法は1.5以前だと違うとか何とかだけどまあそれはいい。 hprofというのは標準でつい…

NullPointerExceptionが発生するのはバグ以外の何者でもないだろ、常識で考えて……

Parameters: in - the input stream from which to read the XML document. Throws: IOException - if reading from the specified input stream results in an IOException. InvalidPropertiesFormatException - Data on input stream does not constitute …

Args4j、コマンドライン解析

リフレクション+アノテーションでとても簡単。Commons CLIより高機能だな。 command output.txt -format TXT -limit 100 -flagenum OutputFormat { TXT, TSV }; public static class Conf { @Option(name="-flag",usage="this is the flag") public boolean …

Apache Commons CLI、コマンドライン解析

本家:Commons CLI – Home javadoc(1.x):http://commons.apache.org/cli/api-release/ コマンドラインオプション解析ライブラリの定番ってなんだろう。Commonsブランドを選んでみたが開発状況が微妙。 1.1をつかってみた。 command --limitsize 1000 -n "hoge…

java、文字列からアクセント符号を除去する

あらすじ:mysqlの文字列比較がウムラウトだのアキュートアクセントだのあのへんをいっさい無視するがjavaのデフォ文字列比較では区別して扱うためjava的にはユニークな文字列のコレクションを挿入せんとしているところがMySQL的には全然ユニークじゃないため…