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

Today's topics:

* Can't write XML to stream outside of NetBeans - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/529ac659aec6e1f4
* Regexp and Pattern.class - 4 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/75d34aa3568519a1
* JSP, session, 'caching' - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9b4a7e1061e7b01c
* AffineTransform rotation question - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c9f275d039d53e16
* Socket commuication questions - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9037f45d8d46b965
* Initialize managed bean with header information? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/93dafdedaebfbd60
* Struts Server-Side Form Validation - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8d7503f3780d747
* timout on line of code - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/85ddb5609baca4a0
* java&php - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbfc754949e2cb42
* Java and inlining - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b13dd1cb6d5e4bd0
* An efficient computation idea. Please comment - 5 messages, 3 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d714c128b46864f
* Help me improve parsing trick? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8ba6b745fd0b06de
* Locale question - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/54f1e8452a7c830
* db connections - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9796781dceede8f6
* How to escape hex digits in a regular expression!!! - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3950cae896bde7a4

==============================================================================
TOPIC: Can't write XML to stream outside of NetBeans
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/529ac659aec6e1f4
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 1:04 pm
From: "hilz"  


<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've been having a lot of trouble trying to create an XML file from a
> DOM tree.  My code works fine inside of netbeans, but I get lots of
> erros when I try to run it independantly.
>
> The error message I keep getting is
>
> [java] java.lang.RuntimeException:
> org.apache.xml.utils.WrappedRuntimeException: The output format must
> have a '{http://xml.apache.org/xalan}content-handler' property!
>
> Both Xerces and crimson are in my classpath, and I've tried using both
> Java 1.5 and 1.4.2.  Any ideas what I'm doing wrong?
>
> This is the code I'm trying to write the file with:
>
> public void writeXML(Document doc, OutputStream ostream)
> {
> try
> {
> //Format & write output
> TransformerFactory tf = TransformerFactory.newInstance();
> Transformer t = tf.newTransformer();
>
> DOMSource ds = new DOMSource(doc);
> StreamResult sr = new StreamResult(ostream);
> t.transform(ds, sr);
> }
> catch (Exception e)
> {
>             e.printStackTrace();
>         }
>     }
>
> Mark McKay
>

I do the same and it works fine, in NetBeans and outside.
do you have those imports(maybe you don't need all of them, but those are
what i needed)?

import java.io.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
import org.xml.sax.*;






==============================================================================
TOPIC: Regexp and Pattern.class
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/75d34aa3568519a1
==============================================================================

== 1 of 4 ==
Date: Fri, Dec 17 2004 10:05 am
From: [EMAIL PROTECTED] 

Sometimes I find it easier to use the Unicode representation of some
characters.




== 2 of 4 ==
Date: Fri, Dec 17 2004 10:06 am
From: [EMAIL PROTECTED] 

Sometimes I find it easier to use the Unicode representation of certain
characters.




== 3 of 4 ==
Date: Fri, Dec 17 2004 6:05 pm
From: Tilman Bohn  

In message <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote on 17 Dec 2004 09:24:20 -0800:

[...]
> I've never seen that combination in <mumble> years of handling
> Tradacomms EDI files so I've had to actually go and test it. The
> generating program throws out ???' where the sequence ?' occurs.

  Interesting. Ok, in this case the pattern I gave you won't work
correctly. Before you can find the correct one you'll need to try
what happens for a) ??' and b) ???'.

-- 
Cheers, Tilman

`Boy, life takes a long time to live...'      -- Steven Wright



== 4 of 4 ==
Date: Fri, Dec 17 2004 6:14 pm
From: Tilman Bohn  

In message <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote on 17 Dec 2004 08:19:21 -0800:

[...]
> How/Can I phrase the regexp parameter to the Pattern.split() method to
> split the string back into the original lines. 

  BTW, that's backwards. The regexp gets passed to Pattern.compile()
first, then your input is the parameter to the split() method executed
on the resulting Pattern object.

-- 
Cheers, Tilman

`Boy, life takes a long time to live...'      -- Steven Wright




