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

Today's topics:

* Extracting c++ header from jar file using javah - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5756da3597b2a06d
* Java trick - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad
* Thread synchronization - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
* Java implementation of crypt() wanted! - 4 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c9d4b7c65f13df2a
* Static mess - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f0afc75c5b4e5d21
* Is it possible to alter Ant properties after they've been initialized? - 3 messages, 
1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b49e18141bedfe87
* Beginner Advice Sought - 3 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b96a0a430a102e22
* How to get a file as a resource - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e2951f5a74da6102
* struts & restarting Tomcat - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5bee53f53da7265c
* using Vst / VstInstrument - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c679ce1cea0f4202
* Variable Arg Lists to PreparedStatements - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/184f86104809543e
* Select and Edit a Record in a Table of JSP page - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5a1fe050df12660
* JSTL el list subclassing and property conflicts - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d2ae9d1a6f1dee61
* Quick question on StreamTokenizer - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/69165678d49ad670
* J2ME Scheduled task? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/63ea15d2afb8e095
* How to incremet IndetAddress / IP numbers - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94897e32234ceaaf
  
==========================================================================
TOPIC: Extracting c++ header from jar file using javah
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5756da3597b2a06d
==========================================================================

== 1 of 2 ==
Date:   Mon,   Sep 20 2004 2:19 pm
From: "Michael Saunby" <[EMAIL PROTECTED]> 


"Rmac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm trying to create a native header from an existing jar file
> (actually, only one class w/in the jar file).  I've tried all sorts of
> command line arguments (w/ classpath) and nothing seems to work.
>
> Here's the setup:
>
> * package is blah.jar and contains dozens of classes, one of which I'm
> interested in creating a .h for (blahClass.java)
> * I have the source for it in another directory but its dependencies
> are pretty large and I figure using javah on the .jar file would be
> easiest?
> * why wouldn't this work:
>
> javah -classpath c:\temp\work\blah.jar blahClass
>
> blahClass is also part of a larger package (net.program.message) so I
> also tried:
>
> javah -classpath c:\temp\work\blah.jar net.program.message.blahClass
>
> nothing works.
>
> any ideas?  thx

I'll bet "it works" - it just doesn't work as you believe it should.  I've
used javah before, but not in the way you describe - I've used it to create
.h files when I've defined native methods, which is I expect what it's
actually for.

Maybe you need to take a look at SWIG http://www.swig.org, and even rethink
what it is you're trying to do.

Michael Saunby






== 2 of 2 ==
Date:   Mon,   Sep 20 2004 4:15 pm
From: "hilz" <[EMAIL PROTECTED]> 

> * why wouldn't this work:
>
> javah -classpath c:\temp\work\blah.jar blahClass
>
> blahClass is also part of a larger package (net.program.message) so I
> also tried:
>
> javah -classpath c:\temp\work\blah.jar net.program.message.blahClass
>
> nothing works.
>
> any ideas?  thx





What error message do you get?






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

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 2:26 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

P.Hill coughed up:

(snipped out by P.Hill):

P.Hill:
> 2. Non static data OR METHODs are referred to based upon the class of
> the underlying object. (the name used in the class declaration).


> Thomas G. Marshall wrote:
>> /NO/, you *still* have it wrong.
>>
>> The non static data is /not/ referred to based upon the class of the
>> underlying object.
>
> Well, at least I have the terms type and class correct now. :-)
>
>>         $ run experiments.simple.StaticPolyAccess
>>         Top static string
>>         Top static method
>>         *Top non static string* <---------------------
>
> That is the result of 'hiding' NOT polymorphism.

No kididng, I didn't SAY this access was polymorphism.  If it /was/
polymorphism and data elements could be overridden, it would have reffered
to the member element of the Bottom instance.

You said:
        Non static data OR METHODs are referred to
        based upon the class of the underlying object.

The data members are not, as shown.  In my example, the class of the
underlying object is Bottom.  Non-static data are not referred to based upon
the class of the underlying object.  In my example, the non-static data is
clearly from Top.

-- 
Everythinginlifeisrealative.Apingpongballseemssmalluntilsomeoneramsitupyourn
ose.






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

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 2:29 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Lee Fesperman coughed up:
> Thomas G. Marshall wrote:
>>
>
> [ Rant Snipped ]
>
> Yeah, right. You want to invent your own terminology and concepts and
> then argue vehemently (against all comers) that we must accept it on
> your terms. You're doing this on other threads as well.

