| A simple way to play a file in an Application |
|
 |
Index ‹ java-programmer
|
- Previous
- 4
- #gN Almost FREE MONEY !! #gNMAKE MONEY!!!
MAKE THOUSANDS!!!
I found this on a bulletin board and decided to try it: I don't care about
the useless pre-fabricated crap this message usually says. All I say is, it
works. Continue pre-fab crap.
WELL GUESS WHAT!!!
Within seven days, I started getting money in the mail!! I
was shocked!! I figured it would end soon, but the money just kept
coming in. In my first week, I made about $25.00. By the end of the second
week I had made a total of more than $1000.00!!
Let me tell you how this works and most important, why it works..........
also make sure you print this out NOW, so you can get the information off
of it, as you will need it. I promise you that if you follow the directions
exactly that you will start making more money than you thought possible by
doing something
so easy!!
Suggestion: Read this entire message carefully!! (Print it out or download
it)
Follow the simple directions and watch the money come in!! It's easy.
It's legal. And, your investment is only $6.00 (Plus postage) !!!
You can use any currancy as people can always change it..
IMPORTANT:
This is not a rip-off, it is decent; it's legal; and it is virtually no
risk - it really works!! If all the following instructions are adhered to,
you will receive extraordinary dividends.
PLEASE NOTE:
Please follow the directions EXACTLY, and $50,000 or more can be yours
in 20 to 60 days. This program remains successful because of the honesty
and integrity of the participants. Please continue its success by carefully
adhering to the instructions. You will now become apart of the Mail Order
business.
You are in the business of developing Mailing Lists. Many large corporations
are happy to pay big bucks for quality lists. However, the money made from
the
mailing lists is secondary to income which is made from people like you
and me asking to be included in that list. Here are the four easy steps to
success.
STEP ONE:
Get six separate pieces of paper and write the following on
each piece of paper "PLEASE PUT ME ON YOUR MAILING LIST."
Now get 6 U.S. $1.00 bills and place ONE inside of EACH of the six pieces
of paper so the bill will not be seen through the envelope (to prevent
thievery). Next, place one paper in each of the six envelopes and seal them.
You now should have six sealed envelopes, each with a piece of paper stating
the above phrase, your name and address, and a $1.00 bill. What you are
doing is creating a service.
THIS IS ABSOLUTELY LEGAL!!!!!
You are requesting a legitimate service and you are paying for it!! Like
most of us I was a little skeptical and little worried about the legal
aspects of it all. So I checked it out with the U.S. Post Office
(1-800-238-5355)
and they confirmed that it is indeed legal!!
Mail the six envelopes to the following addresses:
Matthew Dutton
46 Hayworth St
Point Vernon, Hervey Bay
QLD, 4390
Australia
R. Visser
P.O. Box 274
Nobby Beach
QLD, 4218
Australia
S. Phillips
77 Manly Drive
Robina, QLD 4226
Australia
Chris Pittman
7651 Abigail Glen Dr.
Charlotte, NC 28212
USA
Mike Vango
29 Pebblewood Ave
Scarborough, ON M1V-2A7
Canada
C. Wehler
137 Sara Rd
St. Marys, PA 15857
USA
STEP TWO:Now take the #1 name off the list that you see above, move the
other names up (six becomes 5, 5 becomes 4, and etc.) and add YOUR NAME as
number 6 on the list.
STEP THREE:
Change anything you need to but try to keep this article as close to
original as possible. Now post your amended article to at least 200 news
groups. : (I think there are close to 24,000 groups) All you need is 200,
but
remember, the more you post, the more money you make!! This is perfectly
legal!! If you have any doubts, refer to Title 18 Sec. 1302 & 1341 of the
Postal Lottery laws. Keep a copy of these steps for yourself and whenever
you need money, you can use it again, and again. PLEASE REMEMBER that this
program remains successful because of the honesty and integrity of the
participants and by their carefully adhering to directions. Look at it this
way. If you were of integrity, the program will continue and the money that
so many others have received will come your way.
NOTE: You may want to retain every name and address sent to you,> either on
a computer or hard copy and keep the notes people send you.
This VERIFIES that you are truly providing a service. (Also, it might be
a good idea to wrap the $1 bill in dark paper to reduce the risk of mail
theft). So, as each post is downloaded and the directions carefully
followed, all members will be reimbursed for their participation as a List
Developer with one dollar each. Your name will move up the list
geometrically so that when your name reaches the #1 position you will be
receiving thousands of dollars in CASH!!! What an opportunity for only $6.00
( $1.00 for each of the first six people listed above) Send it now, add your
own name to the list and you're in business!!!
*****DIRECTIONS FOR HOW TO POST TO NEWS GROUPS!!!*****
STEP ONE: You do not need to re-type this entire letter to do your own
posting. Simply put your cursor at the beginning of this letter and drag
your cursor to the bottom of this document, and select 'copy' from the edit
menu. This will copy the entire letter into the computer's memory.
STEP TWO:
Open a blank 'notepad' file and place your cursor at the top
of the blank page. From the 'edit' menu select 'paste'. This will paste a
copy of the letter into the notepad so that you will add your name to the
list.
STEP THREE:
Save your new notepad file as a text file. If you want to do your posting
in different settings, you'll always have this file to go back to.
STEP FOUR:
You can use a program like "postXpert" to post to all the newsgroups at
once. You can find this program at <<http://www.download.com>>.
Use Netscape or Internet Explorer and try searching for various new
groups (on- line forums, message boards, chat sites, discussions.)
STEP FIVE:
Visit message boards and post this article as a new message by
highlighting the text of this letter and selecting paste from the edit menu.
Fill in the subject, this will be the header that everyone sees as they
scroll through the list of postings in a particular group, click the post
message button. You're done.
Congratulations!!!!!!
THAT'S IT!! All you have to do, and It Really works!!!
BEST WISHES ...
ouYj\
- 4
- 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
- 6
- 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.
- 6
- How to delete lines from input file?I'm writing this program to implement a two phase multi-way merge sort.
It works by splitting the data to be sorted into temporary sorted
lists (output files) equal in size to a memory constraint that is
passed in when the program is run. What I've got to do now is actually
merge the lists into one final output. The trick is that this is
supposed to save disk I/Os. What happens is I read the smallest
element from each temporary file into an array. From that array, the
smallest goes into the final output, and that element is then replaced
by the next element from the same list.
I feel like what I need to do is delete a number from one of the
temporary when it's read into the array. Then all I have to do is read
the first line from the same list to get the next number into the
merging array. Any suggestions on how to do this?
I'm using SDK 1.4.2 and the input/output files are binary, so I'm using
DataInput/OutputStream to do this.
Thanks,
Andrew Weber
- 7
- 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?
- 8
- Problems with NetBeans and Subersion.Hi all,
I've got a problem with the subversion module.
I started to checkout from a svn repository with Subversion-
>Checkout...
Next I was asked to create a new project. I took a C++ project (C++
module).
My project window showed a new project BUT with ZERO files! But the
svn repository is fine...
Any hints for me?
Thanks
Goran
- 9
- EL: escaping HTMLHi!
I need to escape HTML - can this be done with EL alone? For a matter of
quotations marks I cannot use JSTL in a plain JSP:
<a href="javascript:f('<c:out value="problem"/>')">
Timo
- 9
- Openings in javaHi All
We currently have openings in java, for a reputed company in chennai.if
you interested please send your profile to email***@***.com
to refer any of your friends, colleagues who are looking for a
change....
POSITION Project Manager
PROFILE: 6+ years experience
Sound technical knowledge in java
Should have handling a team
Must be good team player
POSITION IN Chennai
Regards
for
current profile
- 14
- www/mod_jk2 fails to build (Maintainer fix enclosed!)
>Submitter-Id: current-users
>Originator: Larry Lansing
>Organization: AgileView Software Inc.
>Confidential: no
>Synopsis: www/mod_jk2 fails to build (Maintainer fix enclosed!)
>Severity: non-critical
>Priority: medium
>Category: ports
>Class: maintainer-update
>Release: FreeBSD 5.0-CURRENT i386
>Environment:
System: FreeBSD fuzzilicious.fuzzynerd.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Tue Apr 1 11:50:43 EST 2003 email***@***.com:/usr/obj/usr/src/sys/FUZZILICIOUS i386
>Description:
Attempting to build mod_jk2 yields the following:
libtool: link: `../common/jk_ajp12_worker.lo' is not a valid libtool object
>How-To-Repeat:
I could not reproduce this bug on 5.x, I received one report from
someone who did. I wasn't aware of the problem until I started
receiving bug reports from people running 4.7 and 4.8. If you attempt
to build mod_jk2 on 4.x, you should be able to repeat this bug 100% of
the time.
>Fix:
I found a one-line fix that seems to eliminate this problem for me.
Thanks go to the apache folks, who rolled this into one of the later
mod_jk versions. I'll update the port to the latest version in the
near future. Until then, please commit this fix.
Fix: replace the contents of www/mod_jk2/files/patch-configure.in with
the following:
--- configure.in.orig Tue Dec 17 05:20:55 2002
+++ configure.in Mon Jun 30 13:03:18 2003
@@ -102,7 +102,8 @@
WEBSERVER="apache-2.0"
APXSCFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CFLAGS`"
APXSCPPFLAGS="`${APXS} -q EXTRA_CPPFLAGS`"
- APACHE_CONFIG_VARS=${apache_dir}/build/config_vars.mk
+ APACHE_CONFIG_VARS=${prefix}/share/apache2/build/config_vars.mk
+ LIBTOOL=`$APXS -q LIBTOOL`
fi
AC_MSG_RESULT([building connector for \"$WEBSERVER\"])
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 15
- 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
- 16
- (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--
- 16
- question about console InputHello group,
I wonder if there's any equivalent to C's getch() in java, i.e to
fetch a character from the console immediately after the user typed it,
without pressing the "Enter" key.
Any solution or suggestion is welcome, thank you!
layman
- 16
- 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
- 16
- Generating classes for tables of a data baseHi,
I've got an already existing data base (Postgres) which consists of a
couple of tables and connections. There exist also some stored
procedures. Now, how can I get java-classes generated of this
information? Which tool can do this?
I would like to see a class for each table and methods to call stored
procedures or to locate records by their key.
PS. this must be done for c++, too.
- 16
|
| Author |
Message |
Steve Kostoff

|
Posted: 2003-10-19 10:01:00 |
Top |
java-programmer, A simple way to play a file in an Application
Hi 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
|
| |
|
| |
 |
Digby

|
Posted: 2003-10-19 20:23:00 |
Top |
java-programmer >> A simple way to play a file in an Application
I'm not sure that this applies in your case,. but don't forget that a file's
URL is file://path:/to/file.name.
"Steve Kostoff" <email***@***.com> wrote in message
news:Abmkb.94709$k74.38154@lakeread05...
> Hi 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
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 09/10/2003
|
| |
|
| |
 |
Steve Kostoff

|
Posted: 2003-10-20 4:13:00 |
Top |
java-programmer >> A simple way to play a file in an Application
"Roedy Green" <email***@***.com> wrote in message
news:email***@***.com...
> On Sat, 18 Oct 2003 22:00:55 -0400, "Steve Kostoff"
> <email***@***.com> wrote or quoted :
>
> >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.
>
> see http://mindprod.com/jgloss/sound.html It includes sample source to
> generate a sound file and play it programmatically.
Thanks Roedy, I was inspired by your example and that did the trick. I used
a FileInputStream for the File object for the .au sound file, and used that
in the player. It worked - thanks again.
Cheers,
Steve
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- 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
- 2
- 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
- 3
- 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
- 4
- 5
- 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
- 6
- 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);
}
}
- 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
- 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
- 9
- 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
- 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
- 11
- 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 ?
- 12
- 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
- 13
- 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
- 14
- 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
- 15
- Regular Expression to match the domain part of an email addressHi,
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
|
|
|