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

Today's topics:

* Implications of not closing db connection? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8a87f5b36905f3d0
* javax.xml.Parsers location - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a06eb697f944bccf
* Invalid cast type error - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c6c14ff7e51a601
* Using the 'this' keyword. - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7ab8e9b27d4d517
* Process.destroy() on Win32 - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2677bdb23c8cb84b
* Debate: Inner classes or public classes with package access? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9bc4ea5509bc807
* Synchronized Not Working - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58d8bf5c4828ced5
* PRINTING DIAMOND SHAPE WITH LOOPS! - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/56cb33b6025f97a2
* Need help w. ResourceBundle - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d8c73483d1b1e40c
* jgrasp startup error - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90e7404357b39172
* How to do bitmap icon in front of menu-items in Java? what is the class for 
menu-item in Java? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ac74a360cb38fcd
* applets, applications & beans - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5eed53393e937afa
* ExitValue from Runtime Process not returning - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32e03377219726c0
* How to know when a db connection is free? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f3cdde729252b714
  
==========================================================================
TOPIC: Implications of not closing db connection?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8a87f5b36905f3d0
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 4:28 pm
From: "vivienne wykes" <[EMAIL PROTECTED]> 

Thanks Scott,

All this information will assimilate in between long days enjoying the
Edinburgh Festival.

Time out to enjoy a holliday at home...

