小编Mat*_*att的帖子

AppSettings从.config文件中获取值

我无法访问配置文件中的值.

Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
var clientsFilePath = config.AppSettings.Settings["ClientsFilePath"].Value; 
// the second line gets a NullReferenceException
Run Code Online (Sandbox Code Playgroud)

.config文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <!-- ... -->
    <add key="ClientsFilePath" value="filepath"/>
    <!-- ... -->
  </appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)

你有什么建议我该怎么办?

.net c# configurationmanager appsettings

163
推荐指数
6
解决办法
49万
查看次数

VS代码 - 在活动栏中切换搜索图标

我不小心删除了活动栏中的搜索图标,不知道如何再次添加它.如果我单击活动栏,我不再看到此选项.

截图

visual-studio-code vscode-settings

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

Webpack-dev-server不生成源映射

我使用babel-loader,但无法弄清楚如何生成或找到转换文件的源映射.我试过eval-source-map,inline-source-map,source-map.

webpack.config.js

const BowerWebpackPlugin = require("bower-webpack-plugin");

module.exports = {
    entry: './src/script/index.jsx',
    output: {
        filename: 'bundle.js',
        sourceMapFilename: "bundle.js.map",
        publicPath: 'http://localhost:8090/assets'
    },
    debug: true,
    devtool: 'inline-source-map',
    module: {
        loaders: [
            {   
                test: /\.js[x]?$/, 
                loaders: ['react-hot', 'jsx', 'babel'],
                exclude: /node_modules/ 
              },
              {
                test: /\.scss$/,
                loaders: [ 'style', 'css?sourceMap', 'sass?sourceMap' ]
              },
              {
                test: /\.less$/,
                loaders: [ 'style', 'css?sourceMap', 'less?sourceMap' ]
              },
              {
                test: /\.css$/,
                loaders: [ 'style', 'css']
              },
              { test: /\.woff$/,   loader: "url-loader?limit=10000&mimetype=application/font-woff" }, …
Run Code Online (Sandbox Code Playgroud)

webpack webpack-dev-server

46
推荐指数
3
解决办法
3万
查看次数

React Native带边框的圆角图像

我想创建一个带边框的圆角图像.如果我添加borderColor: 'green', borderWidth:1,边框仅在圆角图像的左上角可见.

在此输入图像描述

<TouchableHighlight
          style={[styles.profileImgContainer, { borderColor: 'green', borderWidth:1 }]}
        >
    <Image source={{ uri:"https://www.t-nation.com/system/publishing/articles/10005529/original/6-Reasons-You-Should-Never-Open-a-Gym.png" }} style={styles.profileImg} />
</TouchableHighlight>

export default styles = StyleSheet.create({
  profileImgContainer: {
    marginLeft: 8,
    height: 80,
    width: 80,
    borderRadius: 40,
  },
  profileImg: {
    height: 80,
    width: 80,
    borderRadius: 40,
  },
});
Run Code Online (Sandbox Code Playgroud)

react-native

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

historyApiFallback在Webpack dev服务器中不起作用

在React Router中使用Webpack dev服务器和browserHistory来通过HTML5 History API操作url.historyapifallback-option在我的webpack配置文件中不起作用.刷新后http://localhost:8080/usershttp://localhost:8080/products我得到404.

webpack.config.js

var webpack = require('webpack');
var merge = require('webpack-merge');

const TARGET = process.env.npm_lifecycle_event;

var common = {
    cache: true,
    debug: true,
    entry: './src/script/index.jsx',
    resolve: {
        extensions: ['', '.js', '.jsx']
    },
    output: {
        sourceMapFilename: '[file].map'
    },
    module: {
        loaders: [
            {
                test: /\.js[x]?$/,
                loader: 'babel-loader',
                exclude: /(node_modules)/
            }
        ]
    },
    plugins: [
        new webpack.ProvidePlugin({
            $: "jquery",
            jQuery: "jquery"
        })
    ]
};

if(TARGET === 'dev' || !TARGET) …
Run Code Online (Sandbox Code Playgroud)

javascript html5-history webpack react-router webpack-dev-server

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

解析错误:找不到模块“@babel/preset-react”

我有一个反应项目。在我导入 React 的每个 .js 文件的第一行中,我收到此错误:Parsing error: Cannot find module '@babel/preset-react'

包.json

{
    "name": "admin",
    "version": "2.0.0",
    "description": "",
    "author": "",
    "main": "index.js",
    "engines": {
        "node": ">=14.15 <15",
        "npm": "~6"
    },
    "scripts": {
        "build-config:local": "CONFIG_ENV=local npm run build-config",
        "build-config:dev": "CONFIG_ENV=dev npm run build-config",
        "build-config:staging": "CONFIG_ENV=staging npm run build-config",
        "build-config:prod": "CONFIG_ENV=prod npm run build-config",
        "build-config": "buildconfig --env $CONFIG_ENV",
        "build": "npm run build-config && webpack --config ./webpack.config.js --mode production",
        "start": "webpack-dev-server --config ./webpack.config.dev.js --mode development"
    },
    "dependencies": {
        "@babel/eslint-parser": "^7.15.7",
        "@fortawesome/fontawesome-svg-core": …
Run Code Online (Sandbox Code Playgroud)

reactjs eslint babeljs babel-loader eslintrc

21
推荐指数
3
解决办法
4万
查看次数

React + Redux - 未捕获错误:期望reducer成为一个函数

我尝试了简单的react,redux,ajax工作示例并遵循Reddit API教程,但我无法创建存储并获取错误:

Uncaught Error: Expected the reducer to be a function.
Run Code Online (Sandbox Code Playgroud)

index.jsx

...

import { createStore, applyMiddleware } from 'redux'
var thunkMiddleware = require('redux-thunk');
var createLogger = require('redux-logger');
var rootReducer = require('./reducers.js');

        const loggerMiddleware = createLogger();

        function configureStore(initialState) {
            return createStore(
                rootReducer,
                initialState,
                applyMiddleware(
                    thunkMiddleware,
                    loggerMiddleware
                )
            )
        }

        const store = configureStore();
Run Code Online (Sandbox Code Playgroud)

...

rootReducer.js

import { combineReducers } from 'redux';

function products(state = {
    isFetching: false,
    didInvalidate: false,
    items: []
}, action) {
    switch (action.type) {
        case …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs redux

18
推荐指数
3
解决办法
3万
查看次数

"模糊测试"和"猴子测试"之间的区别

我最近一直在考虑模糊测试和猴子测试之间的区别.根据wiki,似乎猴子测试"仅"是一个单元测试,而模糊测试则不是.Android有UI/Application Exerciser猴子,它似乎不像单元测试.

这些测试方法有什么区别吗?

testing monkey-testing fuzz-testing

13
推荐指数
1
解决办法
2894
查看次数

使用带有jQuery UI的bootstrap-slider

我想在jQuery UI中使用bootrap-slider.我在加载Bootstrap CSS和jQuery后遵循文档并加载了插件代码.

但是,滑块未初始化 - <input>保持原样,我在浏览器控制台中看不到任何错误.

以下是代码:

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" media="all" />   
        <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.js" type="text/javascript"></script>
        <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script> 

        <link rel="stylesheet" type="text/css" href="./slider/bootstrap-slider.css" media="all" />
        <script src="./slider/bootstrap-slider.js"></script>

    </head>

    <body>
            <input id="ex1" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14"/>

    <script type="text/javascript">

    // With JQuery
    $('#ex1').slider({
      formatter: function(value) {
        return 'Current value: ' + value;
      }
    });

        </script>

    </body>
Run Code Online (Sandbox Code Playgroud)

你能告诉我有什么问题吗?

javascript jquery jquery-ui twitter-bootstrap bootstrap-slider

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

摩卡单元测试Firebase应用程序

我使用firebase 3.3.0并且我想在我的mocha单元测试中使用signInWithEmailAndPassword函数,但是我得到错误auth/network-request-failed

Unhandled rejection Error: A network error (such as timeout, interrupted connection or unreachable host) has occurred. 
Run Code Online (Sandbox Code Playgroud)

test.js

const FIREBASE_CONFIG = {
    apiKey: "AIzaSyDdA1POUWy9eid1AdBYuMdxch_k8ob7Qrg",
    authDomain: "my-app.firebaseapp.com",
    databaseURL: "https://my-app.firebaseio.com",
    storageBucket: "my-app.appspot.com",
};

const FIREBASE_API_REF = firebase.initializeApp(FIREBASE_CONFIG);

before(function (done) {

        promise = new Promise(function (resolve, reject) {
            return FIREBASE_API_REF.auth().signInWithEmailAndPassword(firstUserEmail, firstUserPassword)
            .then(function (userData) {
                firstUserId = userData.uid;
                resolve(userData);
                done();
            }, function (error) {
                return reject(error);
            })
        });

    });
Run Code Online (Sandbox Code Playgroud)

的package.json

"scripts": {
    "test": "mocha --grep ./e2e.js --invert --compilers js:babel-register -R …
Run Code Online (Sandbox Code Playgroud)

javascript mocha.js firebase firebase-authentication

13
推荐指数
1
解决办法
1631
查看次数