public single cell server

187 views
Skip to first unread message

Jason Grout

unread,
Jul 29, 2011, 8:11:16 PM7/29/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com, sage-n...@googlegroups.com
Hi everyone,

I'd like to announce a trial beta run of a public single cell server:

http://sagemath.org:5467/

The idea is that this is a single cell that can very easily be embedded
in any webpage. This is the start of a comprehensive Sage web service
as well, and lays a piece of the ground work for a much more scalable
model for doing computations in the normal notebook.

It's ready to be hammered by the larger community at this point. I will
be mentioning this next week at Mathfest, so please try to break it :).
I think just about any normal Sage computation should work. Please
report any errors to me.

We've also rewritten interacts, so please especially test interacts.
There are some exciting new features for interacts in this rewrite that
I can detail later. The main focus for this testing is that current
existing interacts should work unchanged, hopefully.

Thanks especially to Ira Hanson and Alex Kramer for doing much of the
design and implementation work (funded by Drake University and the NSF),
to William for an early version, and Fernando Perez and Robert Bradshaw
for many helpful conversations. I'm sure there are people I've missed
who have contributed in some way; please let me know if I've missed someone!

The repository for the code is:
https://github.com/jasongrout/simple-python-db-compute. The
instructions are not quite up to date, but I'll be working on those soon.

Thanks,

Jason

--
Jason Grout

P Purkayastha

unread,
Jul 29, 2011, 11:15:41 PM7/29/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com, sage-n...@googlegroups.com
Hi,
 Some computations ran fine. However, the code from http://wiki.sagemath.org/interact/ didn't. Only the first order is shown, and moving the slider provides no update.
  basu.

Jason Grout

unread,
Jul 30, 2011, 2:05:54 AM7/30/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com


Thanks. That is fixed now.

Jason

John Cremona

unread,
Jul 30, 2011, 4:35:37 AM7/30/11
to sage-...@googlegroups.com
Looks nice! Is it necessary to have the "Computation ID" block so
visible? After a few evaluations I could no longer see the output
without scrolling down.

This looks as if it could be very useful!

John

> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

Jason Grout

unread,
Jul 30, 2011, 4:48:16 AM7/30/11
to sage-...@googlegroups.com
On 7/30/11 1:35 AM, John Cremona wrote:
> Looks nice! Is it necessary to have the "Computation ID" block so
> visible? After a few evaluations I could no longer see the output
> without scrolling down.

No, it's not necessary; thanks for the suggestion. In fact, when
embedding in a page, you can turn on or off any of those things. I just
updated things to move that computation id below the results, though.
Is that better?

Thanks,

Jason

Juanlu001

unread,
Jul 30, 2011, 5:40:21 AM7/30/11
to sage-n...@googlegroups.com, sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com
I have tested multiple interacts of mine and some computations, and everything seems to work quite well except for the backslash \, which I tried to use to split lines. It gives a syntax error:

SyntaxError                               Traceback (most recent call last)
SyntaxError: invalid syntax (<string>, line 57)
The line number depends on the length of the code.

Anyway, well done :)

leif

unread,
Jul 30, 2011, 6:25:40 AM7/30/11
to sage-devel
Yep, to me it is.

It would also be nice to have some indicator showing whether the
computation is still running.

(Usually I would just change the "Evaluate" button, but that is
apparently also used to restart the current computation.)

I wonder if it would make sense to have an [optional?] scroll bar for
the output as well. In that case, I would even put the output box
*above* the input / code box (like pocket calculators, phones and IRC
clients have it ;-) ). But perhaps that's also customizable when
embedding it into a page.


I observed that the output is interspersed with additional blank lines
(one or more in sequence), depending on how fast the server delivers.


-leif

Jason Grout

unread,
Jul 30, 2011, 6:34:49 AM7/30/11
to sage-...@googlegroups.com
On 7/30/11 3:25 AM, leif wrote:
>
> On 30 Jul., 10:48, Jason Grout<jason-s...@creativetrax.com> wrote:
>> On 7/30/11 1:35 AM, John Cremona wrote:
>>
>>> Looks nice! Is it necessary to have the "Computation ID" block so
>>> visible? After a few evaluations I could no longer see the output
>>> without scrolling down.
>>
>> No, it's not necessary; thanks for the suggestion. In fact, when
>> embedding in a page, you can turn on or off any of those things. I just
>> updated things to move that computation id below the results, though.
>> Is that better?
>
> Yep, to me it is.
>
> It would also be nice to have some indicator showing whether the
> computation is still running.


This is https://github.com/jasongrout/simple-python-db-compute/issues/161

>
> (Usually I would just change the "Evaluate" button, but that is
> apparently also used to restart the current computation.)
>
> I wonder if it would make sense to have an [optional?] scroll bar for
> the output as well. In that case, I would even put the output box
> *above* the input / code box (like pocket calculators, phones and IRC
> clients have it ;-) ). But perhaps that's also customizable when
> embedding it into a page.


Yep; all of this is customizable when embedding into a page. Just set
the sizes, positions, and CSS however you want.

>
>
> I observed that the output is interspersed with additional blank lines
> (one or more in sequence), depending on how fast the server delivers.
>

This is now
https://github.com/jasongrout/simple-python-db-compute/issues/174

Thanks,

Jason


John Travis

unread,
Jul 30, 2011, 10:57:53 AM7/30/11
to sage-devel
Awesome.

A real minor problem I found was with labels in interact. No latex
for such as

def _( x0 = input_box(0,width=5,label='$x_0$'), blah

Also, %hide does not work but it would be nice to have the option when
shelling out from something like WebWork. Indeed, when using
interacts, it might be nice to be able to turn off everything else
other than the interactive output window and an evaluate button.
Maybe the addition of %hide command in this context would turn off the
code box (other than some small way to get it back), "Upload files",
and all but the latest session.

JT

On Jul 30, 5:34 am, Jason Grout <jason-s...@creativetrax.com> wrote:
> On 7/30/11 3:25 AM, leif wrote:
>
>
>
>
>
>
>
>
>
>
>
> > On 30 Jul., 10:48, Jason Grout<jason-s...@creativetrax.com>  wrote:
> >> On 7/30/11 1:35 AM, John Cremona wrote:
>
> >>> Looks nice!  Is it necessary to have the "Computation ID" block so
> >>> visible?  After a few evaluations I could no longer see the output
> >>> without scrolling down.
>
> >> No, it's not necessary; thanks for the suggestion.  In fact, when
> >> embedding in a page, you can turn on or off any of those things.  I just
> >> updated things to move that computation id below the results, though.
> >> Is that better?
>
> > Yep, to me it is.
>
> > It would also be nice to have some indicator showing whether the
> > computation is still running.
>
> This ishttps://github.com/jasongrout/simple-python-db-compute/issues/161

Benjamin Jones

unread,
Jul 30, 2011, 12:14:30 PM7/30/11
to sage-...@googlegroups.com
On Fri, Jul 29, 2011 at 7:11 PM, Jason Grout
<jason...@creativetrax.com> wrote:
> Hi everyone,
>
> I'd like to announce a trial beta run of a public single cell server:
>
> http://sagemath.org:5467/
>
> The idea is that this is a single cell that can very easily be embedded in
> any webpage.  This is the start of a comprehensive Sage web service as well,
> and lays a piece of the ground work for a much more scalable model for doing
> computations in the normal notebook.
>
> It's ready to be hammered by the larger community at this point.  I will be
> mentioning this next week at Mathfest, so please try to break it :).  I
> think just about any normal Sage computation should work.  Please report any
> errors to me.
>
> We've also rewritten interacts, so please especially test interacts. There
> are some exciting new features for interacts in this rewrite that I can
> detail later.  The main focus for this testing is that current existing
> interacts should work unchanged, hopefully.
>

