Wednesday, November 11, 2009

SVN Repository Migration

Steps to Move SVN from on server to another:

1. Take dump of current SVN server.

svnadmin dump --incremental -r 6274 /svn > rev6274.svn_dump

2. Create Repository on new Server

svnadmin create TestSVN

3. Load dump to new Repository (path to svn)

svnadmin load /home/shailesh/svnrepo/TestSVN
< /app/Work/Projects/rev6274.svn_dump

4. Configure virtual host on apache in apache config file.
here convert square braces to triangular braces.
[Location ]
DAV svn
SVNPath /home/shailesh/svnrepo/TestSVN
AuthType Basic
AuthName "ShaileshRepo"
AuthUserFile /etc/subversion/passwd
[LimitExcept ]
Require valid-user
[ / LimitExcept ]
[ / Location ]

5. AuthUserFile is file for Username and password to access svn.

6. Create AuthUserFile and add username and password.(user1 is username)
It will prompt for password and username & pwd will be added to passwd file.

sudo htpasswd -cm /etc/subversion/passwd user1

7. To add more user use ( c option is for creating file)
sudo htpasswd -m /etc/subversion/passwd user2

8. Give read/write permissions to SVN folder.

9. Restart apache server.

sudo /etc/init.d/apache2 restart

Tuesday, May 12, 2009

How to release Tomcat port on Ubuntu

Many times i was facing problem of Out of Memory error for Tomcat while developing applications.
Sometimes IDE failed to stop tomcat. And if you try to start tomcat again on same port, you get error that "port is already in use". In such cases, below are steps to release Tomcat port to restart tomcat again on same port.

1. Find out which process is using Port using command
sudo netstat -lpn |grep :8080
You will get output like
tcp6 0 0 :::8080 :::* LISTEN 6749/java

2. Process Id 6749 is using port 8080.

3. Kill the process using command
kill 6749

Now you can again use port 8080 to run tomcat on this port.

Tuesday, March 31, 2009

Sample Android application using Netbeans on UBUNTU

Sample Android application using Netbeans on UBUNTU

Step 1. Download Android SDK from
http://developer.android.com/sdk/1.1_r1/index.html

Unzip distribution.

Step 2. Setting Netbeans plugin for Android :
You can get details installing plugin for Android at
http://kenai.com/projects/nbandroid/pages/Install

Step 3.
Netbeans menu
Tools -- Java Platform
Click Add Platform button
Select Google Android Open Handheld platform.
Set Android SDK directory as Platform folder. (downloaded and unzipped in step 1)
Click next and set name as "Android".
Click finish.

Step 4. Create new Android Project
File -- Project --
Android -- Android Application
Set project Name as HelloAndroid for example.
click finish

Step 5.
Open Source packages
org.me.helloandroid.MainActivity.java file.

there is oncreate method as follows
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// ToDo add your GUI initialization code here
}

Change it by adding few lines of code to display "Hello Android".

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// ToDo add your GUI initialization code here
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}

Step 6.
Run Application.

You will get "Hello Android" text on Android Emulator screen.


If You get Following Exception while running application :
trouble processing:
invalid constant pool index 0000
...while parsing attributes[1]
...while parsing Code attribute at offset 0000013e
...while parsing attributes[0]
...while parsing methods[0]
...while parsing org/me/helloandroid/R$layout.class
...while processing org/me/helloandroid/R$layout.class


Check java -version on console and set it as java-6

Here are steps how to set this:
on console window type : sudo update-alternatives --config java

It will give installed versions and option to set java version.

If java 6 is not in list use following link to install and set as default version
https://help.ubuntu.com/community/Java