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

Today's topics:

* JSP compilation time difference? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/71db042e9bc46415
* Java and xmlrpc? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e4304527fb69e181
* Finding Date Difference - 3 messages, 3 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9df8bc4e9c538dd
* Sun's JMS API Tutorial: just hangs - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ffd2dbf4cfdc3ba9
* New String - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/480ebe0f50a46c11
* Memory leak - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/03d171ccb3bbc421
* Rules Engines - Best Practices? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a79bfcda56e2b81c
* Problem with Tiles/Struts on WSAD 5 - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ec359d8e0d5e9d8c
* My understanding in "new" keyword - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/62e90e8bce4915a9
* Java 1.5 where to get info from ? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3d8a99f29fbf389b
* Running programs in (networked) DOS window - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f76fd24178be761c
* how to fix the JFrame size? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ebe9bc0e6b94d453
* ejb-ref-name question? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7846db243c373d79
* Free java game ( may play via bluettoh) - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6440332f2e3e0774
* Application in sandbox - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821eb31df84b5c4a
* Ant vs Makefiles - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e81556a5c62ba767
* Rules Engines - Best Practices? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29c872a53d183689
* BigDecimal: Sun? IBM? - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d8e6c9d469d029de
* Unable to establish a socket connection - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3db1070c05ec0b49
* Update your VM gentlemen, sun made a mistake. - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/0d5689b8341eb5c3

==============================================================================
TOPIC: JSP compilation time difference?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/71db042e9bc46415
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 5:46 pm
From: Alex Kizub  

jdhovland wrote:

> I'm currently experiencing a problem while viewing a JSP page
> immediately after restarting.  I log into the web front and view the
> pages, wherein I experience a problem of expected data/object not
> displaying. However, if I refresh the page the data is displayed. I'm
> trying to fathom if this is due to an interaction between the
> container and certain children compiling and displaying faster than
> the inline content (being generated by a server-side application
> method).  Has anyone else experienced something similiar?

Always, with cash in browser.
Alez Kizub.





==============================================================================
TOPIC: Java and xmlrpc?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e4304527fb69e181
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 11:57 pm
From: Martin Egholm Nielsen  

> I'm using xmlrpc-1.2-b1.jar without difficuly, both client- and
> server-side. Not using it with Eclipse, though.
Can you submit an example of how you use it?
Is it with a large servlet container (e.g. Tomcat) or have you used it 
"standalone"?

Regards,
  Martin Egholm




==============================================================================
TOPIC: Finding Date Difference
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9df8bc4e9c538dd
==============================================================================

== 1 of 3 ==
Date: Fri, Dec 3 2004 4:11 am
From: Jacob  

Mick wrote:
> There must be an 'easy' way to find the difference between 2 dates

No there isn't. You can find the difference between two
moments in time, but make sure the two are represented
by Calendars of the same reference (i.e. TimeZone).
The difference is measured in milliseconds so it still
takes some effort to convert it to something useful
depending on your context.

In an attempt to make it easier to work with *dates* (as
opposed to *times*) I wrote the Day.java class:

   http://geosoft.no/software/day/Day.java.html

In particluar, note the Day.daysBetween() method.



== 2 of 3 ==
Date: Thurs, Dec 2 2004 12:16 pm
From: Andrew Thompson  

> "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
..
>> Please refrain form top-posting Mick, I find it nost confusing..
>> <http://www.physci.org/codes/javafaq.jsp#netiquette>

Did you read *all* of that link Mick?  There were further tips to
prompt you to trim content no longer relevant.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



== 3 of 3 ==
Date: Thurs, Dec 2 2004 11:48 am
From: Thomas Fritsch  

Mick wrote:
> Thanks...but
> 
> Why does this not compile??
> 
> Calendar thisCal_1 = Calendar.getInstance();
> thisDate_1 = new java.util.Date(strStartDate);
> thisCal_1.setTime(thisDate_1);
Exactly which line does not compile? What did the compiler say?


