Bin Smith

Ranch Hand
+ Follow
since Mar 29, 2012
Bin likes ...
Eclipse IDE Java
Merit badge: grant badges
For More
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 Bin Smith

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

This ensures that only one instance of Singleton class is created.
7 years 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:


After that you can safely call
next() or nextInt() methods.
7 years ago
I created subclass of ``.

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?
9 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?
9 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.
9 years ago
9 years ago

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

I found rest url that gives me all countries - But not their states/cities.

How can I get states/cities by country name?

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

Title is static but different for each page.
9 years ago

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?
9 years ago
It may look like this demo:
9 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.
9 years ago
Yes, we can. Just add fetch=FetchType.LAZY to @OneToOne.