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

Today's topics:

* RMI question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d0454c6a5ed7e1e
* How to do bitmap icon in front of menu-items in Java? what is the class for 
menu-item in Java? - 2 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ac74a360cb38fcd
* single package import v/s the entire package - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/113ac57dbc897704
* Using the 'this' keyword. - 5 messages, 5 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7ab8e9b27d4d517
* Share library calls from java and c code results are different - 3 messages, 3 
authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a90bc82d3627e473
* Java programs won't install on HP machine - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/25d0dcfb69436b88
* Implications of not closing db connection? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8a87f5b36905f3d0
* rotate() - a Bug? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2878f5cb04f8dbfc
* JPanel/ScrollBar Bug - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a03c5546acd5b1de
* showDocument blocked by new microsoft pop-up blocker - 4 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d6a00b2c3f47822
* while using javac -classpath some.jar some.java (Where does classpath get stored?) - 
1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70498efcf1a15784
* ExitValue from Runtime Process not returning - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32e03377219726c0
* java & java script - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5bb29439dd2da26d
* Persisting Threaded Tasks in Web Applications with Hibernate? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/288966cba8b51bdf
* Access to Wireless LAN ... - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b6710a272f95e58
* Warning about JFileChooser filters and thread safety - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3eba891af6a2daa0
* Polymorphism - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f6f8b7b6f884475
* tomcat 4 session timeout - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a2bfdcaa4dbf00
* Debate: Inner classes or public classes with package access? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9bc4ea5509bc807
* Process.destroy() on Win32 - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2677bdb23c8cb84b
  
==========================================================================
TOPIC: RMI question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d0454c6a5ed7e1e
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 10:12 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Andy wrote:

