tanamonの稀に良く書く日記

KEEP CALM AND DRINK BEER

2008-01-01から1年間の記事一覧

同時に開けるファイル数

test.rb array = [] loop do begin array.push(open("test.txt")) rescue puts $! puts "max:" + array.size.to_s break end end array.each do |f| f.close end 実行結果 Too many open files - test.txt max:509この509はどこから来ているんだろう。 OSの…

Geek Testをやってみた

FUALI / 404 Error俺々翻訳に途中で自信が持てなくなったので、後半はGIGAZINEの翻訳に頼った。 I am 33% Geek.You probably work in computers, or a history deptartment at a college. You never really fit in with the "normal" crowd. But you have fr…

マージテーブルにアクセスすると1168エラーが出る件

CREATE TABLE sub ( id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, msg varchar(200) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE mrg ( id int(10) unsigned NOT NULL AUTO_INCREMENT KEY, msg varchar(200) ) ENGINE=MERGE UNION=(s…

MySQLのコマンドラインツールでビープ音を消す

まんまのオプションがあった。 --no-beep, -b エラー音を発生させません。 http://dev.mysql.com/doc/refman/5.1/ja/mysql-command-options.html でも毎回指定するのは面倒なので、結局Windowsのビープを止めた。 ビープ音を無効にしたい - ITmedia エンター…

Ruby/DBIでMySQLドライバを使うとSegmentation faultになる

test.rb require 'dbi' db = DBI.connect('DBI:Mysql:test:localhost', 'root', 'root') 10000.times do |c| s = '.' * c * 10 end db.disconnect このコードを実行するとSegmentation faultでRubyが終了する。 実行結果 C:\work>ruby test.rb test.rb:7: [B…

Ruby/DBIのインストール

Ruby(mswin32版)でRuby/DBIをインストールでやけに手間取ったので履歴を残しておきます。 MySQL/Rubyのインストール C:\rubywork>gem install mysql Successfully installed mysql-2.7.3-x86-mswin32 1 gem installed Installing ri documentation for mysql…

ニンテンドーDSiはWPA/WPA2に対応していたのか

通常の接続先設定と上級者設定では利用できるセキュリティに違いがある。通常設定では暗号化キーをWEPしか選択できないが、上級者設定ではWEPのほかにWPA/WPA2が設定可能。 http://bb.watch.impress.co.jp/cda/special/23709.html DSと同じでWEPしか対応して…

MacBook Paper

先日、id:cn_syanにMacBookを売ったのだが、付属品のMacシールを持て余しているみたいだけど、こんな使い方はどうだろうか。 以前より噂されていたタブレット型MacBookがついに登場した。その名も「MacBook Paper(マックブック・ペーパー)」。アルミ削り出…

dashboard-maven-plugin

CheckStyleやFindBugsなどの実行結果をグラフでまとめてくれるdashboard-maven-pluginの設定 /project/reporting/plugins <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>dashboard-maven-plugin</artifactId> </plugin> Hudsonを使うと要らない子になる気がする。

cobertura-maven-plugin

カバレッジレポートを出力するcobertura-maven-pluginの設定 /project/build/plugins <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <executions> <phase>pre-site</phase> <execution> <goals> <goal>clean</goal> <goal>check</goal> </goals> </execution> </executions></plugin>

maven-pmd-plugin

PMDを実行するmaven-pmd-pluginの設定 /project/reporting/plugins <plugin> <artifactId>maven-pmd-plugin</artifactId> <configuration> <sourceEncoding>UTF-8</sourceEncoding> <targetJdk>1.5</targetJdk> <rulesets> <ruleset>${basedir}/pmd.xml</ruleset> </rulesets> </configuration> </plugin> sourceEncod…

LinuxでプロセスIDをgrepして引数に渡す方法

某社の案件でアプリが挙動不審なため、Javaのスレッドダンプを定期的に取ろうという話になった。JRockitでは以下のようなコマンドを実行すると標準出力にダンプしてくれるのだけど、 $ jrcmd <pid> prints_thread 引数のプロセスIDをスマートに取得する方法がぱっ</pid>…

findbugs-maven-plugin

FindBugsを実行するfindbugs-maven-pluginの設定 /project/reporting/plugins <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <configuration> <xmlOutput>true</xmlOutput> <xmlOutputDirectory>${project.build.directory}</xmlOutputDirectory> <effort>Max<…</effort></configuration></plugin>

Maven2設定のまとめ

しばらく時間が経ったせいか、どこまで調べたのかわからなくなってしまったので、まとめてみる。 調べたプラグイン maven-checkstyle-plugin maven-compiler-plugin maven-eclipse-plugin maven-surefire-plugin + djUnit maven-surefire-report-plugin mave…

あの青いカレー

第弐回天下一カウボーイ大会の後のalty Partyで配られた、CyberSpace CurryBoysという青いカレーを晩ご飯に食べてみました。 青い色は赤106号と青1号のようです。 なんかイヤな色が見えてます。 盛り付け。何かが間違っています。 鶏ささみカツはヘルシオさ…

指定ディレクトリ以下のファイルのタイムスタンプを一括で更新する

今やっている案件の仕事環境が、共有サーバ上のファイルのタイムスタンプが1週間以上古いと自動的に削除されるという変なセキュリティポリシーを持っているので、それを回避するためにタイムスタンプを最新にするというしょうもないコードを書きました。 Tou…

taglist-maven-plugin

taglist-maven-pluginを使用してTODOやFIXMEの一覧をレポートとして出力する設定 EclipseのTask Tagsと合わせておくと便利です。が、日本語が化けます。数を確認するくらいにしか使えません。 ver.2.3以降はencodingのオプションが追加されたので化けなくな…

maven-project-info-reports-plugin

maven-project-info-reports-pluginを使用してプロジェクト情報を出力する設定 /project/reporting/plugins <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <reportSets> <reportSet> <reports> <report>cim</report> <report>dependencies</report></reports></reportset></reportsets></plugin>

Maven2からStepCounterを実行する

maven-antrun-pluginを使用してMaven2経由でStepCounterを使用する設定 StepCounterをダウンロード StepCounterはMaven2のセントラルリポジトリで管理されていないため、ここからStepCounterをダウンロードしてきます。今日現在の最新版は1.14です。 ローカ…

maven-antrun-plugin

Antタスクを実行するmaven-antrun-pluginの設定 /project/reporting/plugins <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>pre-site</phase> <configuration> <tasks> <echo message="Source Directory: ${project.build.sourceDirectory}"/> </tasks> </configuration> </execution></executions></plugin>

maven-surefire-report-plugin

UnitTestのレポートを生成するmaven-surefire-report-pluginの設定 /project/reporting/plugins <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <reportSets> <reportSet> <reports> <report>report-only</report> </reports> </reportSet> </reportsets></plugin>

maven-jxr-plugin

JavaソースをHTMLで生成するmaven-jxr-pluginの設定 他のレポートとソースを紐付けてくれるので、けっこう便利 /project/reporting/plugins <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jxr-plugin</artifactId> <configuration> <inputEncoding>UTF-8</inputEncoding> <outputEncoding>UTF-8</outputEncoding> <…</configuration></plugin>

maven-javadoc-plugin

JavaDocを生成するmaven-javadoc-pluginの設定 /project/reporting/plugins <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <encoding>UTF-8</encoding> <docencoding>UTF-8</docencoding> <charset>UTF-8</charset> <bottom></bottom> </configuration></plugin>

maven-surefire-plugin(djUnitを使用)

Unitテストを実行するmaven-surefire-pluginの設定 id:tanigonさんのこの記事が大変参考になりました。ありがたいことです。 /project/build/plugins <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.4.2</version> <configuration> </configuration></plugin>

maven-eclipse-plugin

Eclipseのプロジェクト用ファイルを作成するmaven-eclipse-pluginの設定 /project/build/plugins <plugin> <artifactId>maven-eclipse-plugin</artifactId> <version>2.5.1</version> <configuration> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> </configuration> </plugin> downloa…

maven-compiler-plugin

Javaのコンパイルを行うmaven-compiler-pluginの設定 /project/build/plugins <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> <encoding>UTF-8</encoding> <showDeprecation>true</showDeprecation> <showWarnings>t…</showwarnings></configuration></plugin>

Checkstyleの定義ファイルをURL指定する

maven-checkstyle-pluginの話。 maven-checkstyle-pluginのサンプルでは大抵、 <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <configuration> <configLocation>checkstyle.xml</configLocation> </configuration> </plugin> </plugins> </reporting> …

除外ファイル指定

Eclipse上でSubversionを使用している場合の除外ファイル指定の追加項目。 メニューのHelp → PreferencesのTeam → Ignored Resourcesから追加。 Thumbs.db target work targetとworkはMaven2用。

Proxy設定時の注意

昨日のlog4jの問題に続き、見事にハマってしまった。 ファイルを取得することは正常にできるものの、コミットしようとした場合に以下のようなエラーが出る場合、SubversionクライアントのProxy設定が間違っている可能性があります。 subversiveで出力される…

m2eclipseでsettings.xmlが読まれない

m2eclipseの初期設定では、settings.xmlファイルの場所をC:\Documents and Settings\Administrator\.m2\settings.xmlというように%USERPROFILE%\.m2以下と指定しているため、settings.xmlの設定を使う動作、たとえばProxyを利用している場合のダウンロードな…