Displaying 211-220 of 274 results.
Resolved: MySQL get most popular categories with posts counts (category and posts tables)
posted by admin on March 16, 2016
I have categories table btbl_category

CREATE TABLE btbl_category(
id int auto_increment primary key,
name varchar(20)
);

INSERT INTO btbl_category (name)
VALUES
('one'),('two'),('three'),('four');

INSERT INTO apps (app_category)
VALUES
(2),(4),(2),(1);


I have categories table btbl_post

CREATE TABLE btbl_post
(
id int auto_increment primary key,
category_id int,
);

INSERT INTO btbl_post (category_id)
VALUES
(2),(4),(2),(1);


I want to select most popular categories with countsRead more
Resolved: MySQL задание менеджер, продукт, заявки, продажы. Задача из собеседования - PHP разработчик
posted by admin on March 16, 2016
Даны следующие две таблицы:

--
-- Структура таблицы `claim`
--
CREATE TABLE IF NOT EXISTS `claim` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`manager_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`sum` float NOT NULL,
PRIMARY KEY (`id`),
KEY `manager_id` (`manager_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;
--
-- Дамп данных таблицы `claim`
--

INSERT INTO `claim` (`id`, `manager_id`, `created_at`, `sum`) VALUES
(1, 1, '2013-07-18 10:23:08', 256.128),
(2, 3, '2013-07-18 13:29:49', 512.1),
(3, 4, '2013-07-19 16:29:07', 123),
(4, 4, '2013-07-18 17:35:53', 321),
(5, 4, '2013-06-19 15:31:46', 756),
(6, 1, '2013-06-05 10:47:26', 265),
(7, 2, '2013-05-31 20:27:38', 354),
(8, 4, '2013-07-17 15:48:20', 798.12);
----------------------------------------------------------

--
-- Структура таблицы `manager`
--
CREATE TABLE IF NOT EXISTS `manager` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(32) CHARACTER SET latin1 NOT NULL,
`last_name` varchar(32) CHARACTER SET latin1 NOT NULL,
`email` varchar(32) CHARACTER SET latin1 NOT NULL,
`chief_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `chief_id` (`chief_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
--
-- Дамп данных таблицы `manager`
--
INSERT INTO `manager` (`id`, `first_name`, `last_name`, `email`, `chief_id`) VALUES
(1, 'Simple', 'Manager', '', 2),
(2, 'Super', 'Manager', '', NULL),
(3, 'Third ', 'Manager', '', 2),
(4, 'Just', 'Manager', '', NULL);

--
-- Ограничения внешнего ключа таблицы `claim`
--
ALTER TABLE `claim`
ADD CONSTRAINT `claim_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `manager` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Ограничения внешнего ключа таблицы `manager`
--
ALTER TABLE `manager`
ADD CONSTRAINT `manager_ibfk_1` FOREIGN KEY (`chief_id`) REFERENCES `manager` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;


Задача 1

Напишите sql-запрос, выбирающий информацию по каждому менеджеру, включая количество связанных с ним заявок и их общую сумму (в 2 дополнительных поля: claim_count, claim_total_sum).


Задача 2

Напишите запрос, который выведет двух менеджеров, у которых количество связанных заявок меньше, чем у остальных. При этом, объедините значения first_name и last_name в одно поле full_name.
Read more
Resolved: Wordpress call translation from po pot files in theme
posted by admin on March 16, 2016
I have po mo translation files, and I want to call my translation and use in my theme.
My theme name mytheme
I want to make my theme multilanguage, and make it by right way.
I created directory

mytheme/languages


I created my po mo files

mytheme/languages/ru_RU.po
mytheme/languages/ru_RU.mo


In wp-config.php file I add

define ('WPLANG', 'ru_RU');


In my header.php i call translation function

<?php echo __("Videos", "mytheme"); ?>


But it is not working, not translating.Read more
Resolved: Wordpress How to Add or Remove row in Po Pot translation file
posted by admin on March 16, 2016
I want to add or remove translation row in po pot file in wordpress.

I have poEditor, but I cant find Add Button, or Remove Button, or functionality like this.Read more
Resolved: Awesome fonts Fa icons hover underline
posted by admin on March 14, 2016
In fa icon hover I see underline, like shadow. How to remove it

HTML code:

<a class="fa fa-instagram fa-2x insta" href="http://isystems.am"></a>
Read more
Resolved: Wordpress enqueue include style.css in header head
posted by admin on March 14, 2016
I want to know the right way to enqueue include style.css in header head.Read more
Resolved: Yii Captcha Broken Image
posted by admin on March 12, 2016
The captcha image is broken (no image appearing). The other components of captcha (links, error matching code etc) seem to work correctly

In Controller:

public function actions() {
return array(
'captcha' => array(
'class' => 'CCaptchaAction',
'backColor' => 0xFFFFFF,
),
);
}


In View:

<?php if (CCaptcha::checkRequirements()): ?>
<div class="row">
<?php echo $form->labelEx($model, 'verifyCode'); ?>
<div>
<?php $this->widget('CCaptcha'); ?>
<?php echo $form->textField($model, 'verifyCode'); ?>
</div>
<div class="hint">Please enter the letters as they are shown in the image above.

Letters are not case-sensitive.</div>
<?php echo $form->error($model, 'verifyCode'); ?>
</div>
<?php endif; ?>


In Model:

public $verifyCode;
....
public function rules() {
return array(
....
....
array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements()),
);
}


Why I have this problem?Read more
Resolved: JavaScript jQuery add attribute to links, which is not belong to website and locate to another resource
posted by admin on March 11, 2016

<a href="http://isystems.am">sadsa dasd as ds</a>
<a href="http://forum.isystems.am"> sd s f f d f</a>
<a href="http://autoservice.am"> sd s f f d f</a>
<a href="http://classyluxury.ru"> sd s f f d f</a>
<a href="http://polusportpoluklassika.ru"> sd s f f d f</a>
<a href="http://classystyle.ru"> sd s f f d f</a>


I want to add attribute to my all links, which is not locate to my website. I want to open another links in new window, not in self window. I want to do it after page will be loaded.Read more
Resolved: PHP replace words in string array without case sensitive
posted by admin on March 11, 2016
I want to replace words in array string, only single word, without contains in another word, only, when the word in format SPACE+WORD+SPACE.

For example

$string = ['Москва — город герой!', 'москва не резиновая', 'москватека не резиновая', 'текамоскватека не резиновая', 'текамосква не резиновая'];


I want to replace all "Москва", and "москва" to Moscow, and get result output like

Array ( [0] => Moscow — город герой! [1] => Moscow не резиновая [2] => москватека не резиновая [3] => текамоскватека не резиновая [4] => текамосква не резиновая )
Read more
Resolved: Three table MySQL relation task, city, product, sale max join query
posted by admin on March 11, 2016
We have three tables, city, product, sale

city
  • id PK AI INT(10)
  • name VARCHAR(50)


product
  • id PK AI INT(10)
  • name VARCHAR(50)


sale
  • id PK AI INT(10)
  • city_id INT(10)
  • product_id INT(10)
  • amount INT(10)
  • total_price INT(10)


Task, Задача

Написать SQL-запрос, который выведет результат вида: город, товар, количество проданного товара, итоговая сумма. Т.е. для каждого города и для каждого товара нужно вывести сколько было продано данного товара и на какую сумму. Если в каком-то городе какой-то товар не был продан вовсе — выводить нули в полях "количество" и "сумма".
Read more