| Regular Expression to match the domain part of an email address |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- Adding Fractions ProblemI can use the code below to add fractions together through adding instances
of the class Rational together, but my code to reduce the result to its
lowest terms has no effect. Why is this?
public class Rational
{
// instance variables - replace the example below with your own
private int numerator;
private int denominator;
public Rational()
{
}
public Rational(int num, int denom)
{
numerator = num;
denominator = denom;
}
public int getNumerator()
{
return numerator;
}
public int getDenominator()
{
return denominator;
}
public Rational add(Rational rhs)
{
int numerator1 = (rhs.getDenominator() * numerator);
int newDenom = (rhs.getDenominator() * denominator);
int numerator2 = (denominator * rhs.getNumerator());
int newNum = (numerator1 + numerator2);
if((newDenom % newNum) == 0)
{
// This code is supposed to reduce the result to its lowest
terms
int commonFactor = (newDenom / newNum);
newDenom /= commonFactor;
newNum /= commonFactor;
}
return new Rational(newNum, newDenom);
}
}
- 1
- Need help regarding java application development....sir i am a student of enggineering and i have assigned a project named
"Download Accelerator".
In this application i need to provide fuctionality such that if a user
clicks on any downloading link in its default web browser our
application must be invoked to start respective downloading with
enhanced spped.
Secondly, i have to provided some features that are used in some
downloading applications for example Aries, DAP etc.
Plz reply soon....
Nitesh
- 1
- Barcode reading in JavaHi Everybody I am an MCA student.
I want to know how does the bar code reaer works and How we can use it
in a poject where we can take input by reading the bar code and
display the information about the item.
like in malls they just read the barcode and all the info comes there?
Which tool to use?
I am a fresher and want to implement this in project.
Thank U
Pankaj
- 2
- How do you do THAT with genericsI am working on an event mechanism. Part of my need is to be able to
have a pool of events that can be reused, rather than incurring the cost
of instantiating one via reflection every time I need one. The pool
interface has this method for checking out an event:
<E extends Object & Event> E checkout(Class<E> cl);
Creating an event from this is easy; "return cl.newInstance();" works
fine. The problem is in storing them for later use.
Since there are many event classes in the event hierarchy, and since I
want this method to be able to return an event of the exact type (so I
don't have to cast it after getting it), I thought to use an inner class
(PoolList<E extends Event>) that holds a list of just one type of Event
and tracks which of its objects are in use and which are available. Then
I could use a Map to key these PoolList objects by Class.
That map is the problem. I need to have it store Class<E> as keys and
PoolList<E> as values...the same parameter (E) in both. Except that the
parameter isn't fixed...it could be any implementation of Event. So the
closest thing that I have is...
private Map<Class<? extends Event>, PoolList<? extends Event>> pool;
...which is wrong because it can't guarantee that the type parameters to
Class and to PoolList are the same (only that they are both
implementations of Event, but they could very well be different ones).
Something like...
private <T extends Event> Map<Class<T>, PoolList<T>> pool;
...would work, except that it isn't legal (the <T extends Event> part
can't be used for fields, only for generic methods). It makes sense that
there should be SOME way to do it...all of the necessary type
information is there at compile time and nothing that's needed at
runtime gets erased. But I can't come up with it.
All I need is a Map that knows that if one type parameter is being used
in the key, the same one should be used in the value. Is there a way in
generics to do this?
- 5
- (Review ID: 186942) # HotSpot Virtual Machine Error, Internal
--IJpNTDwzlM2Ie8A6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Mon, Jun 02, 2003 at 14:30:27 -0700, Tom Samplonius wrote:
> > FULL OS VERSION :
> > FreeBSD sherman.cs.miami.edu 4.5-RELEASE-p26 FreeBSD 4.5-RELEASE-p26 #1: Sun Mar 30 17:45:29 EST 2003 email***@***.com:/usr/obj/usr/src/sys/SHERMAN i386
> Probably should use 4.8-RELEASE instead, and upgrade the Linux emulator.
I encounter the same error, with my 5.1-BETA
Terry [/home/ijliao] -ijliao- /usr/local/linux-sun-jdk1.4.1/bin/java -version
#
# HotSpot Virtual Machine Error, Internal Error
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1_03-b02 mixed mode)
#
# Error ID: 4F533F4C494E55580E43505002DD
#
Abort (core dumped)
--
The sooner you start to code, the longer the program will take.
--- Roy Carlson
--IJpNTDwzlM2Ie8A6
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)
iD8DBQE++ZZyrMYBZRHAI4IRAtlWAKC0FYiYG7KRDPC5H5W8VA3MGhDDWQCaAnsl
CFbtsDjRYc6BIM/KFEl6RVM=
=TXcN
-----END PGP SIGNATURE-----
--IJpNTDwzlM2Ie8A6--
- 5
- A simple way to play a file in an ApplicationHi all,
I am looking for a simple way to play a sound clip (.au file) in a java
application (not applet). AudioClip in java.applet seems to require URLs for
clips, and the Java Sound API looks a little too elaborate for what I am
trying to do. All I need is for this .au file to be played once inside
another method. Can anyone give me some pointers here?
TIA
- 5
- Java Training*Free* and Guaranteed placementsHello,
I would like to quickly introduce our training programs to you. Please
do refer your friends or colleagues for the same.
We have two batches starting from June 3rd 2006. Training will last for
5 weeks and is free with Guaranteed placements within a month from
completion of the batch.
JAVA TRAINING
Batch Starts: June 3rd 2006
Duration: 5 Weeks
Location: East Windsor, CT
We will provide-
* Free accommodation * F1 to H1 transfer * Ongoing
onsite
support after getting placed * Green Card processing
We have an excellent Referral Policy. Please feel free to contact us
for
more information regarding the same.
call me ASAP at 860 436 6396
Regards,
Surbhi
Credent Technologies
30 Brookfield st, Suite - A, South Windsor, CT 06074
| Day-time: 860 436 6393 | Fax: 8603712779
email***@***.com
- 5
- Specify security access in JNLPIs it possible to specify what access the web start application needs to
run?
Using the JNLP code
<security>
<all-permissions/>
</security>
All access can be gained, but I would like to restrict it to contacting
certain servers and clipbaord access. More like 'java.awt.AWTPermission
"accessClipboard"'. Is it possible to use this policy code in the JNLP file?
G
- 5
- JVM parametersWhen using the parameters:
-Xms32m -Xmx200m
What exactly does this do in terms of how much memory is allocated to
the JVM from the system?
Does it initially allocate 32m to the JVM and allow it to grow to 200m
over time? Or does it allocate 200m initially?
Thanks.
- 5
- Java Swing Certified?I'm a Java Certified programmer (310-035) and currently I'm working
with Swing GUI components in my job.
I would like to ask if anybody knows if there's any certification exam
for Swing-AWT. I know this topic was removed from the programmers exam,
but I think this is still included in another exam.
Are there any good book to recommend for Swing?
Thank you.
Pablo
- 5
- The new Net Beans IDE Java developer software. Good in theoryNowadays when you obtain the SDK form java.com
you get a new interactive programming environemt
much like the Borland C++ IDE.
Up to now I've been developing applications "the old way"
using the operating system command line method.
that is, javac MyApp.java
Then my computer at home crashed and I decided to install the
JDK on my office computer. This was when I got the new
Net Beans IDE. It all seemed good in theory, having eveything
conveniently in one package, the editing, compiling and
executing of your program. It even promised a way to assemble
Jar files.
The problem is that application programs which compiled just fine
using the Command line compiler (javac MyApp.java) seemed to generate
numerous "Cannot Resolve Symbol" errors on this new IDE thing.
This is despite I had all necessary classes in the same directory.
Another thing, I cannot make Jar files for my applets.
I also han do problems with the command line method.
I just don't understand. What's worse is that there are no readily
available online resources to address such issues.
Thank goodness I didn't have to pay for this thingy.
What did these super-qualified programmers employed by Sun Microsystems
lear in college?
I finally got my home computer up and running again and
I so happend to have an SDK (command line java compiler) from a CD I got
with a Java textbook.
I loaded it onto my computer and I am back in business again.
Francis
- 6
- 10
- What is meant by 'canonical representation'Hi,
I was reading the sun java api 1.4.2 and found the following for
String.intern().
public String intern()
Returns a canonical representation for the string object.
What is a canonical representation? Any example?
//Mikael
- 10
- applet doesn't find jars !!Greetings, I'm trying to create graphics with jfree in an applet
here are the facts :
<HTML>
<HEAD>
<TITLE>Hello to Everyone!</TITLE>
</HEAD>
<BODY>
<APPLET codebase="http://localhost/applets/classes"
CODE="AppletBarChartDemo.class"
WIDTH="400"
HEIGHT="325"
archive="jfreechart-0.9.18.jar, jcommon-0.9.3.jar, log4j-1.2.8.jar>
<PARAM name="sourcexml" value="donnees.xml" >
</APPLET>
</BODY>
</HTML>
My console says :
java.io.IOException: Server returned HTTP response code: 400 for URL:
http://localhost/applets/classes/log4j-1.2.8.jar>
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
java.lang.NoClassDefFoundError at
org.jfree.chart.ChartFactory.createBarChart(ChartFactory.java:386)
java.lang.NoClassDefFoundError at
org.jfree.chart.ChartFactory.createBarChart(ChartFactory.java:386)
but my webserver (IIS on w2K) structure is thus :
root/applets/classes/
in it, I got the class files and the afore mentioned jars
And of course, I can run it under eclipse as an applet !!!
Browsers tested are IE6 and Firefox..
any tips ?
- 15
- Her tight ass shows a massive gape as a cock drills her arse Just few link on some movies...
All just for you...
Download
>>>>> http://download-video.12w.net
>>>>> http://world-sex.urllogs.com
>>>>> http://video-sex.12w.net
CLICK FREE DOWNLOAD VIDEO PORN...
L
I
C
K
T
O
W
A
T
C
H
V
I
D
E
O
P
O
R
N
D
O
W
N
L
O
A
D
|
| Author |
Message |
emzyme20

