UNINCORPORATED FACTS
- _tickCallback processes the process.nextCallback queue
- setTimeout cannot have a timeout smaller than 1
- domains make changes
There are two important things to remember about the Node event loop. The
function Swap(opt){ | |
var b = this.extend(this.defaultOpt, this.extend({} , opt || {}) ), | |
obj = document.getElementById(b.targetId); | |
b.touchAble = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch, | |
b.obj = obj; | |
function start(e){ | |
e = e ? e : event, | |
e.targetTouches ? (b.startX = e.targetTouches[0].clientX, b.startY = e.targetTouches[0].clientY) : | |
(b.startX = e.clientX, b.startY = e.clientY); |
function fromUnicode (str) { | |
var runicode = /\\u([a-f0-9]{4})/gi; | |
str += ''; | |
return str.replace(runicode, function (m, hex) { | |
return String.fromCharCode(parseInt(hex, 16)); | |
}); | |
} | |
function toUnicode (str) { | |
str += ''; |
Apache和Tomcat的整合,原理及例子 | |
这类文档很多很多,但是大多是由不明原理的人拘泥于具体版本写出来的,有很多错漏或多余的部分。 | |
最后找到一篇写得很很不错的,http://macawspark.spaces.live.com/blog/ | |
我修正了其中的错误然后加了一些自己的理解 | |
原理 | |
tomcat 为一个jsp的容器,apache为一个web server,两者之间通信通过worker进行(由Tomcat使用Server.xml文件中Connector的标签来定义其端口和协议),通过 mod_jk的模块(由web服务器像apache、iis等使用)和Web Server通信。 | |
通信协议有很多,其中jk2已经被抛弃了,现在就用jk就好了。 | |
整个过程其实就是让apache的httpd.conf文件调用mod_jk.conf,mod_jk.conf调用workers.properties,最后配置虚拟主机。 | |
文件说明 | |
mod_jk.conf |
var _charHash = (function() { | |
var data = (function (zipData) { | |
var re = zipData.replace(/#(\d+)\$/g, function (a, b) { | |
return new Array(+b+3).join('#'); | |
}).replace(/#/g,'####').replace(/(\w\w):([\w#]+)(?:,|$)/g, function (a, hd, dt) { | |
return dt.replace(/../g, function (a) { | |
if (a !== '##') { | |
return hd + a; | |
} else { | |
return a; |
$$ | |
Shell本身的PID(ProcessID) | |
$! | |
Shell最后运行的后台Process的PID | |
$? | |
最后运行的命令的结束代码(返回值) | |
$- | |
使用Set命令设定的Flag一览 | |
$* | |
所有参数列表。如"$*"用「"」括起来的情况、以"$1 $2 … $n"的形式输出所有参数。 |
#connect 源码学习 这里主要说下connect的路由拦截处理。connect可以添加多个中间件或路由对http的请求进行处理。 在处理http请求时,connect先获取相应的path,然后遍历相应的路由stack,每次从栈顶开始, 当一个路由和path匹配时,若path符合/path、/path/*、/path.*则使用该路由处理请求,否则都跳过当前路由 继续遍历下一个路由。若路由处理请求成功则终止当前路由遍历,若失败则跳过路由继续路由遍历。 路由的匹配规则: