Debugging error message: "A script on this page is causing Internet Explorer to run slowly"

One of my users is intermittently getting a dialog in IE 8 that says:

A script on this page is causing Internet Explorer to run slowly

This problem has been reported numerous times in the MSDN forums and other places on the web. For example:

So, this question is a duplicate of those and many others. But it is an intentional duplicate, because I don’t think any of those questions were answered in a way that helps a user (developer) to determine precisely what in his scenario causes the dialog to appear.

read more

Is it possible to terminate a running web worker?

I have a web worker running a time-consuming routine task with ajax-requests. Can I terminate them from a main thread not waiting for them to finish?

That’s how I spawn and terminate it:

$("button.parse-categories").click(function() {
    if (parseCategoriesActive==false) {
        parseCategoriesActive = true;
        parseCategoriesWorker = new Worker("parseCategories.js");

        $("button.parse-categories-cancel").click(function() {
            parseCategoriesActive = false;

This is the worker code:

function myAjax(url, async, callback) {
    xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        if (xmlhttp.readyState==4 && xmlhttp.status!=200) {
            throw "error in ajax: "+xmlhttp.status;
    }"GET", url, async);

var parseCategoriesActive = true;
var counter = 0;
do {
    myAjax('parser.php', false, function(resp) {
        if (resp=='success')
            parseCategoriesActive = false;
        else {
            counter += Number(resp);
} while (parseCategoriesActive==true);

read more

What does the expression & do in a method?

I found usage of & in the rails sources:

# rails/railties/lib/rails/engine.rb
def routes
  @routes ||=
  @routes.append(& if block_given?

I don’t understand how the expression & works.

I wrote similar code and it failed:

def method_name
  & if block_given?
proc = method_name{ puts 'Hello world!' }

I received a syntax error:

read more