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

Today's topics:

* File.lastModified *extremely* slow ? - 3 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c70759a9620dbe78
* JSTL commands do not work - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/318f42abad9da29e
* file image uploaded to a webserver appears garbled after upload. - 1 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ef06b42d62b446df
* Thread synchronization problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51dbef92f81ca351
* Dangerous code up for peer review - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b272cdaa2b9e9d7
* Powerbuilder and java - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5a2c4f17e3fc3c9
* WANTED: SOFTWARE INVENTIONS - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/31f204232b3af08
* Java SW Engineer to Architect Agile/XP Projects - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/779ed96c0f29ba50
* java splash window - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a18982f4ea35d6ef
* java+vrml - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/72f954e4ce21467
* System hangs while running java apps - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e68e8dfdc8bdb070
* Problems using FTP URL - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7797965ad901a18f
* Why does JApplet not need an instance? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/84afba8320bc26a6
* how is opencard.org doing? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d150078496052c5
* Problem in ant replace task and replaceregexp task to update xml - 1 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/df5f6702f49e68ba
* UTF 16 (byte[]) <--> String? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9199d3b6e927cb81
* Bah. Struts problem. Validation -- or lack thereof. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d69560b1a7cfa47
* can we use regular expression - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff9e1e198673fb7
* Unusual application for code coverage tool? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c87cfc4fff37e62e
* Method as parameter of other method in Java? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d08b43baa828e3f
  
==========================================================================
TOPIC: File.lastModified *extremely* slow ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c70759a9620dbe78
==========================================================================

== 1 of 3 ==
Date:   Tues,   Aug 31 2004 4:09 pm
From: [EMAIL PROTECTED] (Robert Mischke) 

"John C. Bollinger" <[EMAIL PROTECTED]> wrote:

>I can't explain your observations, but I ran my own test just now (Java 
>1.4.2 / Win2000 SP4 / Athlon (classic) 1.4 GHz / 25 GB FAT32 filesystem 
>/ 7200 RPM disk), and my results don't match up very well with yours.  I 
>created a simple FS scanner that recursively traverses a directory tree. 
>  In phase 1 of the test the scanner invokes getName() on each regular 
>file; in phase 2 (separate test runs) it invokes both getName() and 
>lastModified().  I observed a big speedup (ca. 2.5x) from the first run 
>to all subsequent ones, presumably because of the OS caches being 
>loaded, so that run was excluded from the statistics.
>
>I found that for 101208 files in 4882 directories, the scan took an 
>average of 12.9 seconds without lastModified(), and 15.6 seconds with 
>lastModified(), for a difference of roughly 21%.

This is really strange... only three seconds difference on 100.000
files is indeed much less that what I've got. (I eliminated the first
run from my tests as well.)

>[Note that JVM startup 
>time is _not_ factored out of those numbers.]

This might explain the low gain in percentage, as I ran my app from
Eclipse (which keeps a JV running) - but the absolute difference is
still much less than mine. And my system specs are almost identical to
yours, so this is not likely to be the cause: Athlon 1.8, Fat32,
Win2000 SP4, Java 1.4.2_03.

Confusing... but thanks for the test. Maybe I'll try to run some tests
on several machines as well.


Robert







== 2 of 3 ==
Date:   Tues,   Aug 31 2004 4:11 pm
From: [EMAIL PROTECTED] (Robert Mischke) 

DrAcKe <[EMAIL PROTECTED]> wrote:

>The first thing to come to my mind after read this post it's that your
>windows partition maybe need a "defrag".

Good idea, but the disk I was reading from is defragmented regularily.


Thanks anyway,

Robert




== 3 of 3 ==
Date:   Tues,   Aug 31 2004 4:17 pm
From: [EMAIL PROTECTED] (Robert Mischke) 

[EMAIL PROTECTED] (Robert Mischke) wrote:


>If they are really adding this to the 1.5 release (instead of 6, as
>originally planned), well, that's one more reason to look forward to
>1.5 :)

...which, as I just read, is planned for release on September, 30th,
according to Graham Hamilton.





==========================================================================
TOPIC: JSTL commands do not work
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/318f42abad9da29e
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 31 2004 4:09 pm
From: [EMAIL PROTECTED] (Joop Kaashoek) 

