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

Today's topics:

* newbie exceptions question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80a2d1cab77381a
* HttpUtils deprecated, what can I use - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cd42953eb5e027fb
* Newbie question about EJB-CMP: is it worth it when using multiple containers? - 2 
messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7783b0dd00f912fb
* socket & JVM - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/62667ce992bbc83e
* Java Sound API adjust playback speed? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd4cf8ac5f8c6b76
* Building an Exception Layer - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a8359d1a0e5422fb
* JMF usage question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aad921bc1cea5088
* viva questions - any ideas? - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5ea074c24d5897ac
* Java 1.4.2_06 installation - Whats with all the java.exe - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/21ace15b63b4639
* getting the disk absolute path of a web-app - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cbdd00f8c8b7f37a
* java.net.SocketException: Insufficient buffer space - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c9c56b240ed60b1
* Java application developped under Linux running ridiculously slow under Windows - 1 
messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/accd6c66f1db2bc9
* How do you report a JIT crash bug? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e12e8e3c39c7cc4
* Boolean Expression - 4 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/81d323621ec79f88
* local disk based JDBC implementation - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3bcd34f5eb202fef
* Setting up Java 2 SDK - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f716f93502b214ca
* wireless code - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9aab5f810827f0c3
* How to know if a CD is inserted in the cdrom drive from java ? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5d0b1b8567b852
* Packet Capture - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c6d49060499f58f4
* Applet Application - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f30d2dd5fb15c376
* Event posting and handling in all classes? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/abb241d158f24acd
  
==========================================================================
TOPIC: newbie exceptions question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80a2d1cab77381a
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 8:16 am
From: Andrea Desole <[EMAIL PROTECTED]> 

Probably not. It's a regular runtime exception that is thrown by the JVM 
when a class is not found; not necessarily your main class. This means 
that you can get it anywhere in your code.


Nandan wrote:
> Andrea Desole wrote:
> 
>>>That will not work. There is no way to catch that exception, as I
>>>understand it. It isn't even a 'real' exception, as none of our code has
> 
> <snip>
> 
>>Well, considering that the class hasn't been found I don't see how its
>>code can be executed.
>>No, probably it wouldn't work
>>
>>Andrea
> 
> 
> 
> So rather than call it an exception, is it more correct to say it's an
> interpreter error message?
> 
> Thanks,
> Nandan




==========================================================================
TOPIC: HttpUtils deprecated, what can I use
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cd42953eb5e027fb
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 8:21 am
From: Frederic <[EMAIL PROTECTED]> 

Hello,

I need a method that parse the query part of a URL. I get this URL from 
HttpClient library (jakarta commons), so it's not part of a Servlet 
Request Object. HttpUtil.parseQueryString is deprecated. Does anybody 
know another libreary to do this ?

I'm using it that way to get one of the parameter

Hashtable hashtable = HttpUtils.parseQueryString(new 
URL(redirectLocation).getQuery());
ProductId = Long.parseLong(((String[]) hashtable.get("prodUID"))[0]);

Thanks

Frédéric




==========================================================================
TOPIC: Newbie question about EJB-CMP: is it worth it when using multiple containers?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7783b0dd00f912fb
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Nov 4 2004 8:26 am
From: Andrea Desole <[EMAIL PROTECTED]> 

Sudsy wrote:
> Andrea Desole wrote:
> <snip>
> 
>> If it's true then I will have problems if I have an application that 
>> supports multiple EJB containers, which is my case. So, my question 
>> is: isn't it better to write just some normal SQL once and use bean 
>> managed persistence, instead of writing and maintaining n different 
>> files (one for each container) for the same mapping? How complex 
>> should my SQL be to make CMP really valuable in this case?
> 
> 
> CMP EJBs are just another abstraction layer atop proprietary RDBMS
> interfaces. You write your queries in EJB QL rather than SQL and the
> mapping to the underlying data source is typically performed at
> deployment time.

true. It's also true that I can create/update/delete with almost no 
effort. But the problem with n different configuration files for n 
different containers still persists. And most of the times, when I have 
to implement CRUD operations or similar, I can use SQL that very likely 
will be understood by most RDBMS.


