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.

Jun 12, 2012

Mac keyboard symbol

I've just started MacBook Air a month ago. Yes I'm a newbie. So sometime I'm confused what this symbol( like ⎋) means when I started IntelliJ Idea. Here is the list of mac keyboard symbol. I hope it to help you.


  • ⎋ esc
  • ⇧ shift
  • ⌥ alt option
  • ⌘ command
  • ⌃ control
  • ⌫ delete

Jun 6, 2012

How to scan/fetch all of keys in Voldemort

I'm supposed to provide a list that shows all of data in Voldemort. At first, I look around voldemort.client.StroreClient class. It has #getAll() method but this method has a parameter that is collections of key. Now I want to know all of keys!

Next step, I searched "getAll", "scan" and "fetch" that heats what I want. I found voldemort.client.protocol.admin.AdminClient#fetchKeys(). But it fetches all keys on a particular node. As you know I want all of keys in Voldemort cluster. Let me do coding little bit.

Here is my code. Forgive me for my dirty code. I just wrote this in an instant.
 


    private List getAllKeys() {
        String bootstrapUrl = "tcp://localhost:6666";
        StoreClientFactory factory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl));
        AdminClient adminClient = new AdminClient(bootstrapUrl, new AdminClientConfig());

        Collection nodes = adminClient.getAdminClientCluster().getNodes();
        List list = new ArrayList();
        int count = 0;
        for (Node node : nodes) {
            if (!factory.getFailureDetector().isAvailable(node))
            {
                System.out.println("Oops Node " + node.getId() + " is unavailable");
                continue;
            }
            List partitionIds = node.getPartitionIds();
            Iterator iter = adminClient.fetchKeys(node.getId(), "tabe_name", partitionIds, null, true);
            while (iter.hasNext()) {
                String key = new String(iter.next().get());
                list.add(key);
                count++;
                System.out.println("Node id:" + node.getId() + " key: " + key);
            }
        }

        System.out.println(count);
        return list;
    }



May 29, 2012

Install Scala on Mac

It's simple if you installed home brew already.
Type the following. That's all. Now you can use Scala. Welcome to Scala world.




$ brew install scala sbt maven giter8

Apr 17, 2012

Basic knowledge for coding interview


  • Data Structures 
    • Linked List
    • Binary Trees
    • Tries
    • Stacks
    • Queues
    • Vectors/ ArrayLists
    • Hash Tables
  • Algorithms
    • Breadth First Search
    • Depth First Search
    • Binary Search
    • Merge Sort
    • Quick Sort
    • Tree Insert/ Find
  • Concepts
    • Bit Manipulation
    • Singleton Design Pattern
    • Factory Design Pattern
    • Memory(Stack vs. Heap)
    • Recursion
    • Big-O Time
quotes from Cracking the Coding Interview: 150 Programming Questions and Solutions

Mar 29, 2012

Bash script : cacti add graph to tree

I had to add much graph to graph trees on cacti over 80 nodes.
So I made the following script. I hope this will help you.

Please edit awk pattern phrases like "/host pattern/" as your situation.

#!/bin/bash
#
#   CopyLeft 2012 Joongjin, Bae
#
#

CACTI_CLI_DIR=/var/www/cacti/cli

cd $CACTI_CLI_DIR

HOST_ID_LIST=`php -q add_tree.php --list-hosts | awk '/host pattern/ { print $1}'`
TREE_ID=`php -q add_tree.php --list-trees | awk '/graph tree name/ { print $1}'`
PARENT_ID_LIST=`php -q add_tree.php --list-nodes --tree-id=$TREE_ID | awk '/^Header/ {print $0}' | awk '/graph tree header node pattern/ {print $2}'`
TARGET_GRAPH_ID_LIST=()

for host_id in $HOST_ID_LIST
do
  TARGET_GRAPH_ID_LIST=("${TARGET_GRAPH_ID_LIST[@]}" "`php -q add_tree.php --list-graphs --host-id=$host_id | awk '/add target graph pattern/ { print $1 "\n"}'`")
done

idx=0

for parent_id in $PARENT_ID_LIST
do
  for graph_id in ${TARGET_GRAPH_ID_LIST[$idx]}
  do
    php -q add_tree.php --type=node --node-type=graph --tree-id=$TREE_ID --parent-node=$parent_id --graph-id=$graph_id
  done
  idx=$((idx+1))
done

echo Mission Completed!

Feb 3, 2012

how to change language in netbeans


First of all, Let me show you my environment.
Windows 7 Professional 64bit
NetBeans7.1 64bit
Java 1.6 64bit

Now, I just changed my job and need to prepare new development environment. So I downloaded and installed NetBeans 7.1 English ver. But you know what I'm in Japan. So smart IDE, NetBeans, shows Japanese menu for me. It's cool But I'm Korean and I prefer to use it in English. As you know Java supports all of languages int the world.(It may be not.) Anyway, I asked Google Sensei.

Fortunately, I got one shot. Read the following URL.

It tells me use locale option like following.

  • "C:\Program Files\NetBeans 7.1\bin\netbeans.exe" --locale en:US



I just add this option to shortcut property. OK. It works. But I want another way. Because I want to write Blog. :) I asked G Sensei again in Japanese. Sensei shows me other ways. Here is my solution.

Add language option to netbeans.conf file. This file is located in ↓ if you installed it in default path

  • C:\Program Files\NetBeans 7.1\etc


Open it just add user.language=en to netbeans_default_options item. I show you my configuration.
(I don't change locale, cause I live in Japan ^^)

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true -J-Duser.language=en"

It is for English. kr for Korean ja for Japanese and cn for Chinese, Sorry since don't know other languages I can't show you other options. Anyway now you got another option to change language in NetBeans. If you are smart(I BELIEVE YOU ARE), you can change language in other IDE like Eclipse, IntelliJ and etc.

YOU WANT Japanese page? Just click the following URL.

Jan 5, 2012

The New Year Resolutions

Yes, I know that New Year already started 5 days ago.
I already decided my resolutions last year.
But I want to make it public and detail.
I hope publishing to force me achieve my resolutions.

OK, here are my resolutions.


  1. Promotion to Manager.
  2. Study of Computer Science and Statics in College.
  3. Buying my home.


1. I will be a manager. That's it.

2. I want to study computer science, statics and business. Big Data Analyst(he/she understands business) will be in high demand in 5 years. And analysis is fun.

3. My Home is My Dream.


------
Written on Jan. 4th 2022.

1. I was promoted to an engineering manager in 2016. But I was promoted to a team lead in 2012.
2. I started to study Stastics from 2012. But I finished my course in 2018.
3. I bought a house in 2013.