Srihari Injeti

Ranch Hand
+ Follow
since Jan 05, 2001
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 Srihari Injeti

Thanks for your reply. I was doing the same. It works for me as long as the second field is empty.

If the second field is not empty, then it passes the validwhen, and starts validating against the subsequent validators mentioned.

One solution is to blank out the second field when the first checkbox is checked, as we dont intend to validate the second field.

But the requirement is not to blank out the field. For instance, if the user changes his mind, we would like to keep whatever was entered.

I was hoping I can do this without writing a custom validator.
17 years ago
try this
<html-el:image src="/path/yourimage.gif" property="myproperty" />

image type is a submit button
17 years ago
Hi,
I have a requirement where I need to skip validating a field if a check box is checked. How can I use validwhen to achieve this.

Thanks

Sri
17 years ago
Hi,

I have a requirement where I need to call an Oracle procedure
from a shell script.
Let us say that the procedure is procA( myDate IN DATE);

I need to pass system date to it from the shell script.
I can use "date" command in shell to get the date and if necessary
to format it using something like `date "+%d-%h-%y %H:%M:%S"`.

I am getting an error
ORA-01830: date format picture ends before converting entire input string

How can I pass sysdate to the procedure without getting this error ?

Any help/suggestions is appreciated.

Thanks

Sri
19 years ago
Hi
we are experiencing problems with our web application.
We are increasingly getting Oracle - NO More Open cursors error.
On investigating our code we found that there is
a piece of code where we are executing a Prepared Statement in a loop with different parameters.We are not closing the statement between the executions. Instead it is closed after the loop.
Does any one know what the best practice is.
I am not sure if there is a gain/loss in performance in keeping the statement open. We are using JDBC 2.0.
I would appreciate any pointers.
Thanks
21 years ago
I would like to execute a compiled class which is part of a jar from command line. The class has a main method.
21 years ago
Does any one know if there is Open Souce code for CSV parsers.
Your help is very much appreciated.
Thanks
Sri
22 years ago
Hi Dirk,
How do I go about doing this. Can you give me an example. How can I parse through the stuff. Where can I store the output stream after I parse it. I cannot store it on the disk and read back from it to parse it again for a second time.
I appreciate your help
Thanks
Sri

