comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* Logic:iterator reading from an array or collection - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7304603917e58704
* A Jtidy and XHTML question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22e06ae99461da6d
* exec jars w/dependent jars - 4 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57a120668105cdf7
* read binary data from C file??? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c04d04f749f5ae1f
* server application - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bfd9bcb653fd31c
* Need good free beautifier other than Jalopy - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b4415996c299a7af
* loading JAR's from a URL - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5aef841a37c27d9
* Preventing multiple instance standalone desktop gui applications - 1 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afa857e018f3780
* Setting Command Prompt Window Size programmatically - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2731912d7499ef51
* Extension problem Mac OS X (launching of external jar doesn't work) - 3 messages, 3 
authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3dd4b342d0c112d6
* Garbage collector question - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/793ab88313c687f9
* Help with date conversion - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1de63360e87e2da0
* Can I force garbage collection? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/62be19cef0da9817
  
==========================================================================
TOPIC: Logic:iterator reading from an array or collection
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7304603917e58704
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 24 2004 7:24 am
From: Sudsy <[EMAIL PROTECTED]> 

Robert Hornsby wrote:
> Hi,
> I am using the logic:iterator tag in a jsp using struct to output a
> collection or an array of items. This works fine, however when the
> user submits the form and I try to get the changed items the array
> always come back null. I have tried this with array and collection
> objects. Does anyone know why the collection is not getting
> ititialized with the new data?

Sebastian is right: you need to use indexed properties. See
<http://www.sudsy.net/technology/struts-advanced.html>





==========================================================================
TOPIC: A Jtidy and XHTML question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22e06ae99461da6d
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 24 2004 7:48 am
From: Thomas Fritsch <[EMAIL PROTECTED]> 

mike wrote:
> regards:
>  
>   I use Jtidy(java api introduced by w3c),to translate one HTML page into 
>   XHTML page.
>   
>   Now,I get the "XHTML" file 
> 
>   --------------------------------------------------------------------------
>   I write java code and simulate my machine as a HTTP server listening
>   port 85.
> 
>   When client connect to my machine by using HTTP protocol.
>   In my program,I send the client the HTTP headers,there are 2 important
>   HTTP headers:(1)content-length: ?(2)content-type: ?
>   
>   The parameter of "content-length:",I can decide.
>   What I ask is what kind of content-type I should apply to the "XHTML"  file.
>  
>   --------------------------------------------------------------------------
>   because the "XHTML" file is generated by Jtidy,I dont't know what kind of 
>   mime type I should use to let the mobile browser to identify the "XHTML"
>   file.
>  
>   Could someone excellent or experienced to tell me how?
> 
>   thanks a lot
The XHTML specification can tell you:
http://www.w3.org/TR/xhtml1/#media

-- 
Thomas<dot>Fritsch<squiggle>ops<dot>de





==========================================================================
TOPIC: exec jars w/dependent jars
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57a120668105cdf7
==========================================================================

== 1 of 4 ==
Date:   Fri,   Sep 24 2004 7:41 am
From: "Allen Fogleson" <[EMAIL PROTECTED]> 

If you know where the jar will reside you can put an entry into the manifest
file that says to include the depend.jar on the classpath. (off the top of
my head....)

CLASSPATH: depend.jar jars/depend2.jar jars/etc.jar

Al


"Ike" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> if I have an executable jar, H.jar, which also depends on the presence of
> another jar (call it depend.jar) in the CLASSPATH, how do I invoke H.jar
> from the command line such that it sees depend.jar? Ive looked for docs,
> tried many variations such as the one below, to no avail . I'm just trying
> to create a windows bat file such that I can zip all the jars, and the
bat,
> up and send to a client so he can see the status of things. Thanks, Ike
>
> java  -jar H.jar -classpath .;depend.jar
>
>





== 2 of 4 ==
Date:   Fri,   Sep 24 2004 8:02 am
From: John Davison <[EMAIL PROTECTED]> 

Ike wrote:
> if I have an executable jar, H.jar, which also depends on the presence of
> another jar (call it depend.jar) in the CLASSPATH, how do I invoke H.jar
> from the command line such that it sees depend.jar? Ive looked for docs,
> tried many variations such as the one below, to no avail . I'm just trying
> to create a windows bat file such that I can zip all the jars, and the bat,
> up and send to a client so he can see the status of things. Thanks, Ike
> 
> java  -jar H.jar -classpath .;depend.jar
> 
> 

To further extend this question, does java treat the classpath 
differently when using the -jar switch?  Does it use it at all, or does 
it depend solely on the classpath in the manifest?

- john



== 3 of 4 ==
Date:   Fri,   Sep 24 2004 8:26 am
From: Thomas Fritsch <[EMAIL PROTECTED]> 

Ike wrote:
> if I have an executable jar, H.jar, which also depends on the presence of
> another jar (call it depend.jar) in the CLASSPATH, how do I invoke H.jar
> from the command line such that it sees depend.jar? Ive looked for docs,
> tried many variations such as the one below, to no avail . I'm just trying
> to create a windows bat file such that I can zip all the jars, and the bat,
> up and send to a client so he can see the status of things. Thanks, Ike
> 
> java  -jar H.jar -classpath .;depend.jar
> 
> 
Hi Ike!

Read the doc for "java -jar ..."
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html#-jar
You will find:
"When you use this option, the JAR file is the source of all user 
classes, and other user class path settings are ignored."

Further read the JAR File Specification (Main Attributes)
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Main%20Attributes
There you find how to specify a Class-Path in the manifest of your H.jar

BTW: I have added the book-mark http://java.sun.com/j2se/1.4.2/docs/ to 
my browser, which is really helpful. ;-)

