This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!

nikki lorenzo

Greenhorn
+ Follow
since Jan 12, 2004
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 nikki lorenzo

Hi! Would there be any difference if I put the Connection reference in the class scope but new connection is retrieved for every method versus having it inside the method scope? Assuming, we are using Connection Pooling? Thanks.

1) Connection in class scope
public class MyDAO{
private Connection conn = null;

public void openDAO() {
if (this.conn == null) {
this.conn = WebConnectionFactory.getConnection();
}
}

public void myMethod(){
openDAO();
conn.prepareStatment("Select * from table");
//get resultSet
closeDAO();
}

public void mySecondMethod(){
openDAO();
conn.prepareStatment("Select * from table");
//get resultSet
closeDAO();
}
public void closeDAO(){
conn.close();
}
}

2) Connection in method scope
public class MyOtherDAO{
public myOtherMethod(){
Connection conn = WebConnectionFactory.getConnection();
conn.prepareStatment("Select * from table");
//get resultSet
conn.close()
}

public mySecondMethod(){
Connection conn = WebConnectionFactory.getConnection();
conn.prepareStatment("Select * from table");
//get resultSet
conn.close()
}
}
Hi,

We're runnning into timezone problems when during our application testing locally. We are using jdk 1.3.1 which has the old timezone rules. We would like to updated locally installed jres (i.e. localhost) by using the TZUpdater tool. But I'm running into UnsupportedClassVersionError(below).

What i did was to extract the tzupdater.jar on \eclipse\jre\bin and run the command: java -jar tzupdater.jar -u -f -v
What did i do wrong? Please help. Thanks.

Error:
C:\Program Files\IBMWebSphere Studio\Application Developer\v5.1.1\eclipse\jre\bin>java -jar tzupdater.jar -u -f -v
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/sun/tools
/tzupdater/TimezoneUpdater (Unsupported major.minor version 48.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:703)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:13
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:320)
at java.net.URLClassLoader.access$400(URLClassLoader.java:93)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:239)
at java.lang.ClassLoader.loadClass(ClassLoader.java:516)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:460)
at java.lang.ClassLoader.loadClass(ClassLoader.java:448)
14 years ago
Thanks Peter and Jesper for your input. Now it's clear to me that there's no other way besides client polling to display real-time data for web-based applications.
14 years ago
Hi,

I am faced with a design issue. I am supposed to display real-time data to the users of the application we're building. The data is coming from an MQ server.

I want to avoid polling the data source (i.e. running a thread say every 5secs to check for new data). Thus, we decide to consume the messages subscribers using Message Driven Bean(MDB) as it has a callback method onMessage() that can be invoked by the publisher when a new message is on queue. Inside this callback method, we update the database/session.

But how can we implement pushing of data towards the client-side? I can't think of any approach besides a timed AJAX script checking on the database/session for new records every 5secs. Any suggestions?

Thanks.
14 years ago
Thanks for the info. But we are only on the funding and requirement stage of our project where we have to estimate whether we'll need a separate physical server for the application we are about to build.

Can you please at least give me an idea of how much memory would it take to consume a 3,200-character message from an MQ series feed under normal conditions? A rough estimate would do.
14 years ago
Hi,

I need your help.

I am trying to determine how much memory (RAM) with an application be consuming given it has 100 concurrent with a job reading off 1,000 messages per day from an MQ series aside from the regular CRUD functions.

Any idea?

Thanks.
14 years ago
Hi All,

I was hoping I could get help from here.

Currently, we are developing a reporting web application in Java. But the client has plans of later porting the web app in PDA devices, perhaps in Blackberry's. Do you guys know of any emulators where we can test the pages we're developing for IE browsers and see if it looks ok as well in PDAs?

Thanks in advance for your help.
14 years ago
Thanks. But that doesn't work either. Also, what i need is the location of the file and not the file itself. Thus, the use of ClassLoader.getSystemResource which returns a URL.
15 years ago
Hi All,

I've this A.jar inside WEB-INF/lib who needs to locate some class in B.jar (also in WEB-INF/lib) using ClassLoader.getSystemResource("com/sample/ClassB.class"). Problem is, this always returns null. How do i get this working?

Help needed desperately. Thanks & Regards.
15 years ago
Right. Thanks Ernest. Almost forgot that one.

In relation to that, suppose i have 2 jars in WEB-INF/lib. A.jar containing MyClass.class and B.jar containing containing A.jar/MyClass.class. Which version gets loaded this time?
15 years ago
Question: If i have a class, com.sample.A.class located in WEB-INF/lib/B.jar and a similar class in com/sample/ which gets picked up by the class loader?

Will appreciate ur help on this. Thanks.
15 years ago
thanks corey, but i still don't get it...


That means that the variable of type A can reference an object that implements E.


though i agree with your statement above if i interpret it this way:

but what i'm really confused at is this code:

does this work 'coz the object type of reference a is actually a D, and D Is-A E?
if so, should i change my style of looking ONLY at the reference types when spotting for a possible compile-time errors related to casting? 'coz when i look merely at the reference types without regard to the actual object, a of type A then it will seem wrong as A Is-Not-A E.
thanks.
[ March 29, 2004: Message edited by: nikki lorenzo ]
Hi. Can anyone please explain to me why code in line4 compiles fine:

I've always thought that the rules for casting are these:
Compile-time: must be within same hierarchy, otherwise, compile-error
Runtime : casting an object down the hierarchy causes ClassCastException.
If so, why does line 4 work? Class A and Interface E are not in the same hierarchy, right? I feel as though there are many areas in Reference Casting that are gray to me... Can somebody please make my understanding of it crystal clear? Thanks.
[ March 28, 2004: Message edited by: nikki lorenzo ]
thanks thomas, corey. i'll remember that on the exam.
hi everyone. i came across a question in the javaranch rules roundup games which confused me.


true or false. An anonymous class can't have a constructor.
Answer: true
A constructor has the same name as the class. If the class is anonymous (has no name), how could you name the constructor.


i thought all classes have constructors, until this question alarmed me. i looked up the JLS and this is what i got:


An anonymous class cannot have an explicitly declared constructor. Instead, the compiler must automatically provide an anonymous constructor for the anonymous class.


So, an anonymous class CAN have a constructor after all. Does this mean the answer in the rules-round up mock is wrong? Or have i just misinterpreted the mock question entirely? If i came across the same question in the REAL scjp exam, what should i answer? Would there be any difference if the question could've been "An anonymous class has a constructor"?

[ March 24, 2004: Message edited by: nikki lorenzo ]
[ March 24, 2004: Message edited by: nikki lorenzo ]