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

Today's topics:

* Thread synchronization - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
* Java trick - 4 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad
* Tomcat 5.028 Struts problem - struts-config.xml does not start with a "/" character 
- 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/54504892241d7ccf
* HTML Applet Code - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c474db6bb89b26e
* what u program? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410
* How to incremet IndetAddress / IP numbers - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94897e32234ceaaf
* test if the string is a blank data string - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/681d0b9bedeb1d23
* newbie RMI User - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/af49b3bdfce876e4
* update doesnt´t work ? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3619d270a4e29711
* Can I implement INSERTs and DELETEs in DAOs or only in EntityBeans? - 1 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/44068d680f903d5e
  
==========================================================================
TOPIC: Thread synchronization
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 17 2004 8:16 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Mike Schilling coughed up:
> "Thomas G. Marshall"
> <[EMAIL PROTECTED]> wrote in
> message news:[EMAIL PROTECTED]
>>
>> He would be aided by being able to extend a synchronized collection
>> class. The problem is that you can get a synchronized collection at
>> runtime, but they do not seem to allow you to grab one at compile
>> time because the class
>> is package scope.  I find that limitation a /tad/ curious.
>
> The class is just a wrapper, though.  It provides synchronization, but
> relies on the wrapped object to implement all of the Collection
> semantics. Are you wondering why it wasn't implemented as an
> accessible class like the IO filters, e.g.

The decorator pattern that java.io uses?  No.


>
>     public SynchronizedCollection implements Collection
>     {
>             public SynchronizedCollection(Collection wrapped)
>             {
>                 ...
>             }
>     }
>
> I don't know the answer, but I can't see what different it makes to
> the synchronizedCollection() user.

The class Collections.SynchronizedCollection would have been useful for
xarax to extend, given his suggested class design.

Without having such a class to extend, and if you're intent upon creating
something that extends the a collection /and/ be synchronized, you're left
with creating a class that extends the non-synchronized collection, and
hand-implementing a wrapper for each and every method.



-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"







==========================================================================
TOPIC: Java trick
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad
==========================================================================

== 1 of 4 ==
Date:   Fri,   Sep 17 2004 8:45 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Michael Borgwardt coughed up:
> Thomas G. Marshall wrote:
>> The reason it works is that a variable to a class object of any
>> value can still yield access to a static.
>
> Actually, there is no object involved at any point. The *compiler*

{shrug} The *compiler* does everything.


> directly inserts a reference to the class for which the variable is
> declared, so
> it might work differently than expected if inheritance is involved.
>
> ClassA reference = new SubClassOfClassA();
> System.out.println(reference.staticVariable);
>
> is equivalent to
>
> System.out.println(ClassA.staticVariable);
>
> NOT to
>
> System.out.println(SubClassOfClassA.staticVariable);


You're right.  What I really should have said was a "variable of reference
of any value", not object.

Basically, given the declaration & definition:

        {Type} {Variable Name} = {reference};

*Regardless* of the value of {reference},

    {reference}.{static id}

yields the same thing as

    {Type}.{static id}

Which is something I've always thought sloppy about Java.


-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"






== 2 of 4 ==
Date:   Fri,   Sep 17 2004 8:49 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Tor Iver Wilhelmsen coughed up:
> "Adam" <[EMAIL PROTECTED]> writes:
>
>> This will compile and run correctly,
>> even though foo() is not static.
>
> IIRC, it's because the member method foo() is "synthesized" into the C
> method
>
> CSomeClass_foo(CsomeClass* this) {
>
> }
>
> and your code doesn't use "this" for anything.
>
> Methods in Java are "real" member methods.
>
> To the OP: Whether you get the static member's value or a
> NullPointerException depends on which runtime you use: There was a
> change-note for one version (I seem to recall) that spoke of a change
> regarding whether your code should give a NPE at runtime or not.

HUH?  Which?

-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"






== 3 of 4 ==
Date:   Fri,   Sep 17 2004 9:53 pm
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Thomas G. Marshall wrote:
> Basically, given the declaration & definition:
> 
>         {Type} {Variable Name} = {reference};
> 
> *Regardless* of the value of {reference},
> 
>     {reference}.{static id}
> 
> yields the same thing as
> 
>     {Type}.{static id}
> 
> Which is something I've always thought sloppy about Java.