-- 
Thomas<dot>Fritsch<squiggle>ops<dot>de




== 4 of 4 ==
Date:   Fri,   Sep 24 2004 9:23 am
From: Sudsy <[EMAIL PROTECTED]> 

Thomas Fritsch wrote:
<snip>
> BTW: I have added the book-mark http://java.sun.com/j2se/1.4.2/docs/ to 
> my browser, which is really helpful. ;-)

A stellar suggestion! I also have
<http://java.sun.com/j2ee/1.4/docs/api/>
When writing Java code, I <em>always</em> have a browser window open
to the javadocs. Even though life is easier with an IDE like Eclipse,
I need to be able to navigate the classes so that I can find methods
in ancestor classes, etc. Since there are sooo many classes, I find
it helpful to be able to browse and locate likely candidates for what
I'm trying to accomplish.





==========================================================================
TOPIC: read binary data from C file???
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c04d04f749f5ae1f
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 24 2004 7:54 am
From: John Adams <[EMAIL PROTECTED]> 

John Adams wrote:
> Hi,
> 
>   I am sorry if this has been asked before but I couldn't find any hint 
> scheming through the list. So here is my problem:
> 
>   I have to write a client end in java reading data sent over UDP from a 
> server (the server is written in C). The data format is a C struct with 
> all the fields including long, int, float, etc. I got the data in the 
> java client end in the format of a DatagramPacket, then I convert it to 
> a byte array. Now the question is, how do I extract each field from the 
> byte array? I know this is silly but I have tried using classes like 
> ByteBuffer, Array, etc, without good result (The print out of the 
> recieiving end differs than that from the sending end).
> 
>   Thanks for all the advice.


Hi Guys,

   Just to let you know in case you missed my post, I have found the 
problem thanks to all your advice. If you'd like to know where the 
problem came from, check my reply I mistakenly posted under Steve 
Horsley's post.




==========================================================================
TOPIC: server application
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bfd9bcb653fd31c
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 24 2004 8:05 am
From: [EMAIL PROTECTED] (Luke) 

Paul Lutus <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Luke wrote:
> 
> > hi all, I'm not sure if this would be the right group to post this in,
> > but it should work ok.  Ok, my question goes like this: supposeing I
> > have a client/server type project that I want to create in java, the
> > client will be running out of an applet so in order for this to work,
> > the server application must be running on the same server as is the
> > webpage that called the applet. (please don't try to solve what I've
> > said so far, as there are other factors that force me to have the
> > server program run on the webhosting server).  So my question is, does
> > anyone know of a webhost that will host a website for me for free (it
> > doesn't have to be big, banners aren't a problem, and I'm a poor
> > student so anything will be fine).
> 
> In that case, create the server on your own computer. You are very unlikely
> to find a free hosting service that will allow the use of a
> student-designed Java server.

ok, I could do that, but a couple problems, first of all I access the
web via the school network, as a result, I've tryed hosting web-sites
before, but it won't work because the router or whatever it is that
routs the traffic on the network, doesn't direct incoming http
connections to my comp.  Second problem, I don't have a computer that
I could devote solely to web hosting.
so ok, if noone knows of any free webhosts that will alow for server
applications, does anyone know of any cheap ones that a poor student
could afford?



== 2 of 2 ==
Date:   Fri,   Sep 24 2004 8:17 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Luke wrote:

/ ...

>> In that case, create the server on your own computer. You are very
>> unlikely to find a free hosting service that will allow the use of a
>> student-designed Java server.
> 
> ok, I could do that, but a couple problems, first of all I access the
> web via the school network, as a result, I've tryed hosting web-sites
> before, but it won't work because the router or whatever it is that
> routs the traffic on the network, doesn't direct incoming http
> connections to my comp.

No, you missed my point. Your goal is to test your code locally. Do this by
setting up a Web server on your own machine, not one accessible to the
outside world. You most certainly do not want to expose your prototype code
to the entire Net anyway.

> Second problem, I don't have a computer that 
> I could devote solely to web hosting.

What? All you want to do is set up a test Web server. This is not a great
difficulty, nor is it a big system load, because you are not going to open
it up to the world.

> so ok, if noone knows of any free webhosts that will alow for server
> applications, does anyone know of any cheap ones that a poor student
> could afford?

It is on your system now. Both Windows and Linux systems readily start up
Web servers for you. You do not need, nor do you want, to expose your
experimental code to the entire world. And this arrangement is free.

Please ask your professor for advice on this issue.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: Need good free beautifier other than Jalopy
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b4415996c299a7af
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 24 2004 8:11 am
From: [EMAIL PROTECTED] (Tivo Escobar) 

Hi all,

anybody could recommend a good free java beautifier (code formatter,
pretty printer, etc.) other than Jalopy?

I am about to run a beautifier over a 150,000 lines app and Jalopy
comes with a bizarre 'feature' that is really frustrating: it is
indenting my anonymous inner classes with an extra 'tab' (4 spaces).

Thanks in advance,

Tivo Escobar



== 2 of 2 ==
Date:   Fri,   Sep 24 2004 8:43 am
From: bugbear <[EMAIL PROTECTED]> 

Tivo Escobar wrote:
> Hi all,
> 
> anybody could recommend a good free java beautifier (code formatter,
> pretty printer, etc.) other than Jalopy?
> 
> I am about to run a beautifier over a 150,000 lines app and Jalopy
> comes with a bizarre 'feature' that is really frustrating: it is
> indenting my anonymous inner classes with an extra 'tab' (4 spaces).

Jalopy is oth configurable and open source. You should
be able to get it to do what you want.

      BugBear




==========================================================================
TOPIC: loading JAR's from a URL
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5aef841a37c27d9
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 24 2004 8:13 am
From: [EMAIL PROTECTED] (MJK) 

I am loading a JAR file from a URL.  It loads OK.  What I want to do,
is use the classes defined in the JAR file as if they were loaded from
the CLASSPATH.  Does anyone know if this is possible?




