Wednesday, October 7, 2009

Scope in Web Apps

Request Scope
  • Only during the life-time of a single page request->rendering process
Session Scope
  • For as long as a “User” session is maintained (eg: for a user logged in)
Application Scope
  • For as long as the Web App is running

JAVA Typing/Scope

JAVA is a strongly “Typed” Language
  • Each variable is checked for type before assignment… no hidden coercions…
  • DOG myDogClass = (DOG) YourDogClass
SCOPE
  • Public
  • Protected (Only within related class’s)
  • Private (Only within class)

Monday, September 14, 2009

What is the syntax to view structure of table?

SELECT * FROM all_tab_columns
WHERE table_name='TEST'

Tuesday, August 18, 2009

Merge two arrays based on the condition

package com.test.sale;

import java.util.ArrayList;
import java.util.List;

public class swapPro
{

public static void main(String[] args)
{

int[] emp1 = { 2, 4, 5, 6 };
int[] emp2 = { 4, 6, 3, 56, 67, 88 };
int k = 0, temp1;
for ( int i = 0; i < emp1.length - 1; i++)
{
for ( int j = 0; j < emp1.length - 1 - i; j++)
{
if ( emp1[j] < emp1[j + 1] )
{
temp1 = emp1[j];
emp1[j] = emp1[j + 1];
emp1[j + 1] = temp1;
}
}
}

for ( int i = 0; i < emp2.length - 1; i++)
{
for ( int j = 0; j < emp2.length - 1 - i; j++)
{
if ( emp2[j] < emp2[j + 1] )
{
temp1 = emp2[j];
emp2[j] = emp2[j + 1];
emp2[j + 1] = temp1;
}
}
}

for ( int i = 0; i < emp2.length; i++)
{
System.out.println(emp2[i]);
}

for ( int i = 0; i < emp1.length; i++)
{
System.out.println(emp1[i]);
}
List empList = new ArrayList();

int first = 0;
int second = 0;
for ( int i = 0; first < emp1.length && second < emp2.length; i++)
{
if ( emp1[first] == emp2[second] )
{
empList.add(emp1[first]);
first++;
second++;
}
else if ( emp1[first] < emp2[second] )
{
empList.add(emp2[second]);
second++;
}
else
{
empList.add(emp1[first]);
first++;
}
}

for ( int i = first; i < emp1.length; i++)
{
empList.add(emp1[i]);
i++;
}

for ( int i = second; i < emp2.length; i++)
{
empList.add(emp2[i]);
i++;
}



System.out.println("Jayaprakash");
}
}

Sunday, July 19, 2009

Maven Instrumentation for EJB project

mvn compile -Doutput.directory=target/classes cobertura:instrument install -Dwas-ejb