This is fantastic. I've been thinking about potential uses for this
since I watched the recording of your talk about it at the recent Sage
notebook days.

One suggestion, is it possible to make the input text box resizeable
so that the user can see more than 15 lines at a time? I didn't look
into the docs closely so maybe this is already an option.

Thanks!

--
Benjamin Jones

Jason Grout

unread,
Jul 30, 2011, 1:46:59 PM7/30/11
to sage-...@googlegroups.com
On 7/30/11 7:57 AM, John Travis wrote:
> Awesome.
>
> A real minor problem I found was with labels in interact. No latex
> for such as
>
> def _( x0 = input_box(0,width=5,label='$x_0$'), blah


I noticed this when testing one of your interacts yesterday and created
an issue for it:
https://github.com/jasongrout/simple-python-db-compute/issues/168


>
> Also, %hide does not work but it would be nice to have the option when
> shelling out from something like WebWork. Indeed, when using
> interacts, it might be nice to be able to turn off everything else
> other than the interactive output window and an evaluate button.
> Maybe the addition of %hide command in this context would turn off the
> code box (other than some small way to get it back), "Upload files",
> and all but the latest session.


You can already include code in the html of the page, which is
automatically picked up when you create the singlecell. I haven't tried
turning off the edit box after you do that (it would be easy to use CSS
to hide the edit box and/or make it non-editable). This is definitely
in the plans to make this work nicely, though. One of the major uses
will be interacts that are seamlessly embedded in webpages (i.e., just
the controls and the output).

Thanks for your testing and suggestions!

Jason

Jason Grout

unread,
Jul 30, 2011, 1:51:24 PM7/30/11
to sage-...@googlegroups.com

I experimented with having the edit box auto-grew up to about 30 lines,
but it didn't seem to be quite as nice. It's a single-line change to
the CSS to make it autogrow (with upper and lower limits).

Would you suggest making the box auto-grow? How many lines do you think
it should have at minimum or maximum?

Thanks,

Jason

Kelvin Li

unread,
Jul 30, 2011, 3:01:41 PM7/30/11
to sage-devel
Wow, this is really neat!

Out of laziness/incompetence to do any deeper investigation, I will
list my complaints in no particular order. :-)

The syntax highlighting is really cool, but when there is a lot of
text, scrolling through it with the arrow keys can be slow/jerky (at
least in my browser: Firefox 5.0 on Linux).

It looks like the 3D plotters "jmol" and "tachyon" work (but I don't
have a java plugin to know for sure), but "canvas3d" does not. It
gives me a link to a file that I can download (??). It works on
sagenb.org -- which hopefully rules out my browser as the issue.

For interacts, looks like "input_grid" and "color_selector" widgets
have problems. To reproduce:

@interact
def f(a = input_grid(nrows=0, ncols=0)):
pass

(throws a syntax error about an internal file)

@interact
def f(a = color_selector()):
print a

(widget mis-renders in my browser. I took screenshots, but I don't
know where to upload the images.)

The other interact widgets I tested all work.

Note that all of the above results were correct as of last night. For
some reason, none of the interacts or plots is working for me this
morning.

Anyways, that was my attempt at hammering it. :-)

Kelvin

Jason Grout

unread,
Jul 30, 2011, 5:09:40 PM7/30/11
to sage-...@googlegroups.com
On 7/30/11 7:57 AM, John Travis wrote:
> A real minor problem I found was with labels in interact. No latex
> for such as
>
> def _( x0 = input_box(0,width=5,label='$x_0$'), blah

This is fixed now; if you have time, please test it.

Thanks,

Jason


Jason Grout

unread,
Jul 30, 2011, 5:25:33 PM7/30/11
to sage-...@googlegroups.com
On 7/30/11 12:01 PM, Kelvin Li wrote:
> Wow, this is really neat!
>
> Out of laziness/incompetence to do any deeper investigation, I will
> list my complaints in no particular order. :-)
>
> The syntax highlighting is really cool, but when there is a lot of
> text, scrolling through it with the arrow keys can be slow/jerky (at
> least in my browser: Firefox 5.0 on Linux).
>

Soon I will make it so that you can just have a non-colored plain text
box, or toggle between the fancy and non-fancy editors.

> It looks like the 3D plotters "jmol" and "tachyon" work (but I don't
> have a java plugin to know for sure), but "canvas3d" does not. It
> gives me a link to a file that I can download (??). It works on
> sagenb.org -- which hopefully rules out my browser as the issue.

This is now being tracked at
https://github.com/jasongrout/simple-python-db-compute/issues/178.

>
> For interacts, looks like "input_grid" and "color_selector" widgets
> have problems. To reproduce:
>
> @interact
> def f(a = input_grid(nrows=0, ncols=0)):
> pass
>
> (throws a syntax error about an internal file)

This is now fixed. Can you test it please?

>
> @interact
> def f(a = color_selector()):
> print a
>
> (widget mis-renders in my browser. I took screenshots, but I don't
> know where to upload the images.)

This is now fixed. Can you test it please?


>
> The other interact widgets I tested all work.

Great!

>
> Note that all of the above results were correct as of last night. For
> some reason, none of the interacts or plots is working for me this
> morning.


That's interesting that they worked last night---they shouldn't have.
Maybe you had some things loaded in cache from a while ago, but your
cache has been cleared since then...


>
> Anyways, that was my attempt at hammering it. :-)

Thanks!

Jason

Kelvin Li

unread,
Jul 30, 2011, 10:58:45 PM7/30/11
to sage-devel
On Jul 30, 5:25 pm, Jason Grout <jason-s...@creativetrax.com> wrote:

> Soon I will make it so that you can just have a non-colored plain text
> box, or toggle between the fancy and non-fancy editors.

That would be cool!

> > For interacts, looks like "input_grid" and "color_selector" widgets
> > have problems. To reproduce:
>
> > @interact
> > def f(a = input_grid(nrows=0, ncols=0)):
> >      pass
>
> > (throws a syntax error about an internal file)
>
> This is now fixed.  Can you test it please?