==========================================================================
TOPIC: Preventing multiple instance standalone desktop gui applications
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afa857e018f3780
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 24 2004 8:12 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Jacob wrote:

> Kent Yang wrote:
> 
>> I need to have only one instance of a Desktop GUI application running.
>>  What is the best way to do this?  The only answer I can find
>> searching throught the archives was to use a socket.  Is this the best
>> way?
> 
> I'll not add on to the fine answers already given.
> 
> But just because something is technically possible
> doesn't necesserily mean it is a good idea. As a
> user I find this kind of program behaviour a pain in
> the neck. Often it is possible to change the application
> model/logic so it _can_ coexist with other instances;
> Possibly on the expence of programming effort.
> 
> I don't say it is possible in your case, but please
> make sure you _try_ before you chose the simple
> way out :-)

There can be excellent reasons to do this. It is not necessarily a sign of
prorgammer laziness. If the program reads and writes to its own
configuration file, it is very confusing to a user to have multiple
instances running, and it seems inconsistent to spend time reconfiguring an
application, only to have the changes wiped out because of a minimized
extra instance that is closed automatically when the system is shut down.

For example, that is why my Web editor Arachnophilia, very
user-configurable, uses this approach. Earler versions allowed multiple
instances, and this was a disaster and a clear programming error. People
would spend hours reconfiguring the user interface, only to see their work
wiped out in a flash.

This should not prevent multiple users from having their own instances, but
it should prevent a single user from launching more than one.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: Setting Command Prompt Window Size programmatically
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2731912d7499ef51
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 24 2004 8:16 am
From: Dino Buljubasic <[EMAIL PROTECTED]> 

Hi,

How can I set the Command Prompt window size programmatically in Java.
I am quite new in Java, but would like to be able to set the size of
Command Prompt (Windows OS)  window when main starts before doing
anything else.

Thank you



== 2 of 2 ==
Date:   Fri,   Sep 24 2004 8:37 am
From: John Davison <[EMAIL PROTECTED]> 

Dino Buljubasic wrote:

> Hi,
> 
> How can I set the Command Prompt window size programmatically in Java.
> I am quite new in Java, but would like to be able to set the size of
> Command Prompt (Windows OS)  window when main starts before doing
> anything else.
> 
> Thank you

You cannot, not in Java.  Inside the normal command shell, you can use

mode con cols=x
mode con lines=x

but I'm not sure how to get Java to do that before it starts executing 
the program.

This is outside the scope of this newsgroup -- ask around on the 
microsoft newsgroups about it.

- john




==========================================================================
TOPIC: Extension problem Mac OS X (launching of external jar doesn't work)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3dd4b342d0c112d6
==========================================================================

== 1 of 3 ==
Date:   Fri,   Sep 24 2004 8:23 am
From: [EMAIL PROTECTED] (Batman4050) 

I too, have this problem on my Mac OS X computer.

What command do you use to add the $CLASSPATH?

I tried typing the following:
set CLASSPATH=.;/Library/Java/Extensions/
set $CLASSPATH=.;/Library/Java/Extensions/
env CLASSPATH=.;/Library/Java/Extensions/
env $CLASSPATH=.;/Library/Java/Extensions/

and I keep getting the error:  -bash: /Library/Java/Extensions/: is a directory

The current version of Java I have is:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-141)
Java HotSpot(TM) Client VM (build 1.4.2-38, mixed mode)



== 2 of 3 ==
Date:   Fri,   Sep 24 2004 9:27 am
From: [EMAIL PROTECTED] (contrex) 

Thank you for your reply Jonck.

> What you need to do is place whatever .jar file that you want to use as 
> an extension in this folder. For the rest nothing else is needed, this .
> jar is now considered to be on your CLASSPATH.

This is what I thought too and it works in this manner on windows and
linux but apparently not on Mac OS X.

> If you are getting a NoSuchMethodException for some reason the .jar is 
> not found. So you should check one of the following:

