I am building a real time energy monitoring system, where the data are from sensors. There will be new data every second. The data used will be aggregated to be rendered as charts. I have looked into real time stream processing with big amounts of data, and it lead me to Apache Kafka.
Right now my web app is using Express js. I am using kafka-node library. Now currently, I manually insert new data through the command line as a …
我刚刚使用安装了一个新的 Sails.JS sails new sails。我已经安装了所有依赖项,并且 node_modules 文件夹可用。但是当我尝试使用运行服务器时sails lift,它给了我错误:
error:\nerror: Error:\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\nNo `sails.config.sockets.onlyAllowOrigins` or `sails.config.sockets.beforeConnect`\nsetting was detected. For security reasons, one of these options must be set\nwhen running Sails in a production environment.\nFor example (in config/env/production.js):\n\nsockets: {\n onlyAllowOrigins: ["http://www.mydeployedapp.com", "http://mydeployedapp.com"]\n}\n\n\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n\n at Hook.configure (A:\\Projects\\sails\\node_modules\\sails-hook-sockets\\lib\\configure.js:60:13)\n at Hook.wrapper [as configure] (A:\\Projects\\sails\\node_modules\\@sailshq\\lodash\\lib\\index.js:3275:19)\n at A:\\Projects\\sails\\node_modules\\sails\\lib\\app\\private\\loadHooks.js:331:20\n at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:3083:16\n at eachOfArrayLike (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:1003:9)\n at eachOf (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:1051:5)\n at Object.eachLimit (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:3145:5)\n at configure (A:\\Projects\\sails\\node_modules\\sails\\lib\\app\\private\\loadHooks.js:328:17)\n at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:3853:24\n at replenish (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:946:17)\n at iterateeCallback (A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:931:17)\n at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:906:16\n at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:3858:13\n at A:\\Projects\\sails\\node_modules\\sails\\node_modules\\async\\dist\\async.js:421:16\n …Run Code Online (Sandbox Code Playgroud) 我目前正准备部署 Laravel 应用程序。我的功能之一是生成 PDF 并将文件保存在存储文件夹中。但问题是,它仅在存储文件夹具有777权限时才有效。当然,一旦部署,这是一个很大的安全风险。我该如何解决?因为如果我不777许可,它会返回一个Warning: mkdir() [function.mkdir]: Permission denied in ...错误。
谢谢 :)
我试图根据特定键对数组进行排序,但它不起作用。JSON 格式的数组如下所示。我想按id_question升序排序。
这是我到目前为止所做的:
public function compare($ar1, $ar2){
if ($ar1['id_question']<$ar2['id_question']) {
return 1;
}else {
return -1;
}
}
Run Code Online (Sandbox Code Playgroud)
调用排序函数:
uasort($related, Array ($this, 'compare'));
Run Code Online (Sandbox Code Playgroud)
这里完成的是解决方案
usort($related, function($a, $b){
if ($a['id_question'] < $b['id_question']) {
return -1;
}else {
return 1;
}
});
Run Code Online (Sandbox Code Playgroud) 我正在使用 Laravel 和 socket.io 试验实时应用程序。我制作了一个单独的节点和 redis 服务器。现在我看到几个教程介绍 redis 订阅频道。但是我尝试没有 redis 并且 socket.io 能够连接和发射等。
问题是,redis 是干什么用的,有没有什么特定的场景是 redis 能够处理 socket.io 不能处理的?
谢谢你。