- 1
is_zipped = not request.args.get('is_zipped', "false") == "false"
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−102
is_zipped = not request.args.get('is_zipped', "false") == "false"
>>> bool("false")
True
>>> bool("False")
True
почему бы не сделать их ложью
+142
function anal_display()
{
....
+74
public class Encoder {
public static void encode(final OutputStream out, Node node) throws IOException {
node.accept(new NodeVisitor() {
@Override
public void string(StringNode node) {
byte[] value = node.toByteArray();
out.write(Integer.toString(value.length).getBytes(Constants.CHARSET));
out.write(':');
out.write(value);
}
// ... другие методы для других типов нод ...
}
}
}
Решил поменять в паре-тройке модулей пачки ифов на паттерн visitor... И получил пинка от жабы ;(
write() кидает IOException, а значит и метод string() в анонимном классе тоже должен кидать, и метод string() в интерфейсе NodeVisitor тоже... Но ведь соседним посетителям этот IOException нахер не сдался...
Checked exceptions - зло.
+32
#include <iostream>
void f(char c) { std::cout << "f(char)" << std::endl; }
void f(signed char c) { std::cout << "f(signed char)" << std::endl; }
void f(unsigned char c) { std::cout << "f(unsigned char)" << std::endl; }
int main()
{
f('a');
f((signed char)('a'));
f((unsigned char)('a'));
return 0;
}
илитный ресурс сегодня мне раскрыл глаза на очередное крестоблядство керниган-гай-ричи-блядство:
с:
The implementation shall define char to have the same range, representation, and behavior as either signed char or unsigned char.
Irrespective of the choice made, char is a separate type from the other two and is not compatible with either.
с++:
Characters can be explicitly declared unsigned or signed. Plain char, signed char, and unsigned char are three distinct types.
+26
result.push_back(TVector<2>
(
(A-√(D))/C,
(E-Line.K()*√(D))/C
));
result.push_back(TVector<2>
(
(A+√(D))/C,
(E+Line.K()*√(D))/C
));
+141
...
ASSERT( sizeof(L"SystemPartition") <= sizeof(nameBuffer) );
/* Китайский код? Или по другому нельзя было запихнуть строку в ентот массив? */
nameBuffer[0] = L'S';
nameBuffer[1] = L'y';
nameBuffer[2] = L's';
nameBuffer[3] = L't';
nameBuffer[4] = L'e';
nameBuffer[5] = L'm';
nameBuffer[6] = L'P';
nameBuffer[7] = L'a';
nameBuffer[8] = L'r';
nameBuffer[9] = L't';
nameBuffer[10] = L'i';
nameBuffer[11] = L't';
nameBuffer[12] = L'i';
nameBuffer[13] = L'o';
nameBuffer[14] = L'n';
nameBuffer[15] = L'\0';
nameString.MaximumLength = sizeof(L"SystemPartition");
nameString.Length = sizeof(L"SystemPartition") - sizeof(WCHAR);
status = NtSetValueKey(setupHandle,
&nameString,
TITLE_INDEX_VALUE,
REG_SZ,
volumeNameString.Buffer,
volumeNameString.Length + sizeof(WCHAR)
);
...
В Мелкософт китайцев пригласили?
Кусок кода ядра Шindoшs ИТ
файл ioinit.c, строка 3312
+107
begin
writeln('Enter 1st number');
readln(a);
writeln('Enter 2st number');
readln(b);
writeln('Enter 3st number');
readln(c);
if a = b then if a = c then if b = c then ;
writeln('numbers are');
if a > b then if a = c then if b < c then
writeln('a Equally c and it is more b') ;
if a = b then if a > c then if b > c then
writeln('a Equally b and it is more c') ;
if a < b then if a < c then if b = c then
writeln('b Equally c and it is more a') ;
if a > b then if a > c then if b > c then
writeln('a it is more ') ;
if a > b then if a > c then if b < c then
writeln('a it is more ') ;
if a > b then if a > c then if b = c then
writeln('a it is more ') ;
if a < b then if a = c then if b > c then
writeln('b it is more ') ;
if a < b then if a > c then if b > c then
writeln('b it is more ') ;
if a < b then if a < c then if b > c then
writeln('b it is more ') ;
if a = b then if a < c then if b < c then
writeln('c it is more ') ;
if a > b then if a < c then if b < c then
writeln('c it is more ') ;
if a < b then if a < c then if b < c then
writeln('c it is more ') ;
Такое выдал один из моих учеников в 10м классе после того, как отказался учится рисовать блок-схемы и сказал, что сразу сможет писать. Задание заключалось в том, чтобы программа выводила большее из 3х введенных пользователем чисел.
+953
var result = System.Windows.Forms.MessageBox.Show("Ви дійсно бажаєте видалити платника?", "Видалення платників", System.Windows.Forms.MessageBoxButtons.YesNo);
if (result == System.Windows.Forms.DialogResult.Yes)
{
DeleteWithoutRedirect(ReducingPayerID);
red_pay_list.RemoveAt(e.RowIndex);
}
это Code-Behind aspx страницы
Это писал "большой начальник" на укрПочте. Берегитесь Позывая. Он настолько суров, что гавнокодит сразу на 3 языках
+164
inline ~Scene() {
while( boxList.size() > 0 ) {
boxList.erase( boxList.begin() );
}
while( sphereList.size() > 0 ) {
sphereList.erase( sphereList.begin() );
}
while( lightList.size() > 0 ) {
lightList.erase( lightList.begin() );
}
}
http://www.gamedev.ru/code/forum/?id=136478&page=6#m82
+164
ULONG LCard791::SetChn(int _gain,int _channel)
{
ULONG ret;
if(isDiff)
ret=_channel&15;
else
{
ret=_channel&31;
ret|=1<<5;
}
int gain;
switch(_gain)
{
case 1:
gain=0;
break;
case 2:
gain=1;
break;
case 4:
gain=2;
break;
case 8:
gain=3;
break;
case 16:
gain=4;
break;
case 32:
gain=5;
break;
case 64:
gain=6;
break;
case 128:
gain=7;
break;
default:
gain=0;
}
ret|=gain<<6;
return(ret);
}
Есть у нас один мужик, которые такие шедевры творит. Хакер сновидений, РАГ - мы с тобой!