Win a copy of Head First Android this week in the Android forum!

Gayatri Sinha

Ranch Hand
+ Follow
since Feb 13, 2006
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 Gayatri Sinha

Hi,

I am seeing this error on submitting request using POST
Has anyone seen this error before and have any idea what its about. If you need more information please let me know.

The process hangs when it tries to execute
request.getParameter("sampleStr");
and its very sporadic

java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at weblogic.servlet.internal.PostInputStream.read(PostInputStream.java:1
70)
at weblogic.servlet.internal.ServletInputStreamImpl.read(ServletInputStr
eamImpl.java:180)
at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(ServletR
equestImpl.java:1339)
at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Servlet
RequestImpl.java:1206)
at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequ
estImpl.java:1409)
at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequ
estImpl.java:1395)
at com.medem.util.ServletUtils.getParam(ServletUtils.java:364)
at com.medem.util.ServletUtils.getParam(ServletUtils.java:350)
at com.medem.util.ServletUtils.getAttributeOrParameter(ServletUtils.java
:76)
at com.medem.mymedem.auth.filter.AuthFilter.doFilter(AuthFilter.java:214
)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:7053)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3902)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
--------------- nested within: ------------------
weblogic.utils.NestedRuntimeException: Cannot parse POST parameters of request:
'/example/ui/action/helloworld.do' - with nested exception:
[java.net.SocketTimeoutException: Read timed out]
at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(ServletR
equestImpl.java:1364)
at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Servlet
RequestImpl.java:1206)
at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequ
estImpl.java:1409)
at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequ
estImpl.java:1395)
at com.medem.util.ServletUtils.getParam(ServletUtils.java:364)
at com.medem.util.ServletUtils.getParam(ServletUtils.java:350)
at com.medem.util.ServletUtils.getAttributeOrParameter(ServletUtils.java
:76)
at com.medem.mymedem.auth.filter.AuthFilter.doFilter(AuthFilter.java:214
)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:7053)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3902)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)


Thank you.
14 years ago
Thanks for your help, probably I was just blinded by the <a> tag.
Your questions helped me come with the answer

<p onMouse Over="this.style.color='#FF0000', this.title='Enter year of birth'" onMouse Out ="this.style.color='#000000'">
<u>YYYY</u></p>
If I don't use the <a>, is there any other way I can make the 'Year' on mouseover pop up the box with the "Enter year of birth" text
[ June 18, 2007: Message edited by: Gayatri Sinha ]
I am trying to have a hover link, thats a link which just shows some text when moving the cursor on it, but on clicking shouldn't open a new window.

Here is the code i have

<a href="javascript:void(null);" title="Enter year of birth">Year</a>

So here on clicking Year nothing happens, but when you do a Shift+Click on Year a new window opens. Is there any way I can restrict opening a new window on Shift+Click.

Thanks,
- Gayatri

Originally posted by Bear Bibeault:
Be aware that when you write the string containing the new lines, they will be ignored as invisible whitespace. So what's the point of the exercise?



why is the new line ignored?
Yes, the code you have given is exactly what the code I have written above is trying to do..
But after replacing it with \r\n there is no new line, its just a space instead..

Surprisingly, this works -
var dose = "<br />Here<br />is a new<br />line<br />for you";
dose = dose.replace("<br />","\r\n");
document.write(dose);

But if I have & lt; & gt; (which is what I want) it doesn't (please remove the space after &)
All I am trying to do is insert new lines instead of the <br />
That string in dose is what I am getting from the backend and in the front I want new lines instead.

The code below just gives me spaces. Can anyone please help me with this? I dont understand what I am doing wrong.

<html>
<body>

<script type="text/javascript">

var dose = "& lt;br /> ;Here& lt;br /& gt;is a new& lt;br />line& lt;br /& gt;for you";

dose = dose.replace(/& lt;br \/& gt;/g,"& #010;& #013;");
document.write(dose);
</script>
</body>
</html>

The output is "Here is a new line for you"

Please note - I have added the space after & on purpose else the character entiry would be replaced

Thanks

[ April 24, 2007: Message edited by: Gayatri Sinha ]
[ April 24, 2007: Message edited by: Gayatri Sinha ]
Hi,

This is what I am trying to do

