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

Today's topics:

* Michael Jackson Home Movie Horror - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a651d887ec746e00
* Counting words in an Html Document - 4 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5805c33eeb567770
* HTML File Upload using enctype=multipart/form-data in form? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afdd2b53d6979b61
* Integer.getInteger() why there? - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3831772f7db2048f
* Tomcat 5.0.28 problem - My servlet doesn't work - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e6a15a01d5ebbd61
* Detecting if a table in a database already exists ? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9fe9a0b1cc67fe14
* repainting due to a menu - 2 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bc8057f853541900
* Database for Java - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/45e3a2052d0e79a1
* how servlets obtain headers - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d80acbe3ff2b4bf0
* Print a XML string to browser doesn't work in JSP - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8abda23c6d86d8ee
* File Upload versus Copy File in Java - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/291cee04f8962107
* emacs Vs Eclipse? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58b6f53b3e1b91e1
* J2EE deploytool: The requested resource is not available. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a28c5005abef64b
* fortran with Java? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2cf11efacd8968db
* java embedded ppc - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f658b078f5910dc3
* Garbage collector quiz - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8540975084df1f47
* Division by zero: float vs. int - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6dc583f6638fa877
  
==========================================================================
TOPIC: Michael Jackson Home Movie Horror
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a651d887ec746e00
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 11:27 am
From: [EMAIL PROTECTED] 

Cancelled because of virus: Backdoor.Win32.Hackarmy.w





==========================================================================
TOPIC: Counting words in an Html Document
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5805c33eeb567770
==========================================================================

== 1 of 4 ==
Date:   Tues,   Oct 12 2004 1:32 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Lasse Reichstein Nielsen wrote:

> Paul Lutus <[EMAIL PROTECTED]> writes:
> 
>> In any case, this approach is way too complex. Instead, how about:
>>
>>    private static int countWordsInHTML(String s)
>>    {
>>       s = s.replaceAll("<.+?>","");
> 
> To take care of cases such as "Hello<br>world", the replacement string
> should be something like " ".

Yes, thank you, very good suggestion. This does nothing but good, there are
no drawbacks (because I split on "\\s+").

> 
>>       String[] array = s.split("\\s+");
> 
> I don't know the original poster's definition of a "word", but if,
> e.g., "he/she" should be two words, then splitting on whitespace is
> not enough. Perhaps something like "[^\\w]+" would be better (but not
> great, since \w only matches English letters and digits, not letters
> from other alphabets, which are part of words).

Then there is the issue of what defines a word, and according to whom. Is
"and/or" a word? A lawyer might insist that it is indeed a word, others
might insist it is two words.

> 
> So, a clear definition of "word" is necessary before we can evaluate
> the adequacy of a solution :)

Yes.

> 
> Also, since the input is HTML, one should also consider entities.
> Which is hard. E.g., "Me&amp;You" is two words, but "Bl&aring;b&aelig;r"
> is one. The best would probably be to convert all entities to their
> Unicode character first (but after removing tags, so &lt; won't cause
> confuzion). That requires a list of all the textual entities (&amp;,
> &aring;) whereas the numerical ones are easier (&#65;).

Yes, but only because we are counting words, not using the resulting text.
Some additional complex examples:

&nbsp; a space, not a word or part of a word.
&quot; a punctuation mark, maybe part of a word, maybe not.
&copy; a word. Or not?

And so forth.

> 
> Such a simple looking question :)

A conceptual onion, with many layers. :)

In any case, and disregarding most of that, here is the corrected method:

   private static int countWordsInHTML(String s)
   {
      s = s.replaceAll("<.+?>"," ");
      String[] array = s.split("\\s+");
      return array.length;
   }

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




== 2 of 4 ==
Date:   Tues,   Oct 12 2004 3:09 pm
From: Lasse Reichstein Nielsen <[EMAIL PROTECTED]> 

Paul Lutus <[EMAIL PROTECTED]> writes:

> In any case, and disregarding most of that, here is the corrected method:
...
>       String[] array = s.split("\\s+");
>       return array.length;

It looks like an awfully expensive operation to create the array when
all you need is the length. So, with that as an excuse to read up on regex,
I *think* this would be more efficient (but definitly not shorter):
---
   // match sequences of the Unicode letter category 
   // To give same result as above, use "[^\\s]+"
   Pattern pattern = Pattern.compile("\\p{L}+");
   Matcher matcher = pattern.matcher(s);
   int words = 0;
   while (matcher.find()) { 
      words ++;
   }
   return words;
