Use the below code to read the java property file and retrieve the property value.
Properties properties = new Properties();
FileInputStream in;
try {
in = new FileInputStream("app.properties");
properties.load(in);
in.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
return properties.getProperty("appcode");
Sample "app.properties" file is shown below.
appcode=50
email=admin@yahoo.com
Monday, July 19, 2010
Tuesday, July 6, 2010
From date < To date validate using js
Use the below js code to validate date "From date < To date"
var frmDate = document.getElementById("frmDate").value;
var toDate = document.getElementById("toDate").value;
if (frmDate < toDate) {
alert("Invalid Date Range!\nStart Date cannot be after End Date!")
return false;
}
var frmDate = document.getElementById("frmDate").value;
var toDate = document.getElementById("toDate").value;
if (frmDate < toDate) {
alert("Invalid Date Range!\nStart Date cannot be after End Date!")
return false;
}
Wednesday, June 23, 2010
Solution to dwr session error
Edit your web.xml file and and the following code.
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
Sunday, May 9, 2010
Move large number of files in solaris using "awk"
- Change directory where your files are located.
- Use the following "awk" script to move files from one location to another.
do
mv $k destination;
done
Monday, May 3, 2010
Use java 64 bit version
You have to use 64bit version of java when your memory allocation is larger than 4Gb.
Use -d64 parameter when running the application.
java -d64 -jar -Xms1024m -Xmx4096m Test.jar
Use -d64 parameter when running the application.
java -d64 -jar -Xms1024m -Xmx4096m Test.jar
Sunday, May 2, 2010
Type Cast in Java Script
In js, variables are created as var type. That means, js engine can cast it to the original type by itself.
parseInt(12) will be converted 12 to an Integer value.
Example Result
parseInt("12") 12
parseInt("12.657") 12
parseInt("12aaaa") 12
parseInt("aaaa") NaN (means "Not a Number")
parseInt(12) will be converted 12 to an Integer value.
Example Result
parseInt("12") 12
parseInt("12.657") 12
parseInt("12aaaa") 12
parseInt("aaaa") NaN (means "Not a Number")
Friday, April 23, 2010
Encrypt, Decrypt password in Mysql
Inserting password encrypted to database using the following sql.
Selecting password from database to a string.
INSERT INTO PASSWORD(pass) VALUES(DES_ENCRYPT('user password'));
This SQL will encrypt the user inserted password to a encrypted text. In table level, password is unreadable.
Instead of DES_ENCRYPT() method you can come up with your own function.
Selecting password from database to a string.
SELECT DES_DECRYPT(pass) FROM PASSWORD ;
This SQL will return user password as user inserted.
Subscribe to:
Posts (Atom)