Increase the recursive ability of Eclipse [closed] - java

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I'm writing a java program in Eclipse, and when I try to use recursion it gives this error:
Exception in thread "main" java.lang.StackOverflowError
I know that people have probably already asked this question, but every response I've found has been to remove recursion. For what I'm trying to do, recursion is a necessity. There's no other option. I know that the recursive limit can be modified in Enthought Canopy (for python) like this:
import sys
sys.setrecursionlimit(10000)
Is there a way to do this for java in Eclipse? Again, removing recursion is not an option.
UPDATE: I figured out the problem (which was an infinite loop), and the code works now.

Take a look at this: What is the maximum depth of the java call stack?
While it is not exactly a duplicate, it also answers your question by explaining how the limit can be changed.
Note that Eclipse itself has nothing to do with the limit, it is a Java restriction and can be increased by allocating more space to it.
As always with such questions one should note that your code is likely to be inefficient, wrong or maybe has a non-recursive alternative. However you said that you are not interested in such solutions, so I just leave it here as a side note.

Related

I want to give security to my PHP code from copy [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want such a script or logic so that if somebody has a copy of my code, they can only access/run it if they have my unique key, otherwise they get an error. Is there any way to do like this?
Thanks
If somebody has a copy of your PHP code they can run it. As PHP is not compiled, the possessor can read and edit the code as well; so even if you put in something that checks against a secret key, they could simply remove it. If you encrypt the code into an unreadable state, it’s also in an un-runnable state.
So, in brief, there really isn’t a way to give working PHP to another person in a way that they can’t simply run it. If you’re looking to sell a product of some sort, your best bet is probably to run it as a service so the end user never actually sees the code.
The closest you might hope for would be to make it difficult to read, i.e. with meaningless variable and function names and zero white space; but that won’t stop somebody who really wants it, (and who knows how to work some basic refactoring utilities), and only adds significant complication to your own work

Just need help starting up for a program that transfer from c++/c to mips [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
first of all I want to make it clear that's what I am asking is for an assignment.
The idea was to make a program in c++ or java where the user enter a simple c code (A=B, a while loop, a for loop and array functions) and the output is the mips code (lw addi etc) we are free to use whatever registers doing so.
Surely I am not asking for the whole code. The problem is in my head I can only think of hardcoding the whole things inputting a string then cutting it into part and then run a hideous amount of if condition and or switch cases I think there must be a simpler way but I can't get my mind on it.
Damn, whenever you get to studying compilers this will be crazy to look back to.
Anyway you are probably not in the level of building a C compiler from scratch.
So think of it this way, you need to have a set of instructions and yes you will have to go through the program string and transform the string into MIPS instructions.
The most naive way to do it and it might be what your teacher expects unless it is a compiler course, would be to parse the program text line by line as it is expected to be a simple program and as you said have a lot of conditions for each type of expression that you will evaluate.
A tip: Save for / while loops as a label as soon as you read them and from there you need to check where is the endpoint of it for the jump when necessary (completed for/while conditions etc)
Now if it is a compiler project. I'd strongly recommend you read into this book:
Compilers: Principles, Techniques, and Tools
Because to build a real compiler you need to understand all the stages of a compiler and how does it work together... You would also need to know some Language Theory.

can anybody tell or recommend a video series for java threads and help me out to fix an error? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Code fragment
I followed a video series of Derek Banas about java threads but applying the same code on my compiler it gave me an error. I dont know why.please help me out.
Another code fragment
note: I have already defined "getTheMail" with an integer.
This is not a threading issue. You should instantiate GetTheMail class without giving any constructor parameters since it is not expecting any.. like this : new GetTheMail(); I encourage you to read this article for further understanding : https://www.javaworld.com/article/2076204/core-java/understanding-constructors.html

How to minimize multiple if statements? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I'm doing a code cleanup and I want your HELP
The code creates units and place them in a unitPositionHashmap. Furthermore it reduces production value according to unit type.
I'm looking for a way to reduce the amount of code and smarter way to structure this method, so I avoide almost dublicated code.
The code
Create a method having one if block and use parameters to fill in the variable values (p, GameConstants value (like ARCHER), ProductionAmount condition value (like 10). You'll have one if left in the makeUnit method, while having only one if in the new method.

My own code vs library [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
This is kind of unusual question for developers but for some reason i want to post it here and hope to get adequate answer.
Here is a simple example:
I wrote a java function that calculates distance between two geo points. The function is not more than 50 lines of code. I decided to download a source code from ibm that does the same thing but when i opened it i saw that it looks very complicated and is almost thousand lines of code.
What kind of people write such source code? Are they just very good programmers? Should i use their source code or my own?
I have noticed this kind of thing lots of times and i from time to time i start to wonder if it is just me who do not know how exactly to program or maybe i am wrong?
Do you guys have the same kind of feeling when you browse throught some other peoples source code?
The code you found, does it do the exact same calculation? Perhaps it takes into account some edge cases you didn't think of, or uses an algorithm that has better numerical stability, lower asymptotic complexity, or is written to take advantage of branch prediction or CPU caches. Or it could be just over-engineered.
Remember the saying: "For every complex problem there is a solution that is simple, elegant, and wrong." If you are dealing with numerical software, even the most basic problems like adding a bunch of numbers can turn out to be surprisingly complex.

Categories