« first day (1439 days earlier)      last day (3495 days later) » 
00:00 - 11:0011:00 - 23:00

12:54 AM
Yo
 
 
5 hours later…
5:25 AM
yawns
 
AAB
5:51 AM
Hello
Need help understanding a simple concept
Java is pass by value
and references are also passed by value
so why does the code in class Sample not change
?
so why does it not point to Bad?
I mean point to
str holds a reference that points to the string object in memory?
 
6:06 AM
@Karl lolz
 
@AAB In Sample Class ?
 
6:36 AM
hi i need help...
 
shoot
@kiheru heya
 
did u known restdoclet
 
Hello @ItachiUchiha
 
@Darshan No Idea
@kiheru ssup ?
 
Nothing particular
 
6:39 AM
ahh
 
AAB
Yes
@ItachiUchiha
 
Its because String is immutable in Java
 
AAB
no
In the second code
the reference of B is copied
to the function and the str for object B points to new string
 
Nope. In the first Sample it does not change because the method local variable is changed, not a field
 
AAB
@kiheru
Hi
@kiheru @ItachiUchiha give me a moment my nets gonna go
 
6:48 AM
In the Sample2, you explicitly change the reference B.str, so it changes
hi @AAB
Nothing to do with immutability. That would work with any reference the same way
 
     public static void fun(StringBuilder str) {
		str.append("Good!");
	}

	public static void main(String[] args) {
		StringBuilder str = new StringBuilder("Bad!");
		fun(str);
		System.out.println(str);
	}
@kiheru Output and reason ?
 
@ItachiUchiha Bad!Good!
 
@Unihedron I know
isn't str local to fun ?
I am trying to figure out the difference In the first Sample it does not change because the method local variable is changed, not a field
 
Look... str points to a StringBuilder. We invoke StringBuilder.append().
 
note that you append to str, not change it. IE, access it through the reference
 
6:57 AM
In the other example, you throw away what you get.
 
in AAB's first sample, the method local reference is changed to point to another string
 
But, according to you, str is local to fun()
 
it is, but it points to the same StringBuilder instance
 
and incase of String it doesn't ?
 
If you did in fun: str = new StringBuilder("Good");, the output would be just Bad!
sure it does with a String too. See the above
 
6:59 AM
how about this ?
What is the output ?
 
Bad!
 
WTF?
 
str.concat returns a new string, does not change the argument
 
str.concat("Good!") does nothing to str. The method outputs Bad!Good! But you don't save that.
 
bad example
My bad
 
7:00 AM
I'll show you:
 
Eveyone Hail to Uni :P
 
class WithFields {
  private int x = 10;
  int getXPlusFive { return x + 5; }
  int setX(int x) { return this.x = x;}
}
 
5 mins ago, by kiheru
in AAB's first sample, the method local reference is changed to point to another string
 
@AAB's field example is like doing this:
 
This happens because String is immutable
the value is not overwritten and it references a new String in the String pool
 
7:03 AM
It would happen even if String was not immutable
 
{
  WithFields fields = new WithFields();
  echo(fields);
}
void echo(WithFields fields) {
  fields = new WithFields(); // This does nothing to the "fields" in {}.fields. Really.
}
His second example:
 
because what is changed, is the local reference str now points to the new string. The str reference in main() still points to the old one
 
@kiheru If String would have been a primitive type. I would have accepted this! But String being a class, this doesn't makes sense to me
 
{
  WithFields fields = new WithFields();
  echo(fields);
}
void echo(WithFields fields) {
  fields.setX(5); // This does something.
}
And @Ita's example is like this:
{
  WithFields fields = new WithFields();
  echo(fields);
}
void echo(WithFields fields) {
  fields.getXPlusFive(); // I'm not sure how you expect a change here.
}
 
Oh fuck!
I guess I am still under hangover
 
7:06 AM
xD
 
