- 1
- 2
- 3
class UnathorizedDevice : ArgumentException { public UnathorizedDevice() : base() { } }
class LocalException : ArgumentException { public LocalException(string message) : base(message) { } }
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+134
class UnathorizedDevice : ArgumentException { public UnathorizedDevice() : base() { } }
class LocalException : ArgumentException { public LocalException(string message) : base(message) { } }
Говно или не говно? Мне кажется первое
+69
"add()\n";
assert((row_indx >= 0 && row_indx <= rows) &&
(col_indx >= 0 && col_indx < cols)
);
if(row_indx == rows)
addRow();
if(init_flag_arr[row_indx][col_indx])
{
std::cout « "in moving\n";
int uninit_i, uninit_j;
bool found = false;
for(int i = row_indx; found == false && i < rows; i++)
for(int j = col_indx; found == false && j < cols; j++)
if(!init_flag_arr[i][j]) // если флаг == false
{
std::cout « "found!\n";
uninit_i = i;
uninit_j = j;
found = true;
}
if(!found)
{
std::cout « "not found!\n";
addRow(); // добовляем новую строку в матрицу (rows++)
uninit_i = rows - 1;
uninit_j = 0;
}
bool exit = false;
for(int i = uninit_i, j = uninit_j; exit == false; i--)
{
for(; ;j--)
{
if(j == col_indx && i == row_indx)
{
exit = true;
break;
}
if(j == 0)
{
matrix[i][j] = matrix[i - 1][cols - 1];
init_flag_arr[i][j] = init_flag_arr[i - 1][cols - 1];
break;
}
matrix[i][j] = matrix[i][j - 1];
init_flag_arr[i][j] = init_flag_arr[i][j - 1];
}
j = cols - 1;
}
}
matrix[row_indx][col_indx] = obj;
init_flag_arr[row_indx][col_indx] = true;
std::cout « "end add()\n";
}
// Для дебага, вывод инициализированных ячеек матрицы
void Matrix::InitTable(std::ostream& os)const // чисто для дебага
{
for(int i = 0; i < rows; i++)
{
for(int j = 0; j < cols; j++)
if(!init_flag_arr[i][j])
os « "false\t";
else
os « "true\t";
os « std::endl;
}
}
// Удаление объекта с матрицы
void Matrix::remove(int row_indx, int col_indx)
{
std::cout « "remove()\n";
assert((row_indx >= 0 && row_indx < rows) &&
(col_indx >= 0 && col_indx < cols)
);
matrix[row_indx][col_indx] = 0;
init_flag_arr[row_indx][col_indx] = false;
std::cout « "end remove()\n";
}
void Matrix::removeRow(int row_indx)
{
assert(row_indx >= 0 && row_indx < rows);
int** new_matrix = new int*[rows - 1];
bool** new_init_flag_arr = new bool*[rows];
for(int i = 0; i < rows - 1; i++)
{
new_matrix[i] = new int[cols];
new_init_flag_arr[i] = new bool[cols];
//for(int j = 0; j < cols; j++)
//{
// new_matrix[i][j] = 0;
// new_init_flag_arr[i][j] = false;
//}/
...
+157
# http://habrahabr.ru/post/227277/
# открыл первый попавшийся скрипт на гитхабе по ссылке в посте, дальше не читал
function validate_email($str)
{
return preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/',$str);
}
−166
CREATE OR REPLACE FUNCTION "GET_SOTR_FULL_NAME" (sotr_id in number)
RETURN varchar2 IS
cursor surname (sotr_id number)
is
select fc_fam from tsotr
where tsotr.fk_id=sotr_id;
cursor name (sotr_id number)
is
select fc_name from tsotr
where tsotr.fk_id=sotr_id;
cursor patronym (sotr_id number)
is
select fc_otch from tsotr
where tsotr.fk_id=sotr_id;
fio varchar2(90);
fam varchar2(30);
im varchar2(30);
otch varchar2(30);
BEGIN
open surname (sotr_id);
fetch surname into fam;
close surname;
open name (sotr_id);
fetch name into im;
close name;
open patronym (sotr_id);
fetch patronym into otch;
close patronym;
fio:=fam||' '||im||' '||otch;
return fio;
END;
По ИД сотрудника получаем его ФИО
+126
put = "hello"
put put # Гениально!
Ну что же, открылся онлайн интерпретатор Lapis-а на отдельном сайте!
http://lapis.at.ua/Lapis.htm
+12
AttachmentService::MimeType AttachmentService::mimeTypeByCodeKey(const QString &codeKey) const
{
if(codeKey.toLower() == QString("MimeType_PDF").toLower()) return MimeType_PDF;
if(codeKey.toLower() == QString("MimeType_JPEG").toLower()) return MimeType_JPEG;
if(codeKey.toLower() == QString("MimeType_PNG").toLower()) return MimeType_PNG;
if(codeKey.toLower() == QString("MimeType_HTML").toLower()) return MimeType_HTML;
if(codeKey.toLower() == QString("MimeType_ZHTML").toLower()) return MimeType_ZHTML;
if(codeKey.toLower() == QString("MimeType_TEXT").toLower()) return MimeType_TEXT;
if(codeKey.toLower() == QString("MimeType_XLS").toLower()) return MimeType_XLS;
if(codeKey.toLower() == QString("MimeType_DOC").toLower()) return MimeType_DOC;
if(codeKey.toLower() == QString("MimeType_PPT").toLower()) return MimeType_PPT;
if(codeKey.toLower() == QString("MimeType_GIF").toLower()) return MimeType_GIF;
if(codeKey.toLower() == QString("MimeType_BMP").toLower()) return MimeType_BMP;
if(codeKey.toLower() == QString("MimeType_MPEG").toLower()) return MimeType_MPEG;
if(codeKey.toLower() == QString("MimeType_MP4").toLower()) return MimeType_MP4;
if(codeKey.toLower() == QString("MimeType_MP3").toLower()) return MimeType_MP3;
return MimeType_UNKNOWN;
}
Коллега откопал в моём коде, написанном под какими-то веществами по ходу.
Изначально было сравнение строк как есть, без приведения в нижний регистр, а потом понадобилось подстраховаться от левого регистра символов.
+146
.text:08104D0B mov ebx, [ebp+arg_0]
.text:08104D0E mov ecx, [ebp+var_C]
.text:08104D11 mov eax, 51EB851Fh
.text:08104D16 imul ecx
.text:08104D18 sar edx, 4
.text:08104D1B mov eax, ecx
.text:08104D1D sar eax, 1Fh
.text:08104D20 sub edx, eax
.text:08104D22 mov [ebp+var_C], edx
.text:08104D25 mov ecx, [ebx+38h]
.text:08104D28 mov eax, 51EB851Fh
.text:08104D2D imul ecx
.text:08104D2F sar edx, 4
.text:08104D32 mov eax, ecx
.text:08104D34 sar eax, 1Fh
.text:08104D37 sub edx, eax
.text:08104D39 mov [ebx+38h], edx
.text:08104D3C cmp [ebp+var_C], 0
.text:08104D40 jg short loc_8104D55
.text:08104D42 mov [ebp+var_C], 1
.text:08104D49 nop
.text:08104D4A nop
.text:08104D4B nop
.text:08104D4C nop
.text:08104D4D nop
.text:08104D4E nop
.text:08104D4F nop
.text:08104D50 nop
.text:08104D51 nop
.text:08104D52 nop
.text:08104D53 nop
.text:08104D54 nop
.text:08104D55
.text:08104D55 loc_8104D55: ; CODE XREF: session_skill::StartSession(bool)+222j
.text:08104D55 mov eax, [ebp+arg_0]
.text:08104D58 cmp byte ptr [eax+29h], 0
.text:08104D5C jz short loc_8104D74
.text:08104D5E mov ebx, [ebp+arg_0]
.text:08104D61 sub esp, 0Ch
.text:08104D64 push offset g_timer
.text:08104D69 call _ZN5abase5timer8get_tickEv ; abase::timer::get_tick(void)
.text:08104D6E add esp, 10h
.text:08104D71 mov [ebx+40h], eax
.text:08104D74
.text:08104D74 loc_8104D74: ; CODE XREF: session_skill::StartSession(bool)+23Ej
.text:08104D74 sub esp, 0Ch
.text:08104D77 push [ebp+var_C]
.text:08104D7A push 0
.text:08104D7C push 14h
.text:08104D7E push offset g_timer
.text:08104D83 mov eax, [ebp+arg_0]
.text:08104D86 add eax, 10h
.text:08104D89 push eax
.text:08104D8A call _ZN5abase10timer_task8SetTimerERNS_5timerEiii ; abase::timer_task::SetTimer(abase::timer &,int,int,int)
.text:08104D8F add esp, 20h
.text:08104D92 sub esp, 8
.text:08104D95 sub esp, 4
.text:08104D98 push 18h ; size
.text:08104D9A call _ZN5abase12ASmallObjectnwEj ; abase::ASmallObject::operator new(uint)
.text:08104D9F add esp, 8
.text:08104DA2 mov [ebp+ptr], eax
.text:08104DA5 mov [ebp+var_19], 1
.text:08104DA9 sub esp, 8
.text:08104DAC push 0Dh
.text:08104DAE mov eax, [ebp+arg_0]
.text:08104DB1 push dword ptr [eax+8]
.text:08104DB4 mov eax, [ebp+arg_0]
.text:08104DB7 push dword ptr [eax+4]
.text:08104DBA push [ebp+ptr]
.text:08104DBD call _ZN22skill_interrupt_filterC1EP11gactive_impii ; skill_interrupt_filter::skill_interrupt_filter(gactive_imp *,int,int)
.text:08104DC2 add esp, 18h
.text:08104DC5 mov [ebp+var_19], 0
.text:08104DC9 mov eax, [ebp+ptr]
.text:08104DCC push eax
.text:08104DCD mov eax, [ebp+arg_0]
.text:08104DD0 mov eax, [eax+4]
.text:08104DD3 add eax, 100h
.text:08104DD8 push eax
.text:08104DD9 call _ZN10filter_man9AddFilterEP6filter ; filter_man::AddFilter(filter *)
.text:08104DDE add esp, 10h
.text:08104DE1 jmp short loc_8104E13
вот собсно
+153
if (!empty($_POST["favoriteColor"])) {
switch($_POST["favoriteColor"]) {
case "Lightred":
$strBackgroundColor = "#FFDAB9";
break;
case "Lightgreen":
$strBackgroundColor = "Lightgreen";
break;
case "Lightblue":
$strBackgroundColor = "Lightblue";
break;
case "Lightgray":
$strBackgroundColor = "Lightgray";
break;
default:
$strBackgroundColor = "Gray";
break;
}
} else {
$strBackgroundColor = "Gray";
}
+117
int mainCRTStartup()
{
int argc = 0;
char* argv[MAX_CMD_ARGS + 1];
char** pargv = argv;
char* cmdLine = strdup(GetCommandLineA());
int result = 0;
g_module = GetModuleHandle(NULL);
g_process = GetCurrentProcess();
g_thread = GetCurrentThread();
g_heap = GetProcessHeap();
for (*pargv = strtok(cmdLine, " "); *pargv && argc < MAX_CMD_ARGS; *pargv = strtok(NULL, " "))
{
++argc;
++pargv;
}
*pargv = NULL;
result = main(argc, argv);
free(cmdLine);
return result;
}
+92
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with message1 do
begin
Subject:='Test subject';
From := '[email protected]';
To := '[email protected]';
Textbody:='Text body';
[. . .]
Configuration.Fields.Update;
Send;
end;
Лососнул тунца.
with message1 do
begin
Subject:='Test subject';
From := '[email protected]';
To := '[email protected]';
Textbody:='Text body';