ini

my_config.ini vs my_config.php

主宰稳场 提交于 2019-11-30 11:17:45
At work we use a .ini file to set variables prior to calling the rest of the framework (I think it goes function getConfigVars(){ //read my_config.ini file .... //call framework } and I have always wondered if there was a benefit to doing it that way. It seems to me that you then have to write access rules to stop people from looking at it from the web and php has to parse it and understand it. So, why use my_config.ini rather than my_config.php? It is not like anyone should be touching it after it is set up and it seems more convenient to just call the variables and be able to have your IDE

Do standard windows .ini files allow comments?

安稳与你 提交于 2019-11-30 10:24:08
问题 Are comments allowed in Windows ini files? (...assuming you're using the GetPrivateProfileString api functions to read them...) [Section] Name=Value ; comment ; full line comment And, is there a proper spec of the .INI file format anywhere? Thanks for the replies - However maybe I wasn't clear enough. It's only the format as read by Windows API Calls that I'm interested in. I know other implementations allow comments, but it's specifically the MS Windows spec and implementation that I need to

C# Linq .ToDictionary() Key Already Exists

旧时模样 提交于 2019-11-30 09:55:40
Final Edit: I was able to locate the duplicate field in the ini file. Thanks for your help everyone! I'm using a regular expression to parse an ini file and LINQ to store it in a Dictionary: Sample Data: [WindowSettings] Window X Pos='0' Window Y Pos='0' Window Maximized='false' Window Name='Jabberwocky' [Logging] Directory='C:\Rosetta Stone\Logs' EDIT: Here is the file actually causing the problem: http://pastebin.com/mQSrkrcP EDIT2: I've narrowed it down to being caused by the last section in the file: [list_first_nonprintable] For some reason one of the files that I'm parsing with this is

php parse_ini_file oop & deep

早过忘川 提交于 2019-11-30 09:07:18
问题 I would like to make use of somehting like [parse_ini_file][1]. Lets say for instance I have a boot.ini file that I will load for further procedure: ;database connection settings [database] type = mysql; host = localhost; username = root; password = ""; dbName = wit; However, I would like to have it in a different way as the php array would be: $ini['database']['whatever'] So first of all I would like to have my boot.ini like this structure: ;database settings (comment same style) db.host1

How can I access INI files from Perl?

て烟熏妆下的殇ゞ 提交于 2019-11-30 06:57:20
问题 What is the best way to parse INI file in Perl and convert it to hash? 回答1: I prefer to use Config::IniFiles module. 回答2: If you like more perlish style then try Tie::Cfg. Sample: tie my %conf, 'Tie::Cfg', READ => "/etc/connect.cfg"; $conf{test}="this is a test"; 回答3: The best way is to make use of available modules in CPAN as what others have suggested. Below is just for your own understanding, let's say you have ini file like this: $ more test.ini [Section1] s1tag1=s1value1 # some comments

Convert array to an .ini file

元气小坏坏 提交于 2019-11-30 05:54:27
问题 I need to parse an .ini file into an array, and later change the values of the array and export it to the same .ini file. I managed to read the file, but didn’t find any simple way to write it back. Any suggestions? Sample .ini file: 1 = 0; 2 = 1372240157; // timestamp. 回答1: In order to write the .ini file back, you need to create your own function, for PHP offers no functions out of the box other than for reading (which can be found here: http://php.net/manual/pl/function.parse-ini-file.php)

Pyramid and .ini configuration

孤人 提交于 2019-11-30 04:56:23
Each Pyramid application has an associated .ini file that contains its settings. For example, a default might look like: [app:main] use = egg:MyProject pyramid.reload_templates = true pyramid.debug_authorization = false pyramid.debug_notfound = false pyramid.debug_routematch = false ... I am wondering if it is possible to add your own configuration values in there, and read them at run-time (mostly from a view callable). For instance, I might want to have [app:main] blog.title = "Custom blog name" blog.comments_enabled = true ... Or is it better to have a separate .ini file and parse it during

PHP | “The requested PHP extension bcmath is missing from your system.”

核能气质少年 提交于 2019-11-30 04:23:34
Greetings fellow developers, I am trying to use composer for a PHP project of mine on a development server I recently booted up and for some reason I am unable to. I successfully installed composer, however, when I try to run the require command I get the following error: root@webserver:/var/mypersonal/index# composer require php-amqplib/php-amqplib PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_openssl.dll' - /usr/lib/php/20151012/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0 Do not run Composer as root

C# 读写.ini配置文件

倾然丶 夕夏残阳落幕 提交于 2019-11-29 22:07:37
`class Ini { // 声明INI文件的写操作函数 WritePrivateProfileString() [System.Runtime.InteropServices.DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); // 声明INI文件的读操作函数 GetPrivateProfileString() [System.Runtime.InteropServices.DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, System.Text.StringBuilder retVal, int size, string filePath); public static bool Write(string section, string key, string value, string sPath) { // section=配置节,key=键名,value=键值,path=路径 long

Do standard windows .ini files allow comments?

穿精又带淫゛_ 提交于 2019-11-29 20:32:32
Are comments allowed in Windows ini files? (...assuming you're using the GetPrivateProfileString api functions to read them...) [Section] Name=Value ; comment ; full line comment And, is there a proper spec of the .INI file format anywhere? Thanks for the replies - However maybe I wasn't clear enough. It's only the format as read by Windows API Calls that I'm interested in. I know other implementations allow comments, but it's specifically the MS Windows spec and implementation that I need to know about. Ian Boyd Windows INI API support for: Line comments : yes, using semi-colon ; Trailing