configuration-files

Config file with a .py file

守給你的承諾、 提交于 2019-12-20 04:34:10
问题 I have been told that doing this would be a not-very-good practice: configfile.py SOUNDENABLED = 1 FILEPATH = 'D:\\TEMP\\hello.txt' main.py import configfile if configfile.SOUNDENABLED == 1: .... f = open(configfile.FILEPATH, 'a') ... This is confirmed by the fact that many people use INI files for local configuration with ConfigParser module or iniparse or other similar modules. Question: Why would using an INI file for local configuration + an INI parser Python module be better than just

How do I get value of variable from file using shell script?

▼魔方 西西 提交于 2019-12-19 10:17:04
问题 There is a file post_check.ini I need the value set for: Max_value=2 How would I get the value 2 from Max_value ? 回答1: try grep -Po '(?<=Max_value=).*' post_check.ini 回答2: Max_value=$(sed -n '/^Max_value=\([0-9]*\)$/s//\1/p' post_check.ini) 回答3: I recommend using crudini which is a dedicated tool to manipulate ini files from shell value=$(crudini --get /usr/post_check.ini section Max_value) Details on usage and download at: http://www.pixelbeat.org/programs/crudini/ 回答4: You might find it

Asp.Net VNext App Settings on Azure

ぐ巨炮叔叔 提交于 2019-12-19 10:16:37
问题 I really enjoyed the new Configuration feature of Asp.Net vNext using de default appsettings.json But I would like to change the values of that file when I publish the website as a Azure Web App. The old web.config appsettings was easy to change and configure the properties on the environment. Do you know how to do this? I prefer to user the default provider instead of creating a custom configuration provider. Thank you! 回答1: If you set App Settings in the Azure Portal, they become

How can i update app.config connectionstring Datasource value in C#?

喜夏-厌秋 提交于 2019-12-19 08:57:34
问题 Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.ConnectionStrings.ConnectionStrings["MyConnectionString",String.Format("DataSource={0};")].ConnectionString=textBox1.Text; config.Save(ConfigurationSaveMode.Modified, true); ConfigurationManager.RefreshSection("connectionStrings"); I'm having trouble at line two. I cant seem to get the syntax correct. As you can see, i only want to update the DataSource value only. For example, if current

Create app config file if doesn't exist C#

大城市里の小女人 提交于 2019-12-19 07:09:29
问题 When I try to open my app config file by ConfigurationManager.OpenExeConfiguration(filePath); it returns an exception, because there is no file. But I need to create this file in this case. But as I know, config file create by adding at VS like How to: Add an Application Configuration File to a C# Project So, how to create this file in other way? 回答1: If you really want to create an empty config file at runtime you can do something like this, but note that if the config file already exists

How to create global configuration file?

流过昼夜 提交于 2019-12-19 06:04:05
问题 Is there any possibility to create a configuration file with global variables that are visible inside the class? Something similar to this: config.php: $config['host_address'] = 'localhost'; $config['username '] = 'root'; $config['password'] = 'root'; $config['name'] = 'data'; db.php: include('config.php'); class DB { private $_config = array($config['host_address'], $config['username'], $config['password'], $config['name']); ... Current property: private $ _config = array(); I don't want to

Protractor: how to make the configuration file more flexible?

穿精又带淫゛_ 提交于 2019-12-19 03:51:43
问题 I have an idea to make my configs more flexible. For example I have 10000 config files with same parameters: seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['C:/Users/Lilia.Sapurina/Desktop/Protractor Tests/Scenarios/ps-grid-column-filter-range_spec.js'], params: {'url_filter': 'http://wks-15103:8010/ps/ng-components/examples/ps-grid-column-filter-range.html'} And once I want to change path to specs, html or change selenium address. Can I do this in another file for all my configs?

Protractor: how to make the configuration file more flexible?

痞子三分冷 提交于 2019-12-19 03:51:10
问题 I have an idea to make my configs more flexible. For example I have 10000 config files with same parameters: seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['C:/Users/Lilia.Sapurina/Desktop/Protractor Tests/Scenarios/ps-grid-column-filter-range_spec.js'], params: {'url_filter': 'http://wks-15103:8010/ps/ng-components/examples/ps-grid-column-filter-range.html'} And once I want to change path to specs, html or change selenium address. Can I do this in another file for all my configs?

What's the best practice for handling system-specific information under version control?

微笑、不失礼 提交于 2019-12-19 03:08:19
问题 I'm new to version control, so I apologize if there is a well-known solution to this. For this problem in particular, I'm using git, but I'm curious about how to deal with this for all version control systems. I'm developing a web application on a development server. I have defined the absolute path name to the web application (not the document root) in two places. On the production server, this path is different. I'm confused about how to deal with this. I could either: Reconfigure the

Storing application settings in C#

牧云@^-^@ 提交于 2019-12-18 21:50:31
问题 What is the best practice to store application settings (such as user name and password, database location ...) in C# ? Hint: I am new to .net and C# 回答1: Application Configuration Settings that are application wide (non-user specific) belong in either app.config (for Desktop apps) or web.config (for Web apps). Encrypting sections of a web.config file is quite simple as outlined in this Super Simple Example. If you need to store User specific settings (like application settings, etc.) or