> If you're performing complex transactions across multiple data
> sources then the J2EE features really come into play. CMR and the
> "order by" clause (missing from the first version) handle much of
> the complexity you would have to manage explicitly with BMP.
> IMHO it depends on the complexity of your app. There are certainly
> alternatives; DAOFactory immediately comes to mind. Once you get to
> a point where you're explicitly managing transactions and relation-
> ships, you might have reached the juncture where CMPs can simplify
> your life (not to mention your coding ;-).
> 



== 2 of 2 ==
Date:   Thurs,   Nov 4 2004 8:55 am
From: Andrea Desole <[EMAIL PROTECTED]> 

> 
> I have to say that, after a further discussion, I now know that a reason 
> to use EJBs is also that EJBs allow a better control in the case that an 
> object changes, because a notification is sent, so that all the other 
> instances, on other machines (in case, for example, of a cluster) can be 
> updated. I'm not sure Hibernate can do that, and I'm not sure it's 
> possible to find a good framework that can (maybe JDO?)

never mind, I think I got the point.
The idea is to use Hibernate as a lower layer for the EJBs, so the EJBs 
can be regularly used.
Thanks

Andrea




==========================================================================
TOPIC: socket & JVM
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/62667ce992bbc83e
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 8:31 am
From: "Anceschi Mauro" <[EMAIL PROTECTED]> 

Hi i'm trying to create a some sort of JAVA print server:
I've a machine that accept (throught a socket) some spool file........
Here's the JAVA code:

ServerSocket TServer;

int i = 0;

try{

    TServer = new ServerSocket(TPort);

    while( true ){

        //frame.TModel.addElement("+++ WAITING REQUEST " + i );

        Lpd_request request = new Lpd_request(TServer.accept(),frame,PQ,NumQueue);

        request.start();

        i = i + 1;

    }

}


the problem is: every request launch another JVM for handle the print and create a pdf 
of the the spool data: for some reason if i create  a batch that launch 5 spool file 
one after the other, the print server launch 5 thread, but some thread terminate not 
correctly.

In particular the exit code are 1-0-1-0-0 so the first fail, the second is executed 
and so on.....

Can I put a delay between thread execution for solve the problem???

Any suggestion????


-- 
---------------------------------------------
 
Mauro Anceschi
IT Department
 
Global Service Srl
Gruppo Motor Power Company Srl
www.motorpowergroup.com
Tel +39-0522-688189
Fax +39-0522-683552
 
 
IMPORTANT: This e-mail message is intended only for the named recipient(s) above and 
may contain information that is privileged, confidential and/or exempt from disclosure 
under applicable law. If you have received this message in error, or are not the named 
recipient(s), please immediately notify the sender and delete this e-mail message.
 --------------------------------------------





==========================================================================
TOPIC: Java Sound API adjust playback speed?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd4cf8ac5f8c6b76
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 8:33 am
From: [EMAIL PROTECTED] (Mike) 

"Boudewijn Dijkstra" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> "Mike" <[EMAIL PROTECTED]> schreef in bericht 
> news:[EMAIL PROTECTED]
> > In Windows media/other audio apps you can adjust the playback speed of
> > an audio file while MAINTAINING pitch.
> >
> > Was wondering how to do this with java sound.
> >
> > found:
> > SampleRateControl
> >
> > by searching, but as far as I can understand, this will only alter the
> > PITCH and SPEED at the same time.  Just want to control speed,
> > maintain PITCH.
> 
> I'm afraid you'll have to this manually by calculating a band shift in the 
> frequency domain after increasing the speed+pitch.

Do you have any pointers/links for guidelines on this process? 
Haven't been able to find anything searching so far on it.  If not,
thanks for the help anyway.




==========================================================================
TOPIC: Building an Exception Layer
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a8359d1a0e5422fb
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 8:16 am
From: "Rizwan" <[EMAIL PROTECTED]> 

then it would be MITBaseException (MIT being the software product name which
we are creating). But then I have to include MIT with other exception name
as well for example MITPermissionException, etc.


"Chris Smith" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Rizwan wrote:
> > ok so all four exceptions has to be inherited from BaseException. thanks
> >
>
> One more comment: assuming that these exceptions will generally be
> handled from outside your library, BaseException is a really poor name.
> Why not name it after the API or framework?  That way, it's immediately
> obvious where the exception comes from when you're reading client code.
> For example, JavaMail throws MessagingException, and the java.io package
> throws IOException as a base class for their respective exceptions.  You
> are thinking as a library implementor instead of a library user, and
> threatening to create a mess for your users.
>
> -- 
> www.designacourse.com
> The Easiest Way To Train Anyone... Anywhere.
>
> Chris Smith - Lead Software Developer/Technical Trainer
> MindIQ Corporation






