スキップしてメイン コンテンツに移動

投稿

7月, 2012の投稿を表示しています

C#: Generate Integer Sequence

This is quick tips. If you would like to generate sequence in C#, you can do like below: // generate 1, 2, 3,...., 24 foreach (var i in Enumerable.Range(1, 25)){ // do somthing nice :D } In my opinion, C# (.Net implementation) has nicer built-in libraries and syntax than Java...

JsTestDriver Trouble and Tips

I am looking for testing tools for Javascript and reached at This Stackoverflow page . The page contains bunch of useful information :) After reading the page, I decided to use JsTestDriver for the following reason. having high affinity with CI server providing plugin for codecoverage - ( lcov format) JUnit format report To run Javascript test, you need to start up JsTestDriver server. The command is simple. java -jar JsTestDriver-1.3.4.b.jar --port 9876 One thing you should be careful about is if you run the above command in the directory which includes jsTesDriver.conf, the jar automatically picked up the jsTestDriver.conf and and it starts as server mode. Ok now you need to run client side (actual tests) against the server. You will use FireFox + Xvfb or PhantomJS as headless browser. java -jar JsTestDriver-1.3.4.b.jar --browser {path to browser} --tests all --config jsTestDriver.conf --testOutput testResult Also jsTestDriver.conf should something like this: server:

Selenium IDEの使い勝手について調査

Selenium IDEの概要 FireFoxのPlugin 公式ドキュメント 独断と偏見に満ちた長所・短所 長所 作成したテストを様々なプログラミング言語で出力可能 (File->Export Test Suite As...) ブラウザ上での操作をSelenium IDE Commandとして記録するマクロ機能あり 短所 正直、このpluginを導入するより、普通のSeleniumを使って、システムの実装言語だけでテストが完結している方が、プロジェクトの運用コストや学習コストが低くてすむ可能性大。 スクリプトを書いてみた感じだと'''面倒くさい'''。後々のテストのメンテナンスに難あり。 その他、メモ Html内の要素の選択方法 XPath, CSS, DOM, id属性, name属性などが使える Selenium CoreのLocatorsを参照 Assertion or Verification? Assert: テストに失敗すると、それ以降のテストコマンドは実行されない Verify: テストに失敗すると、結果はFailとして表示されるが、Verify以降のテストコマンドは引き続き実行される waitForコマンドは特定の要素が出現するまで待って、出現したら次のテストコマンドを実行する。Ajax系のテストに最適。

Phalanger

I didn't know that there is a PHP compiler - Phalanger It compiles PHP on .Net/Mono platform. The aim of Phalanger is improving performance of PHP  Web application. I am surprised that PHP compiled by Phalanger is four times faster than offical PHP 5.4. Will try it when I have a free time.

SWF Investigator

Not sure everyone is interested in Flash technology but I found an interesting powerful tool - Adobe SWF Investigator . It can analyze SWF file by useful provided functionality like disassembler, SWF Viewer etc. Here is the screenshot. I think this kind of tool should be released much more earlier... I think flash is already fade-out phase. But still the tool is useful for flash developer.

Get Useful SVN info in Ant

Hello there! I am trying to get svn info from Ant. I think there are two ways. SvnAnt Execute SVN command and extract information on Ant I've tried first option - SvnAnt but there is an issue for me. I need to pick up proper version of JavaHL based on Subversion client version installed on machine. Since I would like to shared the ant script between Windows and Linux box, it's a bit pain for me to switch the JavaHL in my Ant script. So I decided to go for second option. This method is really straight forward but a bit hack. The advantage of this method is it works at least svn command is available on your machine and it doesn't depend on svn client version. The disadvantage is it really depends on svn info output string e.g. it's design for human readability, not designed for API. Anyway, here is the example for getting svn revision and set it to build.current.revision property. What this target do is redirecting svn info output and extracting revision li

Setup Headless Browser

Recently I was trying to setup Selenium Tests on CI Server on Linux (Cent OS) box in order to test my web project. I need headless browser for Selenium Tests on CI Server. There are 2 options: PhantomJS FireFox + Xvfb PhantomJS is really cool and I confirmed it worked fine on my Windows XP. I would have liked to use PhantomJS on my Linux box, too. However looks the latest binary build is unable to run on my Linux box because the required libc and libstdc++ are missing in the box: $ phantomjs/bin/phantomjs phantomjs/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by phantomjs/bin/phantomjs) phantomjs/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by phantomjs/bin/phantomjs) phantomjs/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by phantomjs/bin/phantomjs) phantomjs/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by /home/duke/bin/ph

