Мастер Якао изучал программу, написанную попередниками. На мониторе очень большие фрагменты кода светились серым цветом. Они были закомментированны.
Настоятель объяснил, что неактивный код был ненужен, но он приказал оставить его: если однажды понадобится восстановить логику, код можно будет просто раскомментировать, а не переписывать с самого начала.
«Это можно понять» — кивнул мастер.
На следующее утро монахи, пришедшие на встречу, были обеспокоены, что не могут нигде найти настоятеля.
Мастер указал им вверх, на стропила, где висело тело настоятеля.
«Услуги вашего настоятеля больше не требуются» — сказал мастер — «Но оставьте его тело разлагаться над вами. В конце концов, однажды его методы могут снова потребоваться, и было бы расточительно обучать нового с нуля»
В своем отчете мастер отметил быстрое изменение методов работы клана. Он приписывал это хорошему примеру покойного настоятеля и писал «Нам следует рассмотреть возможность его восстановления в должности»
Tuesday, March 27, 2018
Monday, March 19, 2018
Writing universal PHP Extension for different version (PHP5 && PHP7)
After 7.x version ZEND changed Zend_API for PHP extentions.
For making universal extension, you can use the next structure:
The following table lists PHP versions within Zend products with their internal API versions and Zend products versions.
For making universal extension, you can use the next structure:
#if ZEND_MODULE_API_NO >= 20151012
// ...
#endif
The following table lists PHP versions within Zend products with their internal API versions and Zend products versions.
| PHP Version | PHP Extension | Zend Extension | Zend Server | Zend Guard | Zend Encoder ID |
| PHP 5.2 (EOL) | 20060613 | 220060519 | 5.6 (LTS, EOL) | 5.5 | 3 |
| PHP 5.3 | 20090626 | 220090626 | 6.3 (LTS) | 6 | 4 |
| PHP 5.4 | 20100525 | 220100525 | 7 (LTS) | 6 | 5 |
| PHP 5.5 | 20121212 | 220121212 | 8 | 7 | 6 |
| PHP 5.6 | 20131226 | 220131226 | 8 (LTS) | 7 | 7 |
| PHP 7.0 | 20151012 | 320151012 | 9 (EA) | N/A | N/A |
Notes
LTS stands for "Long Term Support", which means that within a specific Zend Server version, one PHP version will be maintained with stability and security fixes by Zend beyond the timeframe defined by PHP community. You might also find out that specific PHP versions appears in multiple Zend Server versions, but only one LTS PHP version exists in every Zend Server version, and appears below as such.
EA stands for Early Access.
EOL stands for End of Life project status.
Zend (Guard) Encoder / Loader ID is an embedded number within each encoded PHP file, identifying PHP version according to the above table. When encoding PHP scripts using Zend Guard, the runtime PHP must be the same version as encoded version, otherwise you get an incompatible file format error instead of script execution.
PHP 5.3+5.4: VC9, VS 2008 SP1
PHP 5.5+5.6: VC11, VS 2012
PHP 7: VC14, VS 2015
Zend (Guard) Encoder / Loader ID is an embedded number within each encoded PHP file, identifying PHP version according to the above table. When encoding PHP scripts using Zend Guard, the runtime PHP must be the same version as encoded version, otherwise you get an incompatible file format error instead of script execution.
PHP for Windows
PHP is built by Zend labs as Non-Thread-Safe (NTS), with these Visual Studio versions:PHP 5.3+5.4: VC9, VS 2008 SP1
PHP 5.5+5.6: VC11, VS 2012
PHP 7: VC14, VS 2015
Monday, March 12, 2018
How to export LD_LIBRARY_PATH to all users and system services
You can add every path in the file in
/etc/ld.so.conf.d then run :ldconfig -v
Then load them.
Friday, April 21, 2017
Enabling the ”Keyboard Layout” indicator with country flags for Mint Mate
At first you will need png images for the flags . Download the flags for your layouts.
Open gimp and rescale them to 26x10 (width x height). Rename them to your layout language
like for US layout rename the image as "us.png", for Russian rename to ru.png and etc.
Then put them in ~/.icons/flags.
After that install dconf-editor (if not installed). Open dconf-editor and go to
org/mate/desktop/peripherals/keyboard/indicator and check the "show-flags" option.
Open gimp and rescale them to 26x10 (width x height). Rename them to your layout language
like for US layout rename the image as "us.png", for Russian rename to ru.png and etc.
Then put them in ~/.icons/flags.
After that install dconf-editor (if not installed). Open dconf-editor and go to
org/mate/desktop/peripherals/keyboard/indicator and check the "show-flags" option.
Friday, December 9, 2016
Swift: programmatically switch ViewController
To switch between ViewController in Swift, you can use the following code:
@IBAction func nextButtonTapped(sender: AnyObject) { var nextView: TheNextViewController = self.storyboard?.instantiateViewControllerWithIdentifier("TheNextViewController") as! TheNextViewController let appdelegate = UIApplication.sharedApplication().delegate as! AppDelegate appdelegate.window!.rootViewController = nextView }
macOS Sierra: Use Caps Lock to switch input sources in OS X 10.12
My previous article "Howto switch language by Caps Lock" don't works on macOS Sierra (OS X 10.12).
So, for fix it, please, go and install Karabiner-Elements and after you'll have the same feature like in previous article
So, for fix it, please, go and install Karabiner-Elements and after you'll have the same feature like in previous article
Thursday, June 9, 2016
Switch between PHP versions on the same machine - Переключение между версиями РНР на одном компьютере
Переключение между версиями PHP на одной машине
Возникла задача:- Иметь версию php без расширения gettext (Если ставить из пакетов, то оно уже предустановлено и выпиливается с трудом)
- Иметь возможность быстро переключаться между версиями php на своей машине (сейчас происходит фаза активного перехода с 5.6 на 7.x)
Сходу было найдено решение: phpbrew. Тут сейчас опишу те подводные камни, на которые наплыл.
Как установить phpbrew
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
Как работает phpbrew
В home dir создается папка .phpbrew. Внутри нее в подпапке php будут все наши версии php с установленными зависимостями
Установка новой версии php
phpbrew install x.y.zВозвращаясь к моей проблеме №1 - отключение расширения gettext, я делал установку следующим образом
phpbrew install x.y.z -gettext
Переключение между версиями php
phpbrew switch 5.4.18
Возможные проблемы при установке
У меня при сборке появилась следующая проблема
checking for BZip2 support... yes
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
*** There was an error while trying to configure php. Check the custom/suphp/configure.php5 file
Суть проблемы в том, что пакет BZip2 установлен, а вот dev версия пакета - нет.
Решается следующим образом:
yum install bzip2-develили
apt-get install libbz2-devАналогичная проблема была с readline
Более универсальное решение в моем случае
apt-cache search libreadlineи ставим нужный пакет.
Установка расширение php
phpbrew ext install xdebugНе забудьте предварительно переключится на нужную версию php
You can also install extension via PECL and enable it manually:
pecl install mongoВ моем случае при установке расширения oci8 возникли следующие проблемы:
phpbrew ext enable mongo
- Нужно было отследить совместимость версии php и pecl расширения и ставить только нужную версию
- phpbrew не хотел включать (enable) расширение. Решилось путем создания oci8.ini руками и написание внутри "extension=oci8.so"
Установка php-7.0 zts:
> phpbrew install --name php-7.0-zts 7.0 +default -gettext +apxs2=/usr/bin/apxs2 +openssl +mcrypt +zts
Subscribe to:
Posts (Atom)