自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 资源 (1)
  • 收藏
  • 关注

原创 golang dialParallel

网络上有些文章代码注释有误,所以记录一下:// dialParallel races two copies of dialSerial, giving the first a// head start. It returns the first established connection and// closes the others. Otherwise it returns an error from the first// primary address.func (sd *sysDi

2021-03-04 14:32:02 222 1

原创 Node.js当中的ioredis设置timeout的问题

因为node.js内部使用libuv实现网络io调用(使用epoll),在socket层面是不能设置read timeout,connection timeout,write timeout。所以node.js api中net模块只暴露了socket.setTimeout,用于在tcp通信空闲时间超过设置的值,所触发的事件;而ioredis在connectTimeout只在初始化socket...

2019-06-02 20:33:38 2960

转载 Kafka的消费模型

How does Kafka's notion of streams compare to a traditional enterprise messaging system?Messaging traditionally has two models: queuing and publish-subscribe. In a queue, a pool of consumers may rea...

2019-04-05 14:14:34 305

转载 Kafka All nodes die at same time. Now what?

Kafka’s guarantee about data loss is only valid if at least one replica is in-sync.If all followers that are replicating a partition leader die at once, then data loss Kafka guarantee is not valid. ...

2019-03-08 13:39:54 118

转载 node.js setImmediate() vs setTimeout()

var fs = require('fs');fs.readFile('file.txt', () => { setImmediate(() => { console.log('setImmediate'); }); setTimeout(() => { console.log('setTimeout'); }, 0); cons...

2018-11-01 18:27:55 1445

原创 Node.Js Readable Streams 同时使用emit、pipe与read()

'use strict';const fs = require('fs');const writable = fs.createWriteStream('file.txt');const event = fs.createReadStream('./a.log',{highWaterMark:8});event.pipe(writable); // 允许多个on('data')监听器...

2018-08-10 15:36:19 371

原创 es6 Thunkify源码解析说明

// Example// var thunkify = require('thunkify');var fs = require('fs');function thunkify(fn) { return function () { // A var args = new Array(arguments.length); var ctx = this;...

2018-07-16 11:43:51 333

原创 wireshark liunx下不能显示网卡的问题

使用root或者sudo方式直接支持wireshark会提示,QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'No protocol specifiedqt.qpa.screen: QXcbConnection: Could not connect to display :0Could not...

2018-07-04 14:23:19 2342 1

原创 es6 阮一峰 iterator一篇中一个例子的解读

function Obj(value) { this.value = value; this.next = null;}Obj.prototype[Symbol.iterator] = function() { var iterator = { next: next }; var current = this; function next() { if (cu...

2018-06-28 00:41:26 760

原创 es6 Promise 执行顺序

'use strict';setTimeout(function () { console.log('three'); }, 0); new Promise(function(resolve,reject){ console.log(1); resolve(1); console.log(2); }).then(function () {...

2018-06-22 22:28:26 942

原创 asp/jscript 转码支持emoji表情以及adodb.stream导致cpu异常升高

function GetHTMLByCharSet(sUrl, charset){ var objXML = new ActiveXObject("WinHttp.WinHttpRequest.5.1"), html = ""; with (objXML) { setTimeouts(3000, 3000, 3000, 10000);//设置超时时间 open("GET", sUr...

2018-05-16 14:59:30 482

原创 提高node.js内部使用http请求性能

这两天刚刚接触node.js,有业务会遇到。通过测试请求单个url,不同的文件大小对性能影响较大。使用strace -p pid -c 统计,futex 90%。后置api带宽没有跑起来,前置web 进程100%,AB测试性能很低。通过node.js profile,得知性能主要在使用LazyCompile: *afterTransform _stream_transform.js:73:24。使...

2018-04-12 11:20:27 1190

转载 es6 块级作用域用法

// IIFE 写法(function () { var tmp = ...; ...}());// 块级作用域写法{ let tmp = ...; ...}块级作用域的出现,实际上使得获得广泛应用的立即执行函数表达式(IIFE)不再必要了。function f() { console.log('I am outside!'); }(function (

2018-01-10 16:02:47 341

原创 babel 浏览器中实现原理

简单实现

2017-11-13 20:59:35 596

原创 IIS8.5 ARR Rewrite 不缓存反向代理的网页

http://127.0.0.1/login.htm 使用内部代理到http://127.0.0.1:8080/login.htm;刚好http://127.0.0.1:8080/login.htm设置了缓存头,ARR就会根据缓存头缓存。这时只需要在ARR里面设置不缓存即可,重启IIS生效(好像缓存头的过期时间到了之后,本地缓存文件清除了之后,也就不会缓存了)。Application Re

2016-12-26 18:14:50 1811

原创 Chilkat MD5使用方式

拿官方文档演示下:1、使用默认编码哈希md5Dim fso, outFileSet fso = CreateObject("Scripting.FileSystemObject")Set outFile = fso.CreateTextFile("output.txt", True)password = "myPassword"set crypt = CreateObject(

2016-11-19 17:14:17 886

转载 asp(Parameters) 参数化实现方法

本文演示了使用 ActiveX 数据对象 (ADO) 从 Active Server Pages 调用存储过程的三种方法下面的示例使用 Command 对象调用示例存储过程 sp_test。此存储过程接受整数,同时返回一个整数值: Place Document Title Here This first method queries the dat

2015-06-07 10:15:39 3326

原创 ckeditor 过滤器(filter)添加允许规则

环境:ckeditor 4.4.7需求:当使用了一个自定义按钮插入了规则所不允许的html代码。editor.insertHtml(''+CKEDITOR.tools.htmlEncode("百度")+'',"unfiltered_html");虽然使用inertHtml()插入了非html所规定的属性,但是点击“源码”多次,a标签里的tips属性会被删除。在config.

2015-06-02 15:00:13 5003

翻译 CKEDITOR.fileTools.fileLoader

需求:将网络上的图片可以自动保存到本地服务器上,也得出的结论还是在服务端做操作比较好。除非自己将图片下载下来转成blob格式或者base64。http://docs.ckeditor.com/#!/api/CKEDITOR.fileTools.fileLoaderckeditor提供的实例只支持Blob跟base64时才有用。There are two possible ways

2015-05-25 15:38:36 1134

原创 node.js express 支持中文路由的中间件

最近在学express所以看到了中间件,就像既然中间件这么灵活,自己都可以定制中间件了。于是来个有特色的,在url、express支持中文路径。使用的url。http://127.0.0.1:3000/users/%E6%B5%8B%E8%AF%95?a=1%E8%A6%81当然param不在我的考虑范围之类。urlchineseroute.js/** * Created

2015-04-30 10:29:44 2009

原创 node.js express 官方Route使用说明

Express路由学习不记录Express安装配置,只记录具体路由的使用方法。资料来自于官方:http://expressjs.com/guide/routing.htmlvar express = require('express');var app = express();// respond with "hello world" when a GET request is

2015-04-27 16:38:08 1159

转载 js 获取随机颜色值的函数

function getRandomColor(){ return "#"+("00000"+((Math.random()*16777215+0.5)>>0).toString(16)).slice(-6); } 来源:http://www.jb51.net/article/41565.htm

2015-04-23 10:06:12 812

采集网页版

原本打算直接用Jquery做采集的,但是Jquery所采集的这个站会出现中文乱码,所以只能MS的WinHttp.WinHttpRequest.5.1。 注意只要IE内核下才支持文件生成。 生成的文件在C盘下。

2012-09-27

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除