...[rip]...


Funny how you didn't answer the points in my post.  I've shown you to be
incorrect, and shown you to be dishonestly representing quotes.

No wonder you say "yeah right", and snip it all away.

You were the first to use insulting terminology, and now that you've shown
to be a fool, you cannot stand it.




-- 
Everythinginlifeisrealative.Apingpongballseemssmalluntilsomeoneramsitupyourn
ose.






==========================================================================
TOPIC: Java implementation of crypt() wanted!
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c9d4b7c65f13df2a
==========================================================================

== 1 of 4 ==
Date:   Mon,   Sep 20 2004 2:34 pm
From: Mark Marcus <[EMAIL PROTECTED]> 

On Mon, 20 Sep 2004 13:48:14 +0200, "Zsolt" <[EMAIL PROTECTED]>
wrote:

>Hi,
>
>I need the java implementation of the Unix crypt function. Can somebody help
>me?
>
>Zsolt
>

Check out JCrypt.
http://jxutil.sourceforge.net/API/org/sourceforge/jxutil/JCrypt.html




== 2 of 4 ==
Date:   Mon,   Sep 20 2004 2:47 pm
From: Mark Marcus <[EMAIL PROTECTED]> 

On Mon, 20 Sep 2004 11:58:03 GMT, Andrew Thompson
<[EMAIL PROTECTED]> wrote:

>On Mon, 20 Sep 2004 13:48:14 +0200, Zsolt wrote:
>
>> I need the java implementation of the Unix crypt function. 
>
>Do you mean this?
><http://www.opengroup.org/onlinepubs/007908799/xsh/crypt.html>
>
>>..Can somebody help me?
>
>I dunno.  Can you help yourself?  Do you Google?
>
>Ten minutes ago I had not heard of crypt, but I figure 
>some of these 8,130 hits might assist your solution..
><http://google.com/search?q=unix+crypt+java+%22source+code%22>
>
>HTH


You know, Andrew, I think you mean well... but this kind of response
in a newsgroup simply doesn't do.  It's very rude, and doesn't do the
Java community any benefit.  If you don't know the answer, then don't
post a reply.  Your snide "Use google" isn't helping anyone.

You obviously looked up crypt, and found the Unix specification for
it.  Great!  Now how is that going to help a Java programmer?  Surely
you must've been in the position where you're looking for a solution,
and can't find it in the search engines---I don't know about you, but
that's when I usually post a question in the comp.lang groups.
Irresponsible responses like yours is why I'm finding it more useful
to go to the pay-as-you-go websites than Usenet.  The people on those
pay-as-you-go are interested in providing a solution rather than an
ego-stroking unhelpful reply.

Once upon a time, Usenet was so much more useful.  What happened?


Once again, on topic, a JCrypt function is built into JxUtil, an open
source solution.  The previous link was to the Java Doc--but it
appears you can download the binary from:
http://sourceforge.net/project/showfiles.php?group_id=27749

Truly, I hope this helps.






== 3 of 4 ==
Date:   Mon,   Sep 20 2004 6:44 pm
From: Sudsy <[EMAIL PROTECTED]> 

Mark Marcus wrote:
<snip>
> You obviously looked up crypt, and found the Unix specification for
> it.  Great!  Now how is that going to help a Java programmer?  Surely
> you must've been in the position where you're looking for a solution,
> and can't find it in the search engines---I don't know about you, but
> that's when I usually post a question in the comp.lang groups.
> Irresponsible responses like yours is why I'm finding it more useful
> to go to the pay-as-you-go websites than Usenet.  The people on those
> pay-as-you-go are interested in providing a solution rather than an
> ego-stroking unhelpful reply.
> 
> Once upon a time, Usenet was so much more useful.  What happened?

Hold your horses there, pardner! Andrew is pointing out that people
who do their own research are usually rewarded for their efforts in
a more timely manner than by waiting for replies to a post on Usenet.
Nothing has changed except that the resources available these days
are hugely improved yet not everyone knows how to use them.
Using search engines is an acquired skill and involves distilling a
request down to the essence of two or three terms. It also helps to
know the standard syntax, namely that adding the plus sign to the
beginning of a term means that the results MUST include the word or
phrase (enclosed in quotes in the case of a phrase).
So I went to the archives and entered the string "+java +crypt
+algorithm" and was pleased to find all manner of relevant posts.
We should all be indebted to Digital Equipment Corporation (may it
rest in pieces) and people like Andrew who try to steer people in a
direction which will be benificial.
Sorry that you didn't like the message, but don't shoot the messenger.
I've made similar exhortations in the past as there's a wealth of
knowledge to be found at <http://groups.google.com/>. If you can't
find an answer in more than two decades of postings then your query
is likely unique, or nearly so. In that case, most people would be
more than happy to reply and share their experiences.
Fair enough?