We have a problem with the following JSTL tag/code

<fmt_rt:message key="<%=(tasObj.showResult) ? "label.yes" : "label.no"
%>"/>

This ends up in the resulting page output as

<fmt_rt:message key="label.no"/>

instead of being translated. What could be the reason that this tag
does not get translated? Other tags such as <fmt:message...> work
fine..

Regards,

Joop Kaashoek



== 2 of 2 ==
Date:   Tues,   Aug 31 2004 4:24 pm
From: "Murray" <[EMAIL PROTECTED]> 


"Joop Kaashoek" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> We have a problem with the following JSTL tag/code
>
> <fmt_rt:message key="<%=(tasObj.showResult) ? "label.yes" : "label.no"
> %>"/>
>
> This ends up in the resulting page output as
>
> <fmt_rt:message key="label.no"/>
>
> instead of being translated. What could be the reason that this tag
> does not get translated? Other tags such as <fmt:message...> work
> fine..
>
> Regards,
>
> Joop Kaashoek

Are you defining the taglib at the top of the page?
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt"; prefix="fmt_rt" %>






==========================================================================
TOPIC: file image uploaded to a webserver appears garbled after upload.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ef06b42d62b446df
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 4:54 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Nishi Bhonsle wrote:

> 
> Hi:
> 
> The images uploaded in a directory on a web server from a client browser,
> end up garbled.


>From the documentation:

"FileReader is meant for reading streams of characters. For reading streams
of raw bytes, consider using a FileInputStream."


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





==========================================================================
TOPIC: Thread synchronization problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51dbef92f81ca351
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 4:55 pm
From: "Vincent Lascaux" <[EMAIL PROTECTED]> 

> Redesign the class.  I can't provide details, because I don't have any
> idea about what your class represents or how it is currently
> implemented.  To be sure, you already recognize that download must not
> directly or indirectly cause assertNotEmpty() to be invoked (in any
> thread).  It may help if you allow your code to assume some invariants
> instead of programmatically checking.  For instance, if download() can
> only be invoked from within assertNotEmpty() as shown above, then during
> the download you can assume that your instance was empty when the
> download started instead of making the threads invoke assertNotEmpty().

Do you think it would be good design to have the following thing :

interface IData
{ void a(); void b(); void c(); }

//This class is the class where the assertNotEmpty() function was
class Data implements IData
{
    //a, b, and c make no call to download
    public synchronized void a() { ... }
    public synchronized void b() { ... }
    public synchronized void c() { ... }
    public synchronized void download() { ... }
}

class DataAccessor implements IData
{
    private Data inner;
    private boolean empty = true;
    public DataAccessor(Data inner) { this.inner = inner; }
    private synchronized void assertNotEmpty() {
        if(empty) {
            inner.download();
            empty = false;
        }
    }
    public synchronized void a() { assertNotEmpty(); inner.a(); }
    public synchronized void b() { assertNotEmpty(); inner.b(); }
    public synchronized void c() { assertNotEmpty(); inner.c(); }
}

That way, download could access all the methods of the inner object without
dead locks...
What I dont like is that if I want to change my code to add a new public
function, I now have 3 classes to change instead of one... But well, that's
better than a bug :P

-- 
Vincent






==========================================================================
TOPIC: Dangerous code up for peer review
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b272cdaa2b9e9d7
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 4:15 pm
From: steve <[EMAIL PROTECTED]> 

Hi,
looking for some advice,

I have a database for addresses coded in java.

to print the addresses, a  jframe is popped up that holds various report 
layouts.
the user chooses a layout then this launches Jasper reports.

basically when the user presses  the print button is  the current screen is 
hidden.
then a  report layout  screen is popped up, ( this cannot be a modal, as it 
would sit on top of any screen generated by jreports)

the problem was , as the report layout screen was not a modal , the code was 
returning directly back to the "mother screen" ,and un-hiding it.


to get round this problem I have implemented a couple of linked lists, where 
the mother screens  sets up a separate thread and then  calls the child 
screens to get their status.



here is a small section of the jasper report compiler
   private void CancelButton_actionPerformed(ActionEvent e) {
         sendStatus(CMD_SIGNAL_GOOD_EXIT); //send exit to calling routine
      

        this.setVisible(false);
    }
        private void this_windowClosed(WindowEvent e) {
         sendStatus(CMD_SIGNAL_GOOD_EXIT); //send exit to calling routine
   

        //cancel the import 
        //here we need to exit the screen
        this.dispose();
    }

