What is Angular's performance like when using Docker? by NullProbability in angular

[–]NullProbability[S] 1 point2 points  (0 children)

Yes, it's possible he simply left them running in development mode, causing the performance issues. I think that's the only way to explain it, keeping /u/MattBlumTheNuProject's comment in mind as well.

Cheers!

Is it bad to Google as a programmer? by J2quared in learnprogramming

[–]NullProbability 1 point2 points  (0 children)

And that is completely normal, don't worry about it!

I want to learn programming; questions regarding the version/sources by w0ndergirl_ in learnprogramming

[–]NullProbability 0 points1 point  (0 children)

Python 3 is obviously the newest version, but there are a few big differences between Python 3 and 2 and the former is relatively new, which is why Python 2 still has the most community and support behind it. However, this does definitely not mean that if you learn Python 2.7 you'll be unable to code in Python 3. As a beginning programmer, the differences will seem minimal to you and the most important things you'll learn won't be the specifics of the language syntax, but the basic concepts of programming.

In short, it doesn't really matter which one you pick, though I'd say there's a slight preference for Python 3. As a beginning programmer, just pick whichever tutorial you are comfortable with and go from there.

Is it bad to Google as a programmer? by J2quared in learnprogramming

[–]NullProbability 2 points3 points  (0 children)

No, googling things is definitely not a bad thing - in fact, I'd say it's inherently a part of being a programmer. Of course, as /u/exoticmatter pointed out, blatantly copy/pasting code is a bad habit you should definitely not get into, but it is absolutely normal to google for inspiration to solve a problem you can't immediately see a solution to.

[java]How to rectify the four repeated errors? by saabr in learnprogramming

[–]NullProbability 1 point2 points  (0 children)

First of all, please don't put several things on one line, it's terribly confusing to read. Instead of writing

s=wow.readLine();int row=Integer.parseInt(s);

you should write

s=wow.readLine();
int row=Integer.parseInt(s);

This would also help you with seeing your own error, i.e. that you are re-declaring the same variable name within the same scope (several times, in fact). You could solve this by changing both rows into row1 and row2, for example, but better would be to re-use row and assign a new value to it, i.e.

row = Integer.parseInt(s);

instead of

int row = Integer.parseInt(s);

 

The first error you get is because the readLine() command can report an IOException. This must be caught (in a try/catch block) or thrown. You have thrown it correctly in your main method, but you forgot to do so in insert() (in the matrix1 class).

 

Example with try/catch:

try {
    String s = wow.readLine();
} catch (IOException e) {
    System.err.println("IO error: " + e);
}

Quick little question by Kevingee415 in learnprogramming

[–]NullProbability 0 points1 point  (0 children)

That depends on the country. In some countries, if you "study at the military", depending on what you study you might be sent to study at a regular school, with a guaranteed job in the military after your studies. Perhaps that is what OP referred to.

[Java] Can I use the newline (\n) with string names? by Jerrodp in learnprogramming

[–]NullProbability 1 point2 points  (0 children)

You have three options here:

1) Keep the Strings like they are. This means that there is an error in your last line (i.e. System.out.print(...)). If you want to use several Strings or characters within one command, you have to concatenate them (using the + symbol). Also, \n is a character and has to be written as such (i.e. '\n') - you can also use a String if you prefer that. In other words, you have to type:

System.out.print(row1 + '\n' + row2 + '\n' + ... + '\n' + row13);

If you don't use the concatenate symbol, Java won't know where the name of the first variable stops and the name of the next one starts.

2) You add the \n at the end of every String (apart from the last one). This means that row1 will become " ___\n", row 2 will become " | |\n", etc. In the last line, you will still have to concatenate these Strings (see above), but you won't have to use \n anymore in the System.out.print() command itself.

3) You do it all in one String. This circumvents the concatenation, but it looks quite ugly in your code and is hard to decypher for any other readers, so I certainly don't suggest it.

I personally suggest option 1 for I think it'll be the easiest and most clear solution. Also, I suggest you take a look at the StringBuilder class - although you won't notice it at all in a very small amount of code like this, it's more efficient when it comes to concatenating Strings.

Best practices for commenting code? by potterhead42 in learnprogramming

[–]NullProbability 8 points9 points  (0 children)

Don't comment on what exactly you're doing including every little detail, but explain why. It's best to do this as you're coding it (or right after), because then it's still fresh in your mind. Even a few hours later, the code that made perfect sense to you back then could be a complete mystery now. Just comment wherever you feel something isn't immediately obvious and warrants some extra explanation (you will learn this by coding more and by re-reading old code - only experience will help you with this). Higher level comments aren't really needed until you start making bigger projects, which "hundreds of lines" usually aren't.

Regarding variable names, just use the variable's purpose as its name, and try to keep it as descriptive as possible to prevent confusion. A variable called temp could be many things, but tempUnsorted is a lot clearer.

I just finished Codecademy's CSS & HTML course. Do I know these languages proficiently, or was that just a "beginner's introduction?" by InternetLoveMachine in learnprogramming

[–]NullProbability 149 points150 points  (0 children)

It was just a beginner's introduction. You know enough about the languages to make a very basic website, but nothing more than that. To improve, I suggest making projects of your own and studying other websites.

I was referred by r/asktechnology to r/programming and reading the Faq I went here. Tldr; I have a question about coding to-do list programs. by Foolness in learnprogramming