-- 
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')





==============================================================================
TOPIC: Sun's JMS API Tutorial: just hangs
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ffd2dbf4cfdc3ba9
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 12:56 pm
From: "TC"  

Andrew Thompson wrote:

> On Thu, 02 Dec 2004 20:24:35 GMT, TC wrote:
> 
> > ...API tutorial ...
> 
> [1]
> 
> > I'm not sure what info to add to the post.  Let me know and I'll
> > add it.
> 
> [1] URL.  As well, add an SSCCE.
> <http://www.physci.org/codes/sscce.jsp>

Er, eh, OK.

I have a client and a server type setting.  Client 1 puts a message
into a queue for client 2 to read out.  Client 1 succeeds in sending
the message.  Client 2 just hangs out there like it's still waiting.
It's like the two machines do not see each other.  If I run the code
for both on one machine, it works.

(all from command line)

Client 1
========
c:\j2ee -verbose

c:\j2eeadmin -addJmsFactory jms/EarthQFC queue -props
url=corbaname=iiop:earth:1050#earth

Client 2
========
c:\j2ee -verbose

c:\j2eeadmin -addJmsFactory jms/EarthQFC queue

Client 1
========
java -Djms.properties=%J2EE_HOME%\config\jms_client.properties
SimpleQueueSender MyQueue 3
(works fine and says 3 messages sent)

Client 2
========
java -Djms.properties=%J2EE_HOME%\config\jms_client.properties
SimpleQueueReceiver MyQueue
(just sits and waits like nothing in the queue)




==============================================================================
TOPIC: New String
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/480ebe0f50a46c11
==============================================================================

== 1 of 2 ==
Date: Thurs, Dec 2 2004 5:58 pm
From: "Ann"  

tnx,

"Yamin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Ann" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> <snip>
> > > That's a NON-PUBLIC CONSTRUCTOR, and "value" is the char[] the
> > > current string is based on, which is referred to in the new String,
> > > not copied.
> > >
> > > Which has exactly the consequences I explained.
> >
> > 1. the word 'new' is used
> > 2. the word 'public' is used
> > Am I still confused? Does 'new' mean 'share'? Does 'public' mean
> > 'NON-PUBLIC'?
>
>
> The world new just creates a new Object.  THis has nothing to do with
> the underlying char[].
>
> Just walk through a simple example.  I will refer to the char array
> inside String as String.charArray which is of type cher[];  This
> example is meant to explain the substring issue.  Don't nitpick
> anything else, like static initialization or the resizing of the
> actual array.
>
> Imagine a String class as follows:
> class String
> {
>   char charArray[] = null;
>   int offset = 0;
>   int length = 0;
>   ...
> }
>
> when you 'new' a String object...all you do is create these 3 members
> initialzed as they are shown above.  Its the contructor that you call
> String with that may or may not do special stuff.  In the case of the
> charArray...it is just like an object.  It points to something.
> Assigning one array to the another does NOT create a copy of all the
> elements.
>
> String foo = "Hello World";
> //this creates a new String object called foo
> //foo.charArray = new char[11];
> //foo.length = 11;
> //foo.offset = 0;
> //the data "Hello World" is copied into foo.charArray
>
> String bar = foo.subString(0,5);
> //this creates a new string object called bar
> //bar.charArray = foo.charArray
> //bar.offset = 0;
> //bar.length = 5;
>
> now suppose foo is no longer needed.  the actual character array
> cannot be deleted because bar.charArray points to the same thing.  So
> now, I'm wasting memory.  In this case, its a trivial amount.  I would
> never advise anyone to actually take any special action here, unless
> they're really doing an extreme case.
>
> like:
> String foo = "Hello World.  My name is Ann...." //use 5 MB worth of
> text
> String bar = foo.subString(0,5);
> //foo is not used again, but bar is
> What i would do now instead is
> String bar = new String( foo.subString(0,5) );
>
>
> Other than cases like this, its not something you should never think
> about.
> On to the other note...when he spoke of NON-PUBLIC constructor, he's
> referring to the fact that the constructor used by substring is not
> available to us regular people.  Just look up the JAVA api for string.
>  You won't find that constructor there.  You can't use that
> constructor.
>
> Yamin





