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

Today's topics:

* re-use the array variable compile error - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4283272c822091ac
* how to get component associated with an Action - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8e18b6ba085fdb1
* Sort Array Problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc8b01c6cee7f666
* Apache 2, Tomcat 5 and mod_jk - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1330fc45b8c0c51
* System.ext() - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6008bc2e14d4e02e
* .NET Programmer Needs To Learn Java - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b99c5dff939a0cea
* Setting java.library.path programatically - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/89cc976f37099e52
* Extracting text data from MS Word document - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/adadc7b9250f0fb1
* java.net.URI.equals() - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/13482983512ae419
* Could it be too bad to implement it as a tag? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7be6c3a08e023f28
* EJB - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d10a655890884de
  
==========================================================================
TOPIC: re-use the array variable compile error
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4283272c822091ac
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 6:00 pm
From: "Ike" <[EMAIL PROTECTED]> 

Do it like this Matt:

String[] ext = {"txt","html","gif","doc"};
ext = new String[]{"exe","pif"};
//Ike

"Matt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I tried to re-use the array variable, and it has compile error:
> illigeal start of expression. any ideas??
>
> String[] ext = {"txt","html","gif","doc"};
> ext = {"exe","pif"};
>
>
> thanks!






==========================================================================
TOPIC: how to get component associated with an Action
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8e18b6ba085fdb1
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 7:45 pm
From: [EMAIL PROTECTED] (robert walker) 

thanks all, i realize that many components can be linked to one action
obejct, but only one will trigger actionPerformed at a time, and it be
nice to
have a method like so
JComponent[] getRegisterComponentsOfAction()

I need a reference to componet(s) but I am not in the 
actionperformed so the obvious getSource(0 will not do the trick
I did what one person said and just sotred it in the action object for
now

thanks all




==========================================================================
TOPIC: Sort Array Problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc8b01c6cee7f666
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 8:15 pm
From: Babu Kalakrishnan <[EMAIL PROTECTED]> 

Carl Howells wrote:
> Babu Kalakrishnan wrote:
> 
>>      public int compare(Object o1, Object o2)
>>      {
>>         Integer a1 = (Integer)o1;
>>         Integer a2 = (Integer)o2;
>>     return a1.intValue()-a2.intValue();    // for reverse sort
>>      }  
>> Note the simplification in the last line. Since the comparator doesn't 
>> insist that the result be any specific value (like 1 or -1), when the 
>> arguments are unequal, 3 comparisons are unnecessary - a simple 
>> subtraction would do since it will return a result with the proper sign.
> 
> 
> Well, you were so close to being correct.  You understood her 
> fundamental problem much better than anyone else who posted did.  But 
> that above advice is simply wrong.
> 
> What happens when that compare is called on these objects?
> 
> Integer i1 = new Integer(2147483647);
> Integer i2 = new Integer(-2147483646);
> 
> Assuming the comparator instance is "comp", comp.compare(i1, i2) returns 
> -3. Last I checked, i1 is not the smaller value there.

Good point. The simplified code above would fail on integer overflows. 
I stand corrected. Thanks for pointing it out.

BK




==========================================================================
TOPIC: Apache 2, Tomcat 5 and mod_jk
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1330fc45b8c0c51
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 8:35 pm
From: Lalit Mehta <[EMAIL PROTECTED]> 

Hello All,

I am trying to try running tomcat with apache. I want all requests to 
come to apache server and if the request is for jsp or servlet, it is 
sent to tomcat server.

I researched a bit and found that mod_jk is what could be used to handle 
this situation.

My question is that when a user come to apache server a session is set 
and when the user is sent to tomcat server I want to be able to get that 
session content. What is the best way to do so.

Also, just curious, will it make any difference if the apache and tomcat 
are on separate server as compared to installed on same machine?

Thanks in advance,

-Lalit




==========================================================================
TOPIC: System.ext()
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6008bc2e14d4e02e
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 8:40 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Sun, 12 Sep 2004 01:44:49 GMT, Andrew Thompson wrote:

> On Sat, 11 Sep 2004 15:58:41 +0200, steph wrote:
> 
>> Is the any way to prevent a class to do a System.exit()
> 
> <sscce>
<snip>

That one was very hackish, and I mistakenly
thought the security manager could not be
changed back to the original.  This version
demonstrates that it can.

<sscce>
import java.awt.*;
import java.awt.event.*;
import java.security.Permission;

/** NoExit demonstrates how to prevent 'child'
applications from ending the VM with a call
to System.exit(0).
@author Andrew Thompson */
public class NoExit extends Frame implements ActionListener {

   Button frameLaunch = new Button("Frame"),
      exitLaunch = new Button("Exit");

   /** Stores a reference to the original security manager. */
   ExitManager sm;

   public NoExit() {
      super("Launcher Application");

      sm = new ExitManager( System.getSecurityManager() );
      System.setSecurityManager(sm);

      setLayout(new GridLayout(0,1));

      frameLaunch.addActionListener(this);
      exitLaunch.addActionListener(this);

      add( frameLaunch );
      add( exitLaunch );

      pack();
      setSize( getPreferredSize() );
   }

   public void actionPerformed(ActionEvent ae) {
      if ( ae.getSource()==frameLaunch ) {
         TargetFrame tf = new TargetFrame();
      } else {
         // change back to the standard SM that allows exit.
         System.setSecurityManager(
            sm.getOriginalSecurityManager() );
         // exit the VM when *we* want
         System.exit(0);
      }
   }

   public static void main(String[] args) {
      NoExit ne = new NoExit();
      ne.setVisible(true);
   }
}

/** This example frame attempts to System.exit(0)
on closing, we must prevent it from doing so. */
class TargetFrame extends Frame {
   static int x=0, y=0;

   TargetFrame() {
      super("Close Me!");
      add(new Label("Hi!"));

      addWindowListener( new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
            System.out.println("Bye!");
            System.exit(0);
         }
      });

      pack();
      setSize( getPreferredSize() );
      setLocation(++x*10,++y*10);
      setVisible(true);
   }
}

