- 1
- 2
- 3
string.Format("{1}/{0}/{2}", day.Day, day.Month, day.ToString("yy")
string.Format("{0}", programm.Key)
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+95.9
string.Format("{1}/{0}/{2}", day.Day, day.Month, day.ToString("yy")
string.Format("{0}", programm.Key)
2 отличных метода превращения даты и числа в строку :)
Человек когда-то драйвера писал на ЖД.
ппц.
+144.7
#include <iostream>
#define lulz int
#define lulZ main()
#define luLz {
#define luLZ }
#define lUlz cout
#define lULz cin
#define lUlZ ;
#define LuLZ <<
#define LuLz >>
#define LULz =
#define LULZ +
#define lolz endl
lulz lulZ
luLz
lulz Lulz lUlZ
lUlz LuLZ" Смешная сумма " LuLZ lolz lUlZ
lULz LuLz Lulz lUlZ
lUlz LuLZ Lulz lUlZ
lUlz LuLZ" + " lUlZ
lulz lULZ lUlZ
lUlz LuLZ "LULZ?" LuLZ lolz lUlZ
lULz LuLz lULZ lUlZ
lUlz LuLZ Lulz LuLZ " + " LuLZ lULZ LuLZ " = " LuLZ Lulz + lULZ lUlZ
luLZ
"Смешная сумма" (c) автор
+134.8
#include "stdafx.h"
#include "conio.h"
#include "time.h"
#include "stdlib.h"
#include "windows.h"
#include <iostream>
using namespace std;
void go()
{ int m[10],maxi,mini,max,min,temp;
srand(time(NULL));
for(int i=0;i<10;i++)
m[i]=rand()%30;
max=0;
for(int i=0;i<10;i++)
{if(m[i]>max) { max=m[i]; maxi=i;};
}
min=max;
for(int i=0;i<10;i++)
{if(m[i]<min) {min=m[i]; mini=i;};
}
for(int i=0;i<10;i++)
cout<<m[i]<<endl;
m[maxi],m[mini]=m[mini],m[maxi];
temp=m[maxi];
m[maxi]=m[mini];
m[mini]=temp;
cout<<"============"<<endl;
for(int i=0;i<10;i++)
cout<<m[i]<<endl;
cout<<"alala=="<<max<<endl;
cout<<"ololo=="<<min<<endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
go();
getch();
return 0;
}
хе-хе, друг написал , меняет макс и мин элементы местами)
+166.3
<img src="./img/pts/main.gif">
<!--<? if ($id=="main" or $id=="" or $id=="archmain")
print "<img src=\"./img/pts/main.gif\">";
if ($id=="ecotur" or $id=="archecotur")
print "<img src=\"./img/pts/main_ekotur.gif\">";
if ($id=="koni" or $id=="archkoni")
print "<img src=\"./img/pts/main_koni.gif\">";
if ($id=="piknik" or $id=="archpiknik")
print "<img src=\"./img/pts/main_piknik.gif\">";
if ($id=="eco" or $id=="archeco")
print "<img src=\"./img/pts/main_eco.gif\">";
if ($id=="maps")
print "<img src=\"./img/pts/main_maps.gif\">";
if ($id=="info" or $id=="archinfo")
print "<img src=\"./img/pts/main_info.gif\">";
if ($id=="sitemap")
print "<img src=\"./img/pts/main_sitemap.gif\">";
if ($id=="contacts")
print "<img src=\"./img/pts/main_kord.gif\">";
if ($id=="ny")
print "<img src=\"./img/pts/main_ny.gif\">";
if ($id=="mas")
print "<img src=\"./img/pts/main_mas.gif\">";
?> -->
</td>
</tr>
<tr>
<td bgcolor="#e0ead3" background="./img/pts/left_main.gif" width="11" style="background-image: url(./img/pts/left_main.gif)"></td>
<td width="650" bgcolor="#e0ead3"><?
if ($id=="main" or $id=="")
include("global.php");
if ($id=="order")
include("order.php");
if ($id=="action")
include("action.php");
if ($id=="search")
{include("search/search.php");}
if ($id=="about" & $cat=="")
include("about.php");
if ($id=="archmain")
include("archnews.php");
if ($id=="contacts")
include("contacts.php");
if ($id=="about" & $cat=="ecoproj")
include("about/ecoproj.php");
if ($id=="about" & $cat=="anim")
include("about/anim.php");
if ($id=="about" & $cat=="prof")
include("about/prof.php");
if ($id=="about" & $cat=="press")
include("about/press.php");
if ($id=="rest" & $cat=="")
include("rest.php");
if ($id=="rest" & $cat=="child")
include("rest/child.php");
if ($id=="rest" & $cat=="child_eco")
include("rest/child_eco.php");
if ($id=="rest" & $cat=="child_edu")
include("rest/child_edu.php");
if ($id=="rest" & $cat=="child_gam")
include("rest/child_gam.php");
if ($id=="rest" & $cat=="child_his")
include("rest/child_his.php");
if ($id=="rest" & $cat=="child_sez")
include("rest/child_sez.php");
if ($id=="rest" & $cat=="child_zoo")
include("rest/child_zoo.php");
if ($id=="rest" & $cat=="child_str")
include("rest/child_str.php");
if ($id=="rest" & $cat=="child_dop")
include("rest/child_dop.php");
if ($id=="rest" & $cat=="fam")
include("rest/fam.php");
if ($id=="rest" & $cat=="adult")
include("rest/adult.php");
if ($id=="rest" & $cat=="eco")
include("rest/eco.php");
if ($id=="club" & $cat=="")
include("club.php");
if ($id=="club" & $cat=="cafe")
include("club/cafe.php");
if ($id=="club" & $cat=="piknik")
include("club/piknik.php");
if ($id=="club" & $cat=="gost")
include("club/gost.php");
if ($id=="koni" & $cat=="")
include("koni.php");
if ($id=="koni" & $cat=="uslugi")
include("koni/study.php");
if ($id=="koni" & $cat=="walk")
include("koni/walk.php");
if ($id=="koni" & $cat=="dom")
include("koni/dom.php");
if ($id=="koni" & $cat=="poni")
include("koni/poni.php");
if ($id=="koni" & $cat=="sell")
include("koni/sell.php");
if ($id=="koni" & $cat=="ippoter")
include("koni/ippoter.php");
Попросили заменить кое что на сайте, начал смотреть исходный код. Умилил ^_^
+103.3
public static IntPtr StringToBSTR(string s)
{
//...
if ((s.Length + 1) < s.Length)
{
throw new ArgumentOutOfRangeException("s");
}
//...
}
System.Runtime.InteropServices.Marshal Не знаю зачем это, но мне показалось смешным.
+135.9
public class PlayerWindow
{
private readonly ScheduleManager _scheduleManager = new ScheduleManager();
...
private void OpenSchedule(string timesheetFilename)
{
if (!_scheduleManager.OpenSchedule(timesheetFilename))
{
_isOpen = false;
return;
}
_isOpen = false;
}
}
Собственное творчество. ^_^
+246.7
proc mltcoef
push ecx
xor ecx,ecx
xor edx,edx
xor ebx,ebx
mov eax,dword[coef+edx]
_b:
add [coef+edx],eax
jc _c
_e:
cmp ecx,9
jne _b
inc ecx
_c
push edx
_d
add edx,4
add [coef+edx],1
jc _d
pop edx
jmp _e
pop ecx
ret
endp
Пока я писалвысирал эту НЁБ, я уже забыл, зачем оно было нужно.
+62.8
bool failed = true;
int count = 0;
do
{
{
ADO cnn( service().connectionString() );
if (count == 0)
{
_RecordsetPtr rs = cnn.Command(L"SELECT MAX(MessNo) as MAXNO FROM RobotLog", ADODB::adCmdText)
.Execute();
if (rs->EndOfFile == VARIANT_FALSE)
{
vt = rs->Fields->Item[L"MAXNO"]->Value;
if (vt.vt != VT_NULL)
messNo = vt.lVal + 1;
}
rs->Close();
}
else
messNo++;
try
{
cnn.Command(L"INSERT INTO RobotLog(MessNo,MessType,MessDate,MessText,Empl_Code,CompName,Robot_Code, "
L"Robot_Name,Doc_Name,Doc_No,Doc_CardDate) VALUES(?,?,?,?,?,?,?,?,?,?,?)", ADODB::adCmdText)
.CreateParameter(messNo)
.CreateParameter((long) messType)
.CreateParameter((DATE) COleDateTime::GetCurrentTime())
.CreateParameter(bstr_t(messText.AllocSysString()))
.CreateParameter((long)m_EmplCode)
.CreateParameter(service().computerName())
.CreateParameter((long)m_ID)
.CreateParameter(sRobotName)
.CreateParameter(sDocName, false)
.CreateParameter(sDoc_No, false)
.CreateParameter(dCardDate)
.Execute();
failed = false;
}
catch(_com_error& )
{
// DebugMsgE("CRobotThread::LogRobotWork[%s] error: 0x%08x::%s - %s. Attempt #:%d", (const char*)m_RobotName, err.Error(), (const char*) err.Description(),
// (const char*) err.ErrorMessage(), count);
}
}
count++;
Sleep(100);
}while (failed && count < 10000);
Вычисляемое значение 'messNo' прописывается в PK. Код выполняется мультипоточночно, примерно из 5 - 15 одновременно работающих потоков.
Вот такая вот попытка 10000 раз прописать неуникальное значение первичного ключа :)
Но, самое смешное, что на моё предложение перенести заботу об уникальности и инкрементации в SQL, мне было велено "не умничать, ЭТО правильный алгоритм !...".
+144.2
if ( strlen(f.ToString()) < 5 )
Проверку булевской переменной.
+78.2
public void pause(){
Object lock=new Object();
synchronized(lock){
try{
lock.wait(1000);
}catch(Exception e){
System.out.println(e.getMessage());
}
}
}