Win a copy of Securing DevOps this week in the Security forum!

Sam Kumar

Ranch Hand
+ Follow
since Nov 30, 2001
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 Sam Kumar

Oops javaranch replaced "'" with ' while posting. I am puting extra space to avoid conversion.
Here is the HTML:
<A HREF="javascript:submitForm('SINGLEQUOTE_TEST','Single& #039;'Quote');"> SingleQuote-Escape Test</A>
<BR><BR>
<script language="javascript">
function submitForm(a, id){
alert(a);
alert(id);
}
</script>
Here actual string is
Single'Quote
and I am replacing single quote with & # 039; ' i.e.
Single& # 039;Quote
(Ignore extra space)

Thanks in advance!
SK
Hi,
I am trying to escape single-quote but I am getting javascript error.
Here is the HTML:
<A HREF="javascript:submitForm('SINGLEQUOTE_TEST','Single'Quote');">SingleQuote-Escape Test</A>
<BR><BR>
<script language="javascript">
function submitForm(a, id){
alert(a);
alert(id);
}
</script>
On clicking the link, I am getting following error:
Line 1, Char 31, Expected ')'
Here actual string is
Single'Quote
and I am replacing single quote with ' i.e.
Single'Quote
Any ideas why I am getting javascript error!
Thanks in advance!
SK
Hi,
I am facing one problem related to URLEncoding. In my servlet after retrieving lets say name from database...i am encoding using the URLEnoder class and generate a dynamic HTML but it seems that URLCoding is not working properly. Here is the code snippet:
String testStr = "Test'String'";
testStr = URLEncoder.encode( testStr );
System.out.println("encodedValue: " + testStr);
I verified that endoded value is:
Test%27sString
Now I am generating dynamic HTML with
out.println("<A HREF="javascript:submitForm('" + testStr + "');">Test<A>");
The generated page does not contains the encoded value, because of single quote, this link is not working:
<A HREF="javascript:submitForm('Test'String');">Test</A>
Ideally I shoould see:
<A HREF="javascript:submitForm('Test%27sString');">Test</A>
Thanks in advance!
SK
15 years ago
Hi,
I am facing one problem related to URLEncoding. In my JSP after retrieving lets say name from database...i am encoding using the URLEnoder class and generate a dynamic HTML but it seems that URLCoding is not working properly. Here is the code snippet:
String testStr = "Test'String'";
testStr = URLEncoder.encode( testStr );
System.out.println("encodedValue: " + testStr);
I verified that endoded value is:
Test%27sString
Now I am generating dynamic HTML with
<A HREF="javascript:submitForm('"<%= testStr%>"');">Test<A>
The generated page does not contains the encoded value, because of single quote, this link is not working:
<A HREF="javascript:submitForm('Test'String');">Test</A>
Ideally I shoould see:
<A HREF="javascript:submitForm('Test%27sString');">Test</A>
Thanks in advance!
SK
15 years ago
JSP
Hi,
I am facing one problem related to URLEncoding. In my servlet after retrieving lets say name from database...i am encoding using the URLEnoder class and generate a dynamic HTML but it seems that URLCoding is not working properly. Here is the code snippet:
String testStr = "Test'String'";
testStr = URLEncoder.encode( testStr );
System.out.println("encodedValue: " + testStr);
I verified that endoded value is:
Test%27sString
Now I am generating dynamic HTML with
out.println("<A HREF="javascript:submitForm('" + testStr + "');">Test<A>");
The generated page does not contains the encoded value, because of single quote, this link is not working:
<A HREF="javascript:submitForm('Test'String');">Test</A>
Ideally I shoould see:
<A HREF="javascript:submitForm('Test%27sString');">Test</A>
Thanks in advance!
SK
15 years ago
Hi,
Anybody know what is the maximum length for "User-Agent" HTTP header.
Thanks in advance.
SK
15 years ago
Hi,
I need to update couple of tables to convert the existing email address into lower case. Using SQL, it is very easy to do but the problem is that these tables are very huge and contains atleast 2M records. I am not sure which is the best way to do update:
1) Using SQL, something like this
update contact set email_address = lower(email_address);
2) Using SQL, but in certain number of records.
update contact set email_address = lower(email_address) where (contact _id >= 1 and contact_id <= 10000);
commit;
update contact set email_address = lower(email_address) where (contact _id >= 10001 and contact_id <= 20000);
commit;
..............so on
3) Using Java JDBC ResultSet by updating one record at a time by scrolling ResultSet. Here the ResultSet may contain atleast 2M records and I will be reading one by one and updating record one by one.
Any suggestion which one is the best or any other alternative.
Thanks in advance.
SK
Hi,
I am new to XML and will appreciate if anybody can provide me some code snippet to do parsing of following XML using JAVA:
<?xml version="1.0"?>
<!DOCTYPE XDatabaseUserURI [
<!ELEMENT URI (HTTP_URI, HTTP_METHOD)>
<!ELEMENT HTTP_URI (#PCDATA)>
<!ELEMENT HTTP_METHOD (SERVICE | GET | POST ) >
]>
<XDatabaseUserURI>
<URI>
<HTTP_URI>/test.jsp</HTTP_URI>
<HTTP_METHOD>GET</HTTP_METHOD>
</URI>
<URI>
<HTTP_URI>/test2.jsp</HTTP_URI>
<HTTP_METHOD>POST</HTTP_METHOD>
</URI>
</XDatabaseUserURI>
Thanks in advance.
SK
Hi Paulo:
Thanks for your reply.
We are using DB2 7.2, in that case I may have to manually update timestamp values in all the tables as we are permanently changing our DB and Web server timezone.
You mentioned that upto v7, DB2 just stores the timestamp value only, so in version 8, DB2 will store the timezone also along with the timestamp? I looked into IBM document "Whats new in Version 8" and it says under "JDBC Driver Enhancement":
"Date, Time, and Timestamp values that can be set or retrieved for a particular time zone using a Calendar object."
I could not understand fully above statement...
Thanks.
SK
Hi,
If we change the timezone, let say from PST to EST, what will happen to existing record which were persisted with PST format. Is DB2 will automatically take care of the conversion of the timestamp value in all the tables.
Thanks in advance.
SK
15 years ago
Hi,
If we change the timezone, let say from PST to EST, what will happen to existing record which were persisted with PST format. Is DB2 will automatically take care of the conversion of the timestamp value in all the tables.
Thanks in advance.
SK
Hi,
We are using single-row, medium setting websphere session persistence and getting following error while persisting session information:
[2/21/03 10:04:58:195 EST] 138a5938 SessionContex X SESN0042E: BackedHashtable:ejbCreate - database error. If a SQLException has occurred then refer to the appropriate database documentation for your environment. Also, assure that you have properly configured a datasource for Session Manager.for session
Session Object Internals:
id : YPMWAV50O4WDSOBNTC41YFA
hashCode : 194943235
create time : Fri Feb 21 10:03:54 EST 2003
last access : Fri Feb 21 10:03:54 EST 2003
max inactive interval : 1800
user name : anonymous
valid session : true
new session : true
session active : true
overflowed : false
session application parameters : com.ibm.servlet.personalization.sessiontracking
.SessionApplicationParameters@5ce81936
session tracking pmi app data : com.ibm.servlet.personalization.sessiontracking.
SessionTrackingPMIApplicationData@46b59936
enable pmi : true
non-serializable app specific session data : {}
serializable app specific session data : {user=com.test.display.SessionUser@7c0
f5903, HISTORY_KEY=[/]}
app data changes : {}
app data removals : null
user write hit : true
max inact write hit : false
listener count hit : false
update : insert into sessions (id, propid, appname, listenercnt, lastaccess, cre
ationtime, maxinactivetime, username, small, medium, large) values (?, ?, ?, ?,?, ?, ?, ?, ?, NULL, NULL)
listener count : 0
buflen : 3510
cached : false
cacheId : 0001
cacheIdUpdated : true
I verified size of session information which is approx 3.5Kb which is very small. In fact we tried to use "multi-row" sesion also just to verify if session size is the issue, but still we were getting the same error consistently. Also, the same code works fine in one other development server.
Thanks in advance!
SK
15 years ago
Hi,
We are using IBM HTTP Server 1.3 (Apache) and I am able to print the most of the information like Referer, User Agent, Cookie etc using "LogFormat"
LogFormat "%h %l %u %t %T \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{C
ookie}i\"" extended
Above LogFormat prints the cookie information if it is already in the REQUEST. I was wondering if is there a way to print "setCookie" also?
Thanks in advance.
SK
15 years ago
Hi,
Whenever customer access our web site from third party we recieve the referer in HTTP header but unfortunately the way out site function is that "entry" page loads twice and hence we lose the "referer" information and its very difficult to know where customer went after the entry page. Here is the flow:
- Let say customer access our site from yahoo.com
- It hit the home page and HTTP header contains referer as "yahoo.com"
- Now "home page" is entry page, before displaying the home page content, we send some javascript to capture browser information (using third party software BrowserHawk) and browser itself calls entry page using "location.replace". Now with this secound request, we lost the referer to this site.
Now in this case, I was wondering if I can either set the referer or preserve the referer from origonal request which is for site trafic analysis purpose. One way is to set it as a parameter but that may not be very effective compare to setting referer in HTTP header.
Thanks in advance.
SK
Hi,
I am wondering if there is a way to set the referer programatically. I know how to see the value using document.referer
Thanks in advance.
SK