ini

Help improve this INI parsing code

末鹿安然 提交于 2019-12-13 00:34:29
问题 This is something simple I came up with for this question. I'm not entirely happy with it and I saw it as a chance to help improve my use of STL and streams based programming. std::wifstream file(L"\\Windows\\myini.ini"); if (file) { bool section=false; while (!file.eof()) { std::wstring line; std::getline(file, line); if (line.empty()) continue; switch (line[0]) { // new header case L'[': { std::wstring header; size_t pos=line.find(L']'); if (pos!=std::wstring::npos) { header=line.substr(1,

Parsing a config file in php to variables

淺唱寂寞╮ 提交于 2019-12-12 19:16:38
问题 -- Background -- So I am working on a installer script for local dev machines and its for installing word press, What I am trying to do is have it so that the user would select a specific plug in from a drop down box and then from there select which version they want to install. -- Issue -- So I need to be able to parse the .cfg file and store all the values into variables dynamically so that way if we add more plugins it won't break. How do I go about doing this? 回答1: Couple of ways,

When i try to parse by js split the first element is empty string

自古美人都是妖i 提交于 2019-12-12 18:14:52
问题 I try to parse ini file, the first string is empty string, but others okay: Structure: [sensor1] param1: value [sensor2] param1 : value param2 : value And my code is: success: function(data) { var parsedArr = data.split(/\s*\[(.*)\]\s*\n/); console.log(parsedArr); } Result: 0: "" 1: "sensor1" 2: "name: brightness temperature↵ 3: "sensor2" 4: "name: brightness temp. IR↵device: HATPRO↵group: length: 5 Is it okay? And how to solve it? Thanks in advance :) 回答1: To remove the empty result at index

ConfigParser getting value from INI file with section and subsection as shown below

拟墨画扇 提交于 2019-12-12 17:34:13
问题 I have a following type of INI file [section1][subsection1] port=989 [section1][subsection2] somethign=somethign I am using ConfigParser of Python to parse the INI file but I am not able to figure it out on how to get the data from the above kinda INI file. the below code is for getting the value when INI file is like [section1] port=908 [section2] ss=ss config = ConfigParser.RawConfigParser() config.read(INI_File) mIp = config.get('section1','port') Please don't suggest me to change the INI

how to enable SOAP,CURL,OPENSSL extension dynamically?

怎甘沉沦 提交于 2019-12-12 15:02:29
问题 i trying to enable SOAP,CURL,OPENSSL extension using ini_set() dynamically.what is the syntax to enable these above ext using ini_set()? i dont have permission to edit php.ini file. thanks... 回答1: You can't. The list of ini parameters and where you can change them is here: List of php.ini directives You'll see that the extension parameter is only configurable in the php.ini file. 来源: https://stackoverflow.com/questions/8103735/how-to-enable-soap-curl-openssl-extension-dynamically

Could there be encoding-related problems when storing unicode strings in ini files?

谁都会走 提交于 2019-12-12 07:28:10
问题 There are already questions regarding unicode and ini files, but many of them are rather domain-specific. So I am not sure if the answer can be applied to the general case. Motivation : I want to use ini files for storing simple data like some numbers and some strings. The strings are provided by users (input via GUI). The software could run anywhere in the world, any language can be used. The files also can be shared between users (so they can be written to on one system, read on another and

How could read application.ini on controller using zend framework

女生的网名这么多〃 提交于 2019-12-12 07:22:46
问题 I have these lines in my application.ini how can I read user in my contrroler resources.doctrine.dbal.connections.default.parameters.driver = "pdo_mysql" resources.doctrine.dbal.connections.default.parameters.dbname = "zc" resources.doctrine.dbal.connections.default.parameters.host = "localhost" resources.doctrine.dbal.connections.default.parameters.port = 3306 resources.doctrine.dbal.connections.default.parameters.user = "root" resources.doctrine.dbal.connections.default.parameters.password

Match INI Section Blocks

时光怂恿深爱的人放手 提交于 2019-12-12 05:48:41
问题 I'm using regular expressions to try to match section blocks in an INI file. I'm using the recipe given in the book Regular Expressions Cookbook, but it doesn't seem to be working for me. Here is the code I'm using: final BufferedReader in = new BufferedReader( new FileReader(file)); String s; String s2 = ""; while((s = in.readLine())!= null) s2 += s + System.getProperty("line.separator"); in.close(); final String regex = "^\\[[^\\]\r\n]+](?:\r?\n(?:[^\r\n].*)?)*"; final Pattern pattern =

C#: Storing the content of an ini file as string or dictionary instead of file name?

冷暖自知 提交于 2019-12-12 05:29:43
问题 Is there a way to store the content of a file as string or as a dictionary instead of just its file path/name? Below is the method that I am currently using for getting the file path from a Windows Form. Is there a way to adapt it or should I start from scratch? I am loading .ini files which is only text. LINQ seems to be one route but I am not familiar with it. public void ShowSettingsGui() { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); ofd.Multiselect

Can php.ini file be used at the directory level? [closed]

荒凉一梦 提交于 2019-12-12 04:43:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I am wondering whether I can use a php.ini file at the directory level? Specifically, I have a domain pointed to a virtual document root in a sub-directory and would like to override some php.ini values previously defined in the php.ini file located in the physical root directory. Is this possible simply by