Salil Wadnerkar

Ranch Hand
+ Follow
since May 28, 2016
Cows and Likes
Cows
Total received
1
In last 30 days
1
Total given
0
Likes
Total received
27
Received in last 30 days
6
Total given
73
Given in last 30 days
24
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Salil Wadnerkar

You can check winCheck again in an if statement, before executing parts which you don't want to execute if that check is true.
1 week ago
To answer your first question, scanner.nextXXX() methods are blocking, and they wait for user input.
1 week ago
JSON web token serves two purposes: to authenticate user, and to store user session related information. So, yes, user-id, their last question, are all fair bets, for adding to JWT.
About splitting of APIs, ideally, you should not mix adding data (POST) with getting data (GET). So, you should keep them separate.
1 week ago
"\b" just matches the end of a word character, which is space. But, since you specified only one character match, <space><space>, is interpreted as <space><empty word><space>, and that is why you are getting an empty word as one of the values. Try "\b+" or "\s+" so that it matches all the spaces between the words.
2 weeks ago
I suggest that since you are not familiar with how java servlets work, you can forget about this task for now, and just get "hello world" servlet working. This will introduce you to servlet mapping, and writing simple servlet that handles GET request from browser. Then you can develop a simple program where you submit your name via POST request, and the server responds back with "Hello, <your name>". Once you have these basic pieces working, you can easily finish your task.
Your interpretation of moves doesn't seem correct to me. Depending upon the existing heads and tails, you need to choose the move. And there are only 4 moves that you can choose.
Also, it's a dynamic programming question, I think. Because from the solution to the sample problem, it doesn't look like greedy solution will solve this.
2 weeks ago
Assuming saveItem method raises an exception if the item already exists in DB, you can surround this call with try.. catch, and collect the items in a list for which this call raised an exception, and then return this list from saveItem method.
2 weeks ago
Browser sending you the data, and the servlet saving it can be done via POST request.
Typically, index.html is the first page people see, and I am assuming you want to provide both GET and POST for this page.
Your player.html handling servlet should handle the GET request by reading from database, and creating a response (typically via JSP).
Your web page is the code browser executes. So, that is javascript code in the HTML page your server sends to the browser, upon browser request.
Your servlet is the code executed by your server so that it can send a HTML page (+ javascript) to the browser.
In Java, you can use a servlet container like Tomcat to execute servlets. You can just google for any introductory article about writing servlets and executing it on Tomcat.
p is a parameter to the lambda, just like "panda" is a parameter in your method "check". And just like when you invoke "check", you pass arguments, which then become parameters to "check" (and that is how "panda" parameter gets the value), when you call a lambda, the argument you pass becomes the parameter ("p" in your case)
2 weeks ago
How are you compiling the program? You need to pass -cp argument with the mysql jar file location. So, it should be
javac -cp /root/java/mysql-connector*.jar your-program.java
And then:
java -cp /root/java/mysql-connector*.jar your-program.java
to execute it.
static simply means belonging to a class, rather than to an object. So, static method in class A, belongs to class A. And you can call it, without needing an instance of class A. So, that's the point of having static members.
inheritance is a relationship between classes, where only non-static methods/fields participate; static methods/fields have no bearing on that.
3 weeks ago
Your display method is inside conversion method. This should not have compiled. So, I am assuming you just pasted the code incorrectly. For display method to print the result, your conversion method should return the result, and the main method should call display method with this result.
3 weeks ago
Thanks a lot, Devaka!!!
3 weeks ago