==============================================================================
TOPIC: JSP, session, 'caching'
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9b4a7e1061e7b01c
==============================================================================

== 1 of 2 ==
Date: Sat, Dec 18 2004 2:17 am
From: Rico  

I'm working on this JSP page that's supposed to display data retrieved
from a database let's say 20 rows at a time. Currently, when we need the
x'th set of 20 rows, what's being done is to select the top 20 rows that
are not in the first (x-1) set of 20 rows.

Something tells me that somebody is just being naive here because a lot of
data is being requested for the purpose of being thrown away. I'm thinking
that it would be better if we could read the data into memory, suitable
data structures, and extract the rows from there as the user navigates
from one set/page of 20 rows to another.

However, the user would also be able to make modifications to the data. I
can either update the modified rows in the data structures accordingly or
throw everything away and refresh the data structures with the latest
contents of the database.

I'll be looking up some example of how to use what I think should be
'session' scope to achieve what I described. Suggestions welcome though.

I'm mainly wondering if there could be any tools or libraries that would
ease the implementation of this kind of, how to call it... caching? that
I am considering?

Thanks.

Rico.



== 2 of 2 ==
Date: Fri, Dec 17 2004 3:31 pm
From: "John C. Bollinger"  

Rico wrote:

> I'm working on this JSP page that's supposed to display data retrieved
> from a database let's say 20 rows at a time. Currently, when we need the
> x'th set of 20 rows, what's being done is to select the top 20 rows that
> are not in the first (x-1) set of 20 rows.
> 
> Something tells me that somebody is just being naive here because a lot of
> data is being requested for the purpose of being thrown away. I'm thinking
> that it would be better if we could read the data into memory, suitable
> data structures, and extract the rows from there as the user navigates
> from one set/page of 20 rows to another.
> 
> However, the user would also be able to make modifications to the data. I
> can either update the modified rows in the data structures accordingly or
> throw everything away and refresh the data structures with the latest
> contents of the database.
> 
> I'll be looking up some example of how to use what I think should be
> 'session' scope to achieve what I described. Suggestions welcome though.
> 
> I'm mainly wondering if there could be any tools or libraries that would
> ease the implementation of this kind of, how to call it... caching? that
> I am considering?

You could select all the rows into a scrollable, updatable ResultSet, 
then hold the ResultSet in the session across requests.  There are all 
sorts of gotchas and caveats there, especially in the area of 
scalability, but if you only need to support a handful of concurrent 
users then it could be made to work without too much hassle.  It has the 
advantage of being able to cache unread results _in the DB_ rather than 
in memory, supports user modifications in a straightforward way, and 
only requires one query.

HOWEVER, if your DB schema is such that you can SELECT exactly the rows 
you want each time (without too much hassle), then that is a much better 
solution.  It sounds from your comments like that's not what you're 
doing now, but I'm not entirely confident about that.


John Bollinger
[EMAIL PROTECTED]




==============================================================================
TOPIC: AffineTransform rotation question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c9f275d039d53e16
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 2:45 pm
From: "hilz"  


"Thomas Weidenfeller" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hilz wrote:
> > I have an AffineTransform that has a uniform scale(x scale == y scale).
How
> > can i get the rotation portion of it, or the rotation angle "theta" ?
>
> Just apply the transformation to two simple points P0(0,0), P1(1,0). The
> resulting P0' and P1' will allow you to determine everything you want to
> know with elementary math.
>
> /Thomas
>
> -- 
> ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq

Thank you Thomas.
That was simple yet effective!
I am new to this area and i am experimenting with it.Your suggestion opened
my eyes to a lot of things!
thank you.
hilz






==============================================================================
TOPIC: Socket commuication questions
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9037f45d8d46b965
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 8:09 pm
From: Steve Horsley  