Originally posted by Dirk Schreckmann:
What about something simple...
Before parsing the text with StreamTokenizer, go through it and add a space (or anything you'd like) between two consecutive commas.

22 years ago
Hi,
In my application we are using StreamTokenizer to
read a file. We are using the constructor
StreamTokenizer(Reader r).
The file is in comma separated format. OUr requirement is to split the data into tokens using comma(,) as the whitespace character. All other characters are made as ordinary characters
using the method resetSyntax(). Then we use the next Token method in a loop to extract the data.
But the problem arises when the data in the file
is like this:
40,,44,56,,,78,,,,
Note that there is nothing between the commas.
In this case the nextToken method just skips these empty data cells. But we need to identify these empty or null data. Please help with any suggestions. I am not sure if StreamTokenizer is going to help.
The code :->
public class MyParser {
private StreamTokenizer parser;

public MyParser() {
super();
}
public MyParser(Reader in) {
super();
if (!(in instanceof BufferedReader)) {
BufferedReader br = new BufferedReader(in);
parser = new StreamTokenizer(br);
}
else parser = new StreamTokenizer(in);
init();
}

public String[] getRow() throws IOException {
List results = new ArrayList();
if ((parser.ttype == 0) || (parser.ttype == parser.TT_EOL)) parser.nextToken();

while ((parser.ttype != parser.TT_EOL) && (parser.ttype != parser.TT_EOF)){


if (parser.sval != null) results.add(parser.sval);
parser.nextToken();



}
String[] retArray = new String[results.size()];
for (int i = 0; i < results.size(); i++){
retArray[i] = (String) results.get(i);
}
return (retArray);
}
public boolean hasMoreRows(){
return !(parser.ttype == parser.TT_EOF);
}
private void init() {

parser.resetSyntax();
parser.whitespaceChars(',', ',');
parser.quoteChar('"');
parser.wordChars(' ',' ');
parser.wordChars(32,43);
parser.wordChars(45,255);
parser.eolIsSignificant(true);

}
public static void main(String[] args) {
try {

URL url = new URL("ftp//myserver");
url.openConnection();
InputStream ftp = url.openStream();
InputStreamReader ftpr = new InputStreamReader(ftp);
MyParser my = new MyParser(ftpr);
java.io.LineNumberReader ln = new java.io.LineNumberReader(ftpr);

do {

String[] st = my.getRow();
System.out.println("START NEW ROW"+ " " + st.length);
for (int i =0; i < st.length; i++){
System.out.println(st[i] + " " + st[i].length());

}

} while (my.hasMoreRows());
}
catch (Throwable t){
t.printStackTrace();
}


}empty or null
22 years ago
Hi Guys,
I have to use a framework where a certain class say A should always call a method m of an Implementaion of an interface IMain.
This method returns an object of type Interface ISingle.
Lets say the class SingleImpl implements ISingle
My requirement is to some how, get a composition of SingleImpl objects to be returned as a result of the call to the method m.
I created another Interface IMulti which extends ISingle.
IMulti contains an additional method that returns an object of type ISingle.
I am planning to create a class MultiImpl that implements IMulti.
Next I will code method m such that it returns an object of type IMulti which is implicitly typecast to ISingle by the method.
When I call the method, I will again typecast the returned object to IMulti.
I am not sure if I am thought proces is correct or if there is a flaw in it.
I would very much appreciate any suggestions.

Interface ISingle {
void methodA();
}
Interface IMulti extends ISingle {

ISingle getNextSingle();
}
class SingleImpl implements ISingle{
----
}
class MultiImpl implements IMulti{
void setSingleList(List singleList){

}
Thanks
22 years ago
Thanks guys, for your suggestions. The problem with the simple
insert is due to the version of Oracle. Instead of a simple insert , I now use a stored procedure and call it directly from
NetDynamics which is the application server we use. I was earlier trying to use a shell script to call the procedure.
NetDynamics also has a limit some where around 40000 characters.
But my requirement is usually between 10000 to 20000 so I am safe there.

------------------
Srihari Injeti
SCJP2 MCP CIW
22 years ago
Hi,
I have a requirement to insert data into a column that is defined as LONG. We are using Oracle 7.3.4..
I am unable to insert more than 2000 characters into this table.
To insert this I had to write a stored procedure that did the Insert. A simple insert woudnt work. The data to be inserted is entered using a web form. I also have a problem of retrieving the data. I have to display the data using a java servlet.
Any Suggestions are most welcome.
Srihari
22 years ago
Hi,
I have a shell script that returns error codes. exit 0 for success and 1,2,.. for different error conditions.
How can I capture these codes when I run the shell script using the Runtime class.
This is what I did:

fileName ="myFile.txt"
String[] cmd1={"/filePath/run_ftp_job", fileName};
Process pr = null;
Runtime myRuntime= Runtime.getRuntime();
pr = r.exec(cmd1);
//To wait for the process to complete
int waitvalue= pr.waitFor();
int returnedValue= pr.exitValue();

-------------------------------------------
I am only getting 0 or 1 as values for the "returnedValue",
no matter what is returned as exit code
How can I capture the exit codes.
Thanks

22 years ago
Hi guys,
I am sure some one knows the answer to my question
please help !!
22 years ago

Originally posted by Vlad Patryshev:
Files can as well be uploaded and downloaded via multipart HTTP requests. Writing this kind of stuff in JSP is pretty straightforward.


Hi,
I have to use only pure java for this. No JSP. And the files to be moved are not on the desktop. I am first uploading the files from the local machine to the App server, by using multipart Http request. But I have to then transfer it to a Database server. This Database server is within the firewall and the FTP ports are not opened for security reasons.
1. Can I still use Http Multipart request? and if so, how?.
Can anyone give me an example.
2. What other options do I have?
3. I am sure some one might have come across a similar situation.
Please give me your input guys !!
Thanks

------------------
Srihari Injeti
SCJP2 MCP CIW
22 years ago