Skip to content

Instantly share code, notes, and snippets.

if (isset($_POST['CategoryFeatureRestrictedValue'])) {
$model->attributes = $_POST['CategoryFeatureRestrictedValue'];
if ($model->validate()) {
//$response['status'] = $model->save();
//$response['flash_msg'] = Yii::app()->user->getFlashes();
//echo CJSON::encode($response);
$this->redirect(array('index', 'categoryFeatureId' => $model->category_feature_id));
//Yii::app()->clientScript->scriptMap['*.js'] = false;
//Yii::app()->clientScript->scriptMap['*.css'] = false;
SELECT COUNT(*)
FROM (
SELECT `pf`.`product_id`
FROM `products` `p`
JOIN `products_feature` `pf` ON p.product_id = pf.product_id
WHERE
p.`category_id` = 151 AND
(pf.feature_id=5 AND (`value` IN ('1600')))
OR
(pf.feature_id=6 AND `value` IN ('1024', '2048'))
While you are logged into a server, you can run a script in detached mode by the following command:
nohup script >script.out 2>script.err &
Later when you log in again, you can check script.out for any output, and script.err for any error messages. If you want output and error messages in the same file, then do:
nohup script >script.out 2>&1 &
194.28.87.71
@damour
damour / gist:5773900
Created June 13, 2013 14:00
выйти из сеанса, не прерывая выполнения приложения
./programma
ctrl + Z
bg
disown -h
Когда нужно ее в foreground вернуть уже после нового входа на сервер по ssh :
fg
Список запущенных прог - команда jobs
$value_str = self::model()->find(
"category_id = :category_id AND feature_id = :feature_id",
array(
':category_id' => $category_id,
':feature_id' => $feature_id,
)
);
@damour
damour / gist:5721235
Created June 6, 2013 12:47
поиск дубликатов в таблице
SELECT login, COUNT(login) AS cnt
FROM users GROUP BY login
HAVING ( COUNT(login)>1 );
@damour
damour / gist:5395843
Created April 16, 2013 13:23
create phpdoc
php bin/phpdoc.php run -d ./src -t ./web/api
<?
//Controller:
if ($this->getRequest()->isXmlHttpRequest())
{
$response = new JsonResponse();
$response->setData(array(
'title' => $title,
'data' => $this->render('AcmeMainBundle:Default:index.html.twig'
)