comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * unreachable statements - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e0df80ed6bce6f07 * Java method Runtime.getRuntime().exec fails on HP-UNIX to start netscape. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/773130e411ae9e14 * HashSet is strange - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6da7fdad88ab5f26 * JDBC and Array Processing - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d4afc16f278187ef * Help!!! - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eaaeabcd73a84fe9 * bug in formatted output? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e01298425078a9f * .class to .exe - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c9acf42378c7800 * applet file output - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e915e998dd450e13 * TreeCellRenderer in Linux - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b517bf7c5a1bfcf4 * javax.xml.Parsers location - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a06eb697f944bccf * How to make JTabbedPane transparent? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/20f6b1a6e31b927e * Progress bar to show the progress of a task - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d367e2df931e5927 * An idea for a framework (does such a thing exist?) - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51ca7d8147024de2 * Newbie Question: How to return the current time in seconds or milliseconds? - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bf5002f4774a5da * EJBs vs. Servlets ?! - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/655ec6e612290698 * Color Bug? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9dd2bd9caea01a8a * DAO/DTO HELP - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94dd843a36b7218a * jdbc help:sun.jdbc.odbc.JdbcOdbcDriver - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90684ed8d04eca32 * java with Paltalk - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94e2c26b005774d9 * struts failed connection to remote mySQL - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e5875007b61aa2e4 * Problem with Java SSL: No trusted certificate found - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/486de8f334a1cd57 ========================================================================== TOPIC: unreachable statements http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e0df80ed6bce6f07 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 8:58 am From: Joona I Palaste <[EMAIL PROTECTED]> P.Hill <[EMAIL PROTECTED]> scribbled the following: > Jacob wrote: >> If there were some technical or security reasons for >> this compiler behaviour, I could understand, > My understanding is that it was NOT put in as an > aid to programmers, it was a rule to make it > more difficult to create self-modifying code, or > allow classes which have been manipulated to contain > dead code through the insertion of a random return statement > But then I couldn't find a reference to unreachable code > in the JLS byte code verification discussion, so I could > be wrong. Is this also the reason for Java's silly insistence on not allowing the programmer to catch exceptions that can't be thrown in the try block? -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/ "A bee could, in effect, gather its junk. Llamas (no poor quadripeds) tune and vow excitedly zooming." - JIPsoft ========================================================================== TOPIC: Java method Runtime.getRuntime().exec fails on HP-UNIX to start netscape. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/773130e411ae9e14 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 9:06 am From: [EMAIL PROTECTED] (Jakir) Thanks for the responses. The command "which netscape" returns "/usr/local/bin" and I had given that path but still it dosen't work. Also I don't get any error message. The output hello is seen and then nothing happens. Regards Jakir Gordon Beaton <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > On 13 Aug 2004 08:10:07 +0200, Tor Iver Wilhelmsen wrote: > > [EMAIL PROTECTED] (Jakir) writes: > >> Runtime.getRuntime().exec("netscape"); > > > > You need the explicit path to the executable. Runtime.exec() does > > not see the path. > > Looks to me like the PATH _is_ searched: > > [foo]$ strace -f java Exec mozilla 2>&1 | grep mozilla > > stat64("/home/gordon/bin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/usr/local/bin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/usr/local/sbin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/usr/bin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/usr/sbin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/bin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/sbin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/usr/local/X11/bin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/usr/X11R6/bin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/usr/local/pgm/j2sdk/bin/mozilla", 0x61d4149c) = -1 ENOENT > stat64("/usr/local/pgm/mozilla-1.7.1/bin/mozilla", > {st_mode=S_IFREG|0755, st_size=4253, ...}) = 0 > execve("/usr/local/pgm/mozilla-1.7.1/bin/mozilla",...) = 0 > > Maybe Jakir's problem is that netscape simply isn't _in_ his PATH. > > /gordon ========================================================================== TOPIC: HashSet is strange http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6da7fdad88ab5f26 ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 9:32 am From: "John C. Bollinger" <[EMAIL PROTECTED]> Christian Schuhegger wrote: > John C. Bollinger wrote: > >> If I understand you correctly, you are perpetrating an ugly hack by >> doing as you describe. In particular, consider this excerpt of the >> docs for the SortedSet interface (which is implemented by TreeSet): >> "Note that the ordering maintained by a sorted set (whether or not an >> explicit comparator is provided) must be consistent with equals if the >> sorted set is to correctly implement the Set interface." The >> Comparator docs discuss the issue more fully. > > > i have to admit that i did not read the documentation that carefully. The same remark appears in TreeSet's class documentation as well; I cited SortedSet instead to emphasize that the requirement it is not a quirk of TreeSet specifically. And as I wrote before, the issue is discussed at some length in the Comparator docs too. I'm not looking to pick a fight, but I have only limited sympathy for people who do not RT<expletive/>M. At least the class-level docs and the docs for the specific methods used, implemented, or overridden. How can you expect to subclass a class or implement an interface correctly if you do not know how your class' parent(s) indicate it should behave? How can you expect to use an object's methods appropriately if you don't know exactly what they're supposed to do? >>> therefore i also cannot understand why methods like find or sort or, >>> ... are not just static methods of the Collections class which take a >>> Comparator as an additional argument? > > > actually what i would like to have is an interface as you have in ANSI > Common Lisp. for example have a look at the following two links: > > 14. Sequences: > http://www-2.cs.cmu.edu/Groups/AI/html/cltl/clm/node141.html > 15.5. Using Lists as Sets: > http://www-2.cs.cmu.edu/Groups/AI/html/cltl/clm/node152.html I don't speak Lisp, but I get the idea. > by letting all of the methods given in the above two references take > addional parameters like :test and :key you actually do not care which > datastructure you have as the underlying, a list, a hashmap, a tree, ... > the functions just do what you want them to do on any datastructure. If you read the docs for the various Collections classes (or at least those for the basic interfaces: Collection, List, Set, and maybe Map) then you might find that Java Collections do much of what you're looking for. List and Set both extend Collection in such a way that you can use them fairly interchangeably. The Collections class (note the "s") offers a variety of methods for Collection instances, some more generic than others, but none more specific than the basic collection interfaces. Collection itself defines methods for several of the operations described for Lisp Sequences, and List defines a few more. Those defined on Lists and not on Sets are inapplicable to a Java Set because in Java generic Sets have no defined order. > you do not have to think about a clever way to do something like: > >> usermap.keySet().removeAll(idSet); > > i would have never guessed that the removal of the keys from the keySet > would also remove the elements from the map?? i would have guessed that > keySet returns a new data-structure without any connection to the > original map. And therein you have touched one of my pet peeves: why are you _guessing_ about such details? As I have been exhorting our friend Anony (who started this thread), read the API docs. > but by reading the documentation carefully enough i could have found out: > public Set keySet() > Returns a set view of the keys contained in this map. The set is backed > by the map, so changes to the map are reflected in the set, and vice-versa. One way a person might come to such a discovery without carefully studying all the method descriptions of every class and interface might be something like this: () I conceive a problem: I want to remove from a Map all of the entries with keys that appear in some Collection. () I look to the Map interface for a solution, and find no method that performs this specific task. () It seems an entirely reasonable thing to do, however, so perhaps there is still an easy way to do it. I start looking at the methods that have to do with keys. () The keySet() method stands out because it returns a Collection (a Set in fact). I read the docs for the keySet method, and aha! If you approach the platform API with the view that it is fairly complete and flexible then you will be more likely to find what you're looking for. The Collections classes are an especially good example, IMO; they have their flaws (some of which are inescapable consequences of the Java language design), but they are well designed, highly flexible, and written at very appropriate levels of abstraction. John Bollinger [EMAIL PROTECTED] == 2 of 2 == Date: Mon, Aug 16 2004 11:15 am From: Christian Schuhegger <[EMAIL PROTECTED]> John C. Bollinger wrote: > And therein you have touched one of my pet peeves: why are you > _guessing_ about such details? As I have been exhorting our friend > Anony (who started this thread), read the API docs. i think we can stop this here and i agree that you're right. i am also annoyed by people not reading the documentation properly. but after having seen serveral different programming languages, programming apis, ... for me the natural approach for the task was to look for something that takes a comparator and therefore i did not even look further. for example even in c++ the <algorithm> http://www.dinkumware.com/manuals/reader.aspx?b=p/&h=algorith.html package gives you the possibility to use all of the algorithms with a predicate instead of having to implement a custom equals/hashCode method like in java. besides that this is the first time that i see a keySet() method that acts like the one in the java HashMap. whenever possible i try to stick to a functional programming style and use "higher order functions". there are good papers comparing functional programming and object oriented programming in the context of c++ (for people not used to functional programming), e.g.: http://citeseer.ist.psu.edu/383622.html http://okmij.org/ftp/Computation/Subtyping/ have a nice evening, -- Christian Schuhegger http://www.el-chef.de/ ========================================================================== TOPIC: JDBC and Array Processing http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d4afc16f278187ef ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 9:33 am From: [EMAIL PROTECTED] (Ryan Gaffuri) How do I get the jdbc to use array processing when executing SQL? When I use Oracle and Oracle's 'sqlplus' tool, I can set the arraysize manually. This affects how many rows are retrieved from Oracle at a time. == 2 of 2 == Date: Mon, Aug 16 2004 11:44 am From: Oscar kind <[EMAIL PROTECTED]> Ryan Gaffuri <[EMAIL PROTECTED]> wrote: > How do I get the jdbc to use array processing when executing SQL? When > I use Oracle and Oracle's 'sqlplus' tool, I can set the arraysize > manually. This affects how many rows are retrieved from Oracle at a > time. This is called a fetch size in JDBC. See the method setFetchSize(int) in the interface java.sql.Statement. This method determmines the maximum number of rows fetched in one go from the database. If you want to limit the total number of rows retrieved, use the method setMaxRows(int) from the same interface. -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ========================================================================== TOPIC: Help!!! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eaaeabcd73a84fe9 ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 9:37 am From: "Hari" <[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 > > > > == 2 of 2 == Date: Mon, Aug 16 2004 10:57 am From: "Liz" <[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: 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 9:38 am From: [EMAIL PROTECTED] (hugo) [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 } } == 2 of 2 == Date: Mon, Aug 16 2004 12:31 pm From: zoopy <[EMAIL PROTECTED]> On 16-8-2004 18:38, hugo wrote: > [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 [snipped bug description] According to <http://java.sun.com/j2se/1.5.0/snapshots/jdk15.b58.bugsfixed.list.html> it's been fixed in build 58 (of July 19). It received 0 votes, and Sun assigning it with severity 2 (out of 5, I think) and a priority of 3 (out of 5(?)) it probably was not considered a bug to be fixed early on. -- Regards, Z. ========================================================================== TOPIC: .class to .exe http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c9acf42378c7800 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 9:42 am From: "Hari" <[EMAIL PROTECTED]> I have used many native .class to .exe converters, so that a java file can be executed on any PC like any other application. However, most of these are only shareware or temporary use converters which I can only use for 30 days or 20 executions. Does anyone know a free permanent converter that I can use to convert GUI .class files and console .class files to .exe files? -Thanks, Hari To reply to me personally (which I discourage), take the x out of my e-mail address. ========================================================================== TOPIC: applet file output http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e915e998dd450e13 ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 9:47 am From: "Hari" <[EMAIL PROTECTED]> For a site that I plan to put up, I want to put up an applet through which people can enter data. I want to applet to write to the server, but in a safe and encrypted way. First of all, if I tell the applet to write a file, without specifying a filepath, would it write directly to the server in the directory that the applet is in? Secondly, if I want to write a filepath, can I write: http://.../..../.../appletinput or would I have to the applet my ftp server password and so on. If any of you would like to e-mail me personally (which I discourage), take the x out of my e-mail address. == 2 of 2 == Date: Mon, Aug 16 2004 11:30 am From: "Matt Humphrey" <[EMAIL PROTECTED]> "Hari" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > For a site that I plan to put up, I want to put up an applet through which > people can enter data. I want to applet to write to the server, but in a > safe and encrypted way. First of all, if I tell the applet to write a file, > without specifying a filepath, would it write directly to the server in the > directory that the applet is in? Secondly, if I want to write a filepath, > can I write: > > http://.../..../.../appletinput > > or would I have to the applet my ftp server password and so on. If any of > you would like to e-mail me personally (which I discourage), take the x out > of my e-mail address. The first thing you need to realize when you are having your applet write a file back to your web server is that your web server is not a file server and there is no presumed protocol available for writing files. The filepaths you think you see in URLs are (at best) read-only and at worst not related to the server's file system. Rather, web servers respond to requests and you must make an HTTP POST request that contains the file contents and have a servlet or some small script put that into your filesystem. This is not done with Files, but with URLs and HTTP requests. (Alternatively, you can arrange for other techniques to transfer files such as FTP and SCP / SSH, but ultimately you must provide the receiver and a corresponding sender.) When you form the correct POST request you will also be (hopefully) indicating that the connection is over https (if you want it encrypted) and you'll be supplying the password that protects the account. (The bad news is that the password must therefore be in the applet and that isn't a very secure technique.) You'll have to search again to get details on setting up a password-protected HTTP POST request. Cheers, Matt Humphrey [EMAIL PROTECTED] http://www.iviz.com/ ========================================================================== TOPIC: TreeCellRenderer in Linux http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b517bf7c5a1bfcf4 ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 9:54 am From: Abs <[EMAIL PROTECTED]> Christian Kaufhold wrote: > > You first set the renderer, only then your model (why are you extending > JTree, DefaultTreeModel?). Therefore, initially FileTree will probably > (as you do not show the code, it is not clear) have a default model > containing DefaultMutableTreeNodes, and, depending on the LAF imple- > mentation is, might already query the renderer to calculate some > dimensions. > > First set your model (or even set it initially, in the FileTree con- > structor) and then the renderer. YES! It was exactly that. I've set an empty FileTreeModel in the FileTree constructor and now the app works flawlessly in linux. Thank you very much both of you for the answers, Christian and Paul. It seems same version JVMs in different platforms don't behave the same. > > Christian == 2 of 2 == Date: Mon, Aug 16 2004 9:58 am From: Abs <[EMAIL PROTECTED]> Paul Lutus wrote: > > That should not matter if the runtime engines are the same. Make sure you do > not have multiple Java versions installed on either platform, this could > produce a case in which a different engine is running the code than you > think. > Thank you for your answers, Paul. Following Christian's recommendations, I've set an empty FileTreeModel in the FileTree constructor and now the app works flawlessly in linux. It seems same version JVMs in different platforms don't behave the same. ========================================================================== TOPIC: javax.xml.Parsers location http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a06eb697f944bccf ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 10:22 am From: Martin Honnen <[EMAIL PROTECTED]> Gibakou wrote: > Does anybody know where could I download the javax.xml.parsers package > from? It is part of Java 1.4 and later so you don't need to download anything if you use 1.4 or later. -- Martin Honnen http://JavaScript.FAQTs.com/ ========================================================================== TOPIC: How to make JTabbedPane transparent? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/20f6b1a6e31b927e ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 10:37 am From: [EMAIL PROTECTED] (Bernd) [EMAIL PROTECTED] wrote in message news:<[EMAIL PROTECTED]>... > Hi, > > does anybody know, how to make a JTabbedPane transparent? > I tried setOpaque(false) on the JTabbedPane and all > its tab-panes, but it doesn't work. > > Thanks for your help. > > Bernd Ok, i found a workaround for the problem. Perhaps this is useful for somebody else: I had a look at the java source code, then - after some trial and error- implemented a new TabbedPaneUI by overriding a couple of methods. That did it. If somebody knows a more elegant way, please post. Greetings Bernd ========================================================================== TOPIC: Progress bar to show the progress of a task http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d367e2df931e5927 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 10:53 am From: Paul Lutus <[EMAIL PROTECTED]> Charlie Zhang wrote: >> >> Only your application can know how long the task is going to be. >> If you are reading a file, for example, you can map the file size >> to 100% and the current position in the file divided by the file >> size to be the current completion percent. If you just want to know >> how to set the value: setProgress(50); will set it to 50% > > Thanks a lot, but actually the task associated with that button is > complicated and hard to estimate the whole work load. Translation: "I cannot determine in advance a total count, but I want to show task progress." Is this correct? If so: JProgressBar.setIndeterminate public void setIndeterminate(boolean newValue) Sets the indeterminate property of the progress bar, which determines whether the progress bar is in determinate or indeterminate mode. An indeterminate progress bar continuously displays animation indicating that an operation of unknown length is occurring. By default, this property is false. Some look and feels might not support indeterminate progress bars; they will ignore this property. -- Paul Lutus http://www.arachnoid.com ========================================================================== TOPIC: An idea for a framework (does such a thing exist?) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51ca7d8147024de2 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 11:10 am From: [EMAIL PROTECTED] (Glenn) [EMAIL PROTECTED] (GG) wrote in message news:<[EMAIL PROTECTED]>... > Hi all, > > Here's an idea for a framework I thought about because I can make use > of it in my project. Maybe such a thing exists, > if so, I'd like pointers; if not, I'll start working on it myself. > > The project is for Java, so ... > > I want something that would make it easier for various modules to be > able to instrument themselves so they can > write logs, which can later be parsed again for replaying > the original behavior. (If that helps, consider something like > a recordable app on a Mac, where AppleScript can be used > to play it back). Frameworks are great for reuse. ;-) I don't know of anything that records and plays back logs. We wrote our own framework; all of our Java apps run on it(we write nearly everything in servlets). It provides many common services: database access, MQ services, error logging, HTML page-writing, login, batch processing, e-mail sending capability, and more. The next version will add file upload capability. We wrote it from scratch, and it's been running for over three years now. - Glenn ========================================================================== TOPIC: Newbie Question: How to return the current time in seconds or milliseconds? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bf5002f4774a5da ========================================================================== == 1 of 4 == Date: Mon, Aug 16 2004 11:07 am From: "Michelle" <[EMAIL PROTECTED]> Hi, May i know which class I should to return the current time in seconds / milliseconds? I have try using Date and Calendar class but seems no method with similar functions. thx. == 2 of 4 == Date: Mon, Aug 16 2004 11:12 am From: Christophe Vanfleteren <[EMAIL PROTECTED]> Michelle wrote: > Hi, > > May i know which class I should to return the current time in > seconds / milliseconds? > > I have try using Date and Calendar class > but seems no method with similar functions. > > thx. Look at System.currentTimeMillis(). -- Kind regards, Christophe Vanfleteren == 3 of 4 == Date: Mon, Aug 16 2004 11:13 am From: Christophe Vanfleteren <[EMAIL PROTECTED]> Michelle wrote: > Hi, > > May i know which class I should to return the current time in > seconds / milliseconds? > > I have try using Date and Calendar class > but seems no method with similar functions. > > thx. Forgot to add, if you're a newbie, c.l.j.help is probably the better group to ask your questions in the future. -- Kind regards, Christophe Vanfleteren == 4 of 4 == Date: Mon, Aug 16 2004 11:17 am From: "Matt Humphrey" <[EMAIL PROTECTED]> "Michelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > May i know which class I should to return the current time in > seconds / milliseconds? > > I have try using Date and Calendar class > but seems no method with similar functions. (new Date()).getTime () is the current time in milliseconds from Jan 1 1970 UTC. Alternative, use System.currentTimeMillis () which is also ms from 1/1/70. Cheers, Matt Humphrey [EMAIL PROTECTED] http://www.iviz.com/ ========================================================================== TOPIC: EJBs vs. Servlets ?! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/655ec6e612290698 ========================================================================== == 1 of 2 == Date: Mon, Aug 16 2004 11:15 am From: Christophe Vanfleteren <[EMAIL PROTECTED]> Tor Iver Wilhelmsen wrote: > Christophe Vanfleteren <[EMAIL PROTECTED]> writes: > >> Yes, you are correct in the case of regular servlets, but the poster >> explicitly mentioned JSPs, which you can not load on startup (unless you >> precompile them). > > You would not /normally/ declare JSPs in web-xml, but it's perfectly > legal: > > <servlet> > <servlet-name>helpPage</servlet-name> > *<jsp-file>help.jsp</jsp-file>* > <load-on-startup>1</load-on-startup> > </servlet> > > Other reasons for declaring servlet elements that are implemented as > JSPs are if you want to use getNamedDispatcher() to add a sense of > semantics to control flow. > > After declaring a JSP as a servlet, you can then use that in any way > you would any other servlet - add servlet-mappings, filter-mappings > etc. The only difference is that the servlet is implemented using JSP. Thanks for correcting me, I had never seen something like this used before. -- Kind regards, Christophe Vanfleteren == 2 of 2 == Date: Mon, Aug 16 2004 12:27 pm From: "Will Hartung" <[EMAIL PROTECTED]> "Razvan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > When someone should be using EJBs and when servlets ? > Are servlets just the Sun's lost children ?! They were just an > intermediate step before EJBs came out ? > > The only reason I see to use servlets instead of EJBs is if do not > have an application server (like JBOSS). > > Are there any other reasons ? (like performance, development time & > effort etc) Servlets are the primary technology in java used to interface with the Web. If you are talking to HTTP clients, you will, at some point, encounter a Servlet. You can obviously write custom code to listen for HTTP requests on a port and do with them what you will, but that would basically be folly and the reinvention of a lot of wheels. By working within the Servlet specification and within modern Servlet containers, you can do a lot of productive things. You can implement request logic within a Servlet, or you can simply use the Servlet as an interface to that logic. The logic can be implemented as Java classes wrapped by the Servlet, for example. EJBs are more geared toward creating distributed application logic. If there is a compelling reason to have your application logic physically seperate from the your presentation logic, then EJBs will fill that role. Note the key word "physically", as in the application logic is running on a seperate machine. A VAST majority of Web applications simply do not need this kind of seperation. While most application can profit from a logical seperation of application and presentation, far fewer benefit from the physical seperation requiring the added complexity and performance hit of a network hop. In a application that requires only a local application logic, logically seperated from the presentation versus physically seperated, EJBs can lose much of their charm and their complexity can override any real benefits provided by the EJB container. This realization has come from the use and creation of the new, "lightweight" frameworks, like Spring. These frameworks offer many of the advantages of an EJB container, but with lower complexity. However, for those application that truly need what EJB containers do offer, these frameworks will not fit the bill. However, again, those applications are much more rare. If you're integrating disparate systems, EJB is a good solution. But if you're simply writing an "everyday" web app, Servlets and any of the leading frameworks implemented on top of them will probably better serve your needs. Regards, Will Hartung ([EMAIL PROTECTED]) ========================================================================== TOPIC: Color Bug? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9dd2bd9caea01a8a ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 11:35 am From: Larry Coon <[EMAIL PROTECTED]> 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 ========================================================================== TOPIC: DAO/DTO HELP http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94dd843a36b7218a ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 12:01 pm From: Oscar kind <[EMAIL PROTECTED]> matt <[EMAIL PROTECTED]> wrote: > Where do[es] your DAO/DTO implementation draw the line? In my case, I use one of the existing libraries, but the principle should stay the same... > 1. Instanatiate an Employee object and only fill in the relative > information? Keep in mind that this could be just employee name and > location on the search results screen and then when the user chooses > which employee to view I need to get all of the employee information. Hardly. I use a DAO layer because I don't want to think about which data is fetched and which data is not. I also want the DAO layer to automatically fetch related objects. Note however, that even for those who don't want their application to do unnescessary work, this is not a good option. They will be more happy with option 3. > 2. Instantiate an Employee object and fill out all the information > even though you won't be needing most of it on the search results > screen? Bear in mind that most mature DAO layers have a caching mechanism that ensures that database access is minimalized. In such a case it is arguably more efficient to fetch everything, because unused information is rarely present in an object. You'll probably don't need all information on a search screen, but you do on the correcponding edit screen. > 3. Create 2 DTOs, one called Employee and one called EmployeeSearch > DTO. The EmployeeSearch DTO only stores what needs to be shown on the > search results screen and the EmployeeDTO holds all the information > for what needs to be shown on the detail screen? If you're worried about fetching data that is never used, this is the best option IMHO. You can also make Employee a subclass of EmployeeSearch, so there is no duplication of data. Also, business logic is likely to be included in the Employee class. This means that the EmployeeSearch class is not suited for anything other than read access (and maybe deletions), which is exactly what it is meant to be used for. > 4. Something else... I don't think other options are nescessary. There are (INHO) enough choices in options 2 (greedy) and 3 (more efficient, albeit more difficult as well). -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ========================================================================== TOPIC: jdbc help:sun.jdbc.odbc.JdbcOdbcDriver http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90684ed8d04eca32 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 12:31 pm From: Keith Wansbrough <[EMAIL PROTECTED]> "Madhur Ahuja" <[EMAIL PROTECTED]> writes: > * I saw code which accesses *access database* using this url > sun.jdbc.odbc.JdbcOdbcDriver . who provides this implementation > sun or microsoft. Sun provides a JDBC driver for ODBC. Microsoft provides an ODBC driver for Access. The two together mean a Java program can access an Access database. > where can I find the documentation of sun.* classes like I have those of > java.* classes. I have pdf file of JDBC Api specification but not > the ones like framed interfaces of java.* html pages. The sun.* classes are deliberately undocumented; they are internal to Sun's implementation of (some of) the java.* classes, and subject to change without notice. You should only ever depend on the java.* classes, and never need to know about the sun.* classes. --KW 8-) -- Keith Wansbrough <[EMAIL PROTECTED]> http://www.cl.cam.ac.uk/users/kw217/ University of Cambridge Computer Laboratory. ========================================================================== TOPIC: java with Paltalk http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94e2c26b005774d9 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 12:34 pm From: [EMAIL PROTECTED] (Fred) What do I need to know to write java code that will communicate with Paltalk. I have an external program that will fade Paltalk text, so I am confident it can be done. ========================================================================== TOPIC: struts failed connection to remote mySQL http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e5875007b61aa2e4 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 12:36 pm From: Keith Wansbrough <[EMAIL PROTECTED]> Sudsy <[EMAIL PROTECTED]> writes: > David wrote: > <snip> > > When I type netstat -a | grep > > 3306 I dont' get anything at all. > > Then you don't have a listener on that port which is why your > connection attempt fails. Comment out the skip-networking directive in /etc/mysql/my.cnf; if you don't do that, mysql listens on a Unix-domain socket only, but the MySQL Connector/J uses TCP connections only. Beware of security issues - by default mysql will listen on all addresses. I did bind-address = 127.0.0.1 to be relatively safe. Then shutdown mysql and restart it. --KW 8-) -- Keith Wansbrough <[EMAIL PROTECTED]> http://www.cl.cam.ac.uk/users/kw217/ University of Cambridge Computer Laboratory. ========================================================================== TOPIC: Problem with Java SSL: No trusted certificate found http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/486de8f334a1cd57 ========================================================================== == 1 of 1 == Date: Mon, Aug 16 2004 12:44 pm From: Joona I Palaste <[EMAIL PROTECTED]> Our application needs to communicate with an external server using SSL. I have J2SE 1.4.2_01 installed, which should include the Java SSL libraries, but I'm unable to get SSL to work. I tried this sample code from the Jakarta Commons HttpClient site: import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.Socket; import javax.net.ssl.SSLSocketFactory; public class Test { public static final String TARGET_HTTPS_SERVER = "www.verisign.com"; public static final int TARGET_HTTPS_PORT = 443; public static void main(String[] args) throws Exception { Socket socket = SSLSocketFactory.getDefault(). createSocket(TARGET_HTTPS_SERVER, TARGET_HTTPS_PORT); try { Writer out = new OutputStreamWriter( socket.getOutputStream(), "ISO-8859-1"); out.write("GET / HTTP/1.1\r\n"); out.write("Host: " + TARGET_HTTPS_SERVER + ":" + TARGET_HTTPS_PORT + "\r\n"); out.write("Agent: SSL-TEST\r\n"); out.write("\r\n"); out.flush(); BufferedReader in = new BufferedReader( new InputStreamReader(socket.getInputStream(), "ISO-8859-1")); String line = null; while ((line = in.readLine()) != null) { System.out.println(line); } } finally { socket.close(); } } } I complied and ran this program, and it gave the following exception: Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA6275) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275) at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275) at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275) at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA6275) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA6275) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275) at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336) at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404) at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152) at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213) at Test.main(Test.java:26) Caused by: sun.security.validator.ValidatorException: No trusted certificate found at sun.security.validator.SimpleValidator.buildTrustedChain(SimpleValidator.java:304) at sun.security.validator.SimpleValidator.engineValidate(SimpleValidator.java:107) at sun.security.validator.Validator.validate(Validator.java:202) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(DashoA6275) at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(DashoA6275) ... 13 more How can I solve this problem? I have created a keystore using keytool, and created a certificate request, but the CA I used (www.verisign.com) refuses to accept the request, claiming it uses an unsupported signing algorithm or has expired. Do I need to create a certificate myself? How do I add a trusted certificate for the external server (www.verisign.com in this case) so that my application can use it? Thanks in advance for any help! -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/ "My absolute aspect is probably..." - Mato Valtonen ======================================================================= 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/
