An XMPP BOSH & WebSocket server (connection manager) written using node.js in Javascript
Project Home Page: https://github.com/dhruvbird/node-xmpp-bosh
Please see whats_changed.md
| /* | |
| * Copyright (c) 2011 Dhruv Matani | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is | |
| * furnished to do so, subject to the following conditions: | |
| * |
| const js = require('../jsonselect.js'); | |
| var obj = { | |
| books: [ | |
| { name: "A Rough Ride", author: "Unknown" }, | |
| { name: "A Smooth Ride", author: "Known" }, | |
| { name: "Javascript", author: "Crockford" }, | |
| { name: "Node.js", author: "Dahl" }, | |
| { name: "C++", author: "Stroustrup" } | |
| ], |
| var dns = require('dns'); | |
| console.log('Calling resolveSrv(localhost)'); | |
| dns.lookup('localhost', function() { | |
| console.log('Callback for resolve(localhost)'); | |
| }); | |
| console.log('After calling resolveSrv(localhost)'); | |
| console.log('Calling resolveSrv(127.0.0.1)'); | |
| dns.lookup('127.0.0.0', function() { |
| /* Compiling: Create a file named list_sort.c in the src/ folder and | |
| * run: | |
| * | |
| * gcc list_sort.c lcthw/list.o lcthw/list_algos.o -I . -O2 | |
| * | |
| * Time: 14.025s | |
| * | |
| */ | |
| #include "lcthw/list.h" | |
| #include "lcthw/list_algos.h" |
| /* | |
| * Output on my machine (i686 32-bit): | |
| * | |
| * qsort: 3.08 sec | |
| * Bottom up Merge Sort: 1.98 sec | |
| * Top down Merge Sort: 2.43 sec | |
| * std::sort: 2.22 sec | |
| * | |
| */ |
| var path = require('path'); | |
| var filename = path.basename(path.normalize(__filename)) | |
| // Install deps: | |
| // $> npm install log4js | |
| // $> npm install node-lumberjack | |
| // | |
| // Run as: | |
| // $> time node stress.js > /dev/null |
| webserver: webserver.c libuv/uv.a http-parser/http_parser.o | |
| gcc -I libuv/include \ | |
| -lrt -lm -lpthread -o \ | |
| webserver webserver.c \ | |
| libuv/uv.a http-parser/http_parser.o | |
| libuv/uv.a: | |
| $(MAKE) -C libuv | |
| http-parser/http_parser.o: |
An XMPP BOSH & WebSocket server (connection manager) written using node.js in Javascript
Project Home Page: https://github.com/dhruvbird/node-xmpp-bosh
Please see whats_changed.md
| def merge_sort(msg, m, depth=0): | |
| print " " * depth, msg, m | |
| result=[] | |
| #Exit condition | |
| if len(m) < 2: | |
| return m | |
| mid = int(len(m)/2) | |
| left = m[:mid] |
| """ | |
| Problem statement: | |
| ------------------ | |
| Given a number 'n', design an algorithm that will output the smallest | |
| integer number 'X' which contains only the digits {0, 1} such that | |
| X mod n = 0 and X > 0 | |
| (1 <= n <= 100000) | |
| """ | |
| def solve(n): | |
| if n < 2: |