December 27, 2009

Apache HTTPD and Tomcat Easy & Fast installation guide

1) Install httpd and httpd_devel using yum.

# yum install httpd**

2) Download the latest tomcat and tomcat connectors

# wget http://mirror.khlug.org/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz
# wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz

3) Compile tomcat connectors

# tar -xvfz http://www.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz
# cd tomcat-connectors-1.2.28-src/native
# ./configure --with-apxs=/usr/sbin/apxs
# make
# su -c 'make install'

4) Configurations

4-1) Add jk module to httpd.conf.
# vi /etc/httpd/conf/httpd.conf

LoadModule jk_module modules/mod_jk.so
//JkMount /*.jsp ajp13

<ifmodule jk_module="">
  JkWorkersFile conf/workers.properties
  JkLogFile logs/mod_jk.log
  JkLogLevel error
</ifmodule>

4-2) Set an tomcat/jdk home path.
# vi /etc/httpd/conf/workers.properties

workers.tomcat_home=/usr/local/src/tomcat6
workers.java_home=/usr/java/jdk_1.6.0.17

4-3) Edit {$TOMCAT_HOME}/server.xml

...
    <Host name="centos.com"  appbase="/home/test" unpackWARS="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
    <Context Path="" docBase="" debug="1" allowLinking="true" reloadable="true"></Context>
...

5) Changes SELinux policy

If you see something along the lines of:

Sep 15 10:56:57 fc5test kernel: audit(1158314217.408:259): avc:
denied  { name_connect } for  pid=2245 comm="httpd"
dest=8009 scontext=system_u:system_r:httpd_t:s0
tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket

then there is some work to do. Note, the “avc: denied” message references httpd (the Apache daemon) and port 8009 as the destination for a tcp socket connection (this is the Tomcat port from earlier). To allow Apache to perform network connects, you can do the following:

setsebool -P httpd_can_network_connect=1

This will allow Apache to perform network connections and will store this change in the booleans.local file in /etc/selinux/targeted/modules/active so it wil be reloaded at next boot.

December 25, 2009

BMW Z4 Wallpaper (1680x1050 size)

This is my car at Jungdongjin beach on the East Sea in Korea. It's made as a 1680x1050.

2009 Happy Christmas, 정동진 여행기

BMW Z4가 비록 후륜이지만 눈길과 빗길을 전혀 두려워하지 않는 나.. (-_-;;)
어김없이 과감히, 강원도 산길 국도 대관령을 뚫었습니다.
사진으론 표현이 잘 안되지만 정말 아름답더군요.



지나가던 길에 풍력발전 연구소가 있었습니다.
물론 바람은 거셌고, 풍력발전기는 뱅글뱅글~
얼어죽는줄 알았다는.



정동진에 도착해서는 가장 먼저 밥을 먹었습니다.
밥을 먹는 내내 주방 아주머니들이 강원도 사투리를 쓰시는데 귀엽다는 생각이 들더군요.
아마 '웰컴 투 동막골'에서 강원도 사투리가 귀엽게 소개된 탓인것도 같으나,
근본적으로 액센트자체가 귀여운 듯.



또 한번 어김없이 과감히, ..
"들어갈곳 못들어갈곳이 없다", "내가 가는 곳이 곧 길이다", 해변까지 GoGo.
(철판 깔면 누구나 가능함 ㅋ)



아, 바다는 아름답고 일몰도 멋졌(대부분 일출보러가던데)습니다.
요즘 답답한 마음이 뻥 뚫린다고나 할까. :)

모쪼록, 정동진으로 여행을 가신다면 반드시 국도를 애용해보세요!

December 23, 2009

Explore Followers of You With Twitter Cumulus!

Google Image Swirl was an inspiration to me. So, I just made the twitter cumulus using REST API. It's really simple But It's a 3D!!!! :)

All code written in javascript. You can simply use this and source code available if you want. How to? See this page, or query URL as below:

http://people.apache.org/~edwardyoon/twitter-cumulus.html?id={YOUR_TWITTER_ID}

P.S. If you have a lot of followers, do not use. It'll be slow.

December 21, 2009

Removing friendships using Twitter API

I just wanted to remove all friendships at once. (As you know, If there is a lot of friends, It could be a rough job... ) There is a Java library for TwitterAPI. So, I could program it. :)

public static void main(String args[]) throws Exception {
    Twitter twitter = new Twitter("user_id", "passwd");
    List list = twitter.getFriendsStatuses();

    for (int i = 0; i < list.size(); i++) {
      User user = list.get(i);
      twitter.destroyFriendship(String.valueOf(user.getId()));
      System.out.println("Un-following " + user.getName());
    }
  }

[Book] Pro Hadoop

Hadoop 관련 책을 살펴보다 Apache Hama가 언급된 부분이 있어, "아니 이런 훌륭한 책이 어디 또 있는가?" ㅋㅋ 스스로 감개무량하여 블로그에 포스팅 해둡니다. (아직 다 읽어보진 못해서 review는 패스)