==========================================================================
TOPIC: JMF usage question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aad921bc1cea5088
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 9:25 am
From: [EMAIL PROTECTED] (Ted Holden) 

On Thu, 04 Nov 2004 02:40:06 GMT, Andrew Thompson
<[EMAIL PROTECTED]> wrote:

>On Wed, 03 Nov 2004 21:12:40 GMT, Ted Holden wrote:
>
>> I've ended up with a situation which positively requires Java, 
>
>If that requirement is 'x-plat', you may get some nasty
>surprises when using JMF.  Some of it is not (x-plat).


What exactly is x-plat? 

Basically, all I need is somethinng which works and is reasonably
portable and JMF appears to satisfy that, IF I can get it to work with
other widgets on the screen at the same time.  I'm still looking at
different ways of trying to do that but haven't succeeded at it so
far.  

The only other approach I've seen to this sort of problem would
involve JavaScript and either separate Java applets or a Java applet
and the windows media player, but I can't assume all users will be
using windows.






==========================================================================
TOPIC: viva questions - any ideas?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5ea074c24d5897ac
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Nov 4 2004 9:33 am
From: "VisionSet" <[EMAIL PROTECTED]> 


"Michael Borgwardt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Madhur Ahuja wrote:
> >    As regard of sun's jvm, i have found that it uses
> >    *reference counting collectors* algorithm to find out unused
> >    objects.
>
> No. This is wrong.
>
> > Q. What are the disadvantages of Swing over AWT?
> > A. Might be little slow.
>
> Not necessarily. The main disadvantage (as people seem to see it)
> is that it's not available until Java 1.2 and thus cannot be used
> in applets that are supposed to run in the outdated Microsoft JVM.

And that Swing *can* provide a more cross platform look to an application
where as awt uses the native toolkit.

--
Mike W





== 2 of 3 ==
Date:   Thurs,   Nov 4 2004 10:26 am
From: "Madhur Ahuja" <[EMAIL PROTECTED]> 

