Сообщения

Сообщения за декабрь, 2015

cmd Windows

cls clear terminal

PHP optimization

src:  http://us3.php.net/manual/en/function.include.php If you're doing a lot of dynamic/computed includes (>100, say), then you may well want to know this performance comparison: if the target file doesn't exist, then an @include() is *ten* *times* *slower* than prefixing it with a file_exists() check. (This will be important if the file will only occasionally exist - e.g. a dev environment has it, but a prod one doesn't.) ---------------------------------------------------

философия. ~ unix way

что такое программа-фильтр: когда из кучи(БД) фильтруется( читай выбирается) что-то что запросил input. Вот и проектирование БД есть не что иное как тупо создание структуры данных, для удобной( читай быстрой, понятной) последующей фильрации/выборки. Как-то так. а вы тут заливаете. * Стройте прототип программы как можно раньше. Ну типа юнит тест. Красиво — небольшое. Как японские садики. Минимализм красив и лаконичен и понятен и прост. Ищите  90-процентное решение . Если можно не добавлять новую функциональность, не добавляйте её (« Чем хуже, тем лучше »). Вообще задача либо имеет решение либо нет - это раз. А во вторых иногда десятая часть что не продумана - занимает в 9 раз больше времени на решение и плюс к тому может вести к большим переменам в сделанной структуре. Программа это структура решения.

test

integration test: when you combine few One purpose test. It's like test some kind of circle in intercation of different parts of app. Интеграцио́нное тести́рование  ( англ.   Integration testing , иногда называется  англ.   Integration and Testing , аббревиатура  англ.   I&T ) — одна из фаз  тестирования программного обеспечения , при которой отдельные программные модули объединяются и тестируются в группе . Обычно интеграционное тестирование проводится после  модульного тестирования  и предшествует  системному тестированию .

phpStorm

http://www.ivanbreet.com/blog-item/some-handy-phpstorm-shortcuts-everyone-should-know ctrl + j shows all shortcuts. ctrl + i implement parent class methods ctrl + o override parent class methods alt + F12 toggle between terminal and code ctrl + Y delete line without send it to a buffer. ctrl + ` change look and feel ctrl + alt + -/+ folding/expand recursively (  https://www.jetbrains.com/phpstorm/help/folding-and-expanding-code-blocks.html ) ctrl + shift + -/+ fold/expand all *********************************************** format: order: ctrl + shift + alt + key ******************************************** ctrl + shift + f6 rename variable, file... ctrl + N open class ctrl + shift + N open file ctrl + shift + t open test ctrl + shift + F10 run test ctrl + shift + F12 hide all windows alt+f1 from source to file in project tree ctrl+ alt + f1 open file in explorer ctrl + + 3 points expand ctrl + - 3 points hide open files: 2*shift search everywhere alt+1

JS JavaScript

[ 0 ]. nextSibling . data replace text after element. Когда случается что-то интересное, модули  сообщают  об этом другим частям приложения, а промежуточный слой интерпретирует их сообщения и необходимым образом реагирует на них. в этой слабосвязанной архитектуре модули всего лишь публикуют события (в идеале, не зная о других модулях в системе). Медиатор используется для подписки на сообщения от модулей и для решения, каким должен быть ответ на уведомление. Паттерн фасад используется для ограничения действий разрешенных модулям. В следующем примере функция  library  используется для объявления новой библиотеки и автоматически при создании библиотеки (т.е. модуля) , связывает вызов метода  init  с  document.ready . function library ( module ) { $ ( function () { if ( module . init ) { module . init (); } }); return module ; } var myLibrary = library ( function () { return { init : function () { /* код модуля */

composer tips

https://knpuniversity.com/screencast/question-answer-day/create-composer-package and error:  http://answered.site/why-do-i-get-php-fatal-error-when-i-want-to-install-an-extension/5451537/

ubuntu bash CentOS

~ /home/ya pwd show path uname -a print system info `uname -a` in bash excute it and replace with command output chmod change permission: chmod X@Y file1 file2 ... where: X is any combination of the letters `u' (for owner), `g' (for group), `o' (for others), `a' (for all; that is, for `ugo'); @ is either `+' to add permissions, `-' to remove permissions, or `=' to assign permissions absolutely; and Y is any combination of `r', `w', `x' read write execute touch create file internet ifconfig internet config programming ls -al show dir content ls -al show dir content ls -al show dir content ls -al show dir content user management passwd userName set password to user su userName change user exit log out userdel userName -r delete user. -r with user dir. system sudo shutdown -r 0 reboot через 0 секунд ctrl+alt+F1-9 run console in full screen mode clear clear terminal Symbolic Notation N

emmet snippets

http://docs.emmet.io/abbreviations/syntax/

stackoverflow

Case: <pre> CREATE TABLE `comment2` (   `id` int(11) NOT NULL,   `user` int(11) NOT NULL,   `text` varchar() NOT NULL,   `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=MyISAM DEFAULT CHARSET=utf8; <br> ALTER TABLE `comment2`   ADD PRIMARY KEY (`id`),   ADD UNIQUE KEY `id` (`id`,`user`); <br> ALTER TABLE `comment2`   MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; </pre> There are 1000000 write operations per second in table 'comment2'. <br> And 100000 queries `SELECT user, text FROM comment2 LIMIT 100;` <br> <br> Any suggestions on how it could be optimized?