James Willans wrote:
> If there is a more appropriate newsgroup to place this message then
> please point me in the right direction.
> 
> We have an application that has a server and a number of clients
> communicating using sockets.  The java.nio libraries are used in the
> server and java.io libraries are used in the clients (this may not be
> relevant).  We are currently testing our application on a windows
> machine.  All works fine until the status of the network changes, for
> example if a wireless signal is momentarily lost the read and write
> data methods begin throwing exceptions.  I'm having trouble
> determining whether or not the network disconnection is causing the
> socket to be lost, or whether it is simple unavailable while the
> network sorts itself out.  In the case of the former, is the usual
> strategy to simply handle the disconnection by recreating the socket? 
> In the case of the former, should I be performing checks prior to
> check whether it is an unstable state?  Any further information would
> be much appreciated.
> 
> James

A "momentary" interruption should not cause problems. Maybe it is
incovering bugs in your code. 

What sort of exceptions?

Steve




==============================================================================
TOPIC: Initialize managed bean with header information?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/93dafdedaebfbd60
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 12:31 pm
From: [EMAIL PROTECTED] 

We use Netegrity's SiteMinder for SSO security on all web apps.
Although SiteMinder handles security for accessing the application
itself, restrictions to certain functions and data are handled within
the application based on user type.
The user information (such as name, type, etc.) are passed in from
SiteMinder via header variables. ie:
hddr_user = Joe Blo
hddr_group = Admin
hddr_phone = 555-555-5555

I'm looking at different designs to capture all of this user
information from the headers at one time and store as a bean in the
user's session (so as to not need to continually reference the header
information).

Does anyone know if you can create a managed bean (ie. User) that is
initialized with header information (by using the configuration file
w/ value-binding expressions)?





==============================================================================
TOPIC: Struts Server-Side Form Validation
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8d7503f3780d747
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 12:30 pm
From: "timmac"  

Okay, I finally found the problem, well, a fix anyway.  Re deploying
the web application in the AppServer admin seems to do the trick...
*sigh*.  Even restarting the appserver isn't sufficient, ironically.
Thank you very much for all of your help!





==============================================================================
TOPIC: timout on line of code
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/85ddb5609baca4a0
==============================================================================

== 1 of 2 ==
Date: Fri, Dec 17 2004 12:40 pm
From: Knute Johnson  

Ike wrote:

> If I have a URLConnection uc, I would like to permit the following line of
> code to execute in say, ten seconds:
> 
>  InputStream inputStream = uc.getInputStream();
> 
> If something is wrong on the server, this line of code hangs, and I'd like
> to catch it after, say ten seconds, and have it segue to another line of
> code. How do you do that? -Ike
> 
> 

Just what would make that line of code hang?

-- 

Knute Johnson
email s/nospam/knute/



== 2 of 2 ==
Date: Fri, Dec 17 2004 9:01 pm
From: "Ike"  


>
> Just what would make that line of code hang?
>
> -- 
>
> Knute Johnson
> email s/nospam/knute/

A google search reveals numerous times others have, in the past, had
inexplicable, eternal hanging on:

URLConnection.getInputStream();



Under all different JVMs. Has anyone ever figured out the resolution to
this? We havent changed anything, just, suddenly, faced with eternal hanging
on this particular line. -Ike







==============================================================================
TOPIC: java&php
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbfc754949e2cb42
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 9:03 pm
From: "Ike"  

In FACT, I'm so sick of dealing with servlets that act  quirky, I think I
may bypass servlets altogether from now on for this type of solution! -Ike

"Ike" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Do an http post. Search the archives on this newsgroup under "php http
post
> ike" and you will find the source code to do this. Its a great
> solution! -Ike
>
> "codemaster" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > is there a way to pass data from java application to php-script?
> >
> >
>
>






==============================================================================
TOPIC: Java and inlining
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b13dd1cb6d5e4bd0
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 9:07 pm
From: "Aaron Fude"  