|
Posted: 2006-11-29 18:26:00 |
Top |
java-programmer, Regular Expression to match the domain part of an email address
Hi,
I'm trying to compile a regular expression that will match the domain
part of an email address. The email address has been split into 2
strings, the part before the @ sign and the part after the @ sign.
This regular expression is just working with the part after the @ sign.
The pattern that I have compiled appears to work for all combinations
except for something like:
a.com
b.com
However, the following do get matched:
a.co.uk
b.co.uk
I think the problem I have is because this combination is only a single
character long. The regular expression is truly horrendous, but I'm now
stuck with the way it has been done and need to figure out how to
modify it to accept the combination of "a.com" as a domain part of an
email address.
Can anyone tell me what's causing this problem from the expression
below?
Pattern.compile("^([\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?\\.)*[\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])\\.[\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?$");
Many thanks,
Emma
|
| |
|
| |
 |
Robert Klemme

|
Posted: 2006-11-29 18:47:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
On 29.11.2006 11:26, email***@***.com wrote:
> Hi,
>
> I'm trying to compile a regular expression that will match the domain
> part of an email address. The email address has been split into 2
> strings, the part before the @ sign and the part after the @ sign.
>
> This regular expression is just working with the part after the @ sign.
> The pattern that I have compiled appears to work for all combinations
> except for something like:
>
> a.com
> b.com
>
> However, the following do get matched:
>
> a.co.uk
> b.co.uk
>
> I think the problem I have is because this combination is only a single
> character long. The regular expression is truly horrendous, but I'm now
> stuck with the way it has been done and need to figure out how to
> modify it to accept the combination of "a.com" as a domain part of an
> email address.
>
> Can anyone tell me what's causing this problem from the expression
> below?
>
> Pattern.compile("^([\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?\\.)*[\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])\\.[\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?$");
What exactly do you want to achieve? Do you want to verify that the
string you have is actually a proper domain name? If so, then looking
at the RFC \\w seems to be matching too much (namely the underscore):
http://tools.ietf.org/html/rfc1034#section-3.5
When making the pattern case insensitive you should be able to match a
"label" in that spec with
[a-z](?:[a-z0-9-]*[a-z0-9])?
From that you can easily construct a complete RX to match a full domain
name.
robert
|
| |
|
| |
 |
