Сообщения

Сообщения за 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?

bootstrap often uses elements

src: http://getbootstrap.com/components/ !!!!!!! everywhere use col-sm!!!!!!!!! for devices. * left column: < div class= "bs-callout bs-callout-info" > <h4></h4> < p > <?= $template -> text ?> </ p > </ div > * header + text block: < div class= "panel panel-info" > < div class= "panel-heading" > < h3 class= "panel-title" > <?= $template -> name ?> </ h3 > </ div > < div class= "panel-body" > <?= $template -> text ?> </ div > </ div > * btn size: btn-lg btn-sm btn-xs .disabled .btn-disabled

zend framework 2 tips

************** basePath in controller $renderer = $this -> serviceLocator -> get ( 'Zend\View\Renderer\RendererInterface' ) ; $basePath = $renderer -> basePath () ; * change form element validators list: $form = new YourForm (); $form -> setData ( $yourPostedData () ); $formInputFilter = $form -> getInputFilter (); // change filter $formInputFilter -> remove ( 'your_field' ); $inputFactory = new \Z end \InputFilter\Factory (); $formInputFilter -> add ( $inputFactory -> createInput ( array ( 'name' => 'your_field' , 'required' => false ) ) ); if ( $form -> isValid ()) { //... } * change elements for validation: $form ->remove( 'name' ); $form ->setValidationGroup( 'date' , 'text' , 'public_to_group' , 'public_for_everybody' ); form bind: $form ->setHydrator( new \Zend\Stdlib\Hydrator\ObjectProperty()

ubuntu dropbox

find / -type f -name "dropboxd" if smth: "echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf; sudo sysctl -p"" run it.

ООП

module uses interface to I/O between others modules. Implementation of interface methods could be done through call services from ServiceManager. принципы: 1. Разделение ответственности между классами 2. Функции не всемогущи, они пишутся под конкретную задачу. http://larin.in/archives/42 https://ru.wikipedia.org/wiki/%D0%90%D0%B3%D1%80%D0%B5%D0%B3%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5) http://sergeyteplyakov.blogspot.ru/2012/12/vs-vs.html

html css

http://www.dejurka.ru/css/applelikenav/ https://css-tricks.com/absolute-positioning-inside-relative-positioning/

to read

fun +++++++++ https://afisha.mail.ru/series_768131_chernoe_zerkalo/?autoplay=1#watch fun ---------- python +++++++++ http://programming-motherfucker.com/ python -------------- golang, vagrant ++++++++++ https://www.youtube.com/user/index0h/playlists golang, vagrant ------------- job  +++++++++++ https://www.ziptask.com/freelance?t=2 https://yandex.ru/jobs/vacancies/dev/phpdev_market/ after mail data course https://ru.wikipedia.org/wiki/%D0%A1%D0%BE%D0%B3%D0%BB%D0%B0%D1%88%D0%B5%D0%BD%D0%B8%D0%B5_%D0%BE%D0%B1_%D1%83%D1%80%D0%BE%D0%B2%D0%BD%D0%B5_%D1%83%D1%81%D0%BB%D1%83%D0%B3 job ------------------ project management +++++++++++++++ https://trello.com/b/sdkrCLzd/goldsurfer project management ---------------------- hight degree  +++++++++++++ http://neerc.ifmo.ru/wiki/index.php?title=%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0 http://www.intuit.ru/studies/ courses/1049/317/info http://www.kstu.edu.ru/mi

psql postgres

connect: psql -U username(postgres) -W \l \list all dbs \dt all tables in current db \connect dbname root доступ su - postgrtes psql и create database ...

sql optimizations

Изображение
B-tree is a self-balancing tree that maintains sorted data and allows operation in logarithmic time. B-trees can handle range queries on sorted data (<, ≤, >, ≥, between, in, is null, is not null) B-tree index can also be used for queries that involve pattern matching operator LIKE or ~ if the pattern is a constant and the anchor is at the beginning of the pattern. For example, you can try matching queries column_name LIKE ‘Apple%’ or column_name ~ ‘^Apple’ But, querying ‘%macbook%’ or ‘%pro’ will not be efficient. For such queries, the query planner will resort to full-text sequential search which is not optimized. Enter, GIN indexes. GIN stands for Generalized Inverted Indexes. We can create a GIN index to speed up text searches: CREATE INDEX index_name ON table USING GIN (to_tsvector(‘english’, column_name)); The query above specifies that the English configuration can be used to parse and normalize the strings. And for the part of searching, a simple query to print the tit