function replaceSpace(obj)
{
obj.value=obj.value.replace(/^\s*|\s(?=\s)|\s*$/g, "");
}
Monday, June 10, 2013
How to find the number is even without using arithmetic Operators
public class EvenOrOddWithoutArithOprs {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
System.out.println("Enter any number : ");
// return the user input as integer
int number = in.nextInt();
// Finding Even and Odd number using Bitwise AND operator in Java.
System.out.printf("Finding number if its even or odd using bitwise AND operator %n");
// For Even numbers
// XXX0
// 0001 AND
// 0000
if ((number & 1) == 0) {
System.out.println("number %d is even number %n" + number);
} else {
System.out.println("number %d is odd number %n" + number);
}
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
System.out.println("Enter any number : ");
// return the user input as integer
int number = in.nextInt();
// Finding Even and Odd number using Bitwise AND operator in Java.
System.out.printf("Finding number if its even or odd using bitwise AND operator %n");
// For Even numbers
// XXX0
// 0001 AND
// 0000
if ((number & 1) == 0) {
System.out.println("number %d is even number %n" + number);
} else {
System.out.println("number %d is odd number %n" + number);
}
}
}
Friday, June 7, 2013
A QUERY FOR TWO DIFFERENT DATE AND TIMES BETWEEN TWO DATES
Select (To_Date(Decode('01/MAY/2013', '', '01/Jan/1910', '01/MAY/2013') ||
' 0001',
'DD-MON-YYYY HH24MI')) +
(Rownum - 1) / 24 FromDate,
(To_Date(Decode('31/MAY/2013', '', '31/Dec/9990', '31/MAY/2013') ||
' 0000',
'DD-MON-YYYY HH24MI')) +
(Rownum / 24) ToDate,
'F' Type,
'XXXX' Operator,
'' FlightNature
From tab
Where Rownum <= 24
' 0001',
'DD-MON-YYYY HH24MI')) +
(Rownum - 1) / 24 FromDate,
(To_Date(Decode('31/MAY/2013', '', '31/Dec/9990', '31/MAY/2013') ||
' 0000',
'DD-MON-YYYY HH24MI')) +
(Rownum / 24) ToDate,
'F' Type,
'XXXX' Operator,
'' FlightNature
From tab
Where Rownum <= 24
QUERY FOR DATE AND TIME SLOT
Select to_char((To_Date(Decode('01/MAY/2013', '', '01/Jan/1910', '01/MAY/2013') ||
' 0001',
'DD-MON-YYYY HH24MI')) + (Rownum - 1) / 24 ,'DD-MON-YYYY HH:MI:SS AM') FromDate,
to_char((To_Date(Decode('31/MAY/2013', '', '31/Dec/9990', '31/MAY/2013') ||
' 0000',
'DD-MON-YYYY HH24MI')) + (Rownum / 24),'DD-MON-YYYY HH:MI:SS AM') ToDate,
'F' Type,
'XXXX' Operator,
'' FlightNature
From tab
Where Rownum <= 24
' 0001',
'DD-MON-YYYY HH24MI')) + (Rownum - 1) / 24 ,'DD-MON-YYYY HH:MI:SS AM') FromDate,
to_char((To_Date(Decode('31/MAY/2013', '', '31/Dec/9990', '31/MAY/2013') ||
' 0000',
'DD-MON-YYYY HH24MI')) + (Rownum / 24),'DD-MON-YYYY HH:MI:SS AM') ToDate,
'F' Type,
'XXXX' Operator,
'' FlightNature
From tab
Where Rownum <= 24
Tuesday, June 4, 2013
Connecting the database and return values using hibernate session
public class InvPersonalInformationDAO {
private static InvPersonalInformationDAO invPersonalInformationDAO;
public InvPersonalInformationDAO(){}
public static InvPersonalInformationDAO getInstance(){
if(invPersonalInformationDAO == null){
invPersonalInformationDAO = new InvPersonalInformationDAO();
}
return new InvPersonalInformationDAO();
}
public List getInventoryList()throws EPASException{
List inventoryList = new ArrayList();
try {
Session session = HibernateSessionFactory.getSession();
Query query = session.createQuery("SELECT invEmpPiBasicDet FROM InvEmpPiBasicDet invEmpPiBasicDet WHERE invEmpPiBasicDet.invEmpMstStatus = '1' ");
Iterator iterator = query.list().iterator();
while(iterator.hasNext()){
InvEmpPiBasicDet invEmpPiBasicDet = (InvEmpPiBasicDet)iterator.next();
System.out.println("invEmpPiBasicDet.getBasicsalary() : "+invEmpPiBasicDet.getBasicsalary());
inventoryList.add(EntityToBeanConverter.convertInvEmpPiBasicDetToInvPersonalInformationBean(invEmpPiBasicDet));
}
} catch (Exception e) {
e.printStackTrace();
throw new EPASException(e);
}finally{
HibernateSessionFactory.closeSession();
}
return inventoryList;
}
public static void main(String[] args) {
InvPersonalInformationDAO id=new InvPersonalInformationDAO();
//or //
//InvPersonalInformationDAO id=InvPersonalInformationDAO.getInstance();
try {
List l1=id.getInventoryList();
} catch (EPASException e) {
e.printStackTrace();
}
}
}
retNodeValue(req,node) in AJAX
function retNodeValue(req,node)
{
if(req.responseXML.getElementsByTagName(node)[0].firstChild!=null||req.responseXML.getElementsByTagName(node)[0].firstChild!="")
return req.responseXML.getElementsByTagName(node)[0].firstChild.nodeValue;
else
return ' ';
}
{
if(req.responseXML.getElementsByTagName(node)[0].firstChild!=null||req.responseXML.getElementsByTagName(node)[0].firstChild!="")
return req.responseXML.getElementsByTagName(node)[0].firstChild.nodeValue;
else
return ' ';
}
Monday, June 3, 2013
In Struts-config.xml file form names having multiple but id value must be unique other wise we will get id is already defined error will get when strut-config.xml file is loaded
In Struts-config.xml file form names having multiple but id value must be unique other wise we will get id is already defined error will get when strut-config.xml file is loaded
<form-bean name="loginValidation" type="org.apache.struts.validator.DynaValidatorForm" id="i1" >
<form-property name="userId" type="java.lang.String" />
<form-property name="password" type="java.lang.String" />
<form-property name="dept" type="java.lang.String" />
</form-bean>
<form-bean name="loginValidation" type="org.apache.struts.validator.DynaValidatorForm" id="i2">
<form-property name="userId" type="java.lang.String" />
<form-property name="password" type="java.lang.String" />
<form-property name="dept" type="java.lang.String" />
</form-bean>
Subscribe to:
Posts (Atom)