« first day (2469 days earlier)      last day (2696 days later) » 

08:00
yeah, I saw geister's input
didn't know of that method :)
yea, it is quite handy
it (Array.toString()) uses String.valueOf internally
Anyone got a link to a very simple explanation of what annotations are/how they work?
@no
that's an annotation
there ya go
hah, exactly my point. writing a toString functionality is quite basic >_>
08:02
(it is a way to pass information which will be removed when compiled)
how do they work ? :D
Pass how? Like in a method?
it took me a while to comprehend that <.<
eventually dug in the compiler mechanism itself
the main reasons for annotation:
Passing information to the Compiler (@Override)
Runtime Processing
CompileTime Processing
simply said, if it encounters an annotation, it applies a strategy associated to that annotation
08:03
not necessarily
@Pigman168 An annotation is kind of a marker. This can be a marker for the IDE (IntelliJ uses them for instant feedback if you violate contracts you defined using an annotation (method my not return null for example), the compiler to ignore certain warnings, for yourself (like @Override) and some for the runtime (like @FXML for javaFX) that mark
for example, all @Override does is checking whether a superclass has that method and throwing a compile error if not
really, @Override doesn't provide any actual functionality
is that not a strategy? It checks the class structure and goes yell to you if it cannot find the parent method
strategy =/= functionality
I see, and a @EventHandler annotation registers the method or...?
well, to me a strategy is something it does based on the annotation, not simply throwing a forced error
also, you can make own annotationss which can be quite handy. You can also supply them with parameters
08:06
fields or methods or classes so that additional things can be applied. In case of JavaFX this means that they can be found by Reflection. If the annotation is missing this will not work anymore
@Wietlol you must be a dude from The netherlands
@Author(
name = "Crowley Astray",
date = "3/27/2003"
)
this for example let's you define the Author via annotation (whyever you'd want that)
Yea I saw that example, but how would you then use that again?
Just annotate it and then use the variables?
@KarelG i am
or a girl
08:07
gotcha refer to ya as " it " to be correct next time ;)
genderless
i have a gender
so that would be incorrect
TRIGGERED
transgender?
@Author
method { do stuff with "name" }
like that?
you need a word that can be used when the gender is unknown
not when there is no gender
08:08
you got me
what about retard?
Yes? :D
@KarelG actually, 'they' is the correct way if you don't know one's gender over the internet
@Wietlol the word is 'they'
is that not a plural noun ?
@geisterfurz007 that is sort of correct... it can be used when the gender is unknown
08:09
too
@Pigman168 What is done with it is always different. Annotations are not the easiest thing. How did you stumble upon them?
@CrowleyAstray "they
what most blacks say when they mean "their""
urban dictionary
however, since it doesn't have a gender, it became used as such. (if you ever played DotA for example, a killing spree line is 'Someone stop them!' although you are a single person)
@Wietlol not what I was referring to
8
Q: Is it appropriate to refer to a person of unknown sex by "it"?

ShaniI would like to treat a user as a non-gender noun and refer to it with the gender-neutral pronoun, it. E.g., The user defines two variables, x and y. It then multiplies each variable by a prime number. However, on Wikipedia I found this: The word "it", however, has an extremely impers...

