How do you put HTML or XML into a YAML?

Example Here is a sample record from a YAML-based snippet management system I created years ago: – caption: fieldset msie5 tinycap: fieldset domain: html desc: fieldset and legend tag wwbody: | <fieldset> <legend>legend</legend> </fieldset> You can repeat that or something like it for all the snippets you want to manage. This particular system stores the … Read more

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

What is the intended use of the DEFAULT section in config files used by ConfigParser?

I found an explanation here by googling for “windows ini” “default section”. Summary: whatever you put in the [DEFAULT] section gets propagated to every other section. Using the example from the linked website, let’s say I have a config file called test1.ini: [host 1] lh_server=192.168.0.1 vh_hosts = PloneSite1:8080 lh_root = PloneSite1 [host 2] lh_server=192.168.0.1 vh_hosts … Read more

Application configuration files [closed]

YAML, for the simple reason that it makes for very readable configuration files compared to XML. XML: <user id=”babooey” on=”cpu1″> <firstname>Bob</firstname> <lastname>Abooey</lastname> <department>adv</department> <cell>555-1212</cell> <address password=”xxxx”>ahunter@example1.com</address> <address password=”xxxx”>babooey@example2.com</address> </user> YAML: babooey: computer : cpu1 firstname: Bob lastname: Abooey cell: 555-1212 addresses: – address: babooey@example1.com password: xxxx – address: babooey@example2.com password: xxxx The examples were taken … Read more

SSIS how to set connection string dynamically from a config file

First add a variable to your SSIS package (Package Scope) – I used FileName, OleRootFilePath, OleProperties, OleProvider. The type for each variable is “string”. Then I create a Configuration file (Select each variable – value) – populate the values in the configuration file – Eg: for OleProperties – Microsoft.ACE.OLEDB.12.0; for OleProperties – Excel 8.0;HDR=, OleRootFilePath … Read more

Using ConfigParser to read a file without section name

You can do this in a single line of code. In python 3, prepend a fake section header to your config file data, and pass it to read_string(). from configparser import ConfigParser parser = ConfigParser() with open(“foo.conf”) as stream: parser.read_string(“[top]\n” + stream.read()) # This line does the trick. You could also use itertools.chain() to simulate … Read more

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