comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Creating Logger in base class - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/15a74f87c385ade * Data Driven Struts/Tiles - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/54a760049e1fd0c * RMI client behind a firewall, server behind a firewall too - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/898ce13af69b8972 * Who is the best WebSphere Studio or Oracle JDeveloper?? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/747e9a4c137251d2 * VisualAge IDE scroll problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d862f878fe2f6af * How to force GUI updates? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c7ba8200d9e58260 * How to log into a web server? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/405f9dab611b53f3 * When the upgrade to Tiger - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5a609be6c073dce * How to figure out the width and height of an image? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52ac3d93bff8088f * Java Decompiler and comments - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b2492f14a4a9460f * byte representation of a class - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/754ced8b07b9a2d3 * Successor to Java? - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9151fedffecef56b * Java applet failed when I try to load the avi file in my java applet - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eee0d2c54a4b7feb * How to display multiple images - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58641d6b8a101c01 * Tomcat + java.io.FileNotFoundException - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7ba2cca95c5415a5 * How fast can Java run crypto in software based approach? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/89c167ba753df2ae * store whole InputStream in a String - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d510835287103e9 * We need good and free Java Rules Engine (JSR 94) - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3acb5cb7f397d8e5 * boradcasting and multicasting in java - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/64cdbb0821f213c7 * How to use JTree with very large data? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/145516a872afaa18 * Thread synchronization - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1 ========================================================================== TOPIC: Creating Logger in base class http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/15a74f87c385ade ========================================================================== == 1 of 1 == Date: Mon, Sep 13 2004 8:18 pm From: "WJ" <[EMAIL PROTECTED]> This is what I'm looking for. Thanks! This works great. ========================================================================== TOPIC: Data Driven Struts/Tiles http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/54a760049e1fd0c ========================================================================== == 1 of 2 == Date: Mon, Sep 13 2004 8:20 pm From: "WJ" <[EMAIL PROTECTED]> I really like the framework of struts and tiles. I started getting the idea of making the tiles definitions and action forward dynamicly load from a database instead of from a series of XML files. The reason for this is to apply personalization logic and such. Before I start looking at the struts source code, is there a project that has already done something like this? The goal is to have the action forwards and tile definitions changable without restarting the server or changing physical files (xml files). Thanks! == 2 of 2 == Date: Mon, Sep 13 2004 9:24 pm From: Sudsy <[EMAIL PROTECTED]> WJ wrote: > I really like the framework of struts and tiles. I started getting the idea > of making the tiles definitions and action forward dynamicly load from a > database instead of from a series of XML files. The reason for this is to > apply personalization logic and such. > > Before I start looking at the struts source code, is there a project that > has already done something like this? The goal is to have the action > forwards and tile definitions changable without restarting the server or > changing physical files (xml files). > > Thanks! From the javadocs for ActionServlet: "rulesets - Comma-delimited list of fully qualified classnames of additional org.apache.commons.digester.RuleSet instances that should be added to the Digester that will be processing struts-config.xml files. By default, only the RuleSet for the standard configuration elements is loaded. (Since Struts 1.1)" Digest that and then contemplate how straightforward it would be to add rulesets retrieved from a database. Kewl, huh? ========================================================================== TOPIC: RMI client behind a firewall, server behind a firewall too http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/898ce13af69b8972 ========================================================================== == 1 of 2 == Date: Mon, Sep 13 2004 9:10 pm From: Sudsy <[EMAIL PROTECTED]> Matthias Kraft wrote: > You can define sockets for the stub and the skeleton (Class > RMISocketFactory). > ---schnipp--- > public class HelloImpl implements Hello{ > public HelloImpl() throws RemoteException{ > UnicastRemoteObject.export(this, 80, new MyClientFactory(), new > MyServerFactory()); > } > ---schnapp--- > If you need a complete example, write me. > RMI is written for use in an Intranet. A better way is to use > Webservices to solve your problem (e.g. AXIS). To the OP: You've had two good replies here. I must admit that I was thinking Web Services simply because of portability issues. But the proxy approach is mature and enjoys wide support. IOW, you'd be well served by either solution. Good luck! == 2 of 2 == Date: Tues, Sep 14 2004 12:32 am From: "Alex Molochnikov" <[EMAIL PROTECTED]> If you have no control over the firewalls at all, then there is no solution. However, if you can negotiate opening of a few ports with the admin, then the solution does exist. If the latter is the case, let me know and I will walk you through the setup. Alex Molochnikov Gestalt Corporation www.gestalt.com "Robert Dodier" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > Browsing the web & newsgroups, it looks like this problem doesn't > have any kind of easy solution, but let's see if someone knows different. > > I want to have a RMI client behind a firewall and a RMI server > behind another firewall. I don't have any control over the firewalls. > I know port 80 will be open for http traffic, but that's it. > The web server on either side isn't the same as the machine running > the RMI client or server. > > I want the client to be able to call methods on server objects > and also to enable callbacks from the server to the client. > > What can be done in this case? I've read the RMI docs at Sun, > browsed through a few dozen webpages & news messages, and the > situation looks pretty dark, actually. Maybe someone has cause > for optimism here. Thanks for any information. > > Robert Dodier ========================================================================== TOPIC: Who is the best WebSphere Studio or Oracle JDeveloper?? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/747e9a4c137251d2 ========================================================================== == 1 of 2 == Date: Mon, Sep 13 2004 9:20 pm From: Sudsy <[EMAIL PROTECTED]> Alex Kizub wrote: > It depends what Application server you use :) > WebSphere - then WSAD; > JDeveloper for Oracle. I'm loathe to disagree but I find that Eclipse with Xdoclet support can generate code for, and deploy to, most J2EE servers including IBM's WebSphere and JBoss. Why use multiple tools (IDEs) when you can just select your target and be done? I can create projects with entity EJBs utilizing Oracle 8i in Eclipse. I can just as easily target DB/2. ps. Isn't WebSphere Studio Application Developer (WSAD) essentially the same code base as Eclipse? ;-) == 2 of 2 == Date: Mon, Sep 13 2004 11:19 pm From: Kevin McMurtrie <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, "REM" <[EMAIL PROTECTED]> wrote: > Can anybody tell me which IDE tools, Web Sphere, JDeveloper or etc, is the > best for the enterprise applications. > > I know that JDEveloper have good IDE for map database object but I am > interesting for web presentation, which has the best framework part for web > component, JSP, servlet and etc. I know that in WebSphereStudio can put > plug-in for Struts framework, but it's look very difficult for develop and > support. > > -- > thanks, > > ilica > > _________ I've heard that JDeveloper is good for the front-end coding. Eclipse is excellent for plain Java. ========================================================================== TOPIC: VisualAge IDE scroll problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d862f878fe2f6af ========================================================================== == 1 of 1 == Date: Mon, Sep 13 2004 9:32 pm From: "Mirlok" <[EMAIL PROTECTED]> On desktop the same version of VisualAge scrolls just fine... <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The problem is VA 4.0 uses java 1.2.2 (I think), scrolling with the > mouse is only supported on java 1.3 and above ========================================================================== TOPIC: How to force GUI updates? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c7ba8200d9e58260 ========================================================================== == 1 of 2 == Date: Mon, Sep 13 2004 10:03 pm From: Jacob <[EMAIL PROTECTED]> I have a processing loop that in each iteration update an image in GUI. When I run the program only the last GUI refresh is actually visible. I guess the entire processing is complete before the AWT thread is ever dispatched and then all the events are collapsed into one. How can I force the GUI refresh to actually execute in each iteration? (I tried the paintImmediately(), buth I don't like it and it didn't work either). Alternatively how should I organize a threaded solution? Thanks! == 2 of 2 == Date: Mon, Sep 13 2004 10:35 pm From: Paul Lutus <[EMAIL PROTECTED]> Jacob wrote: > I have a processing loop that in each iteration > update an image in GUI. When I run the program > only the last GUI refresh is actually visible. > > I guess the entire processing is complete before > the AWT thread is ever dispatched and then all > the events are collapsed into one. > > How can I force the GUI refresh to actually execute > in each iteration? You must put the processing loop in a separate thread. -- Paul Lutus http://www.arachnoid.com ========================================================================== TOPIC: How to log into a web server? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/405f9dab611b53f3 ========================================================================== == 1 of 3 == Date: Mon, Sep 13 2004 10:11 pm From: Jacob <[EMAIL PROTECTED]> I have got access (user/password) to a web server. I can log into the server using a browser; What is the correct approach (i.e. API) from a Java program? The server communicates using SOAP. Do I need the soap.jar, mail.jar and activation.jar, or can I communicate directly using Soap XML strings and the build-in Java XML parser? Thanks! == 2 of 3 == Date: Mon, Sep 13 2004 9:59 pm From: Chris Smith <[EMAIL PROTECTED]> Jacob wrote: > I have got access (user/password) to a web server. > I can log into the server using a browser; What is > the correct approach (i.e. API) from a Java program? See java.net.Authenticator. If you need more flexibility, then take a look at the Jakarta Commons project called HttpClient. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 3 == Date: Mon, Sep 13 2004 11:23 pm From: Kevin McMurtrie <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, Jacob <[EMAIL PROTECTED]> wrote: > I have got access (user/password) to a web server. > I can log into the server using a browser; What is > the correct approach (i.e. API) from a Java program? > > The server communicates using SOAP. Do I need the > soap.jar, mail.jar and activation.jar, or can I > communicate directly using Soap XML strings and > the build-in Java XML parser? > > Thanks! There are many different authentication schemes, including MD5 digest, basic (Base 64), a cookie from posting a form, and various forms supplied in RMI calls. You'll need to know more about how it works. ========================================================================== TOPIC: When the upgrade to Tiger http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5a609be6c073dce ========================================================================== == 1 of 1 == Date: Mon, Sep 13 2004 10:05 pm From: "Vincent Cantin" <[EMAIL PROTECTED]> > When are you upgrading your stuff to Tiger. I know a lot of you will > probably play around with, but are you planning to rewrite a majority > of your apps and server installs to work with the new java version > immediately, year, never? I see in terms of the bytecode, a majority > of it will work with 1.4 runtime and the compile time checks and code > dont look that much different. As soon as possible, as soon as my IDE support it, since I don't want to do without it. The Tiger version support Metadata. This was not mediatized, but it seems to be really usefull for everybody who wish to make tools over (and using) the java language. With the metadata, we have the possibility to extends by ourself the sementic of the language and to generate code from this hi-level information. The enum support is also very good, it makes the code more clear. I have numbers of classes which are waiting to be adapted to it. The genericity of Java is a real good thing. The type check is really welcome. ... Like a ugly fat red clown may say : "I'm lovin'it" :-) ========================================================================== TOPIC: How to figure out the width and height of an image? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52ac3d93bff8088f ========================================================================== == 1 of 3 == Date: Mon, Sep 13 2004 10:15 pm From: "Zsolt" <[EMAIL PROTECTED]> Thank you Andrew, I got -1 in width and height (Windows-XP, jdk-1.2.4-05). Instead of that I found an other solution: ImageIcon image = new ImageIcon(logoTargetFilename); int width = image.getIconWidth(); int height = image.getIconHeight(); Zsolt "Andrew Thompson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > On Mon, 13 Sep 2004 18:07:49 +0200, Zsolt wrote: > > > how can I figure out the height and width of an image (gif,jpeg, png etc.) > > file? > > Image image = Toolkit.getDefaultToolkit().getImage("pretty.gif"); > int width = image.getWidth(null); > int height = image.getHeight(null); > > HTH > > -- > Andrew Thompson > http://www.PhySci.org/ Open-source software suite > http://www.PhySci.org/codes/ Web & IT Help > http://www.1point1C.org/ Science & Technology == 2 of 3 == Date: Mon, Sep 13 2004 10:45 pm From: "ak" <[EMAIL PROTECTED]> > I got -1 in width and height (Windows-XP, jdk-1.2.4-05). because image was not loaded. > Instead of that I > found an other solution: > > ImageIcon image = new ImageIcon(logoTargetFilename); > > int width = image.getIconWidth(); > int height = image.getIconHeight(); ImageIcon loads image. after creating ImageIcon you will also get proper result with > > int width = image.getWidth(null); > > int height = image.getHeight(null); however if you want to get some info about image _before_ it was loaded e.g. you read image over network, then use Imagero Reader http://reader.imagero.com. -- Andrei Kouznetsov http://uio.dev.java.net Unified I/O for Java http://reader.imagero.com Java image reader == 3 of 3 == Date: Tues, Sep 14 2004 12:48 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> Andrew Thompson <[EMAIL PROTECTED]> writes: > Image image = Toolkit.getDefaultToolkit().getImage("pretty.gif"); You need to use a MediaTracker here to wait for the image to actually load before calling > int width = image.getWidth(null); > int height = image.getHeight(null); ========================================================================== TOPIC: Java Decompiler and comments http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b2492f14a4a9460f ========================================================================== == 1 of 1 == Date: Mon, Sep 13 2004 10:29 pm From: "Creatura" <[EMAIL PROTECTED]> > > Step 1 : for optimization purposes, does the Java compiler suppress the > > comments when it generates a file .class ? If 'yes', thanks ! > > Comments are comments, they are not transfered to bytecode. Thanks ! Creatura. ========================================================================== TOPIC: byte representation of a class http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/754ced8b07b9a2d3 ========================================================================== == 1 of 1 == Date: Mon, Sep 13 2004 11:31 pm From: Kevin McMurtrie <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Benjamin von Eicken) wrote: > Hi > > How can I get a byte representation of > a java class? > I do not want to use the class file. > Is it possible to get access to the > byte code? > ObjectOutputStream does it somehow, > but I do not want to use serializable > objects only and I do not want a > stream. > So I want to store an instance of an > object but not in a stream and not > necessary serializable. > Is it possible? No. > And if, how? > > regards > > Benjamin von Eicken Objects use references to other objects to store data. A shallow copy will loose nearly all data while a deep copy would gather every object in the heap. Other than a core dump of the entire JVM, there is no way to make a portable byte representation of a class without serializing it. Serialization saves relevant data and directives that can be used to reconstruct a very similar object later. ========================================================================== TOPIC: Successor to Java? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9151fedffecef56b ========================================================================== == 1 of 3 == Date: Mon, Sep 13 2004 11:35 pm From: Gordon Beaton <[EMAIL PROTECTED]> On Mon, 13 Sep 2004 18:20:30 -0700, Will Hartung wrote: > Java 5 (1.5) is just around the corner, but I can assure you that > once it gets finally released, in 2005, it can easily be a year > before, for example, the major app server vendors even validate > their servers to run on the new release. So, by 2009, we should be > well into Java 6. Java Five? Although Sun seems to have renamed j2se 1.5 to j2se 5.0 (when did that happen?), it's still called Java 2... >From http://java.sun.com/j2se/1.5.0/download.jsp: "Download Java 2 Platform Standard Edition 5.0 RC" /gordon -- [ do not email me copies of your followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e == 2 of 3 == Date: Tues, Sep 14 2004 12:49 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> "George W. Cherry" <[EMAIL PROTECTED]> writes: > Okay, I'll rephrase my question. > What's the COOL successor to Java? COOL was the codename Microsoft used for C#. :) But the question is better suited for clj.advocacy. == 3 of 3 == Date: Tues, Sep 14 2004 12:50 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> Gordon Beaton <[EMAIL PROTECTED]> writes: > Although Sun seems to have renamed j2se 1.5 to j2se 5.0 (when did that > happen?) When C#'s next version was called C# 2.0. You cannot have Java 1.5 and C# 2.0, it will sound like Java is less than C#. ========================================================================== TOPIC: Java applet failed when I try to load the avi file in my java applet http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eee0d2c54a4b7feb ========================================================================== == 1 of 1 == Date: Mon, Sep 13 2004 11:38 pm From: Andrew Thompson <[EMAIL PROTECTED]> On 13 Sep 2004 16:20:14 -0700, Krista wrote: > I am a new person in Java and JMF. I tried to use > HTML to run the class of the SimplePlayerApplet.java I will help you further if you make a post on the group for those starting in Java programming, further described here.. <http://www.physci.org/codes/javafaq.jsp#cljh> But what? You're a 1) beginner 2) dealing with applets 3) that require an extra package. You have some stress ahead. ;-) -- Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology ========================================================================== TOPIC: How to display multiple images http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58641d6b8a101c01 ========================================================================== == 1 of 3 == Date: Mon, Sep 13 2004 11:46 pm From: [EMAIL PROTECTED] (John Broadley) I am building a simple Java application. I have a list box in which I list a list of image files .jpg, and I want to create an area beside the listbox, where whenever the user click on an image in the list, I can display the image for him. I tried the ImageIcon class, and creating an instance and putting it in a JLabel, which is in a scrollable window. It works fine. But now, when I want to display a new image. Do I need to create all these objects again and agian. What if I have 100 images, will I end up with a huge number of objects creates my my program. Please note that the average size of the images is 500kb. I saw also a lot of talking about Toolkit related code, but I was not able to use such library in my Eclipse platform. Do I need to import anything to be able to use the Toolkit facilities like getting for example the screen resolution? Appreciate your help. == 2 of 3 == Date: Tues, Sep 14 2004 12:12 am From: Paul Lutus <[EMAIL PROTECTED]> John Broadley wrote: > I am building a simple Java application. I have a list box in which I > list a list of image files .jpg, and I want to create an area beside > the listbox, where whenever the user click on an image in the list, I > can display the image for him. I tried the ImageIcon class, and > creating an instance and putting it in a JLabel, which is in a > scrollable window. It works fine. But now, when I want to display a > new image. Do I need to create all these objects again and agian. What objects are those? Be specific. > What > if I have 100 images, will I end up with a huge number of objects > creates my my program. No, only one image is loaded at a time, if you design your program appropriately. > Please note that the average size of the images > is 500kb. My digital camera creates 3072x2048 size images, and when displayed in true color (3 bytes per pixel), that is over 18 megabytes per image when uncompressed and loaded into memory. But in my slideshow Java program I only have one image in memory at a time, so this is no problem. > > I saw also a lot of talking about Toolkit related code, but I was not > able to use such library in my Eclipse platform. Do I need to import > anything to be able to use the Toolkit facilities like getting for > example the screen resolution? When your user clicks a thumbnail, load the appropriate image. Arrange for this action to abandon the prior image, and the garbage collector will reclaim its memory. Do you want more specific information? Post more specific information. Post your code. -- Paul Lutus http://www.arachnoid.com == 3 of 3 == Date: Tues, Sep 14 2004 12:22 am From: Andrew Thompson <[EMAIL PROTECTED]> On 13 Sep 2004 23:46:19 -0700, John Broadley wrote: > I am building a simple Java application. I have a list box in which I > list a list of image files .jpg, ... A better group for GUI related matters is described here.. <http://www.physci.org/codes/javafaq.jsp#cljg> > I saw also a lot of talking about Toolkit related code, Make sure you steer clear of Toolkit.getImage() which states.. "Since the mechanism required to facilitate this sharing of Image objects may continue to hold onto images that are no longer of use for an indefinite period of time, developers are encouraged to implement their own caching of images by using the createImage variant wherever available. " Caching is not good when you have a slideshow of 500Kb+ images. >...but I was not > able to use such library in my Eclipse platform. Eclipse is neither the problem nor the solution in this one. The problem is in your code. >..Do I need to import > anything to be able to use the Toolkit facilities Toolkit tk = Tookmit.getDefaultToolkit(); > Appreciate your help. You're welcome. -- Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology ========================================================================== TOPIC: Tomcat + java.io.FileNotFoundException http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7ba2cca95c5415a5 ========================================================================== == 1 of 1 == Date: Tues, Sep 14 2004 12:07 am From: apatruduque <[EMAIL PROTECTED]> Alex and Sudsy, thanks a lot for your suggestions. I'll try with resources, since I have found a couple of places (one of them is the tomcat FAQ) in which it is suggested to use resources to read files. The problem is that the application was running smoothly using File xyz= new File("[application-context-path]/fileB.xml"); However, after a controled shutdown and restart of the system (did not touch any configuration file), I started getting the FileNotFound exceptions I mentioned before, which is kind of "strange", and I cannot find an explanation... may be the .class file being used was not corresponding to the .java I had in the system. The line before results in an error in catalina.out of the form: java.io.FileNotFoundException: file "/[application-context-path]/fileB.xml" not found which means that the File constructor is trying to access the / (root) directory of the filesystem. I put file fileB.xml in /[application-context-path]/fileB.xml (file system path) and the exception desapeared. This is kind of strange for me, since I thought (and probably wrong) that tomcat somehow wraps everything inside the context path... For these reasons, I'm trying to figure out if: 1- I was not accessing the file correctly, which apparently is the case 2- Is there a way to tell tomcat to add the real path somehow to the File constructor Thanks again, Alfonso > Application Server executes servlet and JSP in their own context (both > different by the way). > And patrh /xml/abc/xyz is added to this context root. > It is better then read files not from file system but as resources like > this: > public String stringFromResource(String name) { > > String result = ""; > try { > URL url = getClass().getResource(name); > URLConnection conn = url.openConnection(); > InputStream istream = conn.getInputStream(); > > BufferedReader in = new BufferedReader(new > InputStreamReader(istream)); > String temp = ""; > while ((temp = in.readLine()) != null) > result += temp + "\n"; > in.close(); > //System.out.println(result); > } catch (Exception e) { > System.out.println(e); > } > return result; > } > > At least you know where is your resource root (exactly where is root for > class loading). > > But if it's confusing for you I suggest to understand where are you in > file system and then put your files to this place. > Use regular java.io.File and run it INSIDE container! So you can > understand where you are and read files later: > > java.io.File file=new java.io.File("."); > or > java.io.File fileRoot=new java.io.File("/"); > and then read files in your location and try to understand where it is > eaxctly: > > out.println(fileRoor.getAbsolutePath() +" "+fileRoot.getCanonicalPath()); > > or even this way: > String [] list=fileRoot.list(); > if (list!=null) for (int i=0;i<list.length;i++) out println(list[i]); > > Alex Kizub. ========================================================================== TOPIC: How fast can Java run crypto in software based approach? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/89c167ba753df2ae ========================================================================== == 1 of 1 == Date: Mon, Sep 13 2004 11:46 pm From: Yu <[EMAIL PROTECTED]> After searching through Google, I find that there are too little benchmark done on performance of various JCE implementation. Personally I have tried the java code in Rijndeal's official homepage and obtained a result of around 10MB/s in a Pentium 4 machine. Would anyone share their experience on the performance of other crypto library? Such as RSA, 3DES, MD5 on cryptix, bouncycastle, etc... And which library would you think is the fastest implementation (software based)? Thanks! YU ========================================================================== TOPIC: store whole InputStream in a String http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d510835287103e9 ========================================================================== == 1 of 2 == Date: Tues, Sep 14 2004 12:17 am From: Rogan Dawes <[EMAIL PROTECTED]> Paul Lutus wrote: > > This doesn't solve the problem that the original do-loop doesn't have a > provision to terminate. Neither does your for-loop example, unless there is no input on the first read. It seems to me that the buffer is read only once at loop start, but len is never subsequently updated. I would also have expected AK's version to be correct: for (int len=is.read(buffer); len>0; len=is.read(buffer)) { // do something with buffer } because it updates len at the end of each loop, which yours does not. I might actually start using this in preference to the while construct. I quite like it, stylistically. > > All apart from an error I have also been ignoring: > > len = inputStream.read[buffer]; -> len = inputStream.read(buffer); > Well, I was ignoring it too, until I saw you sniping about an error that YOU originally made yourself!! ---snip----- ??? Please consider the following, and avoid constructions like "while(true)" and "break" when possible: int len; while((len = inputStream.read[buffer]) > 0) { bout.write(buffer, 0, len); } ---snip------ and ------------- >> I could instead have said: >> >> for (int len = inputStream.read[buffer]); len > 0;) { >> } -------------- ;-) Note that you also claimed to have compiled and tested that, which I somewhat doubt ;-) ---snip------- Quite false. It is entirely appropriate and a common coding practice. >> First I'm not sure it would >> compile, I compiled it, then posted it. You could do the same. ---snip--------- Rogan -- Rogan Dawes *ALL* messages to [EMAIL PROTECTED] will be dropped, and added to my blacklist. Please respond to "nntp AT dawes DOT za DOT net" == 2 of 2 == Date: Tues, Sep 14 2004 1:09 am From: Paul Lutus <[EMAIL PROTECTED]> Rogan Dawes wrote: > Paul Lutus wrote: > > >> >> This doesn't solve the problem that the original do-loop doesn't have a >> provision to terminate. > > Neither does your for-loop example, unless there is no input on the > first read. Which for-loop example are you speaking of? The current one, posted five times? Now six times: // using while int len; while((len = inputStream.read(buffer)) > 0) { bout.write(buffer, 0, len); } // using for for(int len;(len = inputStream.read(buffer)) > 0;) { bout.write(buffer, 0, len); } > > It seems to me that the buffer is read only once at loop start, but len > is never subsequently updated. > > I would also have expected AK's version to be correct: > > for (int len=is.read(buffer); len>0; len=is.read(buffer)) { > // do something with buffer > } > > because it updates len at the end of each loop, which yours does not. > > I might actually start using this in preference to the while construct. > I quite like it, stylistically. Again, it has a duplicate line of code where this is not necessary. It is bad coding practice. > >> >> All apart from an error I have also been ignoring: >> >> len = inputStream.read[buffer]; -> len = inputStream.read(buffer); >> > > Well, I was ignoring it too, until I saw you sniping about an error that > YOU originally made yourself!! I certainly did. See above. -- Paul Lutus http://www.arachnoid.com ========================================================================== TOPIC: We need good and free Java Rules Engine (JSR 94) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3acb5cb7f397d8e5 ========================================================================== == 1 of 2 == Date: Mon, Sep 13 2004 11:50 pm From: "toni" <[EMAIL PROTECTED]> > > We are new to Java Rules Engine API (JSR 94). ... > > 'We'? Is that the Royal 'We', or are > there a group of you? group > > So, we need advice about good, free rule engine.. > > It sounds like more you need either a consultant, > or Google for your basic research. What have rule > engines are you considering? What information have That is my question. We need someone, with experiance in java rule engines, to give us advice about few free, good engines, or if someone know about and url where we can find this kind of information (java rule engine comparison). > you ascertained thus far? Just that this kind of sf exist. We need info about free, good java rule engine, and where/how to include it (or rule engine is stand-alone server and can't be incorporated in ear?) in ear. == 2 of 2 == Date: Tues, Sep 14 2004 12:40 am From: Francisco Blay <[EMAIL PROTECTED]> toni escribió: >>>We are new to Java Rules Engine API (JSR 94). ... >> >>'We'? Is that the Royal 'We', or are >>there a group of you? > > > group > > >>>So, we need advice about good, free rule engine.. >> >>It sounds like more you need either a consultant, >>or Google for your basic research. What have rule >>engines are you considering? What information have > > > That is my question. > We need someone, with experiance in java rule engines, to give us advice > about few free, good engines, or if someone know about and url where we can > find this kind of information (java rule engine comparison). > > >>you ascertained thus far? > > > Just that this kind of sf exist. > We need info about free, good java rule engine, and where/how to include it > (or rule engine is stand-alone server and can't be incorporated in ear?) in > ear. > > google search: http://www.manageability.org/blog/stuff/rule_engines/view regards ========================================================================== TOPIC: boradcasting and multicasting in java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/64cdbb0821f213c7 ========================================================================== == 1 of 2 == Date: Tues, Sep 14 2004 12:37 am From: [EMAIL PROTECTED] (smeer_alwosabi) UDP protocals supports both broadcating and multicasting messages,and there some calsses in java language dealing with this the protocal,which are DatagramSocket and DatagramPacket. i tried to send broadcasting message using UDP protocal, but i can not do that. how you can send broadcating message or multicasting message by java language? == 2 of 2 == Date: Tues, Sep 14 2004 12:54 am From: Andrew Thompson <[EMAIL PROTECTED]> On 14 Sep 2004 00:37:57 -0700, smeer_alwosabi wrote: > i tried to send broadcasting message using UDP protocal, > but i can not do that. The problem is probably in the code you did not supply.. <http://www.physci.org/codes/sscce.jsp> -- Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology ========================================================================== TOPIC: How to use JTree with very large data? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/145516a872afaa18 ========================================================================== == 1 of 1 == Date: Tues, Sep 14 2004 1:04 am From: Rogan Dawes <[EMAIL PROTECTED]> Sorin Gherman wrote: > Hi, > I have the following problem: I have this large amount of data, stored > internally in some custom data structures (hierarchical ones, given > the nature of the data - I am using some custom, tree-like structurs > for this). > I have to show the different relations within this data using several > JTrees - one per "viewpoint". (The good news is that I only have to > show one type of view at a time.) > > The first implementation I came up with is just creating a tree model > (using DefaultMutableTreeNodes) for each view, and displaying it using > JTree. > Problem: memory consumption is very high (due to the duplication of > the tree structures in memory, and the fact that the user may toggle > between views fast, thus trees are created and thrown away - again, > memory is an issue so I cannot affort to store them). > > I read about the possibility to have my own internal data implement > the TreeNode interface, and have the JTree uses the internal data > directly - thus avoiding the creation of extra trees. > Problem: the implementation gets very complicated very fast due to the > different views. I can still live with that, but then I realized that > due to TreeNode.getParent() method, I would still have to duplicate, > in memory, for each view, at least the "parent" references. (This is > due to the fact that most of the internal nodes in my data structures > have different parents in different views...). Which means it doesn't > save that much memory after all... (well, it still saves the child > references and the node duplication). > > So I am wondering: is there any well-know "cure" for these type of > problems? > > Thanks in advance, > Sorin Gherman All the previous replies have suggested using a TreeModel, this is just a suggestion to derive your implementation of TreeModel from AbstractTreeModel (http://www.chka.de/swing/tree/AbstractTreeModel.java), which is a nice base implementation that you can derive from. http://www.chka.de/swing/tree/ has some nice explanations of various swing models. This link has some examples of working with trees and treemodels: http://java.sun.com/products/jfc/tsc/articles/jtree/ I would not use the AbstractTreeModel that they provide, as it simply delegates to TreeModelSupport, which just seems klunky to me. Rogan -- Rogan Dawes *ALL* messages to [EMAIL PROTECTED] will be dropped, and added to my blacklist. Please respond to "nntp AT dawes DOT za DOT net" ========================================================================== TOPIC: Thread synchronization http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1 ========================================================================== == 1 of 1 == Date: Tues, Sep 14 2004 12:32 am From: "Chris Uppal" <[EMAIL PROTECTED]> Lasse Reichstein Nielsen wrote: > > And since protecting the meaning (which can only be done from > > outside) will naturally protect the implementation too, there seems > > to be little need for the wrapper. > > Sometimes a list is just a list :) <grin> Not so very often, though. > URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html Nice! -- chris ======================================================================= 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 ------------------------ Yahoo! Groups Sponsor --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM --------------------------------------------------------------------~-> <a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> 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/
