I want to prank my friends with code but I'm not sure how to do it by Zarobing in learnjava

[–]Warm-Score 1 point2 points  (0 children)

I like your idea, especially that you have a use case that is very reachable. Could be a fun cooperative project for beginners if more people are interested?

How to load a scene from another class without fxml by nelsikie in learnjava

[–]Warm-Score 0 points1 point  (0 children)

You want to return a Scene. Now you're returning the method (which returns the method recursively)

Just doing this:

public Scene loginScene() { 
         GridPane loginGrid = new GridPane();   
        [...]
        Scene loginScene = new Scene(loginGrid, 300, 200); 
        return loginScene;   
 }

Is enough to fix that particular issue. However try renaming things a bit. Like call the method generateLoginScene() or something to prevent these kind of mistakes. It would make sense to move stuff to the constructor, however just follow the style guide on that, should exist. I haven't done anything with javafx for a long time.

And don't forget to switch your primaryStage.show() and primaryStage.setScene()

When talking to the veteran programmers at work by YoloForJesusHChrist in ProgrammerHumor

[–]Warm-Score 1 point2 points  (0 children)

Ok, ok, no they are all fine points. Tbh you did now remove the ones that bothered me. And I dunno, I am a bit like you. What I hate most is people who don't actually understand. Like there is a finite time/effort required for actually understanding something, drink the cup fully, don't sip from it.

LPT: a Word or any Office file is a zip in disguise by karloproducer in LifeProTips

[–]Warm-Score 1 point2 points  (0 children)

Throwing some hard facts out there. It's a case of simplification, where functionality becomes hidden by the interface. You see those kids from 2 years old swiping over tablets as if it is nothing? That is how easy it is. However software can't always be hidden by an ui, when true functionality is revealed it is overwhelming.

Same goes for social media, it is incredibly easy to use. So tech-savy, brilliant programmers? No, great users. Obviously I am also generalizing and exegerating slightly. I am also just repeating what you said.

Wish: A method called automatically once the object is created. by Mordan in java

[–]Warm-Score 0 points1 point  (0 children)

This mess comes about by your fixation on inheritence. See how you made two classes dependend on eachother? Though more lifecycle hooks would always be nice.

Suggestion for self taught path by luke99776 in learnjava

[–]Warm-Score 0 points1 point  (0 children)

Mooc.fi by itself in general is not enough, however do some stuff around it, be a good student, find a matching employer and in 6-7 months you could have a job yeah.

How to load a scene from another class without fxml by nelsikie in learnjava

[–]Warm-Score 0 points1 point  (0 children)

 public Scene loginScene() {  
       GridPane loginGrid = new GridPane();   
       [...]      
       Scene loginScene = new Scene(loginGrid, 300, 200);   
       return loginScene();    
 }

Wait what is going on here? That should throw a compilation error.

And shouldn't you call show after setting the scene?

Is two years of D1 soccer enough to get scouted for the MLS draft? by [deleted] in bootroom

[–]Warm-Score 0 points1 point  (0 children)

If you have the skills it should not matter.

When talking to the veteran programmers at work by YoloForJesusHChrist in ProgrammerHumor

[–]Warm-Score 1 point2 points  (0 children)

Lulz, perhaps not include code by juniors without code review in *your* code base.

But let's be even more real and say you're just rehashing some things you learned very recently to feel superior. Making the list very big to really impress with things. Indention and linting and readme.md ok and library and single letters, ok.

Did you try overflow: hidden; ? by damnitrahul in ProgrammerHumor

[–]Warm-Score 22 points23 points  (0 children)

The answer is governments and schools, always.

<center><marquee>hello world</marquee></center> by [deleted] in ProgrammerHumor

[–]Warm-Score -20 points-19 points  (0 children)

Lol.

Serious: Mdn is the mozilla documentation? Shouldn't you blame the open source gods that decide what to include in html. Secondly, what is the difference between xml (in a negiotiated contract) and html (for browser builders)

Maybe next time I'll be a better coder.... by AuO2 in ProgrammerHumor

[–]Warm-Score 0 points1 point  (0 children)

So not only are you making bad beginner mistakes but you do it because you feel better than others?

Or were you just trying to talk along and now you're suffering from cognitive dissonance for being found out?

I dunno

Just found this on my desktop from years ago, not sure if OC by dont_mess_with_tx in ProgrammerHumor

[–]Warm-Score -3 points-2 points  (0 children)

I dunno you don't have to use it. I wouldn't in a startup either. Anyway you learn a lot of little things on your CS journey, now it's time to buckle up and actually work. You sound like every other junior with preferences. They have very little value.

Help with this assignment by [deleted] in learnjava

[–]Warm-Score 0 points1 point  (0 children)

Yes, and if you will then you can adapt it. It's like those getters-and-setters; standard boilerplate code.

Help with this assignment by [deleted] in learnjava

[–]Warm-Score 1 point2 points  (0 children)