> Hi Paul,
> 
> Thanks for your response.  Sorry, maybe I'm a bit confused, I'll try
> to clarify my problem.  I have numerous WiPorts (small wifi embedded
> device servers) attatched to hand-held sensor instruments.  The WiPort
> is simply a small device server that can only run Java applets.  It's
> main functionality is to allow the Applet to create a socket
> connection with it's RS232 port (its connection to the instrument),
> thus being able to talk to the instrument and broadcast its readings
> over the web.
> 
> This all works fine.  The problem arises when I want to view a dynamic
> number of these applets at once.  I was hoping to write a java
> application that could possibly view all of these applets on one
> panel.  My concern was that, if I used a class loader (I'm not too
> familiar with these so forgive me if I'm wrong), It would simply find
> the remote applet, download the code, and run it locally - hence not
> getting the RS232 socket connection that it needs to talk to the
> instrument.

Okay, let me see if I have this right. The remote device has an http server
that serves up an applet, and the applet, while running on the client
machine, can read the server's RS232 data it needs to display. And so far
you have seen one applet at a time in the client machine's display. Right
so far?

If so, why not write a simple HTML page that combines applet tags, one for
each sensor server, all enclosed in a table? The table would serve as your
master display.

Writing an HTML page to handle this would be far simpler and more reliable
than trying to write a Java appplication that in turn hosted Java applets.
And the development time could be measured in hours, not weeks.

I have done this so I know it will work. Most modern wireless TV cameras
work exactly this way -- they serve up an applet that shows the TV picture.
If I want to show more than one camera, I write an HTML page that contains
applet tags for each camera. Same idea. It takes at most a few hours to get
it working.

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





==========================================================================
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 10:15 am
From: Paul Lutus <[EMAIL PROTECTED]> 

gino wrote:

> 
> "Paul Lutus" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> gino wrote:
>>
>> >
>> > "Paul Lutus" <[EMAIL PROTECTED]> wrote in message
>> > news:[EMAIL PROTECTED]
>> >
>> >> >
>> >> > Hi how to write my own extension class?
>> >> >
>> >> > I just found out they are belong the following class...
>> >> >
>> >> > javax.swing.JPopupMenu
>> >> >
>> >> > But what is the simplest way to do that?
>> >>
>> >> Just as it says in your Java textbook:
>> >>
>> >> public class MyClass extends javax.swing.JPopupMenu
>> >> {
>> >>         // your code here
>> >> }
>> >>
>> >> --
>> >> Paul Lutus
>> >> http://www.arachnoid.com
>> >>
>> >
>> > It's not easy at all. I read the textbook. But where is the "bitmap
> icon"
>> > property of this JPopupMenu that I can change?
>>
>> JPopupMenu is not a menu item object. Don't you want icons next to the
> menu
>> items in the popup menu? Look under JMenuItem, the objects that populate
>> your popup menu.
>>
>> > Recall that I want to display my own bitmap icon on these menu-items...
>>
>> 1. JPopupMenu is not a menu item.
>> 2. JMenuItem is.
>> 3. JMenuItem has a setIcon method.
>>
>> This result required me to read the documentation for 15 seconds. Imagine
>> what you can accomplish if you read the documentation for an hour.
>>
>> Why, reading the documentation might be more efficient than posting here
>> until you have a code problem that we can help you with.
>>
>> --
>> Paul Lutus
>> http://www.arachnoid.com
>>
> 
> Yes, yes, JPopupMenu is not a menu item, so what shall I do to put an
> bitmap icon before it or after it?

PLEASE read the documentation.


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




== 2 of 2 ==
Date:   Fri,   Aug 27 2004 10:17 am
From: Paul Lutus <[EMAIL PROTECTED]> 

gino wrote:

/ ...

> Yes, yes, JPopupMenu is not a menu item, so what shall I do to put an
> bitmap icon before it or after it?

Sorry for the last post -- it was posted inadvertently.

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().

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





==========================================================================
TOPIC: single package import v/s the entire package
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/113ac57dbc897704
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 10:16 am
From: "Dejan Lazic" <[EMAIL PROTECTED]> 

"Parvinder" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> what is the advantage of importing a single class v/s all the classes
> from the package
> like java.util.date is better then java.util.*.If yes then what are the
> advantages ?

Look at Java 1.5 specification.
Tiger even give you an option to import only static methods of classes.





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

== 1 of 5 ==
Date:   Fri,   Aug 27 2004 10:32 am
From: [EMAIL PROTECTED] (Harry Colquhoun) 

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 (i.e. this.myVariable = 10). 
Even worse (imho), they've defined their setter methods as follows:

   setVariableName(String variableName) {
              this.variableName = variableName;
   }

Is this a common coding technique that I just haven't seen before?  To
me, proper coding style would dictate that you never define a parent
and child class to each have their own variable with the same name,
and therefore use of the 'this' keyword is both dangerous and
unnecessary.

I'm wondering what others think...

Cheers,
Harry



== 2 of 5 ==
Date:   Fri,   Aug 27 2004 10:54 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

Harry Colquhoun <[EMAIL PROTECTED]> scribbled the following:
> 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 (i.e. this.myVariable = 10). 
> Even worse (imho), they've defined their setter methods as follows:

>    setVariableName(String variableName) {
>               this.variableName = variableName;
>    }

> Is this a common coding technique that I just haven't seen before?

Yes, this is very common in setter methods.

> To
> me, proper coding style would dictate that you never define a parent
> and child class to each have their own variable with the same name,
> and therefore use of the 'this' keyword is both dangerous and
> unnecessary.

You don't have a parent and child class in the above. You have only
one class, but two scopes: class scope and method scope.

> I'm wondering what others think...

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Keep shooting, sooner or later you're bound to hit something."
   - Misfire



== 3 of 5 ==
Date:   Fri,   Aug 27 2004 11:09 am
From: Paul Lutus <[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 (i.e. this.myVariable = 10).

There's no point to that if there is no doubt about what the name refers to.

> Even worse (imho), they've defined their setter methods as follows:
> 
>    setVariableName(String variableName) {
>               this.variableName = variableName;
>    }
> 
> Is this a common coding technique that I just haven't seen before?

It is commonly seen. Some people prefer this to renaming the local variable.

> To 
> me, proper coding style would dictate that you never define a parent
> and child class to each have their own variable with the same name,
> and therefore use of the 'this' keyword is both dangerous and
> unnecessary.

Yes, but sometimes it happens, and this is how you deal with it.

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




== 4 of 5 ==
Date:   Fri,   Aug 27 2004 12:02 pm
From: "P.Hill" <[EMAIL PROTECTED]> 

Harry Colquhoun wrote:

> I'm wondering what others think...

I asked the same question on this list last year (?)
after wandering away from Java for awhile and
coming back from a language which required the "this" keyword in order
to reference members.

In setters:  It looks fine, but can lead to spelling
bugs of the form:

setFooBar( int fubar ) {
    this.fooBar = fooBar;
}

Fancy lint programs and IDEs like Eclipse will warn you about this one,
but otherwise you might not notice.  Of course, your code wouldn't
get for with this mistake, so I'm not one to worry about it.

In equals methods many people find it very useful to say:

if ( this.field1.equals( that.field1 ) && ... )

There are some similar inner class idioms where "this"
is expected; otherwise most experienced Java
folks find it distracting to see "this" all the
time.

By the way, it does not matter if "variableName" (your example
member) is defined in the current class or some superclass as
long as it is accessable, this.variableName will find it and
reference it correctly.

HTH,
-Paul




== 5 of 5 ==
Date:   Fri,   Aug 27 2004 1:01 pm
From: Bryce <[EMAIL PROTECTED]> 

On 27 Aug 2004 10:32:13 -0700, [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 (i.e. this.myVariable = 10). 
>Even worse (imho), they've defined their setter methods as follows:
>
>   setVariableName(String variableName) {
>              this.variableName = variableName;
>   }
>
>Is this a common coding technique that I just haven't seen before?  To
>me, proper coding style would dictate that you never define a parent
>and child class to each have their own variable with the same name,
>and therefore use of the 'this' keyword is both dangerous and
>unnecessary.

I agree somewhat. For instance, suppose you had this:
class SomeClass {
        String  variableName;

        setVariableName(String varaibleName) {
                this.variableName = variableName;
        }
}

Note the misspelling in the method. Now, I should note that most IDE's
have a function that generates getters and setters, but trying to
debug the above handwritten code can be difficult.

Just my 2 cents.

--
now with more cowbell




==========================================================================
TOPIC: Share library calls from java and c code results are different
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a90bc82d3627e473
==========================================================================

== 1 of 3 ==
Date:   Fri,   Aug 27 2004 10:32 am
From: [EMAIL PROTECTED] (Sergio) 

I have the following problem; I want to call some legacy code from
java (some mathematical processing routines).

So I have prepared a java (JNI) wrapper using the swig tool and
everything went ok. I am able to call the c code from the java code
and it doesn't reports any errors, but the results are slightly
different from the same code called from C (something like 1.1e-12).

The C code is only called from the java, there isn't any parameters
passing between them and the C code writes its results to files.

This seems some kind of problem with the Virtual machine handling of
the Shared Library, I there someone that had this kind of problem?


I am using the following versions:

jvm
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

gcc
gcc version 3.3 20030226 (prerelease) (SuSE Linux)

swig
SWIG Version 1.3.19



== 2 of 3 ==
Date:   Fri,   Aug 27 2004 11:03 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Sergio wrote:

> I have the following problem; I want to call some legacy code from
> java (some mathematical processing routines).
> 
> So I have prepared a java (JNI) wrapper using the swig tool and
> everything went ok. I am able to call the c code from the java code
> and it doesn't reports any errors, but the results are slightly
> different from the same code called from C (something like 1.1e-12).
> 
> The C code is only called from the java, there isn't any parameters
> passing between them and the C code writes its results to files.

Then change how C writes its textual results. It is possible to get perfect
repeatability in textual FP results if you will format the C code printf()
statements correctly. I regularly get perfect correspondence between
different languages using textual FP representations, and this happens to
be something that Java does without any effort, but C and C++ require, more
or less:

printf("%.18e",x);

To assure that the textual result will contain all the resolution contained
in the original binary representation. When Java scans this text form, the
original binary double is recreated perfectly, in all cases.

> This seems some kind of problem with the Virtual machine handling of
> the Shared Library, I there someone that had this kind of problem?

Are you not describing what I think you are? Aren't you concerned only that
the two results agree?

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




== 3 of 3 ==
Date:   Fri,   Aug 27 2004 11:39 am
From: Eric Sosman <[EMAIL PROTECTED]> 

Sergio wrote:
> I have the following problem; I want to call some legacy code from
> java (some mathematical processing routines).
> 
> So I have prepared a java (JNI) wrapper using the swig tool and
> everything went ok. I am able to call the c code from the java code
> and it doesn't reports any errors, but the results are slightly
> different from the same code called from C (something like 1.1e-12).
> [...]

     Since another responder seems to have interpreted your
question differently, I'll restate my understanding of the
situation.  You have a C function or library of functions,
and you have two ways of running it: Embedded in a stand-
alone C program, or invoked from Java via JNI.  When you
run it stand-alone you get a result X, but when you invoke
it from Java you get a slightly different result Y.  If
that's not the correct statement of the problem, just
ignore what follows.

     Software systems being what they are, there's a huge
number of possible causes.  However, two occur to me as
likely candidates:

     1) Does the C start-up code place the machine in the
same state Java does?  I'm thinking about things like
floating-point rounding modes: Does C establish "round
toward zero" for exact-halfway quantities while Java uses
"round to even?"  Or vice versa, or something along those
lines?  If there are functions (probably platform-specific)
to discover things like rounding modes, it'd be instructive
to insert some code to display them at the point where the
C code starts; you could then see if they're different when
run from stand-alone C and from Java.

     1a) Along the same lines: Is there a SIGFPE handler in
the picture anywhere?  If so, is the SIGFPE handling set up
by the JVM different from that used by stand-alone C?

     2) Maybe the C code has a bug that causes it to read