"Chris Smith" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Aaron Fude <[EMAIL PROTECTED]> wrote:
>> Is there a good article to read about the inlining of functions in Java. 
>> For
>> example, how inefficient would it be to write double sum(double x) { 
>> return
>> Math.sin(x) + Math.cos(x); }
>
> I don't know of a good article to read.  In practice, I wouldn't worry
> about it.  If your code is performing poorly, there are certainly bigger
> concerns.  A profiler will tell you more.
>
> If you're just curious, though, then read on.  My comments from here on
> apply to the Sun JVM for various platforms; other virtual machines -- 
> and especially those on small J2ME platforms such as mobile phones -- 
> may differ considerably.  Inlining is performed by the JIT compiler at
> runtime, and can be applied very widely in modern virtual machines.
> Inlining will be most widely applied to methods that are declared as
> private, static, or final, or are in final classes.  However,
> conditional inlining is also performed on polymorphics methods when
> possible.  The latter optimization is one of the benefits of adaptive
> optimizations like the JVM does over static optimization of other
> languages.
>
> -- 
> www.designacourse.com
> The Easiest Way To Train Anyone... Anywhere.
>
> Chris Smith - Lead Software Developer/Technical Trainer
> MindIQ Corporation

Actually, thowing in "final" speeded up the code tremendously. 
Interesting... I also used to think that "final" makes little difference, 
but the difference turned out to be tremendous is this case! 






==============================================================================
TOPIC: An efficient computation idea. Please comment
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d714c128b46864f
==============================================================================

== 1 of 5 ==
Date: Fri, Dec 17 2004 9:16 pm
From: "Aaron Fude"  

Hi,

In my program I evaluate long trigonometric polynomials a lot! For example,

final int N = 1000;
double[] c = new double[N];
// Populate c
double x = .5, sum = 0.0;

for (int i = 0; i < N; i++)
    sum += c[i]*cos(i*x);

And this function is evaluated very many times (about 100,000). So why not 
create a java snippet, compile it, load it as a class and use the compiled 
version. So I would have something like;

String sum = "0";  // A String buffer, of course...
for (int i = 0; i < N; i++)
    sum += "+" +  c[i] + "*cos(" + i + "*x)";
sum += ";";


I think it's a pretty cool idea. But before I implement it, I would like to 
know what you think about it!

Thank you in advance!

Aaron Fude 





== 2 of 5 ==
Date: Fri, Dec 17 2004 9:24 pm
From: Patrick May  

"Aaron Fude" <[EMAIL PROTECTED]> writes:
> In my program I evaluate long trigonometric polynomials a lot! For example,
> 
> final int N = 1000;
> double[] c = new double[N];
> // Populate c
> double x = .5, sum = 0.0;
> 
> for (int i = 0; i < N; i++)
>     sum += c[i]*cos(i*x);
> 
> And this function is evaluated very many times (about 100,000). So
> why not create a java snippet, compile it, load it as a class and
> use the compiled version. So I would have something like;
> 
> String sum = "0";  // A String buffer, of course...
> for (int i = 0; i < N; i++)
>     sum += "+" +  c[i] + "*cos(" + i + "*x)";
> sum += ";";
> 
> I think it's a pretty cool idea. But before I implement it, I would
> like to know what you think about it!

Greenspun's Tenth Rule of Programming:
     "Any sufficiently complicated C or Fortran program contains an
     ad-hoc, informally-specified, bug-ridden, slow implementation of
     half of Common Lisp."

You have added Fude's Lemma:  "Java programs, too."

