sushant verma

Greenhorn
+ Follow
since Jun 08, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sushant verma

I'm stuck, help me out !!!

I have got a FILE table with: file_id BIGINT,file_name VARCHAR,file BLOB... etc

I want to count the no of downloads of each file per user/computer so that i can identify the total count of each file and also want to avoid a situation where a single user is downloading the files multiple times,

I just want to know the best way in which it can be implemented, up till now i have thought of following ways:

1) Create a table FILE_DOWNLOAD_COUNT (FILE_ID,UNIQUE_ID) 2) whenever the file is downloaded insert a new record into this table with the ID of the file downloaded and a UNIQUE value corresponding to every download request.

But , what should be used to identfy the UNIQUE_ID???

IP ADDRESS/MAC ADDRESS/A COOKIE Value

ISSUES :
IP ADDRESS : At every new connection, a new IP address is assigned (DYNAMIC IP)

MAC ADDRESS: can be changed and MAC spoofing can be used

A COOKIE Value: can be deleted.

So just help me how can i achive this with most reliable way.

FYI: I'm implementing it in JAVA (STRUTS2+Spring) + MYSQL

Thanks in advance
12 years ago
Hi,
I'm implementing struts2 token interceptor, to test i have added following to a action struts.xml entry:


Also the valid.jsp got a series of hyperlinks generated dinamically through url params from session which is initially put into session by a loginAction.

To get struts token in url i have added :



the value of "session.menuFunctions" is coming from Login Action.

now these hyperlinks are dispalyed on the jsp as follows:

"../namespace/actionName.jsp?struts.token.name=struts.token&struts.token="

the actual token is not coming here, though other links (multiple on a single jsp) which i have created through direct request they are getting valid token though same but working.

Is there any way of getting token for these links.

Please help and correct me if i have missed something. Thanks
12 years ago
Thanks it worked!!!

just need to change the following:





also i write all the code into a .js file and included into jsp page.
and form event >>> onsubmit="toMem()"

I have tested this for no of days =3 and changed the system date to validate it and the value is field into textfield if no of days is less than system date

12 years ago
JSP
Thanks Mark for your valuable input.

Just to check the thread safety of my method i created this :




Its result is below for 3 iterations in the format: "TIME | THREAD NAME | METHOD NAME | LINE NO | logs "






The same method is being called by two threads simultaneously at the same time (loop 0) and as expected for
thread 0 :
|__isUserValid=true
|__getUserExists=1

thread 1:
|__isUserValid=false
|__getUserExists=0





Is that sufficient to check for thread safety of a method?
I mean to say the same method is being called by two threads simultaneously and with different parameters and gets separate result of their own.

Please Check and correct me if i missed something or if I'm wrong on thread safety check.

Thanks & regards
Sushant Verma
12 years ago
Thanks Mark for your reply, can you please guide me how to make it ThreadSafe.... will it be right to make it threadLocal...
I have modified the JdbcUserDtoDao class and separated into two parent and child and instantiated JdbcCallDataSource using Spring IOC







and please explain how to check any function to be threadsafe.
12 years ago
Thanks for your reply but I found how to do it i a single class with different Stored Procedure names:












I tested it and it worked all fine...
12 years ago
Hi, I'm bit confused with the calling pattern of Stored Procedure using jdbcTemplate.
Do i need to add a new class everytime a new SP is to be called?

I WANT to call a SP with some IN and OUT parameters and want to store the result in some DTO object and want to do this using spring in such a manner
that many functions can be listed in a sinlge class some XXXDAO.java

So that it can be called from a bllImp class with some input arguments and gets a class object DTO/String/List/Result set in return.

Please give a running example or provide a .war with the example code or any link where i can clear my doubts.

Thanks in Advance
12 years ago
Hi, I'm bit confused with the calling pattern of Stored Procedure using jdbcTemplate.
Do i need to add a new class everytime a new SP is to be called?

I WANT to call a SP with some IN and OUT parameters and want to store the result in some DTO object and want to do this using spring in such a manner
that many functions can be listed in a sinlge class some XXXDAO.java

So that it can be called from a bllImp class with some input arguments and gets a class object DTO/String/List/Result set in return.

Please give a running example or provide a .war with the example code or any link where i can clear my doubts.

Thanks in Advance.
12 years ago