Priya Vasudevan

Greenhorn
+ Follow
since Mar 19, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Priya Vasudevan

I am facing issues in invoking a javascript from the SWT code.
The javascript code is written to initialize the scanner.

I create a new instance of org.eclipse.swt.browser.Browser and
boolean setUrl= htmlBrowser.setUrl(<html file path> ;
setUrl returns true.The HTML file sets some global javascript variables.

boolean result=htmlBrowser.execute("scanner_id=\"<object id=WebScanner classid='clsid:2FB3B04B-DE1A-11D2-9543-00A0C996209D' OnDataEvent(Status)='WebScanner_OnDataEvent(Status)'><param name='allowScriptAccess' value='sameDomain'/> </object>\";");
boolean result1=htmlBrowser.execute("document.body.insertAdjacentHTML('AfterBegin', scanner_id);");

result returns true and result1 returns false.

If i add htmlBrowser.execute("alert('test');"); before result1, then i get result1 also to be true.
The scanner gets initialized properly.

I understand that it is weird,but am clueless on why this happens.
Is there any way to get rid of the alert statement and still get result1 as true??

Any pointers are truly appreciated.

Thanks!!
17 years ago
Hi,

I would like to know if its possible to sort the column headers of a table,using Jasper Report?

Do let me know on this asap..


Thanks and Regards,
Priya
Hi...

I encounter a problem when i send a e-mail from my SMTP code.I am using mail.jar(version 1.3.2) and activation.jar(version 1.0.2)- downloaded from sun's site.And i have included it in the class-path.

This is the stackTrace i get when i set session.setDebug(true).
Pls. do let me know on how to resolve the same,as soon as possible.

DATA
354 Please start mail input.
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/related;
boundary="----=_Part_0_1148921.1115718020781"
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:841)
at javax.activation.DataHandler.writeTo(DataHandler.java:295)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1206)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1611)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:526)
at com.fiorano.adapter.jca.smtp.cci.SMTPInteraction.sendMessage(SMTPInteraction.java:396)
at com.fiorano.adapter.jca.smtp.cci.SMTPInteraction.execute(SMTPInteraction.java:326)
at fiorano.esb.adapter.jca.cci.AbstractESBInteraction.execute(AbstractESBInteraction.java:307)
at fiorano.esb.adapter.jca.cci.ESBInteractionSpec.execute(ESBInteractionSpec.java:556)
at fiorano.esb.adapter.jca.cci.ESBInteractionSpec.execute(ESBInteractionSpec.java:593)
at fiorano.esb.adapter.jca.cci.ESBInteractionSpec.execute(ESBInteractionSpec.java:602)
at fiorano.esb.adapter.jca.cci.ESBInteractionSpec.test(ESBInteractionSpec.java:426)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1013)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:688)
at mx4j.server.interceptor.InvokerMBeanServerInterceptor.invoke(InvokerMBeanServerInterceptor.java:221)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:120)
at mx4j.server.interceptor.SecurityMBeanServerInterceptor.invoke(SecurityMBeanServerInterceptor.java:84)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:120)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:120)
at mx4j.server.interceptor.ContextClassLoaderMBeanServerInterceptor.invoke(ContextClassLoaderMBeanServerInterceptor.java:194)
at mx4j.server.MX4JMBeanServer.invoke(MX4JMBeanServer.java:1043)
at com.fiorano.jmx.api.JMXOperation.invoke(JMXOperation.java:112)
at com.fiorano.rar.dmi.RARComponent.execute(RARComponent.java:247)
at com.fiorano.rar.actions.RARComponentTestAction$4.run(RARComponentTestAction.java:130)
at foxtrot.AbstractWorkerThread$1.run(AbstractWorkerThread.java:39)
at java.security.AccessController.doPrivileged(Native Method)
at foxtrot.AbstractWorkerThread.runTask(AbstractWorkerThread.java:35)
at foxtrot.workers.SingleWorkerThread.run(SingleWorkerThread.java:196)
at foxtrot.workers.SingleWorkerThread.run(SingleWorkerThread.java:179)
at java.lang.Thread.run(Thread.java:534)