---
It seems to work on simple examples (and gives a significant speedup).

/L
-- 
Lasse Reichstein Nielsen  -  [EMAIL PROTECTED]
 DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
  'Faith without judgement merely degrades the spirit divine.'



== 3 of 4 ==
Date:   Tues,   Oct 12 2004 6:46 pm
From: "David Hilsee" <[EMAIL PROTECTED]> 

"Lasse Reichstein Nielsen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Paul Lutus <[EMAIL PROTECTED]> writes:
>
> > In any case, and disregarding most of that, here is the corrected
method:
> ...
> >       String[] array = s.split("\\s+");
> >       return array.length;
>
> It looks like an awfully expensive operation to create the array when
> all you need is the length. So, with that as an excuse to read up on
regex,
> I *think* this would be more efficient (but definitly not shorter):
> ---
>    // match sequences of the Unicode letter category
>    // To give same result as above, use "[^\\s]+"
>    Pattern pattern = Pattern.compile("\\p{L}+");
>    Matcher matcher = pattern.matcher(s);
>    int words = 0;
>    while (matcher.find()) {
>       words ++;
>    }
>    return words;
> ---
> It seems to work on simple examples (and gives a significant speedup).

HTML is hard (impossible?) to parse using regular expressions.  See
http://www.perldoc.com/perl5.8.4/pod/perlfaq9.html#How-do-I-remove-HTML-from-a-string-

-- 
David Hilsee





== 4 of 4 ==
Date:   Tues,   Oct 12 2004 6:48 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Lasse Reichstein Nielsen wrote:

> Paul Lutus <[EMAIL PROTECTED]> writes:
> 
>> In any case, and disregarding most of that, here is the corrected method:
> ...
>>       String[] array = s.split("\\s+");
>>       return array.length;
> 
> It looks like an awfully expensive operation to create the array when
> all you need is the length.

Yes, its only virtue is its brevity in the source file, nothing else.

> So, with that as an excuse to read up on 
> regex, I *think* this would be more efficient (but definitly not shorter):
> ---
>    // match sequences of the Unicode letter category
>    // To give same result as above, use "[^\\s]+"
>    Pattern pattern = Pattern.compile("\\p{L}+");
>    Matcher matcher = pattern.matcher(s);
>    int words = 0;
>    while (matcher.find()) {
>       words ++;
>    }
>    return words;
> ---
> It seems to work on simple examples (and gives a significant speedup).

Did you measure the speedup or assume it? That aside, your method has a lot
to say in its favor, while mine mostly reflects my well-known laziness. :)

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





==========================================================================
TOPIC: HTML File Upload using enctype=multipart/form-data in form?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afdd2b53d6979b61
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 1:20 pm
From: Tim Slattery <[EMAIL PROTECTED]> 

[EMAIL PROTECTED] (Matt) wrote:

>Should we use enctype=multipart/form-data in the form, I know it is recommended 
>if the form has <input type="file">. My form has <input type="file"> and other 
>html controls.

If your form include an <input type="file"...> element, then you
*must* user enctype="multipart/form-data".

>
>I tried the following, 
>
>form.html
>=========
><FORM NAME="InputForm" ACTION="test.jsp" METHOD="POST" enctype=multipart/form-data>
><P><input type=text name="name" size=80>
><P><input type=file name="filename" size=80>
><P><input type="submit" value="Upload File Test">
></FORM>
>
>test.jsp
>=========
><p><%= "filename = " + request.getParameter("filename") %>
><p><%= "name = " + request.getParameter("name") %>
>
>
>It will output 
>filename = null
>name = null
>
>I don't understand why, but if i remove enctype=multipart/form-data in the form,
>then I am able to get the data.

Because it's transmitted as a MIME stream, a very different format
then a normal POST, and request.getParameter doesn't know about MIME
streams. The other elements, filename and name, are there, but you
have to get them correctly.

--
Tim Slattery
[EMAIL PROTECTED]




==========================================================================
TOPIC: Integer.getInteger() why there?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3831772f7db2048f
==========================================================================

== 1 of 3 ==
Date:   Tues,   Oct 12 2004 1:21 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

"Yogo" <n o s p a m> wrote:

> Hello,
> 
> There are in the Integer wrapper class methods named getInteger which
> return an Integer containing a system property value.
> 
> Now, I really wonder what a system property method does in the Integer
> wrapper class? Shouldn't these methods be in the System class or the
> Properties class??? The methods are not deprecated so I guess there is /
> was a good reason to put them there but I really can't think of any.

They are located as they are because they have to do with the behavior of
Integer instances. They are system properties because they can change from
platform to platform. So you see, an argument can be made for their
location in either class, but on its merits, the present location won out
over the alternative.

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




== 2 of 3 ==
Date:   Tues,   Oct 12 2004 4:02 pm
From: "Yogo" <n o s p a m> 

> They are located as they are because they have to do with the behavior of
> Integer instances.

Hmm, what do you mean?

I can create a system property with any name I want that holds whatever 
int-value I want.

The getInteger method just calls the System.getProperty method and converts 
the returned String to an Integer.

What does this have to do with the behavior of Integers?


Yogo 





== 3 of 3 ==
Date:   Tues,   Oct 12 2004 6:45 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

"Yogo" <n o s p a m> wrote:

>> They are located as they are because they have to do with the behavior of
>> Integer instances.
> 
> Hmm, what do you mean?

The returned value is an Integer instance. So it makes sense that the method
is located in the Integer class.

> 
> I can create a system property with any name I want that holds whatever
> int-value I want.

But these properties are returned as Integer instances. It is obvious that
they should be located in the Integer class.


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





==========================================================================
TOPIC: Tomcat 5.0.28 problem - My servlet doesn't work
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e6a15a01d5ebbd61
==========================================================================

== 1 of 3 ==
Date:   Tues,   Oct 12 2004 1:24 pm
From: "Will Hartung" <[EMAIL PROTECTED]> 

"Thomas Hoheneder" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> My question is: What went wrong? Why do I not get the text "Welcome to the
> Servlet Testing Center" of my TestingServlet displayed in the browser
> window?

Couple of things, as others have mentioned.

One, you're relying on what they call the Invoker Servlet, which makes
Servlets in the web.xml magically appear. Tomcat disables this by default,
as it's a bit of a security hole.

Two, there's potentially the package issue. By not having your Servlet code
within a Java package, you are in store for a whole lot of grief. Save for
the most crude of example programs, and particularly within things like
Servlet containers, always use a package.

To get your example to work, do this:

add:
package mypackage;

to the top of your Java file.

Compile the file, and place the resulting class file in:
WEB-INF/classes/mypackage/TestingServlet.class

Then, fix your web.xml file, and replace:
<servlet-class>TestingServlet</servlet-class>

with:
<servlet-class>mypackage.TestingServlet</servlet-class>

Finally, again in the web.xml file, add:

<servlet-mapping>
    <servlet-name>Testing</servlet-name>
    <url-pattern>/Testing</url-pattern>
</servlet-mapping>

Place that after your <servlet> tag.

That says "When you see the URL /Testing, call the Servlet name "Testing",
which is mapped to the 'mypackage.TestingServlet' class".

What the older invoker Servlet did was automatically create a
/servlet/ServletName servlet mapping for you. But, most web apps don't want
folks calling their Servlets directly. This was the default install behavior
in the past with Tomcat, but they removed it as many folks left this turned
on. You could still enable this behavior, but I don't suggest it.

After that, you should be good to go.

Good Luck!

Regards,

Will Hartung
([EMAIL PROTECTED])






== 2 of 3 ==
Date:   Tues,   Oct 12 2004 11:09 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

William Brogden wrote:

> On Tue, 12 Oct 2004 18:28:30 +0200, Thomas Hoheneder  
> <[EMAIL PROTECTED]> wrote:

[...]

