joyent

How to connect with username/password to mongodb using native node.js driver

我的未来我决定 提交于 2019-12-12 08:09:00
问题 I'm using native mongo driver in Joyent cloud, the node.js application runs fine locally but in Joyent when i run with usrname/pswd that they provided it fails to connect. following is the code used to connect: var db = new MongoDB(dbName, new Server('localhost', 27017 , {auto_reconnect: true}), {w: 1}); db.open(function(e, db){ if (e) { console.log(e); } else{ console.log('connected to database :: ' + dbName); //db.admin().authenticate('admin', '+(uihghjk', function(de , db){ // if(e){ //

NodeJS Cluster unexpected assert.AssertionError

China☆狼群 提交于 2019-12-06 00:36:44
问题 I am facing an weird error, this is my main .js file var cluster = require('cluster'), express = require('express'), http = require('http'); if (cluster.isMaster) { var cpuCount = require('os').cpus().length; for (var i = 0; i < cpuCount; i += 1) { cluster.fork(); } } else { var app = express(), server = http.createServer(app), io = require('socket.io').listen(server); io.set('log level', 2); server.listen(3000); } cluster.on('exit', function (worker) { console.log('Worker ' + worker.id + '

NodeJS Cluster unexpected assert.AssertionError

∥☆過路亽.° 提交于 2019-12-04 06:39:05
I am facing an weird error, this is my main .js file var cluster = require('cluster'), express = require('express'), http = require('http'); if (cluster.isMaster) { var cpuCount = require('os').cpus().length; for (var i = 0; i < cpuCount; i += 1) { cluster.fork(); } } else { var app = express(), server = http.createServer(app), io = require('socket.io').listen(server); io.set('log level', 2); server.listen(3000); } cluster.on('exit', function (worker) { console.log('Worker ' + worker.id + ' died :('); cluster.fork(); }); This is the error message i am getting.. Worker 1 died :( Worker 2 died :

UTF-8 problems in php: var_export() returns \0 null characters, and ucfirst(), strtoupper(), etc. behave strangely

一世执手 提交于 2019-12-03 17:45:21
问题 We are dealing with a strange bug in a Joyent Solaris server that never happened before (doesn't happen in localhost or two other Solaris servers with identical php configuration). Actually, I'm not sure if we have to look at php or solaris, and if it is a software or hardware problem... I just want to post this in case somebody can point us in the right direction. So, the problem seems to be in var_export() when dealing with strange characters. Executing this in the CLI, we get the expected

UTF-8 problems in php: var_export() returns \\0 null characters, and ucfirst(), strtoupper(), etc. behave strangely

风流意气都作罢 提交于 2019-12-03 06:36:43
We are dealing with a strange bug in a Joyent Solaris server that never happened before (doesn't happen in localhost or two other Solaris servers with identical php configuration). Actually, I'm not sure if we have to look at php or solaris, and if it is a software or hardware problem... I just want to post this in case somebody can point us in the right direction. So, the problem seems to be in var_export() when dealing with strange characters. Executing this in the CLI, we get the expected result in our localhost machines and in two of the servers, but not in the 3rd one. All of them are

Verify if my node.js instance is dev or production

那年仲夏 提交于 2019-11-28 16:36:43
问题 Right now, whenever I want to deploy a node.js server to my production server, I need to change all the IP/DNS/username/password for my various connection to my databases and external APIs. This process is annoying, is there a way to verify if the currently running node.js instance is in cloud9ide or actually my production joyent smartmachine? If I am able to detemrine (in my running code) on which server my node.js instance is running , I'll add a condition that set the values to the prod or