1) I don't use any IDE on Mac. I develop on windows or linux where I
make my jar files which will be then installed on Mac.

2) In csh terminal the variable CLASSPATH is undefined and in bash
terminal I get an empty line (I think it's undefined too). But who
cares, because:
        A) it's just a terminal session and the variables you'll set here
don't apply to other sessions because it's just local and not system
wide. Correct me if I'm wrong - I don't know well Mac OS X.
        B) This is more important: I don't want rely on any CLASSPATH
settings! This is the reason why I'm using the extension mechanism
because my "MainApp" can call "SubApp" after being copied into an
extension folder (and restart of "MainApp") without any manipulation
of CLASSAPTH settings!
        
The "MainApp" is able to show System Properties and I can see the
following (only the most important):
sun.boot.library.path =
/System/Library/Frameworks/JavaVM.frameworks/Versions/1.3.1/Libraries
java.class.path = MainApp.jar:/Applications/MainApp/Contents/Resources/Java/lax.jar
java.home = /System/Library/Frameworks/JavaVM.frameworks/Versions/1.3.1/Home
java.ext.dirs = 
/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.frameworks/Versions/1.3.1/Home/lib/ext

You see that the classpath doesn't refer any location of "SubApp". But
the "java.ext.dirs" does it do multiple times indeed!
Apparently Mac OS X doesn't care about else it would find "SubApp".

My last experience was to build an installer for "SubApp" (with
"Install Anywhere" on WinXP) in order to test a standalone
installation of "SubApp" on different plattforms. This works fine on
windows and linux but Mac OS X FAILS AGAIN.

WHAT CAN I DO?



== 3 of 3 ==
Date:   Fri,   Sep 24 2004 9:18 am
From: Sudsy <[EMAIL PROTECTED]> 

Batman4050 wrote:
> I too, have this problem on my Mac OS X computer.
> 
> What command do you use to add the $CLASSPATH?
> 
> I tried typing the following:
> set CLASSPATH=.;/Library/Java/Extensions/
> set $CLASSPATH=.;/Library/Java/Extensions/
> env CLASSPATH=.;/Library/Java/Extensions/
> env $CLASSPATH=.;/Library/Java/Extensions/
> 
> and I keep getting the error:  -bash: /Library/Java/Extensions/: is a directory
> 
> The current version of Java I have is:
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-141)
> Java HotSpot(TM) Client VM (build 1.4.2-38, mixed mode)

Under *NIX (which is what OS/X is under the covers), the semi-colon
is a command separator. You want to use a colon, e.g.

CLASSPATH=.:/Library/Java/Extensions
export CLASSPATH

Same as on the command line, e.g.

java -classpath $CLASSPATH:.:/Library/Java/Extensions <yourClass>

The semi-colon is only used as a separator on M$ systems since they
already use the colon to separate drive from path.





==========================================================================
TOPIC: Garbage collector question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/793ab88313c687f9
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 24 2004 8:24 am
From: Chris Smith <[EMAIL PROTECTED]> 

xarax wrote:
> Note that using
> get() after the WeakReference has been put onto the ReferenceQueue
> will make the object strongly reachable again

That's not my interpretation of the spec, which says:

    Suppose that the garbage collector determines at a certain point in
    time that an object is weakly reachable. At that time it will
    atomically clear all weak references to that object and all weak
    references to any other weakly-reachable objects from which that
    object is reachable through a chain of strong and soft references.
    At the same time it will declare all of the formerly weakly-
    reachable objects to be finalizable. At the same time or at some
    later time it will enqueue those newly-cleared weak references that
    are registered with reference queues. 

In other words, any WeakReference that's added to a reference queue has 
already been cleared, and a call to get() will return null.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



== 2 of 2 ==
Date:   Fri,   Sep 24 2004 9:22 am
From: "xarax" <[EMAIL PROTECTED]> 