도서 개요

You've heard the hype about Hadoop: it runs petabyte-scale data mining tasks insanely fast, it runs gigantic tasks on clouds for absurdly cheap, it's been heavily committed to by tech giants like IBM, Yahoo!, and the Apache Project, and it's completely open source (thus free). But what exactly is it, and more importantly, how do you even get a Hadoop cluster up and running?

From Apress, the name you've come to trust for hands-on technical knowledge, Pro Hadoop brings you up to speed on Hadoop. You learn the ins and outs of MapReduce; how to structure a cluster, design, and implement the Hadoop file system; and how to build your first cloud-computing tasks using Hadoop. Learn how to let Hadoop take care of distributing and parallelizing your software--you just focus on the code, Hadoop takes care of the rest.

Best of all, you'll learn from a tech professional who's been in the Hadoop scene since day one. Written from the perspective of a principal engineer with down-in-the-trenches knowledge of what to do wrong with Hadoop, you learn how to avoid the common, expensive first errors that everyone makes with creating their own Hadoop system or inheriting someone else's.

Skip the novice stage and the expensive, hard-to-fix mistakes...go straight to seasoned pro on the hottest cloud-computing framework with Pro Hadoop. Your productivity will blow your managers away.
What you'll learn Set up a stand-alone Hadoop cluster the smart way, laid out simply and step by step so you can get up and running quickly to build your next data center, collaborative, data-intensive Internet services application, Software as a Service (SaaS), and more. Optimize your Hadoop production tasks like an experienced pro. Work with time-proven, bulletproof standard patterns that have been tested and debugged in high-volume production. Understand just enough theoretical knowledge to know why something works in Hadoop, without getting bogged down in abstruse walls of theory. Get detailed explanations of not only how to do something with Hadoop, but also why, from a front-line coder with years in the Hadoop game. Turn someone else's expensive cluster-wide "wrong" into an orderly, productive "right" with professional-level debugging and testing.
Who is this book for?

IT professionals interested in investigating Hadoop and implementing it in their organizations, and existing Hadoop users who want to deepen their professional toolkits. About the Apress Pro Series

The Apress Pro series books are practical, professional tutorials to keep you on and moving up the professional ladder.

You have gotten the job, now you need to hone your skills in these tough competitive times. The Apress Pro series expands your skills and expertise in exactly the areas you need. Master the content of a Pro book, and you will always be able to get the job done in a professional development project. Written by experts in their field, Pro series books from Apress give you the hard-won solutions to problems you will face in your professional programming career.

December 16, 2009

Mircosoft's Bing (Korea) provides search engine with the Daum, corp.

Today, I just noticed that the http://bing.com is automatically redirected to
http://bing.search.daum.net/search?q=bing.

BTW, Daum and Bing's search results are exactly the same. It looks like a bing-skinned version of Daum search engine. LOL

- daum search result
- bing search result

See also,
- Microsoft’s Bing fails to crack Korea

December 12, 2009

Hot spring bath, .. 온천욕 매니아

정확히 기억은 안납니다만 언제부터인지 못해도 주-(week) 마다 한번은 꼭 온천을 갑니다. 오늘도 어김없이 ㅋ.



남한산성에서 점심을 먹고, 넘어가는 길에 찍은 사진입니다. '퇴촌 스파그린랜드'를 갔지요. (가장 좋아하는 코스) 오늘은 날씨가 크게 나쁘지않아서 탑을 오픈해도 춥지않고, 적당하더군요.

온천지에 도착해서는 도저히 '촬영 정신'을 연결할 수 없어서, 사진은 이것으로 끝납니다. 홀딱 벗어야 되는 상황도 한 몫 했을것이고..

굳이 이후 상황을 말로 전달하자면, 따듯한 온천에 가만히 누워 하늘을 바라보는 그 맛은 정말 '신선놀음'이라 할 수 있지요. 명품 악세서리, 고급 스포츠카, 맛있는 음식, ..., 등등 무엇보다 달콤한 맛이죠.

이렇게 (한국나이) 31살 12월을 보내고 있습니다.

December 9, 2009

Serialize Printing of HelloWorld using BSP of Hama

Apache Hama Team made the BSP package, which is a computational model based on the concept of supersteps on the top of Hadoop for perform matrix/graph computations with better performance. It provide more flexible programming model than Map/Reduce, and more simple APIs than MPI. The vertical system structure of the BSP is as below:



Sequential composition of "supersteps".
- Local computation
- Process Communication
- Barrier Synchronization

* More detailed will be announced very soon.

To helping understand the Synchronization and Superstep, I made a "Serialize Printing of Hello World" example.

