Bin Smith

Ranch Hand
+ Follow
since Mar 29, 2012
Bin likes ...
Eclipse IDE Java
Ukraine, Lviv region, town Mykolaiv
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
24
Received in last 30 days
0
Total given
30
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Bin Smith

To create Singleton class you need to write it this way:


This ensures that only one instance of Singleton class is created.
10 months ago
You are trying to consume a token that is not there. you do a number of next() calls without checking if there is next.

one thing you can use is:


or

After that you can safely call
next() or nextInt() methods.
10 months ago
I created subclass of `java.net.ServerSocket`.

In `run` method I want to get all pending requests and send them error message.

How to do it with `ServerSocket`?

Here is my code:

I need either number of pending requests or non-blocking variant of `accept`?
I wanted to sync upstream with my local repo. I did :

Now I have my fork not synchronized with my original repo and my local repo.

How to sync my fork with my local repo or original repo?

P.S. On my fork there are files which are not in my local nor original repo? I want them to be deleted on sync.
It says :

We provide @CreatedBy, @LastModifiedBy to capture the user who created or modified the entity


But for me the problem is how to create such user?
2 years ago
Thanks but it doesn't explain it well.

I want to create example project that uses `@CreatedBy`. Do you know how to use it?
2 years ago
I don't understand what is the purpose of `@CreatedBy` annotation in spring data jpa.

How to use it?

I used `@CreatedDate` on entity property and I see that it inserts date into db.
2 years ago
2 years ago
Hello!

I need restful url that can give me states/cities by country name.

I found rest url that gives me all countries - http://restcountries.eu/rest/v1. But not their states/cities.

How can I get states/cities by country name?

Thank you!
3 years ago
From another jsp page into which this fragment is incuded.

Title is static but different for each page.
3 years ago
JSP
Hello!

I have .jsp file which is included in other jsp files:

As you see it has static <title>. But I want to customize this title for each jsp page.

How to do that in jsp? Should I create my own jsp tag?
3 years ago
JSP
It may look like this demo:
3 years ago
This is happening because of backtracking of greedy quantifiers in regex.
To avoid backtracking I know two choices : atomic group or possessive quantifiers. Both mean match as many symbols as possible with greedy quantifier and never release(backtrack) symbols.
So I just used atomic group for first greedy plus and problem has gone.
So, regex becomes:

(?>\\w+) means, that it matches as many one of [a-zA-Z0-9_] as possible and never release matched symbol.

This article will be useful to read.
3 years ago
Yes, we can. Just add fetch=FetchType.LAZY to @OneToOne.