V2EX Niris
Niris

Niris

V2EX member #8036, joined on 2011-04-17 16:35:14 +08:00
Per Niris's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
Niris's recent replies
Nov 22, 2016
Replied to a topic by homfen 程序员 shell 打开很慢是啥原因
好多人提到 nvm 很慢,把下面这行注释掉就基本可以解决问题。

https://github.com/creationix/nvm/blob/v0.32.1/nvm.sh#L3200
May 19, 2016
Replied to a topic by jinzhe 分享创造 vue-i18n 多语言切换插件
Apr 20, 2016
Replied to a topic by isbase Javascript 遇到一个奇怪的 js 问题
Jul 28, 2014
Replied to a topic by hao1032 Python python 有简单的图表库吗?
用 R 画过图的应该都知道 ggplot2 吧?
网上有 python 移植 https://github.com/yhat/ggplot
我自己没用过,看了下依赖,好像不太符合要求……
用 Descriptor。
例子可以看 https://github.com/defnull/bottle/blob/master/bottle.py#L194-L218

不明白 @property、@classmethod、@staticmethod 的话,官方有个 howto:
https://docs.python.org/3/howto/descriptor.html
May 21, 2014
Replied to a topic by shyrock Python urllib2 不支持 Connection:keep-alive?
@shyrock

其实我发现自己搞错了……
解析 chunked 是 urllib/requests 之类的库干的事情,使用 urllib 应该不会碰上这事才对呀。

总之 requests 吧。
May 21, 2014
Replied to a topic by shyrock Python urllib2 不支持 Connection:keep-alive?
chunked 需要自己解析。
格式说明可以看 http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1
处理起来也不难,可以参考 Guido 的实现 https://github.com/aosabook/500lines/blob/master/crawler/crawling.py#L233-L259

直接用 requests 当然更简单些。
The browser will not queue up more than one instance of a specific interval handler.
-- Secrets of the Javascript Ninja

When using setInterval(), timer code is added to the queue only if there are no other instances of the timer code already in the queue.
--PROFESSIONAL Javascript

两本书都这么说的。

可以试试下面的代码输出几个 interval

var i = window.setInterval(function() {
console.log('interval', Date.now());
}, 1000);

window.setTimeout(function() {
window.clearInterval(id);
console.log('stop', Date.now());
}, 5900);

var t = Date.now() + 5000;
while(Date.now() < t) {
console.log(1);
}
setInterval 设置的回调函数,永远只有一个吧(上个函数在等待执行,就不会继续添加)。
那么 setInterval 造成任务堆积,要怎么理解?
@darasion @lichao
About     Help     Advertise     Blog     API     FAQ     Solana     4276 Online   Highest 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 12ms UTC 04:15 PVG 12:15 LAX 21:15 JFK 00:15
Do have faith in what you're doing.
ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86