comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Looking for web host - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/12978f93dd03b5cd * JNI - really big troubles - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d130697894de900d * will factory pattern work here? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22414010364427d1 * Application in sandbox - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821eb31df84b5c4a * Pulling out duplicates - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c03ef99a3649796b * Library program - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/254a609c3ab1892e * sampling algoritm based on indexed constrains - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/76acd64d8a48b4ca * Reproducing du/ls in Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3b6930f360088c78 * How to suppress final 0 with DecimalFormat? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c25b4efdb9f3c1f3 * struts - opening new sized window - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5323c441b16e075b * Problems installing Cocoon 2.1.5.1 on BEA Weblogic 8.1sp2 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/39613b581cb88602 * help needed with jvmti and jni - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b93fb091b999b19 * Buy Programming Books - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3c112df683c25da9 * newbie question - how to download a J2ME based game from PC to a cell phone - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/30b360d4d1e873e3 * tooltip on graphics - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/421f42620349a105 * how to resize a array? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5ed97c9d7b81add ============================================================================== TOPIC: Looking for web host http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/12978f93dd03b5cd ============================================================================== == 1 of 2 == Date: Mon, Nov 29 2004 5:55 pm From: "Ike" Anyone know of a decent web hosting company offering Tomcat/Java they could recommend? Thanks, Ike == 2 of 2 == Date: Mon, Nov 29 2004 3:18 pm From: "Mickey Segal" "Ike" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Anyone know of a decent web hosting company offering Tomcat/Java they > could > recommend? Servlets.com has some reviews: http://www.servlets.com/isps/servlet/ISPViewAll ============================================================================== TOPIC: JNI - really big troubles http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d130697894de900d ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 4:00 pm From: "Chris Uppal" Clemens Arth wrote: > I'm really in big desperation. I've never seen such strange behaviour > in any C++ or Java program before... I'm really sorry that my error > description is that long, but I don't know what to do now. Maybe > anyone has got a simple answer to one of the problems mentioned above. Fromwhat you've described, my first thought is that you are picking up different of the .class files somehow. Perhaps older version(s) from previous experiments. > Anyway I don't want to spend another 8 or more hours to search for an > error I don't really know where it is... I don't blame you. Nobody likes to do that, but sometimes that's what it takes... :-( -- chris ============================================================================== TOPIC: will factory pattern work here? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22414010364427d1 ============================================================================== == 1 of 3 == Date: Mon, Nov 29 2004 1:14 pm From: Mark F I have a problem where I need one of several types returned depending on a user selection. I was planning on using a factory pattern as these types can all be related by a base class. The only problem is my concrete classes may not have all the same properties. Can I still use a factory pattern or should I use something else? Example: Abstract Class Document: name title subject Concrete Class Report extends Document: reportno keywords Concrete class Drawing extends Document: drawingno Thanks, -Mark == 2 of 3 == Date: Mon, Nov 29 2004 9:38 pm From: "xarax" "Mark F" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a problem where I need one of several types returned depending on > a user selection. I was planning on using a factory pattern as these > types can all be related by a base class. The only problem is my > concrete classes may not have all the same properties. Can I still use > a factory pattern or should I use something else? > > Example: > > Abstract Class Document: > name > title > subject > > Concrete Class Report extends Document: > reportno > keywords > > Concrete class Drawing extends Document: > drawingno That really depends on how the client application that receives the newly created instance will use it. Seems like you already think that polymorphic instances are the way to go. Well then, you'll likely want some interfaces like: =============================================== public interface DocumentFactory { public abstract Document createDocument(); public abstract String getName(); public abstract String getTitle(); public abstract String getSubject(); } public interface ReportFactory extends DocumentFactory { public abstract Report createReport(); public abstract int getReportNumber(); public abstract String[] getKeywords(); } public interface DrawingFactory extends DocumentFactory { public abstract Drawing createDrawing(); public abstract int getDrawingNumber(); } =============================================== The implementations look something like this: =============================================== public abstract class DocumentFactoryAbstract implements DocumentFactory { protected String name = ""; protected String title = ""; protected String subject = ""; public String getName() { return name; } public String getTitle() { return title; } public String getSubject() { return subject; } } public abstract class ReportFactoryAbstract extends DocumentFactoryAbstract implements ReportFactory { protected int reportNumber; protected String[] keywords = new String[] {}; public Document createDocument() { return createReport(); } public int getReportNumber() { return reportNumber; } public String[] getKeywords() { return keywords; } } public class ReportFactoryDefault extends ReportFactoryAbstract { public Report createReport() { return /* whatever to create a Report */; } } public abstract class DrawingFactoryAbstract extends DocumentFactoryAbstract implements DrawingFactory { protected int drawingNumber; public Document createDocument() { return createDrawing(); } public int getDrawingNumber() { return drawingNumber; } } public class DrawingFactoryDefault extends DrawingFactoryAbstract { public Drawing createDrawing() { return /* whatever to create a Drawing */; } } =============================================== btw: I am too lazy to write the setter methods, so I only included the getter methods. Create your concrete factory classes that extend either ReportFactoryAbstract or DrawingFactoryAbstract, as appropriate. Instantiate the factories once and stuff them into an array of type DocumentFactory[]. When the user selects an action to create something, use the index of the selected action to select an object from the DocumentFactory[]. Then call createDocument() on that object to get an instance that is appropriate for the selected action. If you want to deal directly with the sub-type by using downcasting, you can avoid using instanceof by using my "Inheritance Descending" design pattern. If you don't know that pattern, I can post an example later. It gives the equivalent of an instanceof and downcast without explicitly coding the instanceof or the downcast, so you can work the actual sub-type. -- ---------------------------- Jeffrey D. Smith Farsight Systems Corporation 24 BURLINGTON DRIVE LONGMONT, CO 80501-6906 http://www.farsight-systems.com z/Debug debugs your Systems/C programs running on IBM z/OS for FREE! == 3 of 3 == Date: Mon, Nov 29 2004 1:16 pm From: Oscar kind Mark F <[EMAIL PROTECTED]> wrote: > I have a problem where I need one of several types returned depending on > a user selection. I was planning on using a factory pattern as these > types can all be related by a base class. The only problem is my > concrete classes may not have all the same properties. Can I still use > a factory pattern or should I use something else? You can still use a factory, expecially if your classes have a common interface/superclass. If this is not the case, the users of your factory must do a manual cast. IMHO, this is only feasible if you can specify the returning class in a parameter. -- 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: Application in sandbox http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821eb31df84b5c4a ============================================================================== == 1 of 3 == Date: Mon, Nov 29 2004 12:39 pm From: "John C. Bollinger" Tim Tyler wrote: > Andrew Thompson <[EMAIL PROTECTED]> wrote or quoted: > >>On Sat, 27 Nov 2004 21:04:09 GMT, Tim Tyler wrote: > > >>>I have an application (in a Jar file) which I don't trust - and would >>>like to run securely - in a sandbox. >>> >>>Does anyone know the easiest way? >> >>Launch it from an applet. It will inheret the applet sandbox. > > > So: has anyone done this before? Does it work? I have not tried it, but as I understand applets, this will FAIL if the applet is loaded from the local machine, although it will work if the applet is loaded from a remote server. As Andrew suggested, you should test it before relying on it. John Bollinger [EMAIL PROTECTED] == 2 of 3 == Date: Mon, Nov 29 2004 2:03 pm From: Tim Tyler In comp.lang.java.advocacy Steve Sobol <[EMAIL PROTECTED]> wrote or quoted: > Tim Tyler wrote: > > Jean Lutrin <[EMAIL PROTECTED]> wrote or quoted: > >>As I already said, I belong to this very small (and not very > >>vocal) minority that happens to think that Un*x + Java is a > >>wonderfull setup for a developer (most Java developer use Windows > >>and most Un*x users have a grip with Java not being true > >>Open Source Software). > > > > IMO, they have a good point. > > > > The fact that Java is proprietary, commercial software is its > > biggest weakness - in my book. > > You're right. We should all use .NET because it's open source. I made no mention of .NET. The competitors of Java under slightly more liberal licenses are things like Python and PHP. > Come on... yes, technically Java *is* a commercial product, however... > Proprietary? How can you say it's proprietary when the source code is sitting > on the Web downloadable by anyone? Simple: because Java is owned by Sun. For more details, see: http://dictionary.reference.com/search?q=proprietary -- __________ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. == 3 of 3 == Date: Mon, Nov 29 2004 2:11 pm From: Tim Tyler Sudsy <[EMAIL PROTECTED]> wrote or quoted: > Tim Tyler wrote: [Re: most Un*x users have a grip with Java not being true Open Source Software] > > IMO, they have a good point. > > > > The fact that Java is proprietary, commercial software is its > > biggest weakness - in my book. > > > > Nobody in their right mind wants to build their house on land > > owned by someone else. > > Guess what? The government can exercise their right of "eminent domain" > and take your land anyway. So your analogy is either very good or very > bad, depending on your point of view. :-) If you don't trust the government to act in your best interests - you can usually emigrate. Similarly, if you don't trust Sun not to eat up your bottom line - by actions such as charging J2ME licensees fees to implement their specifications - you can always use something other than Java. -- __________ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. ============================================================================== TOPIC: Pulling out duplicates http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c03ef99a3649796b ============================================================================== == 1 of 3 == Date: Mon, Nov 29 2004 12:43 pm From: [EMAIL PROTECTED] (C.Thomson) I have an application in which I have a list of business objects that hold repeating coupon data about mortgage information. Each record contains the following fields: BeginDate,EndDate,Rate,Cap,Floor,DayCount There can be any number of records for each trade. For instance, here is a trade with 3 coupons: 11/05/04 - 07/04/05 Rate:Prime minus 0.5 Cap:8.0% Floor:0.0% DayCount:30/360 07/05/05 - 09/04/06 Rate:3.0% Cap: Floor:0.0% DayCount:30/360 09/05/06 - 11/04/08 Rate:4.0% Cap: Floor:0.0% DayCount:30/360 I have a coupon object with getters/setters for each field listed. I have an ArrayList that stores that coupon data. What I am trying to do is add a new entry that holds the repeating data that does not change over the life of the trade. From the example above, the added object would hold: 11/05/04 - 11/04/08 Floor:0.0% DayCount:30/360 I have a method of doing this by iterating over the list and comparing each field and saving duplicates to a new object. I am just wondering if there is an easier/more sophisticated way of doing this. Thanks. == 2 of 3 == Date: Mon, Nov 29 2004 8:54 pm From: "Ann" "C.Thomson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have an application in which I have a list of business objects that > hold repeating coupon data about mortgage information. Each record > contains the following fields: > BeginDate,EndDate,Rate,Cap,Floor,DayCount > > There can be any number of records for each trade. For instance, here > is a trade with 3 coupons: > > 11/05/04 - 07/04/05 Rate:Prime minus 0.5 > Cap:8.0% > Floor:0.0% > DayCount:30/360 > 07/05/05 - 09/04/06 Rate:3.0% > Cap: > Floor:0.0% > DayCount:30/360 > 09/05/06 - 11/04/08 Rate:4.0% > Cap: > Floor:0.0% > DayCount:30/360 > > I have a coupon object with getters/setters for each field listed. I > have an ArrayList that stores that coupon data. What I am trying to > do is add a new entry that holds the repeating data that does not > change over the life of the trade. From the example above, the added > object would hold: > 11/05/04 - 11/04/08 Floor:0.0% > DayCount:30/360 > > I have a method of doing this by iterating over the list and comparing > each field and saving duplicates to a new object. I am just wondering > if there is an easier/more sophisticated way of doing this. > > Thanks. Ah, the business equivalent of homework. You should implement as you state above, then you can get more credit (ass kissing points) later for REFACTORing it !!! == 3 of 3 == Date: Mon, Nov 29 2004 9:10 pm From: "xarax" "C.Thomson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have an application in which I have a list of business objects that > hold repeating coupon data about mortgage information. Each record > contains the following fields: > BeginDate,EndDate,Rate,Cap,Floor,DayCount > > There can be any number of records for each trade. For instance, here > is a trade with 3 coupons: > > 11/05/04 - 07/04/05 Rate:Prime minus 0.5 > Cap:8.0% > Floor:0.0% > DayCount:30/360 > 07/05/05 - 09/04/06 Rate:3.0% > Cap: > Floor:0.0% > DayCount:30/360 > 09/05/06 - 11/04/08 Rate:4.0% > Cap: > Floor:0.0% > DayCount:30/360 > > I have a coupon object with getters/setters for each field listed. I > have an ArrayList that stores that coupon data. What I am trying to > do is add a new entry that holds the repeating data that does not > change over the life of the trade. Is the new entry a different class? Hmm...probably, since it represents a summary of the activity... > From the example above, the added > object would hold: > 11/05/04 - 11/04/08 Floor:0.0% > DayCount:30/360 > > I have a method of doing this by iterating over the list and comparing > each field and saving duplicates to a new object. I am just wondering > if there is an easier/more sophisticated way of doing this. You could also try extracting the instances into an array using the toArray method. Then use a Comparator object to sort the array (by calling Arrays.sort(Object[],Comparator)). Duplicate entries will be adjacent in the array. Define multiple comparators to sort on the various fields as needed. -- ---------------------------- Jeffrey D. Smith Farsight Systems Corporation 24 BURLINGTON DRIVE LONGMONT, CO 80501-6906 http://www.farsight-systems.com z/Debug debugs your Systems/C programs running on IBM z/OS for FREE! ============================================================================== TOPIC: Library program http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/254a609c3ab1892e ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 9:29 pm From: "Krzysiek K." Does sombody know some fine websites, where I can find a program writed in java language ,to serve lending library of movies(and the like). Thank you for any info. Krzysiek K. ============================================================================== TOPIC: sampling algoritm based on indexed constrains http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/76acd64d8a48b4ca ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 3:56 pm From: Albretch I know this might not exactly be a question to this newsgroup, but, again, I don't know how to solve this type of problems. I need to understand it well, because I see myself using this a lot I have been thinking about an implementation of a sampling algorithm that would conditionally constrain selections preferably in Java (ANSI C/C++ are fine, too). Say, you have a number of items you may conditionally select. Cases would be: 1._ you may select any and any number of them, 2._ you may select any, but only a given number of them, say 1, 2 or 3 3._ you either select the first or second and any other one, 4._ you may select any as long as the total of certain weight remains in a range 5._ you -must- select all . . . As you can see it is not only about the items themselves but there are also aggregations involved. It would pretty much be like an indexing of possible WHERE clauses in SQL. I could imagine other people have stumbled on these kinds of problems before. I have been thinking about implementing a solution to the problem based on the "language (or grammar how is it called?) pattern" using the knapsack algorithm to try keep things tidy. I did search and could not find anything similar to what I was looking for. Maybe you know of something like this or can avail me of some leads in the right direction. ============================================================================== TOPIC: Reproducing du/ls in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3b6930f360088c78 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 12:11 pm From: [EMAIL PROTECTED] (Oreo) Sudsy <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Oreo wrote: > <snip> > > When compared to the output of ls, the File.length() method will not > > return the proper length of directories (whether on a FAT or reiserfs > > file system) or a symbolic link in UNIX. The length of a UNIX > > directory is not zero, and the size of symbolic link is the length of > > the filename that it points to. > > WRONG! Take a look at this output from a Linux system: > $ ls -l /bin/sh > lrwxrwxrwx 1 root root 4 Oct 26 13:43 /bin/sh -> bash > > That's showing a file size of 4 bytes. It's most empatically NOT > the size of /bin/bash. > As for the correct size of directories, I tested out the following > very simple code and it returned the same value as what ls returned > (not surprising, as it's just mapping to a stat(2) system call > under the covers), namely 5120 bytes. > > import java.io.*; > > public class DirUsage { > public static void main( String args[] ) { > File f = new File( "." ); > System.out.println( "Size = " + f.length() ); > } > } I am computing the size of the symbolic link itself, not the file it points to. ============================================================================== TOPIC: How to suppress final 0 with DecimalFormat? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c25b4efdb9f3c1f3 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 8:51 pm From: "Virgil Green" "Adam Lipscombe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Folks, > > I need to output a blank if a double is 0.0; > > If I use DecimalFormat to format a zero double I get a single "0" output. > i.e. > > double d = 0.0; > DecimalFormat dF = new DecimalFormat("#.##"); > System.out.println(dF.format(d)); > > gives "0". > > > How do I get rid of the zero? System.out.println(d == 0 ? "" : dF.format(d)); - Virgil ============================================================================== TOPIC: struts - opening new sized window http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5323c441b16e075b ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 12:33 pm From: "Raycaster" Using Struts, I have a form displayed for a user to edit values. Now next to a text area, I have a label which is a link that opens a new window that displays a grid of available values for the text box. The user clicks on a value and the popup window closes and fills in the parent window with the selected value. This all works fine, but I want to do is open the popup window with a specific size ( using javascript, you specify the width and height ). I am lost at how to do this. Perhaps I am even doing this the wrong way, but I am not sure how else to do this. I am hoping someone has some advice on this. Here is how I do it: On the edit form, I have the following link: <a href="chainLookupAction.do" target="Chain">Chain Lookup</a> As you can see I use the target parameter to open the popup in a new browser. The chainLookupAction.do action retrieves the data from the database and sends the List to the new jsp. To compensate for this, I have this in the popup window: <script> self.resizeTo(400,600); </script> The only problem I have in all this, is the popup window opens up, but it opens up full screen and then resizes to the correct size. The resize of the window can be quite annoying to the user and so I was trying to get the new window to open without resizing, I want it to open already resized. Anyway, I hope this makes sense. I appreciate any help. Thanks. ============================================================================== TOPIC: Problems installing Cocoon 2.1.5.1 on BEA Weblogic 8.1sp2 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/39613b581cb88602 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 1:30 pm From: [EMAIL PROTECTED] (Per-Christian Engdal) Hi, I have built a cocoon.war file, and deployed it on my BEA Weblogic 8.1 Sp2 (Windows 2000) installation. The deployment works without exceptions, but when I try to access cocoon through http://localhost:80/cocoon I get the following error message (stack trace): java.lang.NoClassDefFoundError: org/apache/log/Logger at org.apache.avalon.framework.logger.LogKitLogger.isWarnEnabled(LogKitLogger.java:122) at org.apache.cocoon.servlet.CocoonServlet.initLogger(CocoonServlet.java:797) at org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:306) at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:993) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:869) at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:848) at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:787) at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:518) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:362) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) I have added xercesImpl-2.6.2.jar and xml-apis.jar to the weblogic server CLASSPATH. I have also checked the cocoon.war file to see if the loggerkit-1.2.2.jar is included - it is! Is there anybody with an idea about how to fix this ? Regards, Per-Christian Engdal ============================================================================== TOPIC: help needed with jvmti and jni http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b93fb091b999b19 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 1:44 pm From: Svetozar Misljencevic Hi, I have few questions about jvmti and jni. Searching in other forums and newsgroup was without any success so i hope someone here can help. 1. I am using MethodEntry and MethodExit events from jvmti. That way my c++ code can log certain method calls and returns. Method' s name, class, thread and some other information is being logged to a file. To increase the performance jmethodID object and its jclass are being cached, so amount of called jvmti function is reduced by looking in the cache. However, there are 2 problems with cache: -All references passed to c++ code are local. In order to use them again i have converted jclass local references to global references. This seemed like a good idea but has one major drawback: in order to compare local jclass reference (which i get by calling GetMethodDeclaringClass(..) on received jmethodID object) with cached global reference jni function IsSameObject(...)is called multiple times. This is against the whole idea of cache being used to decrease amount of jni/jvmti function calls. Is there a way to compare global references with local one without performance penalty? -Beside jclass references I also cache jmethodId that is received as parameter when MethodEntry is called by jvm. On each call different jmethoid object is received even if it points to same method. Here its not possible to make jmethodId object global because it's not a reference. According to following quote there is however a solution to above 2 problems. Quote from http://java.sun.com/docs/books/tutorial/native1.1/implementing/method.html : “It is important to keep in mind that a method ID is valid only for as long as the class from which it is derived is not unloaded. Once the class is unloaded, the method ID becomes invalid. As a result, if you want to cache the method ID, be sure to keep a live reference to the Java class from which the method ID is derived. As long as the reference to the Java class (the jclass value) exists, the native code keeps a live reference to the class.” The thing is that above solution doesn't seem to work. I keep global reference to jclass in mine cache so it shouldn't unload. According to above quote that means that same method always gets same methodId. That is however not true, different methodIds are received. I would appreciate if anyone can help in any way. thx, Svetozar ============================================================================== TOPIC: Buy Programming Books http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3c112df683c25da9 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 2:23 pm From: Rich QubitCode.com Offering programming books related to: C++ C# Java Javascript HTML Perl and much more... Check it out for great deals! http://www.qubitcode.com/ ============================================================================== TOPIC: newbie question - how to download a J2ME based game from PC to a cell phone http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/30b360d4d1e873e3 ============================================================================== == 1 of 2 == Date: Mon, Nov 29 2004 2:53 pm From: [EMAIL PROTECTED] (Bill Davidson) References: ----------- Windows XP J2ME WTK 2.1 Motorola T720 cell phone Hello: I have few games on my PC (running Windows XP) that have been developed using Sun's J2ME Wireless Toolkit 2.1. I would like to download them on to my Motorola t720 cell phone. Is that possible ? If yes, how do I do that. Also, once downloaded, is it possible to delete any game from the phone ? Also, any pointers on how to setup mobile apps on an internet site and the way to download them on a cell phone would be appreciated. Bill == 2 of 2 == Date: Mon, Nov 29 2004 3:58 pm From: Steve Sobol Bill Davidson wrote: > Hello: > > I have few games on my PC (running Windows XP) that have been developed > using Sun's J2ME Wireless Toolkit 2.1. I would like to download them on to > my Motorola t720 cell phone. Is that possible ? If yes, how do I do that. Make sure the carrier supports J2ME. Some US carriers -- Alltel and Verizon for sure, and perhaps US Cellular - don't use J2ME for their apps, they use Qualcomm Binary Runtime Environment for Wireless (BREW); BREW apps are coded in C (and BREW carriers typically don't allow users to just download anything to their phones either; at least, VZW doesn't) -- JustThe.net Internet & New Media Services, http://JustThe.net/ Steven J. Sobol, Geek In Charge / 888.480.4NET (4638) / [EMAIL PROTECTED] PGP Key available from your friendly local key server (0xE3AE35ED) Apple Valley, California Nothing scares me anymore. I have three kids. ============================================================================== TOPIC: tooltip on graphics http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/421f42620349a105 ============================================================================== == 1 of 2 == Date: Mon, Nov 29 2004 3:10 pm From: [EMAIL PROTECTED] (nigel) I have realised a graphic with several squares. Is it possible to add a tooltip for each squares. Thanks Nigel == 2 of 2 == Date: Mon, Nov 29 2004 4:08 pm From: "Andrei Kouznetsov" >I have realised a graphic with several squares. Is it possible to add > a tooltip for each squares. yes see JComponent#getToolTipText(MouseEvent event); -- Andrei Kouznetsov http://uio.dev.java.net Unified I/O for Java http://reader.imagero.com Java image reader http://jgui.imagero.com Java GUI components and utilities ============================================================================== TOPIC: how to resize a array? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5ed97c9d7b81add ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 4:20 pm From: Dimitri Maziuk Oscar kind sez: > Dimitri Maziuk <[EMAIL PROTECTED]> wrote: >> You do know that a) ArrayList does the very same array copy, >> b) comes with an extra dozen bytes overhead for each member >> and c) casts all its memebers to Object, right? > > Yes. More to the point, does OP know that. > However, I often find this not to be a big issue, because: [ snipped ] <sigh/> Some people have all the luck... We get to work with (multiple) 10000+ row data sets where each row consists of at least a couple of short strings and a couple of floats. So far the only implementation that is neither "unacceptably slow" nor "we don't have funds to add an extra 2GB of RAM to all our workstations right now" bloated is the one with hand-coded arrays of primitive types. Column-wise. Dima -- Backwards compatibility is either a pun or an oxymoron. -- PGN ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
