- 1
for (; e.hasMoreElements();)
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+79
for (; e.hasMoreElements();)
смайлокод.
вот почему не while, объясните мне?
−20
void MainWindow::justDoIt(){
ui->textEdit->clear();
bool b[16];
for (int i = 0; i < 16; ++i) {
b[i] = false;
}
ui->textEdit->append("$$ \n \\begin{cases}");
QString a;
a += (ui->lineEdit->text().toDouble() == 0 ? "": (b[0] = true, ui->lineEdit->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_1" :ui->lineEdit->text().remove("+") + "x_1"));
a += (ui->lineEdit_2->text().toDouble() == 0 ? "" : (b[1] = true,ui->lineEdit_2->text().toDouble() < 0 || (!b[0])? "":"+") +(ui->lineEdit_2->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_2" : ui->lineEdit_2->text().remove("+")+"x_2"));
a += (ui->lineEdit_3->text().toDouble() == 0 ? "" : (b[2] = true,ui->lineEdit_3->text().toDouble() < 0 || (!b[0] && !b[1]) ? "":"+") +(ui->lineEdit_3->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_3" :ui->lineEdit_3->text().remove("+")+"x_3"));
a += (ui->lineEdit_4->text().toDouble() == 0 ? "" : (b[3] = true,ui->lineEdit_4->text().toDouble() < 0 || (!b[0] && !b[1] && !b[2])? "":"+") +(ui->lineEdit_4->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_4" :ui->lineEdit_4->text().remove("+")+"x_4"));
if(b[0] || b[1] || b[2] || b[3]){
a += "=";
a += ui->lineEdit_5->text();
a += "\\\\\n";
}
/*еще такой же код*/
a += (ui->lineEdit_24->text().toDouble() == 0 ? "" : (b[12] = true,ui->lineEdit_24->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_1" :ui->lineEdit_24->text()+"x_1"));
a += (ui->lineEdit_21->text().toDouble() == 0 ? "" : (b[13] = true,ui->lineEdit_21->text().toDouble() < 0 || (!b[13])? "":"+") +(ui->lineEdit_21->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_2" :ui->lineEdit_21->text().remove("+")+"x_2"));
a += (ui->lineEdit_23->text().toDouble() == 0 ? "" : (b[14] = true,ui->lineEdit_23->text().toDouble() < 0 || (!b[13]&&!b[14])? "":"+") +(ui->lineEdit_23->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_3" :ui->lineEdit_23->text().remove("+")+"x_3"));
a += (ui->lineEdit_22->text().toDouble() == 0 ? "" : (b[15] = true,ui->lineEdit_22->text().toDouble() < 0 || (!b[13]&&!b[14]&&!b[15])? "":"+") +(ui->lineEdit_22->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_4" :ui->lineEdit_22->text().remove("+")+"x_4"));
if(b[12] || b[13] || b[14] || b[15]){
a += "=";
a += ui->lineEdit_25->text();
}
ui->textEdit->append(a);
ui->textEdit->append("\\end{cases} \n$$");
}
Превращает матрицу 4х5 в СЛАР на LaTeX
+40
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+130
#define FOO /* a macro with a multiline comment
* gets the linecount wrong
*/
Splint will miscalculate line numbers after multi-line comments in macro definitions. For example,
+154
this.ie = (name=="ie" && this.v>=4)
this.activeX = ( this.ie ) ? true : false;
Кусочек шедевра
https://github.com/miketaylr/Snort/blob/master/snort.yml
+75
<input type="text" value="1" id="Count" size="1">
<a href="<?=$arResult["ADD_URL"]?>" rel="nofollow" onclick="return addToCart(this, 'catalog_detail_image', 'detail', '<?=GetMessage("CATALOG_IN_BASKET")?>');" id="catalog_add2cart_link"><span><img src="/upload/cart.jpg"></span>
+90
if ($value != 0) { // Если значение не равно нулю
$this->koeff = $value * 0.01; // Коэффициенту этого экземляра класса присвоить одну сотую от цены
$count++; // Счетчик увеличиваем на единицу
} else { // Иначе
$this->koeff=0; // Устанавливаем коэффициент этого экземпляра класса равным нулю
// Счетчик не увиличиваем
} // Конец условия
Код боевой не мой, комментарии авторские.
+70
if (sAttrName.equalsIgnoreCase("10")) {
+159
foreach ($metrics as $m)
{
eval('$data["'.$a.'"]["'.$m.'"] = $result->get'.$m.'();');
}
На одном из сайтов который объясняют как работать с гугл аналикс апи.
Нафига выполнять столько раз евал???
не легче и лучше
$key = 'get' . $m;
$data[$a][$m] = $result->{$key}();
евалить стопицот рас???
+1002
//pugiXML.cpp:
template <bool _1, bool _2, bool _3, bool _4> struct opt4_to_type
{
static const bool o1;
static const bool o2;
static const bool o3;
static const bool o4;
};
template <bool _1, bool _2, bool _3, bool _4> const bool opt4_to_type<_1, _2, _3, _4>::o1 = _1;
template <bool _1, bool _2, bool _3, bool _4> const bool opt4_to_type<_1, _2, _3, _4>::o2 = _2;
template <bool _1, bool _2, bool _3, bool _4> const bool opt4_to_type<_1, _2, _3, _4>::o3 = _3;
template <bool _1, bool _2, bool _3, bool _4> const bool opt4_to_type<_1, _2, _3, _4>::o4 = _4;
//...
case 0: return strconv_attribute_t(s, end_quote, opt4_to_type<0, 0, 0, 0>());
case 1: return strconv_attribute_t(s, end_quote, opt4_to_type<0, 0, 0, 1>());
case 2: return strconv_attribute_t(s, end_quote, opt4_to_type<0, 0, 1, 0>());
case 3: return strconv_attribute_t(s, end_quote, opt4_to_type<0, 0, 1, 1>());
case 4: return strconv_attribute_t(s, end_quote, opt4_to_type<0, 1, 0, 0>());
case 5: return strconv_attribute_t(s, end_quote, opt4_to_type<0, 1, 0, 1>());
//...
case 14: return strconv_attribute_t(s, end_quote, opt4_to_type<1, 1, 1, 0>());
case 15: return strconv_attribute_t(s, end_quote, opt4_to_type<1, 1, 1, 1>());
//...
inline xml_parse_result make_parse_result(xml_parse_status status, unsigned int offset, unsigned int line)
{
xml_parse_result result = {status, offset, line};
return result;
}
//pugixpath.cpp:
block = static_cast<memory_block*>(operator new(size + sizeof(memory_block) - xpath_memory_block_size));
PugiXML