Thomas Weidenfeller <[EMAIL PROTECTED]> wrote:
> Madhur Ahuja wrote:
>> My instructor gave me some sample viva questions.
>> Some of the questions, were quite odd.
>
> They are indeed. However, some of your answers are also odd :-)
> I will add a "disagree" to the answers where I think that you should
> put some more work in, and do some more research.
>
>> Q. What is the data structure used in the garbage collection
>>     scheme of java[ or perhaps sun's jvm].
>> A. I have found that, implementation of garbage collection is
>>    implementation dependent. java specification only specifies
>>    what is garbage collection and not what algorithm to apply.
>>
>
>>    As regard of sun's jvm, i have found that it uses
>>    *reference counting collectors* algorithm to find out unused
>>    objects.
>
> disagree
>

I have searched a lot but not found exactly which *algorithm*.

[...]

> Oh well ... A lot of this is just opinions, and the actual advantages
> and disadvantages depend much on the context in which you use it.
> Indeed an odd question. Your instructor has most likely a particular
> opinion - maybe you find it in your course notes. But if this is what
> they teach you, then the course is not of the best quality.

Actually this is not what they teach, but these are viva questions.
viva questions here are generally more of a *research type* questions
rather than straight simple java concepts. Sometimes they even do not
have answers, they just exist to check the confidence of level and
understanding of student.

> /Thomas

--
Madhur Ahuja [madhur<underscore>ahuja<at>yahoo<dot>com]

Homepage
http://madhur.netfirms.com









== 3 of 3 ==
Date:   Thurs,   Nov 4 2004 10:58 am
From: Carl Howells <[EMAIL PROTECTED]> 

Madhur Ahuja wrote:
> Thomas Weidenfeller <[EMAIL PROTECTED]> wrote:
> 
>>Madhur Ahuja wrote:
>>
>>>My instructor gave me some sample viva questions.
>>>Some of the questions, were quite odd.
>>
>>They are indeed. However, some of your answers are also odd :-)
>>I will add a "disagree" to the answers where I think that you should
>>put some more work in, and do some more research.
>>
>>
>>>Q. What is the data structure used in the garbage collection
>>>    scheme of java[ or perhaps sun's jvm].
>>>A. I have found that, implementation of garbage collection is
>>>   implementation dependent. java specification only specifies
>>>   what is garbage collection and not what algorithm to apply.
>>>
>>
>>>   As regard of sun's jvm, i have found that it uses
>>>   *reference counting collectors* algorithm to find out unused
>>>   objects.
>>
>>disagree
>>
> 
> 
> I have searched a lot but not found exactly which *algorithm*.

Sun's recent JVM's have used several different strategies.  The basic 
approaches are typically a generational copying collector for new 
objects, and mark-and-sweep for objects which survive the first couple 
generations of the copying collector.

Those are only general strategies, though.  The exact algorithms used 
depend on the JVM options set, with different variations available for 
optimizing for different memory-use and latency vs. throughput 
considerations.

In other words, there isn't one answer to the question "What algorithm 
does it use?".




==========================================================================
TOPIC: Java 1.4.2_06 installation - Whats with all the java.exe
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/21ace15b63b4639
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 9:35 am
From: "Micha" <[EMAIL PROTECTED]> 

I've got a question about the installation of 1.4.2_06.  I've downloaded the
j2sdk-1_4_2_06-windows-i586-p.exe from Sun and installed this java version.
It installs three java.exe files.
j2re1.4.2_06\bin\java.exe
j2sdk1.4.2_06\bin.java.exe
j2sdk1.4.2_6\jre\bin\java.exe
What I need is to run java with the parm -server. Only the last bin folder
(j2sdk1.4.2_6\jre\bin) contains a server folder. So I guess this is the
program to use and I set the path to it. But when I run "java -server" this
error appears:
Error: no `server' JVM at `C:\Program
Files\Java\j2re1.4.2_06\bin\server\jvm.dll'.
Which I can understand, because the j2re1.4.2_06\bin folder has no folder
server. But why is it looking in the j2re1.4.2_06\bin and not to the
j2sdk1.4.2_6\jre\bin which is set in the path. I know that the correct
java.exe is executed. When I rename the other two, Windows still finds the
jave.exe to run.
So I have two questions. Why are there three java.exe (Sun says in the
installation instructions there will be two, one private, one public)? And
how can I get java to use the correct bin folder so I can use the server
parameter?

Any help would be appreciated (naturally, else I wouldn't have posted this
message).

Micha






==========================================================================
TOPIC: getting the disk absolute path of a web-app
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cbdd00f8c8b7f37a
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:03 am
From: "Will Hartung" <[EMAIL PROTECTED]> 

"Andrew Thompson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 4 Nov 2004 02:35:57 -0800, yair wrote:
>
> > how can i get the full path of my web
> > application on the disk (something like "c:\progran
> > files\tomcat\webapps\myApp")?
>
> javax.servlet.ServletContext.getRealPath(java.lang.String)

However, this is not guaranteed to not return null. If, for example, your
web-app is running from an unexploded WAR file, you won't get a useable
value.

Regards,

Will Hartung
([EMAIL PROTECTED])







==========================================================================
TOPIC: java.net.SocketException: Insufficient buffer space
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c9c56b240ed60b1
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:03 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

I wrote:
> wasting memory.  Unless you can determine the message size before 
> allocating the buffer, you have an unavoidable space / speed tradeoff 
> going on here.

Which is true as far as it goes, but upon further reflection I realize 
that if the typical message is considerably smaller than the largest 
possible message, and if there are a lot of messages, then the time to 
allocate (and later GC) a large amount of unused buffer space many times 
may trump the time it takes to copy bytes around in a scheme that uses a 
smaller buffer by default and expands it as necessary for large 
messages.  Such an adaptation scheme could be incorporated into my 
example code, but I'll spare you the details.

This all comes back around to the point that you need to _test_ to 
determine where your performance problems are, and you need to _test_ to 
determine whether any hand optimization you come up with actually 
improves performance.


John Bollinger
[EMAIL PROTECTED]




==========================================================================
TOPIC: Java application developped under Linux running ridiculously slow under Windows
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/accd6c66f1db2bc9
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 9:49 am
From: Dimitri Maziuk <[EMAIL PROTECTED]> 

hshdude sez:
> I owe this thread a message about the outcome.
[ exceptions ]

This is a known problem with exceptions.
Feed, say, 10,000 valid floats to the following:
  try { float f = Float.parseFloat( str ); }
  catch( NumberFormatException e ) {}
and time it. Then feed 10,000 invalid floats through and time
that (FVO "invalid float" including numbers in scientific format).
Then compare the times and weep.

IOW "exception" is called that because it's thrown in exceptional
circumstances. If it's a recoverable error that you expect to see
during normal program execution, you want to have a subroutine
return an error value that you can check in a plain if() instead.

Dima
-- 
Sufficiently advanced incompetence is indistinguishable from malice.




==========================================================================
TOPIC: How do you report a JIT crash bug?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e12e8e3c39c7cc4
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:14 am
From: "Mickey Segal" <[EMAIL PROTECTED]> 

"Andy Flowers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Got take a look at
> http://developer.java.sun.com/servlet/SessionServlet?url=/developer/bugParade/index.jshtml

My question is not about how to report a generic bug; I've reported several 
Sun bugs and many were accepted and fixed within weeks. My question is how 
one can get Sun to take seriously a bug report for which you do not have a 
reductionistic example, but merely have crash reports and a huge applet. 
Should one just submit the JIT crash reports and say it crashed?  Do the 
crash reports reveal information that discloses data or program code?







==========================================================================
TOPIC: Boolean Expression
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/81d323621ec79f88
==========================================================================

== 1 of 4 ==
Date:   Thurs,   Nov 4 2004 10:32 am
From: "Paul Wagener" <[EMAIL PROTECTED]> 

Hi folks,
Anyone having an idea of how testing for the following
condition in a loop:

    if (x/5 == true)break;     // this doesn't compute of course


/*
* x being a double number
*/

Thanks! 





== 2 of 4 ==
Date:   Thurs,   Nov 4 2004 10:34 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

Paul Wagener <[EMAIL PROTECTED]> scribbled the following:
> Hi folks,
> Anyone having an idea of how testing for the following
> condition in a loop:

>     if (x/5 == true)break;     // this doesn't compute of course


> /*
> * x being a double number
> */

> Thanks! 

Doubles can't be compared to booleans. What do you expect?
Or to put it another way:
What do you want to do? Exactly *WHEN* do you want the loop to break?
What condition must x be in for the loop to break? What numbers should
work and what shouldn't?

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"It was, er, quite bookish."
   - Horace Boothroyd



== 3 of 4 ==
Date:   Thurs,   Nov 4 2004 10:40 am
From: "adam" <[EMAIL PROTECTED]> 

> Hi folks,
> Anyone having an idea of how testing for the following
> condition in a loop:
>
>    if (x/5 == true)break;     // this doesn't compute of course
>
>
> /*
> * x being a double number
> */
>
> Thanks!
>

If you want to test whether x is divisble by 5, you could use the modulus 
operator (calculates the remainer of x/5, which'll be 0 if x is divisible by 
5):

if (x%5 == 0) break;

adam 





== 4 of 4 ==
Date:   Thurs,   Nov 4 2004 10:58 am
From: "Paul Wagener" <[EMAIL PROTECTED]> 

Thanks a lot!

The mod does the job quite fine.

Paul

"adam" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
>> Hi folks,
>> Anyone having an idea of how testing for the following
>> condition in a loop:
>>
>>    if (x/5 == true)break;     // this doesn't compute of course
>>
>>
>> /*
>> * x being a double number
>> */
>>
>> Thanks!
>>
>
> If you want to test whether x is divisble by 5, you could use the modulus 
> operator (calculates the remainer of x/5, which'll be 0 if x is divisible 
> by 5):
>
> if (x%5 == 0) break;
>
> adam
> 






==========================================================================
TOPIC: local disk based JDBC implementation
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3bcd34f5eb202fef
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:33 am
From: "bilbo" <[EMAIL PROTECTED]> 

Alex Hunsley wrote:
> I'm looking for local disk storage based JDBC implementations (i.e.
one
> that stores the database in files on disk, the exact format isn't
important)
>
> I've found a few already:
>
>
> http://www.csv-jdbc.com/ (commercial)
>
> http://hsqldb.sourceforge.net/ -  in memory or on disk database.
>
> http://www.servletguru.com/downloads.htm (see SimpleText.zip, is a
text
> JDBC driver)
>
>
> Just wondering if anyone is using or knows of any more that I've
missed
> from my above list!
Here's another one:

Mckoi SQL Database: http://mckoi.com/database/





==========================================================================
TOPIC: Setting up Java 2 SDK
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f716f93502b214ca
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:33 am
From: [EMAIL PROTECTED] (Mikey2jags) 

Hi there,
I'm trying to learn Java.
I'm stuck at the setup phase.

Idownloaded the developers kit Java 2 1.5.0
And the version seems correct java -version indicates the this,

When I write the code it saves ok.
But when I come to javac the code I keep getting the following error.

'javac' is not recognized as an internal or external command,
operable program or batch file.


I tried setting the ClassPath and Path as instructed.
Path 
C:\jdk1.5.0\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
Files\Common Files\Adaptec Shared\System

Doesn't seem to workwork.


Any advice?
Thanks in anticipation

Mike




==========================================================================
TOPIC: wireless code
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9aab5f810827f0c3
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:31 am
From: "djaksic" <[EMAIL PROTECTED]> 

Hi,

I'm planning to do my own simulator of  TCP snoop protocol in wlan (in java 
programming language). So if anyone have code related to this work please 
e-mail to me. Or any source related to wlan.
Thanks! 






==========================================================================
TOPIC: How to know if a CD is inserted in the cdrom drive from java ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5d0b1b8567b852
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:45 am
From: [EMAIL PROTECTED] (Greg Smith) 