Sorry, I broke it again:

@interact
def f(a = input_grid(nrows=1, ncols=2, to_value=lambda t:3)):
pass

(throws an error that looks very similar to the previous one)

> > @interact
> > def f(a = color_selector()):
> >      print a
>
> > (widget mis-renders in my browser. I took screenshots, but I don't
> > know where to upload the images.)
>
> This is now fixed.  Can you test it please?

Passes my (very simple) tests!

> > Note that all of the above results were correct as of last night. For
> > some reason, none of the interacts or plots is working for me this
> > morning.
>
> That's interesting that they worked last night---they shouldn't have.
> Maybe you had some things loaded in cache from a while ago, but your
> cache has been cleared since then...

If I recall correctly, I tested it around 22:00 to 00:00 Pacific Time,
and that was my first time using the single cell server. Would there
be things left over in the cache? And for some magical reason, what
seemed broken this morning all works again this afternoon. :-)

Here are some more things I found (which might already be known
issues):

-- The "function?" help notation does not work. Using "help(function)"
returns raw HTML code in the cell along with an attached file that
does contain the docstring of "function".

-- Entering "graph_editor()" returns the text "Not Found / The
requested URL was not found on the server. / If you entered the URL
manually please check your spelling and try again" and the "save" and
"close" buttons of the non-functioning graph editor.

Kelvin

John Travis

unread,
Jul 31, 2011, 1:30:38 AM7/31/11
to sage-devel
Great. I'm having to look harder for problems so that's good. Check
out the spacing issue on the label rho(x,y,z) for

@interact(layout=dict(top=[['rho','a1']]))
def _(
a1 = input_box(2,label='$a_1$'),
rho=input_box(x,label='$\\rho(x,y,z)$',width=8)):
print "hello"

JT

Jason Grout

unread,
Jul 31, 2011, 2:54:38 AM7/31/11
to sage-...@googlegroups.com
On 7/30/11 7:58 PM, Kelvin Li wrote:
> On Jul 30, 5:25 pm, Jason Grout<jason-s...@creativetrax.com> wrote:
>
>> Soon I will make it so that you can just have a non-colored plain text
>> box, or toggle between the fancy and non-fancy editors.
>
> That would be cool!
>
>>> For interacts, looks like "input_grid" and "color_selector" widgets
>>> have problems. To reproduce:
>>
>>> @interact
>>> def f(a = input_grid(nrows=0, ncols=0)):
>>> pass
>>
>>> (throws a syntax error about an internal file)
>>
>> This is now fixed. Can you test it please?
>
> Sorry, I broke it again:
>
> @interact
> def f(a = input_grid(nrows=1, ncols=2, to_value=lambda t:3)):
> pass
>
> (throws an error that looks very similar to the previous one)

Yep, it should be the same error. Okay, I will have to fix this a
little more robustly. I think I know what to do. This is tracked here:
https://github.com/jasongrout/simple-python-db-compute/issues/179

>
> Here are some more things I found (which might already be known
> issues):
>
> -- The "function?" help notation does not work. Using "help(function)"
> returns raw HTML code in the cell along with an attached file that
> does contain the docstring of "function".
>
> -- Entering "graph_editor()" returns the text "Not Found / The
> requested URL was not found on the server. / If you entered the URL
> manually please check your spelling and try again" and the "save" and
> "close" buttons of the non-functioning graph editor.

Both of these are known issues and not considered show-stoppers for now.
Thanks for reporting these. The graph editor depends heavily on
hacking and kludges dealing with the current notebook, so it will need
to have some major changes to work. One reason I didn't pay too much
attention to the graph editor or the help is that these single-cell
instances are concentrating on a single execution and result. The graph
editor just builds a graph, but then you wouldn't be able to do anything
with it. Likewise, the help will return something, but then you'll need
to execute something again in order to do something with it. Both of
those sorts of computations lend themselves more towards a notebook with
multiple cells, rather than a single-cell system.

That said, we'll eventually get this working, since hopefully we can use
code and what we've learned here to make the current notebook better.

Thanks,

Jason

Jason Grout

unread,
Jul 31, 2011, 2:57:13 AM7/31/11
to sage-...@googlegroups.com
On 7/30/11 10:30 PM, John Travis wrote:
> Great. I'm having to look harder for problems so that's good. Check
> out the spacing issue on the label rho(x,y,z) for
>
> @interact(layout=dict(top=[['rho','a1']]))
> def _(
> a1 = input_box(2,label='$a_1$'),
> rho=input_box(x,label='$\\rho(x,y,z)$',width=8)):
> print "hello"


What do you see as the problem with the output? I can see that the two
textboxes are a little close together (i.e., the $a_1$ is too close to
the end of the $\rho$ textbox). Is that what you mean?

Thanks,

Jason

Jason Grout

unread,
Jul 31, 2011, 3:39:27 AM7/31/11
to sage-n...@googlegroups.com, Juanlu001, sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com
On 7/30/11 2:40 AM, Juanlu001 wrote:
> I have tested multiple interacts of mine and some computations, and
> everything seems to work quite well except for the backslash \, which I
> tried to use to split lines. It gives a syntax error:
>
> SyntaxError Traceback (most recent call last)
> SyntaxError: invalid syntax (<string>, line 57)


Backslashes should work now. Can you test it please?

Thanks,

Jason

Juanlu001

unread,
Jul 31, 2011, 4:36:28 AM7/31/11
to sage-n...@googlegroups.com, Juanlu001, sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com
Yep, it seems they work now. Great!

Rob Beezer

unread,
Jul 31, 2011, 5:55:52 PM7/31/11
to sage-devel
Kudos to Jason and the students at Drake. This is very nice.

I've tried to "hide" some of the diagnostic information, and style a
few of the remaining elements. I've done this with my own crude CSS
stylesheet and via the arguments to the singlecell creation function.
Some questions and observations.

1. Starting from the current HTML page being served from
sagemath.org, where would one add the reference to a "custom" CSS
file? I have this mostly working right, but probably not correctly.
In particular, setting many of the output parts to not display has
totally broken interacts, so in that sense what I have done is
definitely not correct.

2. Using arguments to the singlecell creation function to turn-off
the messages (three values set to false) seems to also break
interacts.

3. The default value of "outputDiv" listed in the documentation for
the dictionary of options to the single cell creation caused an error
for me, but a value of "#singlecell" does seem to work.

4. Maybe the singlecell_completion div can be not-displayed when
"messages" is false?

5. I was able to put two apparently independent single-cells on the
same page by running singlecell.makeSinglecell(alternate_config)
where alternate_config specified a different id for a second div
used to locate the cell. Maybe not news, but I did not see this
documented anywhere. In particular I was just guessing about how to
properly invoke the singlecell creation function.

6. Minor nit: CodeMirror does not handle the "F.<a> = GF(3^2)"
syntax properly.

