- 1
_workflowQueue = new Queue<IWorkflowInfo>(_workflowQueue.Where(w => !(w == workflow || w.WorkflowGuid == workflow.WorkflowGuid)));
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
_workflowQueue = new Queue<IWorkflowInfo>(_workflowQueue.Where(w => !(w == workflow || w.WorkflowGuid == workflow.WorkflowGuid)));
Вот как надо делать, если из очереди нужно удалить произвольный элемент.
Использовать List?! Это для слабаков!
+3
* @return boolean "No! Try not. Do. Or do not. There is no try." - Yoda
+106
< !DOCTYPE html >
< html >
< head >
< title >Температура процессора< /title >
< meta http-equiv="content-type" content="text/html; charset=windows-1251" / >
< asm >
mov dx, 295h
mov al, 4Eh
out dx, al
inc dx
in al, dx
or al, 1
out dx, al
dec dx
mov al, 50h
out dx, al
in al, dx
mov #temperature, al
< /asm >
< /head >
< body >
< span id="temperature" >< /span >
< /body >
< /html >
https://otvet.mail.ru/question/185609056
0
if (document.querySelector('.instruction-wrapper')) {
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = (function() {
return window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame
})();
}
var animator = {
stageArray: [
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
[14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
],
// min:16,max:25,
element: document.querySelector('.instruction-wrapper'),
originalClassName: 'instruction-wrapper',
currentStage: 1,
currentStep: 0,
oldTime: new Date().getTime(),
timeStep: 1200,
addStateClass: 'state-', //+stateRange.currentStep
chaning: true,
repeat: true,
debug: true,
autoplay: true,
animate: function() {
requestAnimationFrame(animator.animate);
if (animator.autoplay) {
animator.draw();
}
},
classCheckUpdate: function(arg1) {
this.element.className = this.originalClassName;
for (var i = 0; i <= arg1; i++) {
this.element.classList.add(this.addStateClass + '' + i);
}
},
draw: function(arg) {
var time = new Date().getTime();
// console.log(time - oldTime);
if (time > this.oldTime + this.timeStep) {
if (this.debug) {
console.log(this.currentStep)
};
this.oldTime = time;
if (!arg && !!this.stageArray[this.currentStage][this.currentStep + 1]) {
console.log('instr-' + 1 + '_' + this.stageArray[this.currentStage][this.currentStep + 1]);
this.currentStep += 1;
this.classCheckUpdate(this.stageArray[this.currentStage][this.currentStep])
// this.element.classList.add(this.addStateClass + '' + this.stageArray[this.currentStage][this.currentStep]);
} else if (!arg && !this.stageArray[this.currentStage][this.currentStep + 1] && !!this.repeat) {
this.currentStep = 0;
console.log('instr-' + 2);
this.classCheckUpdate(this.stageArray[this.currentStage][this.currentStep])
// this.element.className = this.originalClassName;
// this.element.classList.add(this.addStateClass + '' + this.stageArray[this.currentStage][this.currentStep]);
} else if (!this.stageArray[this.currentStage][this.currentStep + 1] &&
!this.repeat &&
this.stageArray[this.currentStage + 1]) {
this.currentStage += 1;
console.log('instr-' + 3);
this.currentStep = this.stageArray[this.currentStage + 1][0];
} else if (arg > 1) {
console.log('instr-' + 4);
this.element.className = this.originalClassName;
for (var i = 0; i <= arg; i++) {
this.element.classList.add(this.addStateClass + '' + i);
this.element.classList.add(this.addStateClass + '' + this.stageArray[this.currentStage][this.currentStep]);
}
}
}
}
}
animator.animate();
}
Перекулючение классов для анимационного сценария
0
<?
//Ограничиваем время выполнения скрипта 3-мя минутами
set_time_limit(180);
//Подключаемся к MySQL, при неудаче выводим ошибку
mysql_connect("localhost", "torrent", "password") or die("Could not connect to MySQL");
//Выбираем БД, при неудаче выводим ошибку
mysql_select_db("torrent") or die("Could not select database");
//Переводим все общение с БД в кодировку utf8
mysql_query("SET NAMES utf8");
//Открываем файл указанный в url переменной "f"
$fp = fopen($_GET[f], "r");
//Запускаем цикл до конца строк в файле
while (!feof($fp)) {
//Считываем строку (да, функцию trim() выполнять не обязательно, но у каждого программиста свои "тараканы")
$tmp = trim(fgets($fp));
//Преобразуем строку в массив. За разделитель используем ";"
$torrent = explode('";"', $tmp);
//В первом и последнем элементе удаляем лишние символы "
$torrent[0] = substr($torrent[0], 1);
$torrent[6] = substr($torrent[6], 0, (strlen($torrent[6]) - 1));
//Если раскомментировать следующую строку, то можно увидеть как распарсился первый торрент в файле
//print '<pre>'; print_r($torrent); exit();
//Вставляем данные текущего торрента в таблицу
mysql_query("INSERT INTO `torrents`
(`name`,
`hash`,
`date`,
`size`,
`topic_id`,
`cat_id`,
`cat_name`)
VALUES
('" . mysql_real_escape_string($torrent[4]) . "',
'" . $torrent[3] . "',
'" . $torrent[6] . "',
'" . $torrent[5] . "',
'" . $torrent[2] . "',
'" . $torrent[0] . "',
'" . mysql_real_escape_string($torrent[1]) . "')
");
}
//Закрываем файл
fclose($fp);
//Выводим сообщение о завершении работы
print 'complete: ' . $_GET[f];
?>
Импорт CSV в MySQL. Со швабры.
+4
<font size="2" face="Courier New" color="black"><font color="#0000ff"><</font><font
color="#800000">video</font><font color="#0000ff">></font> <font
color="#0000ff"><</font><font color="#800000">source</font> <font
color="#ff0000">src</font><font color="#0000ff">="movie.mp4"</font> <font
color="#ff0000">type</font><font color="#0000ff">='video/mp4; codecs="avc1.42E01E,
mp4a.40.2"'</font> <font color="#0000ff">/></font> <font color="#0000ff"><</font><font
color="#800000">source</font> <font color="#ff0000">src</font><font
color="#0000ff">="movie.webm"</font> <font color="#ff0000">type</font><font
color="#0000ff">='video/webm; codecs="vp8, vorbis"'</font> <font color="#0000ff">
/></font> <font color="#0000ff"></</font><font color="#800000">video</font><font
color="#0000ff">></font></font>>
«Итак, чтобы видео появилось на вашей веб-страничке пишем следующий код»
0
// channel.h
#pragma once
namespace AMQP {
class Channel
{
private:
std::shared_ptr<ChannelImpl> _implementation;
public:
Channel(Connection *connection) : _implementation(new ChannelImpl())
{
// attach the connection to the channel
_implementation->attach(connection);
}
Channel(const Channel &channel) = delete;
virtual ~Channel()
{
// close the channel (this will eventually destruct the channel)
_implementation->close();
}
//...
};
// ---------------------------------------------------------
// amqpcpp.h
/**
* AMQP.h
*
* Starting point for all includes of the Copernica AMQP library
*
* @documentation public
*/
#pragma once
// base C++ include files
#include <vector>
#include <string>
#include <memory>
#include <map>
//...
// base C include files
#include <stdint.h>
#include <math.h>
// forward declarations
#include <amqpcpp/classes.h>
// utility classes
#include <amqpcpp/endian.h>
#include <amqpcpp/buffer.h>
#include <amqpcpp/bytebuffer.h>
//...
// amqp types
#include <amqpcpp/field.h>
#include <amqpcpp/numericfield.h>
#include <amqpcpp/decimalfield.h>
#include <amqpcpp/stringfield.h>
//...
// envelope for publishing and consuming
#include <amqpcpp/metadata.h>
#include <amqpcpp/envelope.h>
#include <amqpcpp/message.h>
// mid level includes
#include <amqpcpp/exchangetype.h>
#include <amqpcpp/flags.h>
#include <amqpcpp/callbacks.h>
#include <amqpcpp/deferred.h>
#include <amqpcpp/deferredconsumer.h>
#include <amqpcpp/deferredqueue.h>
#include <amqpcpp/deferreddelete.h>
#include <amqpcpp/deferredcancel.h>
#include <amqpcpp/deferredget.h>
#include <amqpcpp/channelimpl.h>
#include <amqpcpp/channel.h>
//...
https://github.com/CopernicaMarketingSoftware/AMQP-CPP
0
if ($this->scenario == 'registration' || $this->scenario = 'changePassword') {
$this->password = HPasswordHelper::hashPassword($this->password);
}
Вот так сравнение сценарий в одном из проектов)))
И самое странное всегда при сохранении, сценарий "changePassword" )
−1
#define GUIDSTR(s) __uuidof(class DECLSPEC_UUID(s) __guid_##__COUNTER__)
Может можно покороче?
0
if( sync_ip_index < 0 && result() ) {
QString tmp = tr(", нет синхронизации");
addResultMessage( false, p->dev(), tmp);
p->dev()->setState( CDiagramObject::e_Warning );
setResult( false );
}
else if ( sources_from_xml.indexOf( sources_from_ntpq[ sync_ip_index ] ) < 0) {
// ( ( (sync_ip_index >= 0) ? ( sources_from_xml.indexOf( sources_from_ntpq[ sync_ip_index ] ) < 0 ) : false ) ) {
// (p1 ( p2 ) ( p3 ( f1 ) )
// p1..3 - predicates
// Check sync_ip_index >= 0 (p2)
// true, then
// find sync source ip in list filled from xml config , and if there is finded, (p3) are true, else (p3) are false, and then (p1) will be false
// false, then
// (p1) will be false
// This construction for one string check syncronized source ip for host, if host not synchronized
QString tmp = tr(", хост синхронизирован с источником не указанным в схеме");
addResultMessage( false, p->dev(), tmp);
p->dev()->setState( CDiagramObject::e_Warning );
setResult( false );
}
Под конец рабочего дня уже поехала крыша, см. комментарии.