== 4 of 4 ==
Date:   Mon,   Sep 20 2004 9:18 pm
From: Jacob <[EMAIL PROTECTED]> 

Mark Marcus wrote:

> You know, Andrew, I think you mean well... but this kind of response
> in a newsgroup simply doesn't do.  It's very rude, and doesn't do the
> Java community any benefit.  If you don't know the answer, then don't
> post a reply.  Your snide "Use google" isn't helping anyone.
> 
> Once upon a time, Usenet was so much more useful.  What happened?

Thanks Mark! I couldn't agree more.
What did happen?





==========================================================================
TOPIC: Static mess
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f0afc75c5b4e5d21
==========================================================================

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 2:46 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Mike Schilling coughed up:
> "Razvan" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Hi !
>>
>>
>>
>>
>> In the following code:
>>
>> public class CDummy
>> {
>> static {
>> jj = 5;
>> // System.out.println("jj=" + jj);
>> }
>>
>> public static void main(String args[])
>> {
>> System.out.println("CDummy.");
>>
>> System.out.println("jj = " + jj);
>> }
>>
>> static int jj = 6;
>> }
>>
>> I can assign to the primitive jj the value 5 even if the primitive is
>> defined later, however I cannot print its value because I use a
>> 'forward reference' ! Can somebody explain why I can do
>>
>>
>> jj = 5;
>>
>>
>> but I cannot do
>>
>> System.out.println("jj=" + jj);
>>
>>
>> I think that I should either have access to jj prior to declaration +
>> definition (line: static int jj = 6;) in both cases or the access
>> should be denied in both cases. If there is a logical explanation for
>> this I would like to hear it.
>
> I don't know what you mean by "can't do it".  It compiles and runs
> fine (under 1.4.2).


HUH?  Are you sure?  My 1.5.0 is gacking on it big time, as is consistent
with the jls, IMO anyway.

Did you remove the // in front of his erring line?





-- 
Forgetthesong,I'dratherhavethefrontallobotomy...






==========================================================================
TOPIC: Is it possible to alter Ant properties after they've been initialized?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b49e18141bedfe87
==========================================================================

== 1 of 3 ==
Date:   Mon,   Sep 20 2004 3:17 pm
From: vturner <[EMAIL PROTECTED]> 

If I define an Ant property and assign it a value, is it possible to change
it later.  Something like:

<property name="abc" value="hello"/>
<alter property="abc" newvalue="goodbye"/>
<echo message="${abc}"/>  # will print "hello", but want "goodbye"

In general, treat a propertly like a variable.  Or are ant properties like
"variables" in XSL -- namely they're really constants?

I know I can write a Taskdef handler (Java program) that does something
like:

this.getProject().setProperty("abc", "goodbye");

However, it seems like there ought to be a built in feature of Ant that
allows this.  The closest I can find is the <copyproperty> tag from
ant-conrib.  This allows you to copy the value of a property into another,
but only if the "new" property has never been defined.  You cannot use it
to override a previously defined property.

My basic problem is I'm calling a sub-project from my main project and I
want to be able to return properties from the sub-project back to the main
project:

<ant antfile="build_child.xml" dir="." target="do-something"/>
...access properties from build_child.xml here

 From my experimentation, it appears any properties defined in the
sub-project are not available to the parent project.  Properties in the
parent projct *are* available to the sub-project, but since they're already
defined I can't alter them with new values.  

So I guess my real question is: how do you pass properties from a subproject
back to the calling project?



== 2 of 3 ==
Date:   Mon,   Sep 20 2004 4:42 pm
From: vturner <[EMAIL PROTECTED]> 

vturner wrote:

