在我的/usr/local/mongodb/mongod.conf档案中,我有
# Store data alongside MongoDB instead of the default, /data/db/
dbpath = /usr/local/mongodb_data
# Only accept local connections
bind_ip = 127.0.0.1
Run Code Online (Sandbox Code Playgroud)
但是当我尝试运行Mongo(在我的Mac上)时,我收到一个错误:
Wed Sep 14 09:29:35 [initandlisten] exception in initAndListen std::exception: dbpath (/data/db/) does not exist, terminating
Run Code Online (Sandbox Code Playgroud)
显然conf文件没有被读取
我有一个Rails引擎,我想访问父母模型.那可能吗?如果是这样,我该怎么做?
我正在使用Rails 2.3.13而在我的中environments/production.rb,我有:
config.log_level = :info
RAILS_DEFAULT_LOGGER = SyslogLogger.new('mysite-platform-production')
Run Code Online (Sandbox Code Playgroud)
然而,我log/production.log是空的.那为什么会这样?
我想学习Raspberry Pi的编程,我对Node.js非常好.我差不多五年没碰过C++了.我知道我可以在Pi上加载Linux,但是如何在Node中进行编程呢?
如果是这样,我该如何处理输入/输出等事情?例如,如果我想制作一个检测到运动并发出哔哔声的简单设备,这是否可以通过Pi上的Node.js来实现?
我正在尝试使用AngularUI路由器进行一些身份验证.$urlRouter.sync()看起来正是我需要的.但是,这只有在我拦截时才可用$locationChangeSuccess.但是当我这样做时,它$state.current.name是空的,而我希望它是当前的状态.
到目前为止,这是我的代码:
$rootScope.$on('$locationChangeSuccess', function(event, next, nextParams) {
event.preventDefault();
if ($state.current.name === 'login') {
return userService.isAuthenticated().then(function(response) {
var authenticated;
authenticated = response.authenticated;
return alert(authenticated);
});
}
});
Run Code Online (Sandbox Code Playgroud)
关于我做错了什么的指示?
我有一项服务,我的目标是让用户通过OAuth授权我们使用他/她的Github帐户.API层是无状态的,因此我不想维护任何会话信息.我到目前为止的代码是:
app.use passport.initialize()
app.use passport.session()
passport.use new GitHubStrategy
clientID: global.config.oauth.github.clientID
clientSecret: global.config.oauth.github.clientSecret
callbackURL: "http://localhost:9500/auth/github/callback"
passReqToCallback: true
, (req, accessToken, refreshToken, profile, done) ->
console.log req.params
serviceQuery =
service: 'github'
provider_id: "#{profile.id}"
UserId: 13
global.db.Service.find
where: serviceQuery
.then (dbService) ->
if not dbService
newService =
service: 'github'
token: accessToken
secret: null
provider_id: profile.id
raw: profile._json
UserId: 13
global.db.Service.create newService
else
dbService.token = accessToken
dbService.raw = profile._json
dbService.save()
.then ->
done null, true
app.get '/auth/github/:sessionToken', (req, res, next) ->
console.log req.params
next() …Run Code Online (Sandbox Code Playgroud) 我的测试没有检测到变化.这是我的组件:
toggleUploadModal() {
const modalRef = this.ngbModal.open(UploadFilesComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.DeliverableTransaction = this.transactionDetails;
modalRef.result.then((res) => {
if (res.status === 'success') {
this.deliverableTransactionService.updateDeliverableTransaction(this.route.snapshot.params.id, {
submissionStatus: 'In Process'
})
}
setTimeout(() => {
this.uploadStatus = {};
}, 5000);
})
}
Run Code Online (Sandbox Code Playgroud)
我的测试有:
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [TransactionFileViewer, NgxPermissionsAllowStubDirective],
providers: [...],
imports: [...],
schemas: [
NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA
],
})
.compileComponents();
fixture = TestBed.createComponent(TransactionFileViewer);
downloadService = TestBed.get(DownloadService);
component = fixture.componentInstance;
fixture.detectChanges();
submissionFileService = TestBed.get(SubmissionFileService);
deliverableDefinitionService = TestBed.get(DeliverableDefinitionService);
service = TestBed.get(DeliverableDefinitionDetailViewService);
deliverableTransactionService …Run Code Online (Sandbox Code Playgroud) 根据文档,我可以这样做一个日期:
new Schema({
date: { type: Date, default: Date.now }
})
Run Code Online (Sandbox Code Playgroud)
但如果我需要时间怎么办?
我有一个测试:
import { convertHeicToPng } from './heicUtils';
class Worker {
url: string;
onmessage: (m?: any) => void;
constructor(stringUrl: string) {
this.url = stringUrl;
this.onmessage = () => {};
}
postMessage(msg: any) {
this.onmessage(msg);
}
}
(window.Worker as any) = Worker;
describe('test heicUtils', () => {
test('should convert HEIC to PNG', async () => {
const file = new File([''], 'test.heic', { type: 'image/heic' });
const base64 = await convertHeicToPng(file);
expect(base64).toContain('data:image/png;base64');
});
});
Run Code Online (Sandbox Code Playgroud)
在 中heicUtils,我使用的是heic2any,它使用 WebWorkers。我如何才能正确地模拟 Worker …
node.js ×3
angular ×1
angular5 ×1
angularjs ×1
bluebird ×1
codemirror ×1
coffeescript ×1
javascript ×1
jestjs ×1
macos ×1
mongodb ×1
mongoose ×1
oauth-2.0 ×1
passport.js ×1
raspberry-pi ×1
raspbian ×1
spy ×1
stub ×1
typescript ×1
web-worker ×1