>> As operating system I use Windows XP SP1 and my JAVA_HOME points to
>> "C:\jdk131" which I have also configured for Tomcat. Now, the book 
>> tells  me
>> to put the TestingServlet.class file into a sub directory "myApps" of the
>> webapps directory, which is under my Tomcat installation path.  
>> Furthermore I
>> have a deployment descriptor named web.xml. So in a whole I have the
>> following files:
>> <TOMCAT-HOME>/webapps/myApp/WEB-INF/TestingServlet.java
>> <TOMCAT-HOME>/webapps/myApp/WEB-INF/web.xml
>> <TOMCAT-HOME>/webapps/myApp/classes/TestingServlet.class
> 
> 
> Put all classes used in servlets into packages. Correctly name the
> package in your web.xml and save the class files accordingly.
> 
> Old versions of servlet books and examples depended on the
> "invoker" servlet which let you get away with classes in the
> default package. BAD IDEA. See this FAQ at JavaRanch
> 
> http://faq.javaranch.com/view?InvokerServlet

Also, the "classes" directory should go under WEB-INF, i.e. 
<TOMCAT-HOME>/webapps/myApp/WEB-INF/classes/

When you have done as William advised and assigned your servlet class to 
a package, its class file will need to appear in a corresponding 
subdirectory of the classes directory, e.g. 
classes/mypackage/TestingServlet.class if you assign the servlet to 
package "mypackage".


John Bollinger
[EMAIL PROTECTED]



== 3 of 3 ==
Date:   Tues,   Oct 12 2004 11:14 am
From: "Thomas Hoheneder" <[EMAIL PROTECTED]> 

Hello,

both William and John - your advices helped. It works now. Thank you very
much.

Nice greetings from
Thomas




----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---




==========================================================================
TOPIC: Detecting if a table in a database already exists ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9fe9a0b1cc67fe14
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 11:23 am
From: [EMAIL PROTECTED] (Thorsten Meininger) 

Sorry for this newbie question:
How do I find out from a java source if a table in a database already exists?

I cannot believe that I have to execute a SELECT statement and if there is an exception
I know that the table does not exist. But this is a really inconvenient solution.
There must be a direct request statement.

Thorsten





==========================================================================
TOPIC: repainting due to a menu
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bc8057f853541900
==========================================================================

== 1 of 2 ==
Date:   Tues,   Oct 12 2004 1:44 pm
From: "Oxnard" <[EMAIL PROTECTED]> 







"Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 12 Oct 2004 14:06:50 -0500, Oxnard wrote:
>
> > I am extending JApplet. I want the background color of the JApplet to
match
> > the background color of the web page. I found if I:
> ..
> > ...However, do this seems to cause repaint or paint not to be called.
>
> Whoa up a minute there.  You should find out, rather than guess.
> Put a System.out.println in both and find out which is being
> called when. (don't forget to call the 'super'..)
>
> > ...If I select the Menu the MenuItems display however
> > if I do not select an Item from the Menu the Items do not go away.
>
> I did not observe that behaviour using Java 1.5.0 beta.
> What Java version is your browser running?
> <http://www.physci.org/pc/property.jsp?prop=java.version>
>
>
> > Here is the current code:
>
> Your code example had a couple of problems, please
> look over this codument on creating an SSCCE..
> <http://www.physci.org/codes/sscce.jsp>
>
> > public class t4 extends javax.swing.JApplet {
>
> Write 'import' statements rather than reference every class
> by it's fully qualified name.
>
>
> > /** This method is called from within the init() method to
> > * initialize the form.
> > * WARNING: Do NOT modify this code. The content of this method is
> > * always regenerated by the Form Editor.
> > */
>
> ...ahemm. 'Form Editor'?
> <http://www.xdweb.net/~dibblego/java/faq/answers.html#Q34>
>
> There was also a problem with line wrap.
>
> HTH
>
> -- 
> 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


Java(TM) Plug-in: Version 1.4.1_02
Using JRE version 1.4.1_02 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\ox

using NetBeans 3.6 the java_home is 1.4.1_02

I'm not sure why the super needs to be called?





== 2 of 2 ==
Date:   Tues,   Oct 12 2004 2:48 pm
From: "Oxnard" <[EMAIL PROTECTED]> 


"Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 12 Oct 2004 15:44:55 -0500, Oxnard wrote:
>
> > "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> On Tue, 12 Oct 2004 14:06:50 -0500, Oxnard wrote:
> >>
> >>> I am extending JApplet. I want the background color of the JApplet to
> > match
> >>> the background color of the web page. I found if I:
> >> ..
> >>> ...However, do this seems to cause repaint or paint not to be called.
> ..
> >> Put a System.out.println in both and find out which is being
> >> called when. (don't forget to call the 'super'..)
> ..
> > I'm not sure why the super needs to be called?
>
> Perhaps I should have said, "don't forget to call 'super'
> if you override paint or repaint for debugging purposes"
>
> >>> ...If I select the Menu the MenuItems display however
> >>> if I do not select an Item from the Menu the Items do not go away.
> >>
> >> I did not observe that behaviour using Java 1.5.0 beta.
> >> What Java version is your browser running?
> >> <http://www.physci.org/pc/property.jsp?prop=java.version>
> ..
> > Java(TM) Plug-in: Version 1.4.1_02
>
> Early 1.4 versions were known to be buggy, try either
> 1.4.2_03 or 1.5.
>
> -- 
> 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


Got it! (Although I am a little unsure why) It seems the JLayeredPane did
not want to respond to a repaint()??
I then simply used a JPanel and the JApplet repaints as one would expect.
The menu is overwritten after selecting the item.
Here is the final code:


import java.net.URL;
import javax.swing.*;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.awt.geom.*;

public class t4 extends javax.swing.JApplet {

    /** Initializes the applet t2 This function Must be here*/
    public void init() {
        initComponents();
    }

    private void initComponents() {
         jPanel = new javax.swing.JPanel();
         jPanel.setBackground(new java.awt.Color(0xfe,0xfe,0xf2));
         Container contentPane = getContentPane();
         contentPane.add(jPanel);

        // Instantiate the objects
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenuBar1.setBackground(new java.awt.Color(0xfe,0xfe,0xf2));

        jMenu1 = new javax.swing.JMenu();
        jMenu1.setText("t1");
        jMenu1.setBackground(new java.awt.Color(0xfe,0xfe,0xf2));

        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem1.setBackground(new java.awt.Color(0xfe,0xfe,0xf2));
        jMenuItem1.setText("Go to java.sun.com");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
// An Anonymous Inner Class
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
                repaint();
            }
        });

        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem2.setBackground(new java.awt.Color(0xfe,0xfe,0xf2));
        jMenuItem2.setText("Go to Oracle");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
// An Anonymous Inner Class
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
                repaint();
            }
        });

        // add the Items to the Menu jMenu1
        jMenu1.add(jMenuItem1);
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);
        setJMenuBar(jMenuBar1);

    }

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        System.out.println("here I am");
        showStatus("test ");
        urlString = getParameter("link_1");
        try{
            final java.net.URL url = new java.net.URL(urlString);
            java.applet.AppletContext context = getAppletContext();
            context.showDocument(url,"right");
        }catch(java.net.MalformedURLException e){
            e.printStackTrace();
        }
    }

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        System.out.println("here I am");
        showStatus("test ");
        urlString = getParameter("link_2");
        try{
            final java.net.URL url = new java.net.URL(urlString);
            java.applet.AppletContext context = getAppletContext();
            context.showDocument(url,"right");
        }catch(java.net.MalformedURLException e){
            e.printStackTrace();
        }
    }

    private javax.swing.JPanel jPanel; // creates a JPanel so that the
background color can be changed
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private String urlString;
}










==========================================================================
TOPIC: Database for Java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/45e3a2052d0e79a1
==========================================================================

== 1 of 2 ==
Date:   Tues,   Oct 12 2004 3:39 pm
From: Carl <[EMAIL PROTECTED]> 

Carl wrote:

> Raphi wrote:
> 
>> Hello
>> I'm having the Apache 2.0 server and i would like to set up a database
>> that i can access with java. is mySQL a possibility??
>>
>> Raphi
> 
> 
> Yes, Yes it is.
> http://dev.mysql.com/doc/mysql/fr/Java.html
> 
> HTH,
> Carl.

Doh!
The .de tld would indicate that this link might be more appropriate <:o)
http://dev.mysql.com/doc/mysql/de/Java.html

Carl.



== 2 of 2 ==
Date:   Tues,   Oct 12 2004 4:40 pm
From: Frank <[EMAIL PROTECTED]> 

Raphi wrote:
> Hello
> I'm having the Apache 2.0 server and i would like to set up a database
> that i can access with java. is mySQL a possibility??
> 
> Raphi
Why would you use MySQL, though, when you can get a real database like 
PostgreSQL?

-Frank




==========================================================================
TOPIC: how servlets obtain headers
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d80acbe3ff2b4bf0
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 2:26 pm
From: "Madhur Ahuja" <[EMAIL PROTECTED]> 

