configuration-files

Options for wiring dependencies with NInject

筅森魡賤 提交于 2019-11-28 12:24:53
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? 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. Rather than forcing you to write cumbersome and error-prone text, Ninject arms you with a fluent interface

Azure configuration settings and Microsoft.WindowsAzure.CloudConfigurationManager

霸气de小男生 提交于 2019-11-28 12:01:58
Apparently Microsoft.WindowsAzure.CloudConfigurationManager.GetSettings will start by looking in ServiceConfiguration.*.cscfg and then fall back to web.config and app.config. But - what format should this be in web/app .config? E.g. to get Microsoft.WindowsAzure.CloudConfigurationManager.GetSettings("Foo") to pick up from app.config what would the XML look like? It will just be an appSettings key/value . <configuration> <appSettings> <add key="Foo" value="AzureSetting"/> </appSettings> </configuration> You will need to add the settings to the ServiceDefinition.csdef and ServiceConfiguration

Reading Java Properties file without escaping values

a 夏天 提交于 2019-11-28 10:46:57
My application needs to use a .properties file for configuration. In the properties files, users are allow to specify paths. Problem Properties files need values to be escaped, eg dir = c:\\mydir Needed I need some way to accept a properties file where the values are not escaped, so that the users can specify: dir = c:\mydir Why not simply extend the properties class to incorporate stripping of double forward slashes. A good feature of this will be that through the rest of your program you can still use the original Properties class. public class PropertiesEx extends Properties { public void

Reading settings from separate config file

女生的网名这么多〃 提交于 2019-11-28 09:27:57
My asp.net app has is using a web.config for common configuration. I also have a section that maps some data objects to connection strings, and that section is going to be couple thousand of lines. I want to move that section to another config file "dataMappings.config", so I don't bulk up web.config - is there a standard mechanism of accessing that config file? Thank you, Andrey In each section, you can define configSource , which can point to an external file path. Here's a simple example: <connectionStrings configSource="myConnectionStrings.Config" /> <appSettings configSource=

Python's ConfigParser unique keys per section

北慕城南 提交于 2019-11-28 09:21:36
I read the part of the docs and saw that the ConfigParser returns a list of key/value pairs for the options within a section. I figured that keys did not need to be unique within a section, otherwise the parser would just return a mapping. I designed my config file schema around this assumption, then sadly realized that this is not the case: >>> from ConfigParser import ConfigParser >>> from StringIO import StringIO >>> fh = StringIO(""" ... [Some Section] ... spam: eggs ... spam: ham ... """) >>> parser = ConfigParser() >>> parser.readfp(fh) >>> print parser.items('Some Section') [('spam',

How to Write to a User.Config file through ConfigurationManager?

我的未来我决定 提交于 2019-11-28 09:15:46
I'm trying to persist user settings to a configuration file using ConfigurationManager. I want to scope these settings to the user only, because application changes can't be saved on Vista/Win 7 without admin privileges. This seems to get me the user's configuration, which appears to be saved here in Win 7 ([Drive]:\Users\[Username]\AppData\Local\[ApplicationName]\[AssemblyName][hash]\[Version\) Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal); Whenever I try to save any changes at all to this config I get this exception:

Preserve case in ConfigParser?

有些话、适合烂在心里 提交于 2019-11-28 05:36:31
I have tried to use Python's ConfigParser module to save settings. For my app it's important that I preserve the case of each name in my sections. The docs mention that passing str() to ConfigParser.optionxform() would accomplish this, but it doesn't work for me. The names are all lowercase. Am I missing something? <~/.myrc contents> [rules] Monkey = foo Ferret = baz Python pseudocode of what I get: import ConfigParser,os def get_config(): config = ConfigParser.ConfigParser() config.optionxform(str()) try: config.read(os.path.expanduser('~/.myrc')) return config except Exception, e: log.error

How to Create a configuration File For MongoDB

这一生的挚爱 提交于 2019-11-28 04:42:12
I have installed mongodb for mac os through 10gen and I have gone through the documentation to do so. Everything seems fine apart from the configuration file. I can not see it in /etc/mongod.config. Do I have to manually create this config file? And if so how can I go about it? cheers Unless you have installed a packaged version of MongoDB (for example, using Homebrew or Mac Ports ) you will have to create a config file manually, or just pass the appropriate command line parameters when starting up MongoDB. If you want a commented example of a config file to start with, the mongodb.conf in the

How to create an .INI file to store some settings in Java?

霸气de小男生 提交于 2019-11-28 04:33:52
I want to create an ini file to store some settings for my application. Is it a good idea to find where the jar file is located and create an ini file there? If yes, then how can I find the location of the jar file? But if you know a better solution for something like this, I would like to hear some of them. EDIT : I'm using mac and I want to run the same application in windows. I could write something in the System.getProperty("user.home") directory, but I want to keep the system clean, if the user decides to remove the app. There is no a better way to store the settings file, for example in

How to programmatically modify assemblyBinding in app.config?

≯℡__Kan透↙ 提交于 2019-11-28 03:04:58
问题 I am trying to change the bindingRedirect element at install time by using the XmlDocument class and modifying the value directly. Here is what my app.config looks like: <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> ... </sectionGroup> </configSections> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">