Apr 18, 2013

java: invalid flag: -target=1.6 intellij idea

When I ran my test cases, I got this message "error: java: invalid flag: -target=1.6". I search this -"target=1.6" phrase in my project. So I re installed Intellij idea and removed .idea directory and .iml file. But I got same messages.
Finally I solved this problem by removing Additional command line parameters of java compiler.


Apr 11, 2013

How to add new node to an existing Aerospike Cluster - Using multicast

Modify /etc/citrusleaf/citrusleaf.conf as my example.

After modifying just start new node, it will be added an existing cluster automatically. You can confirm it on /var/log/citrusleaf.log with the following message.


Tip(?).
I changed ip address to 172.28.206.73 - it's wrong address -,  after I got succeeded with above configuration. So I fixed it to 172.28.206.72 and restarted node. But I got some non normal message.
I issued the command and failed to get expected result - ClusterSize 2 -.

I fixed this event by restarting all nodes.

Install and Run Aerospike Community Edition on CentOS 6.2

This installation is just for CentOS 6.2. If you use other OS like Ubuntu, please see Aerospike Standard Installation.

Step 1. Download Aerospike Database Server rpm packages
You can download here.

Step 2. Untar file


Step 3. Install the Aerospike Server


Step 4. Run the Aerospike Server for Testing

Oops! I got a error message. It means "CLD is stopped!".  Let me see the log.

Aha! Aerospike can't get ip address by eth, bond, wlan. Wait! my network interface name is "bond0.2032". If they use regular expression, it would be solved. But I can't fix it, so I changed my configuration file - /etc/citrusleaf/citrusleaf.conf - as blow. I just added network-interface-name item.

......