interesting
> Both forms are probably acceptable to most people. Some find using they confusing/ugly because it is plural. Sometimes people use she as a compromise; but this is still rare. The choice is yours.
ok I guess. * back to work *
@geisterfurz007 Well I've used @Override frequently and I just started trying out some event handling but I wanna understand the logic behind it too.
Not just copy pasta from tutorials :D
08:11
@KarelG the most voted answer actually mentions they
Most people now use they, their, them instead: "The user does x. Then they throw their mouse(/mice?) out of the window."
@Pigman168 well, as long as you don't want to define custom ones, they are very straight forward
@Pigman168 @Override does nothing directly. It will show a warning though if the method after it does not override a method from the super-class (if you change the signature). I have no clue about event-handling though, sorry
Oh ok, I'll try to play around with making my own annotations :3
Thanks all!
@geisterfurz007 I actually believe it won't let you compile at all
@CrowleyAstray Indeed, my bad
it won't compile. Why would it be able to compile ? lol
08:15
Oh, "public @interface annotation{}" interesting
breaks the class tree hierarchy if you allow it to compile
Made my own annotation :3 makes a little more sense now, kinda
Annotation.variable :D
whats ta difference in int c=(int)(a.length/2); and int c = a.length/2 ??
in that case: nothing
@geisterfurz007 o then in which case we use int c = a.length/2 ??
08:18
@SusHill actually, the first one is theoretically preferable. but nothing, really
however if the division would return a double value you need to cast to int if you want to save it as that.
okay thats clears it
@geisterfurz007 okay if the array length is more than 10 then i need to cast it in int
In the case you showed a.length is an int and 2 is as well. If you changed the 2 to 2.0 the later would not compile at all
@geisterfurz007 you don't actually need to cast it
it will simply trunk it
@SusHill Nope. Because int/int returns an int.
@CrowleyAstray automatically?
08:20
ye
i = 1/2
i = 0
Ye because it is an integer division
@SusHill since both operands in the / are integers, you get an integer result
If it does return a double implicated that at least one of the sides is double or float or something; sorry
well, in his example both operators are ints as well
if you do a.length / 2.0 , then you get a double result. You then can use (int) to cast it to int (but it looses the precision)
08:22
actually, you need to do that. if you explicitely divide it by a double (2.0) you get a compile error
2 mins ago, by geisterfurz007
In the case you showed a.length is an int and 2 is as well. If you changed the 2 to 2.0 the later would not compile at all
XD
>game is hard
I am basically only reading every second message
@geisterfurz007 for this kind of long length array eg {1,2,5,6,9,8,5,0,0,0,5,6,8,2,3,4,4}, i think its length will be always in number 2 digits, so i dont need to cast int in it yea ?
Is it advisable to make a class for all global constants?
@SusHill the size of an array is ALWAYS an int
08:24
@SusHill The issue is not with the length of the array. a.length will always be an int. int divided by int will return int as well in java. So you do not need to cast
Never!
Difference: a.length/2.0 int divided by double will return double. This would need a cast to fit into int
tbf there is no point to do that if you work with .length
you really shouldn't explicitely use doubles if you want to work with ints though
okay i saw it in someone blog casting int in an array length, so I was curious about that
unnecessary overload
@CrowleyAstray uhm uhm .... ` 5 / 2 ` ...
that is 2
if you want to work with int
08:26
depends of the situation
if you want to work with doubles, you could write 5/2.0, but then you also need to asign it to a double
@CrowleyAstray yea i got that
> if you want to work with int @KarelG
Sorry don't mean to spam but: should I make 1 class for all global constants?
Depends on the usecase. I for example have constants all over the place in the classes I think the belong to.
If you just want to have a simple repository of all constants for a game for example your idea might be a better one
08:37
Oh ok thanks
@Tavo I got 2k rep now. You are not getting me >.>
:o nice man!
Where can I see your answers? ;D
I personally wouldn't suggest a singly place for all global constants, unless you have the uncommon use-case of them being class-independent
You can see them one my profile :D But most of it is batch anyways :) It was what I started with and got around 1600 rep at least from it
@Pigman168 They will be cancelled anyways :)
:o cancelled? why?
08:43
If you upvote a massive amount of posts of one user in a short amount of time they are taken back by the system
To prevent botting behaviour and similar things
And I don't like it actually. I want to get reputation for contributing.
And not for beeing a nice person (which I am not anyways :D )
Haha but you did contribute, and you contribute to the chat for which you aren't credited ;)
08:45
I posted my question
good job
have a cookie
that is some real magic you want there
no reply from any one
08:46
search and replace in a stream?
check the duped question
I tried with normal text it worked
i want with regular expression
so i tied library
you will probably have to read out the stream, then convert it to a string, then do the replace, then convert it back to bytes, and then output it in a new stream
no , i dont want to convert to strring
*string
08:47
you do
you just dont know it yet
as it consumes memory
except if it is not a string itself
what is other alternative solution
Noone can post answers anyways.
It is a duplicate of the question linked. You cannot deny it... It is the same thing
Note: it actually is not because the regex is not able to be cast to strings in the way it should be
@Showkath how large is this byte array we are talking about?
08:49
a regex is an automaton. And you want to cast it on a sequence of bytes?
* CS skills tingles *
Counter Strike?
@geisterfurz007 not really true
Yeah just noticed. Made an edit above
so... the duplication is wrong
who can remove that?
our gracious overlords, the mods
08:50
the OP can unlock the dupe lock though
@CrowleyAstray can you be more specific?
(I can reopen it too)
well, either via community vote to reopen it or if you have enough rep
I htink you need the gold tag for java to do it
How come it wants me to do this:
enum Constants {; String test;}
@Showkath but back to the question, how large is that string/byte array?
08:52
@Pigman168 because that's not how enums work
could u just 2mins , let me ping you lenth
Oh, what did I do wrong? @CrowleyAstray
because you don't have any elements in your enum
only the attribute test
which you probably don't want
Ohhh I remember now haha, sorry
@Pigman168 the first members of enums are their values
in you case, everything between "{" and ";" which are placed next to each other
08:53
if you want an enum-element which can hold a String you need to do something along the lines of
element1("test")
and then define a constructor that accepts Strings
maybe there is a language barrier problem here
I'm not your buddy, pal
@KarelG specific lines?
check the comment in the answer box
@Pigman168 Did you really participate in the Blue Whale Challenge?
08:57
"Please explain more words."
lol
@KarelG just point him at "<String, String>"
@geisterfurz007 No, but problems and stuff ya know
@KarelG ow... he actually didnt have that in his answer before
huh.... If I can help, let me know :)
Much appreciated :)
Even if it is just listening, I try to be there for people ^^
08:59
it's a low quality answer tho. I'm lazy to provide help (and also that he wouldn't understand it :D)
stop being nice, it gives me the creeps
┴┬┴┤( ͡° ͜ʖ├┬┴┬ what's cooking?
@CrowleyAstray :)

« first day (2469 days earlier)      last day (2696 days later) »