comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Problem with cast and inheritance - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e3fbc9c832c7b9a2 * Java Textbook and Instructor's Kit for Highschool - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b77471f015adb099 * 1.4.2 translate errors - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/500030113b379ec * Java, Hyperterminal, File Transfer - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1c43517d2ed0e59d * creating a java UTF-8 string - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff32baef11a0e944 * any HTML/XML handling scripting language ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ad69fcbcf8cb59c * Parsing commnad lines - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6c763684e884ce5e * Building Java Apps for Mobile Phones - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f7cac84d6b2aaed0 * Can i use multiple bluetooth dongles on one computer?! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bc883f14d78e1f6f * inner class, explicit outer class method call - 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c5b10a57b7a8d571 * Round a Double - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/159d9c3cd9c737ed * How do I make my JDialog's buttons respond to enter key? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/42d85a46a4a0b455 * Newbie question: handling arrays in separate class - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/72272e6c26a94a21 * background process: existing jsp/servlet or new applet? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22361eba54ae92f9 * Office/Computer/Nerd/Geek gifts and clothing - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/303d3459380b9728 * log4j and console in ANT/JUnit task - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2767a082c474af64 * Logging configuration file w/ web start - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/647b28fc11be9145 * I renounce the 1st to 33rd degree of Freemasonry------------------ - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/212a98ee72e0a3a4 * GUI - GUI value passing - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/427d1d7372619486 * Struts FileNotFoundException with no stack trace - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbe491ea696843a * Unable to establish a socket connection - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3db1070c05ec0b49 ========================================================================== TOPIC: Problem with cast and inheritance http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e3fbc9c832c7b9a2 ========================================================================== == 1 of 3 == Date: Fri, Oct 22 2004 9:18 am From: "Thomas G. Marshall" <[EMAIL PROTECTED]> Almeja DT coughed up: > Don't worry , > Your Idea is good and you can cast the class the way you want. > The problem is in your code. The correct form to cast your classB is: > > ClassA classA = (ClassA) new ClassB(); ...[rip]... It is perfectly good form to do the following: ClassA classA = new ClassB(); There is no reason whatsoever to supply the up-cast. It doesn't even make clearer code. -- Forgetthesong,I'dratherhavethefrontallobotomy... == 2 of 3 == Date: Fri, Oct 22 2004 9:36 am From: Joona I Palaste <[EMAIL PROTECTED]> Thomas G. Marshall <[EMAIL PROTECTED]> scribbled the following: > Almeja DT coughed up: >> Don't worry , >> Your Idea is good and you can cast the class the way you want. >> The problem is in your code. The correct form to cast your classB is: >> >> ClassA classA = (ClassA) new ClassB(); > ...[rip]... > It is perfectly good form to do the following: > ClassA classA = new ClassB(); > There is no reason whatsoever to supply the up-cast. It doesn't even make > clearer code. Not in this case, but upcasts may be necessary with overloaded methods or with the ?: operator. I can't think of any other place where they are needed. -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-------------------------------------------------------- rules! --------/ "This isn't right. This isn't even wrong." - Wolfgang Pauli == 3 of 3 == Date: Fri, Oct 22 2004 10:09 am From: Jon Martin Solaas <[EMAIL PROTECTED]> Franck DARRAS wrote: > Hello, > > I have two classes > ClassA and ClassB > > ClassB extends ClassA > > When i creat a new ClassB, I can cast this ClassB to the ClassA > code : ClassA classA = (classA) ClassB; > > Problem : > But I would like to create a new instance of ClassA and cast it to the > ClassB, but i obtain a classCastException. > > Do you know a solution ? > > For the moment, I resolve this problem with this follow code > ClassB classB = new ClassB(); > classB.setXXX(ClassA.getXXX); > > Thks for your Help > > Franck How about this: public interface IXxx { public void setXXX(YYY z); public YYY getXXX(); } public class ClassA implements IXxxx { ... } public class ClassB extends ClassA // or implements IXxx { ... } IXxx xxx = new ClassA(); xxx.setXXX(...) xxx.getXXX(); xxxB = new ClassB(); xxx.setXXX(...); xxx.getXXX(); I really don't know what you are trying to do, but maybe this gives you an idea ... -- jonmartin.solaas¤h0tm4i1 ========================================================================== TOPIC: Java Textbook and Instructor's Kit for Highschool http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b77471f015adb099 ========================================================================== == 1 of 2 == Date: Fri, Oct 22 2004 12:49 am From: "Chris Uppal" <[EMAIL PROTECTED]> George W. Cherry wrote: > I'm a little concerned that the IDE may distract > attention from Java itself. You are wise to be sceptical of IDEs for beginners' use, but I think that BlueJ is well worth a couple of hours of your time to check out before you make a decision. It's /designed/ for teaching, and not in the trivial sense of having lots of lots of "training wheels" for beginners either. Recommended (I'm not a teacher, mind). -- chris == 2 of 2 == Date: Fri, Oct 22 2004 9:20 am From: "George W. Cherry" <[EMAIL PROTECTED]> "Yakov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "George W. Cherry" <[EMAIL PROTECTED]> wrote in > message news:<[EMAIL PROTECTED]>... >> "Yakov" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > Read my article on teaching kids Java: >> > >> > http://www.sys-con.com/story/?storyid=44575 >> >> Thanks. BTW Yakov, why don't you use indention >> to show the structure of a class, method, and so on? > > I do it in the book. The article was not formatted by me :( Aren't you embarrassed by it? You're the author. It's rather off-putting, you know. I don't want to sound harassing, but I thought I should bring it to your attention. ========================================================================== TOPIC: 1.4.2 translate errors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/500030113b379ec ========================================================================== == 1 of 3 == Date: Fri, Oct 22 2004 9:22 am From: Paul Lutus <[EMAIL PROTECTED]> Andrew Neiderer wrote: > I programmed a simple GUI using Swing with build 1.3.1 on > a Windows machine. Now someone is interested in using this code under RH > Linu! > with a Blackdown 1.4.2 build. It has been some years since I looked at > Java > but I will dig into it if I must. I just want to do this as fast as > possible. Your system has a bug -- it made you post the exact same post in two different newsgroups. This is called "mutiposting" and it is universally unacceptable. Fix your system's problems, and both this and the original topic wil be resolved. -- Paul Lutus http://www.arachnoid.com == 2 of 3 == Date: Fri, Oct 22 2004 9:35 am From: "Yogo" <n o s p a m> "Paul Lutus" wrote: > Your system has a bug -- it made you post the exact same post in two > different newsgroups. This is called "mutiposting" and it is universally > unacceptable. Is being off topic without mentioning it _clearly_ acceptable ? No, it's not. So please mention that your post is off-topic or don't post it at all. Yogo == 3 of 3 == Date: Fri, Oct 22 2004 12:37 pm From: Alex Hunsley <[EMAIL PROTECTED]> Yogo wrote: > "Paul Lutus" wrote: > >>Your system has a bug -- it made you post the exact same post in two >>different newsgroups. This is called "mutiposting" and it is universally >>unacceptable. > > > Is being off topic without mentioning it _clearly_ acceptable ? > > No, it's not. If the replying post is relaying information to the OP about something they did in their post the wrong way - then yes, it is clearly acceptable, if you look at the way Usenet works currently: how often is a post, which addresses the OP's bad form of posting style, marked 'off-topic'? Never seen it, in my experience. And I've never seen anyone make a fuss about it before now. Can you provide links to messages on google groups that show anyone else is bothered by that? On the contrary, I can supply you with any number of posts that show that the thing you're complaining about is accepted standard practice. I think the key is that while mentioning a technicality about someones post isn't talking about the topic at hand, it isn't talking about a different topic either, which is what "off-topic" would suggest (at least to me). > So please mention that your post is off-topic or don't post it at all. > > Yogo Tell me, honestly, what you think hurts usenet more: people multiposting ad nauseum, or people giving feedback on how better to use usenet without adding 'off-topic' to the subject line? alex ========================================================================== TOPIC: Java, Hyperterminal, File Transfer http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1c43517d2ed0e59d ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:26 am From: [EMAIL PROTECTED] (JP) Hello again, I just read through some more info and found out that apparently there are zmodem implementations in Java available, except I have to purchase them... I am not sure if purchasing is an option at this point, does anyone know of a free implementation of zmodem file transfer protocol that's in Java? If not, how about just some general ideas as to how I can implement zmodem protocol? Or is this a non-trivial task? Thank you, James ========================================================================== TOPIC: creating a java UTF-8 string http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff32baef11a0e944 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:30 am From: Michael Borgwardt <[EMAIL PROTECTED]> static wrote: >>There is no such thing as an "UTF-8 String". A String is composed of characters, >>whereas UTF-8 is a method of converting between chracters and bytes. > > > Sorry guys...I guess I didn't make myself more clear. I have a byte > array in UTF-8 format and would like to transfer all of that data to a > string without any character loss. So the String would contain all of > the UTF-8 data. Any ideas? No problem whatsoever then. Just use UTF-8 encoding for your Readers and Writers (or whatever other ways you use to convert between bytes and characters) and nothing can go wrong. ========================================================================== TOPIC: any HTML/XML handling scripting language ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ad69fcbcf8cb59c ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:33 am From: [EMAIL PROTECTED] (Bru, Pierre) hi, I was used to do page scraping/html handling with Compaq's Web Language (AKA WebL, http://research.compaq.com/SRC/WebL/) but this scripiting tool is no longer supported since a long time and knows only HTML up to 3.2 :( so I wrote a piece of java to get a page and used an HTML parser to parse the crappy HTML found on the 'net and beautify it (add missing close tags, etc) now that I have this XML-like HTML, I would like to edit it with a script (not edit-compile loop when I want to change little things in the way I modify, easiest for people without java compiler to create their own modification). for ex, with WebL you can delete each table row that contains the word "foo" with something like: P=GetURL("http://www.foo.bar/index.html"); each e in Elem(P,"tr") contain Pat(P,"foo") Delete(e); end PrintLn(Markup(P)); and many other easy handling like this one (check the PDF Reference Manual for more) does something like that exist out of the box (or near out out the box)? TIA, Pierre. PS. as WebL sources are available, I could modify WebL (for my own usage) but I could not redistribute the modified version because of copyright. so modifying WebL is not a solution :( ========================================================================== TOPIC: Parsing commnad lines http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6c763684e884ce5e ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:27 am From: "J.F. Cornwall" <[EMAIL PROTECTED]> Travis Spencer wrote: > "Thomas Weidenfeller" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Travis Spencer wrote: >> >>>I have an assignment for a Java programming class >> >>We don't do homework here. You are supposed to do your homework, not we. >> > > > Read the rest of the post, Thomas. When I tutor at school, I don't write > students' code for them. As a CS tutor I am only allowed to help students > understand the assignment better and come up with ways to solve the problem. > This is all I was asking for: a fresh perspective and new thoughts on the > assignment. I have no problem doing my own homework. > > I sincerely hope that you are an atypical member of this newsgroup, and that > the other regulars are better at reading and comprehending information. I > for one will never post here again. > Unfortunately, Travis, there are a number of other regulars who are even more abrasive and seem to have a compulsion towards accusing students of want their homework coded for them. Granted, there certainly have been a lot of those sort of postings in the few months I have been lurking in here, and there may be *some* justification for getting cranky towards them, but I personally think that certain people go overboard on the subject. If you can learn to ignore these individuals' abrasive nature, you can certainly learn from them about the coding aspects of Java. Awhile back, I jumped into the middle of a "cheating-student" thread with a question about where an instructor draws the line between plagiarism/cheating and research/code reuse. The first thing I got in response was "Why, do you plan on cheating this way?" While my first reaction was a very hostile counterattack (which I never sent), the best thing to do was make a clear statement that I was not cheating, didn't need to cheat, and that wasn't what I was asking the question about anyway. After that, there were more reasoned responses, even from the abrasive guru types. All I can suggest is that you hang around, ask questions when you feel the need, and just ignore the responders who try to get a rise out of people. Oh, and make it as clear as you possibly can when you're asking for a general guidance pointer vs solving a coding question. Jim Cornwall (new to Java but been coding for a living for 20 yrs) ========================================================================== TOPIC: Building Java Apps for Mobile Phones http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f7cac84d6b2aaed0 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:38 am From: "Lee" <[EMAIL PROTECTED]> If I bought the correct lead (either USB or serial) for my phone and connected the phone to my PC how easy would it be to use java to access the functions of the phone via the lead? Ideally I would like to send SMS messages from my PC. ========================================================================== TOPIC: Can i use multiple bluetooth dongles on one computer?! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bc883f14d78e1f6f ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:39 am From: Paul Lutus <[EMAIL PROTECTED]> Edward Klepping wrote: > Hi everybody. > I know this is abit of a weird setup but im trying to set up a system > with more than one bluetooth device on a computer. Ie two or more > dongles on one computer which could then all connect to a single > mobile device - ie my phone. Is this possible?! and if so how do you > access the addresses of them because from what i can gather making a > call to local device will only give a single address, not an array or > set of addresses. Any clues anybody?! If this is not possible in a > conventional way are there any work arounds people can suggest eg with > virtual serial ports etc? Just to clarify, its not the range thats > important its having distinguishable bluetooth points. Tell us how this relates to Java, our topic. -- Paul Lutus http://www.arachnoid.com ========================================================================== TOPIC: inner class, explicit outer class method call http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c5b10a57b7a8d571 ========================================================================== == 1 of 4 == Date: Fri, Oct 22 2004 9:44 am From: [EMAIL PROTECTED] (Yamin) Hey all, This is purely an academic question. I know the easy work around for it, but I'm just wondering. I want to know if there's an easy way to explicitly call an outer classes method from an inner class. For example class x { public String getName(){ return "xName";} class y { public String getName { return "yName";} public String getFullName( return x.getName()+ getName;} } } The getFullName should return "xNameyName"; The quesiton is how do your specify x.getName() without getName() being static. The easy way to solve this is to simply pass in the outer class as a parameter to the inner class. Then to call x.getName, you'd simply use the reference you passed in. For example class x { public String getName(){ return "xName";} class y { private x myx; public y(x myx) { this.myx = myx}; public String getName { return "yName";} public String getFullName( return myx.getName()+ getName;} } } I guess what's I'm asking, is there an equivalent way to address the outerclass in a similar manner as when you inherit from a baseclass, you can explicitly call the parent classes member by super.X...is there something along the lines of an outer.X. I don't think there is, but just seeing what's out there. Thanks, Yamin == 2 of 4 == Date: Fri, Oct 22 2004 9:57 am From: "Yogo" <n o s p a m> "Yamin" wrote: > > For example > class x > { > public String getName(){ return "xName";} > > class y > { > public String getName { return "yName";} > public String getFullName( return x.getName()+ getName;} > } > } > > The getFullName should return "xNameyName"; > The quesiton is how do your specify x.getName() without getName() > being static. > Use this -> x.this.getName() The following will then return "xNameyName": new x().new y().getFullName(); Yogo == 3 of 4 == Date: Fri, Oct 22 2004 10:17 am From: [EMAIL PROTECTED] (Paul Tomblin) In a previous article, [EMAIL PROTECTED] (Yamin) said: >I guess what's I'm asking, is there an equivalent way to address the >outerclass in a similar manner as when you inherit from a baseclass, >you can explicitly call the parent classes member by super.X...is >there something along the lines of an outer.X. I don't think there >is, but just seeing what's out there. Try x.this.getName() -- Paul Tomblin <[EMAIL PROTECTED]> http://xcski.com/blogs/pt/ Or, to put it another way, if you see a long line of rats streaming off of a ship, the correct assumption is *not* "gosh, I bet that's a real nice boat now that those rats are gone". - Mike Sphar == 4 of 4 == Date: Fri, Oct 22 2004 11:46 am From: Oscar kind <[EMAIL PROTECTED]> Yamin <[EMAIL PROTECTED]> wrote: > This is purely an academic question. I know the easy work around for > it, but I'm just wondering. > > I want to know if there's an easy way to explicitly call an outer > classes method from an inner class. There is no need to work around it: the methods of the outer class are available in the inner class. You can just call them. It becomes "interesting" when you've hidden the method from the outer class by declaring a method woth the same name in the inner class. But even then you can reach it using OuterClass.this.method(). It even works with more than methods, but I haven't used if for anything other than fields yet. > I guess what's I'm asking, is there an equivalent way to address the > outerclass in a similar manner as when you inherit from a baseclass, > you can explicitly call the parent classes member by super.X...is > there something along the lines of an outer.X. I don't think there > is, but just seeing what's out there. There is (see above): use OuterClass.this instead of super -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ========================================================================== TOPIC: Round a Double http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/159d9c3cd9c737ed ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 9:52 am From: Carl Howells <[EMAIL PROTECTED]> Chris Smith wrote: > (I'm using 2.35 merely as an example above, so when I say "may not" or > "may", I certainly *don't* mean that the behavior is undefined. Rather > I mean that it's perfectly well defined for a given value; but changing > 2.35 to a different value could change those facts.) 2.35 turns out to be one of those values that isn't exactly expressible in binary, so that disclaimer wasn't strictly necessary. Quickest way to see this: .35 = .25 + .1 And while .25 decimal is obviously exactly representable in in binary (.01), .1 decimal is the classic value which isn't exactly representable in binary, so their sum clearly can't be represented exactly in binary. ========================================================================== TOPIC: How do I make my JDialog's buttons respond to enter key? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/42d85a46a4a0b455 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 10:35 am From: Chas Douglass <[EMAIL PROTECTED]> [EMAIL PROTECTED] (Paul Tomblin) wrote in news:[EMAIL PROTECTED]: > In a previous article, Chas Douglass <[EMAIL PROTECTED]> said: >>[EMAIL PROTECTED] (Paul Tomblin) wrote in news:cl9a26$p59$1 >>@allhats.xcski.com: >>> How do I make JDialog buttons work like the buttons in JOptionPane, >>> where pressing the enter/return key does the action of the selected >>> button? At >> >>It's not clear to me exactly what you are asking. > > It's simple. If I tab between the buttons in either a JOptionPane or > a JDialog, the buttons get a highlight (unless you call > "setFocusPainted(false)"). But if I hit return in a JOptionPane, the > highlighted button's action gets performed just as if I'd clicked on > it. In a JDialog, if I hit return, nothing happens. I would like it > to behave like a JOptionPane. Actually, I would like all my java > dialogs to respond to the enter key - radio and toggle buttons > toggling, combo boxes opening up, etc. Native guis do this by > default. > So, it's not quite so simple... > >>In case what you are asking about is how to make a default button work >>with ENTER, have a look at: >> >>JComponent.getRootPane().setDefaultButton() > > Interesting. That makes *a* button respond to the enter key, but it > doesn't have anything to do with where the focus is. > > I suggest you try it. Based on the way it works in my program (that is to say, I have NOT looked at the code for the way JOptionPane is implemented) I beleive it is how JOptionPane gets its functionality. But since you were really asking for more than the way JOptionPane works, you should look at JComponent.getInputMap() and adding custom actions. Also: http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/doc-files/Key- Windows.html#JTable shows what all the default mappings are. Chas Douglass ========================================================================== TOPIC: Newbie question: handling arrays in separate class http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/72272e6c26a94a21 ========================================================================== == 1 of 3 == Date: Fri, Oct 22 2004 11:19 am From: "Tom" <[EMAIL PROTECTED]> I'm writing a sort of dicionary application for mobile phone and I though of having one class with all the data i.e texts sorted in 1dim. arrays of strings. The class should return one element from an array after providing a name of an array and a number of element in that array. That's the problem that I'm facing now and looking for solution. Tom Uzytkownik "Chris Smith" <[EMAIL PROTECTED]> napisal w wiadomosci news:[EMAIL PROTECTED] > In article <[EMAIL PROTECTED]>, toto- > [EMAIL PROTECTED] says... > > I'm new to Java and looking for solution to the following question. > > In my code I want to keep all my data in the arrays of strings in a > > separate class. > > I can not find a way to construct such a class that would return on > > request a specific string from a specific array. > > > > I looked through the java groups any did not find anything that would > > help me. > > If it's a trivial question please give me at least some guideline > > where to look for answer. > > Unfortunately, your question is rather vague. What data are you trying > to store in these arrays? Is there a specific set of arrays, or do you > need to be able to add or remove arrays of strings at any time? What > identifying information would you use to try to obtain an array; i.e., > are they numbered or named? > > With some more information, perhaps someone could help. Nevertheless, > it appears you're headed in the wrong direction with your design. The > goal should be to create an appropriate OO model of the application > data, rather that storing all of your data in some general-purpose data > structure. That's up to you, though. > > -- > www.designacourse.com > The Easiest Way To Train Anyone... Anywhere. > > Chris Smith - Lead Software Developer/Technical Trainer > MindIQ Corporation == 2 of 3 == Date: Fri, Oct 22 2004 12:32 pm From: Chris Smith <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > I'm writing a sort of dicionary application for mobile phone and I though of > having one class with all the data i.e texts sorted in 1dim. arrays of > strings. The class should return one element from an array after providing a > name of an array and a number of element in that array. > That's the problem that I'm facing now and looking for solution. See the java.util.Map interface, and its concrete implementations TreeMap and HashMap. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 3 == Date: Fri, Oct 22 2004 12:34 pm From: Oscar kind <[EMAIL PROTECTED]> Tom <[EMAIL PROTECTED]> wrote: > I'm writing a sort of dicionary application for mobile phone and I though of > having one class with all the data i.e texts sorted in 1dim. arrays of > strings. The class should return one element from an array after providing a > name of an array and a number of element in that array. > That's the problem that I'm facing now and looking for solution. In that case, an alternative is to use a ResourceBundle. It allows you to easily find texts for labels, as used in internationalized applications. In you case: - The labels are not that important, but could be useful. - As you can enumerate the labels (keys), you can add suffixes to the labels: original, translation, description - You can even: - Use a prefix that specifies the language - Use a suffix to destinguish between words and descriptions - Use unified labels to couple words: english.house.word=House dutch.house.word=Huis french,house.word=Maison To translate from english to dutch, you'd need these labels: english.house.word english.house.description dutch.house.word -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ========================================================================== TOPIC: background process: existing jsp/servlet or new applet? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22361eba54ae92f9 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 11:25 am From: [EMAIL PROTECTED] (robert) given an existing code base of jsp/servlet ala Struts; how best (efficiency of execution secondary, getting the code done primary) to support background processing: spec. database writes?? - post to the controller servlet which spawns a thread to do the db update, then sends a response back to the browser. all using the existing infrastructure. adv.: the application comes back fast. disadv.: one loses contact with the db update, so confirming that it worked is some work. - add an applet, which spawns a thread to do the db update. adv.: the applet can keep track of the update, and can respond with update status with a bit less work. disadv.: integrating the applet with the existing L&F of the jsp. oddly (it seems to me), i can't find any discussions of these alternatives, either on c.l.j or various servlet texts. BobTheDataBaseBoy ========================================================================== TOPIC: Office/Computer/Nerd/Geek gifts and clothing http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/303d3459380b9728 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 12:00 pm From: Rogue Chameleon <[EMAIL PROTECTED]> Hi all As Christmas approaches, I've begun receiving invitations to Secret Santa gift exchanges. In the past, I've been very bland and purchased gift certificates for people. This year, I want to put a little more effort into the process and come up with some clever gifts. There are some sites out there that have unique gifts available that are tailored towards the "techie crowd". A couple of them that I know of are: www.despair.com www.thinkgeek.com I was hoping to that you guys may know of some more... anyone? ========================================================================== TOPIC: log4j and console in ANT/JUnit task http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2767a082c474af64 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 11:31 am From: Oscar kind <[EMAIL PROTECTED]> BlueDolphin <[EMAIL PROTECTED]> wrote: > BTW, I am using ANT's JUnit task to run my program, does that affected > something? No, but yes. You still need to make sure the loj4j configuration file is loaded. So in this regard nothing changes. But, the way the log4j configuration file is loaded now may differ from the way you usually do this. So it is something to verify again. -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ========================================================================== TOPIC: Logging configuration file w/ web start http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/647b28fc11be9145 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 11:37 am From: Oscar kind <[EMAIL PROTECTED]> Tobias Besch <[EMAIL PROTECTED]> wrote: [reorganized to put the most important part on top] > What is the proper way to specify a logging configuration file for > Java Web Start? I generally prefer to locate the log4j configuration file myself, and feed it to log4j. This has the advantage that the file can be picked up from anywhere in the classpath. Even from the jar file that also contains your application. The advantage is that it always works. The disadvantage is that is difficult to customize. For the applications I write, this is not a problem. YMMV > java -Djava.util.logging.config.file=myLogging.properties -classpath > my.jar -jar my.jar A side note: if you specify the -jar option, both the -cp and -classpath options are ignored. Use the Class-Path header in the manifest to extend the classpath. -- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2 ========================================================================== TOPIC: I renounce the 1st to 33rd degree of Freemasonry------------------ http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/212a98ee72e0a3a4 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 12:14 pm From: Keith Thompson <[EMAIL PROTECTED]> [EMAIL PROTECTED] (Granite Stone) writes: >> Yes. That must be it. We're ALL brainwashed and only you see things as >> they really are. >> <LOL> > > Your a Nazi, admit it. My father and grandfather were Freemasons and > died racist with hookers in their bed. Telling me Freemasons went to > the concentration camps to join is not going to work with me. LONG > live Israel!!!! If you must post a followup, *please* drop the comp.* newsgroups. -- Keith Thompson (The_Other_Keith) [EMAIL PROTECTED] <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this. ========================================================================== TOPIC: GUI - GUI value passing http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/427d1d7372619486 ========================================================================== == 1 of 2 == Date: Fri, Oct 22 2004 12:16 pm From: "paul.foreman" <[EMAIL PROTECTED]> Hi, A quick newbie question. >From a window created by extending Frame, I have created a new child window also based on extending Frame. I need the user to select a value in the child window which then gets passed back to the parent window. The child window then is closed. Any pointers would be welcome on how to get the user selected value back to the parent window. Regards Paul == 2 of 2 == Date: Fri, Oct 22 2004 1:01 pm From: Michael Rauscher <[EMAIL PROTECTED]> Hi Paul, paul.foreman wrote: > Hi, > A quick newbie question. > > From a window created by extending Frame, I have created a new child window > also based on extending Frame. > > I need the user to select a value in the child window which then gets passed > back to the parent window. The child window then is closed. > > Any pointers would be welcome on how to get the user selected value back to > the parent window. you could use a listener. public interface ValueListener { public void valueChanged( Object newValue ); } class ParentFrame extends Frame implements ValueListener { // ... protected void createChildFrame() { ChildFrame frm = new ChildFrame(); frm.addValueListener( this ); frm.pack(); frm.show(); } public void valueChanged( Object newValue ) { // do s.th. with the given value } } class ChildFrame extends Frame { ArrayList listeners = new ArrayList(); // ... public void addValueListener( ValueListener listener ) { listeners.add(listener); } protected void fireValueChanged( Object newValue ) { Iterator it = listeners.iterator(); while ( it.hasNext() ) ((ValueListener)it.next()).valueChanged(newValue); } } Now, react to the selection with a call to fireValueChanged. In more complex situations it's worth using MVC. Bye Michael ========================================================================== TOPIC: Struts FileNotFoundException with no stack trace http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbe491ea696843a ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 12:33 pm From: [EMAIL PROTECTED] (Brian J. Sayatovic) I found the problem. My Action class's execute method was marked as throwing Exception, and an underlyign FileNotFoundException was being thrown. Unfortunately, Struts' RequestProcessor seems to only print the .toString() of the Exception and not its stack trace, so it can be quite confusing. Regards, Brian. [EMAIL PROTECTED] (Brian J. Sayatovic) wrote in message news:<[EMAIL PROTECTED]>... > I was testing a new ActionForm and Action in Struts 1.1 under > WebSphere 4.0 when I encountered an exception. There was nos tack > trace in the client output, nor in the server output -- just a single > line: > > WARN org.apache.struts.action.RequestProcessor - Unhandled Exception > thrown: class java.io.FileNotFoundException > > I turnedon Struts debugging via log4j and got a bit more info: > > DEBUG org.apache.struts.action.RequestProcessor - Processing a 'POST' > for path '/test' > DEBUG org.apache.struts.action.RequestProcessor - Setting user locale > 'en_US' > DEBUG org.apache.struts.action.RequestProcessor - Storing ActionForm > bean instance in scope 'request' under attribute key 'testForm' > DEBUG org.apache.struts.action.RequestProcessor - Populating bean > properties from this request > DEBUG org.apache.struts.action.RequestProcessor - Validating input > form properties > DEBUG org.apache.struts.action.RequestProcessor - No errors > detected, accepting input > DEBUG org.apache.struts.action.RequestProcessor - Looking for Action > instance for class com.testwar.TestAction > DEBUG org.apache.struts.action.RequestProcessor - Creating new > Action instance > WARN org.apache.struts.action.RequestProcessor - Unhandled Exception > thrown: class java.io.FileNotFoundException > > I'm not sure what's causing this. Has anyone else ever encountered > this with Struts? How abotu some diagnostic suggestions? > > Regards, > Brian. ========================================================================== TOPIC: Unable to establish a socket connection http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3db1070c05ec0b49 ========================================================================== == 1 of 1 == Date: Fri, Oct 22 2004 12:59 pm From: [EMAIL PROTECTED] (S J Rulison) "Filip Larsen" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > S J Rulison wrote > > > Can somebody please give me a clue as to what I'm doing wrong here? I > > have a JAVA Applet and Server application written in JAVA version > > 1.4.2_05 running on a Windows XP platform. I use the socket(String > > host, int port) class on the applet side to establish a connection > > with the Server and the ServerSocket(int port) class on the server > > side. When I run both the Server and Applet on the same workstation, > > everything works fine but if I move the Server portion onto another > > machine, I am unable to establish a connection with that Server. > > You do not write what exception you get, but a guess would be that your > experience the security manager denying your applet to connect to any > other host than the host from where the applet came. If that is the > case, try use Applet.getCodeBase() in the applet to check that the host > really is the one you think. In fact, you can use the code base URL > directly to ensure you always connect to the originating host by using > getCodeBase().getHost() as the hostname when you create your sockets. > > > Regards, Actually, I didn't get any exceptions. And I guess I should have mentioned that in my original post. Thnak you for the headsup on the getCodeBase() & getHost() methods. I will look into that and see if that fixes the problem. Thanks again. Sincerely, Steve Rulison. ======================================================================= 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
