« first day (2404 days earlier)      last day (2545 days later) » 

12:46 AM
@Unihedron Thanks @Uni! Worked for me too. :D
 
12:59 AM
morn
 
Hey @Tavo
 
how's it going?
 
Trying to study for the Comp TIA A+ exam.
Isn't it funny how complex display technologies are?
All this song and dance just so information can be transferred from the computer to our minds.
Incredibly inefficient.
 
1:15 AM
a lot of clever people are working on that. In a few decades we'll have viable technology to make things easier :)
 
I was thinking about the whole "dark theme" fad that is sweeping the software development world.
I bet we're going to look back in 10 years and find it silly how the default background color for most things was white.
A left-over from the times when we thought of a computer screen as a blank piece of paper.
 
and then again in 20 years the new trend will be a white background
 
True. xD
Black is so much easier on the eye.
 
particularly at night
no need to iluminate the whole room with the screen
I don't mind it so much during the day
 
I use dark themes whenever I can.
 
1:29 AM
is there a dark theme for SO?
 
rlemon made one for SO Chat.
Chrome only though.
 
Avast jumped when I opened the repo. Lol
 
Weird.
 
just installed it. It's going to take me a while to get used to it
it's... dark
 
That's the idea. xD
 
1:38 AM
yeah, the problem is the transition. Not having everything in dark is a bit annoying
 
Yeah.
The theme does a bunch of other stuff too, like give you the ability to hide oneboxes.
 
ooohhhh
I thought it was just a css
but it's got features!
 
2:32 AM
themoreyouknow.jpg
Off to bed, night.
 
3:14 AM
hi is anyone here?
im having a weird issue where a private class double variable that i set to 0.9 gets set to 0.0 instead as soon as the class instantiates.
would anyone be willing to give me a hand please?
 
3:33 AM
@Aequitas we might need a little bit more info than that
can you put your code in pastebin/hastebin/whatevertoolyoulike
 
3:44 AM
sigh I don't know why I still bother...
 
@Aequitas hey where is your code?
 
4:00 AM
"If you want to make your dreams come true, the first thing you have to do is wake up." -J.M. Power (source)
 
@Tavo sure, is github okay?
here's my github link
the problem is in the "PercentageAI" class
those 4 doubles at the top
they change to 0.0 when the class instantiates
i have to reset them to what they should be (in the performTrading method in the same class)
 
4:21 AM
@Aequitas you are specifically calling super() in your constructor. Is your parent class changing those values?
 
nope
parent class doesn't even have those values
 
declare them final
 
okay that seems to work
why would that affect it?
thank you
 
final means that once set, nothing will change them. Not sure what is changing the value, but final would have fixed it
 
how could something be changing it though?
if I was doing it declaring them final would give an error right?
 
4:27 AM
yep. That's why I doubt you are changing them. Your error must be somewhere else
 
o/
terror attack on UK
 
\o
 
you should try debugging and see what happens with the values
 
its just zero
as soon as the class instantiates
somehow it's become 0 again after a bit of execution
 
ok, this is what's going on. Took me a while to figure out
when you run your main, you are calling the constructor. When the constructor is called, the first thing it will do is invoke super(), whether you invoke it manually or not. That means it will run through the code of superclass first. After that, it will carry on with the code of your class, and then assign values to the variables that you see initialised as 0
in fact, if you change your constructor to:
public PercentageAI() {
super(10000.0);
System.out.println(buyPercentageThreshold);
}
you should see the value being 0.9
 
4:42 AM
oh
it never gets there
 
as I said, your problem was somewhere else
 
so because theres an infinite loop in the super constructor it never reaches the subclass constructor?
 
you are probably never returning from super()
you have an infinite loop in a constructor?
 
yep
please dont crucify me
 
TYL
the purpose of a constructor is to initialise. Avoid putting complex logic inside
 
4:45 AM
its coz I couldn't have an inherited main
 