Regards,
priya
19 years ago
Hi,

I encounter a similar problem when i send a e-mail form my SMTP code.I am suing mail.jar(version 1.3.2) and activation.jar(version 1.0.2)- doenloaded from sun's site.And i have included it in the class-path.

This is the stackTrace i get when i set session.setDebug(true).
Pls. do let me know how you resolved it.



Regards,
priya

[ UD: added CODE tags ]
[ June 22, 2006: Message edited by: Ulf Dittmer ]
19 years ago

Originally posted by Stan James:
I don't know C so I'm guessing at how to diagnose this.

* Is the size the same? 4-bytes on both sides?
* Is the order the same? See this Endian Essay for what I mean.

In any case, I'd read one byte / char at a time and display them to see what's going on. Let us know what you find!





Hi stan,Thanks for the response.

am able to receive them in a byte array.
and yeah,sizeof int in both C and Java is 4.

I don't know if this is the right place to post my query,but this problem was encountered, during the socket commn. between C and Java

I created a structure,struct1 on C-end with contents as int,char[15],char[15],int.
Now,i Have another structure,struct2 with the reference of struct1 in it.
The actual size of struct1 is 38,but when i say sizeof(struct1) or sizeof(struct2),it gives me 40.
Extra zero values are padded after the 2nd char[] and thereby,I face problems in reading the 2nd int value.

Can anyone help me with this??
The server is coded in C and client is coded in Java.
I have a struct in C with a few primitive data-types like int,char[].The message structure is sent via socket.
Say,i sent an int value of 4 from the C-side.

I use a DataInputStream on the Java-end and read the contents of the message into a byte[].When i try to read the 1st 4 bytes,which denote an int,i get a huge value.
I also tried DataInputStream.readInt(),but it gives the same value.

Now,I need to retrieve the same int value,that was sent from the C-side.

Any suggestions??

Thanks,
Priya

Originally posted by Yaroslav Chinskiy:
You can try to create a queue and queue reader that sends data over the sockets. The other threads will put messages on that queue.



Multiple threads on the client side need to establish connection to different servers.If thread T1 needs to send data to IP1 and thread T2 also needs to send data to IP1, T2 needs to wait for the socket descriptor to get free.
Would it improve performance by opening multiple socket descriptors for each Thread,on the client end, so that simultaneously messages can be sent??
Is it possible for multiple threads to access the same socket descriptor,to send different messages, without any synchronization issues??

The messages are sent over TCP/IP.

Originally posted by Mani Ram:
It mean that the method or the attribute has class scope (i.e they are static)


ok,so static variables/methods are underlined in class diagrams.
Thanks,mani.That was quick response.
Hello,
I have a Threaded Java server, which needs to access multiple clients.
The server is started at a port specified from another class.I invoke the constructor of the Java server only once and start the server at the specified port.Now,i would like my server to listen continuously to my client, whenever the client sends a request.
The code is attached below:
<CODE>
import java.io.*;
import java.net.*;