PMD and CPD for ECMAScript (Javascript)

Recently I have tried to use PMD and CPD for Javascript. I found that the offical PMD release says PMD 5.0.0 supports Javascript :D We have strong code inspection tools like Sonar etc. But I think still helpful for setting up compact ant task. PMD PMD ant task setup for javascript is easy, almost same as Java. Only you have to remember is including rhino jar in the classpath. Here is the example. <property name="buildscripts.path" location="${basedir}/generic-buildscripts"/> <property name="pmd.jar" value="pmd-5.0.0.jar"/> <property location="rhino-1.7R3.jar" name="rhino.jar"/> <path id="pmd.classpath"> <fileset dir="${buildscripts.path}/pmd/"> <include name="asm-3.2.jar"> <include name="jaxen-1.1.1.jar"> <include name="${pmd.jar}"> <include pa

「特定の文字から始まらない文字列」にマッチする正規表現

「特定の文字から始まらない文字列」 にマッチする正規表現の例です。  以下の例では、Aから始まらない文字列にマッチする正規表現を示しています。 ^(?!A).*$ 私も正規表現の組み方で四苦八苦することがあります。以下の書籍は実践的に様々な正規表現のパターンを例示してくれているので、重宝しています。

Continuous Integration

最近、継続的インテグレーション(CI:Continuous Integration)の環境の構築に励んでいるので、CIツールを紹介したいと思います。 TeamCity JetBrains 社が販売している分散ビルド管理(Distributed Build Management)と継続的インテグレーション(Continuous Integration)のためのサーバフレームワークです。 メリット とにかくRemoteRunが非常に便利、コミット前にCIServerでテストできるのはありがたいです。 UIがかっこいい(個人的な感想ですが。)  Jenkins 恐らく、2012年現在、CIサーバはJenkinsとTeamCityとの一騎打ち感じではないでしょうか? メリット 豊富なプラグイン! フリー!  2011年末に以下の書籍が発売されたので最近購入しました。初めてCI環境を経験、構築する人にはお勧めできます。私はTeamCityで既に実践(実戦?)経験があり、知っていた部分も多かったので、ちょっと物足りなかったです。ただプラグインの紹介やプラグインの開発の章は参考になりました。CIを初めて体験する方にお勧めします。 O'reillyからもJenkinsの書籍が出ているようです。 CruiseControl フリーの継続的インテグレーションツールです。 恥ずかしながら使ったことはありません。。。ちなみに.Net版の CruiseControl.NET もあるようです。 Sonar このツール自体は、CIサーバではありませんが、PMD、CPDなどのあらゆるCode Inspectionの機能を持ったサーバです。CIとは非常に親和性が高いので、導入をお勧めします。 特にコードの状態の可視化機能は圧倒的に優れていますので、大きなプロジェクトでは、是非導入したいところです。

C++の書籍(原著 vs 邦訳)

以下は、私が実際に購入した書籍です。原著と邦訳版を対で掲載します。 私が購入したのはすべて邦訳版です。英語力のある方は是非、原著を読むことをお勧めします! 書籍の画像をクリックするとAmazonへ飛びます。(欲張ってたくさん載せたら、リンクの画像が表示されない場合があるようです。。。申し訳ありません。) 基礎 C++ from the Ground Up, 4th Edition 色々見比べてこの書籍を購入しました。基本的な部分はすべて網羅されていますので、ちょっとしたC++のプログラムを書き始めるのであれば、十分な書籍だと思います。 中級 Effective C++: 55 Specific Ways to Improve Your Programs and Designs (Addison-Wesley Professional Computing Series) C++ Coding Standards: 101 Rules, Guidelines, and Best Practices (C++ In-Depth Series) C++だけでなく他の言語でも適用出るようなPracticeもあるので、私のようなJava中心のDeveloperでも役に立ちました。ただ分量の割りにお値段が。。。 More Effective C++: 35 New Ways to Improve Your Programs and Designs (Addison-Wesley Professional Computing Series) Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions (C++ In-Depth Series) Modern C++ Design: Generic Programming and Design Patterns Applied (C++ In-Depth Series) Exceptional C++ Style: 40 New Engineering Puzzles, Programming Problems, and So