inherited main?
 
this was a simple hack
 
you have some unclear concepts there
 
yeh I wanted all that logic in the main method of Trader (the superclass)
and then all the subclasses could inherit that main
and be able to run
 
well, time to rethink your design
 
4:48 AM
I have to do all this by myself in a week, so i just have to do what I can. I did post a question though regarding that and some people gave some cool solutions which i'll use next time.
 
even if you only have a week, spending a bit of time thinking rather than just writing code mindlessly will help you a lot
you'll often have time constrains in real life as well. Good coders are those who can deliver good solutions despite that, and not only a solution
 
yes thats true
but in uni you have to aim to get as best grades as possible, and as dumb as it sounds even at the expense of learning
 
I've been through uni as well, and I completely understand your point. That said, don't let grades get in your way. If you are to become a programmer, you'll face a similar situation in the future. Try to code in a way that, at the end of it, you'll have at least a mild feeling of satisfaction
either because you've learned something, because you've put your knowledge to a good use, or simply because you think you did a good job
The main reward of being a programmer is that mild feeling of satisfaction your code gives you when it's good quality (and works)
I do see some good things in your code, despite the issue you had
 
:)
thanks
 
5:06 AM
tavo :(
@Tavo whatsup?
 
not much, just work today
yourself?
 
6:01 AM
Do any have idea regarding:
 
@Pandya Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :)
 
@OakBot oh! ^^ this is not tech support.
 
@Pandya Type /help to see all my commands.
 
1 message moved to Trash can
@Pandya do not post code/stack traces here. Please use pastebin/hastebin/whatevertoolyouprefer
also no, this is not tech support
 
6:17 AM
@Tavo same
 
7:00 AM
@Tavo ok no-problem. I was not aware.
 
7:37 AM
hey @Tavo, regarding that earlier thing, shouldn't I have been getting errors about those variables not being declared at all?
why would it declare the variable, do the super constructor and then instantiate it
 
not sure what you mean. The variables are declared
 