......

here is the signalling routine.

    public void sendStatus(int currentStatus) {
        String aa = String.valueOf(currentStatus);
        addWork(aa);
    }

    public synchronized void addWork(Object o) {
        queue.addLast(o);
     notify();
    }

    //it is possible that the program could get hung here
    //if the normal flow is interrupted
    public synchronized int getWork() throws InterruptedException {
        while (queue.isEmpty()) {
        wait();

        }

        return Integer.parseInt((String) queue.removeFirst());
    }


to stop the mother screen from being shown i have

     r = new Runnable() {
                        public void run() {
                            try {

call the layoutscreen & jasper reports here
 ReportWriter doReport = new ReportWriter(params,
                                        my_vars.dbconn, errorlogger);
                                while (statusFlag != CMD_SIGNAL_GOOD_EXIT) {
                                    statusFlag = doReport.getWork();
                                }
                            } catch (Exception ex) {
                                Error_stuff.handleError(ex, -1, -1);
                            } finally {
                                show();
                                repaint(); //refresh the screen
                            }
                        }
                    };
            new Thread(r).start();
        } catch (Exception ex) {
            Error_stuff.handleError(ex, -1, -1);
        }

i'm not really happy with the safety of the code, even though the exceptions 
and all exits from the child screen are covered, and after testing the mother 
screen is always shown again, even after an error.





==========================================================================
TOPIC: Powerbuilder and java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5a2c4f17e3fc3c9
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 5:14 pm
From: Real Gagnon <[EMAIL PROTECTED]> 

> Can someone tell me whether Java can access poserbuilder pbd files,
> and if so, how???

An easy way to use EAServer (the Sybase application server). Your 
Powerbuilder components are deployed in EAServer and can be accessed from 
your JSP code as a CORBA component or EJB.

You can download a free EAServer developper edition from the Sybase site.

Bye. 
-- 
Real Gagnon  from  Quebec, Canada
* Looking for Java or PB snippets ? Visit Real's How-to  
* http://www.rgagnon.com/howto.html




==========================================================================
TOPIC: WANTED: SOFTWARE INVENTIONS
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/31f204232b3af08
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 4:40 pm
From: steve <[EMAIL PROTECTED]> 

On Mon, 30 Aug 2004 17:44:47 +0800, Paul Lutus wrote
(in article <[EMAIL PROTECTED]>):

> Joona I Palaste wrote:
> 
>> ZOCOR <[EMAIL PROTECTED]> scribbled the following:
>>> Paul Lutus wrote:
>>>> Marcello do Guzman wrote:
>>>>> I will be making my first of several mid-month visits to several
>>>>> investors and venture capital firms beginning September. I am
>>>>> interested ONLY in SOFTWARE ventures. Of particular interest are the
>>>>> following types of software:
>>>> 
>>>> Stop trolling for morons here. Not that there aren't any, but your
>>>> sleazy scam is no less despicable on that ground. Only people who
>>>> haven't the slightest clue how software development and marketing
>>>> proceeds would let this shark into their swimming pool.
>> 
>>> Unbelievable.
>> 
>>> There should be laws against this sort of behaviour.
>> 
>> Paul Lutus's or Marcello do Guzman's behaviour?
> 
> Once you've heard the full details of Guzman's story, I think you may know
> which it is. Or, perhaps not. :)
> 


Paul,
 You are the wind beneath my wings, funniest thread I have read in a long 
time.

However youv'e got to give credit where credit is due.

he does have a fantastic webshite.

Steve






==========================================================================
TOPIC: Java SW Engineer to Architect Agile/XP Projects
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/779ed96c0f29ba50
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 6:19 pm
From: "Murray" <[EMAIL PROTECTED]> 


"Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 31 Aug 2004 14:12:39 -0700, Jerry Bires wrote:
>
> > You'll gain career enhancing ..
>
> (chortle)
>
> > ..skills in Agile software
> > development and Extreme Programming techniques,..
>
> kewl, ..d00d!   ;-)

Qué?