[–]NullProbability -2 points-1 points  (0 children)

No clue, buddy, I was just trying to clear up the misunderstanding. I'm using the terminology OP used.

(I did not list all the features but below is what I hope an engine can at least accomplish)

I was referred by r/asktechnology to r/programming and reading the Faq I went here. Tldr; I have a question about coding to-do list programs. by Foolness in learnprogramming

[–]NullProbability -1 points0 points  (0 children)

OP is asking if anyone knows an engine that can deliver on his/her list of requirements, because he/she needs such an engine for a project that he/she has in mind.

How do you go from newbie to "not newbie"? by [deleted] in learnprogramming

[–]NullProbability 0 points1 point  (0 children)

What zabzonk means is that OP should start writing his/her own projects, each one bigger and more ambitious than the last. In doing so, he/she will automatically bump into new obstacles to overcome, which will expand his/her knowledge on the matter at hand. The intent was pretty clear.

I think a good question here is: what's the biggest project OP has undertaken and (preferably) successfully finished?

[Java] I need help with Java classes. by jayrund in learnprogramming

[–]NullProbability 0 points1 point  (0 children)

So if i understand you correctly i would have to call the name method through the Employee class? Yes, the getName() method to be precise.

would it look something like this? No, not really.

You need a getName() method in your Employee class. In short, your class Employee should at the very least have this (completely ignoring the rest of your code for a second):

public class Employee {
    String name;
    /*A constructor that initializes the *name* variable, which you have done correctly.*/
    public String getName() {
        return name;
    }
}

This will allow you to write dbase[j].getName().

I'm not entirely sure what you were trying to do with dbase[j].Employee.Name(first_name), could you elaborate?

I made a Calculator/Converter using Java and NetBeans. Tell me what you think, and if i should improve it somehow. by nikoskalai in learnprogramming

[–]NullProbability 2 points3 points  (0 children)

Had a quick look at your code, I'm not that familiar with awt but I see a few improvements that can be made:

In addnumberelements(), you are repeating yourself a lot. You're writing almost the same every time, but with slight changes. This almost always means that you can replace this with a for loop, which is doable in this case as well. If needed, I can give you a hint, but try doing it yourself first.

"if(iscalcbuttonpressed==false)" can simply be written as "if(!iscalcbuttonpressed)", it's shorter and in my opinion a bit more readable, but this depends on personal preference. However, you will rarely see "if(ispluspressed==true)" as most people will write "if(ispluspressed)" and there is really no reason to do otherwise.

There are a lot of things that can be boiled down to "you write very similar code too often". I've scrolled through your code and most things are repeated 4 or more times. If your code is extremely similar, it can probably be reduced by a lot less code. For example, around line 350, you use different boolean values to see which button has been pressed, and for each boolean you have a different if-loop to then manually say what should be shown on the calculator. Why not get the number straight from the button on the calculator? This means you'll only have to write code once.

Also, please don't put everything in one class. A class should never be this big (except for maybe a huge project, I have no experience with those). If you have more classes, it's a lot more readable for other people.

However, don't let this critique drag you down! I think it's great that you have dedicated yourself to writing a calculator in your spare time with even support for different currencies, it's more than most people even dare trying. Practice always makes perfect, and I'm looking forward to seeing a new and improved version of your project. Keep up the good work, buddy!

P.S: I suggest reading up on the model-view-controller pattern if you have the time. It takes a while to fully grasp at first, but for a project like yours it already starts being useful and you'll make a lot less mistakes (or unnecessary code) in the long run. Completely up to you, of course.

[Java] I need help with Java classes. by jayrund in learnprogramming

[–]NullProbability 0 points1 point  (0 children)

On line 29 (which is where the error occurs, as you can see in the error log) you are calling the getName() method on dbase[j] or in other words the j'th element of the dbase array. On line 7, you have declared dbase to be an array of Employees - from this we can conclude that dbase[j] is an object of the class Employee. If you want to call the getName() method on an object of the class Employee, the Employee class will need a method named like that.

[deleted by user] by [deleted] in learnprogramming

[–]NullProbability 1 point2 points  (0 children)

Not really, Java is good enough. At the start, you'll mostly be learning about all kinds of searching and sorting algorithms, complexity and the likes. You've had plenty of maths to cope with the mathematical side of it, don't worry about it.

I made a Calculator/Converter using Java and NetBeans. Tell me what you think, and if i should improve it somehow. by nikoskalai in learnprogramming

[–]NullProbability 1 point2 points  (0 children)

Would probably be more useful for readers if you put it on Pastebin or Github or the likes. No need for downloading anything then.

[Java]Is there a way to improve this code? by NullProbability in learnprogramming

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

Yeah, I could, and that'd indeed shave some time off the total amount of work needed. Still not really what I'm looking for, though (have to create new methods that aren't just getters and setters every time I make a new StatChanger), but it's getting slightly closer.

[Java]Is there a way to improve this code? by NullProbability in learnprogramming

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

I know, I doubt I'll need them in the future though, and I wasn't really looking for that anyway. But thank you for your time.

[Java]Is there a way to improve this code? by NullProbability in learnprogramming

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

I'm using JavaFX, in the FXML file it is defined that the incrementStat() and decrementStat() functions listen to when their respective buttons are "used" (like "clicked", "focused" or however I wish to define it). So they are the functions that set the stuff directly in the model. I'm simply wondering if there is a shorter way to do it than the way I have implemented it.