The below codes create 10 BSPPeerThreads. Each thread will have a shuffled ID number from 0 to 9.
BSPPeerThread thread;
    int[] randomSequence = new int[] { 2, 3, 4, 5, 0, 1, 6, 7, 8, 9 };
    for (int i = 0; i < NUM_PEER; i++) {
      conf.set("bsp.peers.num", String.valueOf(NUM_PEER));
      conf.set(BSPConstants.PEER_HOST, "localhost");
      conf.set(BSPConstants.PEER_PORT, String
          .valueOf(30000 + randomSequence[i]));
      conf.set(BSPConstants.ZOOKEEPER_SERVER_ADDRS, "localhost:21810");
      thread = new BSPPeerThread(conf, randomSequence[i]);
      thread.start();
      System.out.println(randomSequence[i] + ", " + thread.getName());
      list.add(thread);
    }

    for (int i = 0; i < NUM_PEER; i++) {
      list.get(i).join();
    }

Try to run below codes, then you'll see the output in order of thread ID. (It'll take 10 steps)

for (int i = 0; i < NUM_PEER; i++) {
        if (myId == i) {
          echo.add(getName());
          System.out.println("Hello BSP from " + i + " of " + NUM_PEER + ": "
              + getName());
        }

        try {
          Thread.sleep(2500);
          peer.sync();
        } catch (IOException e) {
          e.printStackTrace();
        } catch (KeeperException e) {
          e.printStackTrace();
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }

December 8, 2009

Google Chrome is available today on Linux!

Oh yes!! I love it.

----
Hello everybody out there using Linux -

Google Chrome is go for beta on Linux! Thanks to the many Chromium and WebKit developers who helped make Google Chrome a lean, mean browsing machine. Here are a few fun facts from us on the Google Chrome for Linux team:

60,000 lines of Linux-specific code written
23 developer builds
2,713 Linux-specific bugs fixed
12 external committers and bug editors to the Google Chrome for Linux code base, 48 external code contributors

Thanks for waiting and we hope that you enjoy using Google Chrome!


Google Chrome Team



http://www.google.com/chrome/intl/en/w00t.html

--------

(c) 2009 Google www.google.com 1600 Amphitheatre Parkway, Mountain
View CA 94043 United States of America.

Google is a trademark of Google Inc. All other company and product
names may be trademarks of the respective companies with which they
are associated.

December 7, 2009

Drawing a pie chart using Google Chart API

Really useful!!!

----
The Google Chart API lets you dynamically generate charts. To see the Chart API in action, open up a browser window and copy the following URL into the address bar:

http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=450x200&chl=Hello|World

Press the Enter or Return key and - presto! - you should see the following image:


December 3, 2009

Introducing Google Public DNS

어제 구글 공식 블로그에서 Google Public DNS 에 대해 소개가 있었습니다 -- Official Google Blog: Introducing Google Public DNS

DNS라는건 Domain Name System의 약자로 IP 주소를 도메인 네임(Domain Name)으로 매칭해주는 시스템으로, blog.udanax.org 와 같은 도메인을 브라우저로 입력하면, DNS 서버의 데이터베이스를 참조하면서 해당 서버를 찾아가는 일련의 작업을 내부에서 하게됩니다. 이건 통상 ISP 인터넷 제공자, 즉 KT나 뭐 그런애들이 제공하는데, 이걸 자기들이(Google) public DNS 제공해서 좀더 빠르게 해주겠다는 얘기로 요약됩니다.

어떻게 사용하냐? 사용법은 간단하게 DNS server 주소를 8.8.8.8 과 8.8.4.4 로 변경해주면 됩니다.

(리눅스 기준) DNS server를 아래와 같이 변경하면 됩니다.
[edward@udanax ~]# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4


윈도우즈도 마찬가지로 네트워크 연결 속성에서 DNS server ip를 8.8.8.8 과 8.8.4.4 로 바꿔주면 됩니다.
C:\Documents and Settings\Administrator>ping 210.94.0.73
Pinging 210.94.0.73 with 32 bytes of data:

Reply from 210.94.0.73: bytes=32 time=4ms TTL=243
Reply from 210.94.0.73: bytes=32 time=5ms TTL=243
Reply from 210.94.0.73: bytes=32 time=4ms TTL=243
Reply from 210.94.0.73: bytes=32 time=4ms TTL=243

Ping statistics for 210.94.0.73:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 4ms, Maximum = 5ms, Average = 4ms

C:\Documents and Settings\Administrator>ping 8.8.8.8
Pinging 8.8.8.8 with 32 bytes of data:

Reply from 8.8.8.8: bytes=32 time=125ms TTL=239
Reply from 8.8.8.8: bytes=32 time=126ms TTL=239
Reply from 8.8.8.8: bytes=32 time=125ms TTL=239
Reply from 8.8.8.8: bytes=32 time=125ms TTL=239

Ping statistics for 8.8.8.8:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 125ms, Maximum = 126ms, Average = 125ms
Ping-Pong 테스트 결과는 이렇지만, 이상하게 빨라진 느낌이나네요 (-_-;;)