Win a copy of Event Streams in Action this week in the Java in General forum!

Adrian Grabowski

+ Follow
since Jun 22, 2018
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Adrian Grabowski

I use org.json for this, it has JSONArray which does exactly what you want.
5 days ago
I'm a student and not a professional programmer so here are my thoughts:

- Swift and iOS development tie you up to one vendor, Apple's hardware is quite expensive - traditional uni will stay away from it as it means extra costs for them and courses will be less popular
- Java is a safe choice, low barriers to entry and large job market, easy to find tutors, courses cheap to create and will be popular, it just screams large profit margins for the university
- Why just these two? Why not consider Smalltalk or Dart?
1 week ago
What do you mean by "not be blank". What do you want there instead? Zero?
2 weeks ago
I'm a bit confused, I have these dependencies:

inside my module-info I have both

 requires java.json;

Which gives me "Error:(1, 1) java: module ****** reads package javax.json from both java.json and"

I can't figure it out, any hints?

3 weeks ago
this one doesn't change anything

and this one

is almost correct but when your parameter has the same name as your field you need to prefix your variable with "this":
this.playerhp = playerhp;

4 weeks ago
That's purely educational in my opinion. If you want to learn about distributed computing/big data - a cluster of Raspberry Pi is one way of doing that (and playing with toys is fun!). The poor specs of a Pi (especially RAM) can only help with that.
4 weeks ago
I can't see your Enemy and Player classes unless I missed something, can you post it here?
4 weeks ago
I remember that I scored pretty low on whizlabs tests, around 60-65% I think, as I could not focus for too long but passed the exam with a reasonable score. I found out that I work quite well under pressure but it's often not the case for many people. My strategy (for this and many other exams) is to skip hard questions, do the easy ones first and then come back and give it another go. When I'm not sure I don't guess, I skip. I only guess when I'm running out of time. Also remember that while the scope of this exam is quite small, questions are often tricky so you need to be very careful.
You are correct, I assumed it was Intelij's built in function but it is actually a plugin bundled with Intelij Ultimate. It checks your query and highlights the keywords. It doesn't say if it works with Hibernate 5 to be honest but it looks like it doesn't understand LocalDateTime.

Am I correct to assume that it is ok to use Java 8 Date api with Hibernate 5 without any tricks and mapping from LocalDateTime to MySQL's DATETIME is ok? It seems to be working straight out of the box...


Bob Matthews wrote:

and in line 6 above of the client code have replaced String[] with String

No sign of any client action ???

String... (with three dots)

This will allow you to call the method with or without parameters.
1 month ago
I think you wanted something like:

You just need to replace String[] with String... on line six if you want to use this method without providing any parameters
1 month ago
I think you are confused on what sorting does, you don't need it here. Read bit more about sorting and implementing comparator if you want to know more. You also don't need to prefix your private fields with "_", it's not Python.

Regarding your problem, try describing how you would approach it without coding, let's say you have a list of players on a bit of paper and you want to split them into two teams with equal number of healers. How would you do it manually? Step by step.
1 month ago
I'm persisting some data using Hibernate and I'm not sure if that's the correct way of doing things. I have a class called SensorDataObject, one of the fields is of type LocalDateTime. When it's saved in mysql its type is DATETIME which I assume is correct.
Now when I wrote code to retrieve data my IDE (Intelij) marks it as an error but the code compiles and seems to be working fine:

Intelij complains about "sdo.localDateTime" and says: "Type mismatch: number, date or string expected."

Am I doing something wrong or is Intelij just confused?

You are prefixing all variables with "p", why? You just make your code harder to read. Also, you can make your fields private.

What are the Fechalong and Fechasegundos for? Are you trying to get the timestamp from the date or something similar?

1 month ago