@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3



Comments:

<0> ok. Now I'm wondering. Parsing an ascii config file, I figured I'd write a seperate method in the main cl***. Eventually I'll move the method over to a "tool cl***" but for now I used "private static void readConfig(File cfgfile)". It stores its findings in cl*** variables. Someone told me that "private static" is a little bit odd. I'm looking into this but am still a bit confused. Is it ?
<1> access modifiers are overrated. care about static vs. non static, forget the rest for the most part.
<1> in general whenever someone writes static methods beyond main(), people suspect a **** up, and perhaps often they are right. and if your program is small, and thus a few static methods, etc. are ok and OOP is not justified, then the access modifiers won't matter anyway.
<0> Clackwell: Hmm, sounds logical indeed.
<1> the access modifiers are for libs, large software, software that can be extended and needs to be a bit more secure in itself, not allowing plugins to ruin the whole show by accessing functionality they have no business using, etc.
<0> Clackwell: in this case it was a strict considered option. Basicly to prepare and end up with a "black box" so I can eventually (when its really finished) move the method away into the (what I call) tool cl***.
<0> Clackwell: aye, that I'm aware off. My main motivation for setting this private was just that. This isn't opensource, but should it be used by others it can't do harm. Thanks for the input.
<1> you are welcome
<1> i guess when developing in teams it is relevant, too.
<1> i make any method that i don't want my co-workers to use outside of the current cl*** private, for example, thus more or less clearly indicating "i did this on purpose, ask me before changing this"
<0> Clackwell: absolutely. At this moment its just learning for me, but I'm trying to start out the "right way" (even though thats a bit broad) hence my confusion.
<1> ok, good night :)
<2> big question is why are you using static
<2> hi Clackwell
<0> calchas: because its started from the main method.
<2> so



<2> called not started
<2> that has nothing to do with why you use static
<0> yes it does.
<2> carry on and explain then ?
<0> you can't call a non-static method from a static method unless you instantiate it.
<0> s/it/the cl***/
<2> why not instantiate it
<2> why do these properties all relate to all objects of the cl***
<0> calchas: because this cl*** has other methods which would become part of the instance, and I think thats a waste of memory. Next to that; I'm planning to move this method out of the way eventually.
<2> sounds like you are mixed up on how OO works
<0> calchas: perhaps, in this case I don't think so. Just because its OO oriented doesn't mean everything has to be treated as such.
<2> no, but this would seem to be a case where you should be OO
<2> is this a singleton ?
<0> calchas: this main cl*** is, yes.
<2> is it written as a singleton ?
<0> hmm.. no, its not written as one. If I'm not mistaken a singleton also instantiates itself, in this case thats not the issue.
<2> then it's awkward style that will likely bite you later
<2> sarcificing style and correctness for trivial amounts of memory and convenience seems wrong
<2> but knock yourself out and good luck
<0> calchas: hmm.. Perhaps. In short; the motivation behind it is to get code which needs to perform a seperate task (config file parsing) out of the main method. As I said above the eventual idea is to move this method into a "tool cl***" which can then be used to provide just that; easy tools for other programs.
<2> you shouldn't be doing logic in the main method
<0> In this case I'm pretty confident about the approach, but I guess only time will tell.
<2> then why ask
<2> we just answered your question
<2> have fun
<0> calchas: you asked, not me ;)
<2> wrong
<2> I saw your question
<0> Clackwell had already provided me with the things I wanted to know. After I thanked him you asked me :P
<2> I have highlighted to you what is odd about private static
<2> just trying to help
<0> calchas: which is appreciated, don't get me wrong.
<2> so long and good luck <eom>
<3> How do you escape parentheses in java regular expressions?
<3> Pattern.comple doesn't seem like like \(
<2> \\( in the string becomes \C in the regular expression
<2> hope that helps
<2> \(
<4> :)
<2> \ needs to be escaped in the string literal
<3> I want to match just (
<3> but since ( is a grouping operator in the regex, i need to escape it somehow.
<2> I guess I didn't just help then
<3> I don't want to match \(, I want to match (
<3> ;)
<2> so in the regular expression it has to be escaped as \( correct ?
<3> hmmm.
<3> it may be \\(
<2> yes or no
<2> I'm trying to carry you through the logic here, it's not a trick question
<0> dan-: keep in mind that the \ also needs to be escaped.
<2> NO
<2> stay with me
<3> So basically I just want to match (
<2> in the regex it has to be escaped to \(
<3> Yes.
<2> so the string p***ed to reg ex has to be \(
<3> I just found a little nugget in the Pattern cl*** docs.
<3> yeah, so you do a \\9
<2> so the striing literal has to be \\(
<2> it gets pased by the compiler to \( in the string



<2> ...
<3> Got it, thanks.
<5> does the try block break whenever an exception is thrown or does all code get executed in it?
<0> as I said, it needs to be escaped as well.
<2> it doesn't break, it just jumps to the catch or is p***ed up
<0> thats what bit me in the *** when started with regexps on Java too.
<3> worked beautifully, thanks.
<2> np
<5> ok, but practically that resembles the break instruction? :P
<2> no
<2> a break jumps to the next executable block, and that isn't a good modle for error handling
<2> see thejavatutorial.com, or Thinking In Java
<5> ok, i get it
<3> Are there any Integer-like objects that allow for a simple value increment?
<3> I'd use the primitive, but it needs to be an objectt.
<2> not in the std lib afaik, easy to create one though
<5> there is indeed an Integer object
<2> uppe and ?
<3> Yes, I know there is an Integer object. That wasn't my question.
<2> does it support increment or addition in any way
<2> it's just an imutable wrapper
<3> I'll just write one really quick.
<2> dan-, I'd write one
<6> immutable
<3> All it'll be is a primitive int container with an increment and a decrement method.
<2> nod
<3> What shall I call it though?
<3> Heh.
<2> Int ?
<3> Guess that wins.
<2> or DansIntegerWithOperations
<3> ick.
<3> No thanks.
<2> you are using packages other than the default package aren't you ?
<3> yes.
<3> I have my own package tree
<3> or whatever the terminology is
<3> for all of my own cl***es
<2> then it's easy to call it what it is even if it already exists
<3> Int is fine
<3> It's written.
<2> I thought jdk5.0 got you round that as well, but I don't play there
<3> I'm 1.4.2
<2> k
<7> anyone have a recommendation between geronimo and jboss? or know of any other free J2EE server thingie?
<8> i have a memory blank.
<0> time to restore a backup ;)
<8> i have a static object reference
<8> like myCl*** mycl***[];
<8> later on i have a metho to initialise this object reference
<8> mycl***[] = new mycl***[10];
<2> and?
<8> Well i want to get reference to the initialised object later on.
<8> so i made
<8> private static mycl***[] getCl***Ptr()
<8> {
<8>
<8> return deePtr;
<8> }
<2> why static?
<8> invoked in main.
<8> java seem to love static :)
<2> no morons love static
<2> you need to learn some OO
<8> lol
<8> Java should have reference :)
<2> you shouldn't be (in gewneral) calling methods or instance variables in main
<8> in general i know.
<2> main is not really part of your object (it is but best not consider it that way)
<2> know you don't
<8> its a main wraper for some object
<8> and its not an object.
<2> or you would have answered differently
<8> the object is else where and i want to work with that object.


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #java
or
Go to some related logs:

squid acl allowedsites
#AllNiteCafe
adding a variable to onmouseover
#linux
talib qualli
country was the most heavily bombed in the Vietnam war
vlad ru
ptptp cisco
#AllNiteCafe
#skype



Home  |  disclaimer  |  contact  |  submit quotes