and calculate with an uninitialized variable.  It's quite
possible that the "random" value of such a variable would
be different when the code runs under JNI than when it runs
stand-alone.  If (1) and (1a) don't lead anywhere, it may
be time for some valgrind sessions -- I haven't used it
myself, but I'm told it's pretty good at finding such bugs.

     Good luck!

-- 
[EMAIL PROTECTED]





==========================================================================
TOPIC: Java programs won't install on HP machine
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/25d0dcfb69436b88
==========================================================================

== 1 of 2 ==
Date:   Fri,   Aug 27 2004 11:06 am
From: [EMAIL PROTECTED] (Rex) 

[EMAIL PROTECTED] (Rex) wrote in message news:<[EMAIL PROTECTED]>...
> "Mickey Segal" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> > "Rex" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > User can run that applet.
> > >
> > > Situation appears to be a legitemate issue though.  These people are
> > > having the same problem...
> > >
> > > http://forum.java.sun.com/thread.jsp?forum=14&thread=543616
> > >
> > >
> > http://forum.java.sun.com/thread.jsp?forum=14&thread=534624&start=0&range=15#2673477
> > 
> > A long-shot possibility: Did the user ever run Microsoft's JVM Removal Tool?
> > Some users had problems with Sun's Java after using the defective tool,
> > which got pulled in March when the bug became known and seemed to have been
> > junked soon afterwards when the Sun-Microsoft settlement was announced.
> > 
> > Andrew Thompson followed this issue in detail - he'd have a sense whether
> > this could explain a problem afflicting a small minority of people
> > installing Sun's Java.
> 
> 
> 
> 
> The user is not a technical person and has indicated he does not know
> what that program is.  My guess is that he wouldn't have run such a
> tool.
> 
> My hunch is that he has an old set of Nvidia video drivers and that
> they conflict somehow.  This hunch is based on the fact that the log
> information indicates that the install process craps out while
> attempting to "Set UI mode to".  I think the process may be querying
> his system's video capabilities in an attempt to set the proper UI
> mode.
> 
> I'm headed over there now to update his drivers and try again.  I'll
> post results.