I (and most knowledgeable people I know) think that static members
should be accessible only through the class name, not through
a reference.




== 4 of 4 ==
Date:   Fri,   Sep 17 2004 11:02 pm
From: Kevin McMurtrie <[EMAIL PROTECTED]> 

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Razvan) wrote:

> Hi !
> 
> 
> 
> 
> public class CDummy
> {
>       static int toto = 7;
> 
>       CDummy getDummy() {
>               return null;    // pay attention here !
>       }
> 
>       public static void main(String args[])
>       {
>               System.out.println("CDummy.");
> 
>               CDummy dmy = new CDummy();
>               System.out.println(dmy.getDummy().toto);
>       }
> }
> 
> 
> 
>       Well... can you guess the output of the above code ? (try not to run the 
> code)
> 
>       I have my own explanation but I don't want to spoil your fun:))
> 
> 
> 
> Regards,
> Razvan

Some compilers can give you a warning that you're not using the instance 
variable because the method/field is static.  Eclipse has that option.




==========================================================================
TOPIC: Tomcat 5.028 Struts problem - struts-config.xml does not start with a "/" 
character
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/54504892241d7ccf
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 17 2004 8:50 pm
From: Sudsy <[EMAIL PROTECTED]> 

Aleksandar Matijaca wrote:
> Hi there,
> 
> I am trying to deploy a war file on Tomcat on Windows XP, and I am
> having
> a problem as shown below.  This war files deploys fine on Websphere
> 5.01 on
> both XP and Linux -- what gives??  Any idea -- please help..

<snip>
> SEVERE: Parsing error processing resource path
> java.net.MalformedURLException: Path WEB-INF/struts-config.xml does
> not start with a "/" character
<snip>

It's not complaining about what's IN your struts-config.xml file,
merely that when you specify it in web.xml you omit the leading
slash.
You've probably got this in your web.xml:

   <init-param>
    <param-name>config</param-name>
    <param-value>WEB-INF/struts-config.xml</param-value>
   </init-param>
   ...

when what you SHOULD have is this:

   <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
   </init-param>
   ...

What a difference a single character makes, eh?





==========================================================================
TOPIC: HTML Applet Code
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c474db6bb89b26e
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 17 2004 9:48 pm
From: [EMAIL PROTECTED] (RNS) 

Hello,

I assume there has ot ba a way to show an applet in multiple browsers
(i.e. Mozilla, Firefox, Internet Exploder) that uses swing classes. 
Currently I am using a version directive which causes some browsers to
want to download java from sun.  Some browsers still want to download
the "Plug-in" even if the same version of sun java is installed.  If
someone could provide some more robust code that would be great.  Here
is what I am using:
################
<HTML>
<HEAD>
<TITLE>TreeMenu Applet</TITLE>
</HEAD>
<BODY>


<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->
<OBJECT
    classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    codebase = 
"http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0";
    WIDTH = 200 HEIGHT = 500 >
    <PARAM NAME = CODE VALUE = "TreeMenu.class" >
    <PARAM NAME = "type" VALUE =
"application/x-java-applet;version=1.4">
    <PARAM NAME = "scriptable" VALUE = "false">

    <COMMENT>
        <EMBED
            type = "application/x-java-applet;version=1.4"
            CODE = "TreeMenu.class"
            WIDTH = 200
            HEIGHT = 500
            scriptable = false
            pluginspage =
"http://java.sun.com/products/plugin/index.html#download";>
            <NOEMBED>

            </NOEMBED>
        </EMBED>
    </COMMENT>
</OBJECT>
<!--
<APPLET CODE = "TreeMenu.class" WIDTH = 200 HEIGHT = 500>
</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->
</BODY>
</HTML>
###################




==========================================================================
TOPIC: what u program?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 17 2004 9:51 pm
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Malcolm Dew-Jones wrote:
> : > No, it's just September.
> 
> : It has been since 1993.
> 
> 1993 ?  just curious

http://www.science.uva.nl/~mes/jargon/s/septemberthatneverended.html



== 2 of 2 ==
Date:   Sat,   Sep 18 2004 12:45 am
From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> 

Michael Borgwardt <[EMAIL PROTECTED]> writes:

> It has been since 1993.

