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
wifeschool-lm:~/Code/forumreports $ node reports.js | |
events:14 | |
throw new Error("Uncaught, unspecified 'error' event."); | |
^ | |
Error: Uncaught, unspecified 'error' event. | |
at Client.emit (events:14:15) | |
at Client._handlePacket (/Users/croucher/.node_libraries/mysql/client.js:206:12) | |
at Parser.<anonymous> (/Users/croucher/.node_libraries/mysql/client.js:56:14) |
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
wifeschool-lm:~/Code/kangaroo $ node index.js | |
[riak-js] GET /riak/test/123 | |
[riak-js] PUT /riak/test/123 | |
{ message: '<HTML><HEAD><TITLE>404 Not Found</TITLE></HEAD><BODY><H1>Not Found</H1>The requested document was not found on this server.<P><HR><ADDRESS>mochiweb+webmachine web server</ADDRESS></BODY></HTML>' | |
, stack: [Getter/Setter] | |
} | |
wifeschool-lm:~/Code/kangaroo $ node index.js | |
[riak-js] GET /riak/test/123 | |
[riak-js] PUT /riak/test/123 | |
{ foo: 'bar' } |
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
wifeschool-lm:~/Code/node-dnsserve(master) $ sudo npm install node-couchdb | |
Password: | |
npm it worked if it ends with ok | |
npm sudo true | |
npm configfile /Users/croucher/.npmrc | |
npm cli [ 'install', 'node-couchdb' ] | |
npm version 0.1.18-1 | |
npm install pkg node-couchdb | |
npm fetch data node-couchdb | |
npm GET node-couchdb |
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 assert = require('assert'), | |
sys = require('sys'); | |
var pass = function(message) { | |
sys.error('\033[32mPASS\033[0m: ' + message); | |
}; | |
var fail = function(message) { | |
sys.error('\n\033[31mFAIL\033[0m: ' + message + '\n'); | |
}; |
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
//take a number and make sure it's written to the buffer as | |
//the correct length of bytes with leading 0 padding where necessary | |
// takes buffer, offset, number, length in bytes to insert | |
var numToBuffer = function(buf, offset, num, len) { | |
for (var i=offset;i<offset+len;i++) { | |
var shift = 8*((len - 1) - i - offset); | |
var insert = (num >> shift) & 255; | |
buf[i] = insert; |
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
croucher@Node-1:~/Code/node_pcap$ sudo apt-get install libpcap-dev | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
The following extra packages will be installed: | |
libpcap0.8-dev | |
The following NEW packages will be installed: | |
libpcap-dev libpcap0.8-dev | |
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. | |
Need to get 154kB of archives. |
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
wifi-e-135-251:~/Code/node_pcap/examples(master) $ ifconfig | |
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 | |
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 | |
inet 127.0.0.1 netmask 0xff000000 | |
inet6 ::1 prefixlen 128 | |
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 | |
stf0: flags=0<> mtu 1280 | |
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 | |
ether 00:26:4a:03:5b:4a | |
media: autoselect status: inactive |
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
wifi-e-135-251:~/Code/node_pcap(master) $ sudo find / -name "pcap.h"Password: | |
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/pcap.h | |
/Developer/SDKs/MacOSX10.5.sdk/usr/include/pcap.h | |
/opt/local/include/pcap/pcap.h | |
/opt/local/include/pcap.h | |
/opt/local/var/macports/software/libpcap/0.9.8_0/opt/local/include/pcap.h | |
/opt/local/var/macports/software/libpcap/1.0.0_0/opt/local/include/pcap/pcap.h | |
/opt/local/var/macports/software/libpcap/1.0.0_0/opt/local/include/pcap.h | |
/opt/local/var/macports/software/libpcap/1.1.1_0/opt/local/include/pcap/pcap.h | |
/opt/local/var/macports/software/libpcap/1.1.1_0/opt/local/include/pcap.h |
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 msgStr = msg.slice(0,5); | |
console.log(sys.inspect(msgStr)); | |
var a = msgStr.toString('ascii', 0, msgStr.length); | |
console.log(sys.inspect(a)); | |
for (i=0;i<a.length;i++) { | |
console.log(a.charCodeAt(i)); |
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 httpClient = http.createClient(80, host); | |
var request = httpClient.request("POST", urlpath, {"host": host, "Content-Length": data.length, "Content-Type": "applicaiton/x-www-form-urlencoded"}); | |
request.write(data); | |
request.addListener('response', function (response) { | |
sys.puts("STATUS: " + response.statusCode); | |
sys.puts("HEADERS: " + JSON.stringify(response.headers)); | |
response.setBodyEncoding("utf8"); | |
response.addListener("data", function (chunk) { | |
sys.puts("BODY: " + chunk); | |
}); |