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

Dan Cranmer

Greenhorn
+ Follow
since May 24, 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 Dan Cranmer

Not exactly answering the microsecond issue, but an interesting utility for keeping your computer's time correct can be found at:
http://www.boulder.nist.gov/timefreq/service/its.htm
They go on to explain:
On most Win 3.x, 9x, 2000 and Me systems, the time cannot be set more accurately than to the nearest second. It is therefore possible that the time of your system can be wrong by up to +/-0.5 seconds even immediately after you adjust your clock based on data received from one of our servers. In addition, the clocks on many computers can gain or lose several seconds per day, so that even a clock that is set correctly will not stay that way for very long. Windows NT has more sophisticated software support for the clock, but the hardware is usually not any better. If your applications requires that the time on your system must be correct to within +/-1s at all times then you will probably only be able to achieve that level of performance using Win NT and a continuous connection to the Internet. It will be more difficult to realize using other versions of Windows, and you may find that even Win NT does not completely satisfy this requirement.
18 years ago
The System package has a useful, static method which returns the current time in milliseconds, as described in the java docs. Are you really interested in microseconds? I think that would be very platform specific probably requireing special hardware.
public static long currentTimeMillis()Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.
See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC).
Returns:
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
18 years ago
Thanks for the responses, I found what I was looking for at the following link:
Java Time Line
However it stops after 1.3, anyone know when 1.4 shipped? And when 1.5 might ship?
Here's what I have so far:
Jan '96 1.0
Feb '97 1.1
Dec '98 1.2
May '00 1.3
?? 1.4
?? 1.5
18 years ago
Does anyone have a list of the different versions of the JDK from Sun and when they were released?
18 years ago
You can use the code you used to start an application and have it start the kill utility. It is standard on unix but you have to get the windows resource kit to use it on windows.
19 years ago
It works for me?

System.currentTimeMillis(); might be a little easier to use. For more accurate timing see http://www.boulder.nist.gov/timefreq/service/its.htm
[ August 30, 2002: Message edited by: Dan Cranmer ]
19 years ago
You might want to check the parameters you pass to the getConnection method. The following is what we use for Oracle.

There should be some examples of how to use the MS database and jdbc.
[ August 02, 2002: Message edited by: Dan Cranmer ]
You might want to take a look at the Java source for the File class and the FileSystem class. If you just want to simulate a file system you might be able to get away with using the RandomAccessFile class. Otherwise you will get into some platform specific JNI code.
See:
http://java.sun.com/j2se/1.4/docs/api/java/io/RandomAccessFile.html
19 years ago
Take a look at this article, it might answer some of your questions:
http://www.javaworld.com/javaworld/jw-05-2000/jw-0505-servlets.html
19 years ago
It might have to do with the platform and JVM you are using. I ran the following code on a 3 processor Sun, when only one thread is created I can only use 33.3% of the CPU, when 2 threads are created it starts to use 66.6% and when all 3 threads are started I use all available processors.
There is some overhead in starting a Thread and then the JVM has to call the run method, all of which takes longer than dropping to the next method in the loop which is the interrupt. A sleep of 1 millisecond after the start is enough time for the thread to get started before the interrupt.
[ July 26, 2002: Message edited by: Dan Cranmer ]
I got the following example to work, but I had to have a really big file, greater than 30MB, on a 700Mhz system.

[ July 26, 2002: Message edited by: Dan Cranmer ]
19 years ago
Hi Mohammed,
Sorry about the late response (over a year since the original post). But, except for the problem on line 47, (<paramNames was interpreted as an html tag) I had to change it to "for (int i=0; i<paramNames.length; i++)". It seems to work when changing the super call in the constructor on line 14, from modal to non-modal, "super(parent, "Progress...", false);" It must be that a modal JDialog object is blocking everything else.
--Dan
19 years ago
I like Bruce Eckel's book "Thinking in Java", the electronic version is free.
http://www.mindview.net/Books
19 years ago