Look up defmacro in the Common Lisp Hyperspec
(http://www.lispworks.com/reference/HyperSpec, among others).  Java
doesn't allow you to do this particularly well.  Lisp does.

Regards,

Patrick

------------------------------------------------------------------------
S P Engineering, Inc.    | The experts in large scale distributed OO
                         | systems design and implementation.
          [EMAIL PROTECTED]    | (C++, Java, ObjectStore, Oracle, CORBA, UML)



== 3 of 5 ==
Date: Fri, Dec 17 2004 9:46 pm
From: "Aaron Fude"  


"Patrick May" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "Aaron Fude" <[EMAIL PROTECTED]> writes:
>> In my program I evaluate long trigonometric polynomials a lot! For 
>> example,
>>
>> final int N = 1000;
>> double[] c = new double[N];
>> // Populate c
>> double x = .5, sum = 0.0;
>>
>> for (int i = 0; i < N; i++)
>>     sum += c[i]*cos(i*x);
>>
>> And this function is evaluated very many times (about 100,000). So
>> why not create a java snippet, compile it, load it as a class and
>> use the compiled version. So I would have something like;
>>
>> String sum = "0";  // A String buffer, of course...
>> for (int i = 0; i < N; i++)
>>     sum += "+" +  c[i] + "*cos(" + i + "*x)";
>> sum += ";";
>>
>> I think it's a pretty cool idea. But before I implement it, I would
>> like to know what you think about it!
>
> Greenspun's Tenth Rule of Programming:
>     "Any sufficiently complicated C or Fortran program contains an
>     ad-hoc, informally-specified, bug-ridden, slow implementation of
>     half of Common Lisp."
>
> You have added Fude's Lemma:  "Java programs, too."
>
> Look up defmacro in the Common Lisp Hyperspec
> (http://www.lispworks.com/reference/HyperSpec, among others).  Java
> doesn't allow you to do this particularly well.  Lisp does.
>
> Regards,
>
> Patrick


Hi Patrck,

I myself love Scheme and agree with that quote which I heard as "Inside 
every C program there's a Lisp yearning to get out."

I expect that Java won't do this well. Nevertheless, will this be worth my 
effort?

Thanks.

Aaron 





== 4 of 5 ==
Date: Fri, Dec 17 2004 10:02 pm
From: Mark Thornton  

Aaron Fude wrote:
> Hi,
> 
> In my program I evaluate long trigonometric polynomials a lot! For example,
> 
> final int N = 1000;
> double[] c = new double[N];
> // Populate c
> double x = .5, sum = 0.0;
> 
> for (int i = 0; i < N; i++)
>     sum += c[i]*cos(i*x);
> 
> And this function is evaluated very many times (about 100,000). So why not 
> create a java snippet, compile it, load it as a class and use the compiled 
> version. So I would have something like;

A far better scheme would be to mathematically transform the calculation 
to something which can be evaluated more cheaply. For example suppose we 
calculate t = cos(x)

cos(0*x) = 1
cos(2*x) = 2*t*t-1
cos(3*x) = -3*t+4*t*t*t

etc

So we need only compute cos(x) (and perhaps sin(x)) and then find the 
result with a series of much simpler operations (multiplication and 
addition).

There are a number of different transformations which might be employed, 
depending on the range of values expected for x and other 
considerations. This approach can yield much more efficient evaluation 
than the technique you suggest.

You might also want to review the literature on Fourier series.

Mark Thornton



== 5 of 5 ==
Date: Fri, Dec 17 2004 2:06 pm
From: Mark Thornton  

Patrick May wrote:
> "Aaron Fude" <[EMAIL PROTECTED]> writes:
> 
>>In my program I evaluate long trigonometric polynomials a lot! For example,
>>
>>final int N = 1000;
>>double[] c = new double[N];
>>// Populate c
>>double x = .5, sum = 0.0;
>>
>>for (int i = 0; i < N; i++)
>>    sum += c[i]*cos(i*x);
>>
>>And this function is evaluated very many times (about 100,000). So
>>why not create a java snippet, compile it, load it as a class and
>>use the compiled version. So I would have something like;
>>
>>String sum = "0";  // A String buffer, of course...
>>for (int i = 0; i < N; i++)
>>    sum += "+" +  c[i] + "*cos(" + i + "*x)";
>>sum += ";";
>>
>>I think it's a pretty cool idea. But before I implement it, I would
>>like to know what you think about it!
> 
> 
> Greenspun's Tenth Rule of Programming:
>      "Any sufficiently complicated C or Fortran program contains an
>      ad-hoc, informally-specified, bug-ridden, slow implementation of
>      half of Common Lisp."
> 
> You have added Fude's Lemma:  "Java programs, too."
> 
> Look up defmacro in the Common Lisp Hyperspec
> (http://www.lispworks.com/reference/HyperSpec, among others).  Java
> doesn't allow you to do this particularly well.  Lisp does.
> 

However in this particular case there is a much better way of evaluating 
the required function. A good understanding of mathematics is what is 
required.

Mark Thornton




==============================================================================
TOPIC: Help me improve parsing trick?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8ba6b745fd0b06de
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 9:16 pm
From: "Aaron Fude"  


"Andrew Thompson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Thu, 16 Dec 2004 23:54:23 GMT, Aaron Fude wrote:
>
>> "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>> On Thu, 16 Dec 2004 22:33:21 GMT, Aaron Fude wrote:
>>>
>>>> This works but takes too long. Is there a way to speed this up by doing
>>>> everything in memory and avoid writing to files and running compilation
>>>> scripts.
>>>
>>> You can avoid the last part by invoking javac from within Java itself.
>>>
>>> ( But I do not know if that will be any 'quicker'. )
>>
>> Can you give an example of how to do it?
>
> a) Can you Google?  Try these..
> <http://www.google.com/search?q=tools.javac.Main.compile+class>
> <http://groups-beta.google.com/groups?as_q=class&as_epq=tools.javac.Main.compile&as_ugroup=comp.lang.java*>
> If no to a)
> b) How much are you offering for a prepared example?
>
> -- 
> 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

