configuration-files

How to read a configuration file in Java

允我心安 提交于 2019-11-27 20:15:58
问题 I am doing a project to build thread pooled web server , in which I have to set the port number on which server listens. How many threads are there in thread pool Absolute Path of the root directory, and so many points. One way is to hard code all these variables in the code, that I did. But professionally it is not good. Now, I want to make one configuration file, in which I put all these data, and at the run time my code fetches these. How can I make configuration file for the above task ?

Is it .yaml or .yml?

六月ゝ 毕业季﹏ 提交于 2019-11-27 19:44:37
问题 According to yaml.org, the official file extension is .yaml . Quote: Is there an official extension for YAML files? Please use ".yaml" when possible. However there seems to be a disagreement on the internet on which extension to use. If you look up examples on the web, many of them use the unsanctioned .yml extension. Searching Google returns nearly 3 times as many results for the shorter one. 49,100 15,400 So which am I supposed to use? The proper 4 letter extension suggested by the creator,

Options for wiring dependencies with NInject

最后都变了- 提交于 2019-11-27 19:25:10
问题 With NInject (preferably 2.0), what options do we have wrt wiring up our object dependencies in a web application? Can they be defined in an XML configuration file? Or does it have to be done via code? 回答1: Ninject doesn't have XML configuration, sorry but I can't provide a direct link (cos their site has flash elements), but here is a quotation from ninject.org: Free yourself from XML Most other .NET dependency injection frameworks are designed around the use of XML to declare type bindings.

Read all the contents in ini file into dictionary with Python

折月煮酒 提交于 2019-11-27 18:49:27
Normally, I code as follows for getting a particular item in a variable as follows try: config = ConfigParser.ConfigParser() config.read(self.iniPathName) except ConfigParser.MissingSectionHeaderError, e: raise WrongIniFormatError(`e`) try: self.makeDB = config.get("DB","makeDB") except ConfigParser.NoOptionError: self.makeDB = 0 Is there any way to read all the contents in a python dictionary? For example [A] x=1 y=2 z=3 [B] x=1 y=2 z=3 is written into val["A"]["x"] = 1 ... val["B"]["z"] = 3 I suggest subclassing ConfigParser.ConfigParser (or SafeConfigParser , &c) to safely access the

What is the best way to store configuration variables in PHP?

痴心易碎 提交于 2019-11-27 18:47:49
I need to store a bunch of configuration information in PHP. I have considered the following.... // Doesn't seem right. $mysqlPass = 'password'; // Seems slightly better. $config = array( 'mysql_pass' => 'password' ); // Seems dangerous having this data accessible by anything. but it can't be // changed via this method. define('MYSQL_PASSWORD', 'password'); // Don't know if this is such a good idea. class Config { const static MYSQL_PASSWORD = 'password'; } This is all I have thought of so far. I intend to import this configuration information into my application with require /config.inc.php .

Registry vs. INI file for storing user configurable application settings

风格不统一 提交于 2019-11-27 18:42:00
I'm a new Windows programmer and I'm not sure where I should store user configurable application settings. I understand the need to provide a user friendly means for the user to change application settings, like an Edit | Settings form or similar. But where should I store the values after the user hits the Apply button on that form? What are the pros and cons of storing settings in the Windows registry vs. storing them in a local INI file or config file or similar? Pros of config file: Easy to do. Don't need to know any Windows API calls. You just need to know the file I/O interface of your

PowerShell App.Config

懵懂的女人 提交于 2019-11-27 18:33:27
Has anyone worked out how to get PowerShell to use app.config files? I have a couple of .NET DLL's I'd like to use in one of my scripts but they expect their own config sections to be present in app.config / web.config . millerjs Cross-referencing with this thread, which helped me with the same question: Subsonic Access To App.Config Connection Strings From Referenced DLL in Powershell Script I added the following to my script, before invoking the DLL that needs config settings, where $configpath is the location of the file I want to load: [appdomain]::CurrentDomain.SetData("APP_CONFIG_FILE",

Adding and reading from a Config file

二次信任 提交于 2019-11-27 17:23:22
I have created a C# console based project . In that project i have some variables like companyName , companyType which are Strings. companyName="someCompanyName"; companyType="someCompanyType"; I need to create a config file and read values from it, and then initialize the variables companyName , companyType in the code. How can i create a config file (or equivalent) ? How can i read from the config file ? goric Add an Application Configuration File item to your project (right click project > add item). This will create a file called app.config in your project. Edit the file by adding entries

iOS - Prevent iPhone Configuration Profile from being deleted OR check to see if it's installed

£可爱£侵袭症+ 提交于 2019-11-27 16:51:30
问题 I'm working on an iOS enterprise app that relies on an Configuration Profile being put on the phone. Unfortunately, the user can "cancel" this profile, which really screws with our app. So I was wondering if a) is it possible to prevent a configuration profile from being deleted OR b) is there a way to check to see if a configuration profile is installed already (say, at runtime, then we can just install it again if it's not there)? 回答1: If you want the configuration profile not to be

How to make the Visual Studio compiler ignore a file?

混江龙づ霸主 提交于 2019-11-27 16:22:26
问题 Is anyone aware of a way to make visual studio completely ignore a file when compiling? I have a C# solution that has a foo.config file that isn't really a standard config file - it's just a text file. During compiling VS grabs a hold of the file and bombs. I'd like for it to act as though it's just a text file. I do not have the option of changing the name of the file. EDIT: Please note that BuildAction does not exclude files from the compiler checking them. It simply decides if the file is