Ashok George

Ranch Hand
+ Follow
since Mar 25, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ashok George

Hi can any body help me in figuring out a correct and working Plug in thru which i can draw activity and sequence diagrams for my project .I tried a couple of ones called eclipseUML_E320_freeEdition and also the eUML2-Free-Edition...
but i didn"t get it working....PLease help me....
hi!

See this is just a dummy code that I have to do.there should just be a login page with text fields for login id and password.i ahve created this html page.nOW I NEED TO CONVERT THIS INTO A JSP PAGE WHERE THESE VALUES HAVE TO BE RETRIEVED AND VALIDATED AGIANST A FEW DEFAULT INPUT VALUES AND THE ABOVE GIVEN PROCESSES SHOULD BE DONE.PLease help me!
17 years ago
JSP
Hi!

I apologize for using the term.But if you could please let me know where I can find a code for this or a similar kind of login page I would be grateful.Thank you!
17 years ago
JSP
Hi!
I am a novice ewith programming in jsp.Could you please help me out in making a jsp which has a login and password and a submit button.both fields should also be authenticated after submit is hit.there are a maximum of three attempts.if not successful in all three attempts then you cannot login a fourth time.Could you please tell me how to do this .Urgent!
17 years ago
JSP
Hi!
I recently coded a client server program where I use a dummy server and it is not a multi threaded server.It executes perfectly with simple lines of code or even the html files.but now i have been asked to modify the client program in such a way that it sends out an xml file to the server and by default when this comes back the program should parse it effectively using the DOM parser.I am new to the concept of DOM.but i tried it.But the DataInputStream object is showing null and so not able to parse.Could you please help me out on this.?If possible could yousend me a client server program that does the above function.Thank you!
if my understanding is not wrong while using LOG4J JDBCappender to write to a DataBase using configurator file(Property file), the SQL will be written in the property file and the message to be logged into the DB will be passed from the program(java file ) to the log4J system using the log.debug or any other way.
for eg: INSERT INTO JDBCTEST (Date, Logger, Priority, Message) VALUES ('%d', '%c', '%p', '%m')
here the only message passed t th eLOG4J system is the Message field value which is

represnted by the %m field(inside the value block) and rest are kind of constants , like for date (where we can use sysdate) and the logger and priority level which all are constants and not part of the message passed to the system(LOG4J system).
the trouble we found was in separating the single message we send to the LOG4J system

for eg: suppose if the message we send to the LOG4J system is
" methodname=ABC() timetaken=1.5secs date=28/7/2006 "
i am confused about the way to split the message into say 3 parts
like

methodname=ABC()
methodname=ABC()
date=28/7/2006

and insert into different columns of the table

Hope you got a good broader view of the problem i am facing.
17 years ago
log4j.properties
------------
# config file for JDBCAppender:
log4j.rootCategory=ALL, jdbc

# JDBCAppender writes messages into the database
log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender

#SQL statement to be used (with multiple columns formated)
log4j.appender.jdbc.sql=insert into QIPIP_QUEUE(L)
values ('%m')

# DB Options
log4j.appender.jdbc.URL=jdbc dbc:myDB
log4j.appender.jdbc.user=me
log4j.appender.jdbc.password=password

#set the buffer size
log4j.appender.JDBC.buffersize=1

--------------------------------------------
test.java
import org.apache.log4j.*;
import java.sql.*;
import java.lang.*;
import java.util.*;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.jdbcplus.JDBCAppender;