@ItachiUchiha You can consider references themselves primitive. (I don't think that terminology is used, but the effect is the same). The objects they point to are another matter
 
Shall I sketch?
OK, AAB's first example:
 
@kiheru Please save us from the wrath of Uni's sketch
 
Hold on, I'm out of paper.
 
Quite happy having a C background. Understanding pointers made understanding references trivial (of course, there's the drawback of needing to understand pointers first)
 
7:10 AM
@kiheru Haha, yeah !
 
Java is pass by value. No exceptions. When you pass an object, the passed value is a reference. If you change the value of that reference, the original value is still unchanged, just like with primitive values.
 
yeah, it struck me, how a big dumbass I was acting asa I read

void echo(WithFields fields) {
fields = new WithFields();
}
and it struck me BOOM
alcohol blasted away
thanks @uni
:P :P
 
Too bad, you're still going to get a sketch.
 
Oh no! :-P
 
Nooo.....
Glad that the sketch is blocked by the firewall :D :D
 
7:16 AM
!
 
Bad is never copied
str = "good";
 
The reference to literal string "Bad!" is copied as fun() is invoked with str parameter.
 
is similar to writing str = new String("Good");
so the local reference str now points to a new String
 
It's still copied during method invocation as a dummy variable. The reference change is after that.
 
The reference is copied... True~
"Bad" is copied.... False~
 
7:20 AM
Oh, yep.
1 min ago, by Unihedron
The reference to literal string "Bad!" is copied as fun() is invoked with str parameter.
The reference to literal string. :P
 
So your sketch confuses, it shows as if "Bad!" is copied :P :P
btw, uni
You are getting better at sketching ;)
 
The next one is harder...
 
lolz
Its messier !
 
That's why there are colors! :P
I don't want to build an animated gif since I'm using MS Paint..
 
I'll accept the first sketch !
Please no more sketches!!
@Gemtastic GM
 
7:28 AM
Hi @Gem!
Nah, too much work.
 
hello
 
Eh...
Want to play a game of tic tac toe instead?
 
yeah
 
Hi @HamZa
 
7:30 AM
@HamZa heya
 
Morning!
 
Kylar commented on the question WOW
 
@ItachiUchiha :)
 
AAB
@kiheru
I still don`t get ot
 
@Unihedron i need your regex powers.hahaha
 
AAB
7:39 AM
*it
Sorry for delay
net issues
 
@Kerppag Gimme the problem
 
AAB
str holds a reference
that reference is copied to
 
@AAB Scroll up and look at the pictures :)
 
AAB
the argument of fun
I did
so str in fun is a new variable
 
The point is this: Using str = "Good!" in fun only overwrites the dummy variable. main.str is unchanged.
 
AAB
7:40 AM
or a new reference
uh
 
fun.str is its own variable.
 
AAB
my heads spinning
ok but what does str hold when I pass an argument from main
 
@Unihedron im trying to implement an essay examination in my application. can regex help me if a part of the student's answer comes from web? im planning to do a web crawler to check if comes from other sites.
 
AAB
@Unihedron @kiheru
 
@Kerppag ... Do you know what regex is? :D
 
AAB
7:42 AM
what is passed to fun from main method
the copy of the reference right
 
A reference to the literal string "Bad!".
 
hmm wait ill try to reconstruct my statement.hahaa
yup.
 
AAB
ok
so the reference should now point to the literal string="Good"
 
You then throw away the reference from the dummy variable fun.str and put a literal string "Good!" to it. After fun() is finished, that dummy variable is useless, and main.str still points to "Bad!"
 
AAB
wait let me tell you my exact problem in understand this
say
String str1="Hello World";
String str2=str1;
 
7:44 AM
@Unihedron can regex help to check for grammar i mean? regex can extract string from a sentence right?
 
AAB
str1="Meow!";
str1`s reference is copied to str2
 
@AAB I'll label your three lines of code as "1", "2", and "3", ok?
 
AAB
ok
 
In 1, you defined the literal string "Hello World!" and stored a reference to it in str1. Now str1 holds a reference pointing to a literal string "Hello World!". Still following?
 
AAB
Yes
 
