标签: configuration-files

在 web.config 中指定配置源时如何为 SqlDataSource 设置 ConnectionString

我希望能够快速创建一些没有代码隐藏文件的简单 ASP.NET 报告。每个报表都是一个 aspx 文件,其中可能有多个 SqlDataSource 控件。我希望能够使用 <%$ ConnectionStrings:MyTag %> 语法来设置连接字符串,但是,我们使用的应用程序在单独的配置文件中具有实际的连接字符串,该文件在 web.config 中使用configSource="App_Data\database.config"。

在后面的代码中,我可以使用以下方法以编程方式访问 ConnectionString:ConfigurationManager.ConnectionStrings["AbleCommerce"].ConnectionString

但是我们如何在不使用后面的代码的情况下设置连接字符串呢?

asp.net configuration-files

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

有没有可以在 Linux 上轻松解析配置文件的工具?

我需要一个工具来解析配置文件并从中请求一些数据。

配置文件的格式是自由的(可以是INI、XML等),但越人性化越好。

这是一个示例配置文件(使用 XML,但它可以是任何内容:我不介意格式):

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
  <name>Some name</name>
  <description>Some description</description>
</configuration>
Run Code Online (Sandbox Code Playgroud)

工具的用法应该是这样的:

[ereOn@server ~]$ the_tool config.xml "string(/configuration/name)"
Some name
[ereOn@server ~]$ the_tool config.xml "string(/configuration/description)"
Some description
Run Code Online (Sandbox Code Playgroud)

你知道有什么 Linux 工具可以做到这一点吗?

linux parsing redhat configuration-files

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

如何使用distribute python安装特定于用户的配置文件

我正在创建一个python包,并使用distribute将其打包为egg.我想为我的软件的每个用户安装一个用户可编辑的配置文件.完成此任务的最佳方法是什么?我使用的是Python 2.6,目标是Windows平台.

python configuration-files distribute

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

Pylint中的永久配置文件

我为Pylint设置了一个自定义配置文件(名称,方便,配置).必须有一种方法,我不必包括--rcfile=config在每次运行.如何永久设置配置文件?

macos pylint configuration-files

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

在 PHP 应用程序中获取配置变量的最佳方式(编码方式)是什么

我一直在搜索和阅读很多关于如何在 PHP 环境中获取应用程序配置变量的最佳方式(代码方面)。在那之后,我总结了两种更常用的管理配置文件和变量的方法。

但我对此有点困惑,方法 1使用的是静态类。另一种方法 2是使用可实例化的类

第一个比第二个更糟糕的单元测试。它类似于全局变量。不是吗?

第二个需要一个全局变量才能使用实例化对象。

我会试着解释自己。

事实: - 应用程序的设置保存在 INI 文件中。- 这个 INI 文件有部分,以维护配置变量。- 我只有一个 INI 文件。- 类做一些配置文件的验证。- 下面的代码示例不完整,它只是一个示例来说明我的问题。

方法一:使用静态类

此方法使用Config 静态类,它使用静态因为在所有应用程序中只会使用一个Config对象。

代码示例:

class Config
{
    static private $data;

    static public function load($configFile) {
        self::$data = parse_ini_file($configFile, true, INI_SCANNER_RAW)
    }

    static public get($key) {
         // code stuff to deal with sections and keys, but basically
         return self::$data[$key];
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的应用程序中,我使用以下代码创建了一次静态对象:

\Config::load('/where/is/my/ini/file.ini');
Run Code Online (Sandbox Code Playgroud)

在这种情况下,每次我想获得一个值时,我都会使用:

$host = \Config::get('database.host'); …
Run Code Online (Sandbox Code Playgroud)

php config class configuration-files

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

如何永久启用Vim帮助的行号

我想在vim中永久显示行号,不仅适用于常规文本类型文件,也适用于帮助文件.

添加set number到vim(~/.vimrc)的主配置文件中,如vim行号中所示 - 默认情况下如何启用它们?,对我的帮助文件没有任何影响.

那么我在哪里应用适当的配置更改?

vim configuration-files line-numbers vim-plugin

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

Postgres Docker 持久化

我刚开始使用码头工人,但我不明白一些事情。我只是使用 docker-compose 来使用 PostgreSQL 的基本映像,但我不知道如何在杀死 docker 甚至删除我的本地映像后使数据库中的数据持久化。这有可能吗?

这是我实际的 docker-compose.yml:

version: "3"
services: 
  pintaecolorea_bd:
    image: postgres
    environment:
      POSTGRES_PASSWORD: <PASSWORD>
      POSTGRES_USER: postgres
    ports: 
      - "1234:5432"
    networks: 
      - "service"
networks:
  service:
Run Code Online (Sandbox Code Playgroud)

也许我应该使用卷?如何?

postgresql persistence configuration-files docker docker-compose

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

在 Visual Studio 代码中有不同的选项卡大小

我正在使用 Visual Studio 代码来编程 cobol。但是,我希望能够为第一个和第二个选项卡设置不同的选项卡大小,然后将大小更改为 3 个空格。但是我不知道如何设置它。这就是我希望它设置的方式。

first tab = 7 spaces.
2nd tab = 1 space.
3th tab = 4 spaces.
4th and ongoing = 3 spaces.
Run Code Online (Sandbox Code Playgroud)

我找到了如何为我的所有选项卡将其设置为 3 个空格。这些是我目前的自我设置。

{
    "editor.tabSize": 3,
    "editor.detectIndentation": false,
    // Insert spaces when pressing Tab. This setting is overriden
    // based on the file contents when `editor.detectIndentation` is true.
    "editor.insertSpaces": true
}
Run Code Online (Sandbox Code Playgroud)

configuration-files visual-studio-code

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

如何在 Spring Boot 应用程序中使用命令行参数读取自定义属性文件

在启动我的 Spring Boot 应用程序时,我想使用命令行参数设置自定义配置文件路径,例如:

java -jar some.jar -DConfigPath=conf/config.local(or conf/config.prod) 
Run Code Online (Sandbox Code Playgroud)

那么如何读取这个文件来生成一个spring配置呢?我可以@PropertySource以某种“动态”方式使用注释吗?

spring configuration-files spring-boot

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

按配置文件使用 yaml 属性进行 Spring Boot 测试

所以在这个话题上有很多点击,但没有一个对我有用。

我有一个非常简单的配置类:

@Configuration
@ConfigurationProperties(prefix = "props")
public class TagIncluder {

    private static final String PARAMETER_NAME = "tags";

    private List<String> tags;

    public TagIncluder() {
        tags = new ArrayList<>();
    }

    public List<String> getTags() {
        return tags;
    }

    @Handler
    public void attachIncludedTags(Exchange exchange) {
        exchange.getIn().setHeader(PARAMETER_NAME, tags);
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望这个类能够加载不同的属性文件。我正在使用 yaml,我的文件名为application-tag_test.yml. 我曾尝试将此文件放在src/main/resources,src/test/resources和 中src/test/resources/config,但从未被提取。

这是属性文件的内容:

props:
  tags:
    - test 
Run Code Online (Sandbox Code Playgroud)

最后,测试用例:

@SpringBootTest
@ActiveProfiles("tag_test")
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = TagIncluder.class)
public class TagIncluderTest extends ExchangeTestSupport {

    @Autowired
    private TagIncluder sut;

    @Test …
Run Code Online (Sandbox Code Playgroud)

java spring configuration-files

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