- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
void input (char inpt [64])
{
for (;;)
{
int i(0);
cin >> inpt;
i ++;
if (inpt[i] == '\n')
inpt[i] = '\0';break;
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+55
void input (char inpt [64])
{
for (;;)
{
int i(0);
cin >> inpt;
i ++;
if (inpt[i] == '\n')
inpt[i] = '\0';break;
}
}
+155
function generateSession()
{
$chars = "qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP";
$max = rand(20, 32);
$size = StrLen($chars) - 1;
$sessionID = null;
while ($max--)
$sessionID .= $chars[rand(0, $size)];
return $sessionID;
}
−124
Результат = Запрос.Выполнить();
Если Результат.Выгрузить().Количество() <> 0 Тогда
Выборка = Результат.Выбрать();
Пока Выборка.Следующий() Цикл
... тут некий код... и внутри контрольный в голову...
Если ТЗ.Количество() <> 0 Тогда
Для Каждого Строка Из ТЗ Цикл
...
КонецЦикла;
КонецЕсли;
...
КонецЦикла;
КонецЕсли;
Видимо это такая "оптимизация", другого объяснения подобным проверкам (это не единичный случай) не нашел.
+40
cout << (100 << 1 << (3000 << 2)) << 4 << 2;
08.02.11 Теплый вечер. IDE. Code::Blocks. Цикл. Я чувствую как меня охватывает зверский аппетит.
12.02.11 Индия. Все в лучших традициях.
Потекло со стула.
Я не крестоблядь.
+161
if (parseResult == parseResult) {
...
}
Кто поймёт, что тут проверяется - тот молодец.
−859
create table test(
id integer primary key auto_increment,
d datetime not null
);
insert into test(id) values (1);
-- а сейчас я покажу вам особую уличную магию
select *, d is null, d is not null from test;
select *, d is null, d is not null from test
where d is not null;
select *, d is null, d is not null from test
where d is null; -- WTF?!
select *, d is null, d is not null from test
where d is not null and d is null; -- WTF?!
Все 4 select'а выводят одинаковый результат... MySQL такой MySQL...
P.S. Вставка всякой херни вместо вывода ошибки лечится добавлением STRICT_ALL_TABLES в sql_mode. А вот where с нулевой датой не лечится, видимо, это баг движка.
+80
if (!driver.findElement(By.id(DD_LAUNCH_ID)).equals(null)) {
pause(1000);
}
Тогда уж почему не null.equals(...)?
+76
function returnUserId() {
if (document.getElementById('userstap') != null ) {
var obj = document.getElementById('userstap');
<% if ((sUserIdForPrint != null) && !sUserIdForPrint.equals("")) {%>
if (obj.options[obj.selectedIndex].value == 0) {
return "<%=sUserIdForPrint%>";
<% } %>
<% if (((sAccGrpUserIdForPrint != null) && !sAccGrpUserIdForPrint.equals("")) && ((sUserIdForPrint != null) && !sUserIdForPrint.equals(""))) {%>
} else if (obj.options[obj.selectedIndex].value == 1 ) {
return "<%=sAccGrpUserIdForPrint%>";
<% } else if ((sAccGrpUserIdForPrint != null) && !sAccGrpUserIdForPrint.equals("")){%>
if (obj.options[obj.selectedIndex].value == 1 ) {
return "<%=sAccGrpUserIdForPrint%>";
<% } %>
<% if (((sAccGrpUserIdForPrint != null) && !sAccGrpUserIdForPrint.equals("")) || ((sUserIdForPrint != null) && !sUserIdForPrint.equals(""))) {%>
} else if (obj.options[obj.selectedIndex].value == 2) {
return "<%=userId%>";
}
<% } else {%>
if (obj.options[obj.selectedIndex].value == 2) {
return "<%=userId%>";
}
<% } %>
} else {
return "<%=userId%>";
}
}
Любите ли вы JSP так, как люблю его я?
+79
// Number a, Number b
return new Double(a.doubleValue() - numericTolerance).compareTo(b.doubleValue()) < 0
В продолжение #16698, после рефакторинга. Видимо, диагноз: ООП головного мозга.
−153
eval {
my $from = $class->get_env_sender($message);
$smtp->mail($from)
|| croak("Email::Send::Gmail: error sending 'from' $from");
my @to = $class->get_env_recipients($message);
my @ok = $smtp->to( @to, { SkipBad => 1 } )
|| croak("Email::Send::Gmail: error sending 'to' @to");
if ( @to != @ok ) {
my %to;
@to{@to} = (1) x @to;
delete @to{@ok};
@bad = keys %to;
}
croak("Email::Send::Gmail: no valid recipients") if @bad == @to;
};
Думаю понятно, какой это модуль с CPAN. Убило незнание приоритетов, в результате чего "|| croak" всегда возвращало в @ok число вместо результата выполнения $smtp->to