comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * How do I add an Integer to another Integer? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/68d9b2c22745c2d4 * J2ME, HttpConnection and Proxy - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2aeb16a7cfaabb05 * Java ME i SMS - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/af6fb56fb32836b2 * license question? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7680dfef2acffd6 * newbie: err in ora book? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aa5564fb0068a14e * OT: game programmer SALARY - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/87940bc0e58ea09 * Repost: Print Problem - help! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f33374d643ec932a * Am I the only one who questions JSTL, Struts Tags, XSL Tags? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48683f1f07068c7d * Weather API - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/518f5645aa83f10c * Need help w. Image Servlet. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1bd066386cd1860 * Find all implementing classes in classpath? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/db894e13020738bd * Division by zero: float vs. int - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6dc583f6638fa877 * jni and threads - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d4d0082f9855051 * event listener requesting a thread - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f83c0f196a946f8f * dangling reference - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/debe4c18ace23d77 ========================================================================== TOPIC: How do I add an Integer to another Integer? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/68d9b2c22745c2d4 ========================================================================== == 1 of 1 == Date: Fri, Oct 15 2004 7:59 pm From: "George W. Cherry" <[EMAIL PROTECTED]> "John Davison" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jeffrey Spoon wrote: > >> Anyway you're not adding ints there, you're trying to "add" two >> references to Integer objects. >> >> AFAIK + either concatenates references using toString() or adds >> primitives mathematically. To do the latter get the primitive int value: >> >> iTmp3 = String.valueOf(iTmp1.intValue() + iTmp2.intValue()); >> >> The Integer Objects is like a wrapper for a primitive int, it isn't an >> int itself so you can't just add two Integer Objects together. > > Unless you are using 1.5 in which case autoboxing would allow this. Errr. Auto-UNboxing. : o ) > public class test { > public static void main(String[] args) { > Integer i = new Integer(2); > Integer o = new Integer(2); > System.out.println(i + o); > } > } > > John Davison > Compass Engineering Group ========================================================================== TOPIC: J2ME, HttpConnection and Proxy http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2aeb16a7cfaabb05 ========================================================================== == 1 of 2 == Date: Fri, Oct 15 2004 7:36 pm From: "Darryl L. Pierce" <[EMAIL PROTECTED]> Marko wrote: > But I'm afraid that I'm still getting the same error from the MIDlet: > "proxy cannot initialize HTTP tunnel connection". That's a problem outside of the scope of the device. But, you're having this problem on the emulator and not one a device, right?? > try { > s = c.openDataInputStream(); Try, before this line, doing: int rc = c.getResponseCode(); String rm = c.getResponseMessage(); and see what happens. > I've event tried fooling around with J2ME Toolkit's Preferences. I've > typed in different (wrong) proxy port numbers. The result is I had one > java/io/IOException and HTTPConnection wasn't established. Then I've > typed in the Preferences the address of the Web server itself and port > 80 (port of the HTTP protocol) and still no budge. Is your proxy trying to force you into an HTTPS connection? There's no reason for a ClassNotFoundException unless the proxy's doing a redirect and it's trying to force a protocol other than HTTP down on the handset. > > I'd like to reiterate that I can establish HTTP connections in Visual > Studio .NET, Visual Basic, ANSI C++ using standard libraries in the > same (network) environment I'm trying to use MIDlet and Sun's J2ME > emulator. MIDlet can't establish HTTP connection throught a proxy, > while other technologies can. It's not the MIDlet, it's the emulator. MIDlet's depend on their environment to handle negotiating through firewalls and proxies. -- /** * @author Darryl L. Pierce <[EMAIL PROTECTED]> * @see The Infobahn Offramp <http://mcpierce.multiply.com> * @quote "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk */ == 2 of 2 == Date: Fri, Oct 15 2004 7:37 pm From: "Darryl L. Pierce" <[EMAIL PROTECTED]> Bruno Grieder wrote: <snip good points about proxy server voodoo> > To declare the proxy, do this (that always works): > > System.setProperty("http.proxyHost","my.proxy.com"); > System.setProperty("http.proxyPort","proxyport"); You can't do this in MIDP. They will either cause RuntimeErrors to be thrown, or they'll just be ignored by the system. > Replace http with https for an HTTPS connection. MIDP 1.0 does not support HTTPS. That would cause a ClassNotFoundException or else a protocol exception to get through. -- /** * @author Darryl L. Pierce <[EMAIL PROTECTED]> * @see The Infobahn Offramp <http://mcpierce.multiply.com> * @quote "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk */ ========================================================================== TOPIC: Java ME i SMS http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/af6fb56fb32836b2 ========================================================================== == 1 of 1 == Date: Fri, Oct 15 2004 7:31 pm From: "Darryl L. Pierce" <[EMAIL PROTECTED]> MZ wrote: > What happens when I receive SMS while running java app on a mobile phone > (for example using WMA)? Will it be also stored in phone's messages > inbox?. Furthermore, is it possible to acces that inbox from java app, for > example to read that messages? No, you can only read SMS messages sent to a port on which you were registered previously as the listener. You cannot access the SMS inbox of the device. -- /** * @author Darryl L. Pierce <[EMAIL PROTECTED]> * @see The Infobahn Offramp <http://mcpierce.multiply.com> * @quote "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk */ ========================================================================== TOPIC: license question? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7680dfef2acffd6 ========================================================================== == 1 of 2 == Date: Fri, Oct 15 2004 8:19 pm From: Todd Knarr <[EMAIL PROTECTED]> In comp.os.linux.misc <[EMAIL PROTECTED]> Peter <[EMAIL PROTECTED]> wrote: > Oh shit, i don't think Buffalo's product is open source. FSF should > bring them to the court. IIRC the start of that was what happened. The offending parties decided they didn't want to push it, hence why on Linksys' site you can download the complete source code and build scripts for the firmware for their products (except for the binary-only modules for the Broadcom network chips, which were written in compliance with the Linux kernel's rules for binary-only loadable kernel modules). -- All I want out of the Universe is 10 minutes with the source code and a quick recompile. -- unknown == 2 of 2 == Date: Sat, Oct 16 2004 2:09 am From: justaguy <[EMAIL PROTECTED]> [EMAIL PROTECTED] wrote: > The use of GPL'd code sure comes with a heavy price. As opposed to the price of other copyrighted code? ========================================================================== TOPIC: newbie: err in ora book? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aa5564fb0068a14e ========================================================================== == 1 of 1 == Date: Fri, Oct 15 2004 7:45 pm From: "andreas kinell" <[EMAIL PROTECTED]> > hi, > it is probably me but i copied the example from the tiger book and i get > an error. would be nice if you copied the example to the newsgroup too, i won't buy the book just to help you... > +++++++++++++++++++++++++++++++ > page 48 june 2002 tiger book > > javac HelloJava3.java > HelloJava3.java:40: addActionListener(java.awt.event.ActionListener) in > javax.swing.AbstractButton cannot be applied to (HelloComponent3) > theButton.addActionListener( this); > ^ > > > ++++++++++++++++++++++++++++++++++++++++++ > i can only assume that "this" refers to your class extending AbstractButton instead of refering to the ActionListener. i further assume that theButton.addActionListener(this) was a line of code in an inner class implementing ActionListener but now is not anymore, therefore doesn't work anymore. replace "this" with the desired instance of your class implementing ActionListener. this class cannot be anonymous anymore. again, since i don't see any code, i could be completly wrong, it is mere guessing. andreas ========================================================================== TOPIC: OT: game programmer SALARY http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/87940bc0e58ea09 ========================================================================== == 1 of 1 == Date: Fri, Oct 15 2004 10:57 pm From: [EMAIL PROTECTED] (Signal9) Raghar <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > [EMAIL PROTECTED] (Bo) wrote in > news:[EMAIL PROTECTED]: > > > Hi > > > > I will discuss job offer with a game company soon. Please post > > how much I should bargain for. > > You shouldn't if is it your first job. (Of course if you are > dealing with people that would like to have a new house... And your > low sallary would add a little money for that...) > > > > > -job title: port engineer (j2me, Brew phone games) > > -at San Francisco > > > > Me: > > -fresh out of college > > -I think they hired me because I made an impressive 3D engine in > > Java. But because '3d engine programmer' pays more than people > > who ports, they will still offer the job to me as a port > > engineer. -If there is info on '3d engine programmer' for phones > > please provide it. > > > > thnx! > > They should teach you write sentences more gently. It looks like > letter from 16 year old baseball player. > > Of course if they would pay you enough for food, rent, and a little > savings, it would be nice. Well do not be too upset but game developers make the least amount of money in the industry. But I will tell you one important fact.... Do what you enjoy ! if you want to be a game developer then do so ! do not get hung up on the money right away... I also did game development in school, wrote a DX9 game engine in C++ (took around 3 months to learn DX9 API and then write the engine, with sound and other components), but when i finished school I decided it was better to write enterprise level business applications. ========================================================================== TOPIC: Repost: Print Problem - help! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f33374d643ec932a ========================================================================== == 1 of 1 == Date: Fri, Oct 15 2004 11:28 pm From: Babu Kalakrishnan <[EMAIL PROTECTED]> Ralph Curtis wrote: > I didn't get any answers on my initial post about this problem so I am > trying > again. > > Why doesn't Java return correct fractional font sizes with > Font.getStringBounds?? > The return value is a double but I never see a fractional value. > > Is there ANYONE who can shed some light on this problem? > Did you set the usesFractionalMetrics parameter of the FontRenderContext to true ? On my system (JDK 1.4.2_05 / Linux) I seem to be getting fractional sizes when I set that flag to true. import java.awt.Font; import java.awt.font.FontRenderContext; public class WidthTest { public static void main(String[] args) { Font f = new Font("Dialog",Font.PLAIN,12); FontRenderContext frc1 = new FontRenderContext(null,false,false); //frc1 has useFractionalMetrics = false FontRenderContext frc2 = new FontRenderContext(null,false,true); //and frc2 has useFractionalMetrics = true String s = "Hello World"; System.out.println(f.getStringBounds(s,frc1)); System.out.println(f.getStringBounds(s,frc2)); } } Results : java.awt.geom.Rectangle2D$Float[x=0.0,y=-11.402344,w=66.0,h=13.962891] java.awt.geom.Rectangle2D$Float[x=0.0,y=-11.402344,w=67.177734,h=13.962891] ^^^^^^^^^^^ BK ========================================================================== TOPIC: Am I the only one who questions JSTL, Struts Tags, XSL Tags? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48683f1f07068c7d ========================================================================== == 1 of 1 == Date: Fri, Oct 15 2004 11:45 pm From: [EMAIL PROTECTED] (Greg Smith) > Am I alone in this? It surely does seem that i am alone. and i'm taking heat for it at the office. but let me offer this question to you, how do you execute a logical OR in struts taglib? Say, if x is empty or y is empty? i came up with <logic:empty name="x"> do something </logic:empty> <logic:notEmpty name="x"> <logic:empty name="y"> do something (the same as above) </logic:empty> </logic:notEmpty> i dont think this is as elegant a solution as <% if (x.size()==0 || y.size()==0) { %> do something <%}%> especially when in the struts example we have to copy the <do something> code twice. alternatively, if you are mixing JSTL and XSL how do you say <x:if> OR <c:if> in taglib language? The following resolves to logical AND: <x:if condition> <c:if condition> do something </c:if> </x:if> i'm willing to expose my ignorance on this one. in general i find that the control structures offered by taglibs are less capable than what we have in java. is there anyone who can answer the puzzle i've posed in a more succinct manner, using taglib language? ========================================================================== TOPIC: Weather API http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/518f5645aa83f10c ========================================================================== == 1 of 1 == Date: Fri, Oct 15 2004 11:46 pm From: Bodo Tasche <[EMAIL PROTECTED]> Hi! I am searching a small free Libray that parses the Data from Weather.com as shown in http://www.xml.com/pub/a/2004/09/29/weather.html . I only found a commercial solution. If no GPL'ed/BSD'ed Library exists, I will create one...hope I could save the time and code something "more" usefull ;) Bodo ========================================================================== TOPIC: Need help w. Image Servlet. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1bd066386cd1860 ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 12:02 am From: Oscar kind <[EMAIL PROTECTED]> Steve Burrus <[EMAIL PROTECTED]> wrote: > I need some degree of help/assistance with trying to see an image in a > servlet! I am trying to use the double method of > "getServletContext().getRealPath()" to do this! But I seem to always get > the compiler error msg. pointing to that "getRealPath()" method. I have > tried every which way to get it right with the path, I guess an absolute > path to the image resource that it wants as the method argument, right? > I can submit my code for this servlet, if someone wants to see it. Where is the image stored? The easiest way is the classpath, as you can then use Class#getResource(String) and Class#getResourceAsStream(String). -- 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: Find all implementing classes in classpath? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/db894e13020738bd ========================================================================== == 1 of 3 == Date: Sat, Oct 16 2004 12:21 am From: Martha Goys <[EMAIL PROTECTED]> Sorry if this is a "Classloader 101"-type question, but is there a way to programatically find all classes (in the current classpath) that implement an interface? I.e. I'm looking for some way to perform the following: public Class[] getImplementingClasses(Class someInterface) { ... } or alternately: public Class[] getSubclasses(Class someClass) { ... } Make sense? Is this possible? Many thanks, M == 2 of 3 == Date: Sat, Oct 16 2004 1:14 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> Martha Goys <[EMAIL PROTECTED]> writes: > Sorry if this is a "Classloader 101"-type question, but is there a way > to programatically find all classes (in the current classpath) that > implement an interface? Short answer: No. Longer answer: A ClassLoader does not give out details about its implementation. Also, ClassLoaders work passively: They are requested to load a specific class, and tries to find it. J2SE has AFAIK two ClassLoader implementations it uses, the URLClassLoader (for instance used by applets) and the one that uses the classpath. For the latter, you could split up System.getProperty("java.class.path"), and analyze the components as either archives or directories. Then traverse the sub-entries (using java.io.File and the mechanisms of the java.util.zip package), looking for resources ending in ".class". == 3 of 3 == Date: Sat, Oct 16 2004 1:16 am From: Andrew Thompson <[EMAIL PROTECTED]> On Sat, 16 Oct 2004 00:21:51 -0700, Martha Goys wrote: > Sorry if this is a "Classloader 101"-type question, but is there a way > to programatically find all classes (in the current classpath) No. >..that implement an interface? Yes. There is no way to find all the classes on the current classpath, but if you have a list of classes it is possible to determine if any implement a particular interface. Why do you feel you need to do this? What is the end result you wish to achieve? -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.lensescapes.com/ Images that escape the mundane ========================================================================== TOPIC: Division by zero: float vs. int http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6dc583f6638fa877 ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 1:06 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> "Thomas G. Marshall" <[EMAIL PROTECTED]> writes: > "equals()" is about whatever version of equivalence the author > intended it to be, mathematical or otherwise. No, it is about conforming to the "contract" specified by Object.equals(). And the docs for it states: "It is reflexive: for any non-null reference value x, x.equals(x) should return true." If Java had support for pre- and postconditions, this would be easier to enforce. As it stands, only the Javadocs indicate the contract. So unless you want to claim that new Double(Double.NaN) should be treated like null, they will be equal. ========================================================================== TOPIC: jni and threads http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d4d0082f9855051 ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 1:06 am From: Gordon Beaton <[EMAIL PROTECTED]> [ Followup set ] On Fri, 15 Oct 2004 15:16:09 -0400, Thomas Smith wrote: > I am building a binding to a runtime engine that was written in C++. > I have no problems setting up the mapping from object calls to the > native implementation, and storing reference to those objects. The > problem comes when I start a new thread... The new thread does not > have access to the same memory, and I end up with a pointer to dead > space. Please don't multipost. Two important things to keep in mind: - the JNIEnv* pointer is only valid in the thread for which it was created. Whenever you make normal calls from Java to C, you get a new, valid JNIEnv*. Don't attempt to store the pointer for use in any other context. If you have created threads in the native code and need to use JNI functions, use JNI_GetCreatedJavaVMs() and AttachCurrentThread() to get a valid JNIEnv* for each thread that needs one. - when you store object references that will live across multiple native calls, it is important to only store _global_ references created with NewGlobalRef(). The JVM doesn't know what your native variables contain, only what gets passed in and out of your native code. When you return from a native call, the JVM releases any local references you held during the call, so there is a risk that such objects will become eligible for garbage collection unless you create global references. Don't forget to delete any global references when you're done with them or they will never become eligible for garbage collection. /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 ========================================================================== TOPIC: event listener requesting a thread http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f83c0f196a946f8f ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 2:10 am From: "Thomas Smith" <[EMAIL PROTECTED]> sure... how about: new Thread(){public void run(){<<LENGTHY OPERATION>>}}.start(); -- Thomas W. Smith Senior Engineer "Shrish" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello All, > > I need to perform some lengthy operation as the result of an event by > a swing component and I want to send a request to another thread to > perform the operation. Can someone give me an idea how I can achieve > it. > > Thanks, > Shrish ========================================================================== TOPIC: dangling reference http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/debe4c18ace23d77 ========================================================================== == 1 of 2 == Date: Sat, Oct 16 2004 2:16 am From: [EMAIL PROTECTED] (Hans Van den Eynden) Why is this working?? I wanted to do some experiment in Java about dangling references. But why is this working?? Why is b1!=null?? public class Main { public static void main(String[] args) { Bus b1 = new Bus(), b2; // b2=b1; verwijderBus(b1); System.out.println(b1+""); System.out.println(b1.i+""); } static void verwijderBus(Bus b){ b.i=5; b=null; //System.gc(); } } == 2 of 2 == Date: Sat, Oct 16 2004 2:20 am From: Joona I Palaste <[EMAIL PROTECTED]> Hans Van den Eynden <[EMAIL PROTECTED]> scribbled the following: > Why is this working?? I wanted to do some experiment in Java about > dangling references. But why is this working?? Why is b1!=null?? Because Java doesn't pass by reference, it passes references by value. The variable b1 in main() and the variable b in verwijderBus() don't have anything to do with each other, they simply refer to the same object. Assigning b to refer to some other object (or assigning it to null) does not affect what b1 refers to. > public class Main { > public static void main(String[] args) { > Bus b1 = new Bus(), b2; > // b2=b1; > verwijderBus(b1); > System.out.println(b1+""); > System.out.println(b1.i+""); > } > static void verwijderBus(Bus b){ > b.i=5; > b=null; > //System.gc(); > } > } -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-------------------------------------------------------- rules! --------/ "You will be given the plague." - Montgomery Burns ======================================================================= 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
