Michael Krimgen

Ranch Hand
+ Follow
since Jul 08, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michael Krimgen

I would like to execute Java code which users can enter into a form on a website. The output should be written to the console on my server.

I came up with the following setup:
1) Create a Docker container with a JVM where the code is executed.
2) Use the Java Security Manager to allow only the use of certain (Java core) classes, restrict network access, file access etc.

Here are some examples of website where you can upload code to be executed.
  • https://try.kotlinlang.org
  • https://www.jdoodle.com
  • https://www.hackerrank.com

  • What are your thoughts about this approach? What are the security issues with the above set up?
    3 months ago
    Hi Prashanth,

    First of all good luck with your exam. I hope you did some some decent preparation in the past few days.

    I passed the OCJP exam about a year ago and would like to give one hint regarding writing code for practice.
    Many people point out the importance of coding in Java. This is certainly true, however, I think it is crucial not only
    to program "useful" application but play around as much as possible. If you program something real (or some toy project),
    you only use certain aspects of the language (usually only a really tiny subset).

    So what you might want to do is the following: For every mock-exam question which you do not fully understand, you should
    write a few small test programs. Try to code, compile and run every given answer to that particaular question. Make sure you
    understand exactly WHY the wrong answers are wrong and why the correct answer is correct. Especially understanding why
    wrong answers are wrong will help you a lot during the exam. Also, try to find out what would be the implication if the
    wrong answer was right. Would it make sense? Would it cause a conflict?

    At some point during your study you should go even a step further and write your own exam questions. Try to make them in
    the same style as the actual exam questions. Then do not look at your questions for a while and try to answer them yourself
    or even post them for others (to receive feedback). I found that doing so really helps to get a better understanding of things
    which are not totally clear to you yet.

    Hi Gary,

    I see two possible implementations for the set-theoretic methods (union, intersection, ...).

    1. Static methods
    2. Instance methods.

    Now, you are asking what exactly are these sets (set1 and set2). This will be clear if you instantiate several objects of IntegerSet, as asked in the last sentence of the task.
    The easiest thing would be a simple main method:

    Your example of the union

    set 1 - [1, 2, 6]
    set 2 - [1, 2, 4 ]
    union set 0 - [true, true, false, true, false, true, false, false... to 100]
    Then output would be "1, 2, 4, 6".

    is almost correct. The possible values of your integer set are 0 to 100, not 1 to 100.
    5 years ago
    Thanks for the hint. I did already a few courses at coursera and can really recommend them!
    5 years ago
    it was developed by a team at École Polytechnique Fédérale de Lausanne
    5 years ago

    Does anyone know if there is a book which is for people who are already certified for OCJP 6 and what to ake the upgrade exam for version 7?

    I do not yet have any book for version 7, but I believe that it might be quite tricky to use a book which is meant for the full version 7 exam
    and filter on new feature myself.

    Hi all,

    I passed my exam (OCJP 6 ) last Friday with 85%. :-)

    5 years ago

    I did it some days ago using the Scribe library for oAuth.

    I did not integrate in Spring or use JSP, though, but only pure Java.

    The Scribe website gives some examples, so can try and come back if any problems.

    5 years ago

    Do you want to write input from the console to an Excel file?

    So something like

    Or do you want to write the contents of the HTML page to the file?
    5 years ago

    I am not sure if I understand your requirement correctly. You want to read data from teh console and write it into an Excel file?

    Looking at your code, you already know how to create an Excel file using POI.

    Now the only thinkg you need to do is reading from the console (e.g. using the Console class or System.in)
    and write it to the file.

    5 years ago
    it's not really about the "why", but more about if possible or not :-)
    5 years ago
    Hi Ella,

    This method does not exist in the Player class. There is only the method

    which accepts a String as arguement.
    However, I do not see the need for the arguement in a getter method.
    I suggest to have the following method in Player:

    5 years ago
    Hello Ranchers,

    If you try to create the following generic class, the compiler will give a warning as the class Stupid is final.
    It is obviously impossible to create a (parametrized) object of Generic as the type parameter can only be Stupid,
    but the class itself does not implement the interface Runnable.

    For the following class, the compiler does not give any warning, so I assume it might be possible to create an object of the class, using
    type parametrization.

    However, I did not yet succeed to find a way to create an object of the class. Any ideas?

    Sorry for the naming of the inner class :-)
    5 years ago

    Very simple, you put the object into the hash table:

    That you do already correctly. Now you can use the key to retrieve your object:

    5 years ago

    The variables top and bottom in your methods are local variables to the method and shadow the ones you declare in the first line.

    The latter ones always remain 0 since you never assign a new value to them.

    Can you explain in words what you are trying to achive. Your code looks a bit too complicated for what you want to do...
    5 years ago