like
public class{
private variable1 = 1;
it does the private variable1; part but not the =1 part
why is that
you'd think it'd be either all or none no?
 
no, you are confused
your IDE is clever enough to tell you that you are using a variable and whether it's been declared or not
 
so basically the IDE goes through your code and says 'oh, you are using a variable? Let's see if you have declared it'. It finds it and goes 'fine, it's there'
 
7:42 AM
but why has it been declared if the constructor hasn't been called yet
 
then you compile, and your code does not throw any compile errors, because the code is correct
 
shouldn't it fail at runtime then if it hasn't been declared?
 
declaring a variable has nothing to do with invoking a method
no. If the variable hadn't been declared, your code wouldn't compile
 
mourn
 
i don't really get it but i'll live with it
thx for trying
 
7:46 AM
what is it that you don't understand?
 
the declaration and initialisation is in the same spot right
so how can one of them happen but not the other
 
yes
I understand what you mean
but you are confusing terms
declaration means that you say you have a variable
that's all
if you remove the declaration of your variable, your IDE will tell you that you have an error (your code won't compile)
when you invoke the constructor, the variable you have declared hasn't been initialised. But the declaration is there
if you have a car, the engine is there despite you turn the key or not
(unless you left it in a really bad neighbourhood, but that's a different story)
 
lol
 
think of compiling as putting the car together
and calling the constructor as turning the key
if you don't put the engine, you won't even be able to turn the key, right? (if we consider the mechanism that allows you to turn the key as part of the engine)
 
In Java, classes are initialized in the following order: superclasses, static variables, static methods, instance variables, instance methods, and the JVM stops the initialization at the place corresponding with whatever you called.
I think
 
7:53 AM
okay so the constructor initialises the variables?
even though you have the "= 10.0" in a completely different spot
 
Might depend on the compiler
 
@Aequitas no. Invoking the constructor creates an instance of the class
and executes the relevant code
 
relevant code being?
 
whatever is in the constructor
the JVM also makes sure that the variables are initialised, the static blocks are executed...
the best way for you to see how all of this happens, and in what order, is for you to create an instance of your class and debug it step by step. You'll be able to see the order in which things happen
and there is a reason why you would go to the superclass first, before you go around initialising what's on your newly created object
 
i think i maybe kinda get it
but its still confusing cos it's in the wrong spot
i'm going to put all my initialising in the constructor from now on haha
 
8:04 AM
morning
 
o/
 
\o
 
@Aequitas it only matters in certain cases. I don't think there's a standard in Java to whether you should do it one way or another
also, it's good practice to declare your variables and parameters final whenever possible
 
@Tavo @Aequitas are you talking about the JVM ?
I am interested but just I would like to know the main subject of your question
I don't want to scroll up :p
 
we're talking about how if you declare and initialise a class variable and then don't finish the super constructor the variables don't get initialised
basically i made awful code and it had a weird side effect I didn't get
 
8:10 AM
@Aequitas you said it :P
 
Honestly, I didn't understand your question but I think it's something out of the JVM :p
 
:p
 
I was thinking you are talking about the JIT
 
i never said it was good code, but it did do what I wanted
 
@Aequitas that happens a lot more often that what you might imagine. Sadly
 
8:16 AM
@Hans1984 I will meet the chinese girls this night :D
 
good luck@Sayros
 
thanks :)
 
@Sayros hopefully they'll come without their tablets ;D
 
ah no no lol they won't :p
 
:D
@Aequitas when you call a method private double calculatePercentage(double initialPrice, double finalPrice) then let it return the right value :D
 
8:29 AM
@motaa what do you mean?
 
you method is called "calculatePercentrage" so let it return a "per cent"-age :D
wich means return initialPrice / finalPrice * 100;
just a little wisearsing ;)
 
oh lel
true
 
anyways @Aequitas the problem with your percentageAI is that your private fields are not initialized?
 
ye, it's because i have a loop in the super constructor
 
that's usual behaviour
 
8:34 AM
I am looking for a room dedicated for a financial stuff in Stack exchange :/
I didn't find one
 
personal finance
 
have you tried to set your fields to static?
 
@motaa I haven't but I've solved the issue by just assigning it later,
 
finanvial stuff "isn't really about coding" :D
 
@Aequitas no one there
 
8:41 AM
@Aequitas here are 2 links that shed light on the matter of loading order
https://stackoverflow.com/questions/23093470/java-order-of-initialization-and-instantiation

https://stackoverflow.com/questions/43154736/in-java-what-is-the-order-of-initialization-for-those-statements-after-main-met
 
9:13 AM
Morning
 
hey
 
@Hans1984 What's up?
 
another terror attack
sad day :(
 
Yeah :(
 
arent you from the UK ?
 
9:16 AM
Yes I am
Comiserations
 
yeah sad
and kids too :(
 
Terrible
 
yeah
 
Surely they're in a better place
 
lets hope so
probably couldnt be in a worse place than this earth
 
9:19 AM
well @Hans1984 should ask people who lived during ww2
 
@motaa So true
 
so?
 
I'd hate to live during then
 
im talking about the present
 
they would have said the same thing about the worst place
 
9:19 AM
I'm pretty sure we're safer than people who lived during WW2
 
one thing though is correct... it's earth :D
 
In affected areas
 
besides war ppls life was better back then
more peacefull
 
If you lived in London, I'd think it was difficult
 
noone said it wasnt difficult
its difficult nowadays too
just in different ways
 
9:23 AM
I guess
I've been working on this Algorithm for some time now, and it's confusing
I've been asked to: "Write some code that prints the year number and whether it was a leap year for each year from 1900 until the current year."
Here's what I've done so far:
Rules to govern whether year is a leap year: year % 4 == 0, year % 100 != 0, year % 400 == 0.
 
9:41 AM
do all teachers in all unis ask for the same stupid exercises?
 
I've got part of it ok. It's just that each year is coming up as "Leap Year"
 
@CrashBandicoot you are missing a parenthesis
 
Whereabouts?
 
in your leap year. I vagely remember the rule to be: (year%4 AND NOT year%100) OR year%400
that for a starter
 
@Tavo, that brings back all the Leap Years, which is great
I just need to figure out how to output the non-Leap Years too
 
9:49 AM
eh?
just add an "else"
 
Here's my improved code:
Hmm done that
 
also, change all your printf for println and remove your empty printf
 
@Tavo Perfect, Thanks!
 
and 62 other things that can be improved :D
 
xD
It was just the empty System.out.println() I needed after it
By improvement, is it the syntax, or the layout?
 
9:55 AM
remove it and use println instead of printf
 
Replace all printf() with println()?
 
I'll give you two quick ones:
your naming of variables is terrible.
your class naming is even worse
 
yeah always use println()
 
I thought printf() keeps things clean and short
 
9:57 AM
more like makes things messy
println writes stuff in a new line
so its more readable
 
Thanks for the advice guys!
 
alternatively, just add \n at the end of the line if you like printf better
now, time to go home
niters!
 
@Tavo Bye!
 
bye
 
Cheeeeeeeeeeeeeeeers
 
10:01 AM
hello
 
@geisterfurz007 hi
 
10:45 AM
hello :)
 
G'day :)
 
does anyone know how I may add a special case into this regal expression
^(0[1-9]|[12][0-9]|[01])[- /.](0[1-9]|1[012])[- /.](19|20|21)\d\d$
 
Im trying to add about leap years
 
10:47 AM
ill provide the method hold on will make it more clea
*clear
 
1) Your question is more directed to regex than to Java
2) I still do not get what the regex is supposed to find...
You probably want to have a look on regex101.com
 
ahh yeah my bad so String p is a regular expression pattern that will match any String that contains the date in the format DD/MM/YYYY (where D, M and Y are digits) with the range for a year between 1900- 2199 and only such strings
 
11:03 AM
@M.Jones Unsure whether that works or not, but using the matcher you probably can check the individual regex-groups for a valid date as well. So you keep your matcher and then do something along the lines of
Integer.parseInt(matcher.group(1))
and the same with the other groups and work from their through java code checking for the leapyears etc
Unsure if there is something like that, but I think so
 
alright ill give it a crack thanks :)
 
