Win a copy of Spring Boot in Practice this week in the Spring forum!

Jagdeep Sharma

Ranch Hand
+ Follow
since May 24, 2010
Jagdeep likes ...
IBM DB2 Eclipse IDE Java
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 Jagdeep Sharma


I need a compound key algorithm so that i can use it in hashmap. This compound key is to be constructed from three values INT,INT,STRING.

INT can have any value from 1 to infinity
STRING will have only two values DOMESTIC or OVERSEAS.

Can you people suggest me some algorithm to generate unique hashcode.

Thanks in advance
11 years ago

Rob Spoor wrote:The MAC address isn't sent with the requests*. It's only available on the client machine. That means that the server can't get to it.

* Well, apart from perhaps DHCP requests, but that's not what we're talking about here.

Hey Rob, Could you please suggest me some workaround for this.
Hi guys,

I need a feature in my web application. I want to restrict user login on the basis of IP address and MAC address. To achieve this feature i am able to find LAN IP address and i searched the internet to find MAC address code. But i am unable to get any help. Can you guys please show me a way or workaround for the problem.

Thanks in advance

amit punekar wrote:Hi,
Not very sure of the scenario in which you are using report_master table but check if the report_id that is returned is the next valid value and not the maximum value in that table. Your function name is findMax() which makes me think so.
If it is the max value then you will need to increment it to get next value.


Hi Amit,

I checked it. Both next value comes from findmax and 'select max(report_id) from report_master' are same.
code for insert

Hi all,

I get DuplicateKeyException exception whenever i try to insert record using EJB. Although i checked the value of primary key. They all are seems to be fine. I am giving you snapshot of error message.

Hi all,

I'm having a table, frequently used. Sometimes i face this issue. when somebody tries to update some rows. It doesnt get updated in fact i handled such situation in java by throwing exception. But no exception is shown. Can somebody give some useful advice. is there any locking happening preventing query to be executed.


amit punekar wrote:Hello Jagdeep,
I think you have answered the question in your email itself.

2. Open another tab open gmail (it wont ask for login). now in this tab logout and login with different username and password.

This is not same as what you have asked in your email. You want user to log himself out manually by clicking the logout. If you also implement in the same way then in your case as well when you go back to the earlier tab you would see the login box. Of course, I presume that you have implemented the login functionality and checking the request by whichever means for user's logged in status.


Hello Amit,

I think you misunderstood my question. Please correct me if i am wrong. Let me explain it further.

1. You login on gmail with some username and password for user X and here i can see my homepage.
2. Now Open another tab open gmail (it wont ask for login and directly takes you to the homepage). now in this tab logout(remember in previous tab homepage is still there) and login with different username and password for user Y and it takes you to the respective homepage.
3. Now open previous tab where you are homepage of user X and try to compose a mail and sent it. You will get error because user Y is already logged in.

Now suppose i am using "isLogged" session variable to track user. Then in normal scenario(forget above steps) user X will be treated as user Y as server session will find "isLogged" session variable to be true because user Y is already logged in and all the things will be working fine.

This is what i know. Please correct me if i am wrong. Advice me how to achieve my functionality.

11 years ago

Paul Sturrock wrote:

However, you can track with presence of existing user in session with respect to the clients IP

The client's IP address is frequently likely to be the address of the proxy server they access your server through, so a range of people could have the same IP address.

The only way I can think of doing this is to add some extra variable in the request that identifies this is a different tab. If the page you served was JavaScript that redirected with some unique id which you then used to invalidate the session, that might do it. But if you decided to do this, you have to wonder why you are using the session at all? Do you often have two distinct people accessing the same application via the same browser concurrently?

Thanks for reply Paul and Raghavan

What i want is gmail like functionality.
1. You login on gmail with some username and password
2. Open another tab open gmail (it wont ask for login). now in this tab logout and login with different username and password.
3. No open previous tab where you already opened it. Now try to compose a mail and try to submit it. It will show you error.

I want to implement similar kind of functionality.

Thanks in advance
11 years ago

I have my web application in J2EE. What i want to do is, when somebody logs in (in the same browser using different tab where other guy is already logged in) he should be able to login and other's session should be expire giving some message. Currently if somebody is already logged in and some other guys tries to log in. Login page is not shown to him instead he is taken to inside pages of already logged in user.

Please advice me on that.

Thanks in advance
11 years ago

Bear Bibeault wrote:You are establishing your click event before the DOM is created. That won't work. You need to put that code in a ready handler.

How can i do it. I want to use click handler in multiple places.

Can i use ready method in external js file.

Bear Bibeault wrote:The problem is that you haven't told us what the problem is.

Please read ItDoesntWorkIsUseless.

I am sorry Bear. Problem is when i use external js file's method inside ready method, all things work fine. But when i use this in external js file, method is not invoked on click event.
Guys below is my code of external title.js and main file. But it is not working. Please tell me where is the problem.


Please look at
if you try to edit border width and type alphabet 'a'. It won't accept. alphabet 'a' is not even visible for a second. If you type a number, it goes well. Now i want to achieve the same thing using javascript (using event handlers). How do i go about that.

Eric Pascarello wrote:And what horrible browser is this?

In the end you need the doc type on the page.


As far as i know. if you use html not xhtml. You dont need doctype. Please correct if i am wrong. Please help. If you remove doctype the code above displays alert box.