public class log4jTest
{

static Logger logger = Logger.getLogger(log4jTest.class);//new

public static void main(String[] args)
{
// Ensure to have all necessary drivers installed !
try
{
Driver d = (Driver)(Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
DriverManager.registerDriver(d);
}
catch(Exception e){}


logger.setLevel(Level.DEBUG);

// Configuration with configuration-file
PropertyConfigurator.configure("log4j.properties");

logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");

}
}
---------------------------------------


here when i run the FILE. IT SAYS THE POPERTY FILE IS NOT CONFIGURED PROPERLY!!
CAN ANY 1 HELP ME PLEASEEEEEEE
log4j.properties
------------
# config file for JDBCAppender:
log4j.rootCategory=ALL, jdbc

# JDBCAppender writes messages into the database
log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender

#SQL statement to be used (with multiple columns formated)
log4j.appender.jdbc.sql=insert into QIPIP_QUEUE(L)
values ('%m')

# DB Options
log4j.appender.jdbc.URL=jdbc:odbc:myDB
log4j.appender.jdbc.user=me
log4j.appender.jdbc.password=password

#set the buffer size
log4j.appender.JDBC.buffersize=1

--------------------------------------------
test.java
import org.apache.log4j.*;
import java.sql.*;
import java.lang.*;
import java.util.*;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.jdbcplus.JDBCAppender;

public class log4jTest
{

static Logger logger = Logger.getLogger(log4jTest.class);//new

public static void main(String[] args)
{
// Ensure to have all necessary drivers installed !
try
{
Driver d = (Driver)(Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
DriverManager.registerDriver(d);
}
catch(Exception e){}


logger.setLevel(Level.DEBUG);

// Configuration with configuration-file
PropertyConfigurator.configure("log4j.properties");

logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");

}
}
---------------------------------------


here when i run the FILE. IT SAYS THE POPERTY FILE IS NOT CONFIGURED PROPERLY!!
CAN ANY 1 HELP ME PLEASEEEEEEE
log4j.properties
------------
# config file for JDBCAppender:
log4j.rootCategory=ALL, jdbc

# JDBCAppender writes messages into the database
log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender

#SQL statement to be used (with multiple columns formated)
log4j.appender.jdbc.sql=insert into QIPIP_QUEUE(L)
values ('%m')

# DB Options
log4j.appender.jdbc.URL=jdbc dbc:myDB
log4j.appender.jdbc.user=me
log4j.appender.jdbc.password=password

#set the buffer size
log4j.appender.JDBC.buffersize=1

--------------------------------------------
test.java
import org.apache.log4j.*;
import java.sql.*;
import java.lang.*;
import java.util.*;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.jdbcplus.JDBCAppender;

public class log4jTest
{

static Logger logger = Logger.getLogger(log4jTest.class);//new

public static void main(String[] args)
{
// Ensure to have all necessary drivers installed !
try
{
Driver d = (Driver)(Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
DriverManager.registerDriver(d);
}
catch(Exception e){}


logger.setLevel(Level.DEBUG);

// Configuration with configuration-file
PropertyConfigurator.configure("log4j.properties");

logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");
logger.debug("debug'");

}
}
---------------------------------------


here when i run the FILE. IT SAYS THE POPERTY FILE IS NOT CONFIGURED PROPERLY!!
CAN ANY 1 HELP ME PLEASEEEEEEE
17 years ago
Piyumi ,

Assertions are special features added in java 1.4 onwards
by default assertions will be disabled u will have enable assertion when u compile the java file

assert

The assertion statement has two forms. The first, simpler form is:
assert Expression1 ;
where Expression1 is a boolean expression. When the system runs the assertion, it evaluates Expression1 and if it is false throws an AssertionError with no detail message.
The second form of the assertion statement is:
assert Expression1 : Expression2 ;
where:
�Expression1 is a boolean expression.
�Expression2 is an expression that has a value. (It cannot be an invocation of a method that is declared void.)
Use this version of the assert statement to provide a detail message for the AssertionError. The system passes the value of Expression2 to the appropriate AssertionError constructor, which uses the string representation of the value as the error's detail message.

hope this helps!!
usually this helps a lot while debugging ur code in big projects!!
exactly kiran!!!
thats good explanation!!
Dear Amir

static block in a class will be executed first when the class is loaded

so when normally people use static block to initialize some their variables


so for you to understand better try this program!!!

class teststatic
{
static
{int x=10;
y=100;
}
static int x;
// Initialize a value and check what happens
static int y;

public static void main(String[] args)
{ System.out.println(x); //#5
System.out.println(y); //#6
//teststatic t1= new teststatic(); //#7
//System.out.println(x);
//System.out.println(y);
} }


So in static block if u declare an int x and intialiaze it to 10 nothing wrong is there
but the only thing is that the scope of the varial int x will be only inside the static block!!!

but if u have declared static int y and initialize this y inside the static block , it's scope is through out that class

and for your question there will not be any multiple declaration erros as int x is only inside static block and static int x will be through out the class

hope this might help you
Edisandro!!
u R doing a good JOB man!!!