@M.Jones stackoverflow.com/a/8648129/6707985 This is an answer to a question similar to yours. As you can see, having that stuff as a regex is.... suboptimal to keep it friendly.
@M.Jones an alternative that is a better approach. Surround the parsing with a try/catch block and after the parsing in the try print "match" and in the catch "no match"
 
Hey Joe :D
 
How is everyone today?
 
11:15 AM
\o/ AMAZING
 
Good to hear
 
This evening I have not eaten any meat for 4 weeks :O
 
Why does this print out "Jim"?
Shouldn't it print out "Fred"?
 
Bragging or complaining?
 
both I think :D
I will see how long I will be able to keep it up. Had many creative ideas over the past days for ccoking :)
@CrashBandicoot hm.put ( 1, “Jim” ) ;overwrites Fred
 
11:21 AM
@geisterfurz007 I see, thanks!
 
Is there a reason you gave up meat?
 
Well I am living alone for a while now and I stumbled upon one of these typical "leave animals alone" stories. That gave me the thought I could take one week to try out some of the meatless products that are sold here. meatless sausage, pork etc. Some of that was absolutely horrible though. Then it became a challenge for me to keep beeing meatless up as long as I could without getting bored because I am eating always the same
I pick you Java-room @Joe'sMorgue
 
Do you know who Steve Erwin [sp?] was?
 
nope googling
 
System.out.println("Hello JAVA");
 
11:27 AM
Error: Mainclass could not be found
 
