Примеры решения типичных задач за рамками ядра Yii2Paul Klimov
Рассмотрим сравнительно сложные, и в то же время, часто возникающие, задачи, для которых ядро Yii не дает готового решения. Посмотрим как из отдельных моделей ActiveRecord собирать единые сущности, и как разбивать большие модели на составляющие. Разберем как правильно сохранять файлы и как сэкономить на обработчиках событий и поведениях
- Интернационализация сущностей в базе данных;
- Обработка “ролей” в реляционных базах данных;
- Работа с файлами;
- Вложенные модели;
- Trait вместо Behavior.
Примеры решения типичных задач за рамками ядра Yii2Paul Klimov
Рассмотрим сравнительно сложные, и в то же время, часто возникающие, задачи, для которых ядро Yii не дает готового решения. Посмотрим как из отдельных моделей ActiveRecord собирать единые сущности, и как разбивать большие модели на составляющие. Разберем как правильно сохранять файлы и как сэкономить на обработчиках событий и поведениях
- Интернационализация сущностей в базе данных;
- Обработка “ролей” в реляционных базах данных;
- Работа с файлами;
- Вложенные модели;
- Trait вместо Behavior.
Доклад рассматривает тонкости nodejs, а так же преимущества Evented I/O для серверных приложений. Будет предоставлен ряд рекоммендаций по правильному построению архитектуры, модульности, масштабированию, дизайну кода. Краткое введение в технологию программирования "волокнами" (fibers) и ряд других эффективных практик.
Caching on highload Drupal site - Alexander ShumenkoDrupalCampDN
Рассмотрим создание тегированной системы кеширования сущностей для high load сайта на Drupal. В ходе доклада будут рассмотрены наиболее интересные моменты реализации (построение цепочки тегов) так же рассмотрены проблемы и способы их решения.
Доклад рассматривает тонкости nodejs, а так же преимущества Evented I/O для серверных приложений. Будет предоставлен ряд рекоммендаций по правильному построению архитектуры, модульности, масштабированию, дизайну кода. Краткое введение в технологию программирования "волокнами" (fibers) и ряд других эффективных практик.
Caching on highload Drupal site - Alexander ShumenkoDrupalCampDN
Рассмотрим создание тегированной системы кеширования сущностей для high load сайта на Drupal. В ходе доклада будут рассмотрены наиболее интересные моменты реализации (построение цепочки тегов) так же рассмотрены проблемы и способы их решения.
Рarse'им бэкенд
Аким Халилов
Вы хотите выучить Backbone? Хотите просто писать клиентский код, не думая о сервере и о том, как все обрабатывать, хранить, бэкапить? Выход есть – храните с помощью Parse. Parse – платформа, которая предоставляет возможность хранения данных без забот о сервере. Хранилище данных, соц. сети, push-notification, cloud code. Что такое Parse и что он умеет, о библиотеке для использования:
- знакомство с JS API и примеры использования;
- начинаем кодить: stub-проект;
- кодим фичи: CRUD + плюшки;
- хостим.
Кэширование данных с помощью Service WorkerAndrew Smirnov
Как хорошо вы знаете Service Worker API? А способы применения его для кэширования данных? В этом рассказе мы постараемся понять, как Service Worker может взаимодействовать с запросами, что и как кэшировать, а также как все это поможет нашим с вами сайтам загружаться значительно быстрее.
Продвинутое использование Celery — Александр КошелевYandex
Доклад будет интересен как тем, кто уже знаком с библиотекой для реализации очередей задач Celery, так и тем, кто только собирается её попробовать. Основные темы выступления:
- как устроена Celery;
- как перейти на альтернативные брокеры;
- как обеспечить эффективный доступ к ресурсам;
- как отслеживать работоспособность процессов Celery
Нельзя просто так взять и сделать версионирование APIEatDog
"Нельзя просто так взять и сделать версионирование API"
Почему важно иметь версионирование и какие проблемы оно решает
Какие есть подходы к версионированию API
Какие инструменты и решения предоставляют популярные веб-фреймворки
Почему версионирование - это не просто и как решить возникшие трудности
Выводы
How to find the Right Mobile and Cloud Application Development Company for Yo...MageCloud
We know that quite a lot of organizations and companies of all kinds start planning their resources ahead to tackle their product development in 2013. We will explain the general process, talk about most common development stages as well as provide some case studies and share our experience as an outsourcing contractor.
Many companies consider outsourcing the entire product development or very specific components like UI or mobile application development. Being involved in many projects as an outsourced service provider, QuartSoft has learned the ins and outs of the outsourcing business. So based on our experience we would like to highlight some important points concerning selecting the right outsourcing partner to professionally help you develop and support your product.
Mobile devices became a major part of business so we can't ignore them any longer. How to convert these mobile visitors and ensure the best user experience for them? What should you consider first mobile site or an app? We'll discuss these and other issues in the upcoming webinar.
We recently conducted performance testing to help us determine best practices for Magento optimization; we documented our results in a free white paper. Here are some of the highlights:
An optimized Magento Enterprise Edition configuration can support more than 350 million catalog views and 487,000 orders per day.
Optimizing a standard 2+1 server configuration with Varnish or Nginx can significantly improve response times.
With proper server configuration and enhanced caching, businesses can maximize hardware efficiency while supporting more customers and transactions.
Cloud Based Business Application DevelopmentMageCloud
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
Successful banner ads achieve three things: raise brand/product awareness; introduce a unique proposal that entices the user to learn more; drive the user to a clear, consistent landing page that pushes the user down the funnel.
Two Facets of Great e-Commerce: PPC and Landing Page Best PracticesMageCloud
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise boosts blood flow and levels of neurotransmitters and endorphins in the brain which elevate mood and support the growth of new brain cells.
4. Магия в PHP
class Component {
public $publicProperty;
protected $_protectedProperty;
public function setProtectedProperty($value) {
$this->_protectedProperty = $value;
return true;
}
public function getProtectedProperty() {
return $this->_protectedProperty;
}
}
5. class Component {
public function __get($propertyName) {
$methodName = 'get'.$propertyName;
if (method_exists($this, $methodName)) {
return call_user_func( array($this, $methodName) );
} else {
throw new Exception("Missing property {$propertyName}'!");
}
}
public function __set($propertyName, $value) {
$methodName = 'set'.$propertyName;
if (method_exists($this, $methodName)) {
return call_user_func( array($this, $methodName), $value );
} else {
throw new Exception("Missing property {$propertyName}'!");
}
}
7. Автозагрузка классов
Подключение файлов по принципу DLL:
require_once('components/SomeClass.php');
$someObj = new SomeClass();
…
require_once('components/OtherClass.php');
$otherObj = new OtherClass();
…
require_once('components/SomeClass.php');
$anotherSomeObj = new SomeClass();
8. class Autoloader {
public function autoload($className) {
$classFileName = ‘components/'.$className.'.php';
if (file_exists($classFileName)) {
require_once($classFileName);
return true;
}
return false;
}
public function register() {
return spl_autoload_register( array($this, 'autoload') );
}
public function __construct() {
$this->register();
}
}
9. Автозагрузка классов в контексте Yii:
Yii::import(‘application.components.SomeClass');
Yii::import(‘application.components.OtherClass');
…
$someObj = new SomeClass();
«Карта» автозагрузки классов:
‘SomeComponent’ => ‘/home/www/…/components/SomeClass.php’,
‘OtherComponent’ => ‘/home/www/…/components/OtherClass.php’,
10. Порождение компонентов
function createComponent(array $componentConfig) {
$className = $componentConfig['class'];
if (empty($className)) {
throw new Exception(‘Missing parameter "class"!');
}
unset($componentConfig['class']);
if (!class_exists($className)) {
Yii::import($className); // Автозагрузка
}
$component = new $className();
foreach($componentConfig as $name=>$value) {
$component->$name = $value; // Конфигурация
}
return $component;
}
11. Задание любого объекта через массив:
$componentConfig = array(
'class'=>'CUrlManager',
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'/'=>'site/index',
'<controller:w+>/<id:d+>*'=>'<controller>/view',
),
);
$component = createComponent($componentConfig);
12. Фабрика компонентов
“Request component
by name”
Factory Client
$componentsConfig
$components “Create and store
1 by name”
createComponent() * Component
getComponent()
ComponentA ComponentB …
13. Одиночка (Singleton)
class Singleton {
private static $_selfInstance = null;
public static function getInstance() {
if (!is_object(self::$_selfInstance)) {
self::$_selfInstance = new Singleton();
}
return self::$_selfInstance;
}
private function __construct() {
// закрытый конструктор
}
}
$singleton = Singleton::getInstance();
24. Проблема множественного
наследования
ActiveRecord
ArPosition ArFile
Save custom records Bind physical file with
display order the db record
ArPositionFile
Position + File
26. class ArBehaviorExample extends CBehavior {
public function behaviorMethod() {
$owner = $this->getOwner();
$owner->create_date = date('Y-m-d H:i:s', strtotime('NOW'));
}
}
$user = new User();
// Добавляем поведение:
$behavior = new ArBehaviorExample();
$user->attachBehavior($behavior);
// Вызываем метод поведения:
$user->behaviorMethod();
echo $user->create_date; // Вывод: ‘2012-03-22 16:46’
27. Yii
• Динамический код
• Компонентная структура
• Приложение = «одиночка» + «фабрика»
• Отложенная загрузка и создание
объектов
• MVC
• «PDO» и «Active Record»
• События
• Поведения