7. Do interacts time-out after some period of inactivity? It seems
so.

Rob

Rob Beezer

unread,
Jul 31, 2011, 6:05:59 PM7/31/11
to sage-devel
On Jul 31, 2:55 pm, Rob Beezer <goo...@beezer.cotse.net> wrote:
> Some questions and observations.

Knew I was forgetting something.

8. Is there a way to "pre-load" the CodeMirror text area? Or more
precisely, what could I place into the HTML that would take some code
and load up the text area with the code as its content? Maybe this
should be an argument to the singlecell creation function?

Incidentally increasing list traffic,
Rob

Jason Grout

unread,
Aug 1, 2011, 11:50:07 AM8/1/11
to sage-...@googlegroups.com
On 7/31/11 2:55 PM, Rob Beezer wrote:
> Kudos to Jason and the students at Drake. This is very nice.

Thanks! And thanks again for testing!


>
> I've tried to "hide" some of the diagnostic information, and style a
> few of the remaining elements. I've done this with my own crude CSS
> stylesheet and via the arguments to the singlecell creation function.


Disclaimer: I haven't tested hiding elements very extensively. I
wouldn't be surprised if there was a bug or two in doing this.


> Some questions and observations.
>
> 1. Starting from the current HTML page being served from
> sagemath.org, where would one add the reference to a "custom" CSS
> file? I have this mostly working right, but probably not correctly.
> In particular, setting many of the output parts to not display has
> totally broken interacts, so in that sense what I have done is
> definitely not correct.


You should be able to add a CSS link statement at the end of the head or
the start of the body. We dynamically add CSS to the end of the head in
the embedded_singlecell.js, so there might be problems with us
overwriting your CSS rules if you have them in the head element. So
maybe try putting them at the top of the body element?

Can you post your current working/nonworking version so I can test it too?


>
> 2. Using arguments to the singlecell creation function to turn-off
> the messages (three values set to false) seems to also break
> interacts.

Can you post your current file so I can test it too?

>
> 3. The default value of "outputDiv" listed in the documentation for
> the dictionary of options to the single cell creation caused an error
> for me, but a value of "#singlecell" does seem to work.
>

Thanks; I'll take a look. The documentation likely needs to be updated.

> 4. Maybe the singlecell_completion div can be not-displayed when
> "messages" is false?

At one point, Ira implemented tab-completion, but I don't think that's
turned on now (I think we may have broken it with some extensive changes
after he implemented it). I don't think singlecell_completion serves
any purpose right now and can be removed.

>
> 5. I was able to put two apparently independent single-cells on the
> same page by running singlecell.makeSinglecell(alternate_config)
> where alternate_config specified a different id for a second div
> used to locate the cell. Maybe not news, but I did not see this
> documented anywhere. In particular I was just guessing about how to
> properly invoke the singlecell creation function.

Yes, we planned to support multiple single cells on a page, so I'm glad
it's working.

>
> 6. Minor nit: CodeMirror does not handle the "F.<a> = GF(3^2)"
> syntax properly.

Thanks for the reminder. We had to custom-hack the codemirror in Sage
to support that. I'll look at porting that hack over to codemirror2 and
the singlecell.


>
> 7. Do interacts time-out after some period of inactivity? It seems
> so.

Yes. I think 60 seconds is the timeout we currently have set up.
Computations are allowed 100 seconds of CPU time too, so that could also
cause a computation/interact to time out.

Thanks,

Jason


Jason Grout

unread,
Aug 1, 2011, 11:52:39 AM8/1/11
to sage-...@googlegroups.com

Yes. Anything in that div should show up in the Codemirror box. In
order to get plain code, I'd suggest doing what mathjax does to wrap
code (put it in a script tag):

<div id="my_singlecell">
<script type="text/python-code">
print 'hi'
print 'even < works!'
</script>
</div>


I believe making "#my_singlecell" a singlecell will then put those two
lines in the singlecell div. I may have to turn off the current
behavior of saving what was in the singlecell div and restoring it on
refresh.

Thanks,

Jason


Ondřej Čertík

unread,
Aug 1, 2011, 1:21:30 PM8/1/11
to sage-...@googlegroups.com
On Sun, Jul 31, 2011 at 12:37 AM, Jason Grout
<jason...@creativetrax.com> wrote:

> On 7/29/11 5:11 PM, Jason Grout wrote:
>>
>> Hi everyone,
>>
>> I'd like to announce a trial beta run of a public single cell server:
>>
>> http://sagemath.org:5467/
>>
>> The idea is that this is a single cell that can very easily be embedded
>> in any webpage. This is the start of a comprehensive Sage web service as
>> well, and lays a piece of the ground work for a much more scalable model
>> for doing computations in the normal notebook.
>>
>> It's ready to be hammered by the larger community at this point. I will
>> be mentioning this next week at Mathfest, so please try to break it :).
>
>
> I posted a log of all commands that have been run on the singlecell server.
>
> http://sage.math.washington.edu/home/jason/commands.html
>
> Of particular note are the commands around 2011-07-31 03:03:07.436000
> (search for that string), where someone is apparently testing the security
> of the setup.  Whoever did it, how did the security and infinite loop tests
> go?

I would be interested in that too. How do you handle such infinite
loops on the server? Do you have some limit on the CPU time allowed
per evaluation?

Ondrej

Jason Grout

unread,
Aug 1, 2011, 3:25:57 PM8/1/11
to sage-...@googlegroups.com

We setrlimit a CPU time limit (currently 100 seconds) for the process
before we execute the user code. We also set a memory limit of 2500M.
These are passed in the configuration for launching user code, and the
setrlimit happens here:
https://github.com/jasongrout/simple-python-db-compute/blob/master/device_process.py#L518


Jason

Jason Grout

unread,
Aug 1, 2011, 3:26:53 PM8/1/11
to sage-...@googlegroups.com
On 8/1/11 10:21 AM, Ondřej Čertík wrote:
> Do you have some limit on the CPU time allowed
> per evaluation?

The CPU time limit is for all user code evaluated in a single "session",
which for interacts may actually be multiple roundtrips to the server.

Jason


Jason Grout

unread,
Aug 1, 2011, 3:52:24 PM8/1/11
to sage-...@googlegroups.com
On 7/30/11 7:58 PM, Kelvin Li wrote:
> Sorry, I broke it again:
>
> @interact
> def f(a = input_grid(nrows=1, ncols=2, to_value=lambda t:3)):
> pass
>
> (throws an error that looks very similar to the previous one)

I think I've fixed it better now [1]. Can you check it again?

Thanks,

Jason

[1]
https://github.com/jasongrout/simple-python-db-compute/commit/7da35af669d78a590cb4742bbb53af50843cbbca

Jason Grout