==========================================================================
TOPIC: java splash window
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a18982f4ea35d6ef
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 4:01 pm
From: Roy Ratcliffe <[EMAIL PROTECTED]> 

gino wrote:
> can anybody show me how to show a splash window before my program formally
> starts for 10 seconds. The splash window should show only color image/logo,
> without any window frame, title bar, etc.
> 
> how to use Java to implement this?

Dear Gino,

Maybe a little too late, but see what you think of this one
        http://www.aqss05.dsl.pipex.com/
It tries to avoid cruft with useful compromises, and makes use of 
asynchronous image loading---particularly useful in multiprocessor hosts 
when available.

Regards,
Roy
[EMAIL PROTECTED] (work)
[EMAIL PROTECTED] (study)




==========================================================================
TOPIC: java+vrml
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/72f954e4ce21467
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 7:48 pm
From: "juicy" <[EMAIL PROTECTED]> 

Hello,
Does anyone know how to send vrml object using java?





==========================================================================
TOPIC: System hangs while running java apps
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e68e8dfdc8bdb070
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 8:00 pm
From: "Dan Shield" <[EMAIL PROTECTED]> 

Still working on the problem, but it seems that it isn't only java apps. 
PCMark04
has inconsistant results for all the tests, I've just never seen the problem 
in other
apps before.

Thanks for not flaming me.

Dan

"Dan Shield" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> First of all, if I'm not in the right newsgroup my apologies.  I didn't 
> know where to start.
>
> I've got a Compaq Presario with a 1.5 GHz P4 and 256 Meg RAM.  Several 
> months ago, java apps started experiencing episodes where the would stop 
> responding for several minutes, and then continue on, only to repeat the 
> behavior several minutes later.
>
> I first ran the spyware/adware utilities, and nothing out of the ordinary 
> showed up.  I finally decided to reinstall the base os (XP).  Did that, 
> and immediately updated to SP2.  Same problem.  Updated audio and video 
> drivers. Same problem.  Updated the BIOS.  Same problem.  Replaced the 
> sound card. Same problem.
>
> Now the kicker.  I rebooted with a bootable Linux distro, downloaded and 
> installed the latest java version, configured FireFox w/ the plugin, and 
> ran one of the offending java apps.  SAME PROBLEM!
>
> It appears to be a hardware problem, since the OS and associated drivers 
> are completely different, but I have no idea what could be going on.  Has 
> anyone seen this before, or have any ideas as to what could be going on?
>
> Thanks,
>
> Dan
>
> 







==========================================================================
TOPIC: Problems using FTP URL
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7797965ad901a18f
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 8:04 pm
From: "Dave Rathnow" <[EMAIL PROTECTED]> 

For the benefit of others that may hit this and search the archives.

I'm pretty sure the problem is that whoever wrote the FtpClient code
had a few too many coldies while he/she was reading rfc2428.  The code
does not converse correctly with IPv6 FTP server and attempts to
issue an EPRT command after issuing an "EPSV ALL" command.
According to the rfc, this is verboten.

The bottom line, the code is broke, at least for Java 1.4.1_06.  I
downloaded
and treif Jakarta's commons-net package and the FTPClient class works
fine.

Dave.

"Dave Rathnow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I've been banging my head against this one for a couple of days now
> and need some help.  We recenly started using the URL class to transfer
> files via FTP.   Our code works well with all servers we've run into,
> except Solaris.  When we try to FTP a file, we get the following error:
>
> 501 EPRT not allowed after EPSV ALL
>
> I pulled the Java sourcs for the associated classes and moved them
> into my own packages so I could modify and debug the code.  I haven't
> been using the URL class, however, instead I've been using my own
> FtpURLConnection classes and a few other classes that lay between it
> and java Sockets.  I turned on debug and have gotten the following (some
> overhead removed...):
>
> Sending: TYPE I
> 200 Type set to I.
> Sending: EPSV ALL
> 200 EPSV ALL command successful.
> Sending: EPSV
> 229 Entering Extended Passive Mode (|||14389|)
> Sending: EPRT |1|192.168.2.33|3861|
> 501 EPRT not allowed after EPSV ALL
> Sending: PORT 192,168,2,33,15,21
> 501 PORT not allowed after EPSV ALL
>
> Can anyone tell me what may be going on here?  I'm not an expert in the
> FTP RFC but from what little I've read, there is some incompatability
> between the Java API and the Solaris server.
>
> Thanks,
> Dave.
>
>






