comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * HTTPUnit not working against an https (SSL) site - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d793f5e72fb7839 * Displaying blank JLabel Icon. - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8787f391c42b6a42 * Error while getting Result Set Data from SQL 2000 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5796c291f001ce28 * struts: forward based on input - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80dc9e240fa10b9a * multiple threads in java applets - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c054444b3bab7d44 * efficient network transfer - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6996ec6c1fb6cf53 * Tomcat startup problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb62e38707d64ca1 * Search for byte pattern in a binary file. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc671002cbe38f70 * use com port as parallel port - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/43f0abc240232d51 * Deployed EJBs' count-programatically - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c74df43d54c2cd5 * How can I "force" an upcast? Convert subclass into superclass? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ad4bc9f7ae03de71 * including multiple jars in a single executable jar - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dfd9be21f8995847 * Is "String s = "abc";" equal to "String s = new String("abc");"? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57b8aacdcf136f3f * Class and interface loading order - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dc413d1e05db6fe * Creating video with JMF - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/59e73010ce83f608 * getting class names of a package - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b97a137e29b11850 ========================================================================== TOPIC: HTTPUnit not working against an https (SSL) site http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d793f5e72fb7839 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 10:47 pm From: Bruno Grieder <[EMAIL PROTECTED]> samotto wrote: > I am not sure if I am using HTTPSUrlConnections or SSLSockets. How do > I tell? > > We have a dev site and a production site. When I set the request to > go to the dev site (with http:// in the url) everything works. When I > change the request url to our prod site (with https://) I get the > error. > > So do I need to change something else in my code to the the HTTPS > stuff? > > Thanks for your time... > > Sam > > > Bruno Grieder <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > >>Sam wrote: >> >>>I am trying to test a request/response from a https address and >>>getting the error >>> >>>java.lang.RuntimeException: https support requires the Java Secure >>>Sockets Extension. See http://java.sun.com/products/jsse >>> >>>I have the jdk version 1.4.2_05 which says the JSSE is now part of the >>>jdk. >>> >>>I also have >>> >>>security.provider.2=com.sun.net.ssl.internal.ssl.Provider >>> >>>in my java.security file. >>> >>>What am I doing wrong? >>> >>>Thanks in advance >>> >>>Sam >> >> >>Mhh... Strange. I am using the same version without any issue (on Linux) >>and I confirm that (contrarily to 1.3) there is no set-up to do at all >>to use the default Sun libraries. I have tried with the Apache >>httpclient librairies with similar success. >> >>Are you sure you are actually using HTTPSUrlConnections or opening >>SSLSockets when connecting? >> >>bruno Yes you do have to change something. for http you shoud do something like HttpUtlConnection conx = (HttpUrlConnection) (new URL("http://...)).openConnection(); for https HttpsUrlConnection conx = (HttpsUrlConnection) (new URL("https://...)).openConnection(); bruno nb: please bottom post. ========================================================================== TOPIC: Displaying blank JLabel Icon. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8787f391c42b6a42 ========================================================================== == 1 of 2 == Date: Thurs, Nov 18 2004 11:03 pm From: "Ken Adams" <[EMAIL PROTECTED]> "Chris Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ken Adams <[EMAIL PROTECTED]> wrote: >> So to do the second suggestion, Should I create a class the implements >> Icon? > > Yes. > >> If so, How do I override paint to do nothing yet the size of the image >> takes >> up any panel it is in? > > Please let me know if I'm misunderstanding you. > > I was under the impression that the point was to create a transparent > icon of a given size. Sizes in Java are calculated bottom-up, not top- > down, so there's no way to take up the entire size of a panel, because > the size of the panel *depends* on the size of the icon. You want to > make this icon the same size as the visible one that you would otherwise > be displaying. > > -- > www.designacourse.com > The Easiest Way To Train Anyone... Anywhere. > > Chris Smith - Lead Software Developer/Technical Trainer > MindIQ Corporation Ok, I am sure you are getting sick of my questions to a seemingly easy problem. But I got this for code. What more needs to be done, and yes I do want to set the icon the size of the icon that was previously there.I set the label by calling label.setIcon(new BlankIcon(80,100)) but it essential does the same as calling label.setIcon(null). and that isin't what I want. Thanks for you patients. public class BlankIcon implements Icon { private int width; private int height; public BlankIcon(int width,int height) { } public int getIconHeight() { return width; } public int getIconWidth() { return height; } public void paintIcon(Component arg0, Graphics arg1, int arg2, int arg3) { } } == 2 of 2 == Date: Thurs, Nov 18 2004 11:06 pm From: "Ken Adams" <[EMAIL PROTECTED]> "Ken Adams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Chris Smith" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Ken Adams <[EMAIL PROTECTED]> wrote: >>> So to do the second suggestion, Should I create a class the implements >>> Icon? >> >> Yes. >> >>> If so, How do I override paint to do nothing yet the size of the image >>> takes >>> up any panel it is in? >> >> Please let me know if I'm misunderstanding you. >> >> I was under the impression that the point was to create a transparent >> icon of a given size. Sizes in Java are calculated bottom-up, not top- >> down, so there's no way to take up the entire size of a panel, because >> the size of the panel *depends* on the size of the icon. You want to >> make this icon the same size as the visible one that you would otherwise >> be displaying. >> >> -- >> www.designacourse.com >> The Easiest Way To Train Anyone... Anywhere. >> >> Chris Smith - Lead Software Developer/Technical Trainer >> MindIQ Corporation > > Ok, I am sure you are getting sick of my questions to a seemingly easy > problem. But I got this for code. What more needs to be done, and yes I do > want to set the icon the size of the icon that was previously there.I set > the label by calling label.setIcon(new BlankIcon(80,100)) but it essential > does the same as calling label.setIcon(null). and that isin't what I want. > Thanks for you patients. > > public class BlankIcon implements Icon > { > private int width; > private int height; > public BlankIcon(int width,int height) > { > } > public int getIconHeight() > { > return width; > } > public int getIconWidth() > { > return height; > } > public void paintIcon(Component arg0, Graphics arg1, int arg2, int > arg3) > { } > } > Ignore the last post. I made a simple stupid mistake, If you noticed I don't assign the values in the constructor to my local values. (HEHE) So now it works great. Thanks alot for the help though, this is exactly what I was looking for. :) ========================================================================== TOPIC: Error while getting Result Set Data from SQL 2000 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5796c291f001ce28 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 11:07 pm From: "Murray" <[EMAIL PROTECTED]> "biswa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Strange though! It works with SQL 7 but SQL 2000 gives me error log > "Error in reading Raw Data" > > while(rs.next) { > if(rs.getString(iRowID) != null) { > { > strTemp = rs.getString(iRowID); //For SQL 2000 this line gives > error. > //do something > } > else > break; > } > > but if i change my implementation to > while(rs.next) { > strTemp = rs.getString(iRowID);//no error > if(strTemp != null) { > //do something > } > else > break; > } > > Strangely both works for SQL7 database. I am using jtds as jdbc for > SQL 7 and for SQL 2000 I am using jdbc of SQL Server. > > Any explaination to this would be very helpful. > Thanks, > biswa. Please post the *exact* error message, and an SQL error code if there is one (there usually is). Microsoft's JDBC drivers are notoriously buggy, well some versions anyway. Perhaps you can't call getString() twice on the same column. Your second piece of code is better anyway in my opinion. It's generally best practice to get values from the ResultSet only once, for performance and code readability reasons. ========================================================================== TOPIC: struts: forward based on input http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80dc9e240fa10b9a ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 11:11 pm From: "Murray" <[EMAIL PROTECTED]> "dennis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am newbee in struts so pls bear with me. > > Say you have a page that maybe embedded in other pages/frames etc. > User can submit the page. This always ends up in the same action which > does some processing and fowards on to different location depending > where the page was embedded. Is there anything in request that would > tell me where the page came from... if not I'd think to pass a source > variable in the form which would tell me this. Can anyone offer a > better solution? > thx -D You can get the referring URL from the request header, but this is pretty unreliable. Some browsers and/or firewalls remove this value depending on security settings. String referringUrl = request.getHeader("Referer"); // yes, only one 'r' I'd go with passing a source page value. ========================================================================== TOPIC: multiple threads in java applets http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c054444b3bab7d44 ========================================================================== == 1 of 2 == Date: Thurs, Nov 18 2004 11:36 pm From: [EMAIL PROTECTED] (rockwell) Hi groups i am working on multiple threads in java applets,what i have to do is 1) for the first click of mouse a string say "string 1" is to be displayed at the mouse click location and should move from left ro right. 2) at the second click an other string say "string 2" is to be displayed at the mouse click and it should also move from left to right. I am able to make get the first string moving by creating a thread,but at the same time for the second click i am unable to create an other thread which runs with the first thread.My main aim is to move both the strings after 2 clicks. Can any one give me an idea how to do it, Thanks in advance, Bye. == 2 of 2 == Date: Thurs, Nov 18 2004 11:45 pm From: Andrew Thompson <[EMAIL PROTECTED]> On 18 Nov 2004 23:36:40 -0800, rockwell wrote: > Hi groups i am working on multiple threads in java applets, Do it in an application first.. <http://www.physci.org/codes/javafaq.jsp#appfirst> >...what i have to do is Homework, ehhh? (snip) > I am able to make get the first string moving by creating a thread, What.. Where's your code? >..but > at the same time for the second click i am unable to create an other > thread which runs with the first thread. Why? <http://www.physci.org/codes/javafaq.jsp#specific> >..My main aim is to move both > the strings after 2 clicks. > > Can any one give me an idea how to do it, a) Supply broken code.. <http://www.physci.org/codes/sscce.jsp> -- 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: efficient network transfer http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6996ec6c1fb6cf53 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 11:42 pm From: Esmond Pitt <[EMAIL PROTECTED]> Knute Johnson wrote: > I'm still not clear on how you would set the buffer size of a socket in > Java. java.net.Socket.setSendBufferSize() java.net.Socket.setReceiveBufferSize() http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setSendBufferSize(int) http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setReceiveBufferSize(int) ========================================================================== TOPIC: Tomcat startup problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb62e38707d64ca1 ========================================================================== == 1 of 1 == Date: Fri, Nov 19 2004 12:30 am From: [EMAIL PROTECTED] (moongateclimber) Hello, I've been trying to install OpenNMS for a week with no success. Right now the problem looks like a Tomcat problem, so I thought I could try to look for answers here; if you want to redirect me to a more appropriate newsgroup, please do. I am using jakarta Tomcat 5.0.28. The OpenNMS installation requires a new Context tag to be added to the server.xml file. The tag looks like this: <Context path="/opennms" docBase="opennms" debug="0" reloadable="true"> <Logger classname="org.opennms.web.log.Log4JLogger" homeDir="/opt/OpenNMS"/> <Realm className="org.opennms.web.authenticate.OpenNMSTomcatRealm" homeDir="/opt/OpenNMS"/> </Context> On startup, Tomcat crashes and I find the following log in logs/catalina.out: 19-nov-2004 9.25.00 org.apache.commons.digester.Digester startElement GRAVE: Begin event threw exception java.lang.NullPointerException at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:769) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:721) at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:252) at org.apache.commons.digester.Rule.begin(Rule.java:200) at org.apache.commons.digester.Digester.startElement(Digester.java:1273) at org.apache.catalina.util.CatalinaDigester.startElement(CatalinaDigester.java:65) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.catalina.startup.Catalina.load(Catalina.java:489) at org.apache.catalina.startup.Catalina.load(Catalina.java:528) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:250) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:424) Catalina.start using conf/server.xml: java.lang.NullPointerException java.lang.NullPointerException at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540) at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566) at org.apache.commons.digester.Digester.startElement(Digester.java:1276) at org.apache.catalina.util.CatalinaDigester.startElement(CatalinaDigester.java:65) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.catalina.startup.Catalina.load(Catalina.java:489) at org.apache.catalina.startup.Catalina.load(Catalina.java:528) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:250) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:424) 19-nov-2004 9.25.00 org.apache.commons.digester.Digester startElement GRAVE: Begin event threw exception java.lang.NullPointerException at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:769) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:721) at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:252) at org.apache.commons.digester.Rule.begin(Rule.java:200) at org.apache.commons.digester.Digester.startElement(Digester.java:1273) at org.apache.catalina.util.CatalinaDigester.startElement(CatalinaDigester.java:65) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.catalina.startup.Catalina.load(Catalina.java:489) at org.apache.catalina.startup.Catalina.start(Catalina.java:548) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) Catalina.start using conf/server.xml: java.lang.NullPointerException java.lang.NullPointerException at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540) at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566) at org.apache.commons.digester.Digester.startElement(Digester.java:1276) at org.apache.catalina.util.CatalinaDigester.startElement(CatalinaDigester.java:65) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.catalina.startup.Catalina.load(Catalina.java:489) at org.apache.catalina.startup.Catalina.start(Catalina.java:548) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) 19-nov-2004 9.25.00 org.apache.catalina.startup.Catalina start INFO: Server startup in 0 ms java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) Caused by: java.lang.NullPointerException at org.apache.catalina.startup.Catalina.await(Catalina.java:619) at org.apache.catalina.startup.Catalina.start(Catalina.java:579) ... 6 more Any suggestions? I thank you very much for any help, I'm about to give up with the installation if I don't find a solution! MC ========================================================================== TOPIC: Search for byte pattern in a binary file. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc671002cbe38f70 ========================================================================== == 1 of 1 == Date: Fri, Nov 19 2004 12:41 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Tim Jowers wrote: > Thomas Weidenfeller <[EMAIL PROTECTED]> wrote in message news:<[EMAIL > PROTECTED]>... > >>Ryan Tan via JavaKB.com wrote: >> >>>Hi there, does anyone have a quick way to search for a byte pattern in a >>>binary file? >> >>Look at (Google for) algorithms like Boyer-Moore, Knuth-Morris-Pratt or >>Rabin-Karp. >> >> >>/Thomas > > > Which "quick" are you talking about? I? I don't talk about any "quick". Please get your threading right. If you want to respond to Ryan's post, don't respond to one of my posts. /Thomas ========================================================================== TOPIC: use com port as parallel port http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/43f0abc240232d51 ========================================================================== == 1 of 1 == Date: Fri, Nov 19 2004 12:47 am From: [EMAIL PROTECTED] (b3ny) > So while you cannot control the state of the TxD pin (or read that of > the RxD pin) programmatically, all the remaining pins (DTR and RTS as > outputs and DSR,CTS,DCD and RI as inputs) can be controlled / read > asynchronously from the PC. tell me how it works??? how di i have to config the comm api? maybe a little source code example? thanx beny ========================================================================== TOPIC: Deployed EJBs' count-programatically http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c74df43d54c2cd5 ========================================================================== == 1 of 1 == Date: Fri, Nov 19 2004 12:49 am From: [EMAIL PROTECTED] (Jaiganesh.K) Dear Group, I am new to this group. I have a thing to know how to find the count of EJB's deployed in any server(Currently using JBoss) using a code. I also need to find out the number of session and entity beans active and deployed too. Hope to get a solution... Regards, Jaiganesh.K ========================================================================== TOPIC: How can I "force" an upcast? Convert subclass into superclass? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ad4bc9f7ae03de71 ========================================================================== == 1 of 1 == Date: Fri, Nov 19 2004 1:23 am From: Andrea Desole <[EMAIL PROTECTED]> There has been a discussion already a while ago about the equal method, and some people disagreed with the way I look at this issue. I personally think that the original method is correct, and since a class B is a specialization of A it makes sense to think that it's more restrictive than A. So a B class should use A's conditions and something else. Otherwise there can be a class C that is also derived from A, but it's different from B. Still, equals might return true. Chris Smith wrote: > Tobias K. <[EMAIL PROTECTED]> wrote: > >>Well. I've got a method that compares "a" and "b", checks if >>they are equal. I thought, "casting" b to a would get rid of the >>supplemental members. > > > Nope, sorry. All members of an object will remain members of that > object for as long as the object lives. What casting does is ensure > that one specific *reference* to the object is treated as a different > type, so that even though those members still exist you cannot access > them through that reference. > > >>I don't know if my equal-method could be improved? >> > > > You need to define what it means for two objects of these classes to be > equal. Java programmers often develop the unfortunate habit of > mechanically writing equals methods that just compare all the fields of > two objects and returning true or false. Recall that when you declare > that two objects are equal, you're defining that policy for the entire > class hierarchy rooted at the class you're writing. Also keep in mind > the contract requirements posed in the API documentation for Object's > equals method. > > Specific comments: > > >> class ClassA { > > >> public boolean equals(Object obj) { >> if( (obj != null) && >>(obj.getClass().equals(this.getClass())) ) { >> ClassA otherObj = (ClassA) obj; >> return (this.fix == otherObj.fix); >> } >> return false; >> } > > >> class ClassB extends ClassA { > > >> public boolean equals(Object obj) { >> if( (obj != null) && >>(obj.getClass().equals(this.getClass())) ) { >> if( super.equals(obj) == false ) { >> return false; >> } >> ClassB otherObj = (ClassB) obj; >> return (this.supplement == otherObj.supplement); >> } >> return false; >> } > > > This is going the wrong direction. Implementations of equals should > become more permissive toward the leaves of the inheritance hierarchy. > Yours are becoming less permissive. That is, there are less > requirements for objects of class A to be equal to each other than for > objects of class B. When you implement A, think of it as a contract for > *all* instances of A, including those of its subclass. Hence, the first > equals method says that if the classes of objects are the same and > 'fix' is equal, then the objects are equal. The implementation in B > should, AT A MINIMUM, at least report objects as equal if they are of > the same class and their 'fix' members are equal. B's implementation > may report more objects as equal than that, but it should NOT report > less. > ========================================================================== TOPIC: including multiple jars in a single executable jar http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dfd9be21f8995847 ========================================================================== == 1 of 2 == Date: Fri, Nov 19 2004 1:30 am From: [EMAIL PROTECTED] (Allen Wallis) Hi, I am trying to package my application as a single jar file, say app.jar, that can be executed using java -jar app.jar. The problem is that app.jar requires extensions, say ext1.jar and ext2.jar. I know I can use the Class-Path manifest entry to ensure that these extensions are added to the classpath, however this means that I must send the end-user 3 files - app.jar, ext1.jar and ext2.jar. Can I package ext1.jar and ext2.jar inside app.jar so that I only need the app.jar file in order to run the application? I do not want to unpack the extension jars since they may be 3rd party jars and I would prefer them to remain intact. The goal of this exercise is to have a single 1-click executable jar, the end user should be able to receive the file, and double-click to run it. Thanks Allen == 2 of 2 == Date: Fri, Nov 19 2004 1:53 am From: "Niels Dybdahl" <[EMAIL PROTECTED]> > Can I package ext1.jar and ext2.jar inside app.jar so that I only need > the app.jar file in order to run the application? I do not want to > unpack the extension jars since they may be 3rd party jars and I would > prefer them to remain intact. I can not see the problem in unpacking ext1.jar and ext2.jar and then packing the contents into your app.jar even if they are 3rd party. Its an easy and simple operation. Niels Dybdahl ========================================================================== TOPIC: Is "String s = "abc";" equal to "String s = new String("abc");"? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57b8aacdcf136f3f ========================================================================== == 1 of 1 == Date: Fri, Nov 19 2004 1:32 am From: Michael Borgwardt <[EMAIL PROTECTED]> Mike Schilling wrote: >>Not really. Both declare a reference, and while the first doesn't >>explicitly *create* an object at runtime, there still *is* an Object. >>It's part of the constant pool of the class and created when the >>class is loaded. > > > The second creates two objects, since the constant String "abc" and the > results of "new String()" must be distinct. But the literal isn't created when the line is executed, it's created when the class is loaded. ========================================================================== TOPIC: Class and interface loading order http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dc413d1e05db6fe ========================================================================== == 1 of 1 == Date: Fri, Nov 19 2004 1:37 am From: Andrea Desole <[EMAIL PROTECTED]> Classes should be loaded when they are needed. From the JVM spec: Creation of a class or interface C denoted by the name N consists of the construction in the method area of the Java virtual machine (§3.5.4) of an implementation-specific internal representation of C. Class or interface creation is triggered by another class or interface D, which references C through its runtime constant pool. Class or interface creation may also be triggered by D invoking methods in certain Java class libraries (§3.12) such as reflection. So my guess is that the second case is correct, and the first is not. Maybe a bug? Fernando wrote: > In resume, I have a factory class that creates/instantiates a family > of classes, like in this example: > > public class Test{ > public static void main(String args[]){ > TestInterface t = Factory.getInstance(0); > t.f(); > } > } > > class Factory{ > public static TestInterface getInstance(int type){ > System.out.println("Executed Factory.getInstance()"); > switch(type){ > case 0: return new TestInterfaceImpl0(); > case 1: return new TestInterfaceImpl1(); > default: return new TestInterfaceImpl2(); > } > } > } > > abstract class TestInterface{ > public abstract void f(); > } > > class TestInterfaceImpl0 extends TestInterface{ > public void f(){ System.out.println("Executed > TestInterfaceImpl0.f()"); } > } > > class TestInterfaceImpl1 extends TestInterface{ > public void f(){ System.out.println("Executed > TestInterfaceImpl1.f()"); } > } > > class TestInterfaceImpl2 extends TestInterface{ > public void f(){ System.out.println("Executed > TestInterfaceImpl2.f()"); } > } > > When I run Test class using -verbose:class option I got this output: > > [Loaded Test] > [Loaded Factory] > [Loaded TestInterface] > [Loaded TestInterfaceImpl0] > [Loaded TestInterfaceImpl1] > [Loaded TestInterfaceImpl2] > Executed Factory.getInstance() > Executed TestInterfaceImpl0.f() > > So, what we see here is that JVM loads ALL classes referenced from > Factory.getInstance() (TestInterfaceImpl0, TestInterfaceImpl1 and > TestInterfaceImpl2) before it is executed. > > Now, my question. If I change the abstract class TestInterface into an > interface, the loading order is completely different. See: > > > public class Test{ > public static void main(String args[]){ > TestInterface t = Factory.getInstance(0); > t.f(); > } > } > > class Factory{ > public static TestInterface getInstance(int type){ > System.out.println("Executed Factory.getInstance()"); > switch(type){ > case 0: return new TestInterfaceImpl0(); > case 1: return new TestInterfaceImpl1(); > default: return new TestInterfaceImpl2(); > } > } > } > > interface TestInterface{ > public void f(); > } > > class TestInterfaceImpl0 implements TestInterface{ > public void f(){ System.out.println("Executed > TestInterfaceImpl0.f()"); } > } > > class TestInterfaceImpl1 implements TestInterface{ > public void f(){ System.out.println("Executed > TestInterfaceImpl1.f()"); } > } > > class TestInterfaceImpl2 implements TestInterface{ > public void f(){ System.out.println("Executed > TestInterfaceImpl2.f()"); } > } > > > When I run Test class using -verbose:class option I got this output: > > [Loaded Test] > [Loaded Factory] > [Loaded TestInterface] > Executed Factory.getInstance() > [Loaded TestInterfaceImpl0] > Executed TestInterfaceImpl0.f() > > This time, ONLY TestInterfaceImpl0 is loaded and its loading is > postponed until it is needed (Factory.getInstance() before the > loading). > > Does anyone now why this happens? > > Thanks a lot. > > Regards, > Fernando. ========================================================================== TOPIC: Creating video with JMF http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/59e73010ce83f608 ========================================================================== == 1 of 2 == Date: Fri, Nov 19 2004 1:47 am From: [EMAIL PROTECTED] Hello I want to create a video with jmf. I have a sound file and an image file. How i can mixed the two files to obtain a video. Any help or info will be welcome. Nazha == 2 of 2 == Date: Fri, Nov 19 2004 2:02 am From: Andrew Thompson <[EMAIL PROTECTED]> On 19 Nov 2004 01:47:29 -0800, [EMAIL PROTECTED] wrote: > I want to create a video with jmf. ... > Any help or info will be welcome. Check the JMF FAQ, (linked from) <http://www.physci.org/codes/javafaq.jsp#faq> ..and try the Sun JMF Forum, linked in the section below that. HTH -- 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: getting class names of a package http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b97a137e29b11850 ========================================================================== == 1 of 2 == Date: Fri, Nov 19 2004 1:52 am From: Johannes Zellner <[EMAIL PROTECTED]> Hello, can I get dynamically (from a java program) all class names from a package, where the package is available by the classpath, e.g. get all class names of the package java.util? Any help much appreciated. -- Johannes == 2 of 2 == Date: Fri, Nov 19 2004 1:58 am From: Andrew Thompson <[EMAIL PROTECTED]> On 19 Nov 2004 09:52:12 GMT, Johannes Zellner wrote: > can I get dynamically (from a java program) all class names from a > package, No. Classes may be generated in memory. -- 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 ======================================================================= 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
