Сообщения

Сообщения за июль, 2015

Yii 2 AD LDAP

cd localhost\yii2basic правим composer.json добавляем { "name": "yiisoft/yii2-app-advanced", "description": "Yii 2 Advanced Project Template", "keywords": ["yii2", "framework", "advanced", "project template"], "homepage": "http://www.yiiframework.com/", "type": "project", "license": "BSD-3-Clause", "support": { "issues": "https://github.com/yiisoft/yii2/issues?state=open", "forum": "http://www.yiiframework.com/forum/", "wiki": "http://www.yiiframework.com/wiki/", "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, "minimum-stability": "stable", "repositories": [ {

Логирование в ASP.NET MVC 4

Изображение
1. С помощью NuGet ставим Nlog 2.\Web.config В секцию добавляем < configuration > < configSections > < section name = "nlog" type = "NLog.Config.ConfigSectionHandler, NLog" /> 3.В самом конце добавляем </ entityFramework > < nlog xmlns = "http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" > < targets > < target name = "console" xsi:type = "Console" layout = "${date:format=HH\:mm\:ss}|${level}|${message}" /> < target name = "file" xsi:type = "File" fileName = "${basedir}/logs/Log.${level}.current.txt" layout = "${longdate} ${callsite} ${level}: ${message} ${exception:format=Message,StackTrace} ${stacktrace}" archiveFileName = "${basedir}/logs/archives/log.error.${s

Yii загрузка файлов

Изображение
по мотивам создаем таблицу (я использую postgres) CREATE TABLE techbase.item ( id SERIAL, name TEXT NOT NULL, url TEXT, CONSTRAINT item_pkey PRIMARY KEY(id), CONSTRAINT item_url_key UNIQUE(url) ) WITH (oids = false); COMMENT ON COLUMN techbase.item.id IS 'ид'; COMMENT ON COLUMN techbase.item.name IS 'имя'; COMMENT ON COLUMN techbase.item.url IS 'Источник (URL без http://)'; создаем модель и круд правим protected\models\Item.php чтобы получилось следующее class Item extends CActiveRecord { public $icon; // атрибут для хранения загружаемой картинки статьи public $del_img; // атрибут для удаления уже загруженной картинки /** * @return string the associated database table name */ public function tableName() { return 'item'; } /** * @return array validation rules for model attributes. */ public function rules() { // NOTE: you should only define rules for