> If I define an Ant property and assign it a value, is it possible to
> change
> it later.  Something like:
> 
> <property name="abc" value="hello"/>
> <alter property="abc" newvalue="goodbye"/>
> <echo message="${abc}"/>  # will print "hello", but want "goodbye"
> 
> In general, treat a propertly like a variable.  Or are ant properties like
> "variables" in XSL -- namely they're really constants?
> 
> I know I can write a Taskdef handler (Java program) that does something
> like:
> 
> this.getProject().setProperty("abc", "goodbye");
> 
> However, it seems like there ought to be a built in feature of Ant that
> allows this.  The closest I can find is the <copyproperty> tag from
> ant-conrib.  This allows you to copy the value of a property into another,
> but only if the "new" property has never been defined.  You cannot use it
> to override a previously defined property.
> 
> My basic problem is I'm calling a sub-project from my main project and I
> want to be able to return properties from the sub-project back to the main
> project:
> 
> <ant antfile="build_child.xml" dir="." target="do-something"/>
> ...access properties from build_child.xml here
> 
>  From my experimentation, it appears any properties defined in the
> sub-project are not available to the parent project.  Properties in the
> parent projct *are* available to the sub-project, but since they're
> already defined I can't alter them with new values.
> 
> So I guess my real question is: how do you pass properties from a
> subproject back to the calling project?

While my original questions still remain, I was able to achieve my
objectives by simply importing the remote target using the the <import>
statement.  When you do this, the imported targets are a part of the
importing project.  Therefore, they're in the same namespace.  Which simply
means any properties I set with the imported target are availabe to the
importing target.  Case closed, although I'm still curious if it's possible
to alter Ant variables.




== 3 of 3 ==
Date:   Mon,   Sep 20 2004 7:24 pm
From: vturner <[EMAIL PROTECTED]> 

vturner wrote:

> While my original questions still remain, I was able to achieve my
> objectives by simply importing the remote target using the the <import>
> statement.  When you do this, the imported targets are a part of the
> importing project.  Therefore, they're in the same namespace.  Which
> simply means any properties I set with the imported target are availabe to
> the
> importing target.  Case closed, although I'm still curious if it's
> possible to alter Ant variables.

For posterity, I suppose I should document that this in fact did *not* work. 
I jumped the gun and deluded myself into thinking it worked.  In the end I
finally used a macrodef to fix the problem.

In the remote file (to be shared among several build files) I have:

    <macrodef name="create-work-files">
        <attribute name="service"/>
        <sequential>
            <tstamp>
                <format property="DATE-TIME" pattern="yyyyMMdd_kkmmss"
unit="second"/>
            </tstamp>
            <property name="work-file-a"
                      value="/tmp/build/[EMAIL PROTECTED]"/>
            <property name="work-file-b"
                      value="/tmp/build/[EMAIL PROTECTED]"/>
            <property name="work-file-c"
                      value="/tmp/build/[EMAIL PROTECTED]"/>
        </sequential>
    </macrodef>

In the importing file I have:

<import file="../../common/create_work_files.xml" />
...
<create-work-files service="rates"/>  # call macro here

Now, in the importing file I can finally reference the properties defined in
the remote file.







==========================================================================
TOPIC: Beginner Advice Sought
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b96a0a430a102e22
==========================================================================

== 1 of 3 ==
Date:   Tues,   Sep 21 2004 4:03 am
From: "Joe Beck" <[EMAIL PROTECTED]> 


"TechBookReport" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> jbeck wrote:
> > Looking for recommendations as to the top two or three books to use to
begin
> > learning Java.
> >
> > Also, recommendations for compilers?
> >
> >
> For books take a look at:
>
> Objects First With BlueJ
> Head First Java
> Deitel and Deitel
>
> If you are already familiar with C++ or other object oriented language
> then take a look at Bruce Eckel's Thinking In Java.
>
> All of these are reviewed here at TechBookReport --
> http://www.techbookreport.com/JavaIndex.html
>
> And don't forget Sun's online tutorial - which is easily downloaded.
>
> Pan


Thanks for the recommendations!  Will look into them further.  I had looked
around Suns site (as I stated to the other poster) and saw the online
tutorial...but was after something that I didn't have to tie up the phone
line to use (the one I saw didn't lend it'self to easy downloading for
offline use).  Will hunt around on their site a bit more.

Again, I appreciate the help!

Joe





== 2 of 3 ==
Date:   Tues,   Sep 21 2004 4:06 am
From: "Joe Beck" <[EMAIL PROTECTED]> 


"Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sun, 19 Sep 2004 21:40:57 -0600, jbeck wrote:
>
> > Sub: Beginner Advice Sought
>
> ..beginners are best helped on a different group, described here..
> <http://www.physci.org/codes/javafaq.jsp#cljh>
>
> > Looking for recommendations as to the top two or three books to use to
begin
> > learning Java.
>
> That depends, is Java the first language you are
> learning?  Are you already comfortable with OO
> design from other OO languages?
>
> Besides books, there are also the Sun Java tutorials,
> an offline version of the JavaDocs is very useful as
> well, as they are invaluable.
>
> There are also a lot of good resources listed and
> linked in my FAQ.
> <http://www.physci.org/codes/javafaq.jsp#res>
>
> > Also, recommendations for compilers?
>
> Get it free from Sun*.  It is called the J2SDK.
>
> Or did you mean an IDE?  The Sun Java compiler operates
> from the command line, or can be called from any number
> of IDE's, or ANT.
>
> * there are other SDK's besides Sun's, but it is the
> standard and it's free.  Two points in it's favor.
>
> 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

Thanks for the reply!  I have downloaded Suns J2SDK (don't ask how long it
took on dialup!)

I have limited success with C and am finishing up the basics of C++...I
consider myself a complete beginner at all of this!  I learned C on a
command line editor, and learned C++ on an IDE...I like the IDE alot more!
I was considering using an IDE in my quest for learning the basics of
Java...unless there is a better approach, or reason to go with the
commandline compiler.   Will be doing this on a Windows XP platform.   Those
are my general thoughts on this.  Thanks for the links.  I had looked around
a bit on Suns site, but I guess I missed the easy to download documents.
Anything I can easily use off line is exactly what I am after.

Thanks again for the links and help!

Joe





== 3 of 3 ==
Date:   Tues,   Sep 21 2004 4:22 am
From: "Joe Beck" <[EMAIL PROTECTED]> 


"Joe Beck" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > On Sun, 19 Sep 2004 21:40:57 -0600, jbeck wrote:
> >
> > > Sub: Beginner Advice Sought
> >
> > ..beginners are best helped on a different group, described here..
> > <http://www.physci.org/codes/javafaq.jsp#cljh>
> >
> > > Looking for recommendations as to the top two or three books to use to
> begin
> > > learning Java.
> >
> > That depends, is Java the first language you are
> > learning?  Are you already comfortable with OO
> > design from other OO languages?
> >
> > Besides books, there are also the Sun Java tutorials,
> > an offline version of the JavaDocs is very useful as
> > well, as they are invaluable.
> >
> > There are also a lot of good resources listed and
> > linked in my FAQ.
> > <http://www.physci.org/codes/javafaq.jsp#res>
> >
> > > Also, recommendations for compilers?
> >
> > Get it free from Sun*.  It is called the J2SDK.
> >
> > Or did you mean an IDE?  The Sun Java compiler operates
> > from the command line, or can be called from any number
> > of IDE's, or ANT.
> >
> > * there are other SDK's besides Sun's, but it is the
> > standard and it's free.  Two points in it's favor.
> >
> > 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
>
> Thanks for the reply!  I have downloaded Suns J2SDK (don't ask how long it
> took on dialup!)
>
> I have limited success with C and am finishing up the basics of C++...I
> consider myself a complete beginner at all of this!  I learned C on a
> command line editor, and learned C++ on an IDE...I like the IDE alot more!
> I was considering using an IDE in my quest for learning the basics of
> Java...unless there is a better approach, or reason to go with the
> commandline compiler.   Will be doing this on a Windows XP platform.
Those
> are my general thoughts on this.  Thanks for the links.  I had looked
around
> a bit on Suns site, but I guess I missed the easy to download documents.
> Anything I can easily use off line is exactly what I am after.
>
> Thanks again for the links and help!
>
> Joe
>
>

And just for clarification, this is my last post here (at least until I can
be something other than a beginner).  Future posts will be at the c.l.j.help
group.

Thanks again!






==========================================================================
TOPIC: How to get a file as a resource
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e2951f5a74da6102
==========================================================================

== 1 of 2 ==
Date:   Mon,   Sep 20 2004 4:36 pm
From: [EMAIL PROTECTED] (GIMME) 

The following lines exist in a JSP ... 

    String sRealPath = session.getServletContext().getRealPath("/"); /*1*/
    String sXSLFile = sRealPath  + "/xsl/xl.xsl" /*2*/
    Reader r = new FileReader( new File(sXSLFile) ) ; /*3*/
    StreamSource ss = new StreamSource(r); /*4*/

     transformer = TransformerFactory.newInstance().newTransformer( ss ) ;

