require

react-native - Image require local path from JSON

匿名 (未验证) 提交于 2019-12-03 09:05:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hello comunity :) I am working on a testapp in react-native and try to get Images from a local storage place. Actual what i am doing: I give an image directlink source to a var and call this method at my render function. *react: ^0.14.8 ||* *react-native: ^0.23.1||* *npm: 2.15.1 ||* *node: v4.4.4* Working: ImageCall-File (Imagefile.js) var samplepicture; setPicture(){ samplepicture= require('./images/picture.png') } render() { this.setPicture; return( <Image source=samplepicture/> ); } The code snippet above works in a created class wich is

Lua: can I use “require” as a form of dependency injection?

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm designing a hospital integration system which consumes data from various hospitals (our customers), and then applies specific business rules to said data based on reading configurations from a database. If I were using Java, my first instinct would be to build a series of interfaces representing the various business rules, and then inject concrete instances (using Spring/guice) to compose a fully configured object. This would allow me to achieve a clean separation between configuration logic (what biz rules should apply to Hospital Foo?)

How to require(&#039;electron&#039;) when script is loaded by system.js

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use Aurelia and SystemJs within an electron app; I have a fairly basic app-window.js : const remote = require('electron').remote; document.getElementById("close-btn").addEventListener("click", function (e) { var window = remote.getCurrentWindow(); window.close(); }); ... if I consume it as normal html script ( <script src="app-window.js"></script> ) it works perfectly fine. However, if I have systemJS import it: <script> System.import('app-window.js'); </script> I get the error: system.js:4 GET file:///D:/Code/aurelia-electron

Cannot load files using require

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I just downloaded Ruby 2.0 and have a serious problem with require when I try to run a simple Sinatra app: /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- sinatra (LoadError) from /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from test.rb:1:in `<main>' Also, this and other programs I have a problem with now, worked perfectly fine when i was using Ruby 1.8.7. What should I do? 回答1: I

Dojo 1.7 how to use dojo components outside of require()

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have created Dojo widget like below using AMD loader in Dojo 1.7.2 var myCpane; require([ "dijit/layout/ContentPane" ], function(ContentPane) { myCpane = new ContentPane(); }); myCpane.startup(); // It gives 'myCpane' as undefined In the above example, in the last statment, the variable 'myCpane' is coming as 'undefined', if I use the 'myCpane.startup()' inside the 'require()' callback function then, it will work fine. But I want to use that 'myCpane' variable on outside of the 'require' function (for many reasons) . I know the 'require()'

Can&#039;t read property of undefined (mix.initialize() )when use node_modules/.bin/webpack

匿名 (未验证) 提交于 2019-12-03 08:56:10
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to compile with node_modules/.bin/webpack and I get this error: Mix.initialize(); ^ TypeError: Cannot read property 'initialize' of undefined at Object.<anonymous> (/home/vagrant/Code/stream/webpack.config.js:9:4) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at requireConfig (/home/vagrant/Code/stream

How to require Node Events module in React Native

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do I require the events Node module within my React Native project? I ran into some module dependency issues with util and http which I resolved by using Browserify to package. I try to take the same approach with events : npm install events var EventEmitter = require('events').EventEmitter; After packaging with Browserify, I still get the same error from React Native: "Requiring unknown module 'events'." 回答1: This is what you want: https://github.com/facebook/react-native/issues/1058 var EventEmitter = require('EventEmitter'); 回答2: I'm

Angularjs Validation: Require at least one input from a list

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to use Angularjs validation to enable a button when at least one input from a list is filed in. What I'm working on is similar to the following w3schools example: <head> <script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js" ></script> </head> <body> <h2> Validation Example </h2> <form ng-app = "myApp" ng-controller = "validateCtrl" name = "myForm" novalidate > <p> Username: <br> <input type = "text" name = "user" ng-model = "user" required > <span style = " color : red " ng-show = "myForm

Mismatched anonymous define() module

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm getting this error when I browse my webapp for the first time (usually in a browser with disabled cache). Error: Mismatched anonymous define() module: function (require) { HTML : . . .

ExecJS::RuntimeUnavailable error when I start the Rails server

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have created a new Rails application. When I try to start the server I get the following error: [bathakarai@Project1-CO samp]$ rails server /home/bathakarai/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /usr in PATH, mode 040777 /home/bathakarai/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.4/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /usr in PATH, mode 040777 /home/bathakarai/.rvm/gems/ruby-2.0.0-p0/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in