hELLO java
Houston...We have a problem
 
@ItachiUchiha If you have time, we can discuss ;)
btw, anyone comfortable with javafx ?
 
depends...
 
depends... ?
 
on how comfortable :D
 
11:32 AM
Ok, first question :
 
Why is the sky blue?
 
ready set go
 
How do you manage navigation in your app?
I mean navigation between modules
 
what do you mean with modules
@Joe'sMorgue Why did you mention him?
What is my name, how old am I and what is the meaning of life?
Just to add some more questions
 
He was a tad bit of an animal lover, as your research probably showed
You are older now than when you asked that question...
 
11:38 AM
If you have a crud app with people, towns, documents, ... management for example. Imagine just a complex app, consisting in some different modules. How do you manage switching from one to another?
 
He [Steve] looked into meat vs meatless lifestyles for humans, and he was all for raising animals for food, said it was better for the planet
 
Who You Truly Are is that Pure Being coming onto a planet (this planet or any other) to do various things.
 
@Joe'sMorgue Yeah :D But well my meatlessness (is that a word?) is not mostly because I love animals, but because I see it as a challenge :D
 
Yeah. I was just tossing something I learned into the room. The coding questions are above my skillset
 
@Julo0sS I hoped for a big red 42 on the screen and got disappointed :/
 
11:42 AM
hehehe :D
 
What's wrong with 42?
What did 42 ever do to you?
 
It is not on the page he linked :/
I love 42
do not get me wrong
I actually miss 42
 
You are THAT old, huh?
:P
 
Question two : Do you use FXML templates?
 
I am not that comfortable :>
@Joe'sMorgue 17
 
11:45 AM
Don't hurry to get to 42
 
oh wow
 
42 will arrive when it's time, not before...
There are advantages to 42, and disadvantages
 
I thought we were talking about the meaning of life 42
 
The meaning of life is different for everybody
 
What's 42?
 
11:48 AM
Advantages: people listen to you, you're probably financially secure, if you have children they are old enough to do their own thing.
Disadvantages: Reaching your toes is soon a forgotten trait.
;P
 
Accurate
 
@Tavo haha I was thinking the same thing :D
 
Also awww, this year's towel day is on jeebus goes to heaven day :(
 
You forgot an advantage: You can tell people to "GET OFF MY LAWN!"
 
Yeah, you probably have your own lawn by then
Depending on where you live I suppose
Might not be easy to have a lawn in downtown Tokyo
 
11:52 AM
They actually do...Many grow one in a type of flowerpot
 
I so don't miss working with Spring
@Joe'sMorgue I didn't say it was impossible, just not easy
 
I'm saying from what I've heard, many do...
How are you today @Gem
 
@Joe'sMorgue Yeah, some have a 20x20cm litttle brasspatch on their "balcony"
I'm doing fine. Apart fro trying to dispell Spring and JHipster :P
 
What are they spelling? :P
I heard that China is now building "vertical forests"
Have you heard about that?
 
They spell trouble and BuggExceptionOverLoad
 
11:58 AM
I actually hope that stuff like that starts... else it does not look good for our oxygen :/
 
Oh I heard about that. Sadly it won't do enough. The only thing that'll help is us not buying new sets of electronics every 2 years
 
Bosco Verticale (Vertical Forest) is a pair of residential towers in the Porta Nuova district of Milan, Italy, between Via Gaetano de Castillia and Via Federico Confalonieri near Milano Porta Garibaldi railway station. They have a height of 111 metres (364 ft) and 76 metres (249 ft) and will host more than 900 trees (approximately 550 and 350 trees in the first and second towers respectively) on 8,900 square metres (96,000 sq ft) of terraces. Within the complex is also an 11-story office building; its facade does not host plants. The towers were designed by Boeri Studio (Stefano Boeri, Gianandrea...
 
I like green roofs too
 

« first day (2404 days earlier)      last day (2545 days later) »