On 10/13/10 3:28 AM, danielf wrote:
Either send the commands separately in the Simple API call (rather
than just a load statement), or load the plotdatafile.sage from a
URL, like:
load('http://mysever.com/plotdatafile.sage')
Those are two ways that come to mind.
Jason
Dear Jason,
sorry, I can not understand your suggestions at all:) I try to
explain better below. (Could it be that the documentation to the API
is hard to find. What I managed so far comes from old threads in
different groups.)
Here are the docs:
http://sagemath.org/doc/reference/sagenb/simple/twist.html
In the end it comes down to: How to I manipulate the contents of a
notebook from outside the notebook? The desired result is a graphic
display (simple plot for example) in a browser window that can be
accessed by anyone. Would you mind to explain for a sage newbie.
The simple server API (which is what is used to interact with Sage over
the web outside of the notebook) does not change worksheets. Instead,
think of it as:
* Your web browser sends what would normally be in a code cell to the
Sage server
* Sage responds back with the output of the cell (plus the names of
files created, etc.)
So my problem persists: Whatever I send to the notebook I still do
not know where I can see the result.
This is the current situation in greater detail: The request
http://localhost:8000/simple/compute?session=ecd61726370feecb3dc168e6728c1aa5&code=load+%27%2Fhomes%2Fdafu%2Fpythontestproject%2Fplottester.sage%27
produces this output (in my case in the java console since I
generate the above http in a java program including the session ID):
============================================================
expression ={ "status": "done", "files": ["sage0.png"], "cell_id": 2
} ___S_A_G_E___
<html><font color='black'><img src='cell://sage0.png'></font></html>
============================================================
What http-link must I give to the browser to see the plot and how
can I display it in a worksheet such that I could also introduce
counters or sliders?
From an example in the docs listed above, it appears that the file
should be at:
http://localhost:8000/simple/file?session=ecd61726370feecb3dc168e6728c1aa5&cell=2&file=sage0.png
(replace the session, cell number, and file name as appropriate)
Note that Sage interacts do not work outside the notebook, so if you
want sliders or counters, you'd have to do them yourself. We would love
to have the capability for interacts to work outside the notebook;
volunteers are welcome to work on it!
The file plottester.sage is a little script reading, analysing and
plotting data. It can not be sent line by line. (BTW, sending just
one line of code like "factor(2^20 -1)" does not make a difference. I
do not know where to see the result in the browser, it does not just
pop up.)
Again, an example in the docs says that the answer comes in the response
after the ___S_A_G_E___ part.
Does that help?
Thanks,
Jason
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org