==========================================================================
TOPIC: Why does JApplet not need an instance?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/84afba8320bc26a6
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 31 2004 8:50 pm
From: [EMAIL PROTECTED] (Jenny) 

Hi,

In an Applet program, it does not have an instance.  Could you tell me
why?  Thanks a lot.

Below is a sample:

import java.awt.*;

public class SalutonApplet extends javax.swing.JApplet {
    String greeting;

    public void init() {
        greeting = "Saluton mondo!";
    }

    public void paint(Graphics screen) {
        Graphics2D screen2D = (Graphics2D)screen;
        screen2D.drawString(greeting, 25, 50);
    }
}



== 2 of 2 ==
Date:   Tues,   Aug 31 2004 9:11 pm
From: "Liz" <[EMAIL PROTECTED]> 


"Jenny" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> In an Applet program, it does not have an instance.  Could you tell me
> why?  Thanks a lot.
>
> Below is a sample:
>
> import java.awt.*;
>
> public class SalutonApplet extends javax.swing.JApplet {
>     String greeting;
>
>     public void init() {
>         greeting = "Saluton mondo!";
>     }
>
>     public void paint(Graphics screen) {
>         Graphics2D screen2D = (Graphics2D)screen;
>         screen2D.drawString(greeting, 25, 50);
>     }
> }

browser does it I think.






==========================================================================
TOPIC: how is opencard.org doing?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d150078496052c5
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 8:54 pm
From: [EMAIL PROTECTED] (Joseph Daniel Zukiger) 

Thanks, Silas, for your comments about the all-in-one installer. I was
indeed able to download it, although I haven't yet been able to get it
running.

But does anyone have any information as to why opencard.org cannot be
contacted?

JouDanZuki




==========================================================================
TOPIC: Problem in ant replace task and replaceregexp task to update xml
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/df5f6702f49e68ba
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 8:58 pm
From: [EMAIL PROTECTED] (Victor) 

Problem solved -- simply use the jakata ono with ant.


[EMAIL PROTECTED] (Victor) wrote in message news:<[EMAIL PROTECTED]>...
> Dear all, 
> 
> I am having a problem in using the ant task replace to update the
> following xml file:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE
> Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd";>
> <application>
>   <display-name>TestServer</display-name>
>   <module>
>     <ejb>EJB1.jar</ejb>
>   </module>
>   <module>
>     <ejb>EJB2.jar</ejb>
>   </module>
>   <module>
>     <ejb>EJB3.jar</ejb>
>   </module>
>   <module>
>     <web>
>       <web-uri>web.war</web-uri>
>       <context-root>testme</context-root>
>     </web>
>   </module>
> </application>
> 
> I just want to remove the Web module in the above xml, that is:
> 
> ....
> <module>
>     <web>
>       <web-uri>web.war</web-uri>
>       <context-root>testme</context-root>
>     </web>
> </module>
> .....
> 
> I have tried to use the replace task as following:
> 
> <project name="ReplacementTest" default="test" basedir=".">
> 
> <target name="test">
>     
>     <echo message="Going to remove the war module in the file
> now..."/>
>     
>     <replace file="c:\ant build\test\application.xml">
>       <replacetoken><![CDATA[<module>
>                                  <web>
>                                       <web-uri>web.war</web-uri>
>                                             <context-root>testme</context-root>
>                                  </web>
>                              </module>]]>
>         </replacetoken>
>       <replacevalue>><![CDATA[ ]]></replacevalue>
> 
>     </replace>
> 
> </target>
> 
> </project>
> 
> And it just doesn't work.
> 
> At the same time, I also attempt to use the replaceregexp as
> following:
> 
> <project name="ReplacementTest" default="test" basedir=".">
> 
> <target name="test">
>     
>     <echo message="Going to remove the war module in the file
> now..."/>
>     
>     <replaceregexp file= "c:\ant build\test\application.xml" flags=
> "s" >
>     <regexp 
> pattern="(&lt;module&gt;)(&lt;web&gt;)(.*?)(&lt;/web&gt;)(&lt;/module&gt;)"
> />
>     <substitution expression="" />
>     </replaceregexp > 
>  
> </target>
> 
> </project>
> 
> And it keep giving me the " No supported regular expression matcher
> found" error.
> 
> Could anyone give me a help on this?
> 
> Thanks very much in advance!!!
> 
> Victor




