-
Лучший говнокод
- В номинации:
-
- За время:
-
-
−124
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
Результат = Запрос.Выполнить();
Если Результат.Выгрузить().Количество() <> 0 Тогда
Выборка = Результат.Выбрать();
Пока Выборка.Следующий() Цикл
... тут некий код... и внутри контрольный в голову...
Если ТЗ.Количество() <> 0 Тогда
Для Каждого Строка Из ТЗ Цикл
...
КонецЦикла;
КонецЕсли;
...
КонецЦикла;
КонецЕсли;
Видимо это такая "оптимизация", другого объяснения подобным проверкам (это не единичный случай) не нашел.
Twilight_Sun,
27 Октября 2014
-
+40
- 1
cout << (100 << 1 << (3000 << 2)) << 4 << 2;
08.02.11 Теплый вечер. IDE. Code::Blocks. Цикл. Я чувствую как меня охватывает зверский аппетит.
12.02.11 Индия. Все в лучших традициях.
Потекло со стула.
Я не крестоблядь.
DesmondHume,
24 Октября 2014
-
+161
- 1
- 2
- 3
if (parseResult == parseResult) {
...
}
Кто поймёт, что тут проверяется - тот молодец.
KYJIBEPCTYKAC,
24 Октября 2014
-
−859
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
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 с нулевой датой не лечится, видимо, это баг движка.
bormand,
17 Октября 2014
-
+80
- 1
- 2
- 3
if (!driver.findElement(By.id(DD_LAUNCH_ID)).equals(null)) {
pause(1000);
}
Тогда уж почему не null.equals(...)?
Actine,
25 Сентября 2014
-
+76
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
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 так, как люблю его я?
codingHorror,
18 Сентября 2014
-
+79
- 1
- 2
// Number a, Number b
return new Double(a.doubleValue() - numericTolerance).compareTo(b.doubleValue()) < 0
В продолжение #16698, после рефакторинга. Видимо, диагноз: ООП головного мозга.
Actine,
17 Сентября 2014
-
−153
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
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
NeoliteBSD,
16 Сентября 2014
-
−161
- 1
- 2
- 3
- 4
- 5
- 6
error_response("400 Bad request", "") unless (<> =~ /^GET\s+(.+?)\s+HTTP\/1\.1\r$/);
my $request_url = $1;
log_message "REQUEST $request_url";
get_bans() if ($request_url =~ /^\/bans\?auth=$authkey$/);
remove_ban($1) if ($request_url =~ /^\/bans\/(\d+\.\d+\.\d+\.\d+)\/remove\?auth=$authkey$/);
error_response("404 Not found", "");
REST API через inetd (на этом серваке нету веб сервера, и ставить его влом). Новая жизнь старых технологий ;)
bormand,
09 Сентября 2014
-
+164
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
public function is_number($s){
$result = true;
for($i=0;$i<strlen($s); $i++){
switch($s[$i]){
case '0': break;
case '1': break;
case '2': break;
case '3': break;
case '4': break;
case '5': break;
case '6': break;
case '7': break;
case '8': break;
case '9': break;
default: $result = false; return;
}
}
return ($result) ? $s : int($s);
}
whiskeysam,
23 Августа 2014