Win a copy of Head First Android this week in the Android forum!

Zheng Huang

Ranch Hand
+ Follow
since Dec 20, 2000
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 Zheng Huang

Hello,

I have a question on Apache Tomcat with SunOS.

I am using Apache Tomcat/4.1.12-LE-jdk14 that was installed on SunOS. I could not find httpd.conf file under $CATALINA_HOME/conf directory. Where else can it be? Will Apache Tomcat work without httpd.conf?

Thanks in advance,
Zheng Huang
17 years ago
Hi Budi and Paul,

I have a question on Apache Tomcat with SunOS.

I am using Apache Tomcat/4.1.12-LE-jdk14 that was installed on SunOS. I could not find httpd.conf file under $CATALINA_HOME/conf directory. Where else can it be? Will Apache Tomcat work without httpd.conf?

Thanks in advance,
Zheng Huang
17 years ago
Thanks, Michael, for the great article.
It sounds like that J2ME does have JDBC optional. It will allow us to use database such as Window Access CE.
Data sync appears to be another issue. Can we use some existing Java technology, for example, Web Services(SOAP)? Most time the data sync will be done in the office. The connection between PDA and server are not that slow.
Any advice would be greatly appreciated.
Thanks,
Zheng Huang
SCPJ2, SCWCD
18 years ago
Thanks, Thomas, for your Amazon link.
From the Editorial Reviews, Daryl's book does address "data storage" which, I believe, is database. I have any question.
If an application is developed on Palm OS and PocketPC, how easily can it be migrated to Window CE?
Thanks,
Zheng Huang
SCPJ2, SCwcd
18 years ago
Welcome, Daryl.
For most business applications, developers want to save the data into a database on the PDA. Does your book show how to use a database with Java on PDA?
Thanks,
Zheng Huang
SCPJ2, SCWCD
18 years ago
I have recently joined a team of developing a mobile service application. The platform is embedded Visual Basic on Windows CE. I asked why we don't use J2ME. The answer is that the most wireless applications on market were done in eVB and J2ME will not be ready for the real application till 2007. What is your opinion on this? Do you know the real application that is using J2ME?
I am a Java developer. I am hoping that I can have enough things to convince the team to change the platform. Any advice would be greatly appreciated.
TIA
Zheng
18 years ago
Hi,
I just passed the exam with 91% this morning. As many people posted here earlier, I used Hanumant's book as well. Thanks to everyone at JavaRanch.
Good Luck,
Zheng
18 years ago

Originally posted by Swanand Barve:

I think that if a user opens multiple browser windows, then these will share a session only if cookies are enabled. If not, url rewriting will be used and each browser will represent a different session.


I don't think that the statement above is right. Anyone can correct me if I am wrong.
Regards,
Zheng
You can not use it as is. You have to sub-class it and override one of the following:
doGet, if the servlet supports HTTP GET requests
doPost, for HTTP POST requests
doPut, for HTTP PUT requests
doDelete, for HTTP DELETE requests
init and destroy, to manage resources that are held for the life of the servlet
getServletInfo, which the servlet uses to provide information about itself
What if it is for the real application? Does anybody give any thought on this?
Hi All,
Yesterday I posted a message with topic "Will it ever be GCed?". Dave Boden gave a perfect answer. Thanks, Dave. I have another question. This is the real reason I posted a message yesterday.
I got the "OutOfMemoryError" on the server while many clients called. Is there any way to programatically check how memory are left?
My server code will create a thread for each clients call. The run() for each thread will do some time-consuming job. The server ends up createing a lot of threads when many clients call. Eventurally JVM for server runs out of memory and the server dies. I understand that "OutOfMemoryError" is unchecked exception. I will not be able to catch it. But how can I prevent the server from dieing like that? I would like the server to tell client this memory problem rather than die itself.
Any help would be greatly appreciated.
TIA
Zheng
Hi All,
The following is a server code. Can any one tell me when the newly created ServeOneJabber is available for GC? Please see line with comment "// When ServerOneJabber is available for GC?". Since it is created in the while(true) loop, it will never get GCed, Am I right?
Thanks!
Zheng
//: c15:MultiJabberServer.java
// A server that uses multithreading
// to handle any number of clients.
import java.io.*;
import java.net.*;
class ServeOneJabber extends Thread {
private Socket socket;
private BufferedReader in;
private PrintWriter out;
public ServeOneJabber(Socket s)
throws IOException {
socket = s;
in =
new BufferedReader(
new InputStreamReader(
socket.getInputStream()));
// Enable auto-flush:
out =
new PrintWriter(
new BufferedWriter(
new OutputStreamWriter(
socket.getOutputStream())), true);
// If any of the above calls throw an
// exception, the caller is responsible for
// closing the socket. Otherwise the thread
// will close it.
start(); // Calls run()
}
public void run() {
try {
while (true) {
String str = in.readLine();
if (str.equals("END")) break;
System.out.println("Echoing: " + str);
out.println(str);
}
System.out.println("closing...");
} catch(IOException e) {
System.err.println("IO Exception");
} finally {
try {
socket.close();
} catch(IOException e) {
System.err.println("Socket not closed");
}
}
}
}
public class MultiJabberServer {
static final int PORT = 8080;
public static void main(String[] args)
throws IOException {
ServerSocket s = new ServerSocket(PORT);
System.out.println("Server Started");
try {
while(true) {
// Blocks until a connection occurs:
Socket socket = s.accept();
try {
new ServeOneJabber(socket); // When ServerOneJabber is available for GC?
} catch(IOException e) {
// If it fails, close the socket,
// otherwise the thread will close it:
socket.close();
}
}
} finally {
s.close();
}
}
} ///:~
Judy,
Congratulations to you too!
Zheng
20 years ago
Hi All,
I passed scjp exam last Saturday with 79%. I am pretty happy with my score since I have a limited time to prepare for it. I have a family with two young kids and a very heavy workload at work.
I have only gone through 1/4 of Maha' mock exams. It may be the reason that I got 79%. If you want to get higher score, you may consider to take all Maha's mock exams.
Many thanks to everybody in java ranch for their tips, questions, answers and mock exams.
20 years ago
d is incorrect. e is correct. Am I right?