Features:
Recommendation with personalization: get your name, your location involved in the first place
Search within the tags that interests you the most
Interested? Say "yes" and the event information is saved in file "interested.txt"
Want to search more? Say "yes" and search more for your likes继续阅读 »
直接写
js
function imgError(image) {
image.onerror = null; // prevent event bubble
image.src = "/images/noimage.gif";
return true;
}
html
使用 jQuery
```js
$("img").error(function () {
$(this).unbind("error").attr("src", "broken.gif");
});
//If you use this technique you can use the "one" method to av继续阅读 »
协程是用户态内的,或者准确点说是线程内部的一种上下文切换技术,由于协程切换是在用户态下完成的,所以省去了线程切换时频繁出入内核态的资源开销,可以形成一种很高效的协作式并发技术。
这个简短的视频介绍了一些有关协程、并发之类的东西,很有意义。
Coroutines, event loops, and the history of Python generators
从里面学习到两种很好的协程的调度方式。把代码拿过来分享一下。
Coroutine trampoline
这种方式下的协程调度比较好理解,就是从一个初始状态开始,一条执行线索不断的在多个协程之间切换,就好像多个协程协作完成一项任务。
代码:
def co_tramp继续阅读 »