Saturday, April 4, 2015

Installing SVN Repository in Linux

Steps for installing SVN repository installation in linux

1. Update pre-installed software:
# sudo yum update -y

2. If Apache is not installed (guide):
    # sudo yum groupinstall "Web Server" "MySQL Database" "PHP Support"
    # sudo yum install php-mysql
    # sudo service httpd start

3. Install subversion and mod_dav_svn (should see a long list of all changes):
# sudo yum install mod_dav_svn
# sudo yum install subversion

4. Edit the Apache configuration file for subversion:
# sudo vi /etc/httpd/conf.d/httpd.conf
    include the following lines

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
<VirtualHost *:70>
 <Location /repos>
DAV svn
SVNParentPath /var/www/svn
SVNListParentPath On
SVNPathAuthz On
AuthType Basic
AuthName "Subversion"
AuthUserFile /var/www/svn-auth/passwd
AuthzSVNAccessFile  /var/www/svn-auth/access
Require valid-user
Order deny,allow
Allow from all
  </Location>
</VirtualHost>

5. Modify the DocumentRoot and Listen port
DocumentRoot "/var/www"
Listen 70

6. Create the directory which will contain the subversion repository:
# sudo mkdir /var/www/svn

7. Create the directory which will contain the permissions files.
# sudo mkdir /var/www/svn-auth

Create the permission file:
# sudo vi /var/www/svn-auth/access
And fill it with (replace Eswar, Rajasekar, Simbu with your usernames):
[/]
Eswar = rw
Rajasekar = rw
Simbu = rw

8. Create and add to the password file (use -c the first time to create)
# sudo htpasswd -cb /var/www/svn-auth/passwd Eswar pwd
# sudo htpasswd -b /var/www/svn-auth/passwd Rajasekar pwd
# sudo htpasswd -b /var/www/svn-auth/passwd Simbu pwd

9. Create a repository (REPONAME is the name of your repository eg projectrepo):
    # cd /var/www/svn
    # sudo svnadmin create REPONAME

10. Change files authorization (again after creating new repos too):
# sudo chown -R apache.apache /var/www/svn /var/www/svn-auth
# sudo chmod 600 /var/www/svn-auth/access /var/www/svn-auth/passwd

11. Start apache web server:
    # sudo service httpd restart

Verify the subversion repo by opening in a browser:

http://YOUR_INSTANCE_IP/repos/REPONAME

You are done! Connect via Tortoise svn client using the url above.

Linux Commands

To open bundle zip files :

  delete source        : bzip2 -d file.bz2
  keep the source    : bzip2 -dk file.bz2


To extract the tar files:

     tar -xvf myfile.tar
     tar -xzf myfile.tar.gz

To Check the linux version:

     cat /etc/redhat-release

To find the size of particular file:

      find . -name () -exec ls -l {} \;
      find . -name ReflectionUtil.class -exec ls -l {} \;
      find . -name my.cnf -exec ls -l {} \;

SONAR setup

Please follow below given steps for setting up SONAR in local dev environment:

1. Download Sonar from following link: http://dist.sonar.codehaus.org/sonar-3.5.1.zip
2. Unzip and save the downloaded sonar zip in localfile system.
3. Navigate to sonar bin path for example C:\Softwares\sonar-3.5.1\bin\windows-x86-64
4. Execute StartSonar.bat. In this step sonar is started. leave the comand prompt as it is.
5. Go to  Browser and access  sonar by http://localhost:9000
6. We can login to sonar using the login and password admin:admin
7. Go to Settings->Quality Profiles. Click on "Restore Profile" on the top right and select the            Sonar_Rules.xml which is attached below. Now you should see new Quality Profile "Sonar_Rules".    Set it as default.
8. Go to Settings->Configuration->Exclusions. Add following exclusions to Source File Exclusions section. This is to exclude unnecessary source files in metric calculations.
com/compname/project/**/model/**/*.java
com/compname/project/**/*Constant*.java
com/compname/project/**/*Exception.java
9. Navigate to root of your project path using windows command prompt and run: mvn sonar:sonar - In this step, our project build will be deployed in sonar
10. We can see our project listed on the Home screen. we can see the sonar report generated during ST build 

Creating a jar file in Command Prompt

The following are the steps to create the jar from command prompt
1.  Start Command Prompt.
        Navigate to the folder that holds your class files:
        C:\>cd \myproject
2.  Ignore this step if you already set the java path in environment variables
    To Check if it is already done run the below command
        echo %path
Set path to include JDK’s bin.  For example:
        C:\myproject> path c:\Program Files\Java\jdk1.7.0_25\bin;%path%                            
3.  Compile your class(es):
        C:\myproject> javac *.java
4.  Create a manifest file and your jar file:
        C:\myproject> echo Main-Class: MyMainClass >manifest.txt
        C:\myproject> jar cvfm MyJar.jar manifest.txt *.class
        - c for creating jar
        - v for verbos for displaying jar information on command prompt while jar itself
        - f for jar name
        - m for referring manifiest file                            
5.  Test your jar:
        c:\myproject> java -jar MyJar.jar

Sunday, December 15, 2013

refresh parent window while closing child popup window using javascript


parent script:
===========
win = window.open(mypage,myname,settings);

in child window code:
 ==============
window.onunload = function() {              
    window.opener.location.reload();
};

or

window.onbeforeunload  = function() {               
  window.opener.location.reload(); 
};

Difference between onunload and onbeforeunload is

using window.onunload , able to get an event called when user navigates to a different page from onepage to another . However nothing happens when the tab is closed from the minimized view (X)

Using window.onbeforeunload, I neither get an an event called even if the user navigates to a different page from onepage to another OR if he closes the tab (X) from the minimized view.

Friday, November 2, 2012

Reset Lost/Forgotten root password for MySQL

The following are the steos to restore MySQL root password that is lost/forgotten.

Step 1: Stop MySQL daemon if it is currently running    
     Command to find the MySQL Pid and kill the MySQL process
                ps –ax|grep mysql
                kill -9 pid
Step 2: Run MySQL safe daemon with skipping grant tables
                 mysqld_safe --skip-grant-tables & 
Step 3: Login to MySQL as root with no password
                 mysql -u root mysql
Step 4: Run UPDATE query to reset the root password
          UPDATE user SET password=PASSWORD("ualue=42") WHERE user="root";
      FLUSH PRIVILEGES; 
Step 5: Stop MySQL safe daemon
         Command to find the MySQL safe daemon Pid and kill the MySQL process
               ps –ax|grep mysqld_safe
               kill -9 pid
Step 6: Start MySQL
                            /etc/init.d/mysql start
Step 7: Login into MySQL using root password                          
                           mysql -uroot -proot
 

Thursday, August 16, 2012

Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules”


    While Adding/Removing the projects in tomcat server from eclipse , I am getting issue as “ Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules”. We are unable to add the project in server.
Its occuring since mismatch of jst version.

  

Solution

In project, “.settings” folder, find this file “org.eclipse.wst.common.project.facet.core.xml“, change the version of facet="jst.web" to 2.4 or 2.5.
File : org.eclipse.wst.common.project.facet.core.xml



<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>