Hello

While studying servlets, I noticed the function,
HttpServletRequest.getHeaderNames() which successfully retreived
all the headers passed by my browser.

However I noticed that, when I run my servlet behind a local proxy,
the servlet was unable to return any headers, i.e. it returned
null although the web page was corretly displayed.

How is this possible, since every page requested from the server has
a header and browser like I.E. expect to receive some minimum headers.

Here is the program:

import javax.servlet.*;
import java.io.*;
import javax.servlet.http.*;
import java.util.*;
file://see getheader.html for extension
public class GetHeader extends HttpServlet
{

 public void doGet(HttpServletRequest hrq,HttpServletResponse hrp)
 throws ServletException,IOException
 {
  InputStream is=hrq.getInputStream();
  PrintWriter pw=hrp.getWriter();
  hrp.setContentType("text/html");

  getit(hrq,hrp,pw);
  pw.println("</body>");
  pw.close();
  is.close();


 }

 public void doPost(HttpServletRequest hrq,HttpServletResponse hrp)
 throws ServletException,IOException
 {
  doGet(hrq,hrp);
 }

 void getit(HttpServletRequest hrq,HttpServletResponse hrp,PrintWriter pw)
 {

  Enumeration headers=hrq.getHeaderNames();
  while(headers.hasMoreElements())
  {
   String head=(String)headers.nextElement();
   pw.println(head+hrq.getHeader(head));
   pw.println("<br>");
  }


 }
}




--
Madhur Ahuja [madhur<underscore>ahuja<at>yahoo<dot>com]

Homepage
http://madhur.netfirms.com










==========================================================================
TOPIC: Print a XML string to browser doesn't work in JSP
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8abda23c6d86d8ee
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 3:40 pm
From: "Brusque" <[EMAIL PROTECTED]> 


"Matt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> xmlReq is the XML string, and I want to print it out in browser, but it
doesn't
> print it out. But when I go to view|source, then I could see the XML.
>
> <%
> String xmlReq = generateXML();
> out.println(xmlReq);
> %>
>
> any ideas? please help. thanks!!

Because you're not escaping the XML characters and the browser is trying to
render them/ignore them. You need to convert characters like < > & to &gt;
&lt; &amp; etc. if you want the browser to display it instead of interpret
it.






==========================================================================
TOPIC: File Upload versus Copy File in Java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/291cee04f8962107
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 3:41 pm
From: [EMAIL PROTECTED] (Matt) 

