comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * [Job-SF, CA] Database Caching Engineer - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b2cb84ed75da72e7 * interface design question - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d83b38c5dae9f704 * Simple problem - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/78e14eea63ba6eea * Language Q: widening and narrowing conversions and casting - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d457f06bf9de5ff * execution speed java vs. C - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8713e999b13b7d1 * Another simple problem - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f3052e16ead05747 * Java program is not evaluating String value correctly... - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d457b2bb465740e * Where do they go? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/13296f4262fb9757 * "static" prefix - to parallel "this" prefix - 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5dde10882ac2157 * MIDP MIDlet: which characters are supported in the phone font? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/73bdfdf7f36c6ea0 * Using hobby source code in your job ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4 * Problem wtih Java ThreadGroup.activeCount method - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80c6f5e77859ec02 * Unable to establish a socket connection - Got it! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3db1070c05ec0b49 * Tomcat admin web app? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cff3ddac8a2f143a * NoSuchMethodException when reflecting ServletContext as a parameter - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a447e67bb400d60c ============================================================================== TOPIC: [Job-SF, CA] Database Caching Engineer http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b2cb84ed75da72e7 ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 1:43 pm From: "hiTECH.RECRUIT" Hi all, Our client is a leading enterprise software company in San Francisco - App Server/Application Development & Devployment Platform. They're currently growing their Technical team, and would like to hear from all of you talented engineers out there. Below is a description of the opportunity. To express interest, please contact/send resume to [EMAIL PROTECTED] --Database Caching Engineer-- Location: San Francisco, CA Our client's solutions empower enterprise developers to rapidly create composite, event-driven applications that inherently deploy to horizontally scaled, commodity computing environments. Responsibilities: " Create an XML data model of heterogeneous data sources. " Create object mapping to heterogenous data sources. " Create a dynamic, queryable cache of data sources across a super cluster of machines. " Enable writes to be layered on top of the cache and then optimistically persisted to the data sources. " Integrate with transaction monitors for multi-phase commits. Requirements: " Outstanding, accomplished coder. " 5-10 years experience in the areas described. " Infrastructure software (BEA, IBM WebSphere, Borland, etc.) " Excellent People Skills " Excellent problem solving capabilities " Able to succeed in a fast-paced start-up environment ============================================================================== TOPIC: interface design question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d83b38c5dae9f704 ============================================================================== == 1 of 2 == Date: Thurs, Dec 9 2004 1:42 pm From: Starshine Moonbeam In article <[EMAIL PROTECTED]>, Rajarshi Guha ([EMAIL PROTECTED]) dropped a +5 bundle of words... > Hi I have an interface : > > public interface Model { > public void build() throws ModelException; > public void predict() throws ModelException; > } > > Now i have a set of classes which are really specializations of this > interface. That is all classes will need to implmenent an extra function > (say initModel()). So I defined a new interface inheriting from the above: > > public interface RModel extends Model { > public void build() throws ModelException; > public void predict() throws ModelException; > Object initModel(); > } > > However what I really want is that initModel() is to *only* be called in > the constructor of these classes - so ideally initModel() should be > private. However Java does not allow me to do this. No. You have to make a call to the superclass constructor too. Make the same call as you would to the subclass constructor. Public Blah(String name) { super(name) // YOU MUST HAVE THIS LINE BEFORE ANY OTHER STATEMENTS // IN THE CONSTRUCTOR } -- Starshine Moonbeam mhm31x9 Smeeter#29 WSD#30 sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM == 2 of 2 == Date: Thurs, Dec 9 2004 2:05 pm From: Eric Sosman Rajarshi Guha wrote: > Hi I have an interface : > > public interface Model { > public void build() throws ModelException; > public void predict() throws ModelException; > } > > Now i have a set of classes which are really specializations of this > interface. That is all classes will need to implmenent an extra function > (say initModel()). So I defined a new interface inheriting from the above: > > public interface RModel extends Model { > public void build() throws ModelException; > public void predict() throws ModelException; > Object initModel(); > } > > However what I really want is that initModel() is to *only* be called in > the constructor of these classes - so ideally initModel() should be > private. However Java does not allow me to do this. > > Is there a better way to achieve this? [...] Others have addressed your question about super(), but I think your difficulty with initModel() is self-inflicted: if it's a private part of the implementation, don't publish it: leave it out of the interface altogether. True, this will mean that you cannot force every subclass to provide an initModel() method -- but if the method is only intended to be called from inside the class' own constructors, who cares? You aren't going to call the method from anywhere else, so you don't need to know whether it exists or not. Take it out of the interface and make it private -- simple as that. -- [EMAIL PROTECTED] ============================================================================== TOPIC: Simple problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/78e14eea63ba6eea ============================================================================== == 1 of 3 == Date: Thurs, Dec 9 2004 1:43 pm From: Starshine Moonbeam In article <[EMAIL PROTECTED]>, stud ([EMAIL PROTECTED]) dropped a +5 bundle of words... > super (reason); super(reason); -- Starshine Moonbeam mhm31x9 Smeeter#29 WSD#30 sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM == 2 of 3 == Date: Thurs, Dec 9 2004 1:57 pm From: Eric Sosman Starshine Moonbeam wrote: > In article <[EMAIL PROTECTED]>, stud ([EMAIL PROTECTED]) dropped a > +5 bundle of words... > > > >> super (reason); > > > super(reason); super ( "mart" + "inet" ) ; -- [EMAIL PROTECTED] == 3 of 3 == Date: Thurs, Dec 9 2004 2:45 pm From: Starshine Moonbeam In article <[EMAIL PROTECTED]>, Eric Sosman ([EMAIL PROTECTED]) dropped a +5 bundle of words... > Starshine Moonbeam wrote: > > In article <[EMAIL PROTECTED]>, stud ([EMAIL PROTECTED]) dropped a > > +5 bundle of words... > > > > > > > >> super (reason); > > > > > > super(reason); > > super > ( > "mart" > + > "inet" > ) > ; I'm marking for this. -- Starshine Moonbeam mhm31x9 Smeeter#29 WSD#30 sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM ============================================================================== TOPIC: Language Q: widening and narrowing conversions and casting http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d457f06bf9de5ff ============================================================================== == 1 of 3 == Date: Thurs, Dec 9 2004 1:53 pm From: Chris Smith jeffc <[EMAIL PROTECTED]> wrote: > Reading Mughal "Programmer's Guide to Java Certification". It talks about > widening and narrowing conversions of primitive data types. Widening is OK > (e.g. int to float). Narrowing causes loss of information. This makes sense. > > Now the confusing part, wrt reference types. It also calls upcasting a > widening > conversion, and downcasting a narrowing conversion. This makes sense from the > perspective that going up the class hierarchy is usually fine, but going down > is > usually not. What doesn't make sense is the "widening/narrowing" terminology, > and the loss of information. You are actually widening going down the > hierarchy, in terms of data size. You are also losing information, in a > sense, > by going up the hierarchy. (After upcasting, you no longer have access to the > class extensions, so your object is effectively smaller, not larger. To put it bluntly, a conversion from int to short doesn't "lose information" either. In each given instance, it either works splendidly, or it basically gives you garbage as a result (deterministic garbage, but garbage nonetheless for practically all purposes) So losing information is, from the start, a poor way to put it. Instead, think of these terms as "narrowing" and "widening" the range of possible values. For example, the set of possible values for int includes such numbers as 0, 15, 700, -49000, or 592000. The set of values of short is narrower (of the original examples, only 0, 15 and 700 are valid). Similary, the range of possible values for Object includes all of "17", Integer.valueOf(4), and new Date(), whereas the type String defines a narrower range, including only "17" out of the three examples above. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 2 of 3 == Date: Thurs, Dec 9 2004 1:57 pm From: "jeffc" "Eric Sosman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Comment: IMHO, "widening" and "narrowing" are the terms > at fault. They do not even describe conversion between > primitive types correctly -- for example, both int-to-float > and float-to-int can lose information, so which type should > be called "wider?" When this already sloppy terminology is > applied to reference variables, it loses what little sense > it had in the first place. Don't waste time trying to stuff > sense back into it. I appreciate that sort of comment because it does help with my understanding. I didn't mention this, but the main reason I was asking was for the certification exam.... I know how upcasting and downcasting work reasonably well, but that is not always the same thing as giving answers they want to hear :-) == 3 of 3 == Date: Thurs, Dec 9 2004 2:08 pm From: "jeffc" "Chris Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Instead, think of these terms as "narrowing" and "widening" the range of > possible values. Putting it that way does seem to work well for both primitive and reference types. ============================================================================== TOPIC: execution speed java vs. C http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8713e999b13b7d1 ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 1:59 pm From: Chris Smith James Kanze <[EMAIL PROTECTED]> wrote: > Still, IBM's support for Java should ensure > reasonable quality on an AIX -- maybe with Jikes instead of JDK? The compiler won't matter much at all. It's the VM that matters. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ============================================================================== TOPIC: Another simple problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f3052e16ead05747 ============================================================================== == 1 of 2 == Date: Thurs, Dec 9 2004 1:54 pm From: Starshine Moonbeam In article <[EMAIL PROTECTED]>, stud ([EMAIL PROTECTED]) dropped a +5 bundle of words... > ERROR: > invalid method declaration; return type required > invalid method declaration; return type required > > what's wrong here? > > class insertFailException extends SQLException > { > public insertFailedException(String reason) > { > super (reason); > } > public insertFailedException() > { > super(); > } > } > You need either a return type or void for your method. public String zoom() { } public void zoomZoom() { } -- Starshine Moonbeam mhm31x9 Smeeter#29 WSD#30 sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM == 2 of 2 == Date: Thurs, Dec 9 2004 2:18 pm From: Starshine Moonbeam In article <[EMAIL PROTECTED]>, Starshine Moonbeam ([EMAIL PROTECTED]) dropped a +5 bundle of words... > In article <[EMAIL PROTECTED]>, stud ([EMAIL PROTECTED]) > dropped a +5 bundle of words... > > > ERROR: > > invalid method declaration; return type required > > invalid method declaration; return type required > > > > what's wrong here? > > > > class insertFailException extends SQLException > > { > > public insertFailedException(String reason) > > { > > super (reason); > > } > > public insertFailedException() > > { > > super(); > > } > > } > > > > You need either a return type or void for your method. > > public String zoom() { > > } > > public void zoomZoom() { > > } > However, you're using constructors which don't have the same name as your class, which is why Java thinks it's a method. -- Starshine Moonbeam mhm31x9 Smeeter#29 WSD#30 sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM ============================================================================== TOPIC: Java program is not evaluating String value correctly... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d457b2bb465740e ============================================================================== == 1 of 2 == Date: Thurs, Dec 9 2004 2:03 pm From: "jeffc" "Shelly" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > if (ini.stateAbbr == "WI") { I think the problem is not that Java is evaluating String values incorrectly, the problem is that you're not comparing String values! Remember that every (object) variable is actually a reference, not the object itself. So you are asking if a reference to a String is equal to a literal string. Those are apples and oranges. As a newbie to the language myself, I'm a little surprised it even compiles, actually. I'm not quite sure why comparison of a reference value with a literal string would be allowed. == 2 of 2 == Date: Thurs, Dec 9 2004 2:43 pm From: Eric Sosman jeffc wrote: > "Shelly" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>if (ini.stateAbbr == "WI") { > > > I think the problem is not that Java is evaluating String values incorrectly, > the problem is that you're not comparing String values! Remember that every > (object) variable is actually a reference, not the object itself. So you are > asking if a reference to a String is equal to a literal string. Those are > apples and oranges. As a newbie to the language myself, I'm a little > surprised > it even compiles, actually. I'm not quite sure why comparison of a reference > value with a literal string would be allowed. The literal "WI" is itself a reference: it is a reference to a two-character String object that gets created behind the scenes, as it were, containing the characters 'W' and 'I'. So the two things being compared are two references, and the question being asked is "Do these two refer to the same String object?" And the answer (in Shelley's situation) is "No, they refer to two distinct String objects." The two Strings happen to have identical values -- they both contain 'W' followed by 'I' and nothing else -- but they are distinct String objects. There is a dollar bill in my wallet and a dollar bill in your wallet, and although they have the same value they are not the same dollar bill (if you do not believe this, send me my dollar!). The question Shelley really wants to ask is whether the two Strings have identical values, not whether they are the same String -- and as others have pointed out, the way to do this is with the equals() method. This is like recognizing that your dollar and my dollar have equal value despite being different dollars, but that my dollar and your ten-spot have different values. (Send me that one, too.) -- [EMAIL PROTECTED] ============================================================================== TOPIC: Where do they go? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/13296f4262fb9757 ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 2:10 pm From: Steve Horsley 2471 wrote: > I have just started programing and have started with java. It seems to > be going pretty good, but i have a question that i can not find an > answer to. When creating a data structure such as a linked list, i am > not sure how to remove a node. I mean i know how to make nothing point > to it so it is no longer in the linked list but how do i go about > removing it. The problem seems rather unimportant when using a small > sample size, but if say my linked list had 1,000,000 nodes and i remove > 500,000, it seems like a waste of computer memory to just have those > 500,000 nodes just hanging around with nothing pointing to them. > Java has a thingy called a garbage collector. It goes round retrieving the memory from objects that have been forgotten by the program, meaning objects that can no longer be reached by any active thread. You can forget an object just by overwriting all references to it, or letting them go out of scope (like when a method returns). You cannot instruct the GC to reclaim an object (e.g. garbageCollect(myObject)) because if you have a reference to the object (to point the GC at it) then by definition the object is still reachable and therefore not eligible for collection. Beginners worry about groups of objects with references to each other (e.g. in loops) being ineligible for GC, but the GC is cleverer than that - it doesn't use reference counting. You can have a circular linked list full of objects, and if you lose your last reference to the list, a thousand objects may become eligible simultaneously. A garbage collection sweep tends to happen when allocating new objects, but it really is up to the VM to GC whenever it feels is appropriate. The VM will try to reclaim all it can before it ever throws an OutOfMemoryException. Steve ============================================================================== TOPIC: "static" prefix - to parallel "this" prefix http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5dde10882ac2157 ============================================================================== == 1 of 4 == Date: Thurs, Dec 9 2004 2:16 pm From: "Darryl L. Pierce" Tim Tyler wrote: >>>Java's "static" context is an irregularitly - and an unnecessary one. >>> >>>If - for whatever arcane security reason, class members can't be >>>associated directly with the class objects, they ought at least to >>>be associated with *some* object. >>> >>>Otherwise you wind up with the Java situation - where there's a >>>whole bunch of extra material in the JLS to deal specifically >>>with static entities, how they are (or aren't) inherited - what >>>happens when a member variable overrides a static one in an >>>inherited class - and so on - all pointless irregularity that >>>makes the langage harder to learn, and makes parsers and compilers >>>more difficult to write. >> >>That scenario is already specifically handled: the descendant class's >>variable *hides* the parent class's variable, just as it would with a >>method. You don't inherit static fields or methods: they are explicitly >>tied to the class in which they're defined. > > I didn't claim that it didn't work - or that I didn't know how it > worked. I never said that you didn't. I said that the language specification specifically says how that *will* be handled. The way it's handled is not an accident, it's an intentional situation. <snip> -- Darryl L. Pierce <[EMAIL PROTECTED]> Visit my webpage: <http://mcpierce.multiply.com> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard == 2 of 4 == Date: Thurs, Dec 9 2004 2:15 pm From: "Darryl L. Pierce" Tim Tyler wrote: >>>Within the definition of a class you shouldn't need to spell out >>>the name of the class - you /should/ just be able to say "this class". >> >>You don't *have* to mention the class *except* to clarify the context, >>just as you do when you use the "this" keyword. > > Constructors are the most common mention of class names in the same > class. They replicate the name of the class at several places > within the class. The only alternative is not to use constructors > - and then you lose out on the inherited constructor from > Object - and implicit calls to super(). So? What does that have to do with the topic of using the classname to specify context? >>>>BTW, the above scenario doesn't happen in Eclipse: you refactor and >>>>rename the class and all of those references are updated. *AND* the >>>>references in *other* classes are updated too. Which brings up an >>>>interesting question: how will you refer to static methods/variables in >>>>*other* classes? Are we going to keep the ClassName.staticField pattern? >>>>If so, then we now have *two* ways of doing the *exact same thing* which >>>>to my mind makes the static keyword even *less* attractive. >>> >>>Actually there would be three ways: >>> >>>"ClassName.var" >>>"var" >> >> > ....or... >> > "static.var". >> > >> > They don't say quite the same thing as each other - though they >> > would all refer to the same static variable. >> >>And how does the above tell you *which* other class you're referring to? > > It doesn't. I never said it did. Then why did you write it in reply to my question? I asked a specific question: how will you specify the context for a static variable or field in a *different* class from the one referring to it? > I was just pointing out that the > claim that there were *two* ways of doing things was incorrect: A claim *I* never made. I said that you use the classname to specify context in an ambiguous piece of code. I never said there were only two ways to resolving this. > Actually two ways is the current situation - so your argument boils down > to an assertion that the current situation is undesirable ;-) No, it doesn't. My position is that the way it's done now is perfectly acceptable and that there's no need for a new keyword to specify what is already quite clearly stated by using the class's name for a static reference. >>I asked above "how will you refer to static methods/variables in *OTHER* >>(new emphasis) classes?" > > The same as normal. The proposal has nothing to do with that. The proposal, then, is unnecessary. Why do we need a *special* keyword to state what is *already* possible and clearly stated with the existing language specification? >>In this scenario "static" brings nothing new to the table [...] > > It deals with the situation where you are distingishing instance > variables, local variables and static variables in the *same* class. Something that is *already* done by using the name of the class. As I said, "static" brings nothing _new_ to the table. > The proposal was never supposed to improve the situation with other > classes. > > It is analogous to "this" in that respect. Except that "this" has a specific purpose that is not available otherwise. "static" doesn't do anything new or special, and the existing way to do it (what you've called "redundant") will *still* have to be available so that ClassA can refer to ClassB.SOME_STATIC_FIELD. >>and you will *still* have to type the classname to provide >>context to the compiler. So, in deference to your claiming it's >>redundant data, it's actually quite necessary [...] > > You should not have to spell out the class name repeatedly in > the class. Doing so is redundant - and it's a maintenance screw-up - > since you open up the possibility of the names getting out of step. You > /should/ be able to say something which says "this class". You're repeating yourself without supporting your statement. The fact is, you *don't* _have_ to "spell out the class name" at *all*....provided you give your static field or method a name *different from* an instance field/method and a parameter name. If you want to use the same name for a static field as a passed parameter, then you have to accept that you'll need to specify the context for the static field by using the classname to specify context. Changing the language spec to add a new keyword is rather daft since it doesn't prevent the underlying problem, which is the poor choice of variable names. > In a sensible language, you'd just use the class object: "class" - > but of course in Java, this doesn't work. The programming language will never be able to stop programmers from making poor choices. -- Darryl L. Pierce <[EMAIL PROTECTED]> Visit my webpage: <http://mcpierce.multiply.com> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard == 3 of 4 == Date: Thurs, Dec 9 2004 2:34 pm From: "Darryl L. Pierce" Tim Tyler wrote: > My claim is that the specification of how static objects behaves > is irregular, needs explicit support from the JLS, and makes the > language harder to learn, parse and use. Sorry I didn't include this part earlier. The way it's handled in the language specification now is clear and logical. It's not a kludge to cover up an underlying problem; it's a clarification that is part of what a language specification is intended to do. When you're dealing with static fields or methods, you're not dealing with instances. As such, you can't have one class being used polymorphically as another class. The only that that's polymorphic are *OBJECTS*, not classes. So, if you have FooParent with a static field named bar, and you create a child class named FooChild that has its own static field named bar, there is *no relationship* between the two static fields. That the JLS says FooChild.bar will hide FooParent.bar is a case of the JLS avoiding what could be an *ambiguous* situation for *compiler developers*. <snip URLs> > Smalltalk has an altogether more sensible approach: "static" methods are > ordinary instance methods of the object representing the class. And that makes no sense since static methods in Java are *not a part of any object*. The fact that you put the word static into quotes should have been a signal to you that something was amiss in your statement; i.e., that Smalltalk has something that's not static from Java's point of view doesn't mean the Smalltalk solution is what would work for Java. -- Darryl L. Pierce <[EMAIL PROTECTED]> Visit my webpage: <http://mcpierce.multiply.com> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard == 4 of 4 == Date: Thurs, Dec 9 2004 2:56 pm From: Esmond Pitt Tim Tyler wrote: > The only alternative is not to use constructors > - and then you lose out on the inherited constructor from > Object - and implicit calls to super(). Please explain these assertions. (i) If you don't write a constructor you get a default constructor with package access. (ii) Any constructor which doesn't call super(...) gets a default super() call built into it. (iii) I don't understand 'you lose out on the inherited constructor from Object' at all. ============================================================================== TOPIC: MIDP MIDlet: which characters are supported in the phone font? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/73bdfdf7f36c6ea0 ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 2:18 pm From: "Darryl L. Pierce" Michael Borgwardt wrote: >>> What is a "locale" and in which locale is "pi"? >> >> A locale is the region supported by the virtual machine, which will >> include such things as the character set, money and date/time >> formatting, etc.. I don't know which locale has "pi" in it. > > I don't think the locale is in any way relevant to the question. > The charset is used for converting between bytes and characters, > but it's not supposed to restrict which characters you can use. > > What you need to display mathematical symbols is most importantly > a *font* that supports those symbols, and I'm pretty sure there > are very few (if any) mobile phones that have fonts which support > them. In the US? Probably not. But, rest assured that in each country there are phones available that support that country's displayable characters. -- Darryl L. Pierce <[EMAIL PROTECTED]> Visit my webpage: <http://mcpierce.multiply.com> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard ============================================================================== TOPIC: Using hobby source code in your job ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4 ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 2:29 pm From: Christian Bau In article <[EMAIL PROTECTED]>, Albert van der Horst <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Grant Wagner <[EMAIL PROTECTED]> wrote: > >The bottom line is that if you write code for a living, you have to deal with > >the idea that at any time, for any reason, a past, present or future employer > >(or anyone else for that matter) can claim ownership of your idea. When that > >happens (if it ever does) you'll have to determine then whether it's worth > >fighting for. > > In case the idea is there before you are employed, you must pre-empt > by using a GPL copyright, and publishing. > > Then if you are using the same idea at an employers you point out > that re-implementing doesn't violate copyright. > They should be happy, you being the sensible person that you are. > They will ask you to give them extra rights in writing, but you > should simply refuse to do so. > There will be a lot of blather and booh's, but they will have to > - use the original and accept their code becomes GPL-ed > - believe you are sensible and will never try to > sue them, than re-implement > or > - give up This is nonsense. A company is not allowed to use someone elses copyrighted code without the permission of the copyright holder. In the case that the copyright holder licenses the code under the GPL, the copyright holder is absolutely free to license the same code under any other license. In the situation that you describe, the copyright holder gives the company permission to use the code - with no strings attached. If there is a contract that allows the company to use your code, then they have your permission to use it, and therefore it doesn't make the slightest difference whether the code is licensed under GPL or not. However, if you start with software licensed under GPL, and modify it, then you have no right to allow others the use of the derived work under any different terms, so it will be impossible for the company to lay their grubby hands on it. The only exception would be if _all_ copyright holders are employed by the same company and have signed the same kind of contract. ============================================================================== TOPIC: Problem wtih Java ThreadGroup.activeCount method http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80c6f5e77859ec02 ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 2:58 pm From: "avinashrk" Hi We hava base class server which creates worker threads and everytime it creates these threads it pushes them into a ThreadGroup thereby automatically incrementing the activeCount on this ThreadGroup.As I understand it when the child thread exits its run method, it should die and hence the ThreadGroup count should automatically go down.However this was not happening in my code. Initially i thought I might have written something wrong and so the run method hangs and some threads dont die. So I put some print statements to see if the worker thread was coming out of the run method and to my surprise it was and still the activeCount wont go down... Since there was some important decision logic based on this active count I just got rid of the ThreadGroup and kept a count of activethreads myself by using a varaiblw which was incremented for every thread created and decremented for every thread exiting out of its run method...So now the program works fine...mind you there was no other change i did..so the only thing I can point this to is some kind of problem with activeCount method in threadGroups....Has anyone else seen this kind of behavior? Any advice or tips would help Thanks Avinash ============================================================================== TOPIC: Unable to establish a socket connection - Got it! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3db1070c05ec0b49 ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 3:11 pm From: [EMAIL PROTECTED] Update: For what its worth, I setup a Windows 2000 web server and moved the java server and applet onto it. Everything is working great on it now. The getCodeBase().getHost() methods work so much better when the applet is running on an actual web server. Thanks again for your help. Steve R. ============================================================================== TOPIC: Tomcat admin web app? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cff3ddac8a2f143a ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 3:22 pm From: [EMAIL PROTECTED] (coder) When i click on the tomcat administration link at the default tomcat page, i get: "Tomcat's administration web application is no longer installed by default. Download and install the "admin" package to use it." I have tried and tried,but didnt find a download site for "admin package" Can anyone help me? ============================================================================== TOPIC: NoSuchMethodException when reflecting ServletContext as a parameter http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a447e67bb400d60c ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 3:33 pm From: "John C. Bollinger" natG wrote: > I am not new to reflection, but due to events, I feel new:). Well, you've hit one of the more common reflection stumbling blocks: matching reflected method signatures to method argument types. When a method's formal argument type is a non-final class type, you cannot just match the class of the argument to the method signature because the reflective method lookup methods look for an *exact match*. Such a match will not be achieved if the class of the argument is a proper subtype of the formal type declared by the method. In particular, you will *never* find a match when the formal argument type is an abstract type (such as the ServletContext interface). Similar problems can apply to primitive arguments, too, because they can be promoted according to method invocation conversion rules. (JLS 2ed, section 5.3) If you don't know in advance the signature of the method you want to invoke then for full generality you need to implement the method resolution procedure specified in JLS(2ed) 15.12.2 - 15.12.4. The compiler takes care of all that for you in standard method invocations, but you have to deal with it yourself when you use reflection. > When passing a ServletContext as a parameter to the reflected method, it > throws the NoSuchMethodException. Because whatever the ServletContext implementation class happens to be, it is definitely *not* javax.servlet.ServletContext. > Here is the exact simplified code that produces it. (Please excuse the > extra Invoker class, I use it to test non-servlet related reflection.) [edited for brevity:] > public class StaticMethodClass { > public static void methodA(ServletContext ctx, String s2){ > System.out.print("Hello from methodA: ctx s2 . You passed "+ s2); > System.out.println(" from ServletContext: " + ctx.toString()); > } > } > public class Invoker { > > Method m = null; > > public Invoker(String methodName, Object[] methodParameters){ > runCustomMethod(methodName,methodParameters); > } > > public void runCustomMethod(String methodName, Object[] methodParams){ > Class c = StaticMethodClass.class; > Method m = null; > Class[] parameterTypes = null; > if (methodParams!=null){ > parameterTypes = new Class[methodParams.length]; > for (int i=0;i<methodParams.length;i++){ > parameterTypes[i] = methodParams[i].getClass(); > } > } > try { > m = c.getDeclaredMethod(methodName,parameterTypes); You didn't say, but I can be pretty confident that the exception is thrown during execution of the above method. The method is not found because it is not there. To make this work reliably your invoker must get the list of all methods of the class in question that have the correct name, determine (according to JLS rules) which are both "applicable" to the arguments and accessible to the invoking code, and among those choose the "most specific" method. It is possible for there to be no single most specific method, which is a compile-time error in non-reflective code, but which you can handle however you want in your own invoker. > } > } > } > public class InvokeMethodServlet extends HttpServlet { > > ServletContext ctx = null; > > public void doGet(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException { > new Invoker("methodA", new Object[]{ctx,s1}); //this does NOT. [does not work, that is.] Do not be confused between the type of a reference variable and the class of the object to which the variable refers. They do not need to be the same. Even if the variable type is a final class type, the variable value can still be null (and that will cause your Invoker to throw a NullPointerException even though there may be a suitable method it could invoke). > } > public void init() throws ServletException { > ctx=getServletContext(); > } > } John Bollinger [EMAIL PROTECTED] ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
