kb/310530
Enhancing your expertise in Java, Kubernetes, Spring Boot, AWS, BTC, and ETH can significantly elevate your career prospects in the ever-evolving tech industry. Welcome to my blog, where I share insights and resources to help you master these key technologies and stay ahead of the curve. Enhance your tech skills with insights on Java, Kubernetes, Spring Boot, AWS, BTC, and ETH. Master advanced topics and stay updated with practical tips and tutorials!
Thursday, August 16, 2012
Automatic Completion in Windows
How to use authomatic Completion in Windows. In Linux, we often type "TAB" to display possible file that match character we typed. This can be done in windows too .. http://support.microsoft.com/
kb/310530
kb/310530
Wednesday, August 15, 2012
Installing Maven On CentOS
Copy from key2start wordpress
Installing Maven On CentOS
05APR
These are the simple sequences for making maven work on a CentOS machine.
Pre-requisite : Java to be installed, check using java -version
1. Download the current maven version from the prescribed repository, http://maven.apache.org/download.html. I use to work with maven version 2.0.11 and hence downloaded using,
> wget http://www.eng.lsu.edu/mirrors/apache//maven/binaries/apache-maven-2.0.11-bin.tar.gz
Please wait while it is downloaded as a tar archive.
2. Extract the archive to the desired maven home directory, which can be a common, /usr/local/
So move the downloaded apache-maven-2.0.11-bin.tar.gz to /usr/local/ path using mv command or a short way can be use the wget command told before after going to the /usr/local/ path. Any way no issues..
> mv apache-maven-2.0.11-bin.tar.gz /usr/local
> cd /usr/local
> tar -zxvf apache-maven-2.0.11-bin.tar.gz
This will extract the apache-maven-2.0.11 directory into /usr/local/
3. Create sym link..
> ln -s apache-maven-2.0.11 maven
4. Open ~/.bashrc file with vi ~/.bashrc and add the following lines to the end of the file,
export M2_HOME=/usr/local/apache-maven-2.0.11
export PATH=${M2_HOME}/bin:${PATH}
export PATH=${M2_HOME}/bin:${PATH}
5. AT last execute the environment changes with the command,
> . ~/.bashrc
Check the installation with,
> mvn -version
Wednesday, August 01, 2012
Simple sample source code to hash and encode the hashed value using Base4 or HEX
Simple sample source code to hash and encode the hashed value using Base4 or HEX
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
public class TestMessageDigest {
/**
* @param args
*/
public static void main(String[] args) {
TestMessageDigest test = null;
String rawPass = "passwordInClearTxt";
String encodedPass = null;
test = new TestMessageDigest( "SHA-256", true );
encodedPass = test.encodePassword( rawPass );
System.out.println( encodedPass );
test = new TestMessageDigest( "SHA-256", false );
encodedPass = test.encodePassword( rawPass );
System.out.println( encodedPass );
test = new TestMessageDigest( "SHA-512", true );
encodedPass = test.encodePassword( rawPass );
System.out.println( encodedPass );
test = new TestMessageDigest( "SHA-512", false );
encodedPass = test.encodePassword( rawPass );
System.out.println( encodedPass );
}
private TestMessageDigest(String algorithm, boolean encodeHashAsBase64) {
super( );
this.algorithm = algorithm;
this.encodeHashAsBase64 = encodeHashAsBase64;
}
private String algorithm;
private boolean encodeHashAsBase64 = false;
public String encodePassword(String rawPass) {
MessageDigest messageDigest = getMessageDigest( );
byte[] digest;
try {
digest = messageDigest.digest( rawPass.getBytes( "UTF-8" ) );
} catch ( UnsupportedEncodingException e ) {
throw new IllegalStateException( "UTF-8 not supported!" );
}
if ( encodeHashAsBase64 ) {
return new String( Base64.encodeBase64( digest ) );
} else {
return new String( Hex.encodeHex( digest ) );
}
}
protected final MessageDigest getMessageDigest()
throws IllegalArgumentException {
try {
return MessageDigest.getInstance( algorithm );
} catch ( NoSuchAlgorithmException e ) {
throw new IllegalArgumentException( "No such algorithm ["
+ algorithm + "]" );
}
}
}
Subscribe to:
Posts (Atom)