Tuesday, December 11, 2012

Import hadoop with Eclipse

Eclipse is a good tool for study hadoop code. But it may takes a while to resolve all the links, make tool tip  and declaration jump work.

Here are steps:

1. create a java proj, using j2SE1.5 as your jre (to date it's the highest j2SE you can find in eclipse);
2. symlink src to src in hadoop
3. select proj->Build Path->configure build path, go to library tab
4. click "Add external JARs", and all jars from hadoop dir and lib dir
5. Switch to "Order and Export", check all hadoop-*.jars, click OK
6. select proj -> Refresh

That's it.

When you try to dereference a declaration of a obj, it may prompts you to "Attach file". Just attach to src folder should solve the problem.

 

Tuesday, December 4, 2012

C++ find common factors


It's such easy to do this:

#include <iostream>
using namespace std;

int gcd(int a, int b)
{
if(b == 0)
{
       return a;
}
else
{
return gcd(b, a % b);
}
}

int main()
{
     int a,b;
         
     cout << "Input first number: ";
     cin >> a;
     cout << "Input second number: ";
     cin >> b;
   
     cout << "Greatest common divisior (GCD) is " << gcd(a,b) << endl;
     return 0;
}

Friday, November 23, 2012

can not find by apt-cache -> run apt-get update

I re-installed ubuntu 12.10 today. Then the first thing I like to do is install chrome. I downloaded the deb and run dpkg to install. It prompts a missing package called libgconf2-4. Routinely, I run apt-cache to look for this guy. But I can not find it. This pissed me a bit.

Think it over, I probably need to update my apt-cache. So I run apt-get update. This is better. Now I can find libgconf2-4 from apt-cache.

A good think about apt is it remembers missing packages, so now you just need to run "apt-get -f install", that will install the be spoken libgconf2-4.

nice and easy~ I won't be afraid to run into this again. haha

Thursday, May 3, 2012

Build Xen 4.1.2 on ubuntu 11.04

Looks like easy from the README, but turns out to be tedious package find and see game. The "chk build" and "chk install" don't help much. Even you get all "OK", still not ok. So I just list all the packages I found necessary here :

sudo apt-get install libc6-dev-i386 bin86 bcc bridge-utils build-essential libncurses5-dev dpkg-dev debhelper fakeroot uuid-dev iasl texinfo git-core python-dev 

Hope this can save you a few minutes :)