How would lines 1,2,3 and 4 be changed so that the xl.xsl file
is fetched as a resource instead of from the file system?

Thanks



== 2 of 2 ==
Date:   Mon,   Sep 20 2004 9:05 pm
From: Jacob <[EMAIL PROTECTED]> 



GIMME wrote:

> The following lines exist in a JSP ... 
> 
>     String sRealPath = session.getServletContext().getRealPath("/"); /*1*/
>     String sXSLFile = sRealPath  + "/xsl/xl.xsl" /*2*/
>     Reader r = new FileReader( new File(sXSLFile) ) ; /*3*/
>     StreamSource ss = new StreamSource(r); /*4*/
> 
>      transformer = TransformerFactory.newInstance().newTransformer( ss ) ;
> 
> How would lines 1,2,3 and 4 be changed so that the xl.xsl file
> is fetched as a resource instead of from the file system?


Something like:

   String filePath  = "/com/company/dir/xl.xsl";
   InputStream stream = getClass().getResourceAsStream (filePath);
   BufferedReader reader = new BufferedReader (new InputStreamReader (stream));
   StreamSource source = new StreamSource (reader);

Don't forget the initial "/" in the path.
It is a common source of error.





==========================================================================
TOPIC: struts & restarting Tomcat
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5bee53f53da7265c
==========================================================================

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 4:42 pm
From: [EMAIL PROTECTED] (GIMME) 

Try putting your application initialization code into a SetUpServlet
and running this servlet after compiling. (Your SetUpServlet
has to be mapped in the web.xml file). 

That works for me. 

Note that any session data not populated by the SetUpServlet is lost. 

[EMAIL PROTECTED] (Mike) wrote in message news:<[EMAIL PROTECTED]>...
> I'm developing a struts application and the only way I've found for a
> change in the action class to be recognized is to restart Tomcat.
> 
> Is there an easier way?




==========================================================================
TOPIC: using Vst / VstInstrument
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c679ce1cea0f4202
==========================================================================

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 5:10 pm
From: ventolin <[EMAIL PROTECTED]> 

I took an eye on Sourceforge in order to find audio projects using 
vst/vst instruments (it's about music plugins), but i found nothing.
Is there someone there who has already try and success it ? Does someone 
know where can i find it ?

Thanks a lot :-)

-- I would like to develop a strange-graphical sequencer in java.




==========================================================================
TOPIC: Variable Arg Lists to PreparedStatements
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/184f86104809543e
==========================================================================

== 1 of 2 ==
Date:   Mon,   Sep 20 2004 6:24 pm
From: [EMAIL PROTECTED] (Prem K Mehrotra) 

