configuration-files

Could string comparisons really differ based on culture when the string is guaranteed not to change?

大城市里の小女人 提交于 2019-11-27 11:25:33
问题 I'm reading encrypted credentials/connection strings from a config file. Resharper tells me, "String.IndexOf(string) is culture-specific here" on this line: if (line.Contains("host=")) { _host = line.Substring(line.IndexOf( "host=") + "host=".Length, line.Length - "host=".Length); ...and so wants to change it to: if (line.Contains("host=")) { _host = line.Substring(line.IndexOf("host=", System.StringComparison.Ordinal) + "host=".Length, line.Length - "host=".Length); The value I'm reading

PHP - Application config file stored as - ini,php,sql,cached,php class,JSON,php array?

风流意气都作罢 提交于 2019-11-27 11:12:41
问题 I am trying to decide on the best way to store my applications configuration settings. There are so many options. The majority of applications I have seen have used a simple require and a PHP file that contains variables. There seem to be far more advanced techniques out there. What have you used? What is most efficient? What is most secure? 回答1: The best thing you can do is the simplest thing that could possibly work (php variables) and wrap it up in a class. That way you can change the

Correct implementation of a custom config section with nested collections?

不问归期 提交于 2019-11-27 11:02:00
In a web application, I want to be able to define some mapping using a config section like this: <configuration> <configSections> <sectionGroup name="MyCustomer"> <section name="CatalogMappings" type="MyCustom.MyConfigSection" /> </sectionGroup> </configSections> <MyCustomer> <catalogMappings> <catalog name="toto"> <mapping value="1" displayText="titi" /> <mapping value="2" displayText="tata" /> </catalog> <catalog name="toto2"> <mapping value="1" displayText="titi2" /> <mapping value="2" displayText="tata2" /> </catalog> </catalogMappings> </MyCustomer> </configuration> I'm struggling to

Android Config File

半腔热情 提交于 2019-11-27 09:45:57
问题 What is the best way and how to set up a config file for a application? I want the application to be able to look into a text file on the sd card and pick out certain information that it requires ? 回答1: You can achieve this using shared preferences There is a very detailed guide on how to use Shared Preferences on the Google Android page https://developer.android.com/guide/topics/data/data-storage.html#pref 回答2: If your application is going to be released to the public and if you have

How to handle configuration in Go [closed]

老子叫甜甜 提交于 2019-11-27 08:56:12
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I'm new at Go programming, and I'm wondering: what is the preferred way to handle configuration parameters for a Go program (the kind of stuff one might use properties files or ini files for, in other contexts)? 回答1: The JSON format worked for me quite well. The standard library

How to enable configSource attribute for Custom Configuration Section in .NET?

我的未来我决定 提交于 2019-11-27 08:50:12
following the wealth of information found here how can we get an external .config to work? I've tried the same setup I would use for an external appSettings file, but it is unable to find the file for my custom section. <configSections> ... <section name="CustomSettings" type="Fully.Qualified.TypeName.CustomSettings, AssemblyName" /> </configSections> <!-- this works --> <CustomSettings attrib1="val1" attrib2="val2" .../> however... <!--this does not work--> <CustomSettings configSource="someExternalFile.config"/> where someExternalFile.config would contain <CustomSettings attrib1="val1"

Changing App.config at Runtime

风流意气都作罢 提交于 2019-11-27 08:30:30
I'm writing a test WinForms / C# / .NET 3.5 application for the system we're developing and we fell in the need to switch between .config files at runtime, but this is turning out to be a nightmare. Here's the scene: the WinForms application is aimed at testing a WebApp, divided into 5 subsystems. The test process works with messages being sent between the subsystems, and for this process to be successful each subsystem got to have its own .config file. For my Test Application I wrote 5 separate configuration files. I wish I was able to switch between these 5 files during runtime, but the

Where is the user's Subversion config file stored on the major operating systems?

血红的双手。 提交于 2019-11-27 07:21:18
For Subversion 1.7, where is the SVN "config" file located on the various major operating systems (specifically on Windows, Mac OS X and Linux)? Baxter ~/.subversion/config or /etc/subversion/config for Mac/Linux and %appdata%\subversion\config for Windows gmhk In windows 7, 8, and 10 you can find at the following location C:\Users\<user>\AppData\Roaming\Subversion If you enter the following in the Windows Explorer address bar, it will take you right there. %appdata%\Subversion Not sure about Win but n *nix (OS X, Linux, etc.) its in ~/.subversion 来源: https://stackoverflow.com/questions

Modify config file using bash script

喜你入骨 提交于 2019-11-27 06:29:46
I'm writing a bash script to modify a config file which contains a bunch of key/value pairs. How can I read the key and find the value and possibly modify it? Cascabel A wild stab in the dark for modifying a single value: sed -c -i "s/\($TARGET_KEY *= *\).*/\1$REPLACEMENT_VALUE/" $CONFIG_FILE assuming that the target key and replacement value don't contain any special regex characters, and that your key-value separator is "=". Note, the -c option is system dependent and you may need to omit it for sed to execute. For other tips on how to do similar replacements (e.g., when the REPLACEMENT

Creating a config file in PHP

≡放荡痞女 提交于 2019-11-27 06:04:38
I want to create a config file for my PHP project, but I'm not sure what the best way to do this is. I have 3 ideas so far. 1-Use Variable $config['hostname'] = "localhost"; $config['dbuser'] = "dbuser"; $config['dbpassword'] = "dbpassword"; $config['dbname'] = "dbname"; $config['sitetitle'] = "sitetitle"; 2-Use Const define('DB_NAME', 'test'); define('DB_USER', 'root'); define('DB_PASSWORD', ''); define('DB_HOST', 'localhost'); define('TITLE', 'sitetitle'); 3-Use Database I will be using the config in classes so I'm not sure which way would be the best or if there is a better way. One simple