8

Getting this error, trying to use Masonry with imageLoaded:

"Object # has no method 'imagesLoaded'"

The links to the necessary scripts are in my header:

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script><script src="/js/masonry.pkgd.min.js" type="text/javascript"></script>
<script src="/js/imagesloaded.pkgd.min.js" type="text/javascript"></script>

And here is how the code looks in my footer:

$(document).ready(function() {
    $('#archive-post-container').imagesLoaded(function() {
        $(this).masonry({
            itemSelector : '.post',
            columnWidth:344
        });
    });
});

EDIT / ADDENDUM: Placing the script tags for ImagesLoaded and Masonry in the actual .php file for the page I need them on, instead of in header.php gets me this error instead, coming from ImagesLoaded: Uncaught TypeError: undefined is not a function

Not sure why moving the tags just from the to just under the header would change this, but at least now I am getting to imagesLoaded?


socketIO_client (python) makes cpu spin and crashes

I am trying to use socketIO_client in python and I am pretty successful with it, however when I let the program below run for a while (like an hour), it crashes and if I look at the system information with the 'top' command I can see the CPU is spinning at something like 80 or 90%.

PS: this happens only on my raspberry, so it might be due to an implementation of the python socketio module on ARM?

Am I doing anything wrong? Is there any socket I should close? I am not very familiar with sockets...

Here below my code:

from socketIO_client import SocketIO, BaseNamespace

class MainNamespace(BaseNamespace):

        def on_message(self, message):
            try:
                    typestr = message["depth"]["type_str"]
                    price_int  = int(message["depth"]["price_int"])
                    total_volume_int = long(message["depth"]["total_volume_int"])
                    print "price_int:%s total_volume_int:%s"  % (price_int,total_volume_int)
            except:
                    pass

 if __name__ == "__main__":
    try:
            mainSocket = SocketIO('socketio.mtgox.com', 80)
            chatSocket = mainSocket.connect('/mtgox',MainNamespace)
            mainSocket.wait()
    except Exception, e:
            print e
4

1 回答 1

19

请注意,ImagesLoaded 不再包含在最新的 Masonry 发行版中,每

http://masonry.desandro.com/appendix.html#upgrading-from-v2

你可以在这里直接获取:

http://desandro.github.io/imagesloaded/

于 2013-07-30T21:57:25.733 回答