Thank you. But is there a way to avoid writing the code to a file but 
compile it directly from a String? 






==============================================================================
TOPIC: Locale question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/54f1e8452a7c830
==============================================================================

== 1 of 2 ==
Date: Fri, Dec 17 2004 4:27 pm
From: "hilz"  

Hi all

I have couple of files:
file_en.txt
file_fr.txt
file_es.txt
file_de.txt

they contain the same simple text in their corresponding languages.
and i want to be able to load these files according to the locale.

I know that:
    ResourceBundle.getBundle("file", Locale Locale)
should be used if those files were ".properties" files and contained
key=value pairs. But my files contain just simple text. Is there an
equivalent way of getting the text from those files in a single call similar
to ResourceBundle.getBundle(String baseName, Locale locale)

thanks
hilz





== 2 of 2 ==
Date: Fri, Dec 17 2004 1:46 pm
From: [EMAIL PROTECTED] 

So you have no keys in the text files to identify each message?





==============================================================================
TOPIC: db connections
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9796781dceede8f6
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 2:08 pm
From: "Big Jim"  

Guys,

In a a stateful session bean I'm looking up a data source that wraps a
connection pool and using it to retrieve a connection.
How do I return the connection to the pool when I'm done? Is conn.close()
the right thing to do here?

If I just let it go out of scope I eventually get an exception in the pool
with an "out of resources" error.






==============================================================================
TOPIC: How to escape hex digits in a regular expression!!!
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3950cae896bde7a4
==============================================================================

== 1 of 1 ==
Date: Fri, Dec 17 2004 2:12 pm
From: "Virgil Green"  

aefxx wrote:
> Hi everybody.
>
> I just wanted to leave a note on regular expression in java.
> In one of my projects I had to match hex digits in a string.
>
> Say, u want to search for 0x00 in a string, u would likely
> search for the escape sequence in the API and find "\xhh"
> with hh being the digits to search for.
>
> Well, if done like this u would get an error, being told
> that \x is not a valid escape sequence.
> Actually u dont have to escape the x but the backslash.
>
> So, it should look like this in the end: "\\x00".
> This works fine for me. Hope I saved some people some
> head scratching.

Actually, you are escaping the second \ with the first to make a single \ in
the java String. The single \ thus created is escaping the x so as to
indicate a hex value withing the regex.

 - Virgil





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

You received this message because you are subscribed to the Google
Groups "comp.lang.java.programmer" group.

To post to this group, send email to [EMAIL PROTECTED] or
visit http://groups-beta.google.com/group/comp.lang.java.programmer

To unsubscribe from this group, send email to
[EMAIL PROTECTED]

To change the way you get mail from this group, visit:
http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

To report abuse, send email explaining the problem to [EMAIL PROTECTED]

==============================================================================
Google Groups: http://groups-beta.google.com 

Reply via email to