comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * jar and fies - 12 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c2eb6dfd145db199 * Help!!! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eaaeabcd73a84fe9 * Color Bug? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9dd2bd9caea01a8a * J2SE certificates expired, can I get new ones? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fccf271a3324838d * Using Active Directory to handle application security - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a3741648798f2f1 * java 1.5 foreach statement - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f4af5297d3f93c05 * Simple Struts question: how can I add the value of a bean variable to arg0 of the bean:message tag? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e69bbf6c7ce52108 * PKWARE compression library - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8275b643feebb69c * bug in formatted output? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e01298425078a9f * click OK button programmaticlly - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fff32f6dbb1ec5e3 ========================================================================== TOPIC: jar and fies http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c2eb6dfd145db199 ========================================================================== == 1 of 12 == Date: Mon, Aug 16 2004 2:08 pm From: "<- Chameleon ->" <[EMAIL PROTECTED]> I create a jar file with all my classes and my image resources inside. Package name: my_pack. Now, I want to put inside jar file (and inside directory my_pack) a TXT file which I open with this line: BufferedReader f = new BufferedReader(new FileReader("my_pack/a_read_only_txt_file.txt")); but this line always throws an exception (file not found) What I can do? == 2 of 12 == Date: Mon, Aug 16 2004 4:45 pm From: "Hal Rosser" <[EMAIL PROTECTED]> > BufferedReader f = new BufferedReader(new > FileReader("my_pack/a_read_only_txt_file.txt")); > > but this line always throws an exception (file not found) > > What I can do? > I would play around with the file name (leave off the "my_pack/" part and see if it workie den. But i dunno nuttin' --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004 == 3 of 12 == Date: Mon, Aug 16 2004 6:21 pm From: Paul Lutus <[EMAIL PROTECTED]> Hal Rosser wrote: > >> BufferedReader f = new BufferedReader(new >> FileReader("my_pack/a_read_only_txt_file.txt")); >> >> but this line always throws an exception (file not found) >> >> What I can do? >> > I would play around with the file name (leave off the "my_pack/" part and > see if it workie den. > But i dunno nuttin' With all respect, why did you post? The OP is trying to read a file from a JAR archive. -- Paul Lutus http://www.arachnoid.com == 4 of 12 == Date: Mon, Aug 16 2004 6:31 pm From: Paul Lutus <[EMAIL PROTECTED]> - Chameleon - wrote: > I create a jar file with all my classes and my image resources inside. > Package name: my_pack. > > Now, I want to put inside jar file (and inside directory my_pack) a TXT > file which I open with this line: > > BufferedReader f = new BufferedReader(new > FileReader("my_pack/a_read_only_txt_file.txt")); > > but this line always throws an exception (file not found) > > What I can do? Learn how to read files from JAR archives: URL url = getClass().getResource(path/filename); InputStreamReader isr = new InputStreamReader(url.openStream()); BufferedReader br = new BufferedReader(isr); -- Paul Lutus http://www.arachnoid.com == 5 of 12 == Date: Mon, Aug 16 2004 6:34 pm From: "Hal Rosser" <[EMAIL PROTECTED]> "Paul Lutus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hal Rosser wrote: > > I would play around with the file name (leave off the "my_pack/" part and > > see if it workie den. > > But i dunno nuttin' > > >>> Paul Lutus quipped > With all respect, why did you post? The OP is trying to read a file from a > JAR archive. I was just trying to give him a starting point - ie: what I would try if I was in his shoes. That's exactly what I would have tried - if it did not work - I would try something else- But at least I tried - if I'm wrong - then post a positive reply - or - give him another starting point - or something else to try. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004 == 6 of 12 == Date: Mon, Aug 16 2004 6:40 pm From: "Hal Rosser" <[EMAIL PROTECTED]> > URL url = getClass().getResource(path/filename); > InputStreamReader isr = new InputStreamReader(url.openStream()); > BufferedReader br = new BufferedReader(isr); > If the text file is in a jar file - can you give an example of what " (path/filename) " shown in your first line- would need to be ? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004 == 7 of 12 == Date: Mon, Aug 16 2004 6:42 pm From: "KC Wong" <[EMAIL PROTECTED]> [Hal Rosser] > > > I would play around with the file name (leave off the "my_pack/" part > and > > > see if it workie den. > > > But i dunno nuttin' [Paul Lutus] > > With all respect, why did you post? The OP is trying to read a file from a > > JAR archive. [Hal Rosser] > I was just trying to give him a starting point - ie: what I would try if I > was in his shoes. > That's exactly what I would have tried - if it did not work - I would try > something else- > But at least I tried - if I'm wrong - then post a positive reply - or - give > him another starting point - or something else to try. That'll be confusing to the OP, and since this group is archived, it will confuse others searching similar topics as well. It is important that Paul pointed out your advice is incorrect. You provided a solution that you haven't tried and have no idea if it'll work (you said you dunno nuttin')... isn't that wasting the OP's time by pointing him to a random direction? Instead of blindly guessing you can wait for others to reply to this thread and learn from it. == 8 of 12 == Date: Mon, Aug 16 2004 6:46 pm From: "KC Wong" <[EMAIL PROTECTED]> BTW, I'm not saying one cannot post anything unless he's/her's 100% correct... the solution need not be perfect (others may chime in and provide a better solution, so you can learn from it too), but it should at least work. == 9 of 12 == Date: Mon, Aug 16 2004 6:47 pm From: "Hal Rosser" <[EMAIL PROTECTED]> ok - point taken "KC Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [Hal Rosser] > > > > I would play around with the file name (leave off the "my_pack/" part > > and > > > > see if it workie den. > > > > But i dunno nuttin' > > [Paul Lutus] > > > With all respect, why did you post? The OP is trying to read a file from > a > > > JAR archive. > > [Hal Rosser] > > I was just trying to give him a starting point - ie: what I would try if I > > was in his shoes. > > That's exactly what I would have tried - if it did not work - I would try > > something else- > > But at least I tried - if I'm wrong - then post a positive reply - or - > give > > him another starting point - or something else to try. > > That'll be confusing to the OP, and since this group is archived, it will > confuse others searching similar topics as well. It is important that Paul > pointed out your advice is incorrect. > > You provided a solution that you haven't tried and have no idea if it'll > work (you said you dunno nuttin')... isn't that wasting the OP's time by > pointing him to a random direction? Instead of blindly guessing you can wait > for others to reply to this thread and learn from it. > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004 == 10 of 12 == Date: Mon, Aug 16 2004 6:54 pm From: "KC Wong" <[EMAIL PROTECTED]> > > URL url = getClass().getResource(path/filename); > > InputStreamReader isr = new InputStreamReader(url.openStream()); > > BufferedReader br = new BufferedReader(isr); > > > If the text file is in a jar file - can you give an example of what " > (path/filename) " shown in your first line- would need to be ? It is the path of the file inside the JAR file. Type this command: jar -tf <put path of Jar file here> It will output a list of files inside the JAR. Locate your text file... that line is what you should put in the getResource call. == 11 of 12 == Date: Mon, Aug 16 2004 7:01 pm From: "Hal Rosser" <[EMAIL PROTECTED]> Thanks - now I can't say 'I don't know nuttin' "KC Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > URL url = getClass().getResource(path/filename); > > > InputStreamReader isr = new InputStreamReader(url.openStream()); > > > BufferedReader br = new BufferedReader(isr); > > > > > If the text file is in a jar file - can you give an example of what " > > (path/filename) " shown in your first line- would need to be ? > > It is the path of the file inside the JAR file. > > Type this command: > jar -tf <put path of Jar file here> > > It will output a list of files inside the JAR. Locate your text file... that > line is what you should put in the getResource call. > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004 == 12 of 12 == Date: Mon, Aug 16 2004 7:08 pm From: "KC Wong" <[EMAIL PROTECTED]> > Thanks - now I can't say 'I don't know nuttin' We programmers learn new things everyday :-) That's our way of survival in this ever changin computing world. ========================================================================== TOPIC: Help!!! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eaaeabcd73a84fe9 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 3:12 pm From: "Aghost.temp" <[EMAIL PROTECTED]> thanks for that liz. THe last post came too late for me to use it, and anyway - I worked it out myself. Thanks for the reminder anyway "Liz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > don't forget that your teacher might be reading this ng > (-_-) > > "Hari" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > "Aghost.temp" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Hi, > > > > > > Would anyone help me with the below > > > > > > 1). > > > a). Using a for loop write a program to display the numbers 1 to > > 10 > > > inclusive as follows; > > > > > > 1 > > > 2 > > > 3 > > > etc... > > > > > > Ensure your program is as efficient as possible. > > public class First > > { > > public static void main(String args[]) > > { > > for(int i = 1; i < 11; i++) > > { > > System.out.println(i); > > } > > } > > } > > > > > > b). Modify the above program to se an if statement to display > the > > > messasge "Even" next to all even > > > numbers and the message "Odd" against all odd numbers. > > > > public class Second > > { > > public static void main(String args[]) > > { > > for(int i = 1; i < 11; i++) > > { > > System.out.print(i); > > if(i % 2 == 0) System.out.print(" Even") > > else System.out.print(" Odd") > > System.out.println() > > } > > } > > } > > > > > > c). Repeat the above stages using while loops and do..while > loops > > > > > > 2). > > > > > > a). Use an array to store the cumulative total for each number, > > i.e > > > > > > Number Cumulative Score > > > 1 1 > > > 2 3 > > > 3 6 > > > 4 10 > > > 5 15 > > > > > > public class Third > > { > > public static void main(String args[]) > > { > > int array[] = new int[101]; > > for(int i = 1; i < array.length; i++) > > { > > array[i] = (i*(i+1))/2; > > } > > } > > } > > > > > > > > > > b). Modify the program to display all the numbers up to a > > cumulative > > > > Using this information you should be able to do the rest. -Hari > > > > > score of 100 > > > > > > 3). Wire a method to calculate the cube (x*x*x) of each number an > display > > > the answer to the last screen. > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > ========================================================================== TOPIC: Color Bug? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9dd2bd9caea01a8a ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 2:31 pm From: zoopy <[EMAIL PROTECTED]> On 16-8-2004 16:46, Andrew Thompson wrote: > On 15 Aug 2004 20:28:33 -0700, Jenny wrote: > > >>>>But the 120+i/2 is not an int. Why did it not cause error? > > > (Erich) > >>>If "i" is int, then the whole expression: "120+i/2" >>>uses only integer arithmetics, and is also int. > > >>Could you report it? I do not know how. > > > Report what? That you do not understand > how mathematical calculations might be > cast to 'int's? Please read up carefully > on casting, and continue this conversation > on c.l.j.help if necessary. > Jenny acknowledged her misunderstanding. The lengthy description of her misunderstanding in Jenny's OP obscured the actual bug that she was pointing out. The subject of the post "Color Bug?" maybe contributed to it as well. If you try Jenny's code (apart from indenting, a perfect SSCCE by the way ;-) ) you might see some repaint artefacts in the background of the label. The label is made opaque and filled with a transparent background color, i.e. with an alpha value < (int)255. The artefacts are more obvious when the transparent color is almost translucent (with lower alpha values). So, to me there seems to be a bug when repainting with a transparant background color. -- Regards, Z. == 2 of 2 == Date: Mon, Aug 16 2004 2:28 pm From: zoopy <[EMAIL PROTECTED]> On 16-8-2004 20:35, Larry Coon wrote: > zoopy wrote: > > >>>Thanks. It was my misunderstanding. Csn you try the code to comfirm the bug? >> >>Yep, seems a bug to me. > > (snip) > >>Please report this bug to Sun, if you would be so kind. > > > Not a bug. Well...it IS a bug, but it's one in Jenny's > code, not Sun's. > > > Larry Coon > University of California Have you actually tried Jenny's code? My first reaction was similar to yours when I read Jenny's one line reply "Thanks. It was my misunderstanding. Csn you try the code to comfirm the bug?" and I almost wanted to send a reply in similar wordings. But the firm question to confirm the bug made me re-read the thread. In the first paragraph of her original post Jenny does state a problem: "I tried the code below. The labelColor displays a small button when I move the thumb nail to the left. Is it a bug?" Then she goes on to describe, in several lines, her apprehension of "120+i/2" being a floating point expression and her confusion that the int version of the Color constructor was called instead of the float version. Tor and Erich pointed out her misunderstanding. The lengthy description of Jenny's misunderstanding obscured the actual bug that she was pointing out. The subject of the post "Color Bug?" probably contributed to it as well. If you try Jenny's example you might see some repaint artefacts in the background of the label. The label is made opaque and filled with a transparent background color, i.e. with an alpha value < (int)255 (or < (float)1 ;-). The artefacts are more obvious when the transparent color is almost translucent (with lower alpha values). IMHO it is a bug. -- Regards, Z. ========================================================================== TOPIC: J2SE certificates expired, can I get new ones? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fccf271a3324838d ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 2:52 pm From: Joona I Palaste <[EMAIL PROTECTED]> I just found out that some of my SSL certificates that I got along with J2SE 1.4.2_01 have expired. Can I get new ones by downloading a new J2SE from java.sun.com? Or will it have the same expired certificates? -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/ "The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers." - Bill Gates ========================================================================== TOPIC: Using Active Directory to handle application security http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a3741648798f2f1 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 2:56 pm From: [EMAIL PROTECTED] (Tom Ewall) Is anyone using Microsoft's LDAP (that comes with Active Directory) to handle application security/permissions in connection with java? We are considering this as an option, and I would like to know of the feasability of doing this and if anyone is already doing this, if they are happy with this solution. ========================================================================== TOPIC: java 1.5 foreach statement http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f4af5297d3f93c05 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 2:40 pm From: Jim <[EMAIL PROTECTED]> On 16 Aug 2004 10:32:55 +0200, Tor Iver Wilhelmsen <[EMAIL PROTECTED]> wrote: > >to left, why shouldn't bottom to top be an alternative? >I like to call them. Japanese and many other cultures read from right >formatted for the benefit of "top-posters", or "bottop-up readers" as >bottom to get the flow of a conversation; this article is therefore >That said, I will not force the culture of reading text from top to >"backward". >client that lets the user create responses in the natural way as >browser's bad ways, and attacking anyone who uses a well-behaved >change it, and instead spend their resources defending their >default behaviour in Outlook Express, and people do not know how to >because it's natural; top-posting is used simply because it's the >Quoting relevant parts and adding your comments underneath it is used >the (often fully quoted) article are you actually responding to? >the flow of conversation. After all, with top-posting, which part of >That is simply wrong; any news client can easily scroll down to reveal > >> newest on the screen after scrolling! >> telnet where the old stuff scrolls off the screen leaving the >> for not top posting is if you are still reading your news using >> Just one observation about top posting. The only reason I can see > >Jim <[EMAIL PROTECTED]> writes: OAMLFTOR Jim ========================================================================== TOPIC: Simple Struts question: how can I add the value of a bean variable to arg0 of the bean:message tag? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e69bbf6c7ce52108 ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 3:37 pm From: [EMAIL PROTECTED] (Thomas P. Fuller) Hi, any help with the following is much appreciated: I'd like to add the value of a bean variable into arg0 of the bean:message tag in the following way: The following works: <bean:write name="loginFormBean" property="userName"/> results in, for example, tfuller and <bean:message key="homepage.welcome.text"/> results in, for example: Welcome back {0}, we're happy to see you again! Now I need to figure out how I can do the equivalent of (this does NOT work): <bean:message key="homepage.welcome.text" arg0="loginFormBean.userName"/> which should give me: Welcome back tfuller, we're happy to see you again! I figure this should be pretty easy, but I'm having a bit of trouble with it; I'm new to Struts, so this is probably the reason why. Thanks, Thomas == 2 of 2 == Date: Mon, Aug 16 2004 6:42 pm From: bitbucket43 <[EMAIL PROTECTED]> Thomas P. Fuller wrote: <snip> > <bean:message key="homepage.welcome.text" > arg0="loginFormBean.userName"/> <bean:message key="homepage.welcome.text" arg0="<%= loginFormBean.userName %>" /> ========================================================================== TOPIC: PKWARE compression library http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8275b643feebb69c ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 4:38 pm From: "Hal Rosser" <[EMAIL PROTECTED]> > anything into > it that isn't actually there. > It only talks about the standard ZIP *file format* which, since it is > an open standard, can and is manipulated by code written in pure Java > in the java.util.zip package. No need at all to use the zip utilities > from pkware. Well, shux-darn - and I thought I was being helpful - thar eye go thanking agin --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004 == 2 of 2 == Date: Mon, Aug 16 2004 7:46 pm From: David <[EMAIL PROTECTED]> On Mon, 16 Aug 2004 19:38:28 -0400, "Hal Rosser" <[EMAIL PROTECTED]> wrote: >> anything into >> it that isn't actually there. >> It only talks about the standard ZIP *file format* which, since it is >> an open standard, can and is manipulated by code written in pure Java >> in the java.util.zip package. No need at all to use the zip utilities >> from pkware. > >Well, shux-darn - and I thought I was being helpful - thar eye go thanking >agin > Wee ahpresheate ur heelp. ========================================================================== TOPIC: bug in formatted output? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e01298425078a9f ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 7:06 pm From: [EMAIL PROTECTED] (hugo) [EMAIL PROTECTED] (hugo) wrote in message news:<[EMAIL PROTECTED]>... > [EMAIL PROTECTED] (hugo) wrote in message news:<[EMAIL PROTECTED]>... > > I'm using jsdk 1.5 beta 2. I think there is a bug in the new formatted > > output and was wondering if anyone knows if it has been fixed in the > > newer beta 3 builds. Note that the output of 0.01 shows up as 0.10 > > > > program: > > public class TestFormatting { > > public static void main(String [] args){ > > System.out.format("%.2f\n",1.0); > > System.out.format("%.2f\n",0.1); > > System.out.format("%.2f\n",0.01); > > } > > } > > > > output: > > $ java -cp . TestFormatting > > 1.00 > > 0.10 > > 0.10 > > > > thanks > > > Here's what I found in the java.sun.com bug database. It seems odd > that this bug was first reported in February but is still reported as > unfixed in 1.5 beta 3 snapshot 55 (18 june 04). > > > Bug ID: 5002937 > Votes 0 > Synopsis (fmt) formatting for small floats losing exponent and > rounding incorrectly > Category java:classes_util > Reported Against 1.5 , tiger-beta , tiger-beta2 > Release Fixed tiger-rc > State Closed, fixed > Related Bugs 5005649 , 5086406 > Submit Date 25-FEB-2004 > Description This code: > class PrintfEks { > public static void main(String[] args) { > double number = 8.5; > String format = "%9.2f\n"; > System.out.print("Format string: "+format); > for (int i = 0; i < 8; i++) { > System.out.print("(Number: "+number+") "); > System.out.printf(format, number); > number /= 10; > } > number = 0.085; > System.out.print("(Number: "+number+") "); > System.out.printf("%9.2f\n", number); > } > } > > produces the following > > Format string: %9.2f > (Number: 8.5) 8.50 > (Number: 0.85) 0.85 > (Number: 0.08499999999999999) 0.84 > (Number: 0.008499999999999999) 0.84 > (Number: 8.499999999999998E-4) 0.84 > (Number: 8.499999999999998E-5) 0.84 > (Number: 8.499999999999998E-6) 0.84 > (Number: 8.499999999999998E-7) 0.84 > (Number: 0.085) 0.85 > > > completely wrong for number<0.85 > > [EMAIL PROTECTED] 2004-02-25 > > Work Around None > > Evaluation Oh my! > > This needs to be fixed as soon as possible. > > -- [EMAIL PROTECTED] 2004-02-25 > > > Comments > Include a link with my name & email > > Submitted On 04-JUN-2004 > foxapple > Still exists in JDK 1.5 Beta2 > > > Submitted On 18-JUN-2004 > cayhorstmann > Still wrong in beta 3 snapshot 55. > > public class Test > { > public static void main(String[] args) > { > System.out.printf("%8.2f%n", 0.01); // prints 0.1 > } > } > > > Submitted On 19-JUL-2004 > Matei > Also happens with plain %f; > > import static java.lang.Math.*; > public class Test { > public static void main(String[] args) { > System.out.printf("%f%n", sin(PI)); // prints out 0.122464 > } > } ok, I tried jsdk 1.5 beta 3, build 60 on both Solaris and Windows and this problem seems to be fixed. == 2 of 2 == Date: Mon, Aug 16 2004 7:08 pm From: [EMAIL PROTECTED] (hugo) [EMAIL PROTECTED] (hugo) wrote in message news:<[EMAIL PROTECTED]>... > [EMAIL PROTECTED] (hugo) wrote in message news:<[EMAIL PROTECTED]>... > > I'm using jsdk 1.5 beta 2. I think there is a bug in the new formatted > > output and was wondering if anyone knows if it has been fixed in the > > newer beta 3 builds. Note that the output of 0.01 shows up as 0.10 > > > > program: > > public class TestFormatting { > > public static void main(String [] args){ > > System.out.format("%.2f\n",1.0); > > System.out.format("%.2f\n",0.1); > > System.out.format("%.2f\n",0.01); > > } > > } > > > > output: > > $ java -cp . TestFormatting > > 1.00 > > 0.10 > > 0.10 > > > > thanks > > > Here's what I found in the java.sun.com bug database. It seems odd > that this bug was first reported in February but is still reported as > unfixed in 1.5 beta 3 snapshot 55 (18 june 04). > > > Bug ID: 5002937 > Votes 0 > Synopsis (fmt) formatting for small floats losing exponent and > rounding incorrectly > Category java:classes_util > Reported Against 1.5 , tiger-beta , tiger-beta2 > Release Fixed tiger-rc > State Closed, fixed > Related Bugs 5005649 , 5086406 > Submit Date 25-FEB-2004 > Description This code: > class PrintfEks { > public static void main(String[] args) { > double number = 8.5; > String format = "%9.2f\n"; > System.out.print("Format string: "+format); > for (int i = 0; i < 8; i++) { > System.out.print("(Number: "+number+") "); > System.out.printf(format, number); > number /= 10; > } > number = 0.085; > System.out.print("(Number: "+number+") "); > System.out.printf("%9.2f\n", number); > } > } > > produces the following > > Format string: %9.2f > (Number: 8.5) 8.50 > (Number: 0.85) 0.85 > (Number: 0.08499999999999999) 0.84 > (Number: 0.008499999999999999) 0.84 > (Number: 8.499999999999998E-4) 0.84 > (Number: 8.499999999999998E-5) 0.84 > (Number: 8.499999999999998E-6) 0.84 > (Number: 8.499999999999998E-7) 0.84 > (Number: 0.085) 0.85 > > > completely wrong for number<0.85 > > [EMAIL PROTECTED] 2004-02-25 > > Work Around None > > Evaluation Oh my! > > This needs to be fixed as soon as possible. > > -- [EMAIL PROTECTED] 2004-02-25 > > > Comments > Include a link with my name & email > > Submitted On 04-JUN-2004 > foxapple > Still exists in JDK 1.5 Beta2 > > > Submitted On 18-JUN-2004 > cayhorstmann > Still wrong in beta 3 snapshot 55. > > public class Test > { > public static void main(String[] args) > { > System.out.printf("%8.2f%n", 0.01); // prints 0.1 > } > } > > > Submitted On 19-JUL-2004 > Matei > Also happens with plain %f; > > import static java.lang.Math.*; > public class Test { > public static void main(String[] args) { > System.out.printf("%f%n", sin(PI)); // prints out 0.122464 > } > } ok, I tried jsdk 1.5 beta 3, build 60 on both Solaris and Windows and this problem seems to be fixed. ========================================================================== TOPIC: click OK button programmaticlly http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fff32f6dbb1ec5e3 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 6:21 pm From: "MAB" <[EMAIL PROTECTED]> In one of my games a message box appears after every minute or so and I have to click an OK button to get rid of it. Is it possible to write a Java program that does this job for me automatically? I presume it must be like positioning the mouse where the OK button is placed and clicking it when the box appears. But how would my program know when the message box appears? Apparently the only solution is to keep clicking the mouse every second or two at that position. The solution is ok for me because I dont need the mouse in the game. So what classess and methods are involved? any help appreciated thx. ======================================================================= 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/prefs 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 ------------------------ Yahoo! Groups Sponsor --------------------~--> Yahoo! Domains - Claim yours for only $14.70 http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/BCfwlB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/kumpulan/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