I have a jsp page with a textarea
<input type="textarea" name="comments" id="comments" />

Now this data goes into the database and when I do a get on this from the jsp page like

<script type="text/javascript">
var comments = "<bean:write name="myForm" property="comments" scope="request/>";
</script>

Whats happening here is if the user entered data in the textarea with line breaks, in javascript var comments looks like

var comments = This is
a sample
comment;

I get a javascript error here.

Does anyone know how do I get the textarea data from the struts tag into javascript var?

Thanks
14 years ago
Thanks Bill,

This is what I came up with and seems fine atleast now

----------------------------------------------------------
byte[] data = new byte[1024];

BufferedInputStream bin = new BufferedInputStream(new DataInputStream(new ByteArrayInputStream(fileData))); // byte[] fileData

BufferedOutputStream bout = new BufferedOutputStream(new DataOutputStream(new FileOutputStream(path)));

while(bin.read(data) != -1) {
bout.write(data);
}

bout.flush();
bout.close();


Thanks,
- Gayatri
15 years ago
HI,

I am trying to copy a large number of bytes into a new File. When doing this I get the error

java.io.Exception: Insufficient system resources exist to complete the requested service

When the file is small I have no problem for the transfer, but when the file is huge I get this error.


Here is the chunk of code I am using
The destination path is UNC (e.g. "\\mymachine\myshare\destfile.doc")

public void copyToFile(String path, byte[] fileData) {
FileOutputStream fos = null;

try {
fos = new FileOutputStream(path);
fos.write(fileData);
} catch(Exception e) {}
} finally {close(fos);
}


I was trying to search the solution on the internet, and it seems like windows 200 with sp2 has this problem of copying the large files. And the workaround this is to write the file in chunks.

So I could do this

int maxCount = (64 * 1024 * 1024) - (32 * 1024);
long size = fileData.length;
long position = 0;

while (position < size) {
fos.write(fileData, position, maxCount);
position = position + maxCount - 1;
}

The problem with this is for write() I cannot pass long for position, it has to be int, its write(byte[],long,int)

Can anyone please suggest a solution to this problem?

Thank you,
- Gayatri
15 years ago
Hi,

I have a two forms

<form name="a" action="a.jsp" method="post">
.....
</form>

and one more form
<form name="b" action="b.jsp" method="post">
.....
</form>

and from these forms I am calling a javascript function that is written in a different file. In the function I want to get the name of the form "a" or "b".

Is it possible?

Thanks,
- Gayatri
Thanks
Hi,

here the simple code i have.

What I want to do when a person selects something from the select list, onchange its value should be copied into the text box.

<html>
<head>
<script language="Javascript">
function change(form) {
var m = form.cars.value;
form.textb.value = m;
return true;
}
</script>
</head>

<body>


<form>
<select name="cars" onchange=javascript:change(form)>
<option value="1">Volvo
<option value="2">Saab
<option value="3">Fiat
<option value="4">Audi
</select>

<input type="text" name="textb" value="Volvo">
</form>

</body>
</html>

What actually happens here is, suppose if I change the selection to "Fiat", the value in the text box would be "3" not "Fiat". I want the names for the corresponding values that I have given, not the numbers(values)

I know I can change the values itsself from the numbers to the names, but I don't want to do that..
Is there any other way to get the names??

Thanks
Hi,

we need to upload a file to a website regularly. This website has a login, password and then a button to browse the file and a upload button to upload the file.

Have been doing this manually till now, is it possible have a program that could upload the file to the website?

Thanks,
- Gayatri
15 years ago
I don't think women cannot be good programmers, they surely can be and there are many, but then women manage home too (which "some" guys don't even think of giving a helping hand at). The programming job is very demanding, so most women have to leave jobs to manage homes and children of you guys who think women cannot program..
15 years ago
HI,

I have a bean that has a list of names
the bean has name="companyNames" property="cName"

In the front end I want to manipulate these names for display purposes and so, want to do so using Java in the jsp page

Can I have this list in a Java string array
something like

<bean efine id="iNames[]" name="companyNames" type="java.lang.String[]" />

so that I can use the iNames[] array
<% System.out.println(iNames[0]); %> in jsp


Is there any way to do this?

I hope I was clear in telling what I wanted..

Thanks,
- Gayatri
15 years ago