buildkernel config: illegal option — I
Лекарство:
cd /usr/src&&/usr/bin/make kernel-toolchain
buildkernel config: illegal option — I
cd /usr/src&&/usr/bin/make kernel-toolchain
root@www:/usr/ports # cd /usr/ports/security/letsencrypt.sh root@www:/usr/ports/security/letsencrypt.sh # make install ====> Compressing man pages (compress-man) ===> Installing for letsencrypt.sh-0.2.0 ===> Checking if letsencrypt.sh already installed ===> Registering installation for letsencrypt.sh-0.2.0 Installing letsencrypt.sh-0.2.0... To use this script you should copy the examples in /usr/local/etc/letsencrypt.sh/ and at least add a domain and a contact mail address. You should also copy the openssl.cnf.sample file in /usr/local/openssl so you won't get warnings about it missing. In order to run the script regularly to update the certificates add this line to /etc/periodic.conf weekly_letsencrypt_enable="YES" Additionally the following parameters can be added to /etc/periodic.conf To run the certification renenewal as a different user weekly_letsencrypt_user="_letsencrypt" To run a script after the renewal (as root) weekly_letsencrypt_deployscript="/usr/local/etc/letsencrypt.sh/deploy.sh"я добавил только одну строчку weekly_letsencrypt_enable=»YES», пусть рутом работает
root@www:/usr/local/etc/letsencrypt.sh # cat domains.txt mneti.ru www.mneti.ruв config.sh подправим, это обязательно, папка используется для обмена в процессе аутентификации домена
# Output directory for challenge-tokens to be served by webserver or deployed in HOOK (default: $BASEDIR/.acme-challenges) #WELLKNOWN="${BASEDIR}/.acme-challenges" WELLKNOWN="/usr/local/www/nginx-mneti/.well-known/acme-challenge"Иначе получим ошибку
root@www:/usr/local/etc/letsencrypt.sh # /usr/local/bin/letsencrypt.sh -c # INFO: Using main config file /usr/local/etc/letsencrypt.sh/config.sh Processing mneti.ru with alternative names: www.mneti.ru + Signing domains... + Generating private key... + Generating signing request... + Requesting challenge for mneti.ru... + Requesting challenge for www.mneti.ru... + Responding to challenge for mneti.ru... ERROR: Challenge is invalid! (returned: invalid) (result: { "type": "http-01", "status": "invalid", "error": { "type": "urn:acme:error:unauthorized",
root@www:/usr/local/etc/letsencrypt.sh # /usr/local/bin/letsencrypt.sh -c # INFO: Using main config file /usr/local/etc/letsencrypt.sh/config.sh Processing mneti.ru with alternative names: www.mneti.ru + Signing domains... + Generating private key... + Generating signing request... + Requesting challenge for mneti.ru... + Requesting challenge for www.mneti.ru... + Responding to challenge for mneti.ru... + Challenge is valid! + Responding to challenge for www.mneti.ru... + Challenge is valid! + Requesting certificate... + Checking certificate... + Done! + Creating fullchain.pem... + Done!В конфиге виртуального хоста включим ssl, пропишем пути к сертификату и ключу и редирект на https если пришли на http
# another virtual host using mix of IP-, name-, and port-based configuration # server { <------>listen 80; listen 443 ssl; <------>ssl_certificate /usr/local/etc/letsencrypt.sh/certs/mneti.ru/cert.pem; <------>ssl_certificate_key /usr/local/etc/letsencrypt.sh/certs/mneti.ru/privkey.pem; server_name mneti.ru *.mneti.ru; <------>access_log /var/log/nginx/mneti.access_log; error_log /var/log/nginx/mneti.error_log info; .... <------>if ($ssl_protocol = "") { <------> return 301 https://$server_name$request_uri; <------>} root /usr/local/www/nginx-mneti; index index.html index.htm index.php; location / { <--> try_files $uri $uri/ /index.php; <------>} location ~ \.php$ { <------> fastcgi_pass 127.0.0.1:9000; <------> fastcgi_index index.php; <------> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; <------> fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root:/tmp:/var/tmp"; <------> include fastcgi_params; <------>} }Обнаружилась проблемка, часть мобильных браузеров сертификат не признавали, все потому что им нужны промежуточные сертификаты вплоть до корневого, полная цепочка, клиент Letencrypt.sh и об этом позаботился, просто заменим в конфиге нгинкса
# ssl_certificate /usr/local/etc/letsencrypt.sh/certs/mneti.ru/cert.pem; ssl_certificate /usr/local/etc/letsencrypt.sh/certs/mneti.ru/fullchain.pem;
select max(m.id), m.someId keep (DENSE_RANK FIRST ORDER BY m.UpdateDate desc) from MyTable m group by m.someIdИсходные данные
id UpdateDate someId 1 20-01-2012 10 2 20-01-2012 10 3 01-01-2012 10 4 10-02-2012 20 5 01-02-2012 20 6 01-04-2012 30Результат
2 10 4 20 6 30И конечно это будет работать и на Оракле.
select m.* from (select *, row_number() over (partition by m.someid ORDER BY m.UpdateDate desc, m.id desc) as seqnum from MyTable m ) m where seqnum = 1Результат,
группировки снаружи не нужно, группировка идет по окну over (partition by m.someid max(m.id) заменен сортировкой в окне ORDER BY .... m.id DESC
id UpdateDate someId seqnum 2 2012-01-20 00:00:00.000 10 1 4 2012-02-10 00:00:00.000 20 1 6 2012-04-01 00:00:00.000 30 1
function hack1() { var cur = $('#select1').prop('selectedIndex'); $('#select1').prop('selectedIndex', -1); $('#select1').prop('selectedIndex', cur); }
Задача, в таблице есть строки с некоторыми стилями флагами, код и js недоступен, только css, нужно проставить title атрибут, некий аналог. tr.is-foreign:hover td:nth-child(2):before { position: absolute; background: #fff; border: 1px solid grey; border-radius: 3px; color: #000; padding: 4px 6px; margin-top: -24px; content: "\421\418\20\43D\430\20\0437\430\43C\435\43D\443"; } От "Чужое СИ" взял Unicode Entities, получил %u0427%u0443%u0436%u043E%u0435%20%u0421%u0418 %u0 заменяем на \, %u на \ получаем значение content
session_id('cron'); //используем именованную сессию, имя файла сессии sess_cron session_start(); if ($this->session->has(__METHOD__)) { $attemptCount = intval($this->session->get('attemptCount-' . __METHOD__)); $this->session->set('attemptCount-' . __METHOD__, ++$attemptCount); printf("Run at: %s\r\n", date('c', intval($this->session->get(__METHOD__)))); return; } else { $this->session->set(__METHOD__, $_SERVER["REQUEST_TIME_FLOAT"]); $this->session->set('attemptCount-' . __METHOD__, 1); session_write_close(); // закроем сессию, снимем с нее блокировку иначе следующие скрипты не смогут ничего прочитать и будут ждать в очереди, а нам нужен другой эффект } sleep(300); //тут что-то делаем //снимаем блокировку session_id('cron'); session_start(); $this->session->remove(__METHOD__);
если хотим аналог мьютекса, то достаточно только session_id(‘cron’) и все, все скрипты в очереди на ожидание ресурса — файла сессии
(function () { /* do something */ })()
#php 5.3
$ttttar212 = ['asf',['asd','qwer2'],'qwe'];
$inttttar = 0;
call_user_func(function($cont_act, $ttttar212) use (&$inttttar) {
foreach ($ttttar212 as $v) {
if ($cont_act[0] === $v || $cont_act === $v) {
$inttttar++;
break;
}
}
}, ['qwe','qwer'], $ttttar212);
// если совпадает с внутренними (с виртуальными) то тоже подсветим
if ($data->active == 0 && isset($data->virtual) && is_array($data->virtual)) {
call_user_func(function($cont_act, $ttttar) use (&$data) {
foreach ($ttttar as $v) {
if ($cont_act[0] === $v || $cont_act === $v) {
$data->active++;
break;
}
}
}, [$controllerName, $actionName], $data->virtual);
// $data->active += (int)in_array($controllerName, $data->virtual);
// $data->active += (int)in_array([$controllerName,$actionName], $data->virtual);
}
alter table m_listDocs add contractId int not null
alter table m_listDocs add contractId int
update m_listDocs set contractId = 0
alter table m_listDocs alter column contractId int not null