Read custom configuration file in C# (Framework 4.0)

// Map the roaming configuration file. This // enables the application to access // the configuration file using the // System.Configuration.Configuration class ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap(); configFileMap.ExeConfigFilename = roamingConfig.FilePath; // Get the mapped configuration file. Configuration config = ConfigurationManager.OpenMappedExeConfiguration( configFileMap, ConfigurationUserLevel.None); from http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx

Java – encrypt / decrypt user name and password from a configuration file

As I understand anyhow in order to call 3rd party web service you pass password as plain text and no security certificates are involved. Then I would say the easiest approach would be to store password in encrypted format (via java encryption mechanism) when the encryption/decryption key is just hard coded in the code. I … Read more

Correct implementation of a custom config section with nested collections?

I finally found this guy’s example. It was coded and worked right out of the box. http://manyrootsofallevilrants.blogspot.com/2011/07/nested-custom-configuration-collections.html I am going to paste the code here……only because I cannot stand it when someone says “Your answer is here”, and the link is dead. Please try his website first, and leave a “thank you” if it works. … Read more

2 php.ini files

Depends on where you are running PHP from. If you run it from command line, it uses the cli/php.ini and apache2/php.ini when run through apache. You are executing phpinfo() through the browser, hence you get /etc/php5/apache2/php.ini as the answer. Running php -r “phpinfo();” | grep “Loaded Configuration” from the terminal should output the CLI ini. … Read more

How can I reference a file for variables using Bash?

The short answer Use the source command. An example using source For example: config.sh #!/usr/bin/env bash production=”liveschool_joe” playschool=”playschool_joe” echo $playschool script.sh #!/usr/bin/env bash source config.sh echo $production Note that the output from sh ./script.sh in this example is: ~$ sh ./script.sh playschool_joe liveschool_joe This is because the source command actually runs the program. Everything in … Read more

How to programmatically modify WCF app.config endpoint address setting?

Is this on the client side of things?? If so, you need to create an instance of WsHttpBinding, and an EndpointAddress, and then pass those two to the proxy client constructor that takes these two as parameters. // using System.ServiceModel; WSHttpBinding binding = new WSHttpBinding(); EndpointAddress endpoint = new EndpointAddress(new Uri(“http://localhost:9000/MyService”)); MyServiceClient client = new … Read more

What’s in an Eclipse .classpath/.project file?

Eclipse is a runtime environment for plugins. Virtually everything you see in Eclipse is the result of plugins installed on Eclipse, rather than Eclipse itself. The .project file is maintained by the core Eclipse platform, and its goal is to describe the project from a generic, plugin-independent Eclipse view. What’s the project’s name? what other … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)