7:46 AM
In 2, you copy the reference, so now str1 and str2 both points to literal string `"Hello World!".
 
AAB
Yes
 
In 3, you're changing what str1 is pointing to, and assigning the reference to "Meow!" to str1. Hence, str1 now points to "Meow!". But note that str2 isn't pointing to str1 - It's still pointing to "Hello World!"!
 
AAB
Yes
so whats happening here is happening in fun to?
 
Huh?
 
AAB
A new reference is created inside fun.str
for str="Good!"
 
7:50 AM
Yeah, that's what dummy variables are...
 
AAB
:P
 
AAB
:)
thanks @Unihedron @kiheru
 
Of course, JIT will optimize that away, so 1 won't even happen.
@Kerppag Probably, if you can define the logic for it, you will be able to construct a matcher.
 
AAB
Well don`t know much about compiler optimization
I`m learning android programming
and well Java too I`m using the oracle tutorial and developer.android for android
any better sources u recommend
uh nets gonna go agin
be back in 5 minutes
:(
 
7:53 AM
kk
Oracle tutorials are great!
 
8:27 AM
@ItachiUchiha got time now? :P
 
8:55 AM
@ItachiUchiha crying
 
9:37 AM
Anyone up for a game of chess? I'm bored.
 
I'm back !
I am
But it should be accessible from the great firewall
 
yey!
 
Welcome back!
I was just, uh, playing chess with myself.
 
can I now ask you a question @ItachiUchiha ?
 
I have made some cry. Feeling sad
@miniHessel shoot
 
9:42 AM
1. When I move focus from a treeview to something else, the wholel F.ing treeview turns red?

For example, I have one treeview. Then I click a button and open up a ControlsFX dialog.. When I exit the dialog, the treeview is red !
 
I just stole your chess game :(
 
Arrrrg ! I am not able to access it
@miniHessel you can steal it
@miniHessel Have you applied any css on the treeview ?
 
yep
 
can you show it ?
 
there is no mention of red there, can you post an image of how the treeview looks ?
 
By the way, there's two treeviews there, only the one on the right gets the firetruck color..
 
Plesae help me
0
Q: Applying force on box2d body not working

user1726619I am trying to move a body by applying force on it. But instead of moving in horizontal direction and making a trajectory, it is just falling down like i have not applied force on it. Here is the code: public class Box2dTest implements ApplicationListener { private OrthographicCamera camera;...

 
Please dont use imgurl
@Unihedron please help with this image
where do you upload your images ??
 
4 messages moved to Trash
 
9:51 AM
@miniHessel Is that your treeview ? Seems to me more like a VBox
 
It's a treeview :P
 
Yeah! I beat Hessel in the game of chess!
 
lolz
 
He cheated
he said "FREE PAWN,COME GET IT"
 
haha
 
9:53 AM
and I of course do.. but it was a trap
 
Nope. It's fair and square.
Pun intended.
 
well played
 
Well played, good game!
 
are you understanding sh1t @ItachiUchiha ?
if I click on it, the red color goes away.
 
@miniHessel about the chess, yeah !
about the program, nope !
 
9:54 AM
me neither..
That damn controlsFX bs
Want the next question, while you think?
 
lolx
looks like you beat his ass off while the game just took off
@miniHessel shoot
 
I have a perfectly good help screen, looking damn awesome. BUT I want the help screen to change images dependend on what the user clicks on. I have say three different views, a view with tables, a view with visualization and a view called "combine".

If the user clicks on for example "combine"; then the help screen should be about combine.
 
that is easy
 
woho
me like easy
cause now I have a static string that changes.. that sucks
 
10:01 AM
why do have a static string which changes ? :O
 
cause you were busy yesterday
:P
 
I see, now its on me !
 
I want the help screen to change images dependend on what the user clicks on
It indicates you have 3 buttons, right ?
 
indeed
 
10:05 AM
Are your three different view "tables", "visualization" and "combine" on new stage ?
 
yep :()
 
what is the problem then ?
onAction() of each button you can load different FXML
 
butz, I also need to set images in the different imageviews ?
 
you can handle those inside the controller
each fxml will have its own controller
 
hmm, ellaborate please? In the controller for the help screen?
 
10:08 AM
or is there just one controller for all the help screens ?
 
ah, okay, that's more complicated, but probably smarter than what I thought about.
since it's basically only images with a next button
 
42 secs ago, by ItachiUchiha
or is there just one controller for all the help screens ?
 
I have just one controller for all three of them
timeout
so there is only one.
it's probably more cleaner?
 
ok, then you can pass an attribute to the controller
different attributes will be sent by diff buttons
 
attribute in form of a string?
 
10:14 AM
yeah, ObservableString
 
so then I dont need multiple FXML's right, since they all just use one imageview and a next button
but then the problem is that I want image1 to be viewed in the imageView to be set when the stage opens..
this is my helpscreen controller
 
are image1, image2 and image3 for three different buttons ?
 
each button should have several different images
 
I dont get you
 
Okay, each help screen has a series of images to show, and a next button.
 
10:22 AM
Pawn checkmate!
 
I won
finally
 
It clearly states white wins :D
@ItachiUchiha As you can see, I just made an if clause in the intialize
chat room died, cause @Unihedron won in chess
 
10:39 AM
No, I'm fighting spam!
I lied. I'm writing an answer. I want points!!
 
@ItachiUchiha left me, for someone else
how come there are zero explanations on the internet of how to write a ObservableString ?
 
10:57 AM
is whichView a static field in MainController ?
 
yep
bad design..
 
totally
create an ObservableString in IntroController
 
Okay, now my question is, how the f. do you create an observablestring?
I really can't figure it :P
 
00:00 - 11:0011:00 - 23:00

« first day (1439 days earlier)      last day (3495 days later) »