Yes, but all these recent newbie questions to cljp are the effect of
the "old" September principle.




==========================================================================
TOPIC: How to incremet IndetAddress / IP numbers
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94897e32234ceaaf
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 17 2004 11:49 pm
From: "John B. Matthews" <[EMAIL PROTECTED]> 

In article <[EMAIL PROTECTED]>,
 Paul Lutus <[EMAIL PROTECTED]> wrote:

> Markus Kern wrote:
> 
> > Hey,
> > 
> > i am coding a simple port scanner.
> > now i want to make it scan a whole range of ip numbers. how can i
> > increment the datatype InetAddress?
> 
> Your inquiry has been asked and answered, in a thread you started in
> comp.lang.java.help on 9/14/2004.
[...]

I had missed this thread on c.l.j.h. Before seeing your very 
illuminating code, I had tried the following:

    public static InetAddress inc(InetAddress ip)
    throws UnknownHostException {
        byte[] b = ip.getAddress();
        b[3]++;
        if (b[3] == 0) b[2]++;
        if (b[2] == 0) b[1]++;
        if (b[1] == 0) b[0]++;
        return InetAddress.getByAddress(b);
    }

It seems to work, but I'm vaguely uneasy about relying on 
wrap-around with signed integer arithmetic. In particular, the 
(post) increment operator is subject to binary numeric promotion 
(and subsequent narrowing), while the shift operator is not. Is 
this a problem?

Thanks for any insight.

John
----
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/



== 2 of 2 ==
Date:   Sat,   Sep 18 2004 12:13 am
From: Paul Lutus <[EMAIL PROTECTED]> 

John B. Matthews wrote:

> In article <[EMAIL PROTECTED]>,
>  Paul Lutus <[EMAIL PROTECTED]> wrote:
> 
>> Markus Kern wrote:
>> 
>> > Hey,
>> > 
>> > i am coding a simple port scanner.
>> > now i want to make it scan a whole range of ip numbers. how can i
>> > increment the datatype InetAddress?
>> 
>> Your inquiry has been asked and answered, in a thread you started in
>> comp.lang.java.help on 9/14/2004.
> [...]
> 
> I had missed this thread on c.l.j.h. Before seeing your very
> illuminating code, I had tried the following:
> 
>     public static InetAddress inc(InetAddress ip)
>     throws UnknownHostException {
>         byte[] b = ip.getAddress();
>         b[3]++;
>         if (b[3] == 0) b[2]++;
>         if (b[2] == 0) b[1]++;
>         if (b[1] == 0) b[0]++;
>         return InetAddress.getByAddress(b);
>     }
> 
> It seems to work, but I'm vaguely uneasy about relying on
> wrap-around with signed integer arithmetic.

There is no need to use this approach. Just increment an integer or a long,
dismantle a copy into byte components, and use the bytes to construct the
IP address, as in my prior code example.

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





==========================================================================
TOPIC: test if the string is a blank data string
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/681d0b9bedeb1d23
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 12:35 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

Thomas Kellerer <[EMAIL PROTECTED]> scribbled the following:
> Joona I Palaste wrote on 17.09.2004 22:13:
>> The same can be accomplished with:
>> 
>> return s==null || s.trim().equals("");

> Wouldn't

> return (s == null || s.trim().length() == 0)

> be a bit quicker (and avoid the creation of the "" String)?

Perhaps. The point is, both versions avoid the ?: operator, which shows
that boolean constants are very rarely needed with the ?: operator.
BTW, you don't need the parantheses. "return" is a statement, not a
method call or an operator.

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"C++ looks like line noise."
   - Fred L. Baube III




==========================================================================
TOPIC: newbie RMI User
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/af49b3bdfce876e4
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 12:39 am
From: "Paul Foreman" <[EMAIL PROTECTED]> 

I have just got an applet I am developing to use the RMI method to get 
information from a server.

I was using JBuilder and using try and catch statements for each of the 
methods that needed the remote information. So there were several methods 
which invoked the RMI method Naming.lookup. All seemed well until I tried to 
use the applet in a browser. When I did this I got a 'notinited' message and 
the applet failed to load.

By trial and error the applet appears to work when there is only one method 
that calls the RMI code.

Is this a genuine limitation in the use of RMI?
Is there a standard way of coding the use of RMI such that many methods can 
access one RMI Naming.Lookup set of code?

