How to show loading spinner in jQuery?

In Prototype I can show a “loading…” image with this code: var myAjax = new Ajax.Request( url, {method: ‘get’, parameters: pars, onLoading: showLoad, onComplete: showResponse} ); function showLoad () { … } In jQuery, I can load a server page into an element with this: $(‘#message’).load(‘index.php?pg=ajaxFlashcard’); but how do I attach a loading spinner to … Read more

Elegant ways to support equivalence (“equality”) in Python classes

When writing custom classes it is often important to allow equivalence by means of the == and != operators. In Python, this is made possible by implementing the __eq__ and __ne__ special methods, respectively. The easiest way I’ve found to do this is the following method: class Foo: def __init__(self, item): self.item = item def … Read more