ini

Read certain key from certain section of ini file (sed/awk ?)

独自空忆成欢 提交于 2019-12-10 16:35:26
问题 I need to retrieve the value of a key from an ini file with typical structure: [abcd] key1=a key2=b [efgh] key1=c key2=d [hijk] key1=e key2=f with key names repeated in different sections, and no consistant naming/order of sections. How could I find key1 from efgh? If I grep then I'll find all key1's (and I don't know the order of the sections). I suspect sed or awk can do this but I can't find it... 回答1: This could be a start: awk -F'=' -v section="[efgh]" -v k="key1" ' $0==section{ f=1;

Fatal error: Out of memory (allocated 1979711488) (tried to allocate 131072 bytes) error occur while writing xlsx file using phpexcel

五迷三道 提交于 2019-12-10 15:41:55
问题 I have integrating xlsx file for writing from database using phpexcel. I want to write 3,00,000 records in xlsx file. But it till through Fatal error: Out of memory (allocated 1979711488) (tried to allocate 131072 bytes) My PHP Version 5.3.28 Also i set php ini and cell cache see my code below ini_set('max_execution_time',-1); ini_set('memory_limit', '-1'); $cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_in_memory_gzip; $cacheSettings = array( ' memoryCacheSize ' => '-1'); PHPExcel

enable xdebug on bluehost shared server

。_饼干妹妹 提交于 2019-12-10 10:29:51
问题 I want to setup phpunit on a demo site on a bluehost shared server. I want to check if the php codes work on the environment after I made modifications and added more components. With this, I need to set up xdebug. The problem is that my account is not allowed to download and install xdebug, I got permission denied. pecl install xdebug Then I read upon an answer here Xdebug for remote server not connecting. What I did is upload the xdebug.so file from my local, copy the /etc/php.ini to the

c++ GetPrivateProfileString read ini file from current directory

走远了吗. 提交于 2019-12-10 03:29:05
问题 I'm creating a dll on c++. It is a Visual Studio project. The dll reads some data from ini file. I have decided to use GetPrivateProfileString function. It works almost completely. It does not see file in current directory. How can I provide this parameter (variable called path)? How can I pass last parameter (path) Code: LPCTSTR path = L"\\test.ini"; TCHAR protocolChar[32]; int a = GetPrivateProfileString(_T("Connection"), _T("Protocol"), _T(""), protocolChar, 32, path); String from test.ini

how can i get the ini data in pyramid?

我的梦境 提交于 2019-12-10 01:36:54
问题 There is a development.ini or production.ini in a pyramid project. I add my own config data in the ini files like: [thrift] host = 0.0.0.0 port = 8080 and I want to use the config data in one of py files in the project. How can I get the data without the request object? (I've seen a solution which uses request.) 回答1: You can access the settings at request.registry.settings or pyramid.threadlocal.get_current_registry().settings . It behaves like dictionary. If you want to use the second one,

.ini file load environment variable

℡╲_俬逩灬. 提交于 2019-12-10 01:14:01
问题 I am using Alembic for migrations implementation in a Flask project. There is a alembic.ini file where the database configs must be specified: sqlalchemy.url = driver://user:password@host/dbname Is there a way to specify the parameters from the environment variables? I've tried to load them in this way $(env_var) but with no success. Thanks! 回答1: I've solved the problem by setting sqlalchemy.url in env.py as @dirn suggested. config.set_main_option('sqlalchemy.url', <db_uri>) did the trick,

Change value in ini file using ConfigParser Python

坚强是说给别人听的谎言 提交于 2019-12-09 10:10:26
问题 So, I have this settings.ini : [SETTINGS] value = 1 And this python script from ConfigParser import SafeConfigParser parser = SafeConfigParser() parser.read('settings.ini') print parser.get('SETTINGS', 'value') As you can see, I want to read and then replace the value "1" by another one. All I was able to do so far is to read it. I searched on the net how to replace it but I didn't find. 回答1: As from the examples of the documentation: https://docs.python.org/2/library/configparser.html parser

Use ConfigParser to read an array from ini file [duplicate]

雨燕双飞 提交于 2019-12-08 07:24:37
问题 This question already has answers here : How to ConfigParse a file keeping multiple values for identical keys? (4 answers) Closed 5 years ago . I have read this post, and defined an array in subscriber.ini [smtp] subscriber[] = aaa@hotmail.com subscriber[] = bbb@XX.webmail subscriber[] = ccc@test.org Then I try to use ConfigParser to read the array #!/usr/bin/python import ConfigParser CONFIG_FILE = 'subscriber.ini' config = ConfigParser.ConfigParser() config.read( CONFIG_FILE ) subscriber =

Disable E_STRICT errors in php.ini file still throws the errors

[亡魂溺海] 提交于 2019-12-08 07:17:30
问题 I'm trying to disable E_STRICT errors in my php.ini file but it still throws the error. I'm using PHP 5.4.10 with a MAMP (not PRO version). With phpinfo I've located the php.ini file in /Applications/MAMP/bin/php/php5.4.10/conf/php.ini I've changed: error_reporting = E_ALL to error_reporting = E_ALL & ~E_STRICT Then i've restarted Apache but it still throw the error, where I'm wrong? 回答1: Use error_reporting = E_ALL ^ E_STRICT . If you didn't have access to php.ini, you could put this in your

How to read ini file in spring batch (key=value)

北战南征 提交于 2019-12-08 04:14:06
问题 I want to create a batch using Spring batch to read from an ini file and save the data in database but when I chekced the org.springframework.batch.item.file.FlatFileItemReader class I didn't find a way to parse my data from the ini file , I tried to combine the ini4j API with the spring batch but no result my ini file : [Cat] a=1 b= 2 c= 3 d= 4 e= 5 f= 6 [Cat2] a=11 b= 21 c= 31 d= 41 e= 51 f= 61 回答1: What you can do is define your own ItemStreamReader that wraps a delegate ItemStreamReader ,