"Chris Smith" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> xarax wrote:
> > Note that using
> > get() after the WeakReference has been put onto the ReferenceQueue
> > will make the object strongly reachable again
>
> That's not my interpretation of the spec, which says:
>
>     Suppose that the garbage collector determines at a certain point in
>     time that an object is weakly reachable. At that time it will
>     atomically clear all weak references to that object and all weak
>     references to any other weakly-reachable objects from which that
>     object is reachable through a chain of strong and soft references.
>     At the same time it will declare all of the formerly weakly-
>     reachable objects to be finalizable. At the same time or at some
>     later time it will enqueue those newly-cleared weak references that
>     are registered with reference queues.
>
> In other words, any WeakReference that's added to a reference queue has
> already been cleared, and a call to get() will return null.

Oops, you're right. I had some confusion about
the special behavior of PhantomReferences.






==========================================================================
TOPIC: Help with date conversion
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1de63360e87e2da0
==========================================================================

== 1 of 3 ==
Date:   Fri,   Sep 24 2004 8:35 am
From: "Jack" <[EMAIL PROTECTED]> 


How to convert:

yyyy-MM-ddThh:mm:ss.sTZD

to

yyyy-MM-dd HH:mm:ss

?

thanks for any tips 





== 2 of 3 ==
Date:   Fri,   Sep 24 2004 8:59 am
From: Bryce <[EMAIL PROTECTED]> 

On Fri, 24 Sep 2004 15:35:25 GMT, "Jack"
<[EMAIL PROTECTED]> wrote:

>
>How to convert:
>
>yyyy-MM-ddThh:mm:ss.sTZD
>
>to
>
>yyyy-MM-dd HH:mm:ss

Check out Calendar, GregorianCalendar and SimpleDateFormat classes

>thanks for any tips 

Your welcome.

--
now with more cowbell



== 3 of 3 ==
Date:   Fri,   Sep 24 2004 9:31 am
From: Thomas Fritsch <[EMAIL PROTECTED]> 

Jack wrote:
> How to convert:
> yyyy-MM-ddThh:mm:ss.sTZD
> to
> yyyy-MM-dd HH:mm:ss
> ?
> thanks for any tips 
> 

Probably like this:
  String s1 = ....;
  Date d = (new SimpleDateFormat("yyyy-MM-ddThh:mm:ss.sTZD")).parse(s1);
  String s2 = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(d);

-- 
Thomas<dot>Fritsch<squiggle>ops<dot>de





==========================================================================
TOPIC: Can I force garbage collection?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/62be19cef0da9817
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 24 2004 9:32 am
From: [EMAIL PROTECTED] (Doug Pardee) 

To add to what Chris said:

> The API documentation for System.gc() says that "When 
> control returns from the method call, the Java Virtual
> Machine has made a best effort to reclaim space from
> all discarded objects."
>   ...
> it may not be possible to do any work at this time;
> in that case, a "best effort" is no effort at all.

Conversely, in modern Sun JVMs "best effort" means "maximum effort".
The JVM comes to a screeching halt while it runs a combination of
algorithms designed to root out every possible unused object from
anywhere that they might be hiding. The result is a GC cycle that
frequently can be measured in seconds instead of in milliseconds.

> There is, in fact, never a guarantee that any unreferenced object
> will be freed, ever.  For one thing, conservative collectors will
> tend to retain a very small percentage of objects accidentally,
> and the specification is designed to allow them.

And in fact, the older Sun JVMs used such conservative collectors.

Modern Sun JVMs claim to have "accurate" collectors that can recover
all unused objects. However, there is a distinction between "can" and
"does". The JVM "can" recover all unused objects by using the
maximum-effort GC mentioned above, but ordinarily it uses partial
collections. These partial collections might overlook an unused object
here or there, but they run many times faster. Most overlooked garbage
will be picked up on a later collection cycle. The JVM won't declare
OutOfMemoryError without first trying a maximum-effort GC, so the
overlooked garbage doesn't affect the amount of memory available to
your program.



=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 

Reply via email to