Old video drivers turned out to be the culprit.  User had an HP
Pavillion (model # 8766C) with the original video drivers from 2000. 
Tried to update to current drivers but the machine would lock on
reboot afterwards.  Had to step back to some drivers one or two
versions back (I think 2003?).  After doing so our java application
installed without a hitch.

Mystery solved.



== 2 of 2 ==
Date:   Fri,   Aug 27 2004 12:04 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 27 Aug 2004 11:06:33 -0700, Rex wrote:

> Mystery solved.

Glad you got it sorted.   :-)

Thanks for reporting back with the solution.

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology




==========================================================================
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 11:41 am
From: Scott Ellsworth <[EMAIL PROTECTED]> 

In article <[EMAIL PROTECTED]>,
 "vivienne wykes" <[EMAIL PROTECTED]> wrote:

> 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 ?

Simply put, connections, like files, are limited resources.  They may be 
limited by process, by server, by vm, or by phase of the moon, but they 
_are_ limited.  Even worse - a connection may be kept open even after 
the VM exits, as it may be limited by the db server.  Thus, if you quit 
with a connection still open, the db may not close it automatically, and 
thus future users may not be able to connect.

Memory is also a limited resource, but it is one controlled almost 
entirely by the vm, so if your vm process exits, all of the memory is 
returned to the OS.  DB connections, as mentioned above, may well be 
controlled by the dbms, and thus even your process ending may not give 
them back.

