$ is overriden in IPython notebook

Hi!

There is strange behavior observed when I reload (crtl+R) notebook without restarting kernel.

For some strange reason is overridden (maybe by some other module), and it can not run (delegate)

So after I reload notebook all the drawn plots are shown well, but new ones after running cells do not appear.

Replacing $ = jQuery breaks the notebook completely.

The simple fix is instead of

$(function(){ code of drawing here})

use

jQuery(function(){ code of drawing here})

IMHO, this is more relevant, since $ may be not only jQuery object (while jQuery object always has the same meaning).

Thanks in advance!

Hi Tatiana,

I have not encountered this behaviour. We only use $ inside AMD modules as a local alias for an explicitly require'd jQuery, AFAIK, and in our main.coffee, we also do:

  Bokeh.$ = require("jquery")

  # Make sure that we don't clobber any existing definition of \(most   \# likely a previous version of jQuery\.   \_oldJQ = window\.
  window.jQuery.noConflict()
  if typeof(\) == "undefined"     \# if there was no previous definition of , put our definition into window.\.     window\. = _oldJQ

So I am not sure how we'd be clobbering anything. Where are you suggesting we use jQuery instead of $, exactly? Can you provide an IPython notebook and instructions to minimally reproduce the problem?

Thanks,

Bryan

···

On Dec 25, 2014, at 1:20 PM, Tatiana Likhomanenko <[email protected]> wrote:

Hi!

There is strange behavior observed when I reload (crtl+R) notebook without restarting kernel.
For some strange reason is overridden \(maybe by some other module\), and it can not run (delegate)

So after I reload notebook all the drawn plots are shown well, but new ones after running cells do not appear.
Replacing $ = jQuery breaks the notebook completely.

The simple fix is instead of
$(function(){ code of drawing here})
use
jQuery(function(){ code of drawing here})

IMHO, this is more relevant, since $ may be not only jQuery object (while jQuery object always has the same meaning).

Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ae9e3131-73a9-43b3-99de-0f354bfb4806%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi, Bryan,

to demonstrate let’s take this example

http://nbviewer.ipython.org/github/paddymul/bokeh_tutorial/blob/master/bokeh_tutorial.ipynb

When you look at the source of html page, you’ll find code produced to output the first plot

