comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Examples of thin swing client with middle tier interacting with a DB? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/26179b029bff53a1 * Preventing multiple instance standalone desktop gui applications - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afa857e018f3780 * Using BigInteger - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7be97102e1c754 * Good idea or full of it? - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ceda7465055571c * Doew anyone know th Initial Context properties for JMS? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9cb2a34d249fc2d0 * Need a method to see how much memory is used/available on a system (f.ex. a pc). - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f195b8ef8e6afbd4 * Encryption & Decryption - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4166e73ab1e528d9 * Linux / iPlanet / BEA Setup ???? - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/186c331a0009c603 * Java API source code? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f49b6100e91cd2fa * Tutorial/Help on programming Genetic Algroithms in Java/C++ - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d70b46d726e33955 * Unable to load an XML for jaxb-ing - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f41e63b5fdd7c0cc * code optmization - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b784382e7cbb306 * java.net - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca584de725d23003 * read binary data from C file??? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c04d04f749f5ae1f * Extension problem Mac OS X (launching of external jar doesn't work) - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3dd4b342d0c112d6 * what u program? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410 * jboss/mysql cmp deadlock? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8b6b1527949264ca * howto session bean w/ XDoclet - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d43139a7c8b544c * writeObject and readObject problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e6fc9480a3a7f42a * Can I force garbage collection? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/62be19cef0da9817 * version -> speed? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a63fd0f945fa2e4f ========================================================================== TOPIC: Examples of thin swing client with middle tier interacting with a DB? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/26179b029bff53a1 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 1:14 pm From: Abrasive Sponge <[EMAIL PROTECTED]> keith edward wrote: > Hello, > > Does anyone have a "hello world" examples (URL's) of a thin swing > client with a middle tier interacting with a DB? > > Thanks, > Keith What is in the middle tier? A J2EE server? A web container? ========================================================================== TOPIC: Preventing multiple instance standalone desktop gui applications http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afa857e018f3780 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 1:15 pm From: "Steve W. Jackson" <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, Paul Lutus <[EMAIL PROTECTED]> wrote: >:Kent Yang wrote: >: >:> I need to have only one instance of a Desktop GUI application running. >:> What is the best way to do this? The only answer I can find >:> searching throught the archives was to use a socket. Is this the best >:> way? >: >:That depends. I often use a flag file. This has the advantage that, in a >:multi-user environment, each user has a separate flag file, so each user >:can only have one instance running, but there can be as many single >:instances as there are users. >: >:I put the flag file in the user's home directory under a subdirectory with >:the same name as the application, a scheme that has been worked out in >:Linux/Unix environments over time, and one that works fine in Windows as >:well. I've used a similar technique, though i call it a lock file. In fact, I go further and apply a FileLock on the file, which I hold until I'm ready to shut down. If the lock attempt fails, it's because the file is locked by another instance. If it succeeds, than any pre-existing file could've been left behind by a crashed instance of my app (rare though that is). It works well for me, with the odd caveat that I can actually remove the file manually on Linux while the app is running to bypass this restriction. = Steve = -- Steve W. Jackson Montgomery, Alabama ========================================================================== TOPIC: Using BigInteger http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7be97102e1c754 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 1:14 pm From: Tim Slattery <[EMAIL PROTECTED]> Eric Sosman <[EMAIL PROTECTED]> wrote: >> BigInteger bi1 = new BigInteger(5); > > Where did you find that constructor? ITYM either > > BigInteger bi1 = new BigInteger("5"); >or > BigInteger bi1 = BigInteger.valueOf(5); Guilty as charged. You have to supply a string, there's no BigInteger constructor that takes an integer. -- Tim Slattery [EMAIL PROTECTED] ========================================================================== TOPIC: Good idea or full of it? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ceda7465055571c ========================================================================== == 1 of 4 == Date: Thurs, Sep 23 2004 1:26 pm From: John Davison <[EMAIL PROTECTED]> Abrasive Sponge wrote: > public class Person { > private String firstName; > private static int count; > > > public void setFirstName(String firstName) { > this.firstName = firstName; > } > > public String getFirstName() { > return firstName; > } > > public static setCount(int count) { > static.count = count; //using a static keyword as such > } > > public static int getCount() { > return static.count; //using a static keyword as such > } > } > > I was wondering if the java language can use something > like this....maybe there is something that I don't know, but having a > static reference like this would kick butt. > Do you mean this? public static setCount(int count) { Person.count = count; } public static int getCount() { return Person.count; } Now, go kick some butt! ;) - john == 2 of 4 == Date: Thurs, Sep 23 2004 2:03 pm From: Abrasive Sponge <[EMAIL PROTECTED]> John Davison wrote: > Abrasive Sponge wrote: > >> public class Person { >> private String firstName; >> private static int count; >> >> >> public void setFirstName(String firstName) { >> this.firstName = firstName; >> } >> >> public String getFirstName() { >> return firstName; >> } >> >> public static setCount(int count) { >> static.count = count; //using a static keyword as such >> } >> public static int getCount() { >> return static.count; //using a static keyword as such >> } >> } >> >> I was wondering if the java language can use something >> like this....maybe there is something that I don't know, but having a >> static reference like this would kick butt. >> > > Do you mean this? > > public static setCount(int count) { > Person.count = count; > } > > public static int getCount() { > return Person.count; > } > > Now, go kick some butt! ;) > > - john Hahaha, I do that already :) It's just a feature unused that makes sense, so I thought why not. :) == 3 of 4 == Date: Thurs, Sep 23 2004 2:06 pm From: Bryce <[EMAIL PROTECTED]> On Thu, 23 Sep 2004 13:48:59 -0600, Abrasive Sponge <[EMAIL PROTECTED]> wrote: >public class Person { > private String firstName; > private static int count; > > > public void setFirstName(String firstName) { > this.firstName = firstName; > } > > public String getFirstName() { > return firstName; > } > > public static setCount(int count) { > static.count = count; //using a static keyword as such > } > > public static int getCount() { > return static.count; //using a static keyword as such > } >} > >I was wondering if the java language can use something >like this....maybe there is something that I don't know, but having a >static reference like this would kick butt. uhhh... Would this do? public class Person { private String firstName; private static int count; public static void setCount(int count) { Person.count = count; } public static int getCount() { return count; } public static void main(String[] args) { Person.setCount(100); System.out.println("getting count [" + Person.getCount() + "]"); } } or am I missing something in your request... -- now with more cowbell == 4 of 4 == Date: Thurs, Sep 23 2004 2:21 pm From: Abrasive Sponge <[EMAIL PROTECTED]> Bryce wrote: > On Thu, 23 Sep 2004 13:48:59 -0600, Abrasive Sponge > <[EMAIL PROTECTED]> wrote: > > >>public class Person { >> private String firstName; >> private static int count; >> >> >> public void setFirstName(String firstName) { >> this.firstName = firstName; >> } >> >> public String getFirstName() { >> return firstName; >> } >> >> public static setCount(int count) { >> static.count = count; //using a static keyword as such >> } >> >> public static int getCount() { >> return static.count; //using a static keyword as such >> } >>} >> >>I was wondering if the java language can use something >>like this....maybe there is something that I don't know, but having a >>static reference like this would kick butt. > > > uhhh... Would this do? > > public class Person { > private String firstName; > private static int count; > > public static void setCount(int count) { > Person.count = count; > } > > public static int getCount() { > return count; > } > > public static void main(String[] args) { > Person.setCount(100); > > System.out.println("getting count [" + > Person.getCount() + "]"); > } > } > > or am I missing something in your request... > > -- > now with more cowbell Yeah, sorry, I am just wondering everybody thinks of that idear is all. ========================================================================== TOPIC: Doew anyone know th Initial Context properties for JMS? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9cb2a34d249fc2d0 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 1:33 pm From: Sudsy <[EMAIL PROTECTED]> Ken Baltrinic wrote: > I am trying to get the following code to work from a session bean running on > AppServer8. When I call new InitialContext(), the context I get pack has no > properties. This leads me to suspect that i need a jndi.properties file > with the correct settings. I suspect the settings I need are > java.naming.factory.initial and java.naming.provider.url but I don't know > what to set them to. I am also not sure exactly where to put the properties > file or how to tell the AppServer where to find it. Can anyone help? It's specific to the app server; you'll have to dig into the documentation to locate the definitive specification. I've used code like this in the past: Context context = null; Properties props = new Properties(); try { // for BEA WebLogic props.put( Context.PROVIDER_URL, "t3://hostname:7001" ); props.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" ); // for IBM WebSphere props.put( Context.PROVIDER_URL, "iiop://hostname" ); props.put( Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory" ); // for both context = new InitialContext( props ); } catch( NamingException e ) { ... } I don't run AppServer8 so I don't know that this is going to be of any use whatsoever... :-( ========================================================================== TOPIC: Need a method to see how much memory is used/available on a system (f.ex. a pc). http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f195b8ef8e6afbd4 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 1:36 pm From: "Steve W. Jackson" <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, "John Keyes" <[EMAIL PROTECTED]> wrote: >:Have a look at java.lang.Runtime >:(http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html) Those methods only tell about what's available or used by the JVM. I don't think there's any way in pure Java to get system-level information of this type, since the details on how to do so are system-dependent. = Steve = -- Steve W. Jackson Montgomery, Alabama ========================================================================== TOPIC: Encryption & Decryption http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4166e73ab1e528d9 ========================================================================== == 1 of 2 == Date: Thurs, Sep 23 2004 1:41 pm From: Sudsy <[EMAIL PROTECTED]> Rogue Chameleon wrote: > Ok... I've managed to generate a KeyPair (public and private) and output > them to seperate files. > > Now, how do I use the public key to encrypt my data.txt and how do I use the > private key to decrypt the data.txt? > I suggest you start here: <http://www-106.ibm.com/developerworks/webservices/library/x-xmlsecuritysuite/index.html> == 2 of 2 == Date: Thurs, Sep 23 2004 3:30 pm From: "Ann" <[EMAIL PROTECTED]> "Rogue Chameleon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all > > I've been asked to look into the encryption and decryption of attachments > sent in emails. The specific scenario is as follows: > > - a file is created > - the file is to be encrypted > - the file is attached to an email and sent to a recipient > - once received, the file should be decrypted > - the file is read > Taking this literally, 1. up to you, can you type? 2. use the unix command "crypt" like this "crypt < myfile > newfile" 3. use any common thing like Outlook Express 4. use the unix command "crypt" (call user and ask for the magic word) 5. up to you, don't forget your glasses > At first glance, I think I should be reading up on the JCA (Java > Cryptography Architecture) and use a public key encrypt and a private key to > decrypt. Is this right? > > Are there any online implementations or tutorials that you would suggest I > read to learn more about this? > > -- > Rogue Chameleon... > > > ========================================================================== TOPIC: Linux / iPlanet / BEA Setup ???? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/186c331a0009c603 ========================================================================== == 1 of 4 == Date: Thurs, Sep 23 2004 2:13 pm From: [EMAIL PROTECTED] (Doug) We need to setup a small development enviroment to support a new project. The client has the following enviroment that we would like to recreate in our lab; Linux / iPlanet / BEA Web Logic Can I buy a simple Intel box (IBM xSeries) with Red Hat and run both iPlanet and BEA Weblogic on it? Looks like BEA will work but I can't seem to find out if I can get iPlanet (now Sun ONE?) and if it will run on an Intel/Red Hat box. Any help is very appreciated. Thanks in advance. Btw, we're in Dallas and would gladly pay someone for their time to help get this all setup. -ds == 2 of 4 == Date: Thurs, Sep 23 2004 2:38 pm From: Sudsy <[EMAIL PROTECTED]> Doug wrote: > We need to setup a small development enviroment to support a new > project. The client has the following enviroment that we would like to > recreate in our lab; > > Linux / iPlanet / BEA Web Logic Does it have to duplicate this configuration? You'd save yourself time and trouble by using WebLogic to serve the static web pages. > Btw, we're in Dallas and would gladly pay someone for their time to > help get this all setup. Setting up WebLogic on Linux is fairly straight-forward. Buy a box, install Linux, provide SSH access using certs and I could connect and perform the installation remotely. == 3 of 4 == Date: Thurs, Sep 23 2004 2:58 pm From: "Will Hartung" <[EMAIL PROTECTED]> "Sudsy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Doug wrote: > > We need to setup a small development enviroment to support a new > > project. The client has the following enviroment that we would like to > > recreate in our lab; > > > > Linux / iPlanet / BEA Web Logic > > Does it have to duplicate this configuration? You'd save yourself > time and trouble by using WebLogic to serve the static web pages. Yea, unless there is a specific requirement to have iPlanet (and by iPlanet I'm assuming the web server part of iPlanet), iPlanet is essentially redundant in this configuration. > > Btw, we're in Dallas and would gladly pay someone for their time to > > help get this all setup. > > Setting up WebLogic on Linux is fairly straight-forward. Buy a box, > install Linux, provide SSH access using certs and I could connect > and perform the installation remotely. Not to steal work from Sudsy, but Weblogic is a pretty painless install to get to a working environment. It's worth an hour of your time if you have it to try it yourself before calling in outside help. You'll probably have more issues with the iPlanet->WLS integration than with WLS itself. Regards, Will Hartung ([EMAIL PROTECTED]) == 4 of 4 == Date: Thurs, Sep 23 2004 3:19 pm From: Sudsy <[EMAIL PROTECTED]> Will Hartung wrote: > "Sudsy" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Doug wrote: >> >>>We need to setup a small development enviroment to support a new >>>project. The client has the following enviroment that we would like to >>>recreate in our lab; >>> >>>Linux / iPlanet / BEA Web Logic >> >>Does it have to duplicate this configuration? You'd save yourself >>time and trouble by using WebLogic to serve the static web pages. > > > Yea, unless there is a specific requirement to have iPlanet (and by iPlanet > I'm assuming the web server part of iPlanet), iPlanet is essentially > redundant in this configuration. <snip> > Not to steal work from Sudsy, but Weblogic is a pretty painless install to > get to a working environment. It's worth an hour of your time if you have it > to try it yourself before calling in outside help. You'll probably have more > issues with the iPlanet->WLS integration than with WLS itself. I got the idea that it was the (no longer available) Web Server myself. For the record, I agree with your suggestion. That's why I noted that installing WebLogic isn't rocket science. Having performed the installation myself on a Linux box, it just might go a bit quicker. That said, there's much understanding to be gained by doing it them- selves. ========================================================================== TOPIC: Java API source code? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f49b6100e91cd2fa ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 2:30 pm From: [EMAIL PROTECTED] (Ken) Hi. Where would I find Java 1.4.2 API source code? It's my understanding that the Java creators applied precondtions, postconditions and invariants to the API classes and their methods. I'd like to take a look at these contract definitions, and I'm assuming they are in the source code. One note is that if it is in the code, I wonder why they didn't include it in the Javadoc for the API. It sure would be useful for us clients of the APIs! Thanks for any help, Ken ========================================================================== TOPIC: Tutorial/Help on programming Genetic Algroithms in Java/C++ http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d70b46d726e33955 ========================================================================== == 1 of 3 == Date: Thurs, Sep 23 2004 2:33 pm From: "Kent Paul Dolan" <[EMAIL PROTECTED]> "Paul Lutus" <[EMAIL PROTECTED]> wrote: > Pot, kettle, black. To save me the trouble of doing the needed archive research, do you _always_ attack the messenger, rather than indulge in appropriately contrite behavior, such as apologizing to the party you offended, when your oafishness is called in question? [You'll find, as thousands before you have, that trying to insult a retired submariner by name calling is a failing strategy. The opinions of me expressed by self-demonstrated imbeciles are of no importance whatever to me, as I am more than capable of considering the source.] > Probably an artifact of your age. Yes. It's called "adulthood". When you've once experienced it, it's hard to go back to the Lutus level of maturity. xanthian. -- Posted via Mailgate.ORG Server - http://www.Mailgate.ORG == 2 of 3 == Date: Thurs, Sep 23 2004 3:11 pm From: "Howard" <[EMAIL PROTECTED]> "Ruben Hoste" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > Is there a certain programming language preferably to use to program > > > the GA? > > > > If that were true, the name wouldn't apply. By definition, they are not > > language-specific. I don't see how "Genetic Algortihm", by definition, means "not language specific". Were you thinking "Generic" instead of "Genetic", perhaps? In any case, the language of choice for Genetic Algorithms tends to be governed by the context under which is intended to be run, right? C++ might be a fine language to use for playing around with various methods. So might assembly code. If you're planning on entering some kind of contest, then they probably specify exactly how the programs need to be written. If you're doing it yourself, then you can specify any language you feel comfortable with. (Although in that case you may find it more difficult to write the controlling program, which I'd guess would emulate an imaginary [parallel?] processor, than to fiddle with various algorithms.) I see others have given good links for you already though. Check them out. And have fun! -Howard == 3 of 3 == Date: Thurs, Sep 23 2004 3:12 pm From: "Howard" <[EMAIL PROTECTED]> "Howard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Ruben Hoste" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] <Sorry Ruben, I meant that to be a response to Paul's post.> -Howard ========================================================================== TOPIC: Unable to load an XML for jaxb-ing http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f41e63b5fdd7c0cc ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 2:33 pm From: [EMAIL PROTECTED] (Sipayi) 'lo! Trying to use JAXB for my project. I did the following steps: a. Created xml/xsd/xjb, placed it under "com.foo.blah" b. xjc'd the xmls into "com.foo.blah.jaxb" c. Tried to unmarshal: -- 1. JAXBContext jc = JAXBContext.newInstance("com.foo.blah.jaxb"); 2. Unmarshaller um = jc.createUnmarshaller(); 3. Object xmlData = unmarshaller.unmarshal(com.foo.blah.SomeClass.class.getResourceAsStream("abc.xml")); -- Line 3. throws at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:173) ... I presume this means the classloader of SomeClass is unable to locate the XML file. I have tried placing the xml file in all directories... \, com\, com\foo, com\foo\blah, com\foo\blah\jaxb, etc., in vain. Can anyone tell me where I am going wrong? Is this a locating/loading issues, or JAXB related? Am I using a wrong class for loading? Shouldn't using a class at the level "com.foo.blah" suffice in loading "com\foo\blah\abc.xml"? Thanks in advance. -Siplin ========================================================================== TOPIC: code optmization http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b784382e7cbb306 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 2:37 pm From: "Will Hartung" <[EMAIL PROTECTED]> "mank" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Following java code is executed many multiple times in my program. > Any ideas to optmize it? > > if (result.group(2)== null || result.group(2).trim().length() < 1) > return var; > }else { > var=String.valueOf(Math.round(Float.parseFloat(var)* 3.0)); > } > if (result.group(1) != null && result.group(1).trim().length() > 0) { > return result.group(1) + result.group(2); > }else if (result.group(3) != null && result.group(3).trim().length() > 0) { > return result.group(2) + result.group(3); > }else { > return "$"+ result.group(2); > } > > Thanks Going solely with what's presented, here ya go. String resultGroup2 = result.group(2); if (resultGroup2 == null || resultGroup2.trim().length() < 1) { return var; } String resultGroup1 = result.group(1); if (resultGroup1 != null && resultGroup1.trim().length() > 0) { return resultGroup1 + resultGroup2; } else { String resultGroup3 = result.group(3); if (resultGroup3 != null && resultGroup3.trim().length() > 0) { return resultGroup2 + resultGroup3; } else { return "$"+ resultGroup2; } } Since I don't know how expensive "result.group(1)" method call is, I cached the intermediate results. Since 'var' is not used outside of the first IF block, I eliminated it completely from the else. An aggressive compile might have well eliminated that automatically already. parseFloat tends to be an expensive operation in most any language. Other than that, without knowing much more than what you've supplied, I'd argue that my changes will have as much effect on performance as shortening the network cables between the tiers. Regards, Will Hartung ([EMAIL PROTECTED]) ========================================================================== TOPIC: java.net http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca584de725d23003 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 2:38 pm From: Marcin <[EMAIL PROTECTED]> Hello, Does anyone have an idea how can I interrupt HttpUrlConnection.getInputStream()? I have 2 threads. First one opens stream using HttpUrlConnection method getInputStream(). Second one is monitoring transfer in the first thread. When transfer is below some number second thread tries to interrupt first. It looks sometimes (in special condition that are caused by me, for example :I halt internet traffic or do some changes in my proxy configuration) that getInputStream() method locks and can't be interrupted. I tried interrupt() method from Thread class, but id doesnn't work. I tried also to close streams, but it turned out that they were not open yet. Is there any technic to take full control over http connection ? Martin ========================================================================== TOPIC: read binary data from C file??? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c04d04f749f5ae1f ========================================================================== == 1 of 2 == Date: Thurs, Sep 23 2004 2:43 pm From: John Adams <[EMAIL PROTECTED]> Steve Horsley wrote: > John Adams wrote: > >> Gordon Beaton wrote: >> >> // And how the UDP client gets data >> // try - catch blocks are omitted for clarity >> DatagramPacket pkt = new DatagramPacket(buffer, buffer.length); >> socket.receive(pkt); >> byte[] data = pkt.getData(); >> StructureInputStream t = new StructureInputStream(data); >> float a1 = t.readFloat(); t.skipBytes(4); >> float a2 = t.readFloat(); t.skipBytes(4); >> float a3 = t.readFloat(); t.skipBytes(4); >> float a4 = t.readFloat(); t.skipBytes(4); >> >> > > So you are ignoring the endian-ness issue completely, although you > seem to be addressing the possible alignment issue (skipping 4 > bytes after every float). > Look in your compiler documentation and see exactly how it stores a > float. Compare this with the java documentation on how a DataInputStream > reads a float. I bet they're different. Endian-ness > may possibly be the only difference. > Only you know how the compiler stores floats in memory. Only you > can work out how to decode that back into float values. > > If the server is outside your control then you have no option > but to ask the author exactly what format it sends on the network, > or work it out yourself. > > If the server is in your control then it's your responsibility > to document what the server sends. And change the format to something > you CAN document (parhaps text as Paul suggests) if > you cannot work out what your current implementation sends. > > Either way, you cannot work on decoding the data until you know > how it's been encoded. > > Steve Hi all, I am deeply grateful for all your advice. Thanks to you all I have found the problem; and it is actually a legacy problem. The code has worked all along (I mean the Java end). The reason we saw a discrepancy in value display is that the C code did not print out the correct value! You can rest assure that if I could beat the guy who wrote that I would already have done so! Anyway, since I have no control over that, all I can do is just smile and be thankful that I have hit the right newsgroup to ask for help. It is really nice of you to pour in such a wonderful help. Regards, == 2 of 2 == Date: Thurs, Sep 23 2004 3:55 pm From: Michael Borgwardt <[EMAIL PROTECTED]> John Adams wrote: > I had, ofcourse as Michael > Borgwardt so "brilliantly" pointed out, tried putting some values on the > server side and dumping them out on the client side (That is HOW I know > they are not the same!!!). You obviously didn't understand my suggestion. My point was to NOT try to extract the individual values, but instead to dump the entire byte array to see how the values (which should be chosen to be easily recognizable even if scrambled a bit by endian issues) end up in the output. That can give you far more information than "it's not the same". ========================================================================== TOPIC: Extension problem Mac OS X (launching of external jar doesn't work) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3dd4b342d0c112d6 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 2:44 pm From: [EMAIL PROTECTED] (contrex) My java application use the extension mechanism (see: http://java.sun.com/docs/books/tutorial/ext/basics/install.html) which works very well under windows and linux. But the same app doesn't launch under Mac OS X (Panther) throwing a java.lang.NoSuchMethodException by the main class even when I've copied the jar (the extension) to all three possible extension folders which are (see: http://developer.apple.com/documentation/Java/Conceptual/Java141Development/Overview/chapter_2_section_4.html): 1) /Library/Java/Extensions/ 2) /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Home/lib/ext/ 3) /System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Home/lib/ext/ Let me go a little bit more into the details: What I wan't is to integrate an existing java app "SubApp" into another java app "MainApp". Both apps are normaly standalone apps. Thus, I just added a button to the GUI of "MainApp" which will instanciate "SubApp" when the user clicks it. The jar of "SubApp" has to be located therefore in the java extension folder, which is the case. This works fine on windows and linux but Mac OS X throws a java.lang.NoSuchMethodException. Why? Thanks for reading and helping! PS: If I double-click directly the jar file of "SubApp" then this app works fine too on Mac OS X - but standalone and not integrated in "MainApp". What can I do (besides chuck away Mac OS X)? I don't know much about Mac but I begin to hate it... ========================================================================== TOPIC: what u program? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 2:42 pm From: steve <[EMAIL PROTECTED]> On Mon, 20 Sep 2004 11:33:04 +0800, Peter Ashford wrote (in article <[EMAIL PROTECTED]>): > jaYPee wrote: > >> On 18 Sep 2004 11:41:52 GMT, Joona I Palaste <[EMAIL PROTECTED]> >> wrote: >> >> >>> jaYPee <[EMAIL PROTECTED]> scribbled the following: >>> >>>> I just wanted to know what most program [you] do in [Java]? [Because] >>>> [I'm] a [VB] >>>> programmer and [I] do a lot of database programming. >>> >>>> [Thanks] in advance >>> >>> I'm currently pretty much completely engaged in a large customer >>> project. Our customer is the Finnish state bureau for gambling - >>> Veikkaus OY. They want to upgrade their internal game winnings >>> monitoring system and we're implementing a new one for them. >>> Java-wise, this means a Servlet that basically acts as a gateway to a >>> humongous request-response -style database access program with >>> different customised information retrieval and update components. It's >>> more fun than it sounds, really. >> >> >> >> Thank you all for the information you've shared w/ me. I want to know >> also if java support cyrstal reports as a reporting tool when it comes >> to database programming. if not what is the reporting tool used by >> java? > > Java is a general purpose language - it does not have one single > reporting tool. > > BTW Crystal reports java - use google. danger will robinson, mouth open brain off line. Jasper reports jfreechart ireports check out i reports, it is rapidly turning into "crystal reports for java" ========================================================================== TOPIC: jboss/mysql cmp deadlock? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8b6b1527949264ca ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 3:08 pm From: [EMAIL PROTECTED] (Michael Lim) hi folks, has anyone run into ejb cmp deadlock with jboss/mysql? i can reproduce this fairly easily by simply clicking on various links that i know will access the database as a single user. i've heard of turning off method transaction, or changing the CMP entity bean commit option to commit-option "A". would like to know if these are the only available options to tune this, or there's other proper workaround or config tuning for this to avoid this deadlock. the app i have is a very straightfoward application, and there's no need for transactions, and currently jboss is the only entry point to mysql to modify data. i'm running jboss 3.2.3 with mysql 4.0.18. here's part of my deadlock exception/stack trace. thank you all very much for any help or info in advance. michael lim [EMAIL PROTECTED] 2004-09-23 14:37:01,025 ERROR [com.myapp.action.ShowGBParentAction] org.jboss.util.deadlock.ApplicationDeadlockExceptionexception caught: org.jboss.util.deadlock.ApplicationDeadlockException: Application deadlock detected, [EMAIL PROTECTED], bean=User, id=2D0F93A70A0A0A01019829A918E37D02, refs=2, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1635, BranchQual=], synched=Thread[TP-Processor2,5,jboss], timeout=5000, queue=[], holder=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1633, BranchQual=], [EMAIL PROTECTED], bean=User, id=B06A31EE0A0A0A01005911710AE8D2EC, refs=2, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1633, BranchQual=], synched=null, timeout=5000, queue=[TXLOCK waitingTx=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1635, BranchQual=] id=0 thread=Thread[TP-Processor8,5,jboss] queued=true], waitingResourceHolder=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1633, BranchQual=] org.jboss.util.deadlock.ApplicationDeadlockException: Application deadlock detected, [EMAIL PROTECTED], bean=User, id=2D0F93A70A0A0A01019829A918E37D02, refs=2, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1635, BranchQual=], synched=Thread[TP-Processor2,5,jboss], timeout=5000, queue=[], holder=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1633, BranchQual=], [EMAIL PROTECTED], bean=User, id=B06A31EE0A0A0A01005911710AE8D2EC, refs=2, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1633, BranchQual=], synched=null, timeout=5000, queue=[TXLOCK waitingTx=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1635, BranchQual=] id=0 thread=Thread[TP-Processor8,5,jboss] queued=true], waitingResourceHolder=TransactionImpl:XidImpl [FormatId=257, GlobalId=gb-app-srv01//1633, BranchQual=] at org.jboss.util.deadlock.DeadlockDetector.deadlockDetection(DeadlockDetector.java:48) at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.waitForTx(QueuedPessimisticEJBLock.java:301) at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.doSchedule(QueuedPessimisticEJBLock.java:236) at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.schedule(QueuedPessimisticEJBLock.java:183) at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:85) at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:54) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122) at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:489) at org.jboss.ejb.Container.invoke(Container.java:700) at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:375) at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38) at $Proxy82.getProviderrating(Unknown Source) at com.myapp.serviceProviders.ServiceProviderManagerBean.getProviderRating(ServiceProviderManagerBean.java:309) at com.myapp.serviceProviders.ServiceProviderManagerBean.getRating(ServiceProviderManagerBean.java:381) at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122) at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331) at org.jboss.ejb.Container.invoke(Container.java:700) at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:375) at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:83) at $Proxy106.getRating(Unknown Source) at com.myapp.directories.DirectoryManagerBean.getGBProviderRating(DirectoryManagerBean.java:322) at com.myapp.directories.DirectoryManagerBean.getGBProviderRatings(DirectoryManagerBean.java:816) at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122) at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331) at org.jboss.ejb.Container.invoke(Container.java:700) at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90) at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46) at ... ... ========================================================================== TOPIC: howto session bean w/ XDoclet http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d43139a7c8b544c ========================================================================== == 1 of 2 == Date: Thurs, Sep 23 2004 3:18 pm From: [EMAIL PROTECTED] (Willian Irving Zumwalt) Hey all, Does anyone see anything wrong w/ this session bean. I'm pretty new to XDoclet and having various problems in compiling or loading. So now I'm just trying a very basic example. I get the following compile errors below it. /** * * @ejb.bean * name="comp/History" * type="Stateless" * view-type="remote" * jndi-name="ejb/comp/History" * * @ejb.home * extends="javax.ejb.EJBHome" * remote-class="com.place.management.ejb.session.HistoryHome" * * @ejb.interface * extends="javax.ejb.EJBObject" * remote-class="com.place.management.ejb.session.History" */ public class HistoryBean implements SessionBean { private transient SessionContext context = null; public void setSessionContext(SessionContext ctx) { context = ctx; } public void unsetSessionContext() throws EJBException { context = null; } /** * @ejb.create-method */ public void ejbCreate() throws CreateException { } /** * @ejb.home-method */ public void ejbRemove() throws EJBException { } /** * @ejb.home-method */ public void ejbPassivate() { } /** * @ejb.home-method */ public void ejbActivate() { } /** * @ejb.home-method */ public void ejbRemove() { } } --- jboss server output --- [javac] Compiling 42 source files to /home/myProject/build/classes [javac] /home/myProject/src/com/place/management/ejb/session/HistoryBean.java:74: ejbRemove() is already defined in com.place.management.ejb.session.HistoryBean [javac] public void ejbRemove() { } [javac] ^ [javac] /home/myProject/build/gen/com/place/management/ejb/session/HistoryHome.java:29: remove() is already defined in com.place.management.ejb.session.HistoryHome [javac] public void remove() [javac] ^ [javac] 2 errors == 2 of 2 == Date: Thurs, Sep 23 2004 3:46 pm From: Sudsy <[EMAIL PROTECTED]> Willian Irving Zumwalt wrote: > Hey all, > > Does anyone see anything wrong w/ this session bean. I'm pretty new to > XDoclet and having various problems in compiling or loading. So now > I'm just trying a very basic example. I get the following compile > errors below it. > > /** > * > * @ejb.bean > * name="comp/History" > * type="Stateless" > * view-type="remote" > * jndi-name="ejb/comp/History" > * > * @ejb.home > * extends="javax.ejb.EJBHome" > * remote-class="com.place.management.ejb.session.HistoryHome" > * > * @ejb.interface > * extends="javax.ejb.EJBObject" > * remote-class="com.place.management.ejb.session.History" > */ > > public class HistoryBean implements SessionBean > { > private transient SessionContext context = null; > > public void setSessionContext(SessionContext ctx) { > context = ctx; > } > > public void unsetSessionContext() throws EJBException { > context = null; > } > > /** > * @ejb.create-method > */ > > public void ejbCreate() throws CreateException { } > > /** > * @ejb.home-method > */ > > public void ejbRemove() throws EJBException { } First definition. > > /** > * @ejb.home-method > */ > > public void ejbPassivate() { } > > /** > * @ejb.home-method > */ > > public void ejbActivate() { } > > /** > * @ejb.home-method > */ > > public void ejbRemove() { } Second definition. > } Remove one. ========================================================================== TOPIC: writeObject and readObject problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e6fc9480a3a7f42a ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 3:48 pm From: Michael Borgwardt <[EMAIL PROTECTED]> Andrew Thompson wrote: > In your server code, top line.. > > import java.awt.Event; > > Your server does not need it till run time, > that is why your code compiles, but to recognize > an Event you are reading, the java.awt.Event > must be imported to the server code. That can't be right. Java's import is nothing but a compiler directive to allow the use of classnames without prepending the package. It *cannot* have any influence whatsoever on runtime behaviour. In compiled code and in serialized objects, all classes are referred by their fully qualified name. The only thing he needs is java.awt.Event in the server's classpath, which should be no problem since it has been part of the API since 1.1. ========================================================================== TOPIC: Can I force garbage collection? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/62be19cef0da9817 ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 3:50 pm From: "Mike Schilling" <[EMAIL PROTECTED]> "Chris Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You should never set a reference to null just to encourage garbage > collection to happen sooner; it doesn't work, and it clutters your code. > There are a few rare instances where you may need to set a reference to > null to permit garbage collection to collect an object graph in the > first place, though. These situations, and a few other tips, are > mentioned at the bottom of http://jinx.swiki.net/59, which I wrote a > couple years ago to address this topic. That's a nice writeup. Thanks. ========================================================================== TOPIC: version -> speed? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a63fd0f945fa2e4f ========================================================================== == 1 of 1 == Date: Thurs, Sep 23 2004 3:58 pm From: Michael Borgwardt <[EMAIL PROTECTED]> Jacob wrote: >> Same java program, if i use jdk5.0 to compile it, it will run >> faster than compiled by 1.4.2? > > > It probably depends on many factors. > > My experience is that Java2D at least has > significantly better performace in 1.5. But this almost certainly nothing to do with the compiler, only with the runtime. Java compilers can't really do all that much optimization, so there should be little (if any) difference. It's all in the runtime and its JIT compilation. ======================================================================= 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