== 2 of 2 ==
Date: Fri, Dec 3 2004 12:46 am
From: Starshine Moonbeam  

In article <[EMAIL PROTECTED]>, Yamin 
([EMAIL PROTECTED]) dropped a +5 bundle of words...

> "Ann" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> <snip>
> > > That's a NON-PUBLIC CONSTRUCTOR, and "value" is the char[] the
> > > current string is based on, which is referred to in the new String,
> > > not copied.
> > >
> > > Which has exactly the consequences I explained.
> > 
> > 1. the word 'new' is used
> > 2. the word 'public' is used
> > Am I still confused? Does 'new' mean 'share'? Does 'public' mean
> > 'NON-PUBLIC'?
> 
> 
> The world new just creates a new Object.  THis has nothing to do with
> the underlying char[].
> 
> Just walk through a simple example.  I will refer to the char array
> inside String as String.charArray which is of type cher[];  This
> example is meant to explain the substring issue.  Don't nitpick
> anything else, like static initialization or the resizing of the
> actual array.
> 
> Imagine a String class as follows:
> class String
> {

You can't have a class String. There already is one automatically 
imported from java.lang

>   char charArray[] = null;
>   int offset = 0;
>   int length = 0;
>   ...
> }
> 
> when you 'new' a String object...all you do is create these 3 members
> initialzed as they are shown above.  Its the contructor that you call
> String with that may or may not do special stuff.  In the case of the
> charArray...it is just like an object.

No, it *is* an object.

java.lang.object
     |
     |
     java.lang.reflect.Array
                      
           

>  It points to something. 
> Assigning one array to the another does NOT create a copy of all the
> elements.

And it's unnecessary. That one array should meet the needs. (That's not 
counting multi-dimensional arrays, of course)

You can assign values to array elements.

whatever[0] = "string"

to search for values use a for loop. (You can also assign values that 
way)

You can even pass the array but you'll still have to either assign or 
search for values.

public void whatever(int[] something) {

}


> 
> String foo = "Hello World";
> //this creates a new String object called foo
> //foo.charArray = new char[11];
> //foo.length = 11;
> //foo.offset = 0;
> //the data "Hello World" is copied into foo.charArray
> 
> String bar = foo.subString(0,5);
> //this creates a new string object called bar
> //bar.charArray = foo.charArray
> //bar.offset = 0;
> //bar.length = 5;
> 
> now suppose foo is no longer needed.  the actual character array
> cannot be deleted because bar.charArray points to the same thing.  So
> now, I'm wasting memory.  In this case, its a trivial amount.  I would
> never advise anyone to actually take any special action here, unless
> they're really doing an extreme case.
> 
> like: 
> String foo = "Hello World.  My name is Ann...." //use 5 MB worth of
> text
> String bar = foo.subString(0,5);
> //foo is not used again, but bar is
> What i would do now instead is
> String bar = new String( foo.subString(0,5) );
> 
> 
> Other than cases like this, its not something you should never think
> about.
> On to the other note...when he spoke of NON-PUBLIC constructor, he's
> referring to the fact that the constructor used by substring is not
> available to us regular people.  Just look up the JAVA api for string.
>  You won't find that constructor there.  You can't use that
> constructor.
> 
> Yamin
> 

-- 
Starshine Moonbeam
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM













==============================================================================
TOPIC: Memory leak
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/03d171ccb3bbc421
==============================================================================

== 1 of 2 ==
Date: Fri, Dec 3 2004 4:23 am
From: "Tim Ward"  