unread,
Aug 1, 2011, 4:30:21 PM8/1/11
to sage-...@googlegroups.com
On 7/31/11 3:05 PM, Rob Beezer wrote:
> 8. Is there a way to "pre-load" the CodeMirror text area? Or more
> precisely, what could I place into the HTML that would take some code
> and load up the text area with the code as its content? Maybe this
> should be an argument to the singlecell creation function?

I just made it [1] so that if you put some code in the div before making
it a singlecell, maybe something like:

<div id="singlecell"><script type="text/code">print 'hi'</script></div>

then it won't try to restore the user's last code. However, if the
initial div is empty:

<div id="singlecell"><script type="text/code"></script></div>

then it should try to restore whatever the user last had in the cell.

Thanks,

Jason


Jason Grout

unread,
Aug 1, 2011, 4:34:57 PM8/1/11
to sage-...@googlegroups.com
On 8/1/11 1:30 PM, Jason Grout wrote:
> On 7/31/11 3:05 PM, Rob Beezer wrote:
>> 8. Is there a way to "pre-load" the CodeMirror text area? Or more
>> precisely, what could I place into the HTML that would take some code
>> and load up the text area with the code as its content? Maybe this
>> should be an argument to the singlecell creation function?
>
> I just made it [1] so that if you put some code in the div before making
> it a singlecell, maybe something like:
>


Missing reference [1]:
https://github.com/jasongrout/simple-python-db-compute/commit/c90fc0d8d3cecab9ec2062d8261aa9d8c3ef3656

Rob Beezer

unread,
Aug 1, 2011, 7:23:17 PM8/1/11
to sage-devel
On Aug 1, 8:50 am, Jason Grout <jason-s...@creativetrax.com> wrote:
> Can you post your current working/nonworking version so I can test it too?

Thanks, Jason, for all the details. I'll try to put up an example or
two, incorporating what you have suggested.

Right now, it looks like something has changed and is not working for
me. The file (listed first) throws up the error message below, and I
get nothing in the browser window.

./static/mathjax/config/TeX-AMS-MML_HTMLorMML.js