==========================================================================
TOPIC: UTF 16 (byte[]) <--> String?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9199d3b6e927cb81
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 31 2004 9:13 pm
From: "Ong Hong Peow" <[EMAIL PROTECTED]> 

Hi,

is there a convenient way to convert unicode that's stored in byte array to
java String?
and vice-versa?

e.g. for a single single unicode,
the higher byte would be in byte[0],
lower byte[1]
and byte[2], byte[3] = 0. null terminated

the byte array of unicode is generated from a C program and transfered over
the network ..

looking over the String API doesn't reveal much ... or am I overlooking
something?

Thanks in advance.





== 2 of 2 ==
Date:   Tues,   Aug 31 2004 9:42 pm
From: "Mike Schilling" <[EMAIL PROTECTED]> 


"Ong Hong Peow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> is there a convenient way to convert unicode that's stored in byte array
to
> java String?
> and vice-versa?
>
> e.g. for a single single unicode,
> the higher byte would be in byte[0],
> lower byte[1]
> and byte[2], byte[3] = 0. null terminated
>
> the byte array of unicode is generated from a C program and transfered
over
> the network ..
>
> looking over the String API doesn't reveal much ... or am I overlooking
> something?
>
> Thanks in advance.
>

String -> bytes:     string.getBytes("UTF-16BE")
bytes -> String:     new String(bytes, 0, len, "UTF-16BE")

You'd have to write code to find the length of the byte array (i.e. to
search for the null terminator.)






==========================================================================
TOPIC: Bah. Struts problem. Validation -- or lack thereof.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d69560b1a7cfa47
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 10:28 pm
From: Steve Sobol <[EMAIL PROTECTED]> 

Latest version of Struts, Java 1.4.2_05 (I think), Jetty 5.0rc2

Struts works great. Except for validation. Validation doesn't. :)

If I override validate() and unconditionally add an error message, the form 
behaves properly (control is returned to the form no matter what). But the 
inherited validate() method is not detecting that my form fields are empty... 
see below for more information:

The form:

======================================================================
<%@ page session="false" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:xhtml/>
<title>testing</title>
<html:form action="/login">
<html:errors/>
<table align="center" border="0" width="600" cellpadding="5">
   <tr>
     <td width=300 style="text-align: right">Username or Email address:</td>
     <td width=300><html:text property="email"/></td>
   </tr>
   <tr>
     <td width=300 style="text-align: right">Password:</td>
     <td width=300><html:password property="password"/><BR/>
   </td></tr></table>
   <p style="text-align: center"><html:submit styleClass="button" value="Enter 
Client Services Site"/></p>
</html:form>
</CENTER>
</BODY></HTML>
======================================================================

The form's bean:
======================================================================
package net.justthe.csweb;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
import org.apache.struts.validator.ValidatorActionForm;

public class LoginForm extends ValidatorActionForm {
   private String email = "";
   private String password = "";

   public String getemail() {
     return(email);
   }

   public void setemail(String value) {
     email = value;
   }

   public String getpassword() {
     return(password);
   }

   public void setpassword(String value) {
     password = value;
   }

    public ActionErrors validate(ActionMapping mapping,
                                HttpServletRequest request) {

       ActionErrors errors = super.validate(mapping, request);
       if (errors == null) errors = new ActionErrors();

       // sometimes during testing I will add a call to
       // errors.add here, and if I do, I can submit the form and
       // have control return back to the form. if I do not, and leave
       // the form fields blank, control doesn't return back to the form
       // as it should.

       return errors;
    }
}
======================================================================

My struts-config.xml:
======================================================================
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
           "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
           "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>

<struts-config>
     <form-beans>
         <form-bean name="LoginForm" type="net.justthe.csweb.LoginForm"/>
     </form-beans>

     <action-mappings>
         <action path="/login" type="net.justthe.csweb.LoginAction"
            name="LoginForm" scope="request" input="/login.jsp" validate="true">
          <forward name="success" path="/loginSuccess.jsp"/>
         </action>
     </action-mappings>

     <message-resources parameter="/WEB-INF/webapp"/>

     <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
       <set-property
           property="pathnames"
           value="/WEB-INF/validator-rules.xml,/WEB-INF/csweb-validate.xml"/>
     </plug-in>