"Anon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a strange problem. There is a memory leak in my application
> which grows steadily even if no action is being performed on it. AFter
> some initial action, when the application is left running with no
> action ebing performed,  the memory usage  by means of the Task
> Manager by process java.exe (virtual machine) grows steadily. But if I
> minimize Command Prompt window, memory drops down (from 100-120MB)
> almost to 10MB. Then it grows again. The memory in the task manager
> keeps on increasing even with no action on the application. COuld
> anyone give a clue on this?

Your application is quite likely not leaking memory - the problema are
simply that you've chosen to write it in Java, which behaves like this, and
that you're trying to make sense of the memory usage reported by Task
Manager, which is sufficiently difficult that it's best regarded as not
possible. If you can't tolerate this behaviour you will need to rewrite in
another language that gives you better control over memory allocation and
also stop looking at the Task Manager figures.

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk





== 2 of 2 ==
Date: Fri, Dec 3 2004 9:12 am
From: "Thomas G. Marshall"  

Anon coughed up:
> I have a strange problem. There is a memory leak in my application
> which grows steadily even if no action is being performed on it. AFter
> some initial action, when the application is left running with no
> action ebing performed,  the memory usage  by means of the Task
> Manager by process java.exe (virtual machine) grows steadily. But if I
> minimize Command Prompt window, memory drops down (from 100-120MB)
> almost to 10MB. Then it grows again. The memory in the task manager
> keeps on increasing even with no action on the application. COuld
> anyone give a clue on this?
> Rdrs,
> Anon


What is the upper bound, or does it keep increasing memory usage until all
VM is sucked dry?

-- 
Iamamanofconstantsorrow,I'veseentroubleallmydays.Ibidfarewelltoold
Kentucky,TheplacewhereIwasbornandraised.ForsixlongyearsI'vebeenin
trouble,NopleasureshereonearthIfound.ForinthisworldI'mboundtoramble,
Ihavenofriendstohelpmenow....MaybeyourfriendsthinkI'mjustastrangerMyface,
you'llneverseenomore.ButthereisonepromisethatisgivenI'llmeetyouonGod's
goldenshore.






==============================================================================
TOPIC: Rules Engines - Best Practices?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a79bfcda56e2b81c
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 7:46 pm
From: [EMAIL PROTECTED] (Edward G. Nilges) 

[EMAIL PROTECTED] (Cindi Jenkins) wrote in message news:<[EMAIL PROTECTED]>...
> Anyone know of best practices for rules engines. The only thing I
> could find was at: 
> http://blogs.ittoolbox.com/eai/leadership/archives/002172.asp

Good site.

See Chapter 8 of my book, Build Your Own .Net Language and Compiler,
for a discussion of one way to implement declarative rules cheaply.
This book was published by Apress in 2004.

This approach is best for small business since within the procedural
context, it can implement declarative structures.

However, it imposes an unfamiliar requirement on the developer, and
this is learning how to build small parsers.

I do address the consistency and completeness problem in this chapter.

I deliberately target small business because my experience in the
large enterprise is that the technology is so black-box as to create
opportunities for contradictory and incomplete rules which can't be
audited.

The advantage of my approach, in which the developers are language
designers and implementers and the end users manage the rules, is that
there is less opportunity for last minute changes to the rules of
which the users are unaware.

In environments using a commercial rules engine, an "expert" on the
engine becomes in effect a coder with the ability to override the
user's changes.

Whereas if the developers are tasked instead with providing languages
to express the rules, their focus is on improving the end user
experience. The end user modifies the rules with better assurance that
the actual rules are being followed.

It's always amazed me that new development projects start with a
committment to cast TODAY's rules into concrete. Large, "Enterprise"
systems are built like old Soviet sports palaces...for the ages...when
change is the name of the game.

I show techniques for managing knee-jerk changes by the empowered end
user to the rules by enforcing full evaluation and consistency, which
of course needs tuning when scaled up, and therefore I propose that
rules engine developers take a look at compiler optimization theory
for ways to pre-evaluate the rules (by means of symbolic
interpretation) for consistency and completeness.