Aside: the underlying window pointer used by a JFrame is often a limited 
resource as well, and once the OS runs out of them, all hell breaks 
loose.  Thus, calling dispose() on your jframes can be very important.  
Most of the time, though, those window pointers are returned when the vm 
exits if not before.  Still, why be a poor citizen.

The exact details of the consequences of not closing an RS, Statement, 
or Connection depend on the OS, the VM, and the DBMS, but in general, it 
is a very bad thing.  Oracle 7/Solaris combined with the Windows VM is a 
particularly unfun combination.  We have had Oracle instances that 
needed rebooting by the dba to recover from dropped connections.

Scott




==========================================================================
TOPIC: rotate() - a Bug?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2878f5cb04f8dbfc
==========================================================================

== 1 of 2 ==
Date:   Fri,   Aug 27 2004 11:45 am
From: [EMAIL PROTECTED] (Jenny) 

Thanks.  Java is not math.



== 2 of 2 ==
Date:   Fri,   Aug 27 2004 3:28 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Jenny wrote:

> Thanks.  Java is not math.

Meaning, I presume, that rightfully, +x = right and +y = up. I agree. All my
graphic programs use this convention, but those that are closer to text
display, as your example is, adhere to the +y = down convention. This
Graphics2D class appears to have one foot in each world, making it a
strange duck if there ever was one.

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





==========================================================================
TOPIC: JPanel/ScrollBar Bug
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a03c5546acd5b1de
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 11:47 am
From: [EMAIL PROTECTED] (Jenny) 

Thanks.




==========================================================================
TOPIC: showDocument blocked by new microsoft pop-up blocker
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d6a00b2c3f47822
==========================================================================

== 1 of 4 ==
Date:   Fri,   Aug 27 2004 11:58 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

TestShowDocApplet, ..testing/demo,
<http://www.physci.org/test/showdoc/>

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 2 of 4 ==
Date:   Fri,   Aug 27 2004 1:57 pm
From: "Mickey Segal" <[EMAIL PROTECTED]> 

"Andrew Thompson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> ...hhhm.  I have seen a few responses on c.l.js
> that suggest attempts to detect pop-up success
> using JS are unreliable..  I am not sure whether
> that extends beyond 'JS disabled', but I would
> whip up a test case and ask the goodly JS folks
> to break it for you..

I've put my JavaScript code on a working example at:
http://segal.org/js/pop_detect/
It is not very elegant but it does seem to work in Internet Explorer for 
Windows, which is the only environment for which I would enable pop-up 
testing since showDocument is not blocked by the Netscape pop-up blocker and 
the Apple Safari pop-up blocker.

Does anybody have any comments before I ask the experts at c.l.js about this 
JavaScript-newbie code?  Nobody knows me there are they are liable to assume 
the worst about my interest in pop-up detection.  At least people on this 
group know that there are many legitimate examples of using event-driven 
calls to showDocument. 





== 3 of 4 ==
Date:   Fri,   Aug 27 2004 2:26 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Fri, 27 Aug 2004 16:57:04 -0400, Mickey Segal wrote:

> http://segal.org/js/pop_detect/

a few suggetsions ..gimme a few mins.



== 4 of 4 ==
Date:   Fri,   Aug 27 2004 2:45 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Fri, 27 Aug 2004 16:57:04 -0400, Mickey Segal wrote:

> I've put my JavaScript code on a working example at:
> http://segal.org/js/pop_detect/

Try this variant..

<!doctype html public "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">
<title>Pop-up blocker detection</title>
<script type='text/javascript'>
function isBlockingPopUps() {
  result = window.open("popped.html", "popped",
    "width=10, height=10, location=no, \
    menubar=no, status=no, toolbar=no, \
    scrollbars=no, resizable=no");
  return result=='undefined';
}
</script>
<style type='text/css'>
div {
        border: solid 2px red;
        padding: 10px;
}
</style>
</head>
<body>
<h3>Pop-up blocker detection</h3>
<p>If any message appears in the red box below, it may indicate
a problem with this browser's ability to display pop-ups.
<div>
<!-- display only to IE -->
<!--[if IE]>
<p>This browser is potentially affected.
<script type='text/javascript'>
document.write( "<p>Your browser is " );
if ( !isBlockingPopUps() ) {
  document.write( "<em>not</em> " );
}
document.writeln( "blocking pop-ups.");
</script>
<noscript>
<p>This browser has Javascript disabled, and as a
result we cannot check pop-ups.
</noscript>
<![endif]-->
</div>
</body>
</html>