uncaught exception: Must specify an input
(?)(c=Object { config={...}, processUpdateTime=250, more...})
c = Object { config={...}, processUpdateTime=250, more...}
[Break On This Error]
(function(c){var h="1.1.1";var a=MathJ...ete("[MathJax]/config/
MMLorHTML.js");

Rob

Jason Grout

unread,
Aug 1, 2011, 7:37:53 PM8/1/11
to sage-...@googlegroups.com
On 8/1/11 4:23 PM, Rob Beezer wrote:
> On Aug 1, 8:50 am, Jason Grout<jason-s...@creativetrax.com> wrote:
>> Can you post your current working/nonworking version so I can test it too?
>
> Thanks, Jason, for all the details. I'll try to put up an example or
> two, incorporating what you have suggested.
>
> Right now, it looks like something has changed and is not working for
> me. The file (listed first) throws up the error message below, and I
> get nothing in the browser window.
>
> ../static/mathjax/config/TeX-AMS-MML_HTMLorMML.js

>
> uncaught exception: Must specify an input
> (?)(c=Object { config={...}, processUpdateTime=250, more...})
> c = Object { config={...}, processUpdateTime=250, more...}
> [Break On This Error]
> (function(c){var h="1.1.1";var a=MathJ...ete("[MathJax]/config/
> MMLorHTML.js");

Yep. You *have* to specify an inputDiv now (some selector for the main
singlecell div). It was a little silly of us to default to
'#singlecell'. See my simple example for details.

Jason


Jason Grout

unread,
Aug 1, 2011, 7:45:06 PM8/1/11
to sage-...@googlegroups.com

Sorry, I guess I haven't replied with my simple example yet. This is
soon going into the docs:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width">
<title>Simple Compute Server</title>
<script type="text/javascript"
src="http://localhost:8080/static/jquery-1.5.min.js"></script>
<script type="text/javascript"
src="http://localhost:8080/embedded_singlecell.js"></script>

<script>$(function() {singlecell.init(function ()
{singlecell.makeSinglecell({
'inputDiv': '#mysingle',
'files': false,
'messages': false,
'computationID': false});});})</script>
</head>
<body>
<div id="mysingle"><script type="text/code"></script></div>
</body>
</html>

Thanks,

Jason

Jason Grout

unread,
Aug 1, 2011, 8:07:30 PM8/1/11
to sage-...@googlegroups.com
On 8/1/11 4:23 PM, Rob Beezer wrote:
> On Aug 1, 8:50 am, Jason Grout<jason-s...@creativetrax.com> wrote:
>> Can you post your current working/nonworking version so I can test it too?
>
> Thanks, Jason, for all the details. I'll try to put up an example or
> two, incorporating what you have suggested.
>
> Right now, it looks like something has changed and is not working for
> me. The file (listed first) throws up the error message below, and I
> get nothing in the browser window.
>
> ../static/mathjax/config/TeX-AMS-MML_HTMLorMML.js

>
> uncaught exception: Must specify an input
> (?)(c=Object { config={...}, processUpdateTime=250, more...})
> c = Object { config={...}, processUpdateTime=250, more...}
> [Break On This Error]
> (function(c){var h="1.1.1";var a=MathJ...ete("[MathJax]/config/
> MMLorHTML.js");

Ah, I didn't realize you meant that I broke the normal singlecell
because I forgot that I changed things ;). It's working now.

As a bonus, interacts embedded in other pages should work now too. For
example, this test file should display an interact and the interact
should work:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width">
<title>Simple Compute Server</title>
<script type="text/javascript"

src="http://sagemath.org:5467/static/jquery-1.5.min.js"></script>
<script type="text/javascript"
src="http://sagemath.org:5467/embedded_singlecell.js"></script>

<script>$(function() {singlecell.init(function ()
{singlecell.makeSinglecell({
'inputDiv': '#mysingle',
'files': false,
'messages': false,
'computationID': false});});})</script>
</head>
<body>
<div id="mysingle"><script type="text/code">

@interact
def _(a=(1,10)):
print a
</script></div>
</body>
</html>

Next up: being able to hide the code area, to *just* have the interact.


Thanks,


Jason


Jason Grout

unread,
Aug 1, 2011, 8:11:07 PM8/1/11
to sage-...@googlegroups.com
On 8/1/11 5:07 PM, Jason Grout wrote:
> <meta name="viewport" content="width=device-width">

I should just mention that the above line is for ipad/android tablet
devices. It makes a world of difference in how small the things on the
screen are and how usable everything is on the tablets/iphones. We
should maybe look into using it for the sage notebook.

Jason


Rob Beezer

unread,
Aug 1, 2011, 8:52:12 PM8/1/11
to sage-devel
On Aug 1, 5:07 pm, Jason Grout <jason-s...@creativetrax.com> wrote:
> Ah, I didn't realize you meant that I broke the normal singlecell
> because I forgot that I changed things ;).  It's working now.

Thanks, Jason, for the quick fixes and ideas.

Working demo at:

http://buzzard.ups.edu/misc/singlecell/singlecell-minimal.html

Hosted on my university server, computations happen at sagemath.org:
5467, just because.

See "singlecell-minimal.css" where I set everything I could find to
"display: none". Turned off the sage-mode checkbox but wasn't sure
how to turn off the legend on that. Added some margin around the
output boxes so they were a bit spread apart.

Placed the CSS file at the top of the body - previously I'd hacked it
into singlecell_embedded.js to have it loaded last - which seems to
have fixed the minor error I was getting.

singlecell_completion I think was holding messages about the
completion of commands, not anything related to tab-completion. I
think maybe you have it turned off now as part of one of the
switches? Tho it would be really nice to have tab-completion. ;-)

Included two independent cells. First preloads properly and refreshes
with any changes to the code, so that seems like the behavior I would
expect.

Did I setup the second cell properly? The preload is not working on
that one, but it computes fine once given input.

I think I'm caught up, maybe another demo later tonight. Nice work.
Off to grab my Android tablet...

Rob

Jason Grout

unread,
Aug 1, 2011, 9:38:40 PM8/1/11
to sage-...@googlegroups.com
On 8/1/11 5:52 PM, Rob Beezer wrote:
> On Aug 1, 5:07 pm, Jason Grout<jason-s...@creativetrax.com> wrote:
>> Ah, I didn't realize you meant that I broke the normal singlecell
>> because I forgot that I changed things ;). It's working now.
>
> Thanks, Jason, for the quick fixes and ideas.
>
> Working demo at:
>
> http://buzzard.ups.edu/misc/singlecell/singlecell-minimal.html
>
> Hosted on my university server, computations happen at sagemath.org:
> 5467, just because.
>
> See "singlecell-minimal.css" where I set everything I could find to
> "display: none". Turned off the sage-mode checkbox but wasn't sure
> how to turn off the legend on that. Added some margin around the
> output boxes so they were a bit spread apart.
>


You can use this rule to turn off the checkbox label (and all other
labels on the page...):

label {display: none}

However, I'll make it so that you can turn off the checkbox instead in
the command.


> Placed the CSS file at the top of the body - previously I'd hacked it
> into singlecell_embedded.js to have it loaded last - which seems to
> have fixed the minor error I was getting.
>
> singlecell_completion I think was holding messages about the
> completion of commands, not anything related to tab-completion. I
> think maybe you have it turned off now as part of one of the
> switches? Tho it would be really nice to have tab-completion. ;-)

Tab completion seems a bit...interesting to do since it is a *single*
cell. So if I type:

myvar=10
my<tab>

should it complete to "myvar"? How does it know myvar exists until
after it executes the cell? Or are you saying that only standard
python/sage commands that are defined at the start of a session should
be completed?

>
> Included two independent cells. First preloads properly and refreshes
> with any changes to the code, so that seems like the behavior I would
> expect.
>
> Did I setup the second cell properly? The preload is not working on
> that one, but it computes fine once given input.


Make this:

<script>$(function() {singlecell.init(function ()
{singlecell.makeSinglecell({inputDiv: '#singlecell'});});})</script>
<script>singlecell.makeSinglecell({inputDiv:
'#singlecellagain'})</script>

into this:

<script>$(function() {singlecell.init(function ()
{
singlecell.makeSinglecell({inputDiv: '#singlecell'});
singlecell.makeSinglecell({inputDiv: '#singlecellagain'});
});})</script>

Here is another way to do this so that it is a bit clearer what is going on:

<script>$(function() {
var makecells = function() {
singlecell.makeSinglecell({inputDiv: '#singlecell'});
singlecell.makeSinglecell({inputDiv: '#singlecellagain'});
}
singlecell.init(makecells);
})</script>


There is some initialization that needs to happen. This includes
loading javascript files, etc. That happens in singlecell.init(). You
can't make singlecells until this is done, however. So the init()
function takes as an argument another function (makecells() in our code
above). It will call that function when things are done loading, and
then makecells actually makes the cells. In your previous code, the
problem was that you were trying to make the second cell before the
javascript was finished loading (started in parallel by the init()
function). At least, I think that was the problem.

The $(...) around everything makes sure that it doesn't execute until
the entire document is done loading.


Also, you'll want to get rid of the spaces at the start of your code
lines, like this:

<div id="singlecellagain"><script type="text/code">
G = graphs.PetersenGraph()
G.eigenvalues()
</script>

Maybe we could automatically assume that the first line is at
indentation 0 and strip off that many spaces from every other line.

Thanks,

Jason

Rob Beezer

unread,
Aug 1, 2011, 10:31:38 PM8/1/11
to sage-devel
OK, demo updated and everything seems to be working as intended now.

http://buzzard.ups.edu/misc/singlecell/singlecell-minimal.html

> Tab completion seems a bit...interesting to do

Right. I guess the most we could hope for would be completion on
global stuff - functional syntax like log() and predefined things
like the graphs.* collection. So not as useful as I was imagining.

Rob

Jason Grout

unread,
Aug 2, 2011, 1:02:22 AM8/2/11
to sage-...@googlegroups.com
On 8/1/11 7:31 PM, Rob Beezer wrote:
> OK, demo updated and everything seems to be working as intended now.
>
> http://buzzard.ups.edu/misc/singlecell/singlecell-minimal.html

I changed the public API (which probably broke your demo). Here is a
new example. Note that now it's easy to change the text of the evaluate
button and hide the editor if you wish. Note that this doesn't disable
the editor (if they unhide the editor, they can still change things, for
example). But it does let you seamlessly embed interacts in webpages
with just a simple button to make the interact live.

Thanks,

Jason

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width">
<title>Simple Compute Server</title>
<script type="text/javascript"
src="http://sagemath.org:5467/static/jquery-1.5.min.js"></script>
<script type="text/javascript"
src="http://sagemath.org:5467/embedded_singlecell.js"></script>

<script>


$(function() {
var makecells = function() {
singlecell.makeSinglecell({

inputDiv: '#mysingle',
hide: ['messages', 'computationID', 'files', 'sageMode', 'editor'],
evalButtonText: 'Make Live'
});
}
singlecell.init(makecells);
})</script>

</head>
<body>
<div id="mysingle"><script type="text/code">
@interact
def _(a=(1,10)):

print factorial(a)
</script></div>
</body>
</html>


Rob Beezer

unread,
Aug 2, 2011, 2:38:36 AM8/2/11
to sage-devel
On Aug 1, 10:02 pm, Jason Grout <jason-s...@creativetrax.com> wrote:
> I changed the public API (which probably broke your demo).  

Still working, it seems. I don't think you changed anything I'm
using.

> But it does let you seamlessly embed interacts in webpages
> with just a simple button to make the interact live.

That'll be nice.

Rob

Jason Grout

unread,
Aug 2, 2011, 10:06:53 AM8/2/11
to sage-...@googlegroups.com
On 8/1/11 11:38 PM, Rob Beezer wrote:
> On Aug 1, 10:02 pm, Jason Grout<jason-s...@creativetrax.com> wrote:
>> I changed the public API (which probably broke your demo).
>
> Still working, it seems. I don't think you changed anything I'm
> using.

Ah, that makes sense. Javascript just ignores extra arguments to a
function (so the inputs I'm not using anymore don't cause a problem),
and you do the CSS yourself, so you're basically doing what the new
'hide' parameter does. Except now you can hide the entire checkbox.
Anyways, instead of using the custom CSS file, you can use the new
'hide' argument (which basically just sets the CSS for you).

Jason

Rob Beezer

unread,
Aug 5, 2011, 2:18:54 PM8/5/11
to sage-devel
I have been experimenting with including the single cell in documents
that are born in authoring formats, specifically LaTeX and Docbook,
with output as webpages or ebooks. I imagine my comments would apply
equally well to ReST, but that is mostly just informed speculation.

In this setting, the setup interface would be much more flexible and
easy to use if more configuration/initialization could happen in the
<body> in the near vicinity of where the <div> holding the content is
placed, rather than in the <head>. The problem is that you may want
to place more than one cell on a page, and you may want to configure
them differently (say one cell with editable source, and a second with
an interact in a hidden editor), but you have to read the source of
the whole page before you can create all the initialization in the
head of the output. At a minimum, you do not even know how many cells
to create until you finish reading the source for the page.

So it feels like it almost becomes a two-pass operation, ala LaTeX
references, though there may be an approach to the text processing
involved that might alleviate this, though I have not figured out just
what that approach might be, still being a bit of a novice with tools
like XSLT.

Would it be possible to put some sort of generic setup service in the
head, and then let each cell "register" itself on-the-fly just prior
to where it is used in the body? Or something like that? If the
setup service was lightweight enough, then maybe there'd be no penalty
to including it on a page even if it were not used.

Thanks,
Rob

Jason Grout

unread,
Aug 5, 2011, 2:56:16 PM8/5/11
to sage-...@googlegroups.com

Yes, this would be very easy to do. In fact, that's pretty much what is
done now. Remember that you can use <script> tags anywhere in the
document, including right above the single cell divs. We don't provide
a nice way to just queue up the cells (ala MathJax's Queues), but it
would be easy to do so. In fact, we might be able to reuse the MathJax
Queues anyway.

I will create an issue on github for this.

Jason


Rob Beezer

unread,
Aug 5, 2011, 6:25:12 PM8/5/11
to sage-devel
Thanks for the reply and advice. Glad to hear this is not
inconceivable. I hope to get at some more experimenting in the next
few days, so will try out a few things then.

Rob

Maarten Derickx

unread,
Aug 6, 2011, 7:39:34 AM8/6/11
to sage-...@googlegroups.com
I tried some computations and first it worked fine but then reading the things about limits I ofcourse wanted to try and reach those so I did a:

while True:
    print 42

After this I can still view the webpage and start computations, but I don't get results anymore. Reloading the page or opening it in other browsers seems to be broken to. (I tried it in chome, safari and firefox, I only executed the infinite loop in chrome).

See the attached picture for how a simple print "hello world" doesn't give any result
simple_compute_server.jpg

Ivan Andrus

unread,
Aug 6, 2011, 7:55:43 AM8/6/11
to sage-...@googlegroups.com
On Jul 30, 2011, at 11:40 AM, Juanlu001 wrote:

I have tested multiple interacts of mine and some computations, and everything seems to work quite well except for the backslash \, which I tried to use to split lines. It gives a syntax error:

SyntaxError                               Traceback (most recent call last)
SyntaxError: invalid syntax (<string>, line 57)
The line number depends on the length of the code.

Anyway, well done :)

I have to say that the SyntaxError messages are not very helpful. e.g. It says line 39 when I've only given it one line of input.  Is there a way to get a better error message?

Also they seem to have shell escape sequences in them.  Do you strip them out in the javascript?

-Ivan

Jason Grout

unread,
Aug 6, 2011, 10:31:32 AM8/6/11
to sage-...@googlegroups.com

I just restarted things and checked it and it works now.

Thanks,

Jason


Jason Grout

unread,
Aug 6, 2011, 11:28:33 PM8/6/11
to sage-...@googlegroups.com
On 8/6/11 7:55 AM, Ivan Andrus wrote:
> On Jul 30, 2011, at 11:40 AM, Juanlu001 wrote:
>
>> I have tested multiple interacts of mine and some computations, and
>> everything seems to work quite well except for the backslash \, which
>> I tried to use to split lines. It gives a syntax error:
>>
>> SyntaxError Traceback (most recent call last)
>> SyntaxError: invalid syntax (<string>, line 57)
>> The line number depends on the length of the code.
>>
>> Anyway, well done :)
>
> I have to say that the SyntaxError messages are not very helpful. e.g.
> It says line 39 when I've only given it one line of input. Is there a
> way to get a better error message?

Yes. We need to write the input to a file and then execute that file.
Then we'd get a traceback that includes the code at the specific line.
It says line 39 because we always tack on a few lines at the beginning
of a script to set things up.

>
> Also they seem to have shell escape sequences in them. Do you strip them
> out in the javascript?

Those are for syntax highlighting of Traceback sequences in the
terminal, I believe. Javascript converts them to colors, like your
shell would.


Alexander Juarez

unread,
Sep 12, 2011, 11:29:49 PM9/12/11
to sage-n...@googlegroups.com, sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com
Hi Jason,
This is really neat and I love the way the code view is integrated. I
was checking out the cell, and would suggest a version optimized for
handhelds.
Awesome work,
Alex Juarez

On Jul 29, 2011, at 2:11 PM, Jason Grout <jason...@creativetrax.com> wrote:

> Hi everyone,
>
> I'd like to announce a trial beta run of a public single cell server:
>
> http://sagemath.org:5467/
>
> The idea is that this is a single cell that can very easily be embedded in any webpage. This is the start of a comprehensive Sage web service as well, and lays a piece of the ground work for a much more scalable model for doing computations in the normal notebook.
>

> It's ready to be hammered by the larger community at this point. I will be mentioning this next week at Mathfest, so please try to break it :). I think just about any normal Sage computation should work. Please report any errors to me.
>
> We've also rewritten interacts, so please especially test interacts. There are some exciting new features for interacts in this rewrite that I can detail later. The main focus for this testing is that current existing interacts should work unchanged, hopefully.
>
> Thanks especially to Ira Hanson and Alex Kramer for doing much of the design and implementation work (funded by Drake University and the NSF), to William for an early version, and Fernando Perez and Robert Bradshaw for many helpful conversations. I'm sure there are people I've missed who have contributed in some way; please let me know if I've missed someone!
>
> The repository for the code is: https://github.com/jasongrout/simple-python-db-compute. The instructions are not quite up to date, but I'll be working on those soon.
>
> Thanks,
>
> Jason
>
> --
> Jason Grout

Alexander Juarez

unread,
Sep 13, 2011, 2:53:11 AM9/13/11
to sage-s...@googlegroups.com, sage-...@googlegroups.com, sage...@googlegroups.com
I ran some simple code in my iphone's browser and the result was an error. When I toggled plaintext input the code ran as expected. It would seem that the code view does not play well with the particular device. I am not sure if this is a problem experianced by other devices but, perhaps browser checking could determine the state of the plaintext input toggle.
Code:
def myfunc():
    return 2+2

print myfunc()
---------------------------------------------------------------------------
SyntaxError                               Traceback (most recent call last)
SyntaxError: invalid syntax (<string>, line 41)
Session 6673139e-8456-472c-96db-b6e72de127f4 done

Respectfully,
Alex

On Mon, Sep 12, 2011 at 8:40 PM, Jason Grout <jason...@creativetrax.com> wrote:
On 9/12/11 10:29 PM, Alexander Juarez wrote:
Hi Jason,
This is really neat and I love the way the code view is integrated. I
was checking out the cell, and would suggest a version optimized for
handhelds.

We have been waiting for http://jquerymobile.com/ to come out of beta before moving to it for the interact controls.  We've also incorporated several tweaks for handhelds (like the meta tag we suggest in the embedding code).

Do you have some other optimizations in mind?


Thanks,

Jason

--
To post to this group, send email to sage-s...@googlegroups.com
To unsubscribe from this group, send email to sage-support+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Jason Grout

unread,
Sep 13, 2011, 1:26:04 PM9/13/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com
On 9/13/11 1:53 AM, Alexander Juarez wrote:
> I ran some simple code in my iphone's browser and the result was an
> error. When I toggled plaintext input the code ran as expected. It would
> seem that the code view does not play well with the particular device. I
> am not sure if this is a problem experianced by other devices but,
> perhaps browser checking could determine the state of the plaintext
> input toggle.
>
> Code:
> def myfunc():
> return 2+2
>
> print myfunc()
>
> ---------------------------------------------------------------------------
> SyntaxError Traceback (most recent call last)
> SyntaxError: invalid syntax (<string>, line 41)
>
> Session 6673139e-8456-472c-96db-b6e72de127f4 done
>


Your example worked fine on my ipad (both with codemirror and plain text
inputs). Is it possible that you accidentally something slightly
different on the ipod?

I did notice that the autocapitalization was very frustrating. I fixed
that just now.

Thanks,

Jason

Eviatar

unread,
Nov 16, 2011, 9:04:44 PM11/16/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com, sage-n...@googlegroups.com
One problem: random doesn't work. It generates the same value every time.

Jason Grout

unread,
Nov 16, 2011, 9:23:21 PM11/16/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com
On 11/16/11 8:04 PM, Eviatar wrote:
> One problem: random doesn't work. It generates the same value every time.

Good point. The worker process is forked from one main server process,
so it inherits the same random seed each time. I suppose it would be
easy enough to reset the random seed. Does anyone know of any other
caveats to starting a worker process by forking from a main process?

Thanks,

Jason

Eviatar

unread,
Nov 17, 2011, 2:41:16 AM11/17/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com
I'm sorry, I was testing it and tried "while 1: print 'Hello world'". It seems to still be working on that, and doesn't output anything anymore. Maybe a timeout is necessary?

Jason Grout

unread,
Nov 17, 2011, 5:30:24 AM11/17/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com

There should be a timeout already. Your computation didn't keep running
forever, did it?

Jason

Eviatar

unread,
Nov 17, 2011, 12:53:38 PM11/17/11
to sage-...@googlegroups.com, sage-s...@googlegroups.com, sage...@googlegroups.com
Try the server. I think it's still running.

Jason Grout

unread,
Nov 17, 2011, 1:20:42 PM11/17/11
to sage-...@googlegroups.com
On 11/17/11 11:53 AM, Eviatar wrote:
> Try the server. I think it's still running.
>

(replying only to sage-devel)

Actually, it looks like the server ran out of disk space (/scratch on
boxen).

Thanks,

Jason

Eviatar

unread,
Nov 17, 2011, 5:13:36 PM11/17/11
to sage-...@googlegroups.com
Ah, okay.

Would there be any load problems if more people used it? I ask because I'm working on a simple Chromium/Chrome extension for it.

Great work by the way! I think it has a lot of potential.

William Stein

unread,
Nov 17, 2011, 5:17:42 PM11/17/11
to sage-...@googlegroups.com

As owner/manager of the computer it runs on, I say: USE IT!

>
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+...@googlegroups.com


> For more options, visit this group at

> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Jason Grout

unread,
Nov 17, 2011, 7:23:38 PM11/17/11
to sage-...@googlegroups.com
On 11/17/11 4:17 PM, William Stein wrote:
> On Thu, Nov 17, 2011 at 2:13 PM, Eviatar<eviat...@gmail.com> wrote:
>> Ah, okay.
>> Would there be any load problems if more people used it? I ask because I'm
>> working on a simple Chromium/Chrome extension for it.
>> Great work by the way! I think it has a lot of potential.
>
> As owner/manager of the computer it runs on, I say: USE IT!

I second that. I just restarted the server and it appears to work now.

Thanks,

Jason

Eviatar

unread,
Nov 18, 2011, 2:50:39 AM11/18/11
to sage-...@googlegroups.com
It broke again. I'm pretty sure it's a timeout issue this time, since I was iterating over a large list.

Jason Grout

unread,
Nov 18, 2011, 3:52:10 AM11/18/11
to sage-...@googlegroups.com
On 11/18/11 1:50 AM, Eviatar wrote:
> It broke again. I'm pretty sure it's a timeout issue this time, since I
> was iterating over a large list.

Was it this command?

while 1:
print 'hi'

I'm looking into it. The infinite loop is indeed stopped, further
calculations are indeed run, and the further calculation output is put
into the database, so everything seems okay on the server end, but
somehow the further output isn't making it back to the browser.

Thanks,

Jason

Eviatar

unread,
Nov 18, 2011, 7:35:18 PM11/18/11
to sage-...@googlegroups.com
Yes, that was it. Not a list, sorry.

Eviatar

unread,
Nov 30, 2011, 11:45:18 PM11/30/11
to sage-...@googlegroups.com
It's still down.

Jason Grout

unread,
Dec 1, 2011, 2:32:58 PM12/1/11
to sage-...@googlegroups.com
On 11/30/11 10:45 PM, Eviatar wrote:
> It's still down.
>

It looks like we ran out of disk space on /scratch again. I deleted a
file or two to give us a little breathing room, but we'll probably have
this issue again on boxen again in the future.

I restarted the server and it works now. Please don't do your infinite
loop test again until I have time to fix that.

Thanks,

Jason

Reply all
Reply to author
Forward
0 new messages