http://java.sun.com/products/java-media/jmf/2.1.1/faq-jmf.html#jmf2-cd

this tidbit may help




==========================================================================
TOPIC: Packet Capture
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c6d49060499f58f4
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:49 am
From: "Captain Blammo" <[EMAIL PROTECTED]> 

I was wanting to write a little network monitoring tool that will sit on my
network in promiscuous mode and gather stats from a few application layer
protocols. I'd want to keep tabs on how many connections are set up, as well
as things like how many HTTP requests go back and forth (maybe even what
type of resource is requested).

I'm quite new to the more in-depth aspects of networking, and was wondering
what package anyone would recommend for doing this. I'm currently looking at
Jpcap (http://sourceforge.net/projects/jpcap). If anyone knows of a good
reason to use/not use it, or has any alternate recommendations, they'd be
greatly appreciated. It seems to be more than capable doing what I want, but
I'm not sure if it is, or if there's something better suited to my needs out
there.

Ewan







==========================================================================
TOPIC: Applet Application
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f30d2dd5fb15c376
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:49 am
From: "paul.foreman" <[EMAIL PROTECTED]> 

Hi,
    I have a vary newbi question on the construction of a Java Applet 
Application.

I would like some advice on the number of applets in my application. I have 
the initial window as an applet, from which the user can navigate to other 
windows.

My question is how many of these secondary/tertiary windows should be 
constructed as applets?
Does each applet create its own thread?
What are the pro/cons of each approach?

Any references which deal with this topic would be appreciated.

Regards

Paul







==========================================================================
TOPIC: Event posting and handling in all classes?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/abb241d158f24acd
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 10:55 am
From: [EMAIL PROTECTED] (Kaidi) 

Hi guys, 
I have one question of how to post/hand events under this class
framework:
 

                       JFrame A
                       JPanel B
      JPanel C                        JPanel D                .....
  JPanel E,  Thread F.            JPanel G, Thread H.       ...   ...

Thread F will be called when a button in JPanel E is clicked. 
And thread H will be called when a button in JPanel G is clicked. 
C,E,F are one one group. D,G,H are another group, etc. As program goes
on, more such groups will be added.
Thread F will update some GUI display things in JPanel E and D and G. 
Thread H will also need to update some display things in JPanel G, D.
C.
In other words, each thread needs to update something in ALL other
panels.

Surely, one way is to keep an reference of each of these panels in B
(or frame A) and keep a "parent" reference in each panels to B (or A).
But besides that, is there any better way to use Event to do this? For
example, thread F just posts an event and all other JPanels can get
and process.

Any suggestion or code example are appreciated. :-)

Thanks. 
PS: I am kind of new in Java event. I use JBuilder for
button/mouse/JComponents events and the handling functions are
auto-generated by JBuilder.



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

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

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


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

Reply via email to