Jason wrote: > It looks like you're using the trick of asking Sage to evaluate some > text using cell id -1. This is a hack right now, as cell ids are > supposed to be nonnegative numbers. Currently, though, the output > directories are created and the right .py file is created and sent to > SAGE. Problems can crop up if you happen to have two requests going to > Sage simultaneously (one request overwrites the other since they're both > for cell -1). Also, Sage complains that cell -1 wasn't defined before > sending the text to it. I think there may be other places in the code > where the id is assumed to be nonnegative.
This is where I need to get my mind around the notebook code better. What I am doing now is the following: 1) When the applet launches, it injects an applet_callback function into the browser: win = JSObject.getWindow(this); win.eval("function applet_callback(status, response_text) {" + "document.mathrider.response( status, response_text );"+ "}" ); 2) When the user enters code into the Send text area, the applet calls the async_request function and gives the applet_callback function as the callback (I have been experimenting with different values for newcell and id to see what effect they have): String code = sendTextArea.getText(); String encodedCode = URLEncoder.encode(code,"UTF8"); win.eval("async_request(worksheet_command('eval'), applet_callback, 'newcell=1&id=11&input="+ encodedCode +"');"); 3) The response method in the applet is called by the applet_callback function to handle the response: public void response( String status, String response_text ) { receiveTextArea.append("\nStatus: " + status + " Response: " + response_text + "\n"); }//end method. Eventually, I see different parts of the applet communicating with the server concurrently. To enable multiple concurrent submissions to the server, I was thinking about maybe having response objects in the applet handle the replies. In light of this approach, I am going to have to study your enhancement proposals further to better understand how they would work. Ted --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---