..it is valid, and degrades gracefully.

But I suspect it still has a fatal flaw..

Some pop-up blockers will open the window
only to clos it *themselves*, so.. to JS,
it appears to be defined.

Perhaps a good thorough search of the 
JS archives might be in order..

<http://google.com/groups?as_q=detect%20pop&as_ugroup=comp.lang.javascript>

HTH

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology




==========================================================================
TOPIC: while using javac -classpath some.jar some.java (Where does classpath get 
stored?)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70498efcf1a15784
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 12:02 pm
From: Cid <[EMAIL PROTECTED]> 

On 27 Aug 2004 05:01:40 -0700, [EMAIL PROTECTED] (Gabe)
wrote:

>Cid <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
>> On 26 Aug 2004 20:24:35 -0700, [EMAIL PROTECTED] (Gabe)
>> wrote:
>> 
>> >
>> >The jar and the java file both being in the same dir and I having
>> >navigated to that dir through the commandline console.
>> 
>> You haven't, by chance left the class files from some.jar sitting
>> around in the same directory as some.java after making some.jar have
>> you? (this assumes all these classes are in the default package -
>> seems like that's how the tutorial worked)
>
>The answer to that questions would be yes.  The class file from
>some.jar is sitting around in the same dir as some.java after making
>some.jar.
>
>Is this is why the classpath data appears to be persistent but it
>really isn't stored anywhere after cleaning up memory through exiting
>the command line console or restarting the OS?

Yes it is. If I understand your setup correctly, you've got 
folder A
        some.java
        some.class
        some.jar

and some.jar contains some.class?


So you could invoke 

java -classpath some.jar some
        This invokes some.class in some.jar

java some
        This invokes some.class in folder A


Or maybe you have another class involved, a test driver - test.class
with the main method? And assuming it references the some via default
package, it will find some.class in the folder if you don't specify
some.jar as the classpath.





==========================================================================
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:   Fri,   Aug 27 2004 1:00 pm
From: "Liz" <[EMAIL PROTECTED]> 


"Gordon Beaton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 26 Aug 2004 08:11:39 -0700, Binaebi A. wrote:
> > I'm currently writing a java program that interfaces with a Perl
> > script through a Linux command shell. I am able to interact with the
> > script, but with each action I get a Null Exception Error which does
> > not prevent the program from working. How is it possible that an error
> > can be thrown and yet not stop the program from working?
>
>
> The error occurs after the child process has already
> completed, when readLine() returns null at EOF. You attempt
> to call null.equals(), which causes the exception.
>
> To compare a reference with null, use one of the identity
> operators == or !=, not equals().
>
> Change the following line:
>
> >       while(!(line = in.readLine()).equals(null)) {
>
> to:
>
>   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?

>
> and this:
>
> >        while(!(eLine = error.readLine()).equals(null))
>
> to:
>
>   while ((eline = error.readLine()) != null)
>
> /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: java & java script
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5bb29439dd2da26d
==========================================================================

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



> The better question is: what do they have in common?
> The answer: very little.
>
> - The first four letters of their names
> - Both are object oriented
********************************
***Actually - JavaScript is object-based - rather than object-oriented  -
but they try

> - Both derive their syntax from C
>
> And that's ALL.


---
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: Persisting Threaded Tasks in Web Applications with Hibernate?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/288966cba8b51bdf
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 1:07 pm
From: [EMAIL PROTECTED] (Mike S) 

Hello,

I would like to accomplish something in a Struts web application that
I have not done before.  I'd like some feedback on my approach and
suggestions to make it better or best implement it.  The part of the
app that concerns me is one where a user initiates a process by
clicking on a link and ends it by clicking a different link at some
later time.

The only way I can think of to accomplish this is by extending Thread
on the class in question that is responsible for the process.  Then
the Action that is to load the repeated process will instantiate the
class, put a reference to the object in the Session and call .start()
on it.  That way the Action can finish what it needs to do, return an
ActionMapping and be done while the threaded process continues to run.
 When the user then calls the termintating Action it will pull the
reference to the Thread out of the Sesion and call .setStop(true) on
it (my thread continues to run while the boolean I'm setting is false
or it times out).

This approach works, but it obviously has holes.  Sure, I can put in
simple logic to make sure that only one instance of my thread runs at
a time by updating a flag in a database when the process
starts/finishes but what happens if a user starts myThread and then
closes his browser?  He kills the session and prevents myThread from
being accessed again.  This is why I am thinking that my only option
is to persist myThread itself not to the Session but to a database so
that I can maintain a reference to it.  I can't serialize it and put
it in a database because the serialization would make me lose the
reference to the actual instance of myThread that I want so I'm
guessing I have to use JDO.

First, would you agree with my assumptions and approach to the
problem?  Second, can I accomplish persisting the myThread object to a
database with Hibernate or some open source JDO implementation?  If
so, could you provide an example on how to persist an object so that I
can retrieve the actual reference to the object I persisted and not
just a different instantiated class that is a clone of the original?

Thanks for your help.  Please cc [EMAIL PROTECTED] on your
responses.

Mike




==========================================================================
TOPIC: Access to Wireless LAN ...
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b6710a272f95e58
==========================================================================

== 1 of 2 ==
Date:   Fri,   Aug 27 2004 1:07 pm
From: [EMAIL PROTECTED] (Trent) 

Paul Lutus <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Michael Borgwardt wrote:
> 
> > Paul Lutus wrote:
> >>>Actually, in the case of Wireless LAN, this should be easier than with
> >>>files, since it's standardized on the lower levels.
> >> 
> >> 
> >> False. This is quite false. Consider the simple case of Bluetooth versus
> >> 802.11 technologies. They have nothing in common beyond a rudimentary
> >> shared purpose.
> > 
> > And who said anything about Bluetooth?
> 
> It is a wireless LAN technology. That's the topic. So the point is made.
> 
> > Marco does not require, nor 
> > did I propose, a generalized API to all possible kinds of "wireless
> > interfaces" (are there really any relevant ones outside those two?).
> 
> That is precisely what he asked for:
> 
> >>>Actually, in the case of Wireless LAN, this should be easier than with
> >>>files, since it's standardized on the lower levels.
>  
> > He mentioned "Writelss LAN", which I've never seen used to mean
> > anything except specifically 802.11,
> 
> Bluetooth is a wireless LAN. Q.E.D.


I just wanted to use my cell phone to call my coffee maker in the
morning, and tell it to turn on.



== 2 of 2 ==
Date:   Fri,   Aug 27 2004 3:18 pm
From: Sudsy <[EMAIL PROTECTED]> 

Trent wrote:
<snip>
> I just wanted to use my cell phone to call my coffee maker in the
> morning, and tell it to turn on.

So you wanted to let your fingers do the walking?
Can you say "inappropriate use of technology"?!

[just so nobody gets upset, smiley follows]

:-/





==========================================================================
TOPIC: Warning about JFileChooser filters and thread safety
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3eba891af6a2daa0
==========================================================================

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


"Larry Barowski" <larrybarATengDOTauburnDOTeduANDthatISall> wrote in message
news:[EMAIL PROTECTED]
> > Maybe I am confused, but isn't there a different instance of "accept()"
> > for each FileFilter?
>
> Sure, but you can add one FileFilter instance to more than one
> JFileChooser, and each JFileChooser will start a separate thread
> to do the filtering. In that case, accept() itself would need to be
> thread-safe.

Wow, lots of info in this message. Let me see, I have a simple GUI
with a single button that brings up the file chooser. If the file
chooser is open and I try to click the button again, I get some sort
of bell and it refuses to open a second file chooser. In fact, I cannot
click any buttons without getting the bell.

>
> A more common problem would be that you access a cache from
> accept() and that cache may be modified by your event handling
> code elsewhere in the application. Then access to the cache must
> be made thread-safe.
>
> If you only use JFileChoosers in modal dialogs, problems would
> be less likely than if you have them in modeless dialogs, or
> embedded in a larger gui. For modal JFileChoosers, maybe
> accept() would only have to be thread safe with respect to
> any method that could be called when handling events generated
> by the file chooser itself (my example below violates this
> condition).
>
> Showing the files asynchronously using separate threads,
> as JFileChooser does, is a good thing. If file display is
> slow it allows you to change directories, cancel, etc.
> before all the files are displayed. The multi-threading is
> undocumented though, and it did take me by surprise.
>
> Following is a rather contrived example demonstrating the
> problem. If accept() was only called from the event dispatch
> thread, this program would not throw a NPE, which it
> will if you click "Cancel" before all the files are displayed.
>
>
>    public class TestFileChooser {
>
>       public static void main(String[] args) {
>          JFileChooser fc = new JFileChooser();
>          fc.addActionListener(
>                 new ActionListener() {
>                    public void actionPerformed(ActionEvent e) {
>                      str = null; }
>                });
>          fc.addChoosableFileFilter(
>                 new FileFilter() {
>                    public boolean accept(File f) {
>                      test();
>                      return true;
>                   }
>                    public String getDescription() {
>                      return "test"; }
>                }
>             );
>
>          fc.showOpenDialog(null);
>       }
>
>       public static String str;
>       public static void test() {
>          str = "test";
>          try {
>             Thread.sleep(1000); }
>              catch(InterruptedException e) {}
>          str.length();
>       }
>    }
>
>






==========================================================================
TOPIC: Polymorphism
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f6f8b7b6f884475
==========================================================================

== 1 of 1 ==
Date:   Fri,   Aug 27 2004 1:12 pm
From: Joona I Palaste <[EMAIL PROTECTED]> 

xarax <[EMAIL PROTECTED]> scribbled the following:
> Will someone please mention Hitler, so this
> thread will cease?

It doesn't work that way. First, you have to compare some other
participant to Hitler, merely mentioning Hitler is not enough.
Otherwise, discussion that is actually about Hitler (for example on
political history newsgroups) would be impossible.
Second, it's been said that you can't purposefully compare someone to
Hitler just so you could lose the argument and end the thread. You have
to make a real insult.

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"The trouble with the French is they don't have a word for entrepreneur."
   - George Bush




==========================================================================
TOPIC: tomcat 4 session timeout
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a2bfdcaa4dbf00
==========================================================================

== 1 of 2 ==
Date:   Fri,   Aug 27 2004 1:59 pm
From: Oscar kind <[EMAIL PROTECTED]> 

Sameer <[EMAIL PROTECTED]> wrote:
>  This page accesses the session every time it is invoked. The session timeout
>  is set to 60 seconds. What I have observed is that, If the page refresh 
>  interval is set to less than 30 seconds, then session lives for a long time,
>  but if it is longer then session is dropped frequently.
> 
>  Does this mean, it is not sufficient to access session only once during
>  timeout period to avoid timeout? I was under the impression that tomcat 4
>  would restart the 60 seconds timer after every access to session.

When does the 60 second interval start? When the page is being loaded?
After the page is loaded? In the latter case, the actual session access
interval will be longer than 60 seconds.

Also, I assume you ensured that each time the page is requested, the
JSP/servlet code is executed. I.e., no caching is done. Otherwise, there
will be a lot more points of failure.


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



== 2 of 2 ==
Date:   Fri,   Aug 27 2004 3:12 pm
From: Sudsy <[EMAIL PROTECTED]> 

Sameer wrote:
<snip>
> <meta  HTTP-EQUIV="refresh" CONTENT="35">
> <META http-equiv=Cache-Control content=no-cache>
> <META http-equiv=Pragma content=no-cache>

After reading Oscar's response, it strikes me that the headers
might be at fault after all. Here's some sample code from a web
app which is supposed to preclude caching:
     resp.setHeader( "pragma", "no-cache" );
     resp.setHeader( "expires", "-1" );
(where resp is the HttpServletResponse provided as the second
  argument to the doPost method)
Perhaps some additional research is in order?





==========================================================================
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 1 ==
Date:   Fri,   Aug 27 2004 2:10 pm
From: [EMAIL PROTECTED] (Christian Bongiorno) 

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.

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).

The closest alternative I could think of was to put them in their own
package and  then have "package" access to most of those methods.

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.

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?

Christian




==========================================================================
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 3:09 pm
From: [EMAIL PROTECTED] (Joshua Jones) 

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?



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

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