browscap ini directive not set

I don’t think this is the “best” solution to detect is a browser supports what you need for your website : first of all, browsers can lie — they can send whatever thay want as User-Agent And even if a given version of a support should support what you need, Javascript can still be disabled. … Read more

Function Get-IniContent is not recognized – INI file support inPowerShell

JeroenMostert has provided the crucial pointer in a comment: PowerShell, as of v7.2.x, has no built-in cmdlets for processing INI files (*.ini), though introducing such cmdlets is being discussed in GitHub issue #9035. Get-IniContent and Out-IniFile are advanced functions (cmdlet-like functions) that come with the third-party PSIni module, available from the PowerShell Gallery. In PowerShell … Read more

PHP Warning: Module already loaded in Unknown on line 0

I think you have loaded Xdebug probably twice in php.ini. check the php.ini, that not have set xdebug.so for the values extension= and zend_extension=. Check also /etc/php5/apache2 and /etc/php5/cli/. You should not load in each php.ini in these directories the extension xdebug.so. Only one file, php.ini should load it. Note: Inside the path is the … Read more

parsing .properties file in Python

Say you have, e.g.: $ cat my.props first: primo second: secondo third: terzo i.e. would be a .config format except that it’s missing a leading section name. Then, it easy to fake the section header: import ConfigParser class FakeSecHead(object): def __init__(self, fp): self.fp = fp self.sechead = ‘[asection]\n’ def readline(self): if self.sechead: try: return self.sechead … Read more

How to parse ini file with Boost

You can also use Boost.PropertyTree to read .ini files: #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ini_parser.hpp> … boost::property_tree::ptree pt; boost::property_tree::ini_parser::read_ini(“config.ini”, pt); std::cout << pt.get<std::string>(“Section1.Value1”) << std::endl; std::cout << pt.get<std::string>(“Section1.Value2”) << std::endl;

How to read and write to an ini file with PHP

You can simply use parse_ini_file with PHP4/5. $ini_array = parse_ini_file(“sample.ini”); print_r($ini_array); Here is the doc: http://php.net/manual/en/function.parse-ini-file.php To write back an array of objects back to the ini file, use below as a very fast & easy solution: function write_php_ini($array, $file) { $res = array(); foreach($array as $key => $val) { if(is_array($val)) { $res[] = “[$key]”; … Read more

Windows batch script to read an .ini file

Here’s a command file (ini.cmd) you can use to extract the relevant values: @setlocal enableextensions enabledelayedexpansion @echo off set file=%~1 set area=[%~2] set key=%~3 set currarea= for /f “usebackq delims=” %%a in (“!file!”) do ( set ln=%%a if “x!ln:~0,1!”==”x[” ( set currarea=!ln! ) else ( for /f “tokens=1,2 delims==” %%b in (“!ln!”) do ( set … Read more

Cross-platform way to get line number of an INI file where given option was found

Once again, took the opportunity to play with Boost Spirit. This time I got to play with line_pos_iterator. Here is the fruit of my labour: https://gist.github.com/1425972 When POSITIONINFO == 0 input is streaming output is raw strings (well, map<string, map<string, string> > for the sections) When POSITIONINFO == 1 input is buffered output is textnode_t: … Read more

Upload max size in PHP?

The following options are relevant: PHP: upload_max_filesize (in php.ini or .htaccess only, won’t work using ini_set()) PHP: post_max_size (ditto) PHP: max_input_time (ditto, thanks @Thorstein, forgot this one) and possibly Apache: LimitRequestBody