My JSP application needs file upload feature. And I plan to use Apache
File Upload API (http://jakarta.apache.org/commons/fileupload/index.html).

For the file copy, I implement a method void copyFile(String dest,
String src)
that read a source file 2K at a time, and write to the destination
file.

My question is what's the differences between file upload and file
copy? In theory, I can just use the file copy mechanism for file
upload. Is that correct?

please advise. thanks!!




==========================================================================
TOPIC: emacs Vs Eclipse?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58b6f53b3e1b91e1
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 11:07 am
From: Alan Mackenzie <[EMAIL PROTECTED]> 

Phillip Lord <[EMAIL PROTECTED]> wrote on 12 Oct 2004 15:27:09 +0100:

> Emacs could definitely do with being easier to use.

Hardly.  Emacs is phenomenally easy to use.  It's just difficult to
learn how to use.

> Eclipse does win here, although it insists on trying to import your
> java into a "project structure". Thanks, I already have one of these!

I can do without my tools dictating my development processes to me, thank
you very much!  [No, I've not yet tried Eclipse.]

> Cheers

> Phil

-- 
Alan Mackenzie (Munich, Germany)
Email: [EMAIL PROTECTED]; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").





==========================================================================
TOPIC: J2EE deploytool: The requested resource is not available.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a28c5005abef64b
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 4:48 pm
From: [EMAIL PROTECTED] ([EMAIL PROTECTED]) 

Hi All!

> But... when I enter this URL:
>    http://localhost:4848/card-service/card?WSDL
> I get this page:
> 
>    HTTP Status 404 - /card-service/card
>    type Status report
>    message /card-service/card
>    description The requested resource (/card-service/card) is not available.
>    Sun-Java-System/Application-Server

When I check the admin console, click on Application Server | General
tab, I see the following information:

Host Name: localhost
HTTP Port(s): 44861, 8181, 4848
IIOP Port(s): 3700, 3820, 3920
Configuration Directory:
/home/robertmarkbram/SUNWappserver/domains/domain1/config
Installed Version: Sun Java System Application Server Platform Edition
8.1 (build b28-beta)
Debug: Not Enabled

When I try this url:
http://localhost:44861/card-service/card?WSDL
It works!! I see the wsdl.

Rob
:)




==========================================================================
TOPIC: fortran with Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2cf11efacd8968db
==========================================================================

== 1 of 2 ==
Date:   Tues,   Oct 12 2004 9:32 pm
From: "Ann" <[EMAIL PROTECTED]> 


"Kay" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello all:
>
> I need to use some Fortran package in Java. I am not familiar with
Fortran.
> I am wondering what is the best way to do it. I tried f2c and planned to
use
> the Java native interface. Unfortunately I couldn't get the c lib and the
> f2c lib to link successfully with the c wrapper in Microsoft studio.
Anybody
> can give me some suggestions?
>
> thanks,
> -Kay
>
Is the Fortran stuff in the format of 'dll' files?





== 2 of 2 ==
Date:   Tues,   Oct 12 2004 9:38 pm
From: "Kay" <[EMAIL PROTECTED]> 

> Is the Fortran stuff in the format of 'dll' files?

no. I have source code instead.

-Kay. 






==========================================================================
TOPIC: java embedded ppc
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f658b078f5910dc3
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 7:45 pm
From: [EMAIL PROTECTED] (os2) 

hi

i search a jvm to work on a ppc (about 50mhz to 100mhz) 

any idea, 

thanks




==========================================================================
TOPIC: Garbage collector quiz
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8540975084df1f47
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 11:46 am
From: Chris Smith <[EMAIL PROTECTED]> 

Razvan wrote:
> > I choosed 10, the right answer is 11. The reason for this is the fact
> > that even if the variable tmp is out of scope it is STILL holding a
> > reference to the last 'tmp' string. Is that true ?!!

It actually depends on the question.  The question as written is 
ambiguous.  It could mean either of the following, for example:

1. How many object would it be legal for the garbage collector to have 
collected?, or

2. How many objects would it be possible that the garbage collector 
would have collected in the current version of the Sun reference 
implementation of the Java virtual machine?

I also rephrased the questions here to avoid the matter of whether 
objects have already been collected.

The answer to #1 is 11.  The answer to #2 is 10.  (Incidentally, 
question #1 narrowly avoids a dispute I have had with Dale on 
interpreting the JLS, but since the variable is out of scope I assume 
that even Dale would agree with me here that the answer is 11.)

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: Division by zero: float vs. int
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6dc583f6638fa877
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 9:48 pm
From: [EMAIL PROTECTED] (Joseph Daniel Zukiger) 

"Thomas G. Marshall" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Joseph Daniel Zukiger coughed up:
> > ...
> > But I'm still wondering, if you knew the functionality was available,
> > why argue in favor of making a floating point primitive do
> > non-primitive things?
> 
> It /should/ be a "primitive thing" IMHO.
> 
> The argument I'm making is that the floating point primitive operations 
> should hold
> 
>         NaN == NaN, for all values NaN :)

Well, let me see. I have a rocket for launching satellites, and a
routine that calculates my trajectory involving a string of
calculations in which the lengths of two hypotenii (hypotenuses?) are
calculated and compared. The programmer, of course, is checking the
sums of two sides for out-of-bounds conditions, right?

    if ( Math.sqrt( displacement1 ) != Math.sqrt( displacement2 ) )
        Rocket.courseChange( displacement1 - displacement2 );

(Way over simplified, and someone will complain about the brackets not
being there.)

Which approach is going to be more likely to tell me on the test rig
that something is amiss when displacement1 and displacement2 are both
Double.POSITIVE_INFINITY?

Of course it should never happen.

> That the .equals() method happens to get that right, is a side issue.

I'm not sure the equals() method "gets it right"., but, yes, it's a
side issue.

> In light of the wars I'm willing to fight to the death, this is certainly 
> not one of them.

Perhaps the reason it doesn't matter that much to you is that you
don't work with NaNs that much?

JouDanJaNehYa



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

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 

Reply via email to