"Christian Antognini" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> **** Post for FREE via your newsreader at post.usenet.com ****
> 
> Mhmm... just noticed you multi-posted... (not the best thing to do!) My
> solution works only with Oracle...
> 
> "Christian Antognini" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > **** Post for FREE via your newsreader at post.usenet.com ****
> >
> > Hi Robert
> >
> > You could solve the problem by using an array. Personally I don't like
>  this
> > method too much... anyway here an example...
> >
> > - on the database
> >
> >       CREATE TYPE t_collection IS TABLE OF NUMBER;
> >
> > - on the JDBC client (excerpt)
> >
> >       String sql = "SELECT ename FROM emp WHERE empno IN (SELECT value(v)
> > FROM table(?) v)";
> >       OraclePreparedStatement statement =
> > (OraclePreparedStatement)connection.prepareStatement(sql);
> >       ArrayDescriptor descriptor =
> > ArrayDescriptor.createDescriptor("T_COLLECTION", connection);
> >       long[] content = { 7521, 7654, 7698 };
> >       ARRAY array = new ARRAY(descriptor, connection, content);
> >       statement.setARRAY(1, array);
> >       ResultSet resultSet = statement.executeQuery();
> >       while (resultSet.next())
> >       {
> >         System.out.println("name: " + resultSet.getString("ename"));
> >       }
> >
> >
> > Chris
> >
> > "Robert Brown" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Is there a way to use PreparedStatements (or bind variables) with SQL
> > > statements that have a variable number of arguments. For example, I
> > > have an array of IDs for employees of a certain type and I want to
> > > have a PreparedStatement retrieve all of them in a single SQL call.
> > >
> > > SELECT FROM employees WHERE employee_type = ? employee_id in
> > > (?,?,?,...,?)
> > >
> > > It seems at least in Java that PreparedStatements can only take a
> > > fixed number of arguments?
> > >
> > >    PreparedStatement pstmt = con.prepareStatement("SELECT FROM
> > > employees WHERE employee_type = ? AND employee_id = ?");
> > >    pstmt.setLong(1, employeeType);
> > >    pstmt.setInt(2, employeeID);
> > >
> > > Is there a way to have a PreparedStatement for a SQL "IN" clause or
> > > similar variable argument length clauses? I heard that Temp tables is
> > > one option where you first insert your array of IDs into a Temp table
> > > and then use a JOIN. But that seems to defeat the purpose as it
> > > requires multiple queries. Is there anyway to something like this:
> > >
> > >    int[] employeeIDArray = getEmployees();
> > >    PreparedStatement pstmt = con.prepareStatement("SELECT FROM
> > > employees WHERE employee_type = ? AND employee_id IN (?)");
> > >    pstmt.setLong(1, employeeType);
> > >    pstmt.setIntArray(2, employeeIDArray); <--- How can I do this?
> > >
> > > Thanks,
> > >
> > > - Robert
> >
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> >  *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
> >                       http://www.usenet.com
> > Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>  *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
>                       http://www.usenet.com
> Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Have you loooked  in JDBC's dynamic query interface. If you cannot do
what you want  using static prepared statement, dynamic query may be
your best  option.
I have personnally not used dyanmic query in JDBC, but I have used in
other languages such as PRO*C.

Prem



== 2 of 2 ==
Date:   Mon,   Sep 20 2004 7:21 pm
From: [EMAIL PROTECTED] (Yakov) 

[EMAIL PROTECTED] (Robert Brown) wrote in message news:<[EMAIL PROTECTED]>...
> Is there a way to use PreparedStatements (or bind variables) with SQL
> statements that have a variable number of arguments. For example, I
> have an array of IDs for employees of a certain type and I want to
> have a PreparedStatement retrieve all of them in a single SQL call.
> 
> SELECT FROM employees WHERE employee_type = ? employee_id in
> (?,?,?,...,?)
> 
> It seems at least in Java that PreparedStatements can only take a
> fixed number of arguments?
> 

Srting sql = "SELECT FROM employees WHERE employee_type = ?
employee_id in(";

When you have all your IDs in the array, concatenate a required number
of the question marks in a loop like for(int
i=0;i<myArray.length;i++)...

Set param values  from the array in a similar loop

Regards,
Yakov




==========================================================================
TOPIC: Select and Edit a Record in a Table of JSP page
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5a1fe050df12660
==========================================================================

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 7:01 pm
From: [EMAIL PROTECTED] (John Rizzo) 

Hello All,

I am displaying the following Database records in a Table of my JSP
page.

Customer No.  FirstName     LastName

1             Tim            Hertal
2             John           Rizzo
3             Todd           Steven     

I want to select anyone of the record and perform Edit operation. When
I press Edit button, a new screen open up and take all values of the
selected row. Where I can make changes and send the data back to
database.
I am wondering if someone can help me or sends Java and JSP code or
provides any link where I can find information.

Thank you.




==========================================================================
TOPIC: JSTL el list subclassing and property conflicts
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d2ae9d1a6f1dee61
==========================================================================

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 7:01 pm
From: [EMAIL PROTECTED] (Usenet Poster!!!) 

I'm extending an ArrayList and adding my own property.

However, when I use JSP 2.0 and JSTL it can't seem to be able to
access the property, it keeps trying to coerce the name into an
Integer.

Example:

public class Foo extends ArrayList {
  private String x = null;

  public Foo() {
    super();
  }

  public String getX() {
    return x;
  }
  
  public void setX(String x) {
    this.x = x;
  }
}

My JSP goes something like this:

....
<jsp:useBean id="foo" class="Foo"/>
<c:set var="c" value="${foo.x}"/>
....

It complains that it can't convert x into an integer the error message
from Tomcat 5 is below:

javax.servlet.ServletException: The "." operator was supplied with an
index value of type "java.lang.String" to be applied to a List or
array, but that value cannot be converted to an integer.

Root cause 

javax.servlet.jsp.el.ELException: The "." operator was supplied with
an index value of type "java.lang.String" to be applied to a List or
array, but that value cannot be converted to an integer.

So is this a "feature" that I can work around?




==========================================================================
TOPIC: Quick question on StreamTokenizer
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/69165678d49ad670
==========================================================================

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 7:26 pm
From: [EMAIL PROTECTED] (Yakov) 

overbored <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> How do I prevent StreamTokenizer from returning any TT_NUMBER items? 
> Basically all I want is to have a steady stream of plain TT_WORD items, 
> even if they're all digits. I tried wordChars('0', '9') but to no avail. 
> Thanks in advance.

When you get TT_NUMBER, convert it to a String and concatenate all
strings and numbers into one string

Regards,
Yakov




==========================================================================
TOPIC: J2ME Scheduled task?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/63ea15d2afb8e095
==========================================================================

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 7:48 pm
From: JScoobyCed <[EMAIL PROTECTED]> 

knocker wrote:

> Hi 
> 
> I wonder if there's a way to do a scheduled task that launches an
> application to perform a task in j2me?
> 
> I have the made a simple application, but I would like to be able to
> schedule the work to be done at different times.
> 
> In a way it is similar to the alarm on a mobile phone, you set it and
> it doesn't alert or query you until the appropriate time.
> 
> /Erik

I don't know any API that does that (you might need to look on a 
websearch like google), but it can be done:
- Create your application
- Create a Launcher interface:
public interface Launcher {
public void launch();
}
- Create a launcher for this application:
public class myApplLauncher implements Launcher {
  public void launch() {
    myAppl ma = new myAppl();
    ma.start();
    }
- Create a MIDlet that starts a timer and check every second if the time 
is the one configured. When it is, launch the launcher implementation.
For this MIDlet, you could have in the JAD file the parameters:
mytimer.launcher.implementation=foo.bar.myApplLauncher
mytimer.executionTime=21/09/2004 01:00:00

The timer MIDlet will get the parameters from the JAD file through 
Class.getResourceAsStream() (see J2ME javadoc for that) and then it 
doesn't need any hardcoded value.


-- 
JScoobyCed
What about a JScooby snack Shaggy ? ... Shaggy ?!




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

== 1 of 1 ==
Date:   Mon,   Sep 20 2004 8:27 pm
From: "John B. Matthews" <[EMAIL PROTECTED]> 

In article 
<[EMAIL PROTECTED]>,
 matthews <[EMAIL PROTECTED]> wrote:

> In article <[EMAIL PROTECTED]>,
>  "Markus Kern" <[EMAIL PROTECTED]> wrote:
> 
> > btw, i solved the incrementing problem like this :
> > 
> > ----
> >  public static InetAddress incIP(InetAddress address) {
> >   byte[] ip = address.getAddress();
> >   for (int i = ip.length - 1; i >= 0; i--) {
> >    if (ip[i] < Byte.MAX_VALUE) {
> >     ip[i]++;
> >     if (ip[i] != 0) {
> >      break;
> >     }
> >    } else { // ip[i] == Byte.MAX_VALUE
> >     ip[i] = Byte.MIN_VALUE;
> >     break;
> >    }
> >   }
> >   InetAddress inc = null;
> >   try {
> >    inc = InetAddress.getByAddress(ip);
> >   } catch (UnknownHostException e) {
> >    //sollte nicht passieren
> >    e.printStackTrace();
> >   }
> >   return inc;
> >  }
> 
> This seems awkward to me. The platform uses signed, twos-complement 
> arithmetic; there is no overflow. Using an integral intermediate is 
> really the easiest route; but if you are determined to go down this 
> road, consider the recursive version:
> 
>     public static byte[] incByteArray(byte[] b, int i) {
>         if (i >= 0) {
>             b[i]++;
>             if (b[i] == 0) b = incByteArray(b, i - 1);
>         }
>         return b;
>     }
> 
>     public static InetAddress incIP(InetAddress ip)
>     throws UnknownHostException {
>         byte[] b = ip.getAddress();
>         incByteArray(b, b.length - 1);
>         return InetAddress.getByAddress(b);
>     }

Or this plain, old iterative version:

    public static InetAddress inc(InetAddress ip)
    throws UnknownHostException {
        byte[] b = ip.getAddress();
        int i = b.length - 1;
        b[i]++;
        int carry = b[i] == 0 ? 1 : 0;
        while (i-- > 0) {
            b[i] += carry;
            carry = carry > 0 && b[i] == 0 ? 1 : 0;
        }
        return InetAddress.getByAddress(b);
    }
-- 
John
----
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/



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

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