$(function(){

var all_models = [{“attributes”: {“plot”: {“type”: “Plot”, “id”: “2b6bb419-c7d4-4d1c-a850-f455a289a7b7”}, “location”: “min”, “bounds”: “auto”, “doc”: null, “id”: “783f0d50-b46f-4921-b6ff-8b7419fd66a5”, “dimension”: 0}, ………

omitted much code

…… }];

var modelid = “2b6bb419-c7d4-4d1c-a850-f455a289a7b7”;

var modeltype = “Plot”;

var elementid = “7ce001e1-6af0-4def-bfe6-f408f77a8d1e”;

var view;

console.log(modelid, modeltype, elementid);

Bokeh.load_models(all_models);

var model = Bokeh.Collections(modeltype).get(modelid)

window.model=model;

var view = new model.default_view(

{model : model}

);

window.view = view;

_.delay(function(){

$(’#7ce001e1-6af0-4def-bfe6-f408f77a8d1e’).append(view.$el)

}, 1000);

});

Pay attention this is wrapped by (function(){}), not jQuery, not bokeh..

Thanks,

Tatiana.

26 дек. 2014 г., в 0:29, Bryan Van de Ven [email protected] написал(а):

···

Hi Tatiana,

I have not encountered this behaviour. We only use $ inside AMD modules as a local alias for an explicitly require’d jQuery, AFAIK, and in our main.coffee, we also do:

Bokeh.$ = require(“jquery”)

Make sure that we don’t clobber any existing definition of $ (most

likely a previous version of jQuery.

_oldJQ = window. window.jQuery.noConflict() if typeof() == “undefined”

if there was no previous definition of , put our definition into window..

window.$ = _oldJQ

So I am not sure how we’d be clobbering anything. Where are you suggesting we use jQuery instead of $, exactly? Can you provide an IPython notebook and instructions to minimally reproduce the problem?

Thanks,

Bryan

On Dec 25, 2014, at 1:20 PM, Tatiana Likhomanenko [email protected] wrote:

Hi!

There is strange behavior observed when I reload (crtl+R) notebook without restarting kernel.
For some strange reason is overridden (maybe by some other module), and it can not run (delegate)

So after I reload notebook all the drawn plots are shown well, but new ones after running cells do not appear.
Replacing $ = jQuery breaks the notebook completely.

The simple fix is instead of
$(function(){ code of drawing here})
use
jQuery(function(){ code of drawing here})

IMHO, this is more relevant, since $ may be not only jQuery object (while jQuery object always has the same meaning).

Thanks in advance!


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ae9e3131-73a9-43b3-99de-0f354bfb4806%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/7CJxL7cKxXs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5D6C1765-FD27-4447-80CF-DFE6C28A4AF1%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Tatiana,

Thans for the example, I misunderstood your initial comment. I thought you were saying that Bokeh was overriding \(which was a problem we had long ago\) not that something else was overriding it, and that our use of bare is fragile. I have made an GH issue to address this:

  https://github.com/bokeh/bokeh/issues/1606

FYI, the example notebook you linked is very old and was created with a very old version of Bokeh (version 0.3). The latest release, Bokeh 0.7, was just last month and has many improvements and features since that notebook was created.

Thanks,

Bryan

···

On Dec 29, 2014, at 10:19 AM, Tatiana Likhomanenko <[email protected]> wrote:

Hi, Bryan,
to demonstrate let’s take this example
http://nbviewer.ipython.org/github/paddymul/bokeh_tutorial/blob/master/bokeh_tutorial.ipynb

When you look at the source of html page, you’ll find code produced to output the first plot

\(function\(\)\{ &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;var all\_models = \[\{&quot;attributes&quot;: \{&quot;plot&quot;: \{&quot;type&quot;: &quot;Plot&quot;, &quot;id&quot;: &quot;2b6bb419\-c7d4\-4d1c\-a850\-f455a289a7b7&quot;\}, &quot;location&quot;: &quot;min&quot;, &quot;bounds&quot;: &quot;auto&quot;, &quot;doc&quot;: null, &quot;id&quot;: &quot;783f0d50\-b46f\-4921\-b6ff\-8b7419fd66a5&quot;, &quot;dimension&quot;: 0\}, ……\.\. omitted much code …\.\. \}\]; var modelid = &quot;2b6bb419\-c7d4\-4d1c\-a850\-f455a289a7b7&quot;; var modeltype = &quot;Plot&quot;; var elementid = &quot;7ce001e1\-6af0\-4def\-bfe6\-f408f77a8d1e&quot;; var view; console\.log\(modelid, modeltype, elementid\); Bokeh\.load\_models\(all\_models\); var model = Bokeh\.Collections\(modeltype\)\.get\(modelid\) window\.model=model; var view = new model\.default\_view\( &nbsp;&nbsp;&nbsp;&nbsp;\{model : model\} \); window\.view = view; \_\.delay\(function\(\)\{ &nbsp;&nbsp;&nbsp;&nbsp;('#7ce001e1-6af0-4def-bfe6-f408f77a8d1e').append(view.$el)
}, 1000);
    
    });

Pay attention this is wrapped by \(function\(\)\{\}\), not jQuery, not bokeh\..

Thanks,
Tatiana.

26 дек. 2014 г., в 0:29, Bryan Van de Ven <[email protected]> написал(а):

Hi Tatiana,

I have not encountered this behaviour. We only use $ inside AMD modules as a local alias for an explicitly require'd jQuery, AFAIK, and in our main.coffee, we also do:

Bokeh.$ = require("jquery")

# Make sure that we don't clobber any existing definition of \(most \# likely a previous version of jQuery\. \_oldJQ = window\.
window.jQuery.noConflict()
if typeof(\) == &quot;undefined&quot; &nbsp;&nbsp;&nbsp;\# if there was no previous definition of , put our definition into window.\. &nbsp;&nbsp;&nbsp;window\. = _oldJQ

So I am not sure how we'd be clobbering anything. Where are you suggesting we use jQuery instead of $, exactly? Can you provide an IPython notebook and instructions to minimally reproduce the problem?

Thanks,

Bryan

On Dec 25, 2014, at 1:20 PM, Tatiana Likhomanenko <[email protected]> wrote:

Hi!

There is strange behavior observed when I reload (crtl+R) notebook without restarting kernel.
For some strange reason is overridden \(maybe by some other module\), and it can not run (delegate)

So after I reload notebook all the drawn plots are shown well, but new ones after running cells do not appear.
Replacing $ = jQuery breaks the notebook completely.

The simple fix is instead of
$(function(){ code of drawing here})
use
jQuery(function(){ code of drawing here})

IMHO, this is more relevant, since $ may be not only jQuery object (while jQuery object always has the same meaning).

Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ae9e3131-73a9-43b3-99de-0f354bfb4806%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/7CJxL7cKxXs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5D6C1765-FD27-4447-80CF-DFE6C28A4AF1%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/51E2307A-9CC5-4A41-8FC6-A917493FA4C3%40yandex.ru.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.