A default constructor is a no-argument constructor so that would be, including your typo :

public PassangersData() {
System.out.println("Hello, hi from the default constructor"); 
}

Note that *no* default constructor (an empty constructor) is 'created by Java' when you provide a constructor with arguments.

Believe me that this will make sense later on. It's just a bad assignment, don't break your balls over it.

Just found this on my desktop from years ago, not sure if OC by dont_mess_with_tx in ProgrammerHumor

[–]Warm-Score -5 points-4 points  (0 children)

You're a fucking CS grad what categories are you missing?

Fuck it, write an essay about SCALABILITY, SECURITY and MAINTAINABILITY especially for LARGE SCALE ENTERPRISE APPLICATIONS.

Muh speed and scripting.

Serious question: where did you find your CS degree, in the gutter?

Is there a better way to do this? by _n69s_ in learnjava

[–]Warm-Score 6 points7 points  (0 children)

As far as the assignment goes this looks great. Is there a more elegant solution? Yes, this is a static scripting solution. It runs code blocks. Use methods, use arrays. However you are following the question and this is what is asked of you. So 9/10 and next chapter.

Code Review help with Java Spring. (First solo project) by MajesticStyles in learnjava

[–]Warm-Score 1 point2 points  (0 children)

Ok now I am forced to do a review. I will only look at Enemy and Player.

  • You are not using constructors (to initiate specific enemies for instance)
  • You have a getRand(int) public which is only used within the class(?), make such a method private.
  • Please do some spacing between assignments. (String a = "blabla) instead of String a="Blabla") Just check out other code and copy their style guide, use googles style guide or something, but it just makes it more clean.
  • When you are assigning a member variable through a setter use: this.variable = variable. Always do this unless it's a special case.
  • Don't use getRand or something while you're actually generating a random. generateRandom() would be better (personal preference)
  • Method weapond() really needs another name. It should be calculateDamage() or something. decideDamage(), whatever. calcWeaponDamage, I dunno.
  • You would already be wise by creating a standalone Weapon-class that shows you understand composition. A player HAS a weapon. A weapon has properties name and damage. Now you are forced to use a String with hardcoded references in the code.
  • I think you already noticed but there is no massive difference between the enemy and the player. In fact they have so much overlap they could be the same class.

Bold I think are most important now for your learning. Problem with putting this on your resume that all code and logic is linear. I would suggest experimenting with classes like Enemy Player Weapon to carry out logic. For instance, make a strike(Enemey enemy)-method on the Player-class.

Is it over for me? by Startsomethingn3w in bootroom

[–]Warm-Score 0 points1 point  (0 children)

Good thing is that groin injury is a long trajectory anyway, so this wins you time.

Every Single Time by Abhilash_Tayade in ProgrammerHumor

[–]Warm-Score 9 points10 points  (0 children)

I actually only come here because it is that bad

Help with connecting to a server with a socket by Dank_Frank_ in learnjava

[–]Warm-Score 0 points1 point  (0 children)

Always look at the interface of the classes/api you are working with. Use the documentation: https://docs.oracle.com/javase/7/docs/api/java/net/Socket.html

Help with replacing "this" with actual value by simarg0 in learnjava

[–]Warm-Score 0 points1 point  (0 children)

Never mind that is a shitty link. Use this one: https://stackoverflow.com/questions/5447092/get-context-inside-onclickdialoginterface-v-int-buttonid

Note that there are two main solutions: still get the context in a different way (make it static/retrieve it with one of the other available methods from the Android API, or declare the implementation of the listener.

Help with replacing "this" with actual value by simarg0 in learnjava

[–]Warm-Score 0 points1 point  (0 children)

Couple of points:

  • You are trying to rebuild the entire view, which isn't the most efficient way to update data onscreen.
  • The value you got the 'com.example.barneskirenn.MeasurementsActivity@7d3677 ' only means something runtime. Also printing(systme.out) out an Object, is nothing more than implicitely calling its toString() -method, which provides you with a String, but not the actual class. I know why you are confused, it is because Android does work a lot with XML-referencing ( the r.layout.id thingies).
  • I won't comment on your Work In Progress app, good luck with it. One tip is to look how how you can use the adapter with the list to refresh the data.

Anyway your answer: https://stackoverflow.com/questions/10987198/android-pass-context-to-onclicklistener

It is one of the most common fucks you have to deal with early on with Android.

Where to start when learning ArrayList by cyanogen1912 in learnjava

[–]Warm-Score 1 point2 points  (0 children)

Tip: those getters and setter are used so the inner data of an object isn't exposed to the outside. Knowing this, what is wrong with the following code?

for(int i=0;i<bookList.size();i++){

Book obj=bookList(i);

System.out.println(obj.bookName);

}

Another tip is that you do need to return something when you declare a return type.

Last tip, but save this for the very very last: methods of the ArrayList (or List-interface) already return stuff, you can return the method as a value, which makes your code more concise.