小编Alf*_*Osa的帖子

如何使IntelliJ IDEA解析webpack需要在node_modules目录之外?

IntelliJ无法解析使用webpack要求的javascript模块,这些模块不在node_modules目录中

想象一下这个项目结构:

`- project
   |- node_modules
   |  `- react
   |     `- addons.js
   |- webpack.config.js
   |- util
   |  `- tool.js
   `- src
      |- components
      |  `- uno.jsx
      `- two.jsx
Run Code Online (Sandbox Code Playgroud)

这是我的webpack配置

// webpack.config.js
var path = require('path'); 
module.exports = {
  resolve: {
    root: [
      path.resolve('./src'),
      path.resolve('./')
    ]
  }
  ...
}
Run Code Online (Sandbox Code Playgroud)

这就是我使用webpack的要求

// two.js
var React = require('react/addons');
var One = require('components/one');
var Tool = require('util/tool');
// dosomething
Run Code Online (Sandbox Code Playgroud)

因此,这在我的应用程序中完美运行,IntelliJ看起来很满意'react/addons',如何理解导航,代码完成和'components/one'和'util/tool'的文档查找源代码?

我到目前为止尝试过:

但到目前为止没有运气.谢谢.

javascript intellij-idea reactjs webpack react-jsx

18
推荐指数
1
解决办法
8653
查看次数

音乐与数学.寻找自然尺度发生器.最好的方法?

我写了这篇文章 音乐和数学,找到了自然和五声音阶.

我想找到最好的程序化方法.解决方案可能是:

<script>
  function getScaleIntervals(c) {
    var tot = 0;
    var scale = [];

    while(tot <= 12){
      scale.push(Math.round(tot));
      tot += c;
    }
    return scale;
  }
  var natural_scale = getScaleIntervals(12/7);
  document.write(natural_scale + " \n"); // ==> 0, 2, 3, 5, 7, 9, 10, 12

  var pentatonic_scale = getScaleIntervals(12/5);
  document.write(pentatonic_scale + " \n"); // ==> 0, 2, 5, 7, 10, 12
</script>
Run Code Online (Sandbox Code Playgroud)

结果区间以D(Re)开始于0,因此您有DEFGABCD这是Dorian模式

javascript math

8
推荐指数
1
解决办法
1760
查看次数

在Python中动态调用函数的方法是什么?

我想做的事情如下:

dct = ['do_this', 'do_that']
dct[0]() // call do_this
Run Code Online (Sandbox Code Playgroud)

但是你不能将字符串作为函数调用(会出错).

我怎样才能做到这一点,而无需切换,并且不使用lambda表达式或功能的列表?

显然我想按名称引用函数.

python

4
推荐指数
2
解决办法
5579
查看次数

致命错误:registerContainerConfiguration的声明必须与Kernel :: registerContainerConfiguration的声明兼容

有人知道为什么会这样吗?

就我所知,子类方法的声明方式与父类相同.

谢谢!

这是我的内核代码:

<?php

require_once __DIR__.'/../src/autoload.php';

use Symfony\Framework\Kernel;
use Symfony\Components\DependencyInjection\Loader\YamlFileLoader as ContainerLoader;
use Symfony\Components\Routing\Loader\YamlFileLoader as RoutingLoader;

use Symfony\Framework\KernelBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\ZendBundle\ZendBundle;
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
use Symfony\Bundle\DoctrineBundle\DoctrineBundle;
use Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle;
use Symfony\Bundle\DoctrineMongoDBBundle\DoctrineMongoDBBundle;
use Symfony\Bundle\PropelBundle\PropelBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Application\UfaraBundle\UfaraBundle;



class UfaraKernel extends Kernel {
    public function registerRootDir() {
        return __DIR__;
    }

    public function registerBundles() {
        $bundles = array(
                new KernelBundle(),
                new FrameworkBundle(),
                new ZendBundle(),
                new SwiftmailerBundle(),
                new DoctrineBundle(),
                //new DoctrineMigrationsBundle(),
                //new DoctrineMongoDBBundle(),
                //new PropelBundle(),
                //new TwigBundle(),
                new UfaraBundle(),
        );

        if ($this->isDebug()) { …
Run Code Online (Sandbox Code Playgroud)

php dependency-injection symfony

2
推荐指数
1
解决办法
5814
查看次数