/** Our custom ExitManager does not allow the VM
to exit, but does allow itself to be replaced by
the original security manager.
@author Andrew Thompson */
class ExitManager extends SecurityManager {

   SecurityManager original;

   ExitManager(SecurityManager original) {
      this.original = original;
   }

   /** Deny permission to exit the VM. */
    public void checkExit(int status) {
      throw( new SecurityException() );
   }

   /** Allow this security manager to be replaced,
   if fact, allow pretty much everything. */
   public void checkPermission(Permission perm) {
   }

   public SecurityManager getOriginalSecurityManager() {
      return original;
   }
}
</sscce>

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




==========================================================================
TOPIC: .NET Programmer Needs To Learn Java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b99c5dff939a0cea
==========================================================================

== 1 of 2 ==
Date:   Wed,   Sep 15 2004 10:02 pm
From: Owen Jacobson <[EMAIL PROTECTED]> 

On Wed, 15 Sep 2004 17:26:32 +0800, Vincent Cantin wrote:

>> Some questions:
>>
>> 1. Is there a low cost way to learn, compile and develop for this
> langauge?
>> (aka Visual Studio but not costing an arm and a leg like this platform)
> 
> It is hard to shoot a bullet in your feet with Java. In fact, Java will
> embed the bullet in a safe exception just before it touch the feet. So ...
> it will not cost you a leg, you will just be notified of a
> IllegalArgumentException : "Bullets are not elligible for leg penetration"
> ... when the bullet will try to peneter the feet and the penetration will be
> canceled.

Not only will Java helpfully pad them in exceptions, but you must be
prepared to catch said bullets -- even if you're only *talking politely*
with someone carrying a gun.

Cheers, etc

-- 
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution. 




== 2 of 2 ==
Date:   Thurs,   Sep 16 2004 12:23 am
From: [EMAIL PROTECTED] (Christian Hvid) 

"scorpion53061" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Hello,
> 
> I am a vb.net programmer. That being said I have been forced to conclude I 
> need to learn java ...
> 
> Some questions:
> 
> 1. Is there a low cost way to learn, compile and develop for this langauge? 
> (aka Visual Studio but not costing an arm and a leg like this platform)

Yes. Besides the latest SDK from Sun - you probably need:

1. An IDE:

http://www.eclipse.org/ or
http://www.jetbrains.com/idea/index.html (recommended)

2. A build/make tool:

http://ant.apache.org/

3. If you are doing web applications - some web application framework
and server. Look at these open source projects:

http://jakarta.apache.org/velocity/
http://jakarta.apache.org/tomcat/index.html
http://struts.apache.org/

If you are doing GUI, you will do with Swing (contained in the SDK)
but in that case consider the alternative IDEs JBuilder or NetBeans
for their good GUI builders.

> 2. Can programs written here run on AIX 5.1 (non DB2 environment)?  is there 
> a specific install I need to do to make these programs work on AIX 5.1?

Built programs (jar files and class file) should run without
modification on IBM AIX. Beware of what Java version is running on the
AIX.

> 3. I believe they use .idx files for their database structure. Can Java be 
> of use in reading, modifying and inserting data into these environments?

Dunno? IDX files sound like DB2, Java can talk to DB2.

> 4. What is the java equivalent (if there is one) to ADO.NET?

There is the java.sql package in the standard Java distribution and
some of the EJB stuff may be relevant. But also look at these two open
source projects, which may be very helpful in what you are trying to
do:

http://www.hibernate.org/
http://xstream.codehaus.org/

> 5. Am I looking at a huge learning curve?

IBM AIX is not exactly user friendly. You might be learning two new
environments: Unix and Java at the same time. Be patient and persitent
:-D

regards,

Christian Hvid
http://vredungmand.dk




==========================================================================
TOPIC: Setting java.library.path programatically
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/89cc976f37099e52
==========================================================================

== 1 of 2 ==
Date:   Wed,   Sep 15 2004 10:34 pm
From: "Aaron Fude" <[EMAIL PROTECTED]> 

Hi,

Is there a way to modify java.library.path in the code?

I try the following in Windows

System.setProperty("java.library.path", "C:\\My\\Library\\Path;" +
System.getProperty("java.library.path"));
System.loadLibrary("MyLibrary");