I hope that I have made my question clear enough. Any advice would be 
appreciated.

Regards

Paul







==========================================================================
TOPIC: update doesnt´t work ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3619d270a4e29711
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 12:43 am
From: [EMAIL PROTECTED] (gzell) 

Babu Kalakrishnan <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...

Hi Babu,
thank you for your reply.

> >.. But everytime, when I call repaint(), my canvas-area first
> > get´s a "clear screen" . Is there anyone who knows why ?
> > 
> 
> Probably because the paint() method of the canvas derived component 
> clears the drawing surface before painting the contents ? (As is very 
> commonly done)
> 
> BK

I inserted a method   
            public void update(Graphics g) {paint(g);}
to avoid this. (see source-code )...

Ciao, Günter Zell


//-------------------------class myFrame03 ------

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class myFrame03 extends JFrame{
Parabeln myC = new Parabeln();
JPanel p1 = new JPanel();

public  myFrame03(){
   p1.setLayout(null);
   p1.setBounds(10,10,800,600);

   myC.setBounds(10,10,400,400);
   p1.add(myC);
   getContentPane().add(p1);

   Point myPoint = new Point(200,200);
   myC.mpKsystem(myPoint);

   Point p1 = new Point(-10,+5);
   Point p2 = new Point(10,-7);
   myC.zeichneLinie(p1,p2);       //first line doesn't appear ??

   p1 = new Point(-10,0);
   p2 = new Point(10,7);
   myC.zeichneLinie(p1,p2);       // second Line appears
   

}



public static void main(String[] args){
  myFrame03 myF = new myFrame03();
  myF.setSize(700,400);
  myF.setVisible(true);
}
}


//---------------------- class Parabeln --------------
import java.awt.*;
import javax.swing.*;


public class Parabeln extends Canvas{
boolean ksystem=false;
boolean bGeradezeichnen = false;
boolean bParabelzeichnen = false;

int mpx, mpy;
int xS,yS;
Color f;

Point pkt1 = new Point(0,0);
Point pkt2 = new Point(0,0);

 public void paint(Graphics g){
       if (ksystem) {
          setBackground(new Color(150,150,150));
          koordinatensystem(g);
       }
       if (bGeradezeichnen) myGerade(g);
   }


   
public void mpKsystem(Point p){
  mpx=p.x;  mpy=p.y;
  ksystem=true;
  repaint();
}

private void ksystemgrid(Graphics h){
  Color grid = new Color(199,199,199);
  h.setColor(grid);
  for(int i=1;i<20;i++) h.drawLine(20*i,0,20*i,400);
  for(int i=1;i<20;i++) h.drawLine(0,20*i,400,20*i);
  }


private void koordinatensystem(Graphics h){
   ksystemgrid(h);
   h.setColor(Color.black);
   h.drawLine(0,mpy,400,mpy);
   h.drawLine(mpx,0,mpx,400);
}

private void myGerade(Graphics h){
  h.setColor(new Color(255,0,0));
  h.drawLine(pkt1.x,pkt1.y,pkt2.x,pkt2.y);

}


public void update(Graphics g)
 {
   paint(g);
 }


public void zeichneLinie(Point p1, Point p2){
 //transfer coordinates to screencoordinates
 pkt1.x=(p1.x+10)*20;
 if (p1.y>0) pkt1.y=(10-p1.y)*20;
  else pkt1.y=(p1.y*(-1)+10)*20;
     
 pkt2.x=(p2.x+10)*20;
 if (p2.y>0) pkt2.y=(10-p2.y)*20;
  else pkt2.y=(p2.y*(-1)+10)*20;
  
bGeradezeichnen=true;
}


}




==========================================================================
TOPIC: Can I implement INSERTs and DELETEs in DAOs or only in EntityBeans?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/44068d680f903d5e
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 1:02 am
From: [EMAIL PROTECTED] (Tobias Merler) 

Ok, when I access SQL databases I could use DAOs and EntityBeans in general.

SELECT queries can be implemented in DAOs as well as in EntityBeans.
But what about INSERTs, DELETEs and UPDATEs ?
>From what I have heard so far these non-select statement MUST be implemented by 
>EntityBeans.
Is this true?

Tobias




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

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 



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

<a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> 
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