Tag: 节点

具有多个写入的节点 – 串行端口问题

当我传递一个元素的数组时,一切都很好,当我传递一个二(max用于我们的用例)我得到以下错误: 该文件描述符没有写入队列(写入后)! 这是我的代码: exports.triggerPhysical = function(state, alerts) { console.dir("IN PHYSICAL"); console.dir(alerts); SerialPort.list(function(err, ports) { var port = {}; for(var i = 0; i < ports.length; i++) { try { if(typeof ports[i].manufacturer != 'undefined' && ports[i].manufacturer.includes("Numato")) { port = ports[i]; } } catch(err) { console.dir(err); } } var numato = new SerialPort(port.comName, {baudrate : 19200}, function(err) […]

什么是简单的饲料系统最好的模式devise? -Aerospike

我正在尝试开发一个电子商务应用程序,并试图在我的应用程序中使用提要的概念。 每当用户购买东西时,就会为其生成一个类似于东西的东西,这可以通过两种方式被其他用户看到: 如果用户跟随购买该产品的人员,他/她可以看到该馈送(这是一种定制的馈送,买方告知只与跟随他/她的人分享) 生成的Feed将会显示给所有正在使用该应用的用户(在这种情况下,买家必须select与所有人共享的选项) 这是我的用例,我正在使用以下技术为此构build后端: 的NodeJS 塞 我的使用案例包括一个社交networking系统的东西。 什么是解决这个问题的最好方法? 我已经通过Twitter应用程序Aerospike,但没有这个分页,而且我恐怕这个模式可能会失败如果我尝试缩放。

用Node / NWJS App读取PDF文件

首先感谢您的关注。 我正在构build一个简单的nwjs应用程序,并阅读PDF文件很难。 我试了几个库(pdf2json,pdfreader,pdf2text),他们都返回了以下错误。 Error: No PDFJS.workerSrc specified at error (eval at <anonymous> (/node_modules/pdf2json/lib/pdf.js:60:1), <anonymous>:195:9) at new WorkerTransport (eval at <anonymous> (/node_modules/pdf2json/lib/pdf.js:60:1), <anonymous>:42944:9) at Object.getDocument (eval at <anonymous> (/node_modules/pdf2json/lib/pdf.js:60:1), <anonymous>:42547:15) ….. 似乎所有这些库都基于pdf.js,问题来自那里。 我剥下我的js来解决问题。 var reader = require('pdfreader'); new reader.PdfReader().parseFileItems("/path/to/file.pdf", function(err, item){ console.log(err, item); }); 这工作如果我运行它作为一个普通的节点脚本node myfile.js但它不工作时,我作为一个nwjs应用程序运行它。 我无法find任何其他可靠的本地js库。 任何帮助将不胜感激。

mongooseForegin键映射

我是MongoDB / Mongoose的新手,试图弄清楚如何映射Schema之间的关系。 我不认为问题是.populate()。 在创build新用户和客户时,我看不到收集中反映的关系 用户(通过本地/社交login)有许多客户端。 一组客户属于1个用户 这是正确的方式来声明外键? {type:Schema.Types.ObjectId,ref:'Client'} Schema是否应该有彼此的外键相互联系? 创build用户/客户端以使外键数据显示时是否需要额外的代码? 我读了一些关于populate() 用户 var mongoose = require('mongoose'); var Schema = mongoose.Schema; var userSchema = new Schema({ local: { id: String, email: String, password: String, name: String, mobile: String, clients: {type: Schema.Types.ObjectId, ref: 'Client'} }, google: { id: String, token: String, email: String, name: String, clients: […]

Query.execute不是一个函数

当我试图执行查询使用query.execute()比它显示它不是一个函数。 我已经尝试过了,最近3个月前还在工作。 它是从新的aerospike节点客户端更新中删除? 如果是,那么哪个是可选的选项。 我可以过滤查询没有二级索引?

如何升级Nodester上的Node.js

我正在尝试升级到Node v0.6.17。 我遵循这篇文章中的说明: http://blog.nodester.com/ 但我仍然运行0.4.9版本 有什么build议么? 谢谢

奇怪的结果在nodejs扫描列表查询aerospike?

这里有什么不对吗? 我有这个片段,它显示了我的stream中的所有logging? 语句filter似乎不被忽略。 我已经设置了二级索引。 // uid的bintypes是文本 var statement = { concurrent: true, nobins: false, }; statement.filters = [aerospike.filter.equal("idx_mynamespace_myset_uid", "639085555553")]; var query = client.query('mynamespace','myset', statement); var stream = query.execute(); var count = 0; stream.on('data', function(rec) { // process the scanned record here count++; console.log(rec); }); stream.on('error', function(err){ // console.log(err); }); stream.on('end', function() { console.log('TOTAL SCANNED:', count++); […]

对自定义模块使用node_modules文件夹

最近我得到这个结构在哪里: app.js < – init脚本,它将启动lib / index.js node_modules < – 从npm获取的模块 LIB index.js 资源 – 系统中某些实体的代码 node_modules – 系统中使用的本地模块(不是来自npm) 对于从npm中获取的本地代码,如何使用名为node_modules的文件夹呢? 唯一的好处是,您不需要从资源请求模块时使用相对path。 负面的部分是,有许多脚本(jshint,nodemon,..)这是忽略这些文件夹,你也必须允许这个文件夹也在.gitignore

这个JS代码有什么错?

var Subscription = require('./Subscription'); var api = require('./api'); exports = module.exports = {}; var bridgeData; function validateAccount(account) { if (!account) throw new Error('Muzzley account details must be present!'); if (!account.appToken) throw new Error('appToken is not defined!'); if (!account.profileId) throw new Error('profileId is not defined!'); if (!account.serialNumber) throw new Error('serialNumber is not defined!'); } function validateComponents(components) […]

Aerospike Query使用Bin1 == Bin2读取所有logging

我有一个nodejs和aerospike设置。 我想知道如何运行一个查询Bin1 == Bin2 。 在SQL中 SELECT * FROM [test]t where t.EmployeeId == t.shipperid 可以这样做吗? 我总是可以查询test集中的所有值,并在nodejs中对其进行过滤。 不过,我认为这将是非常低效的。 请让我知道是否有一个aerospike的方式来做到这一点?