require

Loading requirejs modules Dynamically with sugar syntax

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hi i am trying to load some requireJs modules in a dynamic way by getting a list of filters and the iterate over the array to load this modules like this define(function(require){ var runFilters = function(filters){ var _ = require('underscore'); var computedFilters = getFilters(filters); var result = _.every(computedFilters,function(filter){ return filter(); }); return result; }; var getFilters = function(filters){ var _ = require('underscore'); return _.map(filters,function(filter){ return require('filters/' + filter); },this); } var

Sending image as binary via require(“http”) request to a remote server

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to send an image to remote server from nodejs server. Here's the request format so far. Note: Just like binary request in postman and choosing a file and sending) function upload ( options , body ) { body = body || '' ; return new Promise ( function ( resolve , reject ){ const https = require ( 'https' ); https . request ( options , function ( response ) { var body = []; response . on ( 'data' , function ( chunk ) { body . push ( chunk ); }); response . on ( 'end' , function (){ resolve ( JSON . parse ( Buffer . concat (

throw new mongoose.Error.MissingSchemaError(name); ^ MongooseError: Schema hasn't been registered for model “merchant”

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: throw new mongoose.Error.MissingSchemaError(name); ^ MongooseError: Schema hasn't been registered for model "merchant". Use mongoose.model(name, schema) at Mongoose.model (C:\survey-system\node_modules\mongoose\lib\index.js:362:13) app.js: var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var index = require('./routes/index'); require('./models/merchant'); var mongoose =

Schema hasn't been registered for model “categories”. Use mongoose.model(name, schema)

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When i called my function in controller through postman,it worked fine and i got results but when i wrote a test case for the same function it is saying the error as MissingSchemaError: Schema hasn't been registered for model "categories". Use mongoose.model(name, schema) I was completely confused about these because how come a function that is working well go wrong with test case.Can any one suggest help please. My test.js, var server = require('../modules/categories/model/categories.server.model'); var chai = require('chai'); var chaiHttp

socket.gethostbyname unable to find local hostname after updating to mac osx sierra

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: After updating to OS Sierra, I tried running my local test suite with rspec spec , this immediately broke giving this stack trace: Coverage report generated for RSpec to / Users / October / Documents / code / clients - api / coverage . 38 / 101 LOC ( 37.62 %) covered . / Users / October /. rvm / gems / ruby - 2.3 . 1@clients - api / gems / bundler - 1.13 . 2 / lib / bundler / runtime . rb : 94 : in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'torid'. (Bundler::GemRequireError) Gem Load

passport.js passport.initialize() middleware not in use

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using node with express + mongoose and trying to use passport.js with restful api. I keep getting this exception after authentication success (I see the callback url on the browser): /Users/naorye/dev/naorye/myproj/node_modules/mongoose/lib/utils.js:419 throw err; ^ Error: passport.initialize() middleware not in use at IncomingMessage.req.login.req.logIn (/Users/naorye/dev/naorye/myproj/node_modules/passport/lib/passport/http/request.js:30:30) at Context.module.exports.delegate.success (/Users/naorye/dev/naorye/myproj/node_modules

“Uncaught TypeError: $(…).popover is not a function” RoR - Bootstrap - jQuery

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've checked out this question on SO because I have a similar problem with rails. I'm trying to make an AJAX request work (looking up some financial tickers) and I think that I'm ok with my code (at least I hope) but I'm still getting this weird error: bootstrap.self-fdc98dee79ee88255e10cac6caa91338165cb76cf0d263744d8d90011fc2ef8f.js:3 Uncaught TypeError: $(...).popover is not a function at HTMLDocument. (bootstrap.self-fdc98dee79ee88255e10cac6caa91338165cb76cf0d263744d8d90011fc2ef8f.js:3) at fire (jquery.self

How are require, require_dependency and constants reloading related in Rails?

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How are require and require_dependency different? How can require_dependency automatically reload classes in development but require can't ? I digged into Rails' ActiveSupport::Dependencies and dispatcher.rb code. What I saw in require_dependency 's code is it basically adds the constants to an autoloaded_constants array. But it gets cleared in clear_application inside dispatcher after each request. Can someone give a clear explanation or point me to some resources which will help? 回答1: require (and its cousin load ) are core Ruby methods.

Bound columns require a field or property access expression in ASP.NET MVC

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have relations one to many in DB ( i used entity interface to generate associations between 2 obj) Im getting error: Bound columns require a field or property access expression My code: in view: in entity model: public ObjectSet<Deliveries> Deliveries { get { if ((_ Deliveries == null)) { _Deliveries = base.CreateObjectSet<Deliveries>("Deliveries"); } return _Deliveries; } } private ObjectSet<Deliveries> _Deliveries; In deliveries i havnt any null. Where is problem ? 回答1: columns.Bound accept only primitive as int or string. You can't

Gulp Concat JS results in require is not defined

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have project using gulp. I am trying to get jquery, jquery ui and bootstrap into one file called vendor.js. This works fine however when I run "gulp serve" to run the project fromthe dist folder of the project i get the error ReferenceError: require is not defined http://localhost:3000/assets/toolkit/scripts/vendor.js Line 6 var jQuery = require ( 'jquery' ); gulp . task ( 'vendor-js' , function () { return gulp . src ([ 'src/assets/toolkit/scripts/vendor/jquery.min.js' , 'src/assets/toolkit/scripts/vendor/jquery-ui.js' , 'src