| System.currentTimeMillis not returning GMT/UTC (J2me) |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- problem w/conditional...
I'm learning java.. following an assignment given to me by a programmer
at work I put together a little app that:
when you first run it it types a string, then prompts user to type part
of the string, and app returns sgmt of string user typed surrounded by
two chars before and after sgmt user typed..
I put a few lines in there to deal with when user types first two chars
of string, but what happens is not what I specify... pls see code here..
www.francesdelrio.com/java/string.html
lines in question near bottom of code..
(signaled with " //*************...") thank you..
Frances
- 1
- differense of look between 1.4.2 and 1.4.1Hello,
when compiling and running with jdk 1.4.2 (or higher) the look is totally
different then when i use 1.4.1 fe mouse over on buttons seems different,
the look of the radiobuttons is different , how can i solve this
fe how i call a button
trashbutton.setIcon(new ImageIcon(images.getString("TRASH20")));
trashbutton.setPressedIcon(new
ImageIcon(images.getString("TRASH20_IN")));
trashbutton.setRolloverIcon(new
ImageIcon(images.getString("TRASH20_OUT")));
trashbutton.setDisabledIcon(new
ImageIcon(images.getString("TRASH20_DIS")));
trashbutton.setToolTipText(recources.getString("REMOVE_NODE"));
trashbutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
EditRemoveMenuItem_actionPerformed(e);
}
});
trashbutton.setFocusPainted(false);
trashbutton.setBorderPainted(false);
trashbutton.setMaximumSize(new Dimension(40, 40));
trashbutton.setMinimumSize(new Dimension(40, 40));
trashbuttons.etPreferredSize(new Dimension(40, 40));
trashbutton.setBackground(new Color(15, 40, 70));
trashbutton.setForeground(new Color(15, 40, 70));
it seems when i go with the mouse over the buttons in jdk 1.4.2 the
backgroundcolor disapears and i need to set for mouseover also a color
or are there other parameters to set
there are also border that appears around the buttons on jdk 1.4.2 and not
on lower versions
can i find any solutions about this on the net?
thanks Sven
- 3
- java kerberos with DCE KDCHi all,
Before I go trying to reinvent the wheel, I figured I would ask the
experts. Has anyone had the Java kerberos client successfully
interoperate with a DCE KDC? On the surface, it looks as though it
should work. I coded up a quick test, and found that Java is using the
host field differently than DCE would like, although the rest of the
data looked OK.
Thanks in advance for any help or information on interoperability you
can provide.
Regards,
Neal
--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
- Neal A. Dillman * email***@***.com -
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
- My opinions are. -
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
- 4
- ejbcreate and ConstructorHi,
I am just learning EJB. Sorry if I am asking a stupid question.
It is required that a session bean should have a public no-argument
constructor. However, the initialization is usually done inside the
ejbcreate() method.
Could I put the initialization code in the constructor instead of
ejbcreate()?
TIA.
SF
- 5
- OPIE or SKEY authentication on web applicationHello,
I am looking for a free and opensource component to do an OTP
authentication on a web application running on Linux/Apache/Tomcat.
JAVA API would be nice but any information is welcome.
Pierre
- 5
- why wont this workwhat is wrong with my code to make it throw this IOException?
import java.io.*;
public class mainClass {
public static void main(String[] args) {
PrintStream MyOutput = null;
try {
//dies here:
MyOutput = new PrintStream(new FileOutputStream("ftp://
****username****:*****password*****@ftp.*****host****.com/web/
whatever.com/hi.dat"));
} catch (IOException e) {
System.out.println("crap");
}
MyOutput.println("hi");
MyOutput.close();
}
}
- 8
- I AM FUCKING SICK OF ROEDY GREENStephen Kellett wrote:
> If you are going to insult people, please learn to spell.
As usual, you have to point out minor errors because you have nothing to
say regarding the actual content of my posts. so what, a mispelling,
you knew what I meant. what purpose does spelling have beyond that? what
is this, a spelling bee you dork.
> Indeed. If you have a point to make, make it politely.
no, say please. dont tell others what to do.
In most
> societies, online and offline, opinions of rude people don't count.
Oh, ok dork. but if dont you have a point to make regarding the actual
content of my posts rather than being a star trek geek, then shut your ahole
- 9
- Questions about using Java 3DHi everyone (newbie here),
I'd like to develop my skills to become a professional java developer.
I was wondering about your opinion regarding the Java 3d API. Is it
popular?
>From my google searches it looks like Java3d is most popular in the
mobile
device realm. Everywhere else it appears quiet. So for instance I
wanted to
build a 3d applet for my website (to build my portfolio). Do you think
this is
wise? Or are there better alternatives?
Thanks for any advise,
Dennis.
- 9
- java doc start!?Hi
I hear about Java document.. jar files etc. I want to learn these subjects..
what do you think would be a good start.. I want to start with something so
basic and simple so I can understand what is going on, then go to sun
tutorial or any other advanced tutorials. Thanks.
- 10
- EJBs vs. Servlets ?!Hello,
When someone should be using EJBs and when servlets ?
Are servlets just the Sun's lost children ?! They were just an
intermediate step before EJBs came out ?
The only reason I see to use servlets instead of EJBs is if do not
have an application server (like JBOSS).
Are there any other reasons ? (like performance, development time &
effort etc)
Regards,
Razvan
- 13
- How this is possible?if (mySocket != null){ logger.log(Level.FINEST,"Connection
Status" + mySocket.isClosed() + mySocket.isConnected()); }
When I see the log isClosed() and isConnected() are both returning
true??? Anybody has an explanation for this?
- 13
- Alternative for deprecated method JFrame.show()I'm messing around with Java Swing. I'm also messing around with
Eclipse instead of a plain text editor such as TextPad.
When I create the following two classes in Eclipse, I get a persistent
warning that
The method show() from the type Window is deprecated
But I've checked the API docs (hence my looking for the 1.5.0 docs) and
it does NOT indicate that show() is deprecated. Any words of
guidance/advice?
Thanks
import javax.swing.*;
public class LoanCalculatorApp
{
public static void main(String[] args)
{
JFrame frame = new LoanCalculatorFrame();
frame.show();
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.*;
public class LoanCalculatorFrame extends JFrame
{
public LoanCalculatorFrame()
{
setTitle("Loan Calculator");
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
System.out.println("Screen:" + d.width + " by " + d.height + "
pixels");
int height = 200;
int width = 267;
setBounds((d.width-width)/2, (d.height-height)/2, width, height);
setResizable(false);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
Container contentPane = getContentPane();
JPanel panel = new JPanel();
contentPane.add(panel);
}
}
- 13
- Layout ManagersRoedy Green coughed up:
> On Fri, 28 Oct 2005 01:58:18 GMT, "Thomas G. Marshall"
> <email***@***.com> wrote, quoted
> or indirectly quoted someone who said :
>
>> No, I think you mean "integer multiples" here. Pixels, for example,
>> could
>> easily be drawn 3:1. But it's still the wrong solution.
>
> Yes. That applies to shrinking too which is even more problematic.
...[rip yada...]...
I was part of a postscript clone manufacturer. I am intimate with all
details regarding it's developement and design, particularly AA and pixel
alignment ramifications.
The only thing I can imagine is (believe it or not) that a general purpose
PDL such as postscript is beyond the abilities of most to implement. This
is true to a large extent---take a look at how many postscript clones that
would work and then gack on particular pages. Or not work at all. There
were a great many joke interpreters. I haven't checked in a while, but
gnu's ghostscript was certainly one of them for many years.
--
http://www.allexperts.com is a nifty way to get an answer to just about
/anything/.
- 16
- Happy Xmas!Hope everybody who celebrates has a wonderful holiday, and that all have a
good vacation day! :)
--
Darryl L. Pierce <email***@***.com>
Visit the Infobahn Offramp - <http://mypage.org/mcpierce>
"What do you care what other people think, Mr. Feynman?"
- 16
- Eclipse : edit code using drag & drop ?Patrick, Isn't eclipse cool?! A little more context from your
question, that is, from what perspective? Developing applets? JSP
pages? M7 develops NitroX for JSP and Struts which provides an
integrated synchronized source and visual editor. www.m7.com.
email***@***.com wrote in message news:<email***@***.com>...
> After a few months of working with Eclipse, I'm almost 100%
> happy with it, but the one feature i'm (still) missing is the ability
> to edit source-code using drag & drop ...
>
> Does anyone know if there's some way (maybe a plugin) to make
> this possible ? (I've already googled on it, to no avail).
|
| Author |
Message |
reply2nelson

|
Posted: 2004-5-14 3:02:00 |
Top |
java-programmer, System.currentTimeMillis not returning GMT/UTC (J2me)
I've got an application that I built for the Motorola i730
MIDP2.0 platform. System.currentTimeMillis() always seems
to return me -as stated- in GMT/UTC. I ported the application
to run against the i88s phone MIDP1.0 and the same method
is returning me the time in the Local Time.
Is this a know issue, or am I going about this the wrong
way? It would be so bad getting the local time, but it appears
that TimeZone.getDefault().getID() is returning GMT !
Any ideas?
Thanks.
|
| |
|
| |
 |
P.Hill

|
Posted: 2004-5-14 5:46:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Nelson wrote:
> I've got an application that I built for the Motorola i730
> MIDP2.0 platform. System.currentTimeMillis() always seems
> to return me -as stated- in GMT/UTC. I ported the application
> to run against the i88s phone MIDP1.0 and the same method
> is returning me the time in the Local Time.
So how do you know that the currentTimeMillis is local time?
I don't know about you, but I wouldn't recognize milliseconds since 1970
if it bit me, so I'm guess you are doing something with it and
that processing is picking up a TZ from somewhere.
Are you using a SimpleDateFormat object to create a formatted data/time?
Could you show us example code.
-Paul
|
| |
|
| |
 |
Reply7471859353

|
Posted: 2004-5-14 10:26:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
email***@***.com (Nelson) wrote in message news:<email***@***.com>...
> I've got an application that I built for the Motorola i730
> MIDP2.0 platform. System.currentTimeMillis() always seems
> to return me -as stated- in GMT/UTC. I ported the application
> to run against the i88s phone MIDP1.0 and the same method
> is returning me the time in the Local Time.
> Is this a know issue, or am I going about this the wrong
> way? It would be so bad getting the local time, but it appears
> that TimeZone.getDefault().getID() is returning GMT !
> Any ideas?
> Thanks.
Maybe the simplest solution is, appove an adjustment of the
application or system model to fit an additional machineTypeId
configuration parameter,
preform an application boot check,
maw
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-5-15 0:43:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Nelson wrote:
> I've got an application that I built for the Motorola i730
> MIDP2.0 platform. System.currentTimeMillis() always seems
> to return me -as stated- in GMT/UTC. I ported the application
> to run against the i88s phone MIDP1.0 and the same method
> is returning me the time in the Local Time.
> Is this a know issue, or am I going about this the wrong
> way? It would be so bad getting the local time, but it appears
> that TimeZone.getDefault().getID() is returning GMT !
Sounds like the device thinks it's in GMT. Since the device doesn't
know its time zone, it would then be absolutely impossible to get that
information from anywhere else, unless you're connected to some remote
device that might know.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-5-15 19:53:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
P.Hill wrote:
>> I've got an application that I built for the Motorola i730
>> MIDP2.0 platform. System.currentTimeMillis() always seems
>> to return me -as stated- in GMT/UTC. I ported the application
>> to run against the i88s phone MIDP1.0 and the same method
>> is returning me the time in the Local Time.
>
> So how do you know that the currentTimeMillis is local time?
> I don't know about you, but I wouldn't recognize milliseconds since 1970
> if it bit me, so I'm guess you are doing something with it and
> that processing is picking up a TZ from somewhere.
> Are you using a SimpleDateFormat object to create a formatted data/time?
> Could you show us example code.
The MIDP doesn't have SimpleDateFormat.
--
/**
* @author Darryl L. Pierce <email***@***.com>
* @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
perl
*/
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-5-15 19:53:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Nelson wrote:
> I've got an application that I built for the Motorola i730
> MIDP2.0 platform. System.currentTimeMillis() always seems
> to return me -as stated- in GMT/UTC. I ported the application
> to run against the i88s phone MIDP1.0 and the same method
> is returning me the time in the Local Time.
> Is this a know issue, or am I going about this the wrong
> way? It would be so bad getting the local time, but it appears
> that TimeZone.getDefault().getID() is returning GMT !
If the device isn't aware of its timezone, then there's no way for you to
determine from within the device that same information. Have you checked to
make sure that you i730's operating system is configured with the right
timezone? What is the difference between what your MIDlet thinks the time
is and what the phone states the time is from the main screen?
Also, have you checked what the java.util.Date class claims the local
date/time is when you create an instance using new Date()? Forget what
System.currentTimeMillis() returns if you can get the proper information
from Date.
--
/**
* @author Darryl L. Pierce <email***@***.com>
* @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
perl
*/
|
| |
|
| |
 |
P.Hill

|
Posted: 2004-5-16 7:11:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Darryl L. Pierce wrote:
> The MIDP doesn't have SimpleDateFormat.
Hm, curious. That begs the questions of how the OP knew
what the time was that he had. I assume there is some
similar class.
-Paul
|
| |
|
| |
 |
P.Hill

|
Posted: 2004-5-16 7:14:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Darryl L. Pierce wrote:
> Also, have you checked what the java.util.Date class claims the local
> date/time is when you create an instance using new Date()? Forget what
> System.currentTimeMillis() returns if you can get the proper information
> from Date.
The value of the two are exactly the same on a full size JDK. The Date
constructor gets its time from currentTimeMillis.
-Paul
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-5-17 20:40:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
P.Hill wrote:
> Darryl L. Pierce wrote:
>> The MIDP doesn't have SimpleDateFormat.
>
> Hm, curious. That begs the questions of how the OP knew
> what the time was that he had. I assume there is some
> similar class.
You have java.util.Date available, with the default constructor creating a
Date object with the current date/time.
--
/**
* @author Darryl L. Pierce <email***@***.com>
* @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
perl
*/
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-5-17 20:40:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
P.Hill wrote:
>> Also, have you checked what the java.util.Date class claims the local
>> date/time is when you create an instance using new Date()? Forget what
>> System.currentTimeMillis() returns if you can get the proper information
>> from Date.
>
> The value of the two are exactly the same on a full size JDK. The Date
> constructor gets its time from currentTimeMillis.
The Javadoc for System.currentTimeMillis() states that it returns
"the specified number of milliseconds since the standard base time
known as 'the epoch', namely January 1, 1970, 00:00:00 GMT." One should
not be expecting System.currentTimeMillis() to return the _local_ time.
The Date constructor takes the current time from System.currentTimeMillis()
and then uses your timezone to convert that value to the local time.
So, it's inaccurate to claim that System.currentTimeMillis() and Date
return the same value unless your locale *is* GMT.
--
/**
* @author Darryl L. Pierce <email***@***.com>
* @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
perl
*/
|
| |
|
| |
 |
P.Hill

|
Posted: 2004-5-18 0:27:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Darryl L. Pierce wrote:
> The Javadoc for System.currentTimeMillis() states that it returns
> "the specified number of milliseconds since the standard base time
> known as 'the epoch', namely January 1, 1970, 00:00:00 GMT." One should
> not be expecting System.currentTimeMillis() to return the _local_ time.
> The Date constructor takes the current time from System.currentTimeMillis()
> and then uses your timezone to convert that value to the local time.
> So, it's inaccurate to claim that System.currentTimeMillis() and Date
> return the same value unless your locale *is* GMT.
Say what?
" Although the Date class is intended to reflect coordinated universal time
(UTC), ..."
Notice also that all constructors but
public Date(long date) are deprecated. Why? Exactly for the reason the
OP was having trouble. There would have to be an implicit TZ lookup and
calculation happening.
Check the source. You'll find that internally a Date is represented as
a GMT/UTC millisecond value.
In fact here is the source for the no arg c'tor:
public Date() {
this(System.currentTimeMillis());
}
Darryl L. Pierce wrote:
> P.Hill wrote:
>> That begs the questions of how the OP knew
>>what the time was that he had.
>
> You have java.util.Date available, with the default constructor creating a
> Date object with the current date/time.
You are still missing my point. A java.util.Date contains a large binary
number, something else formats it into a String; that includes doing the
most simple:
Date a = new Date()
System.out.println( a.toString() );
So if the OP used that or anything else to get a string, I wonder what TZ
his method of choice used on J2ME to convert from the internal binary
representation to the a readable string. It is in this conversion that the
problem lies.
Consider also the code for comparing two date (and time) objects; if a
Date object was TZ dependant, a simple equals() or compare() would have to
normalize to compare, this is not what you want for simple date comparisons.
I hope that helps to clarify that in a Date() object these is a GMT value
based on binary GMT time value and that the TZ comes in when making a String not
when pushing around binary Date values.
-Paul
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-5-18 19:17:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
P.Hill wrote:
> Darryl L. Pierce wrote:
>> The Javadoc for System.currentTimeMillis() states that it returns
>> "the specified number of milliseconds since the standard base time
>> known as 'the epoch', namely January 1, 1970, 00:00:00 GMT." One should
>> not be expecting System.currentTimeMillis() to return the _local_ time.
>> The Date constructor takes the current time from
>> System.currentTimeMillis() and then uses your timezone to convert that
>> value to the local time. So, it's inaccurate to claim that
>> System.currentTimeMillis() and Date return the same value unless your
>> locale *is* GMT.
>
> Say what?
I said that System.currentTimeMillis() is *not* returning *local* time, and
you can only say it *does* if your current locale is *GMT*. I also said
that the Date constructor takes the value returned by
System.currentTimeMillis() but does not return *that* as the local date
either, but instead uses other information to convert that value into the
local time when the local time is requested.
> " Although the Date class is intended to reflect coordinated universal
> time (UTC), ..."
>
> Notice also that all constructors but
> public Date(long date) are deprecated. Why? Exactly for the reason the
> OP was having trouble. There would have to be an implicit TZ lookup and
> calculation happening.
So they do the conversion internally. Where did I say otherwise? I said
before that Date "uses your timezone to convert [the value from
System.currentTimeMillis()] to the local time". Why are you on about the
deprecated constructors?
> Check the source. You'll find that internally a Date is represented as
> a GMT/UTC millisecond value.
Yeah, so? When did I say otherwise? I said that the value *RETURNED* by Date
was the local time. I never said it didn't hold the date internally as the
local date/time.
> In fact here is the source for the no arg c'tor:
>
> public Date() {
> this(System.currentTimeMillis());
> }
So? I never said it didn't use the value, and *did* say explicitly that Date
*does* get its value from System.currentTimeMillis(). What's your point in
arguing with me?
<snip>
> I hope that helps to clarify that in a Date() object these is a GMT value
> based on binary GMT time value and that the TZ comes in when making a
> String not when pushing around binary Date values.
You clarify something that wasn't in question. Nobody said that Date held
the local date/time...
--
/**
* @author Darryl L. Pierce <email***@***.com>
* @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
perl
*/
|
| |
|
| |
 |
P.Hill

|
Posted: 2004-5-18 23:19:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Darryl L. Pierce wrote:
> I said that System.currentTimeMillis() is *not* returning *local* time, and
> you can only say it *does* if your current locale is *GMT*.
Sorry, we are in agreement here. currentTimeMillis() returns GMT.
I was not in any way trying to suggest, and don't see where I suggested,
that currentTimeMillis() is possibly a local time at any place in this
thread. If I did claim the currentTimeMillis() *might* return a local
time then I'd have to make a statement about conversion to the
internal format or claim that internally the value could be either
local or GMT. Reading my post I think you'll agree I was assuming
Date kept one consistent representation -- "GMT".
> I also said
> that the Date constructor takes the value returned by
> System.currentTimeMillis() but does not return *that* as the local date
> either, but instead uses other information to convert that value into the
> local time when the local time is requested.
But this is where the confusion starts. Constructors don't return anything.
And in the case of java.util.Date() the constructor doesn't do any conversion.
The result of a constructor is an object which interally has a GMT value.
When the time is requested, there IS NO CONVERSION unless a readable
string representation is requested then, and only then, is there a conversion.
> So they do the conversion internally. Where did I say otherwise?
With your use of the word constructor in both your last message and
in your penultimate message you suggest that on its way IN the value
might be converted in some way.
> I said
> before that Date "uses your timezone to convert [the value from
> System.currentTimeMillis()] to the local time".
Only the toString() method through the use of a SimpleDateFormat
does any TZ aware conversion. Now in the ME edition it uses a slight
different approach, but it still converts in the toString() method.
> Why are you on about the
> deprecated constructors?
I thought it would help to illustrate that Date does NOT store
a timezone aware value. Apparently this was not a useful example.
But to use them again as an example, if there is any conversion in the
constructor as you stated, it would be in those deprecated ones.
[ ... Date stores GMT millisecond value ... ]
> Yeah, so? When did I say otherwise? I said that the value *RETURNED* by Date
> was the local time.
This is an imprecise statement. There are two methods that
are not deprecated which return values and are not for comparison: getTime() and
toString(). Do a myDate.getTime() and you get GMT milliseconds.
Do a toString() and you get a string that is converted to the default
TZ (not necessarily the local timezone), so 50% of the time you
get a local time and 50% of the time you get GMT.
> I never said it didn't hold the date internally as the
> local date/time.
Which I guess means you would say it does hold it in local time.
If you did state that internally it is local time
you'd be making an incorrect statement. It is better to speak
about what the class does internally, instead of talking about
what the constructor does or what a particular method does.
Internally the value in a Date object is GMT. Which is what
I was trying to say.
> I never said it didn't use the value, and *did* say explicitly that Date
> *does* get its value from System.currentTimeMillis(). What's your point in
> arguing with me?
To point out a few mis-statements. I hope I have succeeded.
> You clarify something that wasn't in question. Nobody said that Date held
> the local date/time...
You just did above and in previous messages when you refered to constructors
converting and I believe in your megation of what you claim you
did say a few paragraphs above.
Just to summarize, I'll contain to try to point out that:
1. System.currentTimeMillis() always (to the abliity of the OS and hardware)
returns a millisecond value since 1/1/1970 0:0:0 GMT.
2. java.util.Date internally always uses GMT.
3. java.util.Date.toString() uses the default TZ to create a localized string.
4. java.util.Date.getTime() returns a GMT value as stated in the documentation.
I hope everyone is on the same page now.
But what of the original OP. Did he figure out his TZ problem? See other
post in this thread.
-Paul
|
| |
|
| |
 |
P.Hill

|
Posted: 2004-5-18 23:39:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Chris Smith wrote:
> Sounds like the device thinks it's in GMT. Since the device doesn't
> know its time zone, it would then be absolutely impossible to get that
> information from anywhere else, unless you're connected to some remote
> device that might know.
>
To get back to the problem of local time, apparently there is
NO locale by default in a J2ME.
http://java.sun.com/j2me/docs/wtk2.1/user_html/Ap_LanguageSupport.html#wp22327
Unlike in the SE, Date.toString() in CLDC goes off to call special classes.
public String toString() {
return com.sun.cldc.util.j2me.CalendarImpl.toString(calendar);
}
which ends up using
com.sun.cldc.util.j2me.TimeZone
which says:
"By default, the only supported
time zone is UTC/GMT. Vendor-specific implementations
may provide additional time zones."
Of course, if the device's TZ is not set correctly then you can get confusing
things where a machines apparent local time is attempted to be converted
to GMT, but other problems are possible.
-Paul
-Paul
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-5-19 9:40:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
P.Hill wrote:
>> I said that System.currentTimeMillis() is *not* returning *local* time,
>> and you can only say it *does* if your current locale is *GMT*.
>
> Sorry, we are in agreement here. currentTimeMillis() returns GMT.
> I was not in any way trying to suggest, and don't see where I suggested,
> that currentTimeMillis() is possibly a local time at any place in this
> thread. If I did claim the currentTimeMillis() *might* return a local
> time then I'd have to make a statement about conversion to the
> internal format or claim that internally the value could be either
> local or GMT. Reading my post I think you'll agree I was assuming
> Date kept one consistent representation -- "GMT".
You said earlier "The value of [Date and currentTimeMillis()] are exactly
the same on a full size JDK.牋The燚ate constructor gets its time from
currentTimeMillis." This lead me to believe you were saying that both
currentTimeMillis() and the date representation were the same. If you were
talking about the internal representation of the date within the Date class
then your statement is either vague or misleading.
>> I also said
>> that the Date constructor takes the value returned by
>> System.currentTimeMillis() but does not return *that* as the local date
>> either, but instead uses other information to convert that value into the
>> local time when the local time is requested.
>
> But this is where the confusion starts. Constructors don't return
> anything.
And the confusion then is that I never said nor implied that they did.
> And in the case of java.util.Date() the constructor doesn't do
> any conversion. The result of a constructor is an object which interally
> has a GMT value. When the time is requested, there IS NO CONVERSION unless
> a readable string representation is requested then, and only then, is
> there a conversion.
That's what I was talking about. You put in one thing (a long value
representing the date in a singular way) and you get out of the black box
called Date a String that is your local date/time.
>> So they do the conversion internally. Where did I say otherwise?
>
> With your use of the word constructor in both your last message and
> in your penultimate message you suggest that on its way IN the value
> might be converted in some way.
The value is converted. But, the problem here is that you seem to think that
"conversion" means "changed". Perhaps a better term would be "translated"?
>> I said
>> before that Date "uses your timezone to convert [the value from
>> System.currentTimeMillis()] to the local time".
>
> Only the toString() method through the use of a SimpleDateFormat
> does any TZ aware conversion. Now in the ME edition it uses a slight
> different approach, but it still converts in the toString() method.
Translates. It seems we're in violent agreement on this topic. ;)
>> Why are you on about the
>> deprecated constructors?
>
> I thought it would help to illustrate that Date does NOT store
> a timezone aware value. Apparently this was not a useful example.
> But to use them again as an example, if there is any conversion in the
> constructor as you stated,
I never stated that. The conversion/translation is in the *class*, with the
constructor collecting the value in this case.
> it would be in those deprecated ones.
That constructor is not deprecated in the MIDP.
> [ ... Date stores GMT millisecond value ... ]
>> Yeah, so? When did I say otherwise? I said that the value *RETURNED* by
>> Date was the local time.
>
> This is an imprecise statement.
It seems there's quite a bit of imprecision here. I was talking about the
toString() method. Yes, there are methods that will return the internal
representation of the date as you pointed out, but they're not the one
being discussed here.
> There are two methods that
> are not deprecated which return values and are not for comparison:
> getTime() and toString(). Do a myDate.getTime() and you get GMT
> milliseconds. Do a toString() and you get a string that is converted to
> the default TZ (not necessarily the local timezone), so 50% of the time
> you get a local time and 50% of the time you get GMT.
>
>> I never said it didn't hold the date internally as the
>> local date/time.
>
> Which I guess means you would say it does hold it in local time.
No. I'm saying that I *didn't* say anything about how the date is stored
internally. Try not to put words into my mouth.
> If you did state that internally it is local time
> you'd be making an incorrect statement. It is better to speak
> about what the class does internally, instead of talking about
> what the constructor does or what a particular method does.
> Internally the value in a Date object is GMT. Which is what
> I was trying to say.
I would say it's better to talk about what the public contract of the class
does and not about what happens internally, since such is subject to
potentially change.
>> I never said it didn't use the value, and *did* say explicitly that Date
>> *does* get its value from System.currentTimeMillis(). What's your point
>> in arguing with me?
>
> To point out a few mis-statements. I hope I have succeeded.
I think you've succeeded in pointing out some miscommunciations. You've
assumed more than I've stated.
>> You clarify something that wasn't in question. Nobody said that Date held
>> the local date/time...
>
> You just did above and in previous messages when you refered to
> constructors converting and I believe in your megation of what you claim
> you did say a few paragraphs above.
I said *nothing* about *what* is stored within the class. I said that it
(the default constructor for Date) *gets* the current timestamp *from*
System.currentTimeMillis() and also that the class *returns* a value that
is the local version of that value. I said nothing about what is stored
internally to the class; you're assuming that part.
> Just to summarize, I'll contain to try to point out that:
>
> 1. System.currentTimeMillis() always (to the abliity of the OS and
> hardware) returns a millisecond value since 1/1/1970 0:0:0 GMT.
I said this.
> 2. java.util.Date internally always uses GMT.
I said nothing about how Date stores the value, though it's safe to assume
this is probably the best practice.
> 3. java.util.Date.toString() uses the default TZ to create a localized
> string.
No problem here.
> 4. java.util.Date.getTime() returns a GMT value as stated in the
> documentation.
This only came up in this message from you.
> I hope everyone is on the same page now.
Yeah, but we've forgotten the point. :)
> But what of the original OP. Did he figure out his TZ problem?
That's been lost to antiquity...
--
/**
* @author Darryl L. Pierce <email***@***.com>
* @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
perl
*/
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-5-19 9:40:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
P.Hill wrote:
> To get back to the problem of local time, apparently there is
> NO locale by default in a J2ME.
>
http://java.sun.com/j2me/docs/wtk2.1/user_html/Ap_LanguageSupport.html#wp22327
>
> Unlike in the SE, Date.toString() in CLDC goes off to call special
> classes.
>
> public String toString() {
> return com.sun.cldc.util.j2me.CalendarImpl.toString(calendar);
> }
Careful. That's one implementation's way of returning the date as a String.
Each handset may (and probably will) be getting that value differently.
From where is the above code snippet taken?
--
/**
* @author Darryl L. Pierce <email***@***.com>
* @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
perl
*/
|
| |
|
| |
 |
P.Hill

|
Posted: 2004-5-19 12:04:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
Darryl L. Pierce wrote:
> I said *nothing* about *what* is stored within the class. I said that it
> (the default constructor for Date) *gets* the current timestamp *from*
> System.currentTimeMillis() and also that the class *returns* a value that
> is the local version of that value. I said nothing about what is stored
> internally to the class; you're assuming that part.
You said the "constructor returns", twice, I'm sorry, I had assumed that meant
you were talking about what the Date object claims to be or is internally.
The class does not "return a value when asked" it returns one of two values when
asked. It seems you are now worried about the internal representation.
By the way I am not sneaking into the implementation to claim what it does
represent, I am stating what it public contract is:
"the Date class is intended to reflect coordinated universal time" that is from
the JavaDocs, that is not an implemenation detail. Date
is a token that carries such things around. To think otherwise is
to not understand a Date object.
> This lead me to believe you were saying that both
> currentTimeMillis() and the date representation were the same. If you were
> talking about the internal representation of the date within the Date class
> then your statement is either vague or misleading.
Yup, that is what I was saying and it is the truth of all implementations
currently in use, but you think otherwise for you want to make
claims of conversion. For example, you said in your latest message:
>That's what I was talking about. You put in one thing (a long value
>representing the date in a singular way) and you get out of the black box
>called Date a String that is your local date/time.
Date.toString() may return a local String or it may not, in fact it
is the ME editions where it is free to take the OR path and return GMT.
But Date() is not some conversion object for making strings, you'd
be wasting your time to use it as such. It is flyweight object, or
token object which represents in a very small space a date/time combination
like all objects it happens to have a toString() method. Like all
toString() methods there is not guarentee what this might be as long
as it consistent. There is no guarentee that it will come up with the TZ
and produce local time in a Unix-like style.
This is also a change in what you were stating, I quote you quoting
yourself.
>I said before that Date "uses your timezone to convert [the value from
>System.currentTimeMillis()] to the local time".
The only time a timezone comes into play is possibly in the toString()
method and it converts the value currently in the Date() object which
may not have anything to do with any System.currentTimeMillis().
The above quote without even containing the word constructor again
hints at timezones and currentTimeMillis coming together in the class
somewhere. Since the only place the current time is mentioned in
the API (we're sticking to the external contract right?) is in
Date constructor then again you suggest TZ has something to do
with constructing a Date object.
>The value is converted. But, the problem here is that you seem to think that
>"conversion" means "changed". Perhaps a better term would be "translated"?
Recall I was quoting your sentences where you stated WHERE the conversion
took place, in the constructor. I'm glad you are now stating explicitly
that toString() MAY be the one which may doing such things.
A good mental model, the stated contract, and all known implementations
of Date() are a binary value since 1/1/1970. any other comments implying
otherwise including statement about conversion in the constructor or use of
terms like "conversion", "changed" or "translated" (from
System.currentTimeMillis(), see your quote above) seems to me to obscure the
picture unless you want to talk about toString() explicitly which until your
very last post you did not state explicitly.
>The conversion/translation is in the *class*,
Too bad you stated it was in the constructor on two different occasions
and claimed currentTimeMillis is translated using a TZ, thus starting down
the path about internal represenation.
>That constructor is not deprecated in the MIDP.
Which one would that be? I was speaking of the one that take
a String and variations that take seperate month, day, year values.
Such don't exist in the MIDP edition. My god, what an
imprecise statement! "not deprecated" might suggest to some
that those old methods exist in MIDP. If any one is reading
along, I'll point out to them that the only way
the statement "That constructor is not deprecated in the MIDP"
is true for the constructors in question which exist in the SE, but are
deprecated, is that they don't exist at all in the MIDP, so they can't be
deprecated. The old constructors where deprecated before MIDP or ME were
defined, so they were just dropped in the ME and all variations of it.
There are 4 deprecated ones in the JDK SE, all
deprecated of for the same reason -- they would have to assume a TZ in order to
do the right thing. Note that toString() has no such requirement to work with a
TZ. The toString() doesn't have to return a local string tomorrow if SUN decides
it doesn't want to. The programmers are only being polite to give you
something that is recognizable. Notice that is typically formatted in a UNIX
like manner. They chose an old defacto standard, aka prior art, but that is not
part of the contract for Date.toString(). If you are using java.util.Date()
to create a local time string, you are not working with just the defined
interface, you are making an assumption about toString() which is not
stated anywhere. I would not recommend that to anyone.
You speak of not assuming implementations, I suggest you follow your own advice
and not talk about local time and Date() objects, particular not in conjunction
with currentTimeMillis().
cheers,
-Paul
|
| |
|
| |
 |
Darryl L. Pierce

|
Posted: 2004-5-20 7:56:00 |
Top |
java-programmer >> System.currentTimeMillis not returning GMT/UTC (J2me)
P.Hill wrote:
>> I said *nothing* about *what* is stored within the class. I said that it
>> (the default constructor for Date) *gets* the current timestamp *from*
>> System.currentTimeMillis() and also that the class *returns* a value that
>> is the local version of that value. I said nothing about what is stored
>> internally to the class; you're assuming that part.
>
> You said the "constructor returns", twice,
I said no such thing. Please quote where I said the constructor returns
anything.
> I'm sorry, I had assumed that
> meant you were talking about what the Date object claims to be or is
> internally. The class does not "return a value when asked" it returns one
> of two values when
> asked.
Sorry, what's the difference between those two statements?
> It seems you are now worried about the internal representation.
What *is* your problem? I said specific *not* to worry about internal
representations and only to focus on the public contracts in the message to
which you're replying. You're now trying to claim I've said the exact
opposite. Why?
> By the way I am not sneaking into the implementation to claim what it does
> represent, I am stating what it public contract is:
> "the Date class is intended to reflect coordinated universal time" that is
> from
> the JavaDocs, that is not an implemenation detail. Date
> is a token that carries such things around. To think otherwise is
> to not understand a Date object.
I never claimed otherwise. I said that the Date object takes the value from
currentTimeMillis() in the default constructor and will return to you a
representation of that date in the local format in the MIDP.
> > This lead me to believe you were saying that both
> > currentTimeMillis() and the date representation were the same. If you
> > were talking about the internal representation of the date within the
> > Date class then your statement is either vague or misleading.
>
> Yup, that is what I was saying and it is the truth of all implementations
> currently in use,
Not in the MIDP. The MIDP returns the local date.
> but you think otherwise for you want to make
> claims of conversion. For example, you said in your latest message:
>
> >That's what I was talking about. You put in one thing (a long value
> >representing the date in a singular way) and you get out of the black
> >box called Date a String that is your local date/time.
In the MIDP it does, which is what the OP was asking for.
> Date.toString() may return a local String or it may not, in fact it
> is the ME editions where it is free to take the OR path and return GMT.
That's what the OP asked for, and that's the answer to his question.
> But Date() is not some conversion object for making strings, you'd
> be wasting your time to use it as such. It is flyweight object, or
> token object which represents in a very small space a date/time
> combination like all objects it happens to have a toString() method. Like
> all toString() methods there is not guarentee what this might be as long
> as it consistent. There is no guarentee that it will come up with the TZ
> and produce local time in a Unix-like style.
>
> This is also a change in what you were stating, I quote you quoting
> yourself.
>
> >I said before that Date "uses your timezone to convert [the value from
> >System.currentTimeMillis()] to the local time".
>
> The only time a timezone comes into play is possibly in the toString()
> method and it converts the value currently in the Date() object which
> may not have anything to do with any System.currentTimeMillis().
Mate, that's what the OP asked for, and that's the answer to his question.
<snip>
--
/**
* @author Darryl L. Pierce <email***@***.com>
* @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
perl
*/
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Javascript link problem in IE 6Found the fix myself. Go to
http://support.microsoft.com/default.aspx?kbid=281679 and register the
dll's listed there. I don't know which one did the trick because I did
each one of them.
On Sun, 18 Jun 2006 22:04:39 GMT, Sangrateo
<email***@***.com> wrote:
>I'm running Windows XP SP2 with all of the latest updates and patches.
>Whenever I click on a javascript link in Internet Explorer, nothing
>happens. I don't get an error message nor do any windows pop up.
>
>A good example is at the Windows Update page. Nothing happens when
>clicking on a software update for more information (where it shows
>"Click to display this update's description"). Its as if I were
>clicking a non-link portion of the web page.
>At the bottom left corner of IE, appears
>"Javascript:parent.fnExpandDetails(0);" when I hover over the same
>link.
>
>Anyone have any ideas?
>Thanks,
>
>Sangrateo
>email***@***.com
Sangrateo
email***@***.com
- 2
- CubicCurve2D TracingGiven an arbitrary CubicCurve2D how can I iterate along it getting
both the x and y coordinates of the current point as I go?
Thanks.
- 3
- Need a project... found a website on mindprodJohn T wrote:
> First, for those who may not already know, I am NOT a Java programmer. I
> am learning the language for my own purposes (
> Along with Ruby, XML, Perl and Groovy).
>
> I have sucessfully written a Java program which parses an XML file and
> am using it in my job. I am a technical support person, who specializes
> in printing systems, namely the way that our systems (HPUX and SunOS)
> interface with a print server running Easyspooler and Infoprint Manager.
>
> With that in mind, I think I am ready for a project. However, the
> closest thing I can come up with on my own, as anyone who has read any
> of my previous threads can tell, is some form of real world modelling. I
> am *not* convinced that this would be benefical to me as a learning
> experience.
>
> So let me elaborate on what I have been studying.
> I am familiar with classes, interfaces, packages and polymorphism,
> although interfaces and polymorphism are still somewhat foreign to me. I
> know a little bit about interfacing with Oracle and MySQL and have done
> a very rudimentary JSP page which talks to an Oracle database.
>
> Since I have no current projects in my job which require me to do any
> kind of Java programming (I came up with the XML parser as satisfying a
> need I had) I am looking for some suggestions.
>
> I have made my way through some of Eckle's book (and even have had an
> email from him). I have worked my way through the first portion of the
> Sun Java Tutorial. I've studied the Horstmann books (text for a class I
> took in Java) and, my favorite, Head First Java.
>
> I would like to do something with what I have learned. I'm not ready
> for GUI programming yet, nor do I want something trivial. Perhaps
> someone out there has written something along the lines of what I am
> looking for and would be willing to share with me the requirements for
> what they did. From the requirements, I can do a Use-Case and UML
> diagrams and from there, get to the coding.
>
> *Remember* I come from a procedural language (COBOL) background and have
> done very little OOP aside from SAS (does anyone remember SAS) and some
> Delphi, so please, be gentle. A simple project is all I am looking for.
> I'm not going to market it and I'm not going to post my code here
> looking for suggestions on how to clean it up.
>
>
Since no one has come up with anything I did a google search (GIYF) for
beginner java project and this is one of the sites which came up.
http://mindprod.com/projects/beginner.html
Do these make sense as beginner projects or am I out of my league again?
- 4
- Static Variables in Servlet ContainerJohn C. Bollinger wrote:
> Application servers typically assign different ClassLoaders to different
> web applications. That, combined with typical ClassLoader delegation
> behavior, normally produces the situation you describe. It is probably
> fairly safe to expect that kind of behavior, but be advised that it is
> not guaranteed. In particular, in some application servers that support
> it, hot (re)deployment may cause such expectations to be incorrect.
Well, one part of that is very definitely guaranteed: that classes in
web applications' relevant WEB-INF folders will be loaded in a class
loader that's unique to that web application. The part about shared
classes and a container lib directory is entirely implementation-
dependent.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
- 5
- Use of scrolling in the JBuilder IDEDoes anybody know why the use of scrolling is not supported in the IDE of
JBuilder ? (the middle mouse button). Will this be supported sometime in the
future? Because it is really convienient.
Also can you tell me why the Java programs do not support the clicking of
the middle mouse button hit as an event?
Thanks in advance.
- 6
- Can I link to a PDF from JavaHelpI reckon its not going to be possible but I'm going to ask....
I've done a JavaHelp system and we'd like if we could make a PDF
document available from here.
I thought we could do it as a download, right click and save target as
but when I right click it just tries to open it in the JavaHelp...
Can anyone think of a solution? The other option I suppose is to make
the document available as another option on the help menu but I'd
wanted to deploy the help jars on their own(at the moment we cant
redeploy the client)
- 7
- int return in JSpinner."Matteo Finistauri" <email***@***.com> writes:
> I'd like to have the int value in a JSpinner. I tryed in this way:
> int h = MySpin.getValue();
> but it doesn't work. I tried to cast the value like this:
> int h = (int) MySpin.getValue();
> but it doesn't work.
Why should it? You can't cast Object to int.
> What can I do????? Thank you!
If you use a SpinnerNumberModel, then
((Number)MySpin.getValue()).intValue()
or
((SpinnerNumberModel)MySpin.getModel()).getNumber().intValue()
/Thomas
- 8
- Running compiled programs in command promptHi, I should know how to do what it says in the subject of this post,
but I don't. I've almost finished Sams Teach Yourself Java in 24 Hours
3rd Edition and now I need to pass some arguments to the program via
command prompt but the book only covers 1.4.
java program [arguments] when i cd it to the directory containing the
class
doesn't work.
- 9
- Jsp Error Cant Get Data from databaseHi
i am writing a JSP page which connects to Mysql DataBase
i can get the connection but i cant get to execute the query on the
database
plz help
the code of jsp file
<%@ page import ="java.lang.*" %>
<%@ page import ="java.sql.*" %>
<html>
<head>
<title>
Index Page
</title>
</head>
<body>
jsp pages is better than ASP.NET
<%
int x;
Connection conn=null;
Statement st=null;
ResultSet rt=null;
String query="select * from user";
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/
mysql","root","aaaa");
if(conn==null)
{
out.print("not connected");
}
out.print("<br>"+"Connection"+conn+"<br>");
try
{
st = conn.createStatement();
rt=st.executeQuery("select * from a.a");
while(rt.next())
{
String y;
String str;
x=rt.getInt("id1"+"<br />.");
y= rt.getString("id2"+"<br />.");
str= rt.getString("id3"+"<br />.");
out.print(x);
out.print(y);
out.print(str);
}
}
catch(Exception ex)
{
out.print("<br>");
out.print("Timeoooo "+"<br />");
}
finally
{
if (rt != null) rt.close();
if (st != null) st.close();
if (conn != null) conn.close();
out.print("<br>");
out.print("Timeoooo"+"<br />");
}
%>
<%
conn = null;
st = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn =
DriverManager.getConnection("jdbc:mysql://localhost:
3306/","root","aaaa");
st = conn.createStatement();
rs = st.executeQuery("select * from a.employees");
while(rs.next()) {
%>
<TR><TD><%= rs.getString("lname_txt") %></TD>
<TD><%= rs.getString("fname_txt") %></TD></TR>
<%
}
%>
</TABLE>
<%
} catch (Exception ex) {
ex.printStackTrace();
%>
</TABLE>
Ooops, something bad happened:
<%
} finally {
if (rs != null) rs.close();
if (st != null) st.close();
if (conn != null) conn.close();
}
%>
</body>
</html>
- 10
- Upgrade from 1.4.2_10 to 1.5.0_06I recently upgraded my JAVA and now I am unable to run any JAVA applets.
All I am getting is a "General Exception" dialog box and a whole lot of CRAP
in the "JAVA Console" - see below...
---------------------------------------------------------------------------------
Java Plug-in 1.5.0_06
Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Rob
network: Loading user-defined proxy configuration ...
network: Done.
network: Loading proxy configuration from Internet Explorer ...
network: Done.
network: Loading direct proxy configuration ...
network: Done.
network: Proxy Configuration: No proxy
basic: Cache is disabled by user
----------------------------------------------------
c: clear console window
if: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
basic: Registered modality listener
liveconnect: Invoking JS method: document
liveconnect: Invoking JS method: URL
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@87a5cc,
refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@152544e
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
network: Connecting http://www.java.com/applet/testvm.class with
proxy=DIRECT
network: Connecting http://www.java.com/applet/testvm/class.class with
proxy=DIRECT
load: class testvm.class not found.
java.lang.ClassNotFoundException: testvm.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: www.java.com
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
basic: Exception: java.lang.ClassNotFoundException: testvm.class
java.lang.ClassNotFoundException: testvm.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: www.java.com
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
basic: Modality pushed
basic: Modality popped
Anyone else experienced this issue? SUN seems to be more than a little
perplexed - and is not providing much help...
- 11
- Applet icon & status barHi,
I have an applet that extends a JFrame. How can I change or remove
the java icon in the upper-left corner and the status bar "Java Applet
Window" ?
Thanks
- 12
- Sexy GirlfriendsPornoduel.com
Bodypaint - http://www.pornoduel.com/duel.php?myCategory=bodypaint
Bondage - http://www.pornoduel.com/duel.php?myCategory=bondage
Sexy Amatures - http://www.pornoduel.com/duel.php?myCategory=amature
Sloppy Blow Jobs - http://www.pornoduel.com/duel.php?myCategory=blowjob
Sexy Costumes - http://www.pornoduel.com/duel.php?myCategory=costume
Erotic Art - http://www.pornoduel.com/duel.php?myCategory=hentai
Nasty Lesibans - http://www.pornoduel.com/duel.php?myCategory=lesbian
Sexy Sluts - http://www.pornoduel.com/duel.php?myCategory=frontal
Perfect Pussy - http://www.pornoduel.com/duel.php?myCategory=pussy
- 13
- Object creation vs. ThreadLocal retrievalI have a method which searches a singly linked list for an object. It
needs to return references to both the object and the preceding object
in the list. I have created a very simple inner class to encapsulate
this information:
private final class MemberReference
{
final Member referent;
final Member previous;
MemberReference(Member referent, Member previous)
{
this.referent = referent;
this.previous = previous;
}
}
An instance of this class will be required for just about every access
the the class, including reads, which could cause a lot of these objects
to be created and then discarded.
I'd like to avoid this if possible, but the class does need to support
reading by multiple threads, so I wouldn't want to use a single
instance (or a couple of class fields). I'm thinking of using a
ThreadLocal, but I can't help wondering if retrieving the thread-local
value might not be more expensive than creating a new object.
Anyone have any experience/thoughts?
Thanks!
--
========================================================================
Ian Pilcher email***@***.com
========================================================================
- 14
- Managing Session with javamailHi all,
I send a large number of emails using javamail. My problem is that my
provider limits the number of emails I can send out per minute per
session. On top of that, it does not allow me to use another SMTP
server than its own.
My first way to deal with that has been to include a sleep in my
sending loop in order to respect their quota (20 mails per minute).
But I now would like to explore faster ways to send emails out.
One of my idea was to close the session and reopen a new one to see if
that would be accepted by my provider server. But I don't see that
being a possilbe with javamail. Am I wrong?
Can you come up with other ideas?
Has anyone of you guys had to deal with such an issue before?
Thanks,
Necleto
- 15
|
|
|