comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Jakarta Struts relative path question on form submit - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efabed9f151fbf61 * clarification about login logic in a Webapp using Struts - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6107ee79d477edec * Writing to Word documents - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/63e6214e752428a * Search for byte pattern in a binary file. - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc671002cbe38f70 * How can I "force" an upcast? Convert subclass into superclass? - 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ad4bc9f7ae03de71 * I wrote my own Java in BASIC ! ! ! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29ec22b23b7d5d6d * applet problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/77127616376e3ddd * How secure is Java? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/38d2eda5f6def0e3 * efficient network transfer - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6996ec6c1fb6cf53 * 'A'++ == 'B': Always True? - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb79b41e32f311b2 * Where is source code for Struts 1.1? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b5efbaecd3eca9a * SCJP 5.0 Beta exam group - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dce5aaca037b346f * 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 * struts: forward based on input - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80dc9e240fa10b9a * 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 * how to use format? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3fc0459d7c798baf ========================================================================== TOPIC: Jakarta Struts relative path question on form submit http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efabed9f151fbf61 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 3:15 pm From: "bo123" <[EMAIL PROTECTED]> carmine, Have you tried Controller attribute forwardPattern in Struts 1.1? ========================================================================== TOPIC: clarification about login logic in a Webapp using Struts http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6107ee79d477edec ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 3:16 pm From: Andrew Thompson <[EMAIL PROTECTED]> On 18 Nov 2004 10:05:44 -0800, Jean Lutrin wrote: > Imagine a Web site where you have to login before > you access, say, the "forums". NoooOOOOooooo! Not *another* one. [ Sorry Jean, it's an in-joke about 'web forums' that has precious little to do with your enquiry. Hope you get an answer and that you are not intending to use it for what I ..imagine. ;-) ] -- 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: Writing to Word documents http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/63e6214e752428a ========================================================================== == 1 of 2 == Date: Thurs, Nov 18 2004 3:30 pm From: "Ann" <[EMAIL PROTECTED]> "Y2KYZFR1" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] (Jonck van der Kogel) wrote in message news:<[EMAIL PROTECTED]>... > > Hi everybody, > > I have defined a Word template and set bookmarks at certain locations > > in this document, to which I then want to write text gotten from a > > database and save the file. In this way I could create standard > > documents (for example an invoice) in an automated manner. > > I have looked into the Jakarta POI project > > (http://jakarta.apache.org/poi/index.html), but this project is mostly > > aimed at Excel, Word support is still in its infancy. > > Another solution that I've found > > (http://www.must.de/en/default.html?../Javactpe.htm) seems to work > > very well, but is Windows only. > > Also there are a few commercial solutions, but these cost several > > thousand dollars, which I can't afford. > > > > I figure such an automated creation of Word documents is probably > > being done by a lot of people, so therefore I was wondering, does > > anyone know of a (affordable) way to achieve what I described in a > > platform independent manner? > > > > Thanks very much, Jonck > > write to an RTF format, that will open right up in word, or html, > either one can be imported into word by clueless users with no > problems. RTF is probably the best becuase its extension is mapped to > word by default Yesterday I viewed a microsoft web page that discussed problems with upgrading to WIN XP SP2 and there was a statement that the RTF converters were being unlinked or something such that each program was itself now (in SP2) responsible for the conversion. I got the impression that RTF was being phased out. I don't have the URL because I cleaned out my cache/history. == 2 of 2 == Date: Thurs, Nov 18 2004 4:00 pm From: Andrew Thompson <[EMAIL PROTECTED]> On 18 Nov 2004 13:44:46 -0800, Y2KYZFR1 wrote: > ...RTF is probably the best becuase its extension is mapped to > word by default Not on my XP Pro box it isn't, .RTF open in Wordpad as default. (But that would not hamper it for the OP's users - who probably have MS Office, or at least MS Word, installed). -- 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: Search for byte pattern in a binary file. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc671002cbe38f70 ========================================================================== == 1 of 4 == Date: Thurs, Nov 18 2004 3:47 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Thu, 18 Nov 2004 10:17:51 +0100, Frank wrote: > Andrew Thompson wrote: >> Note that '_____________________' is *not* a valid sig. delimiter, >> whereas Thomas suggested '-- ', which is the accepted sig. delimiter. >> >> The lack of links to resources on Usenet etiquette is of continued concern. >> >> A basic understanding of netiquette > > While we're on that subject. Perhaps some of us should make an effort to > trim their sig to 4 lines or less..? ;) Standards of etiquette are mostly set by the contributors to a group. I'll make you a deal, Frank. If you start a new thread about sig. delimiters and can get any *three* regulars on this group to agree with your view, I will shorten my sig.. -- 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 == 2 of 4 == Date: Thurs, Nov 18 2004 6:25 pm From: "Ryan Tan via JavaKB.com" <[EMAIL PROTECTED]> Hi, thank you all for you invaluable input. I will have a good look at the suggested search algorithm. In my case, the byte patterns to search are small (less than 100 bytes). So, I was thinking of reading a buffer (say 2048 bytes) and apply one of the algorithm before reading again from (the last position - the size of the pattern) and so on. This way my overhead is only the pattern size. What do you think? If this is the case, I would have to use a forward-searching algorithm like Knuth-Morris-Pratt. Mr Jowers, by saying "quick" I meant a quick method of coding and also best performance (which sometimes coincide). Since I am interested in processing binary files, there is not much sense in using a dictionary (correct me if I am wrong) because all the data are completely random. And also, all the string functions would not work well with binary data. Thanks again for all the input. Man, I wish someone has already done a byte[].indexOf method :P _____________________ Message posted via http://www.javakb.com == 3 of 4 == Date: Thurs, Nov 18 2004 6:34 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Thu, 18 Nov 2004 23:47:43 GMT, Andrew Thompson wrote: > On Thu, 18 Nov 2004 10:17:51 +0100, Frank wrote: >> .. Perhaps some of us should make an effort to >> trim their sig to 4 lines or less..? ;) .. > I'll make you a deal, Frank. If you start a new thread about sig. > delimiters .. Ughhh.. I meant sig. *length*. >..and can get any *three* regulars on this group to agree > with your view, I will shorten my sig.. (below, for those unfamiliar with the abbreviation 'sig.') -- 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 == 4 of 4 == Date: Thurs, Nov 18 2004 9:59 pm From: Chris Smith <[EMAIL PROTECTED]> Ryan Tan via JavaKB.com <[EMAIL PROTECTED]> wrote: > Thanks again for all the input. Man, I wish someone has already done a > byte[].indexOf method :P Google told me that there's a SourceForge project at http://mockrunner.sourceforge.net/ that contains exactly that. The code is in a class called com.mockrunner.util.ArrayUtil, and the method is (somewhat confusingly) named contains... but it acts just like indexOf does in java.lang.String. Note that byte array searching is NOT the primary purpose of mockrunner; the code just happens to exist by coincidence. I know nothing about the quality of the code there. Mockrunner uses an Apache-style license, so you are free to use the code in your own project. See the license for details about your coincident obligations, though, should you choose to do so. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== 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 5 == Date: Thurs, Nov 18 2004 4:30 pm From: "Tobias K." <[EMAIL PROTECTED]> Maybe this is an FAQ, but nevertheless I don't get the point. Look at this: public class CastTest { class ClassA {} class ClassB extends ClassA {} CastTest() { ClassA a = new ClassA(); ClassB b = new ClassB(); ClassA c = (ClassA) b; System.out.println(a.getClass()); System.out.println(b.getClass()); System.out.println(c.getClass()); } public static void main(String[] args) { new CastTest(); } } If you execute the obove, you'll get the following: class test.CastTest$ClassA class test.CastTest$ClassB class test.CastTest$ClassB Why is the class of c still ClassB and _not_ ClassA? I casted it! Is there a way to force the cast from ClassB to ClassA or do I have to do it by hand - say: Do I have to write a method that takes all members that are both present in A and in B out of B, then creates a new A and puts them into it? Or is there another way? Thanks in advance! Tobias == 2 of 5 == Date: Thurs, Nov 18 2004 4:39 pm From: "Hal Rosser" <[EMAIL PROTECTED]> "Tobias K." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Maybe this is an FAQ, but nevertheless I don't get the point. > > Look at this: > > public class CastTest { > > class ClassA {} > class ClassB extends ClassA {} > > CastTest() { > ClassA a = new ClassA(); > ClassB b = new ClassB(); > ClassA c = (ClassA) b; > System.out.println(a.getClass()); > System.out.println(b.getClass()); > System.out.println(c.getClass()); > } > > public static void main(String[] args) { > new CastTest(); > } > } > > If you execute the obove, you'll get the following: > > class test.CastTest$ClassA > class test.CastTest$ClassB > class test.CastTest$ClassB > > Why is the class of c still ClassB and _not_ ClassA? I casted it! > Is there a way to force the cast from ClassB to ClassA or do I have to > do it by hand - say: Do I have to write a method that takes all members > that are both present in A and in B out of B, then creates a new A and > puts them into it? Or is there another way? > > Thanks in advance! > > Tobias You don't have to cast a subclass for it to be a superclass. Try the instanceOf operator. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.788 / Virus Database: 533 - Release Date: 11/1/2004 == 3 of 5 == Date: Thurs, Nov 18 2004 4:56 pm From: "Matt Humphrey" <[EMAIL PROTECTED]> "Tobias K." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Maybe this is an FAQ, but nevertheless I don't get the point. > > Look at this: > > public class CastTest { > > class ClassA {} > class ClassB extends ClassA {} > > CastTest() { > ClassA a = new ClassA(); > ClassB b = new ClassB(); > ClassA c = (ClassA) b; > System.out.println(a.getClass()); > System.out.println(b.getClass()); > System.out.println(c.getClass()); > } > > public static void main(String[] args) { > new CastTest(); > } > } > > If you execute the obove, you'll get the following: > > class test.CastTest$ClassA > class test.CastTest$ClassB > class test.CastTest$ClassB > > Why is the class of c still ClassB and _not_ ClassA? I casted it! > Is there a way to force the cast from ClassB to ClassA or do I have to > do it by hand - say: Do I have to write a method that takes all members > that are both present in A and in B out of B, then creates a new A and > puts them into it? Or is there another way? It's because you have some misconceptions about what casting is. The new () creates an object of the specific class. An object cannot change its class--the class is an intrinsic part of the object itself. Casting cannot change the class of the object, only how the compiler treats the reference at that point. Furthermore, all subclasses *are* members of their superclasses. All ClassB objects are also ClassA. You don't have to cast a ClassB object to be able to treat it like a ClassA object. Cheers, Matt Humphrey [EMAIL PROTECTED] http://www.iviz.com/ == 4 of 5 == Date: Thurs, Nov 18 2004 5:50 pm From: "Tobias K." <[EMAIL PROTECTED]> Matt Humphrey wrote: > You don't have to cast a > ClassB object to be able to treat it like a ClassA object. 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. I tought, if the members being left over were equal, then a and b would be considered as equal as well... Maybe I need to define another equal-method, or simply create a new object of ClassA out of b. The latter is working. I don't know if my equal-method could be improved? Have a look: public class CastTest { class ClassA { int fix=100; public int hashCode() { return 0; } 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 { int fix=100; int supplement=200; public int hashCode() { return 1; } 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; } } ClassA methodA() { ClassA a = new ClassA(); a.fix=500; return a; } ClassB methodB() { ClassB b = new ClassB(); b.fix=500; return b; } boolean methodACompareB(ClassA a, ClassA b) { return a.equals(b); } boolean methodBCompareA(ClassA a, ClassA b) { return b.equals(a); } CastTest() { ClassA a = new ClassA(); ClassB b = new ClassB(); ClassA c = (ClassA) b; System.out.println(a.getClass()); System.out.println(b.getClass()); System.out.println(c.getClass()); if (b instanceof ClassA) { ClassA d = (ClassA) b; System.out.println(d.getClass()); } System.out.println( methodACompareB(methodA(),methodB()) ); System.out.println( methodBCompareA(methodB(),methodA()) ); a.fix=500; b.fix=500; ClassA newB = new ClassA(); newB.fix = b.fix; System.out.println( methodACompareB(a,newB) ); System.out.println( methodBCompareA(a,newB) ); } public static void main(String[] args) { new CastTest(); } } Execute the obove and you'll get: class test.CastTest$ClassA class test.CastTest$ClassB class test.CastTest$ClassB class test.CastTest$ClassB false false true true == 5 of 5 == Date: Thurs, Nov 18 2004 9:54 pm From: Chris Smith <[EMAIL PROTECTED]> 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. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: I wrote my own Java in BASIC ! ! ! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29ec22b23b7d5d6d ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 4:59 pm From: thirdrock <[EMAIL PROTECTED]> Todd Carnes wrote: > Hans-Marc Olsen wrote: > >> Java was too expensive for me, so I wrote my own Java in BASIC. > > > Java is free. If your time is worth nothing. ========================================================================== TOPIC: applet problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/77127616376e3ddd ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 5:26 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Thu, 18 Nov 2004 20:03:37 +0100, Lam wrote: > i have an applet .. URL? > ..problem .. You should develop applications first <http://www.physci.org/codes/javafaq.jsp#appfirst> > i have created an applet which his comportment is correct on Mozilla, > IE under Linux or windows with Sun VM, Which versions specifically? Note that Sun also made Java 1.1.8. If your Applet uses things like BufferedImage or Swing, it will not work in a Sun 1.1.8 VM. >..but incorrect with Microsoft VM > does anybody know if it is possible de specify which VM must be > install on the client ? Yes. At least you can specify a minimum Java version (you should not need to care who's compliant VM it is). > like in applet tag ? No. You can use the nested <OBJECT>/<EMBED> element for Java versioning, but I hava a better solution. You can put the JavaVersionApplet in your page as well and redirect Java 1.1 VM browsers to a different page. <http://www.physci.org/codes/jre.jsp> BTW - While x-posting is better than mulit-posting, it is generally not wise to x-post between c.l.j.help and c.l.j.programmer, as the nature of responses can be very different. I will set the follow-ups for this post to c.l.j.help. 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: How secure is Java? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/38d2eda5f6def0e3 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 5:45 pm From: [EMAIL PROTECTED] (hiwa) steve <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > On Wed, 17 Nov 2004 18:29:09 +0800, hiwa wrote > (in article <[EMAIL PROTECTED]>): > > > Do you happen know, what would happen if we, with root privilege, run > > an rm -fr / or equivalent by using Runtime#exec() or java.io.File > > methods? > > looks like the students are upto page 2 in their "how to learn java" > course work. Will you please give the title and the publisher of the course book of which the page 2 does mention this security issue. Or, does the book give a counter measure against a malicious Java program which would try rm -rf / or equivalent? Or, do you happen to know an undocumented JVM option to prevent the software terror? ========================================================================== 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 6:32 pm From: Knute Johnson <[EMAIL PROTECTED]> Esmond Pitt wrote: > Knute Johnson wrote: > >> I'm curious how you would set your socket's buffer to 48k. Could you >> explain that and what it just what it would do for you? > > > At least 48k. on xDSL it should be nearly 64k. The buffer size should at > least equal the bandwidth-delay product. Otherwise you don't have the > maximum amount of data in flight so you aren't using the maximum > available network capacity. > > EJP > I'm still not clear on how you would set the buffer size of a socket in Java. I think the socket buffer size is a function of the TCP/IP stack. I'm not a TCP/IP expert but if you know how to adjust it on my Winbloze XP machine I would like to know. Thanks, -- Knute Johnson email s/nospam/knute/ ========================================================================== TOPIC: 'A'++ == 'B': Always True? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb79b41e32f311b2 ========================================================================== == 1 of 4 == Date: Thurs, Nov 18 2004 7:46 pm From: [EMAIL PROTECTED] (Fritz Foetzl) "Doug Pardee" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... [snip] > The OP (to whom I was responding) was asking an important question > about a fundamental difference between the languages that he was > accustomed to and Java. Languages like C process characters internally > in 'native' form with no translation during I/O, while Java processes > characters internally in Unicode and translates during I/O. This > difference trips up a LOT of beginning Java programmers, and I felt > that it was worthwhile to be explicit about what was going on. ...and the OP appreciates it. This has been a lively, stimulating discussion - better than I anticipated. The difference between character I/O and internal processing is important, and I've learned much from reading this thread. Thanks to all who have responded! ff == 2 of 4 == Date: Thurs, Nov 18 2004 8:40 pm From: "Gary Labowitz" <[EMAIL PROTECTED]> "Doug Pardee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] <<snip>> > Doug> you'll usually be using a character encoding that > Doug> translates 0x0000-0x007F into byte values 0x00-0x7F. > Doug> A counter-example would be if > Doug> you were running on an IBM mainframe, > > Chris> I don't think that's relevant. A typical EBCDIC machine would > Chris> take a different route to get there, but the resulting output > Chris> would still be an 'A' followed by a 'B'. Not true. EBCDIC does not guarantee that the alphabetic characters are contiguous. I believe 'R' is not followed by 'S'. There may also be other "breaks" in the sequence. -- Gary == 3 of 4 == Date: Thurs, Nov 18 2004 8:43 pm From: "Gary Labowitz" <[EMAIL PROTECTED]> "Fritz Foetzl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Doug Pardee" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > [snip] > > > The OP (to whom I was responding) was asking an important question > > about a fundamental difference between the languages that he was > > accustomed to and Java. Languages like C process characters internally > > in 'native' form with no translation during I/O, while Java processes > > characters internally in Unicode and translates during I/O. This > > difference trips up a LOT of beginning Java programmers, and I felt > > that it was worthwhile to be explicit about what was going on. > > ...and the OP appreciates it. This has been a lively, stimulating > discussion - better than I anticipated. The difference between > character I/O and internal processing is important, and I've learned > much from reading this thread. Thanks to all who have responded! Interesting. Also, since the OP used the postfix operator, I'm just wondering if the 'A' wasn't being compared to 'B' and would therefore always be false. As confused as ever, I remain -- Gary == 4 of 4 == Date: Thurs, Nov 18 2004 9:42 pm From: Chris Smith <[EMAIL PROTECTED]> Gary Labowitz <[EMAIL PROTECTED]> wrote: > Not true. EBCDIC does not guarantee that the alphabetic characters are > contiguous. I believe 'R' is not followed by 'S'. There may also be other > "breaks" in the sequence. That doesn't matter. The point is that the literal 'A' is a unicode code point. Incrementing it will always give the code point for 'B'. The translation to EBCDIC is only performed during the output phase. The resulting output may not contain consecutive EBCDIC values (I don't know enough about EBCDIC to say whether it will or not), but it WILL be A followed by B -- not because A and B are consecutive in EBCDIC, but because A and B are consecutive in Unicode. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Where is source code for Struts 1.1? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b5efbaecd3eca9a ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 8:21 pm From: Sudsy <[EMAIL PROTECTED]> Andrew Hammer wrote: > Does anyone know where I can obtain the source code for Struts 1.1? > Now that Struts is an Apache project (not Jakarta) I can't find the > source (or bianry) distributions for previous versions. Do you know how to use a browser?! Seriously, on the off chance that it had somehow disappeared (highly unlikely!), I went to jakarta.apache.org. A grand total of 5 (count 'em!) clicks located the following: <http://archive.apache.org/dist/jakarta/struts/source> It took you longer to post the question (and me the reply) that it did to navigate the links, clearly labelled as they were... ;-) -- Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development. ========================================================================== TOPIC: SCJP 5.0 Beta exam group http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dce5aaca037b346f ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 8:24 pm From: [EMAIL PROTECTED] (Kiran) Hello Java geeks, Sun is planning for a beta exam for the new version of Java 1.5 (Tiger). ***************************************** SUN Certification News - New SCJP exam to be released in early 2005 - The SCJP 5.0 Beta exam will be available for a limited time, starting in mid-January, 2005. The "live" exam is tentatively scheduled to be released in late March, 2005. **************************************** So I have created an group for discussion on this exam. http://groups.yahoo.com/group/scjp5/ Discussions are open on the new features of the Java 5.0(Tiger). Cheers, Kiran ========================================================================== 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: Thurs, Nov 18 2004 8:33 pm From: "Mike Schilling" <[EMAIL PROTECTED]> "Chris Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Yes. Use of '==' is, in fact, the only direct way to see the > difference. Indirectly, of course, you could observe the memory usage > of the application after a large number of repetitions of the code. At an intermediate level of directness, you could create a thread that locks "abc" and observe that a different thread can lock the new-ed String. ========================================================================== 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 8:44 pm From: [EMAIL PROTECTED] (dennis) 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 ========================================================================== 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 9:41 pm From: [EMAIL PROTECTED] (biswa) 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. ========================================================================== TOPIC: how to use format? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3fc0459d7c798baf ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 9:58 pm From: Kieron Briggs <[EMAIL PROTECTED]> Skip wrote: > String binary = Integer.toBinaryString(...)); > int fixedLenght = 8; > int currentLength = binary.length(); > int difference = fixedLength - currentLength; > > StringBuffer sb = new StringBuffer(); > for(int i=0; i<difference; i++) > { > sb.append('0'); > } > sb.append(binary); > > binary = sb.toString(); > Or how about: StringBuffer sb = new StringBuffer(Integer.toBinaryString(...)); while (sb.length() < DESIRED_LENGTH) { sb.insert(0, '0'); } System.out.println(sb.toString()); Just saves a few variables... ;-) Kieron ======================================================================= 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
