Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!

Rob Spoor

Sheriff
+ Follow
since Oct 27, 2005
Rob likes ...
Chrome Eclipse IDE Java Windows
Forum Moderator
Rob Spoor currently moderates these forums:
Cows and Likes
Cows
Total received
94
In last 30 days
2
Total given
34
Likes
Total received
1415
Received in last 30 days
5
Total given
2251
Given in last 30 days
4
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rob Spoor

Interesting fact: the API docs are now found at https://docs.oracle.com/en/java/javase/11/docs/api/ (not http://docs.oracle.com/javase/11/docs/api/ as versions 7 through 10 would have suggested).

This release has quite some impact - it has removed all JEE APIs like JAXB, JAF and RMI. CORBA is also gone. Furthermore, Nashorn is deprecated and will probably be dropped pretty soon.

FYI, I'm working on getting a new version of https://robtimus.github.io/whats-new-in-java/. The removal of entire packages has lead to some interesting behaviour, like features introduced in previous versions no longer showing up as new for those versions. I expect to have this fixed later this week.
11 hours ago
Welcome to the Ranch!

Try removing the header call. That causes a redirect, which means you cannot see any errors anymore. Without the redirect you will at least be able to see any output your PHP file produces.

Also, your code is very vulnerable for SQL injection. I suggest using PDO with parameter binding, or at least mysqli_real_escape_string.
11 hours ago
PHP
Why not use a private static final Logger field? The logger name is fixed, so why not make the Logger fixed as well?
There's at http://jdk.java.net/10/ (and other versions of course). There is no setup file for each version though, so you'll have to unpack it yourself. You can use 7-zip for that.
4 days ago
Memory settings must be applied when the JVM starts. When you use a Spring Boot config file, or configuration of the embedded server, it's already too late - the JVM has already started. Unless there's a JVM config file I don't know about, you are stuck with providing it when the JVM starts. A script file is the easiest way.
4 days ago
Right. You can use any(User.class) to let it match any User instance, but like this it will only return true for this specific user.

Note that userActions.createUser isn't called from your code, so your verify step will fail.
1 week ago
You mock userActions, but you never specify that its methods should actually return something. If you don't, methods simply return the default value for the return type (e.g. false, 0, null), or empty arrays collections for methods that return arrays, lists, etc.

So, you just need to start using Mockito.when to make the userActions methods return something. You of course need to do this before you actually start using it.
1 week ago
+1 on Tim's comment.

That said, an access violation in native code is usually the equivalent of a NullPointerException. Somewhere you probably have a NULL pointer that you try to de-reference.
2 weeks ago
Welcome to the Ranch!

Before you try to fix anything, you should try to figure out which part of the processing is taking so long. Once you have identified the largest contributor, try to improve that. Continue until you either cannot improve anymore, or you are satisfied with performance.

My guess is the web service call though. 4 hours is 14400000 ms. Divide this by 100k and you get 144 ms. It wouldn't surprise me if at least 40 ms of that time is the web service call. Can you group these calls to send a few dozen or even a hundred or so in one call?
2 weeks ago
Frameworks like Spring and CDI use it internally. You ask for a bean to be injected, and the framework will locate an appropriate instance and inject that. JNDI look-ups can probably also be seen as the bean locator pattern.
2 weeks ago
How does this page get called initially? The transactiondate is sent through AJAX, but if that AJAX call doesn't take place the transactiondate must come from somewhere else. If it's not a query parameter then it cannot be found in $_GET.
2 weeks ago
PHP
Did you give the select element a name called "combo"? Did you also give the option elements all a value attribute? If not, then the selected value will not be sent to insert.php (correctly).
2 weeks ago
PHP
I've never seen Maven add two versions of a dependency. There has always been one "winner" which causes other versions to be ignored.
2 weeks ago
1) It's $_POST, not $_post. PHP is case sensitive.
2) You use $combo.=. The .= means that you want to append to an existing variable. Since this is the first occurrence of $combo you should drop the .: $combo=$_POST["combo"];
2 weeks ago
PHP