In a scenario, the manager of my hypothetical firm gets mad at his
tenant and in a credit application adds the rule "deny all
renters"...which contradicts other rules that accept renters.

The rules engine points out the contradiction.

In procedural "thinking", an occupational hazard of end users as well
as programmers, the rule If rents->deny should "override" because it
is last in the list and furthermore it is today's priority because the
boss is hopping mad at his renter.

In "declarative" thinking, the end user is held to previous decisions
even if he forgot that yesterday he wanted to do business with
renters.

Part of my motivation was the fact that I'm troubled by a split in the
language of the business rules community.

On the one hand you have terribly abstract discussion of business
rules which gets "deep" only in the area of performance AS IF the
problems of contradictory or non-compliant rules were solved.

On the other you have equally abstract discussions of very advanced
inference engines which are treated as a black box and built by ivory
tower types who have never approved a credit application or reviewed
an immigration application for compliance to the latest rules. We live
in a world where people get Associate degrees in medical billing, but
too often, developers of rules engines somehow think that actually
RELATING their technology to the real world is beneath them.

It's only in the area of small business that you can combine the two
forms of discourse. In the USA, small business is at a disadvantage,
but, working in China, I see it in areas like microcredit as having a
powerful advantage and a need for a rules-based, as opposed to a
procedural-based approach.




==============================================================================
TOPIC: Problem with Tiles/Struts on WSAD 5
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ec359d8e0d5e9d8c
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 5:07 pm
From: [EMAIL PROTECTED] (Gurudev) 

Hi Everybody -

I am following up on my earlier post. I got no responses ...kinda had
a feeling that it got lost in the holiday hoopla ..

Well I kinda have a crude way to get around this ..but a real solution
would be nice ...please yall take a look at the post below.

Thanks again ..
Guru.

[EMAIL PROTECTED] (Gurudev) wrote in message news:<[EMAIL PROTECTED]>...
> Hello !
> 
> IDE: WSAD 5
> AppServer: WTE/WAS
> Struts 1.1b
> 
> In my defintions file I'm extending a base definition  and overriding
> the param if needed.
> Now since the base def param has a empty( or null ) value I get the
> following error:
>     [ServletException in:] Response already committed.' 
> 
> This seems to work fine if a valid value (some jsp) is provided 
> 
> In the below scenario my ActionFwd is to "app1ReqView". Meanwhile I
> also tried setting the ignore="true" attribute and removing the
> deifintion from the baseView. Didn't work :(
> 
> The thing I dont understand is ever after the above message the
> remaning tiles( in this case the button tile and message.jsp) seem to
> display properly.
> 
> I am not sure if this is a tiles bug or If i am not getting something
> right.
> 
> TIA,
> Guru.
> 
> Below are excerpts from my definitions file and the layout. The
> problem tile/param is "admData"
> 
> <tiles-definitions>
>       <definition name="baseView" path="/layouts/tiletemplate.jsp">
>               <put name="title" value="" />
>               <put name="formAction" value="" />
>               <put name="commonData" value="/tiles/common.jsp" />
>               <put name="systemData" value="" />
>               <put name="admData" value="" />
>               <put name="button" value="/tiles/buttonreq.jsp" />
>       </definition>
> 
>       
>       <definition name="app1ReqView" extends="baseView">
>               <put name="title" value="BOSS System Request" />
>               <put name="formAction" value="/reqsubmit.do?reqsys="app1" />
>               <put name="systemData" value="/tiles/app1.jsp" />
>       </definition>
> 
>       <definition name="app1AdmView" extends="app1ReqView">
>               <put name="formAction" value="/admsubmit.do?reqsys=app1" />
>               <put name="admData" value="/tiles/app1adm.jsp" />
>               <put name="button" value="/tiles/buttonadm.jsp" />
>       </definition>
> 
>         .....
>         .....
> 
> tiletemplate.jsp:
> 
> <%@ page language="java" %>
> <tiles:useAttribute name="formAction" classname="java.lang.String"
> scope="page" />
> <html:html>
> <head>
>       <link href="<%=request.getContextPath()%>/themes/app.css"
> rel="stylesheet" type="text/css">
>       <script language="javascript"
> src="<%=request.getContextPath()%>/javascript/apputil.js"></script>
>       <title><tiles:getAsString name="title" /></title>
> </head>
> <body onload="initialize()" class="appform" leftmargin="0"
> topmargin="0" marginwidth="0" marginheight="0">
> <h4 class="heading"><tiles:getAsString name="title"/></h4>
>       <form name="masterform" styleClass="appform" method="POST" 
>               action="<%=request.getContextPath()%><%=formAction%>">
>               <tiles:get name="commonData" />
>               <tiles:get name="systemData" />
>               <tiles:get name="admData" ignore="true" />
>               <br>
>               <tiles:get name="button" />
>               <br>
>       </form>
>       
>       <%-- Display messages if any --%>
>       <tiles:insert page="/tiles/messages.jsp" />
> 
> </body>
> </html:html>