Cheers
"vivienne wykes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi All,
>
> Could anyone explain simply the implications of not closing a
> resultset,statement, and connection as shown below or provide a link to an
> explanation ?
>
> I had a problem on a shared server (resin) and I think my webapp was
causing
> an issue for other server users by not closing the db connection.
>
> Is it a case of that there is certain amount of connections available to a
> server and not closing the connection ?
>
> Any guidance appreciated.
>
> Regards
>
>
> Code below
>
> <%
>    //-------------------make
connection-------------------------------------
>
>    Class.forName("org.gjt.mm.mysql.Driver");
> java.sql.Connection connection =
> java.sql.DriverManager.getConnection("jdbc:mysql://localhost/shop");
>    java.sql.Statement statement = connection.createStatement();%>
> &nbsp;</td>
>         </tr>
>         <tr valign="top" class="footer">
>           <td height="25" colspan="2" class="bodytext"> <%
> if(session.getAttribute("welcome") != null) { %> <h3> <%=
> session.getAttribute("welcome") %> </h3>
>             <%String weddingid=request.getParameter("weddingid");
>      if (!weddingid.equals("paulonly")){%>
>             Click <a href="<%=
> response.encodeURL("shop-products.jsp?weddingid="+weddingid) %>">here</a>
>             to view your wedding pictures
>             <%}
>      else {%>
>             Click <a href="<%=
> response.encodeURL("pauls_jedi_interface.jsp") %>">here</a>
>             to enter JEDI
>             <%}
>              } else { %>
>             Please log in below to continue...
>             <form action="<%= response.encodeURL("db-result.jsp") %>"
>         method="get">
>               <table class="bodytext">
>                 <tr>
>                   <%java.sql.ResultSet RS3 =
statement.executeQuery("SELECT
> * FROM items ORDER BY weddingid");%>
>                   <td nowrap>Select Wedding:</td>
>                   <td><select name="weddings_to_view" class="dropdown"
> onChange="MM_jumpMenu('parent',this,0)">
>                       <option selected><%=selected%></option>
>                       <%while(RS3.next()){//open while
>  String weddingid2 = RS3.getString("weddingid");
>  if (!last_wedding_id.equals(weddingid2)){// open if%>
>                       <option
>
value="<%=response.encodeURL("db-login.jsp?selected="+weddingid2)%>"><%=wedd
> ingid2%></option>
>                       <%} //close if
>  last_wedding_id = weddingid2;
> }//close while
>
>   //-------------------close result set close statement close
> connection-------------------------------------
>
> RS3.close();
>   statement.close();
>   connection.close();%>
>
>






==========================================================================
TOPIC: javax.xml.Parsers location
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a06eb697f944bccf
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 4:33 pm
From: "Allen Chee" <[EMAIL PROTECTED]> 

Just download JDK1.4 above. It comes with it.

"Gibakou" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Does anybody know where could I download the javax.xml.parsers package
> from? I'm new in the java-xml field...







==========================================================================
TOPIC: Invalid cast type error
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c6c14ff7e51a601
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 4:44 pm
From: "fg" <[EMAIL PROTECTED]> 

> public void method(Integer i)
> {
> }
> public void method(String s)
> {
> }
>
> If dynamic casting were possible and overloaded methods
> not bound statically, you could do
>
> Object o = returnSomethingThatMightBeAStringOrAnInteger();
> method((o.getClass)o);
>
> to automatically call the appropriate method.

In fact you can...
By creating a third method :
public void method(Object o)
{
  if (o instanceof Integer)
  {
     method((Integer)o);
  }
  else if (o instanceof String)
  {
     method((String)o);
  }
  else
  {
     System.err.println("Error, 'o' is not an Integer nor a String...");
  }
}

The point is that if you create a new method
public void method (Long l)
{
}

you must change the method(Object o) to add this possibility.

so if you really want to go over this problem, you can write :

public void method(Object o)
{
  Class c = o.getClass();
  try
  {
    Method meth = this.getClass.getDeclaredMethod("method", new Class[]{c});
  }
  catch (NoSuchMethodException e)
  {
    System.err.println("Error, 'o' is not a supported Object... Its class is
: " + o.getClass());
    e.printStackTrace();
    return;
  }

  meth.invoke(this, new Object[]{o});
}

this code assumes that the methods "method" are inner methods of the current
object ("this", as it is referenced to get the Method object, and to invoke
it).



The pleasure is mine.

Frédéric (French, you may have guessed...)






==========================================================================
TOPIC: Using the 'this' keyword.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7ab8e9b27d4d517
==========================================================================

== 1 of 3 ==
Date:   Fri,   Aug 27 2004 4:51 pm
From: "fg" <[EMAIL PROTECTED]> 

> I'm wondering what others think...
>

Personnaly (and i got this technique from an entreprise I  worked for), I
use special prefixes :
for example :
public class MyClass
{
  String mObjectName = null;

  public void setName(String pName)
  {
    mObjectName = pName;
  }

  private void complexMethod()
  {
    //Some code
    String lField = getSomeResult();
    useThisString(lField);
    //etc
  }
}

As a conclusion :
prefix "p" for *p*arameters
prefix "l" (L lowercase) for *l*ocal fields
prefix "m" for global fields (I don't know why "m", they used it, so I used
to code the same way....)



The honnor is mine.

Frédéric.





== 2 of 3 ==
Date:   Fri,   Aug 27 2004 8:00 pm
From: "Woebegone" <[EMAIL PROTECTED]> 


> prefix "m" for global fields (I don't know why "m", they used it, so I
used
> to code the same way....)

m for *m*ember. At object scope though, not global.

-- 
Sean.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.744 / Virus Database: 496 - Release Date: 24/08/04





== 3 of 3 ==
Date:   Sat,   Aug 28 2004 1:03 am
From: Jacob <[EMAIL PROTECTED]> 

Harry Colquhoun wrote:

> For my current job I've encountered a java coding 'technique' in the
> existing code that has me scratching my head.  Most places in the code
> where a method variable is referenced, the previous programmers prefix
> the variable with the "this" keyword 

Identifying class variables are important as they
they have more significance than method variables
and parameters.

I'd find the "this." prefix strange though, as it
somewhat violates data encapsulation; It makes an
object aware of itself _among others_ (I am special,
I am "this"). This is meta-information that only the
programmer or higher level objects should be aware of.

A common technique is to identify class variables
by underscore suffix. See for instance
http://geosoft.no/development/javastyle.html
rule #8. Be careful with variable name _prefixes_
(such as "m" or "_" etc.) as they tend to reduce
the  readability of the name.

A side effect of the name suffix is that it nicely
resolves the problem of finding good variable
names for setter methods:

  void setName (String name)
  {
    name_ = name;
  }





==========================================================================
TOPIC: Process.destroy() on Win32
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2677bdb23c8cb84b
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 5:18 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Joshua Jones wrote:

> Running on Win2k.  I have something like this:
> 
> AntThread.java
> ==============
> Process p;
> try {
>     p = Runtime.getRuntime().exec(commandLine);
>     ...
>     p.waitFor();
> }
> ...
> catch (InterruptedException e) {
>     p.destroy();
>     p = null;
> }
> finally {
>     cleanup();
> }
> ==============
> 
> Another thread calls AntThread's interrupt() method, and I get to the
> InterruptedException catch block.  For some reason, however, this
> process (an ant build process, which itself uses java) does not end.
> I continue getting output from it, and only if I kill the process
> manually through the task manager will it stop.
> 
> I can't get the PID from Java or anywhere else, which would be kludgy
> anyway.  Does anyone know why the destroy() method is not destroying,
> or better yet, a solution?

The problem appears to be p.waitfor(), which locks the thread. In this
arrangement, when you interrupt the thread, the InterruptedException may
not be executed.

This is just a guess.

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





==========================================================================
TOPIC: Debate: Inner classes or public classes with package access?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9bc4ea5509bc807
==========================================================================

== 1 of 2 ==
Date:   Fri,   Aug 27 2004 5:49 pm
From: "P.Hill" <[EMAIL PROTECTED]> 

Christian Bongiorno wrote:
> However, doing that forces me to grant public access to some of the
> members in a class that would otherwise be private since, they are
> useless outside of my Main panel window.

You got something against default (package) access?

"The default access is that a member can be accessed anywhere within the package 
that contains its declaration; other possibilities are public, protected, and 
private."

    -- JLS Chapter 6
     http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html




== 2 of 2 ==
Date:   Sat,   Aug 28 2004 12:49 am
From: Oscar kind <[EMAIL PROTECTED]> 

Christian Bongiorno <[EMAIL PROTECTED]> wrote:
> I am a fan of Inner class. Names Inner classes that is. The un-named
> kind are not fit to see the light of day.

Anonymous inner classes can be ideal to connect for example Swing
interface components to your application. Of course, such an inner class
is not likely to implement more than one method.


> Ok, that being said, I find myself in a situation where I have
> numerous Inner support classes, all of them are related to events,
> JTables and such that exist in my display. (the current working outter
> class).
> 
> However, having 15 inner classes has become tedious to manage at times
> and ties your hands slightly (for example, you can't use static in an
> inner class if you want a singleton model).

Using named inner classes for such tasks creates extra work: you define
and instantiate them in different places, and they still don't need more
than one member function to call the API of your business model layer.

IMHO, this is the cause for the tediousness.


[...]
> I am just curious as to what the current consensus is on this topic.
> From an OO standpoint? From a supportability standpoint? Cleanliness? 
> Access standpoint?

My opinions on the matter:

OO:
        Don't locate the support classes in a different package. In fact,
        because of the minimal content required, inner classes are ideal.

Supportability:
        Using anonymous inner classes defines a simple class with (often) one
        method right where it's used. And since such code is not often reused
        -- a GUI rarely has several buttons that do exactly the same -- there
        is no code duplication.

Cleanliness:
        For me an anonymous inner class is a clear winner to handle events in
        a GUI:
        - it's s simple construct for a trivial task (calling your business
          model layer to perform business logic)
        - it does almost nothing, so it doesn't interrupt the flow of the code
        - Since it's anonymous, there only is the public API of it's interface
          and/or superclass. Also, it can only access method parameters or
          final members of the defining class. Thus there are no problems of
          accessing too much or too little information.

Access:
        Your original inner classes are a good idea. So are anonymous inner
        classes.


-- 
Oscar Kind                                    http://home.hccnet.nl/okind/
Software Developer                    for contact information, see website

PGP Key fingerprint:    91F3 6C72 F465 5E98 C246  61D9 2C32 8E24 097B B4E2




==========================================================================
TOPIC: Synchronized Not Working
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58d8bf5c4828ced5
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 8:00 pm
From: "Tony Morris" <[EMAIL PROTECTED]> 

Is the method called on the same instance (which acts as the mutex) ?
If not, produce a better test case that demonstrates your misunderstanding.
As it stands, your description is potentially erroneous. Since the basis for
your claim is blatantly incorrect ('synchronized' not working), it's
difficult to trust your description of the scenario -- complete, compilable
source code might help point out your problem.

-- 
Tony Morris
http://xdweb.net/~dibblego/







==========================================================================
TOPIC: PRINTING DIAMOND SHAPE WITH LOOPS!
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/56cb33b6025f97a2
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 9:46 pm
From: [EMAIL PROTECTED] (Jay Dean) 

Okay, Paul, et al.,
   I tried the implementation of the shape again. This time I came soo
close. My main problem is where I have indicated with (---) in the
second else if condition. If you remove && j< (----) from it and test
it, you will see exactly what I am talking about. If I
replace(----)with m, where m is an int m=n; and then put m--; after
j++; at the end of the outer loop, it does not work. I would
appreciate your help with this.
   Also, I have a few questions below the code I need help with:
  
   int n=7,marker=(n/2)+1,i=1,j=1;
   
   while(i<=n)
   {
        while(j<=n)
        {
         if((i<marker)&&((marker-i)<j && j <(marker+i)))
           {System.out.print("*");}
           
         else if((i==marker))
           {System.out.print("*");}  
           
         else if((i>marker)&&((i-marker)<j  && j < (----)))
         {System.out.print("*");}
         
         else 
           {System.out.print(" ");} 
         j++;
        }
   System.out.println("");
   i++;
   j=1;
   }

 - In Java, if say I print out 7 rows of stars and at the end I want
to go back to the very beginning of the first line, or any other line
apart from the last one,how do I do that?

 - My guess is that (boolean)?(true):(false); is some sort of a
condensed if-else clause. If so, is there a limit on the lines of code
that one can put in place of the (true) and the (false)?

 - If say, 5 rows of dots are printed using System.out.print(ln), to
the screen, is it possible to create a second code that traverses the
dots and removes or erases some of them as I wish?

 - Does the Java API provide any info on ALL Java operators and
symbols?

I would appreciate your help.Thanks..

Jay Dean

        

Paul Lutus <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Jay Dean wrote:
> 
> > Paul,John,Adam,Liz, at al.,.
> >        Thank you all for your individual help and input into trying to
> > helping me. Sorry, all I needed was one sentence:"Post your code that
> > is not working". Instead, I was subjected to all sorts of unfair
> > stereotypes.
> 
> Neither unfair nor a stereotype. Applying a sterotype would have required us
> to use our misguided imaginations instead of the content of your posts.
> There was no need for that. You asked a student question, then claimed
> falsely not to be a student, while explaining what kind of student you are.
> No imagination required.
> 
> But we can move past that, yes?
> 
> >        Anyway, I tested John and Paul's codes in a main method and
> > they worked perfectly,even thogh Paul intentionally meant to confuse
> > me.
> 
> No, not at all. I meant to write a concise, efficient embodiment of the
> algorithm. Its complexity to a student was a coincidental side effect.
> Experienced programmers can see how it works at a glance. This makes it
> space-efficient without sacrificing comprehensibility and maintainability.
> 
> >         However, I have two main issues...
> >  (1)I STILL want HELP to implement the method with one of my OWN
> > UNFINISHED codes below
> 
> That's more like it. We are much happier helping you with your own code. You
> have no idea how much more acceptable this is.
> 
> > and 
> > (2) I would like you to help me understand your code with clear
> > commenting if possible..., especially, does a "-" sign in front of an
> > int variable imply ("opposite direction")?
> 
> No, it is called a unary operator: -1 means "minus one". In the same way, -x
> means "minus x".
> 
> > Also, what do the symbols 
> > ?,:,etc mean in Java?
> 
> In this specific example it means:
> 
> (logical true-false test)?(do this if true):(do this if false);
> 
> Like this (not compiled or tested):
> 
> int x = -1;
> 
> System.out.println((x < 0)?"X is less than zero":"X is equal to or greater
> than zero");
> 
> > (1). Here's one of my many attempts that I have struggled with for
> > days:
> 
> Okay, with all respect I ask that you abandon this code entirely and start
> with something simpler.
> 
> >      if(i=((n+1)/2)+1) break;
> 
> And please do not use "break" in a program of this kind! This is very bad
> practice. Constructs like "break" have a place, but they are very much out
> of place in a simple, deterministic algorithm like this.
> 
> 1. "Divide and conquer." Start with something simple, make it work, be sure
> you understand it, and move on. Do not try to solve the entire problem in
> one go.
> 
> 2. Experiment with loops that create a row of spaces or a row of asterisks.
> Think about how they work. Do not get bogged down with ambitious blocks of
> code meant to solve the main problem, but that end up not doing what you
> want and that you are unwilling to abandon.
> 
> 3. Think about the logical flow of the program, and how to derive all the
> required values from a few variables and control structures. Build
> something easy first, before moving on to the main task.
> 
> 4. Avoid "break." Breaks are innately confusing and to be avoided. Including
> a break in a program is in most cases an admission of defeat in sorting out
> a logical control flow for the algorithm.
> 
> With all respect, fixing the code you posted would not be particularly
> productive, although I want to say it sends a very positive signal of your
> seriousness, and you are to be commended for doing it.




==========================================================================
TOPIC: Need help w. ResourceBundle
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d8c73483d1b1e40c
==========================================================================

== 1 of 2 ==
Date:   Fri,   Aug 27 2004 9:58 pm
From: "Mr. Steve R. Burrus" <[EMAIL PROTECTED]> 

Hi all, I am working on a simple "HelloWorldExample.java" servlet, and there
are 2 lines of code in it:  "ResourceBundle rb =
            ResourceBundle.getBundle("LocalStrings",request.getLocale());",
and it compiles okay for me, but when I try to execute it in my browser, I
get all sorts of "MissingResourceExceptions" java exceptions!!

 What could possibly be wrong anyway??? The  "LocalStrings" mentioned as an
argument to the "getBundle" method are about 3 different languages, English,
French, and Spanish, and the whole servlet is designed to output a simple
greeting in those 3 languages. I of course checked the logs for the tomcat
server which I am using, but it really was of no help at all in trying to
figure out what is wrong. CaN someone please help me? I would greatly
appreciate it.





== 2 of 2 ==
Date:   Fri,   Aug 27 2004 10:29 pm
From: "Tony Morris" <[EMAIL PROTECTED]> 

Put the resource bundle (properties files?) on the classpath to be loaded as
a resource by the class loader.
For example, in the root of the war, or in WEB-INF/classes.

-- 
Tony Morris
http://xdweb.net/~dibblego/






==========================================================================
TOPIC: jgrasp startup error
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90e7404357b39172
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 10:20 pm
From: "Hal Rosser" <[EMAIL PROTECTED]> 

> Most likely the OP wants to compile Java code, but
> people do use jGRASP for editing and compiling the
> other languages it supports -  C, C++, Objective-C,
> Ada, VHDL.
>
>
Hey! Wait a minute - you WROTE JGrasp - I bow to your expertise. - sorry



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.744 / Virus Database: 496 - Release Date: 8/24/2004






==========================================================================
TOPIC: How to do bitmap icon in front of menu-items in Java? what is the class for 
menu-item in Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ac74a360cb38fcd
==========================================================================

== 1 of 2 ==
Date:   Fri,   Aug 27 2004 11:47 pm
From: "gino" <[EMAIL PROTECTED]> 


"Paul Lutus" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I repeat:
>
> >> 1. JPopupMenu is not a menu item.
> >> 2. JMenuItem is.
> >> 3. JMenuItem has a setIcon method.
>
> Time to read the documentation. JMenuItem.setIcon().
>

I understood you perfectly. JMenuItem has a setIcon method that can allow me
to put a bitmap icon easily...

but JPopupMenu is not, so it does not have that setIcon() method, so I asked
what to do with this JPopupMenu...(I asked this part...)





== 2 of 2 ==
Date:   Sat,   Aug 28 2004 12:23 am
From: Paul Lutus <[EMAIL PROTECTED]> 

gino wrote:

> 
> "Paul Lutus" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> I repeat:
>>
>> >> 1. JPopupMenu is not a menu item.
>> >> 2. JMenuItem is.
>> >> 3. JMenuItem has a setIcon method.
>>
>> Time to read the documentation. JMenuItem.setIcon().
>>
> 
> I understood you perfectly. JMenuItem has a setIcon method that can allow
> me to put a bitmap icon easily...
> 
> but JPopupMenu is not, so it does not have that setIcon() method, so I
> asked what to do with this JPopupMenu...(I asked this part...)

JPopupMenu is not a visible element of your program. Only its JMenuItems
are.

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





==========================================================================
TOPIC: applets, applications & beans
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5eed53393e937afa
==========================================================================

== 1 of 1 ==
Date:   Sat,   Aug 28 2004 1:00 am
From: "Jeremy Watts" <[EMAIL PROTECTED]> 

am i right in thinking that 'applets' are compiled, and 'applications' are 
interpreted?  i'm reading this confusing book on java and i cant quite get 
to the difference between the two.

so what about 'beans', how are they used typically?

i'm in the process of writing a maths program thats to be used within a 
brouser.  now i've used PHP to write it and its taking several minutes to 
run, because PHP is an interpretor, and so slower.  so what i need is a 
compilable language.


thanks 






==========================================================================
TOPIC: ExitValue from Runtime Process not returning
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32e03377219726c0
==========================================================================

== 1 of 1 ==
Date:   Sat,   Aug 28 2004 1:07 am
From: Gordon Beaton <[EMAIL PROTECTED]> 

On Fri, 27 Aug 2004 20:00:12 GMT, Liz wrote:
> "Gordon Beaton" <[EMAIL PROTECTED]> wrote
>>   while ((line = in.readLine()) != null)
> 
> I use this myself, but when I run "jikes +P <filename>"
> to find errors it says that this is too complicated.
> (compound statement)
> What would you recommend that is not?

I think the example is clear and concise, and that jikes is being too
picky.

This seems to be a common alternative:

  line = in.readLine();

  while (line != null) {
    // do some stuff with line
    [...]
    
    line = in.readLine();
  }

...but I find it unnecessarily verbose, and the logic isn't quite as
clear when code is repeated outside and inside the loop. This is
especially true when the missing stuff, which could be long, gets
filled in.

There are surely other ways to do the same thing, but my example is a
common idiom that most programmers will recognize immediately.

/gordon

-- 
[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e




==========================================================================
TOPIC: How to know when a db connection is free?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f3cdde729252b714
==========================================================================

== 1 of 1 ==
Date:   Sat,   Aug 28 2004 1:58 am
From: [EMAIL PROTECTED] (Jonck van der Kogel) 

Michael Borgwardt <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> 
> else what? is exactly the question. In most cases, there will not be a useful
> alternative, so you might as well wait until the connection is "free".
> This is exactly what java's synchronization does, and I suspect that
> most, if not all, implementations of JDBC connections are synchronized for
> exactly that reason, so that no "weird stuff" happens.
> 
> So you actually don't have to do anything at all. You problem is already solved.

Ahhh... great, thanks!



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

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/prefs

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 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to