我最近用Homebrew安装了mongodb-2.6.0 .成功安装后,我尝试使用该mongo
命令进行连接.我收到以下错误,不允许我连接:
Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
Run Code Online (Sandbox Code Playgroud) 我打开终端并输入以下命令
sudo mongod
Run Code Online (Sandbox Code Playgroud)
然后输出
[initandlisten] waiting for connections on port 27017
Run Code Online (Sandbox Code Playgroud)
我打开另一个终端然后进入
sudo mongo
Run Code Online (Sandbox Code Playgroud)
打开mongo shell并提示mongo命令,但是当我转到localhost/27017时,我收到以下消息:
It looks like you are trying to access MongoDB over HTTP on the native driver port.
Run Code Online (Sandbox Code Playgroud)
我使用express创建了一个简单的nodejs应用程序,当我POST
数据时,似乎mongodb被挂起了.这是我在终端中收到的消息,我在其中启动了快速应用程序,页面从不发布数据.所以我认为问题在于mongo,但我无法弄明白.
POST /info 200 120002ms
Run Code Online (Sandbox Code Playgroud)
这是我的快递代码
var Info = require('../models/info');
var path = require('path');
var fs = require('fs');
var join = path.join;
exports.form = function(req,res){
res.render('info', {
myName: 'Michael'
});
};
exports.submit = function(){
console.log('Within exports.submit 1');
return function(req,res,next){
console.log('Within exports.submit 2 ');
var firstName = …
Run Code Online (Sandbox Code Playgroud) 我使用macports安装了MongoDB,并尝试运行该mongo
命令以启动mongo shell.我收到以下错误:
warning: Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at src/mongo/shell/mongo.js:146
Run Code Online (Sandbox Code Playgroud)
然后我运行mongod
并收到以下错误:
$ [initandlisten] MongoDB starting : pid=11984 port=27017 dbpath=/data/db 64-bit host=Nikitas-MacBook-Air.local
$ [initandlisten]
$ [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
$ [initandlisten] db version v2.6.0
$ [initandlisten] git version: nogitversion
$ [initandlisten] build info: Darwin tennine-slave.macports.org 13.1.0 Darwin Kernel Version
13.1.0: …
Run Code Online (Sandbox Code Playgroud) 使用aws lambda我在使用numpy模块运行脚本时收到以下错误:
无法导入模块'process':/ var /task/numpy/core/multiarray.so:无效的ELF头
这个问题是关于numpy本身还是natsy特别是在aws lambda上.什么是无效的ELF标题?
编辑:
我相信这与本机代码执行有关,如在AWS Lambda上使用nodejs"ref"模块时在本回答"无效ELF头"中所述
我收到了function definition is not allowed here
所有三个错误enum
.我最近更新到Xcode 6.0.1,现在我收到了这个错误.如何避免使用此宏,如何修复此错误.我还将目标SDK设置为支持这些宏的ios 6.0.
BConstants.h
#ifndef asdf_BPConstants_h
#define asdf_BPConstants_h
typedef NS_ENUM(NSUInteger, BTheme) {
kField
};
typedef NS_ENUM(NSUInteger, BItem) {
kBox
};
typedef NS_ENUM(NSUInteger, BMovementState) {
kTouchUp,
kTouchDown
};
#endif
Run Code Online (Sandbox Code Playgroud) 在该方法的文档中,它声明如果生成数据的熵量不足,它将抛出异常.我的问题与熵有关.如何生成并且可以通过提供足够的熵来防止异常被抛出?抛出异常会有多常见,还是未知?
文档crypto.randomBytes
:
crypto.randomBytes(size,[callback])
// async
crypto.randomBytes(256, function(ex, buf) {
if (ex) throw ex;
console.log('Have %d bytes of random data: %s', buf.length, buf);
});
Run Code Online (Sandbox Code Playgroud)
生成加密强大的伪随机数据.
如果没有足够的累积熵来生成加密强数据,则会抛出错误或调用带有错误的回调.换句话说,即使所有熵源都耗尽,没有回调的crypto.randomBytes也不会阻塞.
在下面的示例中,我将如何正确处理异常并仍然完全填充数组,基本上确保数组已完全填充生成的字节.我是否只是捕获异常并在catch块中生成一个新数组,但是如果它也会引发异常?基本上我将如何使这段代码100%正常工作?
var codes = [];
for(var i = 0;i < 100;i++){
(function(i){
crypto.randomBytes(256, function(ex, buf) {
if (ex) throw ex;
codes[i] = buf.toString('hex');
});
})(i)
}
Run Code Online (Sandbox Code Playgroud) Tailwind 2.0.1 的2xl
断点设置为1536px
。我想禁用此断点并将最大container
宽度设置为xl
断点。根据文档,我可以禁用 的所有响应变体container
,但我只想禁用这个断点。相反,我尝试2xl
通过更新 Tailwind 配置来禁用断点,如下所示:
module.exports = {
theme: {
screens: {
'2xl': '1280px'
}
}
}
Run Code Online (Sandbox Code Playgroud)
这不起作用,当我只想针对单个类和单个断点时,我也不认为这是正确的。
我在这个网站http://www.agileinfoways.com/上看到了很好的滚动效果,想知道如何实现.我以前从未见过它,我甚至不知道它叫什么.滚动几乎模仿UIScrollView
iOS平台上的一个.关于如何创建这个的任何建议都会有所帮助.谢谢
我已使用以下代码设置行插入.我只UITableViewRowAnimationNone
在插入和删除行时使用,但有时,正如您在下面的gif中看到的那样,该行从顶部或底部开始动画.在大多数情况下,它没有动画,因为我想要它,但有时它在插入和删除时动画.我不是在谈论扩展显示插入单元格的表格视图,我的意思是单元格似乎从底部或顶部滑入.
以下是控制插入动画的方法:
- (void)contentHeaderFooterView:(NFContentHeaderFooterView *)headerFooterView sectionOpened:(NSInteger)section{
NSIndexPath *pathToAdd = [NSIndexPath indexPathForRow:0 inSection:section];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[pathToAdd] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
}
Run Code Online (Sandbox Code Playgroud)
这是控制删除动画的方法.
- (void)contentHeaderFooterView:(NFContentHeaderFooterView *)headerFooterView sectionClosed:(NSInteger)section{
NSIndexPath *pathToDelete = [NSIndexPath indexPathForRow:0 inSection:section];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[pathToDelete] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
}
Run Code Online (Sandbox Code Playgroud) 如果我想验证动态资源是否存在,Nuxt建议validate()
在页面组件中实现调用。如果该调用执行数据的 API 请求以验证资源的存在,Nuxt 文档说明我可以检查 Vuex 存储,但没有明确说明我可以dispatch
执行操作以commit
获取 API 请求接收的数据。在store
该范围内validate()
的方法允许调用dispatch
与Vuex店就如同和同步asyncData
或fetch
,但是这会是一个反模式-从内部数据提交给Vuex validate()
?
例如,您还可以检查商店中的一些数据(在操作之前由 nuxtServerInit 填充
commit
从内部获取数据的需求validate()
将防止在同一资源内asyncData
或fetch
对同一资源进行重复的 API 调用。例如,如果我调用validate()
请求一个资源的存在并且我没有commit
将该资源的数据发送给 Vuex,我可能需要再次从asyncData
或请求该资源数据fetch
。
validate ({ app, params, store }) {
return app.$axios.get('client/cards', {params: { slug: params.card }})
.then(() => true)
.catch(() => false)
}
Run Code Online (Sandbox Code Playgroud)
本质上是复制相同的 API 请求,但在操作中:
async fetch ({ params, …
Run Code Online (Sandbox Code Playgroud) mongodb ×3
ios ×2
javascript ×2
macos ×2
node.js ×2
nuxt.js ×2
aws-lambda ×1
caanimation ×1
cryptography ×1
css ×1
express ×1
homebrew ×1
html5 ×1
jquery ×1
numpy ×1
python ×1
python-2.7 ×1
tailwind-css ×1
uitableview ×1
uiview ×1
vue.js ×1