==============================================================================
TOPIC: My understanding in "new" keyword
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/62e90e8bce4915a9
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 10:15 pm
From: Starshine Moonbeam  

In article <[EMAIL PROTECTED]>, Bruce 
Sam ([EMAIL PROTECTED]) dropped a +5 bundle of words...

> I think,if not use the "new" keyword,it will not create an object,only
> create a reference.For example, String str = "ab";

Actually, for a String, it'll do exactly that. Repetition of that will 
just create a new memory reference though. Unless you use new, the 
string will only be created once. You don't need to ever 
use String whatever = new String(); unless you want to. I'm not 
sure if other classes do it (can't think of any) but I know String does 
for sure. If you later instantiate say String str = new String("the 
exact same thing"); and try to determine equivalency using == it comes 
back false. Always use the equals method to determine equivalency of 
strings.

boolean x = string1.equals(string2);

AHA! Primitive types. That's what I was thinking of. You don't need to 
use new for the primitive types.

int x = 4;

is the same as

Integer xx = new Integer(4);

x == xx; // returns true

StringBuffer you have to use new for. 

> only create a
> reference.But when I use "String str = new String("ab");",here will
> create an string object and a reference str point to it.
> Is it right?
> 
> 

-- 
Starshine Moonbeam
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM













==============================================================================
TOPIC: Java 1.5 where to get info from ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3d8a99f29fbf389b
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 3 2004 4:03 am
From: [EMAIL PROTECTED] (Steve Webb) 

Hi I've read a little about java 1.5 and the language changes but
there also seems to be a whole load of API changes  & additions. Is
there a site that lists not just all the language changes but also all
the other changes that have taken place ?

Cheers

Steve Webb




==============================================================================
TOPIC: Running programs in (networked) DOS window
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f76fd24178be761c
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 3:32 pm
From: Steve Horsley  

TC wrote:
> I'm new to Java and working on some examples so I hope this comes out
> correct.
> 
> Win2K
> J2EE 1.3
> 
> I have a networked drive (f:) where I want to run a java program.  This
> is another physical machine.  I'm using the DOS window to access this
> drive.
> 
> Then, I want to use a local drive (c:) to run another java program.
> These two programs will "talk" with each other via "topic" (JMS).
> 
> My question:  Will the program on f: be actually running on the other
> machine or is the code and memory pulled over to the local machine that
> is mapping the drive?
> 
> I hope that makes sense.

The program on F: will be downloaded into the memory of the local machine,
and then executed by the local machine CPU. The only code run on the remote
machine will be its file-sharing code.

Steve




==============================================================================
TOPIC: how to fix the JFrame size?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ebe9bc0e6b94d453
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 8:01 pm
From: "nick"  

i want to fix the JFrame size , make it can't resize

thanks! 






==============================================================================
TOPIC: ejb-ref-name question?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7846db243c373d79
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 3 2004 2:43 am
From: "harry"  

I have an EAR file containing several stateless session EJB's

1 EJB (say EJB1) uses methods on another EJB (EJB2)

Reading about "ejb-ref-name", apparently I have to have this set in my
ejb-jar.xml file for EJB1 to ref EJB2

Currently I do not have this set but can reference EJB2 no problem at all
using something like (forgive typos) -

EJB2Remote ejb2Home = (EJB2RemoteHome)
ServiceLocator.getInstance().getRemoteHome("EJB2", EJB2RemoteHome.class);
ejb2 = ejb2Home.create();

// service locator code
public EJBHome getRemoteHome(String name, Class homeClass) throws
NamingException
{
  Object objref = context.lookup(name);
  EJBHome home = (EJBHome) PortableRemoteObject.narrow(objref, homeClass);
  return home;
}

The article also says to use "java:comp/env/ejb/EJB2" not just "EJB2"

So do I need "ejb-ref-name" set & should I be using "java:comp/env/ejb/"?

Just can't see the difference!

many thanks

harry







==============================================================================
TOPIC: Free java game ( may play via bluettoh)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6440332f2e3e0774
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 2 2004 11:39 pm
From: [EMAIL PROTECTED] (Klio) 

Hi everbody,
I found cool game :) . Link is:
http://www.bonex-inc.com/mgame.htm




==============================================================================
TOPIC: Application in sandbox
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821eb31df84b5c4a
==============================================================================

== 1 of 1 ==
Date: Mon, Nov 29 2004 12:12 am
From: Tim Tyler  

Jean Lutrin <[EMAIL PROTECTED]> wrote or quoted:

> As I already said, I belong to this very small (and not very
> vocal) minority that happens to think that Un*x + Java is a
> wonderfull setup for a developer (most Java developer use Windows
> and most Un*x users have a grip with Java not being true
> Open Source Software).

IMO, they have a good point.

The fact that Java is proprietary, commercial software is its
biggest weakness - in my book.

Nobody in their right mind wants to build their house on land
owned by someone else.
-- 
__________
 |im |yler  http://timtyler.org/  [EMAIL PROTECTED]  Remove lock to reply.




==============================================================================
TOPIC: Ant vs Makefiles
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e81556a5c62ba767
==============================================================================

== 1 of 1 ==
Date: Mon, Nov 29 2004 5:01 am
From: bugbear  

Mike Schilling wrote:
> "Ann" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> 
>>Great, then maybe you can suggest a solution for me since I am
>>new to Ant. I have a file that contains mostly constants. When
>>it changes there are a dozen other files that must be recompiled.
> 
> 
> 
> It's funny, but for all of its reputation as the premier build tool for 
> Java, Ant doesn't do thorough dependency checking.

It's not funny ; it's very annoying.

Whilst make is built around the concept of file-dependancies,
and has powerful tools for expressing these in general ways
(e.g. pattern dependancies), and is built around
target dependancies. Many of the commands in Ant
implement their own file dependancy functionality
(nice code architecture, I don't think).

There is a desperate kludge within ant in the "dependset"
task, but using it is verbose and ugly.

I like the platform portability of Ant, and the ability
to add (java implemented) extensions, but I'd have strongly
preferred to have retained the elegant dependancy model
of make.

Life might have been so different if Ant's author
had found a decent text editor. One of the prime motivations
seems to have been avoiding the use of tab's in the control
file!

     BugBear




==============================================================================
TOPIC: Rules Engines - Best Practices?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29c872a53d183689
==============================================================================

== 1 of 1 ==
Date: Mon, Nov 29 2004 5:05 am
From: [EMAIL PROTECTED] (Cindi Jenkins) 

Anyone know of best practices for rules engines. The only thing I
could find was at: http://blogs.ittoolbox.com/eai/leadership/archives/002172.asp




==============================================================================
TOPIC: BigDecimal: Sun? IBM?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d8e6c9d469d029de
==============================================================================

== 1 of 2 ==
Date: Fri, Dec 3 2004 6:01 am
From: Michael Borgwardt 
 

wald wrote:
> I'm considering using the java.math.BigDecimal class for a 
> simulation program I'm working on.

Why? For numerical arithmetic, the issues with exact rounding and decimal
representation that BigDecimal solves are usually not an issue, and using
plain float or double is much, MUCH faster.



== 2 of 2 ==
Date: Fri, Dec 3 2004 6:34 am
From: wald  

Michael Borgwardt <[EMAIL PROTECTED]> wrote:

> wald wrote:
>> I'm considering using the java.math.BigDecimal class for a 
>> simulation program I'm working on.
> 
> Why? For numerical arithmetic, the issues with exact rounding
> and decimal representation that BigDecimal solves are usually
> not an issue, and using plain float or double is much, MUCH
> faster. 

I'm simulating growth models where some quantities evolve from quite 
large to very small values, approaching zero in the limit. So, 
calculations with these quantities end up in divisions of numbers of 
quite different magnitudes. I'm afraid that the limitations of 
floating point arithmetic will have more influence than I can 
tolerate, especially since the accuracy of simulation results is 
quite important in those low-quantity situations...

Wald




==============================================================================
TOPIC: Unable to establish a socket connection
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3db1070c05ec0b49
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 3 2004 9:04 am
From: [EMAIL PROTECTED] (S J Rulison) 

One more thing:

I'm still puzzled by this getCodeBase()getHost() method.  If I'm
running the Server program from a PC named JServer and I'm loading the
Applet on a different PC, even if the applet.class file is stored on
the hard-drive of JServer, how will the getCodeBase()getHost() method
know to point to the PC named JServer?  Is there something I need to
do to publish the java server application?  Something that tells the
getHost() I'm JServer, a JAVA Server, and HERE I AM!

Keep in mind that JServer is nothing more than a PC running windows XP
with my java server application running on it.  I don't have any type
of Windows XP Internet Server processes running on it.  When I here
words like ORIGINATE or CALL BACK TO THE SERVER, the only thing that
means to me is that the java applet, Applet1.class and Applet1.html
are both stored on the hard-drive of the JServer PC.  When I load
Applet1.html, I have to point the web browser to the JServer PC and I
guess that process alone could pass along the host information but if
there is something more to it than that, please let me know.

Thanks for your help.


<snippet>
public class Applet1 extends Applet
{

 /*
How does the getHost() method know that I want to point to JServer as
opposed to any of the other PCs on the network?
*/

 public void init() {
  System.out.println("getCodeBase(): '" +
   getCodeBase() + "'" );
  System.out.println("getCodeBase().getHost(): '" +
   getCodeBase().getHost() + "'" );

  connect(getCodeBase().getHost());
 }

 public static void connect(String host)
 {
  try
  {
   Socket s = new Socket(host, 1427);
</snippet




==============================================================================
TOPIC: Update your VM gentlemen, sun made a mistake.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/0d5689b8341eb5c3
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 3 2004 4:59 am
From: Andrew Thompson  

On Fri, 3 Dec 2004 11:20:45 -0000, MaSTeR wrote:

> http://sunsolve.sun.com/search/document.do?assetkey=1-26-57591-1&searchclause=

For quick further details, check Nigel Wade's post.
<http://groups.google.com/[EMAIL PROTECTED]>

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



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

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

To post to this group, send email to [EMAIL PROTECTED] or
visit http://groups-beta.google.com/group/comp.lang.java.programmer

To unsubscribe from this group, send email to
[EMAIL PROTECTED]

To change the way you get mail from this group, visit:
http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

To report abuse, send email explaining the problem to [EMAIL PROTECTED]

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

Reply via email to