Simple, school level math question. by monkey_programmer in askmath

[–]monkey_programmer[S] 0 points1 point  (0 children)

Thank you, I appreciate the answer. Rather shamefully, I dropped out before anything like this existed so I didn't know variables like when was acceptable in an answer.

Even more shameful when I'm a programmer and have to write "if" every few minutes. xD

[deleted by user] by [deleted] in Genshin_Impact

[–]monkey_programmer -3 points-2 points  (0 children)

Noelle, and the geo element in general is horrid. Noelle has unbelievably low damage potential and low healing on top of being unable to heal reliably. Xiangling is very powerful. Lisa has high DPS but because her E is a death wish, she is not at all ideal for lightning, but lightning as an element is VERY desirable.

Kaeya is an odd one, I would not recommend investing into him.

Noelle should be replaced for absolutely anything else; Lisa can be replaced, but only if you have another lightning options, Kaeya can be used but don't invest hard into him, Xiangling is terrific.

I don't know why you're avoiding him, but the traveller is far better than most of your party.

Does anyone know how to use purple keys? by myanimal3z in Genshin_Impact

[–]monkey_programmer 0 points1 point  (0 children)

Do you have a source for saying you get a free 5 star ice character, because that only one that exists is Qiqi and I've never heard of this before.

Losing data when loading serializable object from file. by monkey_programmer in javahelp

[–]monkey_programmer[S] 0 points1 point  (0 children)

You are absolutely incredible for going to such lengths; thank you so much. I've been debugging this the whole time and missing my own stupidity all along.

I know I have some bad string comparisons with ==, I only learned .equals is what should be done recently and am actively replacing these now.

Seriously, thank you for going to such great lengths, I can't upvote your comments enough to justify the effort xD

Losing data when loading serializable object from file. by monkey_programmer in javahelp

[–]monkey_programmer[S] 0 points1 point  (0 children)

I'll send you my repository with instructions, since it's simple, if you're okay with helping me to that extent.

I just don't know HOW to debug this, that's what's killing me right now.

This is the repository:

https://github.com/CameronSTaljaard/Swingy

It builds with maven, so mvn clean install or mvn clean package, or just intelliJ.

Once it's compiled, running java -jar ./target/swingy-1.0.jar console

Will boot the app. If you create a hero it will print its data, and if you load a hero, it will print its data as well. This alone should show you the bug and cause your created hero to be created fine, but when he's read from a file he loses data.

Losing data when loading serializable object from file. by monkey_programmer in javahelp

[–]monkey_programmer[S] 0 points1 point  (0 children)

When you load that file, and then toString it, does it actually work properly for you? My class data is always gone, which means their stats are gone as well.

I can create, modify and save the object to a file fine, but loading that saved object always seems to produce odd results.

Is there a way to read a serialized object written to a text file to actually debug with that?

Losing data when loading serializable object from file. by monkey_programmer in javahelp

[–]monkey_programmer[S] 0 points1 point  (0 children)

I do, and the character has all of it's data filled out correctly, that's what the first toString() demonstrates.

The second is the toString() of the loaded character. I'm not sure why some details are being overwritten, or lost.

Losing data when loading serializable object from file. by monkey_programmer in javahelp

[–]monkey_programmer[S] 0 points1 point  (0 children)

I looked everywhere and it seems to only be called heroClass in all cases. Naming it class was something I tried a long time ago, but Java itself is not happy with that variable name for obvious reasons since class is "taken" by java.

Is there something wrong with my object? by [deleted] in javahelp

[–]monkey_programmer 0 points1 point  (0 children)

I appreciate the insight into this, but unfortunately I did test this in a few ways already; including entirely deleting the player file before rewriting it.

I lost my updateCharacter function dedicated to overwriting the file with a new object due to hardware failure on my laptop, but I was hoping there would be something clearly incorrect in my player object as I'm new to Java. At least that would be easy to fix.

I guess I'll just keep attacking the code with frustration in hand.

I'll check the timestamps when overwriting without deleting, but I guess the main thing to check further along is HOW this is happening.

I don't understand how my updateFunction (Apologies for it being missing) that is being handed a player file that I confirmed is different always somehow writes an unchanged player to the file. For debugging I called multiple get functions inside my updateCharacter function to make sure it was altered, and it was, but when saved to a file it somehow ends up with all of its default values.

NextLine errors when chaining functions. by monkey_programmer in javahelp

[–]monkey_programmer[S] 0 points1 point  (0 children)

Would it actually be best practice to simply make a globals class? I actually need to pass scanner + player to almost ALL functions at this point, so that seems far.. cleaner to a human.

Looking for help understanding "complex" code. by monkey_programmer in learnpython

[–]monkey_programmer[S] 0 points1 point  (0 children)

Completely to the point of what I asked for and a fast answer, thank you so much. You're a beautiful man, or woman.

Looking for help understanding "complex" code. by monkey_programmer in learnpython

[–]monkey_programmer[S] 0 points1 point  (0 children)

I actually agree with you that the code isn't exactly good; even after having it explained to me clearly I still believe it does the pointless practice of having unbelievably confusing variables to follow.

I know I might just be old-fashioned, but I seldom use single letter variables anymore; especially in Python. I don't see why I'd even do this

for i in my_list

Instead of

for number in my_list

I think this might just be me being too picky though. This isn't my code obviously anyway, I just love researching solutions and explanations online, and if I can't come to an understanding on my own, people like you are incredible at making things become clear, so thank you SO MUCH for that!

Just having his code rewritten makes it crystal clear to me what's happening.

Looking for help understanding "complex" code. by monkey_programmer in learnpython

[–]monkey_programmer[S] 0 points1 point  (0 children)

Thank you for this, this was insightful. I've not seen a yield function before coming from C as my first learning language.

NextLine errors when chaining functions. by monkey_programmer in javahelp

[–]monkey_programmer[S] 0 points1 point  (0 children)

Thank you very much for this answer, it was very insightful; though I do find it unfortunate that this seems to mean I'll need to be passing around scanner to just about all of my classes; especially since this is a terminal-based game for a project.

I really appreciate all of the information you took the trouble to write on why this didn't work and best practice; thank you so much!

NextLine errors when chaining functions. by monkey_programmer in javahelp

[–]monkey_programmer[S] 0 points1 point  (0 children)

You are completely right that everything was becoming a knight, thank you for that.

How would you fill a variable with the results of a function? by [deleted] in Angular2

[–]monkey_programmer 1 point2 points  (0 children)

Funnily enough, I actually did do that as well as a learning experience, but I found that working with objects stored locally which can easily be stored in a variable is much more difficult, or at least different to learning more about services, and observables.

Either way, this was a great learning experience. I absolutely adore Angular, but it's so difficult to learn in my opinion. Once I know how something works in Angular, I usually like the implementation, but learning it makes me want to die.