public class JavaServer extends Thread{
static int port;
Dispatcher dispatch;
ServerSocket server_socket;
Socket s;


/**
* Deafult constructor
*/
public JavaServer(){ }
/**
* Overloaded Constructor,starts the server at the specified port
* @param p int
* @param dispatch Dispatcher
*/
public JavaServer(int p,Dispatcher dispatch) {
this.dispatch=dispatch;
port = p;

try {
System.out.println("before Socket port..");
server_socket = new ServerSocket(port);
System.out.println("Server started on port " +port);
}
catch (IOException io) {
System.out.println(" IO Exception " + io);
io.printStackTrace();
}
while(true){
while(this.acceptConn()){
System.out.println( "**** Client's connection accepted !! *** " );
start();//<b> $$$$$$$$$$$$$$$$$$I get the error java.lang.IllegalThreadStateException here </b>$$$$$$$$$$$$$$$$$$$$$
}
}
}

public boolean acceptConn(){

System.out.println("within accept........");
boolean bool=false;
try {
s = server_socket.accept();
System.out.println(
"server side i/p and o/p stream associated with socket...");
bool=true;
}
catch (UnknownHostException io) {
System.out.println(" Unknown host " + io);
io.printStackTrace();
}

catch (IOException io) {
System.out.println(" IO Exception " + io);
io.printStackTrace();
}
return bool;
}
/**
* This method is invoked when the Receiver is started.
*/
public void run(){
DataOutputStream dos = null;
int i = 0;
InputStream is = null;
BufferedReader bf = null;

try {
dos = new DataOutputStream(s.getOutputStream());
is = s.getInputStream();
bf = new BufferedReader(new InputStreamReader(is));
System.out.println("Waiting for response.." + bf);
long start=System.currentTimeMillis();
System.out.println(" **** Start time is **** "+ start);
dispatch.dispatchMessage(bf,start);
}

catch (IOException io) {
System.out.println(" IO Exception " + io);
io.printStackTrace();
}

}//end of run()

}//end of class
</CODE>
I understand that start() is invoked only once in the lifecycle of Thread.But,now,i have to invoke it multiple times.How is it done??
Thanks!!
[ April 29, 2004: Message edited by: Priya Vasudevan ]
[ April 29, 2004: Message edited by: Priya Vasudevan ]
Hello,
am using Rational Rose for design purposes.what would a underlined method or underlined class variable denote in a class diagram, constructed using Rational Rose??. I couls't find this in the Help of Rose.
Thanks!!

Originally posted by Stan James:
Yup, show us where you're going in a little more detail. You can't have multiple threads reading from the same socket at the same time. But you could have a driver that reads a message and hands it off to a thread for handling. The driver could read at the speed of the network and not be slowed down by the server code that runs in response to each message.

The logic would be something like:

Hmmm, there must be a cleane way to say that without three reads. Lemme know if that's going the right direction.
If you get tons of messages faster than you can handle them you'll wind up with tons of threads which could be very bad. If the number of threads or the overhead of creating them becomes a problem, look into thread pools. The Jakarta Commons has a nice one.


Hi Stan,

Instead of reading the message and passing each message to a Thread,I want the Thread to read the message till it encounters a #.Have already sent the code.I would alsolike to know,if there would be a better preformance this way!!!
I tried using your code as well,but it gives me NullPointerException,when it tries to read the message the 2nd time...though it works well the first time.
Thanks!!
Hi,
The code in the Java server is as follows:

This is where the socket accepts messages from the client,and the socket's instance is passed as parameter to a Runnable thread from the thread pool
The code in New Thread is


Here,r is a read class,which has a synchronized read() method.This method is called in the read() of the Thread.
The code for read() is:

Can u help me with it now??
Thanks!!
hello,
I have a Javaserver and my client send X messages to the server.Each messsage is terminated by a # and my javaserver uses this to identify end-of-message.Now,i want each thread to read a message till it encounters #.Since all threads would read the messages,I thought the read logic needs to be synchronized.My javaserver just starts X threads from a Threadpool.I call the synchronized read method from the run() of the Runnable worker thread.But it doesn't seem to work right.The read logice works well for the 1st message only.
I can't figure out where i went wrong??..could u help me with it...
Thanks!!
hello,
Could you help me find out an implementation of Thread Pool,that keeps track of minimum no. of threads,max. no. of threads in the pool,the increment size of threads,number of idle threads,idle time allowable for a thread,etc...
I also need to know if it is possible to have >5000 threads in a ThreadPool,beacuse I get OutofMemoryError,when I used a ThreadPool( which didn't have any of the above-mentioned parameters!)
Thanks!!!