require

Does Parallel.ForEach require AsParallel()

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: ParallelEnumerable has a static member AsParallel . If I have an IEnumerable<T> and want to use Parallel.ForEach does that imply that I should always be using AsParallel ? e.g. Are both of these correct (everything else being equal)? without AsParallel : List<string> list = new List<string>(); Parallel.ForEach<string>(GetFileList().Where(file => reader.Match(file)), f => list.Add(f)); or with AsParallel ? List<string> list = new List<string>(); Parallel.ForEach<string>(GetFileList().Where(file => reader.Match(file)).AsParallel(), f => list

Browserify require returns an empty object

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have this code which, for reasons I can't understand, produces an empty object when using require() . My file structure is like this: src | __ public | __ javascript | __ collections | categories . js | listings . js <-- Always an empty object | __ models | category . js | employer . js | listing . js | location . js | routing | templates | tests | ui - components | views The problem file is collections/listings.js , which seems to simply output as an empty object when required like so: var ListingsCollection = require('..

Stubbing jQuery.ajax in node environment (jQuery 2.x)

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to run some tests that require stubbing jQuery.ajax . I'm using SinonJS to do that and it used to work fine with older version of jQuery (1.x) var $ = require('jquery'); var sinon = require("sinon"); sinon.stub($, "ajax"); // this worked because $.ajax is defined However, after upgrading to jQuery 2.x, I have had to include a window environment when I require jquery from my module for it to run. I am using jsdom to accomplish this: var document = require('jsdom').jsdom(), window = document.parentWindow, $ = require('jquery')

Cannot find name &#039;require&#039; after upgrading to Angular4

匿名 (未验证) 提交于 2019-12-03 08:30:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to use Chart.js within my Angular project. In previous Angular2 versions, I have been doing this well by using a 'chart.loader.ts' which has: export const { Chart } = require('chart.js'); Then in the component code I just import { Chart } from './chart.loader'; But after upgrading to cli 1.0.0 and Angular 4, I get the error: "Cannot find name 'require'". To reproduce the error: ng new newapp cd newapp npm install chart.js --save echo "export const { Chart } = require('chart.js');" >> src/app/chart.loader.ts ng serve In my 'tsconfig

R: rCharts and Shiny, charts won&#039;t show up when I run it

匿名 (未验证) 提交于 2019-12-03 08:28:06
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This seems like an ongoing question. I saw this posted a few times, I tried all the different solutions people offered. But nothing works for me. My chart won't show up when I run it :( Here is my ui.R ## ui.R require('rCharts') require('shiny') require("quantmod") require("TTR") require("stringr") require('lubridate') options(RCHART_LIB = 'polycharts') shinyUI(pageWithSidebar( headerPanel('test'), sidebarPanel(p('test') ), mainPanel( showOutput('graph',lib='polycharts') ) )) and here is my server.R #Dependencies require('rCharts') require(

Sea.js 手册与文档

北战南征 提交于 2019-12-03 08:27:13
Sea.js 手册与文档 首页 | 索引 目录 何为 CommonJS 何为 CommonJS 模块 为何封装模块 何为 CommonJS? CommonJS 是一个有志于构建 JavaScript 生态圈的组织。它有一个 邮件列表 ,有很多开发者参与其中。 整个社区致力于提高 JavaScript 程序的可移植性和可交换性,无论是在服务端还是浏览器端。 何为 CommonJS 模块? JavaScript 并没有内置模块系统(反正现在没有),于是 CommonJS 创造了自己的。 传统的 CommonJS 模块如下: math.js: exports.add = function() { var sum = 0, i = 0, args = arguments, l = args.length; while (i < l) { sum += args[i++]; } return sum; }; increment.js: var add = require('math').add; exports.increment = function(val) { return add(val, 1); }; program.js: var inc = require('increment').increment; var a = 1; inc(a); // 2 为何封装模块?

RequireJs dependency always undefined

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using require Js and am getting rather confused as to why my modules are loading but dependencies are always undefined and even upon using require.defined() function to check if my module has been loaded it indeed has been but when i use the require([deps],function(deps){}); all of my dependencies are undefined (except for jquery ,underscore and knockout) my file structure is as follows my file structure is as follows scripts | | main.js | |_________BusinessScripts | | | | jquery.js | | | | boostrapper.js-undefined ko.js | | dataservice

How to properly require modules from mocha.opts file

不羁的心 提交于 2019-12-03 07:36:58
问题 I'm using the expect.js library with my mocha unit tests. Currently, I'm requiring the library on the first line of each file, like this: var expect = require('expect.js'); describe('something', function () { it('should pass', function () { expect(true).to.be(true); // works }); }); If possible, I'd like to remove the boilerplate require code from the first line of each file , and have my unit tests magically know about expect . I thought I might be able to do this using the mocha.opts file:

Delete links stopped working data-method=&#039;delete&#039; but goes to show page

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I just noticed that all the various delete links in my application now just go to show pages. This application began as rails 2.3.8, it is now rails 3.2.17 Examples of the rails code: Controllers, def destroy @group = Group.find(params[:id]) @group.destroy respond_to do |format| format.html { redirect_to(groups_url) } format.xml { head :ok } end end And, def destroy @link = Link.find(params[:id]) @link.destroy respond_to do |format| format.html { redirect_to(links_url) } end end Which generates: HTML, <a rel="nofollow" data-method="delete"

Activated Ruby RAKE 10.0.1, require 10.0.0

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I get this error when i try to run "rake test": avery@ubuntu:~/rails_projects/depot$ rake test rake aborted! You have already activated rake 10.0.1, but your Gemfile requires rake 10.0.0. Using bundle exec may solve this. /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:31:in `block in setup' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:17:in `setup' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler.rb:116:in `setup' /home/avery/.rvm/gems/ruby-1.9.3-p327