...but it can't find it. (Everything works when I stick MyLibrary.dll
physically in one of the directories in the original path.)

Should what I'm trying to do work in principle? Thanks!

Aaron Fude






== 2 of 2 ==
Date:   Wed,   Sep 15 2004 11:28 pm
From: Gordon Beaton <[EMAIL PROTECTED]> 

On Thu, 16 Sep 2004 05:34:17 GMT, Aaron Fude wrote:
> Is there a way to modify java.library.path in the code?
> 
> I try the following in Windows
> 
> System.setProperty("java.library.path", "C:\\My\\Library\\Path;" +
> System.getProperty("java.library.path"));
> System.loadLibrary("MyLibrary");
> 
> ...but it can't find it. (Everything works when I stick
> MyLibrary.dll physically in one of the directories in the original
> path.)
> 
> Should what I'm trying to do work in principle? Thanks!

No.

AFAIK, Java doesn't actually search for the shared library. Like many
of the system properties, the value in java.library.path is just
"f.y.i." and changing it doesn't actually change the behaviour of the
JVM.

On Unix, the dynamic linker (not the JVM!) searches for shared
libraries using a preconfigured path as well as the directories in the
user's LD_LIBRARY_PATH setting. On Windows, DLLs are loaded from the
PATH (although I don't know who does this search).

If you want to load a library from a specific location, you can use
System.load() instead (at the cost of some platform independence).

/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: Extracting text data from MS Word document
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/adadc7b9250f0fb1
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 10:51 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Ann wrote:

/ ...

> If you have control, save the word document in RTF format
> which is mostly text.

Not really. Look at one sometime in a plain-text editor.

> Then just read it as any other text file. 

If the intent is to read it "as any other text file", why not save it as any
othre text file? Word does that too. If instead it is saved as RTF, it
should be read as RTF, which Java can do with some limited success.

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





==========================================================================
TOPIC: java.net.URI.equals()
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/13482983512ae419
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 12:11 am
From: Peter Davis <[EMAIL PROTECTED]> 

I'm trying to figure something out -- java.net.URI.equals() makes no 
sense the way it is specified:

        "When testing the user-information, path, query, fragment, authority,  
or scheme-specific parts of two URIs for equality, the raw forms rather 
 than the encoded forms of these components are compared and the  
hexadecimal digits of escaped octets are compared without regard to  
case."

First of all, is that a typo?  I think it's trying to say "the raw 
forms rather than the /decoded/ forms...".  Aside from that, the 
problem is that it would make sense if two URIs with encoded or 
unencoded versions of the same characters should be equal, but they're 
not.  I wrote a little test class:

import java.net.*;

class Test {
        public static void main(String[] args) throws Throwable {
                URI u1 = new URI("foo%7Ebar");
                URI u2 = new URI("foo%7ebar");
                URI u3 = new URI("foo~bar");

                System.out.println(u1 + " == " + u2 + " => " + u1.equals(u2));
                System.out.println(u1 + " == " + u3 + " => " + u1.equals(u3));
                System.out.println(u2 + " == " + u3 + " => " + u2.equals(u3));
        }
}

Outputs:

foo%7Ebar == foo%7ebar => true
foo%7Ebar == foo~bar => false
foo%7ebar ==foo~bar => false

Why in the world would it compare the raw rather than decoded forms of 
the URI?  Anybody have any clues?

-- 
Peter Davis <[EMAIL PROTECTED]>
"Furthermore, I believe bacon prevents hair loss!"





==========================================================================
TOPIC: Could it be too bad to implement it as a tag?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7be6c3a08e023f28
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 12:40 am
From: Rhett Liu <[EMAIL PROTECTED]> 

Hi,Kind guys!

I'm in troulbe with a choice of custom tag.
The situation is:
I have some record stored in database,but not much records,just like a 
catalog,less than 30,there's need to display them all in a web page as a 
list,I want to write a custome tag to display them,fill them in a 
<select><option></option></select>'s options;If I don't do like 
this,however,I have to refill all them in to a java bean in a action 
bean,consider that first we get it from an edit-action,next we submit it 
to the save-action,if save-action fill and have to redirect back to edit 
page,hear we have to refill all them in to a java bean(which is stored 
in request not session,i think this is more suitable).
Which method should i do?One of my mates considers it is bad design,he 
seems don't like write custom tag,it is dangerous,not clear!

How about your ideas?

Thanks




==========================================================================
TOPIC: EJB
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d10a655890884de
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 1:19 am
From: "Martinez" <[EMAIL PROTECTED]> 

Hello 
I have problem.
When my EJB CMP + JSP write data to database generate error

type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error)
that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
    at org.apache.jsp.dodaj$jsp._jspService(dodaj$jsp.java:75)

line 75 file dodaj$jsp.java

                
                    PomiarHome home = ( PomiarHome)session.getAttribute("home");
                    Pomiar newPomiar = 
home.create(id,miejscowosc,data_pomiaru,temperatura,cisnienie,wilgotnosc,kierune
k_wiatru);

what is wrong  ???

Thx for any help

Martinez



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

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 --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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