</struts-config>
======================================================================

The validator-rules.xml is the file from the Struts distro; my csweb-validate 
xml file is as follows:

======================================================================
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE form-validation PUBLIC
           "-//Apache Software Foundation//DTD Commons Validator Rules 
Configuration 1.0//EN"
           "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd";>

<form-validation>
     <formset>
         <form name="LoginForm">
             <field property="email" depends="required">
                <arg0 key="LoginForm.email"/>
             </field>
            <field property="password" depends="required">
                 <arg0 key="LoginForm.password"/>
             </field>
         </form>
     </formset>
</form-validation>
======================================================================

FWIW, I'm using Sitemesh to handle site templating. It's installed as a filter. 
This shouldn't make a difference, should it??

-- 
JustThe.net Internet & New Media Services, http://JustThe.net/
Steven J. Sobol, Geek In Charge / 888.480.4NET (4638) / [EMAIL PROTECTED]
PGP Key available from your friendly local key server (0xE3AE35ED)
Apple Valley, California     Nothing scares me anymore. I have three kids.




==========================================================================
TOPIC: can we use regular expression
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff9e1e198673fb7
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 10:38 pm
From: [EMAIL PROTECTED] (Anupam Sengupta) 

Dave Monroe <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] (saravana) wrote in message 
>> hai all,
>> 
>> i want to search a particular character in the given set of strings
>> ,the string can be of any length it can be changed dynamically .so if
>> i use loops then there may be performmance degradation
>> 
>> so please suggest me how i can do this one 
>> 
>> is there a possibility to do this work with regular expression 
>> 
> 
> Take a look at the matches() method of String.

If you are using JDK > 1.4, then string.matches() and family will do
what you want. If not, then you might want to try the Apache regexp
package available at:

http://jakarta.apache.org/regexp/

or the GNU regexp package: http://www.cacas.org/java/gnu/regexp/

- Anupam





==========================================================================
TOPIC: Unusual application for code coverage tool?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c87cfc4fff37e62e
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 10:46 pm
From: [EMAIL PROTECTED] (Anupam Sengupta) 

Jared MacDonald <[EMAIL PROTECTED]> wrote:
>> I'm searching for a java code coverage tool. I plan to identify every
>> line that isn't executed, and then comment it out of the source code,
>> in order to produce a truly minimal size java applet. Assuming that no
>> tool can do this actual thing, I would need line by line coverage
>> output in a readable file so I can run the commenting as a post
>> process.
> 
> I assume you came across Clover? 
> 
> http://www.cenqua.com/clover/
> 
> I'm not sure if you're willing to write unit tests to determine the
> code coverage of the applet, but if you are, Clover is very good at
> producing line-by-line reports of coverage (in a typical report, each
> line provides a highlighted indication of whether it was executed or
> not, and if it was, how many times).
> 

If you are willing to take the unit test approach, then the "NoUnit"
tool can also provide an indication on the coverage (well, coverage of
the tests actually). 

http://nounit.sourceforge.net/

This of course assumes that your test cases
exercise the application/applet extensively, and the branches/code being
left out can be reasonably excised from source without any negative
effects on actual operation.


- Anupam




==========================================================================
TOPIC: Method as parameter of other method in Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d08b43baa828e3f
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 31 2004 10:53 pm
From: [EMAIL PROTECTED] (Anupam Sengupta) 

Patrick May <[EMAIL PROTECTED]> wrote:
> Andrew Thompson <[EMAIL PROTECTED]> writes:
>> On Fri, 13 Aug 2004 20:15:26 +0200, aljo_ribw wrote:
>> > Is it possible to send a method as an argument to another method?
>> 
>> Why?
> 
>     I'm not sure why the original poster asked, but look up
> "functional programming" and "closures" on Google and you'll get one
> set of answers to your question.
> 

IBM developerworks has a good article on functional programming in Java.
The article is available at:

http://www-106.ibm.com/developerworks/java/library/j-fp.html

The article uses Jakarta Functor package, available at:

http://jakarta.apache.org/commons/sandbox/functor/

- Anupam




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

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