摘要: 转自:http://www.ruanyifeng.com/blog/2014/10/event-loop.html 五、定时器 除了放置异步任务的事件,"任务队列"还可以放置定时事件,即指定某些代码在多少时间之后执行。这叫做"定时器"(timer)功能,也就是定时执行的代码。 定时器功能主要由set 阅读全文
posted @ 2016-11-25 16:10 bonelee 阅读(304) 评论(0) 推荐(0)
摘要: 转自: http://www.ruanyifeng.com/blog/2014/10/event-loop.html 一、为什么JavaScript是单线程? JavaScript语言的一大特点就是单线程,也就是说,同一个时间只能做一件事。作为浏览器脚本语言,JavaScript的主要用途是与用户互 阅读全文
posted @ 2016-11-25 16:09 bonelee 阅读(347) 评论(0) 推荐(0)
摘要: $digest和$apply 在Angular中,有$apply和$digest两个函数,我们刚才是通过$digest来让这个数据应用到界面上。但这个时候,也可以不用$digest,而是使用$apply,效果是一样的,那么,它们的差异是什么呢? 最直接的差异是,$apply可以带参数,它可以接受一个 阅读全文
posted @ 2016-11-25 14:15 bonelee 阅读(6118) 评论(0) 推荐(1)
摘要: Angular什么时候不会自动为我们$apply呢? 这是Angular新手共同的痛处。为什么我的jQuery不会更新我绑定的东西呢?因为jQuery没有调用$apply,事件没有进入angular context,$digest循环永远没有执行。 我们来看一个有趣的例子: 假设我们有下面这个dir 阅读全文
posted @ 2016-11-25 11:37 bonelee 阅读(625) 评论(0) 推荐(0)
摘要: 转自:http://www.angularjs.cn/A0a6 Angular用户都想知道数据绑定是怎么实现的。你可能会看到各种各样的词汇:$watch,$apply,$digest,dirty-checking... 它们是什么?它们是如何工作的呢?让我们从头开始吧。 浏览器事件循环和Angula 阅读全文
posted @ 2016-11-25 11:34 bonelee 阅读(332) 评论(0) 推荐(0)
摘要: spark-2.0.0-bin-hadoop2.6/bin/spark-shell --jars elasticsearch-hadoop-5.0.1/dist/elasticsearch-spark-20_2.11-5.0.1.jar 注意版本对应关系! 可以看到ES请求data/test/3中i 阅读全文
posted @ 2016-11-24 19:57 bonelee 阅读(2065) 评论(0) 推荐(0)
摘要: 转自:http://www.lovelucy.info/understanding-scopes-in-angularjs.html angularjs 中的scope继承关系 ng-include 假设在我们的 controller 中, $scope.myPrimitive = 50; $sco 阅读全文
posted @ 2016-11-22 18:59 bonelee 阅读(1070) 评论(0) 推荐(0)
摘要: 转自:http://www.lovelucy.info/understanding-scopes-in-angularjs.html JavaScript 的原型链继承 假设父类 parentScope 有如下成员属性 aString, aNumber, anArray, anObject, 以及 阅读全文
posted @ 2016-11-22 18:58 bonelee 阅读(672) 评论(0) 推荐(0)
摘要: 比如我们现在有这样一个文件,data.json: 它的第一行定义了_index,_type,_id等信息;第二行定义了字段的信息。 然后执行命令: 阅读全文
posted @ 2016-11-20 21:27 bonelee 阅读(2535) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/bonelee/p/6078947.html 里分析了ES bulk实现,其中路由代码: ShardId shardId = clusterService.operationRouting().indexShards(clusterState, conc 阅读全文
posted @ 2016-11-18 19:54 bonelee 阅读(2367) 评论(0) 推荐(0)