ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
last edit: 20140822 15:11 | |
本文分析的代码是 nanomsg-0.4-beta版本。 | |
要创建一个 PUB/SUB 服务,只需要六个 API,分别是: | |
1. nn_socket | |
2. nn_bind | |
3. nn_connect | |
4. nn_send | |
5. nn_recv | |
6. nn_close |
These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):
-
Install Raspbian - http://www.raspberrypi.org/downloads
-
Install the necessary dependecies:
sudo apt-get install git-core build-essential
(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* FormData for XMLHttpRequest 2 - Polyfill for Web Worker (c) 2012 Rob W | |
* License: Creative Commons BY - http://creativecommons.org/licenses/by/3.0/ | |
* - append(name, value[, filename]) | |
* - toString: Returns an ArrayBuffer object | |
* | |
* Specification: http://www.w3.org/TR/XMLHttpRequest/#formdata | |
* http://www.w3.org/TR/XMLHttpRequest/#the-send-method | |
* The .append() implementation also accepts Uint8Array and ArrayBuffer objects | |
* Web Workers do not natively support FormData: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Getting a file through XMLHttpRequest as an arraybuffer and creating a Blob | |
var rhinoStorage = localStorage.getItem("rhino"), | |
rhino = document.getElementById("rhino"); | |
if (rhinoStorage) { | |
// Reuse existing Data URL from localStorage | |
rhino.setAttribute("src", rhinoStorage); | |
} | |
else { | |
// Create XHR, BlobBuilder and FileReader objects | |
var xhr = new XMLHttpRequest(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var url='http://r.autobloglink.com/?u=aHR0cDovL3BpYy5oYW5pbWFnZS5jb20vZGFiYWdpcmwvRFJFU1MvRGExMDcwNC8yLmpwZw=='; | |
http.get(url, function(res) { | |
console.log("Got response: " + res.statusCode); | |
if(res.statusCode===302){ | |
console.log(res.headers.location); | |
} | |
}).on('error', function(e) { | |
console.log("Got error: " + e.message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function encodeToGb2312(str){ | |
var strOut=""; | |
for(var i = 0; i < str.length; i++){ | |
var c = str.charAt(i); | |
var code = str.charCodeAt(i); | |
if(c==" ") strOut +="+"; | |
else if(code >= 19968 && code <= 40869){ | |
index = code - 19968; | |
strOut += "%" + z.substr(index*4,2) + "%" + z.substr(index*4+2,2); | |
} |