[IPython-dev] experiment - remote execution of jquery and d3 code into the browser via ipython

hugo hugo@continuum...
Mon Mar 19 08:32:44 CDT 2012



On 03/19/2012 09:22 AM, fawce wrote:
> holy mackerel that's awesome!
>
> Can you elaborate on the callback issue? Wondering why you can't pass 
> in a callback that just makes a ws call internally.

just that I serialize function names and the args they are called with 
via JSON

so for d3, the normal way you would position points in a scatter plot is 
something like this

d3.selectAll('circle').attr('cx', function(d){return axis(d['x'])});

I have no good way to pass function(d){return xaxis(d['x'])}

I could pass it as a string, but then I would need some way to determine 
whether strings I pass should be eval-ed to retrieve callbacks or not
also - you would have to write javascript callbacks in string form, 
which is ugly anyways.  furthermore, in d3, it is common to define 
scaling axes objects, and use those in your callbacks - I don't have a 
good place to do that either.


> On Mar 19, 2012, at 8:13 AM, hugo wrote:
>
>>
>> Thought you might be interested in something I've experimented with 
>> over the past few days.
>>
>> https://github.com/hhuuggoo/pushd3/blob/master/demopush.ogv
>>
>> I wanted to see how well this concept would work, I set up remote 
>> execution of code in the browser by creating an RPC interface around 
>> zeromq messages which get forwarded into websockets, and then I 
>> forwarded d3 and jquery operations to the browser.  It works fine if 
>> your arguments are all json serializable, however d3 is heavily 
>> reliant on passing callbacks, and I don't have a good way to do that.
>>
>> Anyways, here it is.  This is separate from the ipython notebook, I 
>> have a separate gevent based zeromq web socket forwarder that I've 
>> also been playing around with which I am using here.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev@scipy.org <mailto:IPython-dev@scipy.org>
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20120319/50103500/attachment.html 


More information about the IPython-dev mailing list