How to share folder between Ubuntu guest and Windows host in Virtual box

My host is Windows XP , although it matters very less as for most of windows you can guess the process from these steps

Step 1

After you start your virtual machine , Click on Devices and Install Guest Additions , Guest additions is bunch of tools which makes life easy :)

Let the install finish

Step 2


Click Device > Shared folders and click Add

In the window which appears , enter the folder path of windows which you want to share , for example D:\Virtualmachineimages\shared

In Folder name give the friendly name with which you want your folder to appear in Ubuntu , i chose myshared

Select the options to Auto mount and Make permanent if you want this folder to be automatically made available to Ubuntu and changes are synchronized.

Step 3

Add your user with which you are logged into Ubuntu to group named vboxsf

You can do this by going to System > Administration > Users and Groups

Select the user with which you are logged in , Click Advanced settings

Change the group of user to vboxsf

Log out of Ubuntu and login again

Step 4

Go to root folder of Ubuntu

You can see your shared folder at /media/sf_myshared

Enjoy

IF you are struck you can watch the following video also on YouTube

Hadoop development environment in eclipse

The sample steps are

Create a Java Project
In Build path add the hadoop jar files , which come by default when you download hadoop binary from apache website.
It is also suggested that you link javadoc and source files for the above jars also

Now create one sample program based on famous WordCount example of hadoop

The example present on the official documentation for version 0.20.203 is based on old API , if you want to see the latest example you can see the link below

http://shuyo.wordpress.com/2011/03/08/hadoop-development-environment-with-eclipse

The example also shows detailed steps to setup eclipse

Sample code which you can use , just create one folder named input within your project workspace folder
Click Run

package com.hadoop;

import java.io.IOException;
import java.util.*;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.Job;

import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.Mapper.Context;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.util.GenericOptionsParser;

public class WordCount1 {

public static class SimpleMapper extends Mapper {

private Text word = new Text();
private static final IntWritable one = new IntWritable(1);

public void map(Object key, Text value, Context context)
throws IOException {

StringTokenizer itr = new StringTokenizer(value.toString());
while (itr.hasMoreTokens()) {
word.set(itr.nextToken());
try {
context.write(word, one);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}
}

public static class SampleReducer extends Reducer {

private IntWritable result = new IntWritable();

protected void reduce(Text key, Iterator values,
Context context) throws IOException, InterruptedException {
// TODO Auto-generated method stub

int sum = 0;
while (values.hasNext()) {
sum += values.next().get();
}
context.write(key, new IntWritable(sum));

}

}

public static void main(String[] args) throws Exception {

Configuration conf = new Configuration();
GenericOptionsParser g = new GenericOptionsParser(conf, args);
String[] otherArgs = g.getRemainingArgs();
Job job = new Job(conf, "Example Hadoop 0.20.1 WordCount");
job.setJarByClass(WordCount1.class);
job.setMapperClass(SimpleMapper.class);
job.setReducerClass(SampleReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path("input"));
FileOutputFormat.setOutputPath(job, new Path("output"));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}

Java 7 API documentation download

I spent considerable amount of time looking to find where to download the API documentation for Java 7 for offline view. Must say oracle website was not usable for finding the link.

At last i was able to find it at

http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html

I searched Google with keyword

“Java SE Development Kit 7 Documentation” zip

Online view for J2SE JDK 7
http://download.oracle.com/javase/7/docs/api/

The Java Language Specification, Java SE 7 Edition
http://download.oracle.com/javase/cmn/spec_index.html

The Java Virtual Machine Specification, Java SE 7 Edition
http://download.oracle.com/javase/cmn/spec_index.html

Java SE , J2SE JDK 7 Download
http://www.oracle.com/technetwork/java/javase/downloads/index.html