Technology Cares

Not Just another weblog

Posts Tagged ‘linux’

Unison to sync your computer to remote computer

Posted by Manish on October 14, 2010

Just type apt-get install unison
If you need to a particular version, or build from the source follow following steps.
1. Download Unison from http://www.cis.upenn.edu/~bcpierce/unison.
2. Download Objective Caml compiler (version 3.07 or later), which is available from http://caml.inria.fr
3. Build and install OCaml
4. Once you’ve got OCaml installed, unzip and untar Unison, change to the new unison directory, and type “make UISTYLE=text.” The result should be an executable file called unison.
5. Copy it to /usr/local/bin

***If you want to build the graphical user interface, you will need to install two additional things:
* The Gtk2 libraries. These areavailable from http://www.gtk.org and are standard on many Unix installations.
* The lablgtk2 OCaml library. Grab the developers’ tarball from
http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html,
untar it, and follow the instructions to build and install it.
(Quick start: make configure, then make, then make opt, then su and make install.)
Now build unison. If your search paths are set up correctly, simply typing make again should build a unison executable with a Gtk2 graphical interface. (In previous releases of Unison, it was necessary to add UISTYLE=gtk2 to the ‘make’ command above.

6. Follow following url for details on local usage and remote usage
http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html

Posted in Uncategorized | Tagged: , , , | Leave a Comment »

ssh without password

Posted by Manish on October 14, 2010

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:

a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory ‘/home/a/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):

a@A:~> ssh b@B mkdir -p .ssh
b@B’s password:

Finally append a’s new public key to b@B:.ssh/authorized_keys and enter b’s password one last time:

a@A:~> cat .ssh/id_rsa.pub | ssh b@B ‘cat >> .ssh/authorized_keys’
b@B’s password:

From now on you can log into B as b from A as a without password:

a@A:~> ssh b@B hostname
B

#note : Depending on your version of SSH you might also have to do the following changes:

* Put the public key in .ssh/authorized_keys2
* Change the permissions of .ssh to 700
* Change the permissions of .ssh/authorized_keys2 to 640

Posted in Uncategorized | Tagged: , | Leave a Comment »

Analyzing Execution Statistics of Java code using TPTP

Posted by Manish on February 17, 2010

I was looking for the plugin for Eclipse which would provide me the time spent by each piece of code while computing. After about an hour of quick research, I came across this tool called TPTP which is acronym for Test & Performance Tools Platform. This tool can be integrated into Eclipse thus allowing profiling of Java code running within Eclipse. The tool is easy to install and use (except for one exception that I encountered. It complained about some library while I tried to run it in my Elyssa machine for Eclipse 3.4.2).

1. Go to Eclipse -> Software Updates, type in ‘TPTP’ and search. You will find it under “Testing and Performance” in the update manager. Install it.

2. While trying to run it you may get the bug. It may complain saying something like this- “The launch requires at least one data collector to be selected”. To avoid it download the libstdc debian package as

wget http://ftp.us.debian.org/debian/pool/main/g/gcc-2.95/libstdc++2.10-glibc2.2_2.95.4-27_i386.deb

Then install the package to get rid of the bug.

sudo dpkg –install libstdc++2.10-glibc2.2_2.95.4-22_i386.deb

More about this at http://goodenoughjava.blogspot.com/2008/10/profiling-with-eclipse-tptp-problem.html

3.To profile a Java application, simply select the Java main class, right click and select “Profile as -> Java Application”

Switch to the perspective “Profiling and Logging” if you are asked. Here you can see various reports based on your selection.

These links might be helpful

http://www.vogella.de/articles/EclipseTPTP/article.html

http://www.eclipse.org/articles/Article-TPTP-Profiling-Tool/tptpProfilingArticle.html

http://www.eclipse.org/projects/project_summary.php?projectid=tptp

Posted in Uncategorized | Tagged: , , , , , | Leave a Comment »

Install Eclipse 3.4 (Ganymede) on Linux (Ubuntu)

Posted by Manish on February 15, 2010

Eclipse is the best open source IDE available for Java. Thus, it was natural for me to install it in my machine today. Why today? Coz its my first day at work here at UNO and my platform is Java 🙂

When installing, Eclipse has only one dependency – Java JDK. I had it mine preinstalled which I found by typing following in the terminal.

java -version

Otherwise, to install it issue the following command:

apt-get install sun-java6-jdk

I downloaded the latest version of Eclipse(Ganymede, version 3.4.2) from

http://www.eclipse.org/downloads/

When download finished, I just had to uncompress the archive accordingly.

tar -xzvf eclipse-jee-ganymede-SR1-linux-gtk.tar.gz

This created the directory /home/[USER_NAME]/eclipse. That is it.

Then I added Eclipse to the programs menu, so that I don’t have to start Eclipse from command line.

Posted in Uncategorized | Tagged: , , | Leave a Comment »