network {
        service {
                address any
                port 3000
                reuse-address
                network-interface-name bond0.2032

......

I ran it again and got succeeded.


Step 5. Verify Installation
I used the Aerospike command line interface tool to verity installation. It is installed as /opt/citrusleaf/bin/cli and lined in /usr/bin/cli. So you can use it normally.


It's simple, right?

Apr 10, 2013

How to install Jenkins and plugins offline.

I tried to the following commands that are introduced on Installing Jenkins on Red Hat distributions.


But I got failed. This server is not connected to internet. So I downloaded rpm package from RedHat Linux RPM packages for Jenkins and git, git-client plugins from Jenkins plugins download site to my MBA. And I uploaded them to the server and executed as blow.





Mar 18, 2013

No runnable methods junit 4.11

I am implementing Swift(OpenStack Object Storage) Client to use Swift simply. I ran each of test cases successfully on IDE, but I ran test cases with Class. It throws the following exception messages.



Here is my code.


I googled and searched several pages.

http://stackoverflow.com/questions/15383387/no-runnable-methods-on-junit-with-custom-annotation-and-all-tests-filtered

It says
You get this error due to the validation performed in validateInstanceMethods since computeTestMethods() returns an empty List: 

He suggested override or remove List size validation. I couldn't agree with him. Cause I have run my test cases with no problem on other projects. I read my code and error message again.

at swift.client.SwiftConfigTest.suite(SwiftConfigTest.java:17)

I felt it weird.  Because I don't need to run suite method. I removed suite method and ran all tests successfully.
Here is my right source code.

Feb 7, 2013

[memo] Kill all process by uid in Linux

Sometimes flunetd porecess is not stopped by "/etc/init.d/td-agent stop".
So I executed the following command.

Feb 5, 2013

bash while loopの変数が初期化される問題

業務上処理件数を調べる必要があったため軽くスクリプトを書くつもりが変数が初期化される現象に遭遇してはまった。

最初書いたスクリプトはこちらです。

特に問題ないように見えますが、最後のecho文の結果が0(zero)になります。

Google先生に聞くと下記のサイトを教えて下れました。
http://www.edwardawebb.com/linux/scope-issue-bash-loops

それで修正したスクリプトがこちら。正しくカウントできました。


ではなぜこの現象が起きるかというとパイプ(|)からのstdinはいつもsubshellを使うそうです。なのでループの中のcountはループ内の変数になってしまいます。
while文前パイプを使った場合よく起きるそうです。w

上で修正したスクリプトは自分のスタイルではないので下記のように見やすく修正しました。

Dec 7, 2012

how to remove remote branch in git(github)

It's simple to delete your remote branch.

  git push origin :

Deleting your local branch is simple too.

  git branch -d

You need to be on another branch. If you execute the command above on , you will see error message.

error: Cannot delete the branch '' which you are currently on.




Dec 6, 2012

How to make IntelliJ IDEA dark(Darcula)

If you use previous version (under 12), please import setting of Ted Wise. You can download this theme from the following URL.

http://tedwise.com/2009/02/26/dark-pastels-theme-for-intellij-idea/

If you just started IntelliJ IDEA 12,
1. Choose IntelliJ IDEA -> Preferences on Menu
2. Choose Editor -> Colors & fonts -> Scheme name
3. Choose Darcula! It's done.

Look it's beautiful!


Dec 5, 2012

Configuration of maven files to deploy to Nexus(Sonatype Nexus)

When I make a new Jenkins server, I always get a trouble with deploying module to Nexus. This memo  is just for me from future. Because I know I will search it again.

You need to write your Nexus repository information as the following.


ID is defined at pom.xml as below.

Nov 17, 2012

error: Setup script exited with error: command 'gcc' failed with exit status 1

I get the following error message when I tried to install tomahawk as following process of "How to install tomahawk"

Python's version is 2.4.3. tomahawk requires upper 2.4. My environments meets requirements.

Suddenly I remember that gcc troubles was solved by installing xxx-devel package.

I ran the following command.
  #]yum install python-devel

I could install tomahawk!

Oct 12, 2012

failed to flush the buffer, retrying. error="no nodes are available" fluentd

I got other error message from fluentd.
  failed to flush the buffer, retrying. error="no nodes are available"

The detail message is the following.


The reason
flunetd uses UDP for health check. But my target servers are on staging environment and collecting server is on production environment. They are on different segment. UDP is prohibited by our network policy.

The solution
Configure your Fire Wall to permit UDP over different segment.

fluentd unexpected error error="Address already in use - bind(2)"

When I started fluentd, I got the error message like the following.

2012-10-12 14:52:07 +0900: unexpected error error="Address already in use - bind(2)"

I searched which program was using this port. Yes, as you see it was td-agent(fluentd).
td-agent is supposed to use 24224 port. It's natural behavior.


But I forgot that I booted it by /usr/sbin/td-agent command before.
Yes it's absolutely my mistake. I killed this process and restart fluentd.

Aug 23, 2012

How to add cron job by Chef

Thanks to Chef, I have could save my time. Because I'm responsible for over 70 servers. I installed Middleware, configured user and ssh and OS environment variables by Chef 4 months ago. It just took half a day. Thanks Chef!

As you know, the LOGs became monsters when we have been satisfied. My application dumped out 4.4GB monsters for 4 months. I need to hunt them. So I reused Chef!

Here is my Chef recipe.


Here is my shell hunts monsters.


After run Chef client, you can confirm cron job is activated.


If you want to configure detail level of cron, please look around the following URL.
http://wiki.opscode.com/display/chef/Resources#Resources-Cron

Aug 9, 2012

How to get thread dump in Tomcat


#ps -ef | grep tomcat
30012    32470     1  6 15:06 ?        00:02:29 /usr/local/java/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -server -Dcom.sun.management.jmxremote -XX:MaxPermSize=256m -XX:PermSize=256m -XX:SurvivorRatio=2 -Xmn2048m -Xmx4096m -Xms4096m -Dweblogic.corba.client.bidir=true -XX:+PrintGCDetails -Xloggc:/usr/local/tomcat/logs/gc.log.20120809-1506 -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start

#kill -3 32470

Thread dump would be recorded on /usr/local/tomcat/logs/catalina.out
Thread dump starts with "TP-Proccesor".

Aug 7, 2012

error: src refspec master does not match any. error: failed to push some refs to 'git@github.com:.git'

If you are a github newbie as like me, it will help you.
Here is what I got message from git after I made new repository.
error: src refspec master does not match any.
error: failed to push some refs to 'git@github ... .git'
I googled and found this solution. It works for me.

$ touch README
$ git add README
$ git add *
$ git commit -m 'my first commit'
$ git push origin master --force

Jul 23, 2012

IntelliJ : java.util.ResourceBundle.throwMissingResourceException


java.util.MissingResourceException: Can't find bundle for base name voldemort
    at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499)
When I run my program on IntellJ IDEA, this error message shown up on console window. Do I miss something? Yes, I know. It's a kind of class path thing. Here are my solutions.
1. Move properties under sr/main/java/
2. Write attributes on your codes.
3. Just do the following.
 Select root directory of your project.
 Right Click.
 Choose "Mark Directory at" to "Source Root".
 
Don't choose 1 or 2. Your reviewers would be happy to have a chance to give you a lot of feedback.
It's a secret that I selected 2 for a test. :)
Here is my code.
    private StoreClientFactory storeClientFactory() {
        Properties p = new Properties();
        ResourceBundle rb = ResourceBundle.getBundle(VOLDEMORT_PROPERTY);
        for(String key:rb.keySet()) {
            p.setProperty(key, rb.getString(key));
        }
        return new SocketStoreClientFactory(new ClientConfig(p));
    }

Jun 19, 2012

Configuration for using post-review command on Mac

The memo for using post-review command on Mac

#easy_install -U RBTools
#brew update
#brew install svn  // It would stop on "make" step like following message. Don't worry about it. You just run it again. It will be installed.


==> Installing subversion
==> Downloading http://www.apache.org/dyn/closer.cgi?path=subversion/subversion-1.7.5.tar.bz2
==> Best Mirror http://ftp.meisei-u.ac.jp/mirror/apache/dist/subversion/subversion-1.7.5.tar.bz2
######################################################################## 100.0%
==> ./configure --disable-debug --prefix=/usr/local/Cellar/subversion/1.7.5 --with-ssl --with-zlib=/usr --with-sqlite=/usr/local --disable-neon-version-check --disable-mod-activation --withou
==> make

But you may have some problem yet. Because your built in svn(/usr/bin/svn) is prior to installed svn(/usr/local/bin/svn). You can change your path by using this command.

export PATH=new_path //copy your original path and exchange /usr/bin and /usr/local/bin

 or

Use /usr/local/bin/svn propset reviewboard:url http://reviewboard.example.com .

And make .reviewboardrc file in your check out directory.
#vim .reviewboardrc
REPOSITORY = "http://localhost/svn/myproject/trunk/"
REVIEWBOARD_URL = "http://localhost/reviewboard"

Finally you can use post-review for review board!
#post-review  // in your work directory = check out and modified directory.

reference:
http://www.reviewboard.org/docs/manual/dev/users/tools/post-review/

Warning:
If you use svn1.7.x, post-review command is unable on Review Board 1.6.9.
http://code.google.com/p/reviewboard/issues/detail?id=2359




Jun 18, 2012

Installing ReviewBoard on Ubuntu

I'm following this URL
http://www.reviewboard.org/docs/manual/dev/admin/installation/linux/

#sudo apt-get update
#sudo apt-get upgrade  //It takes time
#sudo apt-get install sqlite3
#sudo apt-get install apache2 libapache2-mod-wsgi
#sudo apt-get install python-setuptools
#sudo apt-get install python-dev

#sudo apt-get install memcached
#sudo easy_install python-memcached
#sudo apt-get install patch
#sudo easy_install ReviewBoard //If you failed here, please use pip. You may see this error message "error: Setup script exited with error: command 'gcc' failed with exit
status 1"
#sudo easy_install pip
#sudo pip install ReviewBoard
#sudo easy_install RbTools  //Don't forget this!!!

If you forget the last command, you will see "Review Board is taking a nap" message.


Install ldap modules
#sudo apt-get install libldap2-dev libsasl2-dev

#sudo easy_install python-ldap


Now you are ready to create Review Board site. Come on just run command. Choose options to fit your environment.


# rb-site install /var/www/rb


Finally we're the last step.



# sudo chown www-data -R /var/www/reviewboard/
# cp /var/www/reviewboard/conf/apache-wsgi.conf /etc/apache2/sites-enabled/000-default

Trouble with mysql-python gcc failed

I'm installing Reviewboard. I followed installing on Linux(Cent OS 5.4). I don't have any problem except the following command.

easy_install mysql-python


/usr/include/python2.4/pyconfig.h:6 から include されたファイル中,
                 /usr/include/python2.4/Python.h:8 から,
                 pymemcompat.h:10 から,
                 _mysql.c:29 から:
/usr/include/python2.4/pyconfig-64.h:648:1: 警告: ここが以前の宣言がある位置です

Googling gave me the answer about this.http://blog.eflow.org/archives/54
Actually the writer couldn't fix this problem but Olivier Biot has the answer.
Thx Olivier! The answer is here.

yum install MySQL-python

It works perfectly.