Mehotd to read Jar versions

I have a test JSP that is used for testing the installation of the applicaiton. 
I that I needed to find the versions of the Jar files that are loaded by the server. I wrote a small method in a JSP to read the Versions from the JAR files. 


String readManifest(String jar) {
try {
JarFile jarfile = new JarFile(jar);
Manifest manifest = jarfile.getManifest();
java.util.Map map = manifest.getEntries();
java.util.Iterator iter = map.keySet().iterator();
String ver = "unknown";
while(iter.hasNext()){
String key = (String)iter.next();
String str = null;
java.util.jar.Attributes attr = (Attributes)map.get(key);
str = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
if(str == null) {
str = attr.getValue(Attributes.Name.SPECIFICATION_VERSION);
}
if(str != null) { ver = str; }
else {
ver = "unknown";
}
}
return ver;
} catch (Exception ex) {
return "Error:"+ex.getMessage();
}
}


git error: error setting certificate verify locations


I am using Windows and msysgit. When I try to clone a git repo from Github I received a SSL related error.

>git clone https://someid@github.com/project/wisper.git
Password:
error: error setting certificate verify locations:
  CAfile: /bin/curl-ca-bundle.crt
  CApath: none
 while accessing https://someid@github.com/project/wisper.git

fatal: HTTP request failed

>git config -l
http.sslcainfo=/bin/curl-ca-bundle.crt

To fix the problem change the forward slashes to backward slashes.

>git config --system http.sslcainfo \bin\curl-ca-bundle.crt

>git config -l
http.sslcainfo=\bin\curl-ca-bundle.crt

Frequently Used Maven Commands

Frequently used Maven commands

# Command to Clean any previously build code
mvn clean

# Command to install
mvn install

# If you are behind a proxy then add this in the $USER_HOME/.me/settings.xml
<settings>
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>myproxyhost.com</host>
      <port>1234</port>
    </proxy>
  </proxies>
</settings>

# And for HTTPS traffic use this in the command line
mvn install -Dhttps.proxyHost="myproxyhost.com" -Dhttps.proxyPort="1234"

# For offline building (i.e. if you think you have all the required dependencies)
mvn –o install

# Command to install without executing unit tests
mvn install -Dmaven.test.skip=true

# Command to install but using a specific profile
mvn clean install -Ptomcat

# Command to use the Cargo Deploy plugin
mvn cargo:deploy

# Command to perform the release of a module
mvn -Dresume=false release:prepare release:perform

# Command to continue a release that stopped in the middile
mvn -Dresume=true release:prepare release:perform

# Command to do a Dryrun release
mvn release:prepare -DdryRun=true

# If SCM interactions are involved then below option can be used to provide a SCM Comment prefix
mvn -Dresume=false release:prepare release:perform -DscmCommentPrefix="Mvn Release 1.0:"

# Not all jar files are available in the Maven repository.
# Command to Upload a missing artifact jar into a local repository
mvn deploy:deploy-file -DgroupId=net.sf -DartifactId=jcsc -Dversion=0.98.1 -Dpackaging=jar -Dfile=JCSC.jar -DrepositoryId=thirdparty-jars -Durl=http://mavenrepo.comp.com/nexus/content/repositories/thirdparty-jars

# Command to create a maven project from an Artifact
mvn archetype:create -DgroupId=com.mycompany.myapp -DartifactId=basic-webapp -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DremoteRepositories=http://repo1.maven.org/maven2

# Command to check the version of maven plugin being used
mvn -Dplugin=install help:describe -Ddetail

# Command to Generate dependency tree
mvn dependency:tree -Doutput=dep-tree.txt

# List all dependencies of this project
mvn dependency:list

# Command to generate Site documentation
mvn site:site

# Commands to generate specific reports
mvn site:site -DgenerateReports=false -Dmaven.test.skip=true
mvn project-info-reports:summary -Dmaven.test.skip=true
mvn project-info-reports:scm project-info-reports:issue-tracking project-info-reports:index -Dmaven.test.skip=true

# Commands for various other reports
mvn taglist:taglist
mvn javancss:report
mvn dashboard:dashboard
mvn jdepend:generate
mvn changes:changes-report
mvn changes:jira-report

yum install MySQL - Remote Access

This post explains all the steps needed to install Mysql on Linux(RedHat, CentOS, Fedora) and configure it to access db from remote machines.

Install Mysql Client
$ yum install mysql

Install Mysql Server
$ yum install mysql-server

Upgrade Mysql Installation
$ mysql_upgrade

Login as root user
$ mysql -u root
mysql>

List the grants this user has
mysql> SHOW GRANTS;

Grant all privileges to login as root from any remote machine
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION