Shuai Liu

Ranch Hand
+ Follow
since Jan 25, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shuai Liu

Hi all,

I believe that this question has been asked a billion times but I didn't find what I wanted by search the forum. So here it goes again.
I am looking for some real usable JSP tag that provides a web calendar interface, the one that can be viewed in different mode(monthly, weekly, daily) and where user can enter events. Something like the Calendar control in .Net would be nice.
I'd love to know if there's such package availabe before I attemp to hack one my own.

Thank you very much!
16 years ago
I am not sure if using different emulator will help me for the MIDlet doesn't work on my physical phone (Motorola i58sr) itself either?

Yes, I am 99.99% sure the error was caused by the null date. I wrote another simple test MIDlet which has only a DateField, a TextField and a Command. When the command is clicked, I display the return value of getDate() method on the TextField (display "null" if it's null) and I am getting consistent result as I described in my original post: It returns null under generic Nokia emulator and correct result under Treo600 simulator...

I also tried remote debugging on the Motorola phone, but didn't see any other exception that seemed related.

[ July 07, 2004: Message edited by: Shuai Liu ]
16 years ago
Thank you for the reply.

My target device is Motorola i58sr, which is MIDP1.0 compatible.
My IDE is Websphere Device Developer 5.6 and I am using the bundled Nokia phone emulator to do testing.
I get same result from both the emulator and the phone.

I just tried to run it on a Treo600 (Palm OS 5) simulator, and it works w/o any problems! I will be shocked if this is indeed a bug because it's such a simple operation and MIDP1.0 has been released for more than 3 years?

Thanks again.
16 years ago

Originally posted by arvind doraiswamy:
oh...and on hindsight...have you allocated memory for the timeIn object..try explicitly allocating it memory.
java.util.Date timeIn=new java.util.Date();

What difference does that make? And yes, the input string is in correct format.
16 years ago
Hi, I am using a DateField to let user enter a time field. It looks like the getDate() method always return null when the user enters any time prior to the prepopulated date of the DateField object.

In form init method I set the time to be current time

say if current time is 15:00 and user enters in 14:30, getDate() method will return null

and it works fine when user enters a time that is later than 15:00. Why?

Please help. Thank you!
16 years ago
Thank you both!
16 years ago
Kada is a JVM for WinCE. It supports Personal Java, if I remember it correctly.

Kaffe or Blackdown if you use Linux.
16 years ago
Hi all,
Is there anything in MIDP 1.0 that simulates a dropdown box? ChoiceGroup doesn't fit b/c it takes too much space by shows every option.

Thank you!
[ June 15, 2004: Message edited by: Shuai Liu ]
16 years ago

Originally posted by Michael Yuan:
For calling external browser applications, check out this link

Thank you Michael, so I guess the final answer is that invoking browser from a MIDP app is not possible...
16 years ago
Thank you for your suggestion. 2 questions
1. How do I invoke a browser in a MIDP app?
2. I guess if I use command to "simulate" hyperlink, I won't be able to list multiple of those "pseudo-hyperlinks" in my form since only a limited number of them will show up as buttons?
Thnx again.
16 years ago
If it's possible, how can I insert a hyperlink in my form? I want the browser to be invoked when user clicks on the link.
Thank you!
[ April 01, 2004: Message edited by: Shuai Liu ]
16 years ago
Yeah, that makes sense. Just one more thing. When I switch XML Parsers, I don't need to make property or config file changes(I only need to include different jars in my classpath) and Xalan seems to be able to pick it up, how is that implemented?
Thank you.

Originally posted by Richard Jensen:

Are the classes that implement the interface dynamic or fixed? That is, do you know all the possible types when you code the factory class or do you have to allow for an unknown class to be used at runtime? Reflection handles the latter case, but can be a bit tricky.

Yes the classes that implemenat the interface is dynamic. It's the later case and I assume that reflection is necessary.
I was looking at the source code of Xalan, it picks up the implemenation by looking for certain system property. Is that the standard way to do it?
In that case, when I swap my implementation class, I need to update some kind of property like "IEnvorinmentVariableImp" to be "Foo.Bar.SomeClass" so that I can load the class at run time?
John,Ilja and Layne
Sorry I still didn't state the question clearly. So here it goes again:
For an example, in Xalan document, the authors ask the user to "The SAX, DOM, and JAVAX interfaces are in xml-apis.jar. These interfaces are shared by a number of tools (Xalan-Java, Xerces-Java, etc.), so placing them in a separate JAR simplifies coordination and reduces risk of duplication. Be sure to put both JAR files (and xercesImpl.jar or another JAXP 1.2-compliant XML parser) on your classpath!"
Obviously, Xalan utilize SAX and DOM interface in xml-apis.jar and I am responsible for providing an implementation of those XML parsers(Xerces or JAXP). Since Xalan doesn't depend on certain implementation, I could possibly write my own JAXP 1.2-compliant XML parser and use it. Bottom line is, Xalan doesn't know what implementation I am using.
So John: I can't have a string param for my factory method since I don't know what derived class to instantiate. I want the return type changes as I changes the actual implementation I use(again, without changing anything in factory class).
Ilja: I assume that some sort of Factory class will decide about the actual implementation to use. But the factory class shouldn't have that knowledge hard wired. That means, when I decide to use another implemenation, I don't need to change anything in the Factory class. In the case of Xalan, I can replace the parser from Xerces to my own parser and Xalan can pick it up.
Layne: I understand that my question is kinda vague and maybe the pattern to use is not Abstract Factory. What I want to achieve is something like the way Xalan utilize XML parser interface. Let's say Xalan is my user class and it get a XML parser via some sort of factory class. The factory class shall return Xalan the available implemenation of XML parser interface based on certain rules. The rules should be flexible such that the facotry won't know what particular concrete class to call until run time. That way it can return any kind of implemenation without change the code.
Sorry for my English if you guys still don't know what I am talking about.
[ June 17, 2003: Message edited by: Shuai Liu ]
Richard, if I understood you correctly, I will have a factory like this:

and the author can change the concrete class ( EnvironmentVariableImpl1 in this case) being returned to the user.
But my real problem is: in my factory class, I don't know what concrete class to create, so it would look like

so that I don't need to change the getEnvironmentVariable() method in MyEnvironmentVariableFactory class, and it will return the current available implementation of IEnvironmentVariable. I want MyEnvironmentVariableFactory be able to pick up the available implementaion itself at run time.
I assume that one way I can do it is that I specifiy the classname of the implementation in some sort of property file that my Factory class can read and use reflection to create the concrete class on the fly. I am just wondering if there is a simpler/cleaner way.
I hope that I made myself understandable.
Thank you for your time.
[ June 16, 2003: Message edited by: Shuai Liu ]
[ June 16, 2003: Message edited by: Shuai Liu ]