Jussi Piitulainen

|
Posted: 2006-11-29 19:09:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
email***@***.com writes:
...
> The pattern that I have compiled appears to work for all
> combinations except for something like:
>
> a.com
> b.com
>
> However, the following do get matched:
>
> a.co.uk
> b.co.uk
>
> I think the problem I have is because this combination is only a
> single character long. The regular expression is truly horrendous,
> but I'm now stuck with the way it has been done and need to figure
> out how to modify it to accept the combination of "a.com" as a
> domain part of an email address.
>
> Can anyone tell me what's causing this problem from the expression
> below?
Here is your expression laid out on several lines, with the two
required characters before the last \. marked with <-----.
([\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?\\.)*
[\\*\\w] <-------
([\\*\\w\\-]{0,61}
[\\*\\w]) <-------
\\.
[\\*\\w]
([\\*\\w\\-]{0,61}[\\*\\w])?
It seems to me the parenthesised expression before the second arrow
should be optional. The other two identical expressions are.
|
| |
|
| |
 |
emzyme20

|
Posted: 2006-11-29 20:26:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
Hi,
I am trying to validate that the domain portion (everything after the @
sign, including the .com or .co.uk etc).
I modified the expression to try to make the part before the second
arrow optional. From the regular expression help that I have found,
this is done by putting a ?: at the start of the parenthesis.
(?:[\\*\\w\\-]{0,61}[\\*\\w])
This change allowed me to recognise a-b.com as a domain, but I am still
having issues with single character domains e.g. a.com, b.org
Is this because I've got two sections with \\w?
I agree with the comment about the underscores being invalid, I'll work
on a better expression to eliminate them.
Emma
Jussi Piitulainen wrote:
> email***@***.com writes:
> ...
> > The pattern that I have compiled appears to work for all
> > combinations except for something like:
> >
> > a.com
> > b.com
> >
> > However, the following do get matched:
> >
> > a.co.uk
> > b.co.uk
> >
> > I think the problem I have is because this combination is only a
> > single character long. The regular expression is truly horrendous,
> > but I'm now stuck with the way it has been done and need to figure
> > out how to modify it to accept the combination of "a.com" as a
> > domain part of an email address.
> >
> > Can anyone tell me what's causing this problem from the expression
> > below?
>
> Here is your expression laid out on several lines, with the two
> required characters before the last \. marked with <-----.
>
> ([\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?\\.)*
> [\\*\\w] <-------
> ([\\*\\w\\-]{0,61}
> [\\*\\w]) <-------
> \\.
> [\\*\\w]
> ([\\*\\w\\-]{0,61}[\\*\\w])?
>
> It seems to me the parenthesised expression before the second arrow
> should be optional. The other two identical expressions are.
|
| |
|
| |
 |
Robert Klemme

|
Posted: 2006-11-29 20:55:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
On 29.11.2006 13:26, email***@***.com wrote:
> I am trying to validate that the domain portion (everything after the @
> sign, including the .com or .co.uk etc).
>
> I modified the expression to try to make the part before the second
> arrow optional. From the regular expression help that I have found,
> this is done by putting a ?: at the start of the parenthesis.
No. Please reread your documentation. "(?:)" is simply a non capturing
group as opposed to "()".
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
> I agree with the comment about the underscores being invalid, I'll work
> on a better expression to eliminate them.
Yes, do that.
Regards
robert
|
| |
|
| |
 |
Jussi Piitulainen

|
Posted: 2006-11-29 21:49:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
email***@***.com writes:
[reordered]
> Jussi Piitulainen wrote:
>> Here is your expression laid out on several lines, with the two
>> required characters before the last \. marked with <-----.
>>
>> ([\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?\\.)*
>> [\\*\\w] <-------
>> ([\\*\\w\\-]{0,61}
>> [\\*\\w]) <-------
>> \\.
>> [\\*\\w]
>> ([\\*\\w\\-]{0,61}[\\*\\w])?
>>
>> It seems to me the parenthesised expression before the second arrow
>> should be optional. The other two identical expressions are.
...
> I modified the expression to try to make the part before the second
> arrow optional. From the regular expression help that I have found,
> this is done by putting a ?: at the start of the parenthesis.
>
> (?:[\\*\\w\\-]{0,61}[\\*\\w])
Er, no. It's made optional by adding a ? in the end, like so:
([\\*\\w\\-]{0,61}[\\*\\w])?
Your original expression contained two of these already, so I thought
you knew this. Other optional expressions are E* and E{0,61} but they
also repeatable.
It is a good idea to put in that ?: anyway, but for a different
reason. A merely parenthesised expression is used to "capture" the
part of the match that corresponds to that expression, and if you
don't use that mechanism, this computation is just wasted.
> This change allowed me to recognise a-b.com as a domain, but I am
> still having issues with single character domains e.g. a.com, b.org
That should have matched already. The ?: does not change what the
expression matches, only what parts of the match are captured as
groups.
> Is this because I've got two sections with \\w?
You have two top-level segments that both _have_ to match either a
literal * or a \w. By the way, you can write just "[*\\w]", the * is
not special inside brackets.
> I agree with the comment about the underscores being invalid, I'll
> work on a better expression to eliminate them.
I don't even know what is allowed in domain names. Is * really
allowed? Is a-.com really disallowed?
|
| |
|
| |
 |
emzyme20

|
Posted: 2006-11-29 23:24:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
> Er, no. It's made optional by adding a ? in the end, like so:
>
> ([\\*\\w\\-]{0,61}[\\*\\w])?
>
> Your original expression contained two of these already, so I thought
> you knew this. Other optional expressions are E* and E{0,61} but they
> also repeatable.
heh thanks for that.. I inherited this particular piece of code. I'm
trying to diagnose and fix a few problems that have been highlighted
since conception. When I sat down with the expression and separated it
into sections following a guide I was using, it stated that ? stood for
1 or more times, so that's why I never noticed that.
> You have two top-level segments that both _have_ to match either a
> literal * or a \w. By the way, you can write just "[*\\w]", the * is
> not special inside brackets.
ah yes, now I see those, the regular expression makes it really
difficult to spot everything and there's just far too many backslashes
for my liking....
> I don't even know what is allowed in domain names. Is * really
> allowed? Is a-.com really disallowed?
The * is for our benefit I think, we're allowing users to enter
wildcarded email addresses to save them having to specifically enter
every single combination in. I'm not sure about the - ended domain
name, I know you're not allowed to start or end with a dot.
|
| |
|
| |
 |
Jussi Piitulainen

|
Posted: 2006-11-30 0:35:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
email***@***.com writes:
>> Er, no. It's made optional by adding a ? in the end, like so:
>>
>> ([\\*\\w\\-]{0,61}[\\*\\w])?
>>
>> Your original expression contained two of these already, so I
>> thought you knew this. Other optional expressions are E* and
>> E{0,61} but they also repeatable.
>
> heh thanks for that.. I inherited this particular piece of code. I'm
> trying to diagnose and fix a few problems that have been highlighted
> since conception. When I sat down with the expression and separated
> it into sections following a guide I was using, it stated that ?
> stood for 1 or more times, so that's why I never noticed that.
Ok, here are some suggestions. First, if the guide really says ?
stands for one or more, don't trust it. Sun's documentation for
java.util.Pattern is actually rather good:
<http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html>
Second, my main point here, this particular pattern is a good
candidate for some abstraction, because it contains a repeated
sub-pattern. Tame it by naming that pattern. I do this below starting
from Robert Klemme's pattern and putting in that `*' that you want.
Third, I'm not convinced that you need to bother with {0,61}. That 61
is so many that I would just use *.
Fourth, when a single expression becomes unwieldy, you may be able to
write separate tests. One test to see that only the allowed characters
are used, another to see that the input starts and ends properly, for
example.
Consider this:
class Roska { public static void main(String [] args) {
// Wrapping `word' in (?: ) is a redundant safety
// measure here, but matters a lot if `word' ends
// before a quantifier or something.
String word = "(?:[a-z*](?:[a-z0-9\\-*]*[a-z0-9*])?)";
String words = "(?:" + word + "[.])+" + word;
for (int k = 0 ; k < args.length ; ++ k) {
System.out.println(args[k].matches(words));
}
}}
It seems to work. One or more words ending in a period, and then one
more word, where a word starts with ...
I'm not sure if the escape is needed for `-' in a character class, and
Sun does not seem to tell. It appears to work with or without.
|
| |
|
| |
 |
Lew

|
Posted: 2006-12-2 16:36:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
Jussi Piitulainen wrote:
> I'm not sure if the escape is needed for `-' in a character class, and
> Sun does not seem to tell. It appears to work with or without.
You don't need to escape the '-' in a character class if it's the first or
last character indicated:
[a-z] matches any character from 'a' to 'z'.
[a\-z] matches 'a', 'z' or '-'.
[az-] matches 'a', 'z' or '-'.
- Lew
|
| |
|
| |
 |
Jussi Piitulainen

|
Posted: 2006-12-2 18:00:00 |
Top |
java-programmer >> Regular Expression to match the domain part of an email address
Lew writes:
> Jussi Piitulainen wrote:
>> I'm not sure if the escape is needed for `-' in a character class,
>> and Sun does not seem to tell. It appears to work with or without.
>
> You don't need to escape the '-' in a character class if it's the
> first or last character indicated:
>
> [a-z] matches any character from 'a' to 'z'.
> [a\-z] matches 'a', 'z' or '-'.
> [az-] matches 'a', 'z' or '-'.
Or otherwise at a point where it does not form a range, when read from
left to right: [a-z-*]. Apparently.
It seems to be that way, but this is not documented. At least I can't
find it stated in Sun's documentation of java.util.regex.Pattern, 1.5,
which is otherwise rather thorough.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Question: Gui Looks DifferentI am a fairly new java developer, so the answer to my question may be
obvious to the veterans, but it is not obvious to me, so here goes. I
have an application that has several progress bars and other guid
widgets in it. On the system (a desktop with CRT) where the code was
developed the GUI looks normal. If I run the same code on my laptop,
the app still runs but the GUI is not drawn correctly. Is there a fix
(easy or otherwise) for this? Many thanks in advance,
Ken Browning
- 2
- jdbc on tomcatHi all,
I'm experiencing a unusual problem in
Apache Tomcat/4.1
sdk:1.4.1_03-b02
Linux 2.4.20-8 i386
I've got an application running on commons-DBCP
everything seems ok:
- libs in the commons/lib folder
- datasource in the context:
<Resource name="jdbc/devel4_minePooledDS" scope="Shareable"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/devel4_minePooledDS">
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@10.10.45.4:1521:orlx</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30000</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>500</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>30</value>
</parameter>
<parameter>
<name>password</name>
<value>mine</value>
</parameter>
<parameter>
<name>username</name>
<value>mine</value>
</parameter>
</ResourceParams>
- enabled in web.xml:
<resource-ref>
<description>Resource for DB connections</description>
<res-ref-name>jdbc/devel4_minePooledDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
- used in this way:
InitialContext initCtx = new InitialContext();
DataSource ds =
(DataSource)initCtx.lookup("java:comp/env/jdbc/devel4_minePooledDS");
Connection conn = ds.getConnection();
- the application simply doesnt start with the following errors, not
so helpful, to be honest:
2004-05-04 09:46:06 StandardWrapperValve[action]: Allocate exception
for servlet action
javax.servlet.ServletException: Servlet.init() for servlet action
threw exception
at org.apache.catalina.core.StandardWrapper.loadServlet(Unknown
Source)
at org.apache.catalina.core.StandardWrapper.allocate(Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown
Source)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown
Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContextValve.invoke(Unknown
Source)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown
Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContext.invoke(Unknown Source)
at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown
Source)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown
Source)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown
Source)
at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown
Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardEngineValve.invoke(Unknown
Source)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown
Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)
----- Root Cause -----
java.lang.StackOverflowError
at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.acceptElement(ValidationConsumer.java:1795)
at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.acceptElement(ValidationConsumer.java:1795)
at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.acceptElement(ValidationConsumer.java:1795)
at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.acceptElement(ValidationConsumer.java:1795)
at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.acceptElement(ValidationConsumer.java:1795)
at gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.acceptElement(ValidationConsumer.java:1795)
..
.
.
I didn't find anything similar
any helop will be appreciated
thanks in advance
jc
- 3
- Why does JMenuItem react to right button?In all the applications that I know, menu items react only to mouse
left-click. Swing JMenuItem, however, reacts to any mouse button click.
Swing JButton (which also extends AbstractButton) behaves as expected.
Does anybody know why? Is there any way to change this behavior?
Thanks in advance,
Diego
- 4
- quartic polynomial solverHi,
I'm looking for a java method or Math lib which solves quartic
polynomial equations a4 x^4 + a3 x^3 + a2 x^2 + a1 x + a0 = 0.
My google results pointed to dead links. Any help appreciated.
Thanks,
Lothar Leidner
- 5
- Trying to store fixed dates in calendar....hi,
sorry to bother you with a question somebody should have already ask,
but i was unable to find it in groups.google.com.. so ;)=
well, my problem is that i'm trying to store dates values in Calendar
(more exactly GregorianCalendar) class instances.
BUT... the stored dates keep on running upon the system date :
ie : i store 2h 34m 5s 324ms
4s later, when i print the date, it will give me something like
2h 34m 9s 450ms
it is very bothering for me...
how can i make Calendar class to store "fixed" dates... ?
or which class should i use to store "fixed" dates ?
Thanx for your help.
Pierre-Yves
- 6
- Problem With Eclipse IDE and perforce plugin.Hi I am running Eclipse SDK Version: 3.1.0 Build id: I20050627-1435
It has perforce plugin P4WSAD Client API Team provider core and
Provider UI all version 2005.2.3573
Each time I compile the project I got follows exception. I does not
prevent from working successfully but kind annoing.
Error 2006-10-19 10:46:56.703 Problems occurred when invoking code from
plug-in: "org.eclipse.core.resources".
java.lang.NullPointerException
at
com.perforce.team.ui.actions.TeamAction.getShell(TeamAction.java:154)
at
com.perforce.team.ui.actions.AddEditDeleteAction.doAddEditDelete(AddEditDeleteAction.java:70)
at
com.perforce.team.ui.PerforceMarkerManager.resourceChanged(PerforceMarkerManager.java:111)
at
org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:276)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
at org.eclipse.core.runtime.Platform.run(Platform.java:783)
at
org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:270)
at
org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:144)
at
org.eclipse.core.internal.resources.Workspace.broadcastBuildEvent(Workspace.java:185)
at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:200)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Thank u Vlad.
- 7
- SQL Server 2000 database connection problems: Can ANY one help?Environment: SQL Server 2000, Windows 2000, Eclipse, and Microsoft's SQL
Server 2000 driver for JDBC
Problem: Connection to any table in my SQL 2000 database hangs. If I stop
it, it produces the following exception:
com.sun.jdi.VMDisconnectedException: Got IOException from Virtual Machine
at
org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceive
Manager.java(Compiled Code))
at
org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceive
Manager.java:137)
at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:168)
at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:186)
at
org.eclipse.jdi.internal.ObjectReferenceImpl.invokeMethod(ObjectReferenceImp
l.java:350)
at
org.eclipse.jdt.internal.debug.core.model.JDIThread.invokeMethod(JDIThread.j
ava:647)
at
org.eclipse.jdt.internal.debug.core.model.JDIObjectValue.sendMessage(JDIObje
ctValue.java:67)
at
org.eclipse.jdt.internal.debug.eval.LocalEvaluationEngine.run(LocalEvaluatio
nEngine.java:231)
at
org.eclipse.jdt.internal.debug.core.model.JDIThread.runEvaluation(JDIThread.
java:562)
at
org.eclipse.jdt.internal.debug.eval.LocalEvaluationEngine.acceptClassFiles(L
ocalEvaluationEngine.java:218)
at
org.eclipse.jdt.internal.core.eval.RequestorWrapper.acceptClassFiles(Request
orWrapper.java:45)
at
org.eclipse.jdt.internal.eval.EvaluationContext.evaluate(EvaluationContext.j
ava:234)
at
org.eclipse.jdt.internal.eval.EvaluationContext.evaluate(EvaluationContext.j
ava:252)
at
org.eclipse.jdt.internal.core.eval.EvaluationContextWrapper.evaluateCodeSnip
pet(EvaluationContextWrapper.java:207)
at
org.eclipse.jdt.internal.debug.eval.LocalEvaluationEngine$1.run(LocalEvaluat
ionEngine.java:433)
at java.lang.Thread.run(Thread.java:498)
I have confirmed that server name is correct, and have pinged the port.
Looking at the following code snippet, what I am doing wrong?
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url =
"jdbc:microsoft:sqlserver://niels-bngjqb9y1:1433;DatabaseName=Forester;";
Connection conn = null;
conn = DriverManager.getConnection(url,"sa","");
- 8
- Comparing two long numbersJohn B. Matthews <email***@***.com> wrote:
>> I meant (Math.sqrt(5.)-1)/2, which is theoretically the same, but
>> numerically more stable, since the divisor is simpler.
>> But then it would be Math.PHI, and at least as exact as each of the
>> formulae, if not better than both. :-)
> You're right: I inverted but didn't simplify! But isn't
> (Math.sqrt(5.)-1)/2 equal to 1 / phi?
IIRC, PHI is the one with a "1" before the decimal point, so, yes,
your aspect ration was near 1/PHI actually. The other solution
of "x = 1/x + 1" is -1/PHI (-0.618...)
Just hold the height fixed, and make the width of your component
<wish>Math.PHI</wish> times longer. Or if really the width is
given, then make the height a PHI'th.
PS: I think we should think about ending this subthread, shouldn't we?
- 9
- newbie: "reference to object is ambiguous" errorHi!
I have this error compilling my application that I have created with
netbeans:
JFrameSample.java:164: reference to Object is ambiguous, both class
org.omg.CORBA.Object in org.omg.CORBA and class java.lang.Object
in java.lang match
new Object [][] {
^
1 error
How can I fix it? I need both: org.omg.CORBA and java.lang.*
any ideas?
Thanks!
LaCo
- 10
- Bug#365408: Millions of men use thisGive your woman extraordinary pleasure and extraordinary orgasms.
http://www.Plixiets.com/
Too hot to handle
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 11
- Spring/Tomcat/Ant/Java developmentHi there,
I am trying to build my first application with the Spring framework,
Apache Tomcat and Ant. I am having trouble accessing the application.
When I try to build it with Ant I get this error:
/home/workspace/springapp/build.xml:78: taskdef class
org.apache.catalina.ant.InstallTask cannot be found
Here is my build.properties file:
appserver.home=home/apache-tomcat-5.5.20
appserver.name=tomcat
deploy.path=${appserver.home}/webapps
tomcat.manager.url=http://localhost:8080/manager
tomcat.manager.username=<username>
tomcat.manager.password=<password>
And build.xml (just where the problem is occuring, since the whole file
is rather lengthy):
<taskdef name="install"
classname="org.apache.catalina.ant.InstallTask">
<classpath>
<path
location="${appserver.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<taskdef name="reload"
classname="org.apache.catalina.ant.ReloadTask">
<classpath>
<path
location="${appserver.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath>
<path
location="${appserver.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<taskdef name="start"
classname="org.apache.catalina.ant.StartTask">
<classpath>
<path
location="${appserver.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
<classpath>
<path
location="${appserver.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
Does anyone have a clue as to what I'm doing wrong??
Many thanks,
Courtney
- 12
- Response Control ProblemI am trying to connect to IBM Directory server using Sun JNDI
implementation. The scenario: Connecting to the directory using an
expired password. When I do this I expect to get a Password Expiration
response control that indicates that the password has been expired.
However when i execute the code I get no response control. The context
returned is null. Snippet of my code is shown below:
Hashtable env = new Hashtable(11);
env.put( Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://.../");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "dn...");
env.put(Context.SECURITY_CREDENTIALS, "...");
Control[] ctls = new Control[] {new PasswordPolicyRequestControl()};
ldapctx = new InitialLdapContext(env,ctls);
It throws AuthenticationException where I try to get the response
control but it returns null.
Thanks.
Ashish
- 13
- Register Now - BOF 36 JBoss SEAM and JavaServerFacesHello world,
This is a quick reminder that the BOF 36 is still on track as
scheduled for the 16th of April. If you are in or around London area
and think you would like to attend but missed the initial
announcement, well here's the link again
ttp://www.jroller.com/javawug/entry/javawug_bof_36_jboss_seam.
Secondly, I would also like to formally announce that there is a Code
Camp holding on the 19th of April at the same venue. More about the
Code Camp later.
Please note that these are TOTALLY FREE events organised by the London
based JavaWUG. So, just put your name down and come along.
http://www.jroller.com/javawug/entry/javawug_bof_36_jboss_seam#register
If you have any queries or need something clarified, please leave a
comment on this page.
Evans Anyokwu
http://www.javawug.org
- 14
- [OT] Re: Yet Another Web Application Mess...Hi,
Roedy Green wrote:
>... in the early 80...
> It will be that class's concern alone that
> Germans have a two part zip code.
Note that this was true in the early 80es but is no longer true since...
ah... the late 80es.
SCNR,
Ingo,
33615 Bielefeld
- 15
- ORBSocketFactory in JDK15I've created an ORBSocketFactory for use in JDK14. I now need to create one
for JDK15. It seems that the interface has substantially changed and that
it no longer provides the IOR, which I need access to to decide what kind of
socket to create.
The JDK14 classes had extensive javadocs. The JDK15 classes have zippo.
Can someone provide some useful tips on porting?
Regards,
Alan
|
|
|