<div dir="ltr"><div>Brian,<br><br></div><div>So it seems that for us to get some data from a python object into our javascript, we write the data to file on the fly so that a js cell can pull it in from the filesystem or we hard code the data into the js string. Is that the way it should be done with the current setup?<br>

<br></div><div>So we'd like the functionality for GET/POST in the notebook for our project. And I have one full time student that starts this week. What would be the best way for us to contribute some patches to jumpstart this on the ipython side?<br>

</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><br>Jason<br><a href="http://moorepants.info" target="_blank">moorepants.info</a><br><span>+01 530-601-9791</span><br></div>
<br><br><div class="gmail_quote">On Sat, Jun 15, 2013 at 9:02 AM, Brian Granger <span dir="ltr"><<a href="mailto:ellisonbg@gmail.com" target="_blank">ellisonbg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Right now it does not have any easy way of doing that.  For now you<br>
will have to encode your data into the call to kernel.execute, which<br>
is a completely pain. That is exactly what we will be tackling later<br>
in the summer...<br>
<br>
Cheers,<br>
<br>
Brian<br>
<div class="HOEnZb"><div class="h5"><br>
On Sat, Jun 15, 2013 at 8:54 AM, Jason Moore <<a href="mailto:moorepants@gmail.com">moorepants@gmail.com</a>> wrote:<br>
> Brian,<br>
><br>
> In IPython, is there a standard mechanism to pass data from the client to<br>
> the server? We'd like to make some python calls that generate a data<br>
> stucture, jsonify it and then make it available to the javascript that is<br>
> running in a cell via a GET request. I assume the kernel architecture has<br>
> this in place?<br>
><br>
><br>
> Jason<br>
> <a href="http://moorepants.info" target="_blank">moorepants.info</a><br>
> +01 <a href="tel:530-601-9791" value="+15306019791">530-601-9791</a><br>
><br>
><br>
> On Sat, Jun 15, 2013 at 8:14 AM, Brian Granger <<a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a>> wrote:<br>
>><br>
>> Right now (today) the best way is to use the Javascript object along<br>
>> with the display function.  However, starting in late summer we will<br>
>> be improving this API so it may change some, but all for the better...<br>
>><br>
>> Cheers,<br>
>><br>
>> Brian<br>
>><br>
>> On Fri, Jun 14, 2013 at 11:33 PM, TARUN GABA <<a href="mailto:tarun.gaba7@gmail.com">tarun.gaba7@gmail.com</a>><br>
>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > I am wondering on what method would be more efficient to serve<br>
>> > Javascripts on IPython notebooks<br>
>> ><br>
>> > I need to visualize/simulate multibody dynamics, and there are two<br>
>> > methods which are in my mind.<br>
>> > The rough API of the project is being formed at ..<br>
>> ><br>
>> > <a href="http://pydy.org/visualization" target="_blank">http://pydy.org/visualization</a><br>
>> ><br>
>> > the two methods are:<br>
>> > 1) Via http requests:<br>
>> ><br>
>> >   on calling something like ..<br>
>> ><br>
>> > myobject.visualize(numerical_data)<br>
>> ><br>
>> > The browser sends a POST request to the kernel, and python methods<br>
>> > send a POST request to the required javascripts alongwith POST<br>
>> > parameters as the numerical data required for visualization, most<br>
>> > likely a 4*4 transformation matrix, and shape information.<br>
>> > the Javascripts recieves the post and then it is displayed in the<br>
>> > IPython output cell.<br>
>> ><br>
>> > 2) Another method can be to make Javascript objects and save them as<br>
>> > text in the classes,<br>
>> > something like ..<br>
>> ><br>
>> > def MyClass():<br>
>> ><br>
>> >     def __init__(relevant,args):<br>
>> >         self.js_data = ''' A call to the Javascript functions,<br>
>> > alongwith arguments..<br>
>> >                              var myobject =<br>
>> > Shape_creating_function(%s)'''%(args)<br>
>> ><br>
>> > and then on calling ..<br>
>> > MyClass.visualize()<br>
>> ><br>
>> > from IPython notebook, first calling all the required<br>
>> > javascripts(files) via publish_javascript()/publish_html() display<br>
>> > methods and then<br>
>> ><br>
>> > display(Javascript(MyClass.js_data))<br>
>> ><br>
>> > Which of these would be more feasible and efficient..<br>
>> > _______________________________________________<br>
>> > IPython-dev mailing list<br>
>> > <a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
>> > <a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> Brian E. Granger<br>
>> Cal Poly State University, San Luis Obispo<br>
>> <a href="mailto:bgranger@calpoly.edu">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a><br>
>> _______________________________________________<br>
>> IPython-dev mailing list<br>
>> <a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
>> <a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> IPython-dev mailing list<br>
> <a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
><br>
<br>
<br>
<br>
--<br>
Brian E. Granger<br>
Cal Poly State University, San Luis Obispo<br>
<a href="mailto:bgranger@calpoly.edu">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com">ellisonbg@gmail.com</a><br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</div></div></blockquote></div><br></div>