Set up quickly a Hadoop 2.3 project on Mac OS X

Install Hadoop on Mac OS X using Homebrew

brew install hadoop

Create a quick Maven-based Java project

mvn archetype:generate -DgroupId=org.xmao.hadoop -DartifactId=wordcount -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Configure Java project to support Hadoop

Add the follow dependencies into pom.xml

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.3.0</version>
</dependency>

Develop and compile Hadoop project using Maven

Now you have all the stuff for a Hadoop project, and you can start with WordCount example on Hadoop web site and then package all the Java binary classes into a final jar.

mvn package

Then you can run your first Hadoop example like this:

hadoop jar target/wordcount-1.0-SNAPSHOT.jar org.xmao.hadoop.WordCount INPUT_FILE OUTPUT_DIR

Pretty easy, right? Enjoy!

Advertisements

Fixed slow MATLAB UI response on mountain lion

The slow UI is due to a recent Apple Java update (build 1.6.0_51-b11-456-10M4508), which impacts <= 2012b and made me feel awful. To check, just type command in MATLAB console:

version -java

If you get 1.6.0_51-b11-456-10M4508, you may encounter this problem.

Apple has fixed in another patch, and just installing this patch manually fixes the issue finally. Here is the link:

http://support.apple.com/kb/DL1572

After installing, check again with version -java, you should get the msg like:

Java 1.6.0_51-b11-457-11M4509

Load flat text file into a Berkeley DB database

cat INPUT_FILE | sed ‘s/\\/\\\\/g’ | db_load -T -t hash DB_FILE

“-T” is requirable if input file is just flat text file instead of being from db_dump. The input file consists of two-line pairs, in which the first line in a pair is key and the second is value.

An excellent quick tour for Objective-C

http://www.otierney.net/objective-c.html

Fantastic desktop on my mac book pro

Just show the desktop in my mbp. It’s fantastic, and I am a mac fan now 🙂

wpid-sbres_1265904205_0__-2010-02-11-11-03.png