- 1
$table_name = "$pub_code"."_"."$lg_code";
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+151.9
$table_name = "$pub_code"."_"."$lg_code";
+17
std::string sError = "";
try
{
fIn = fopen(cszFileName, "rb");
if (fIn == 0)
{
sError = "Can not open file: ";
sError += cszFileName;
throw std::string("");
}
if (!ParseFile(fIn, pLookup))
{
sError = "Bad file format. File: ";
sError += cszFileName;
throw std::string("");
}
sError = "";
throw std::string("");
}
catch (std::string& e)
{
if (fIn != 0)
{
fclose(fIn);
fIn = NULL;
}
if (sError.length() != 0)
{
throw std::exception(sError.c_str());
}
}
Там же нашел еще более шикарное продолжение гавнокода http://govnokod.ru/1459
−867.6
SELECT SQL_CALC_FOUND_ROWS *,cached_login as login,cached_name as uname,comment_count as ccount FROM posts p WHERE exists (select * from tags tg, tegi_zapisi tx where tg.alt_title like 'post' and tg.id_tag=tx.id_tag and tx.id_post=p.id_post) and exists (select * from tags tg, tegi_zapisi tx where tg.alt_title like 'opentomsk' and tg.id_tag=tx.id_tag and tx.id_post=p.id_post) and hide<>1 ORDER BY p.date desc, p.time desc LIMIT 210,10
выбираем все посты с определёнными тегами или без них
удивляемся, почему тормозит пропорционально количеству тегов
+111.7
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct pl
{
int speed;
double time;
char cname[25];
}player;
int cni;//countries number
static double disti;//distance of road
player *bpll;
class country
{
public:
// country();
// country(country& cnr);
void setinfo();
char name[25];
int pn;
int sp;
player *cpl;
player *bpl;
void getname(char *name);
void findbestplayer(int pp);
void sortplayers();
~country();
};
void country::setinfo()
{
static char nm[255];
printf("Enter country name\n");
gets(nm);
strcpy(name,nm);
printf("Country name: %s\n",name);
static char pnc[25];
printf("Enter number of players: ");
gets(pnc);
pn=atoi(pnc);
cpl=new player[pn];
for(int i2=0;i2<pn;i2++)
{
int spd;
static char spdc[10];
printf("Enter speed of player %d:",i2+1);
gets(spdc);
spd=atoi(spdc);
cpl[i2].speed=spd;
cpl[i2].time=disti/spd;
memset(&cpl[i2].cname,0x20,25);
strcpy(cpl[i2].cname,name);
printf("Player time %f\n",cpl[i2].time);
};
return;
};
country::~country()
{
delete []cpl;
delete []bpl;
};
void country::findbestplayer(int pp)
{
int min=0;
bpl=new player;
for(int i=1;i<pn;i++)
{
if(cpl[i].time<cpl[min].time){
min=i;
};
bpl=&cpl[min];
};
return;
};
int compare (player * arg1, player * arg2);
int main(int argc,char *argv[])
{
static char cn[10];
static char dist[10];
printf("Enter distance\n");
gets(dist);
disti=atoi(dist);
printf("Enter number of countries\n");
gets(cn);
cni=atoi(cn);
country c1[cni];
bpll=new player[cni];
for(int i=0;i<cni;i++)
{
c1[i].setinfo();
c1[i].findbestplayer(c1[i].pn);
printf("best time %f\n",c1[i].bpl->time);
bpll[i].speed=c1[i].bpl->speed;
bpll[i].time=c1[i].bpl->time;
Задача для олимпиады для подсчёта занятых мест по времени и скорости, каждого спортсмена, предыдущее но правильно работающее.
+123
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct pl
{
int speed;
double time;
}player;
int cni;//countries number
static double disti;//distance of road
class stack
{
public:
stack(int i)
{
ael=new int[i];
sp=0;
};
int pop(void);
void push(int el);
int sp;
private:
int *ael;
};
class country : public stack
{
public:
country();
void setinfo();
char name[25];
int pn;
int sp;
player *cpl;
player *bpl;
void getname(char *name);
player* findbestplayer();
void sortplayers();
~country();
};
country::country():stack(cni)
{
};
void country::setinfo()
{
static char nm[255];
printf("Enter country name\n");
gets(nm);
strcpy(name,nm);
printf("Country name: %s\n",name);
static char pnc[25];
printf("Enter number of players: ");
gets(pnc);
pn=atoi(pnc);
cpl=new player[pn];
for(int i2=0;i2<pn;i2++)
{
int spd;
static char spdc[10];
printf("Enter speed of player %d:",i2+1);
gets(spdc);
spd=atoi(spdc);
cpl[i2].speed=spd;
cpl[i2].time=disti/spd;
printf("Player time %f\n",cpl[i2].time);
};
return;
};
country::~country()
{
delete []cpl;
delete []bpl;
};
player* country::findbestplayer()
{
int bpl2=0;
for(int i3=1;i3<pn;i3++)
{
if(cpl[i3].time<cpl[bpl2].time){
bpl2=i3;
};
*bpl=cpl[bpl2];
return &cpl[bpl2];
};
};
int getspeed(struct pl pll);
void sort(country *cnt);
int main(int argc,char *argv[])
{
static char cn[10];
static char dist[10];
printf("Enter distance\n");
+141
Stess (21:31:33 5/08/2009)
блин..я мало ем...просто полнею и все...ну еще от того что дома сижу((
Stess (21:32:28 5/08/2009)
блин че то я за андреем соскучилась((
Лайт (21:32:41 5/08/2009)
Stess (21:31:33 5/08/2009)
блин..я мало ем...просто полнею и все...ну еще от того что дома сижу((
Лайт (21:32:43 5/08/2009)
хммм...
Лайт (21:32:47 5/08/2009)
надо с тобой заняться
Лайт (21:32:49 5/08/2009)
...
Лайт (21:32:51 5/08/2009)
тобой
Stess (21:33:01 5/08/2009)
чем???
Лайт (21:33:10 5/08/2009)
тобой
Лайт (21:33:15 5/08/2009)
или...чем хочешь
Stess (21:33:39 5/08/2009)
блин.. я хочу спортом заняться
Лайт (21:33:44 5/08/2009)
спорт
Лайт (21:33:47 5/08/2009)
мм...
Лайт (21:33:51 5/08/2009)
бокс)
Stess (21:33:55 5/08/2009)
нет
Лайт (21:33:58 5/08/2009)
тейквандо
Лайт (21:34:00 5/08/2009)
карате
Лайт (21:34:02 5/08/2009)
дзюдо
Stess (21:34:05 5/08/2009)
там бегать по вечерам
Лайт (21:34:06 5/08/2009)
легкая атлетика
Лайт (21:34:08 5/08/2009)
Лайт (21:34:14 5/08/2009)
бегать по вечерам одной скучно)
Лайт (21:34:22 5/08/2009)
и эт не спорт
Лайт (21:34:25 5/08/2009)
над экстрим
Stess (21:34:34 5/08/2009)
ну вот)) я ща ищу человека кто захочет со мной бегать)))
Лайт (21:34:38 5/08/2009)
бег по пересеченной местности с перпятствиями от собаки
Stess (21:34:40 5/08/2009)
потом на роликах
СОЦ инженерия :)
+141.6
$nomer_kateg = substr($_POST[kategorii], 0,1);
if($nomer_kateg == '1'){
$shljahv = 'img/nash_kom/zona2/vel/';
$shljahm = 'img/nash_kom/zona2/mal/';
$vus_vel ='525';
$shur_vel ='700';
$vus_mal ='53';
$shur_mal ='80';
}
if($nomer_kateg == '2'){
$shljahv = 'img/nashshar/vel/';
$shljahm = 'img/nashshar/mal/';
$vus_vel ='525';
$shur_vel ='700';
$vus_mal ='53';
$shur_mal ='80';
}
if($nomer_kateg == '3'){
$shljahv = 'img/poloty/perejaslav_2009/big/';
$shljahm = 'img/poloty/perejaslav_2009/mal/';
$vus_vel ='525';
$shur_vel ='700';
$vus_mal ='150';
$shur_mal ='200';
}
if($nomer_kateg == '4'){
$shljahv = 'img/poloty/Podillya_2008/big/';
$shljahm = 'img/poloty/Podillya_2008/mal/';
$vus_vel ='525';
$shur_vel ='700';
$vus_mal ='150';
$shur_mal ='200';
}
Разбираю сайт, который надо полностью переделать. Просто поражаюсь...
+151
@$sel = $_POST["sel"]?$_POST["sel"]:$_GET["sel"];
из огромной кучи (продолжение следует)
+174
if (!function_exists('function_exists')) die('o_O');
существует или нет, вот в чем вопрос
+131.8
class Par_host_port
{
private:
std::string vdata;
public:
//...
char* get () { return (char*)vdata.c_str (); }
};
char const* превращается... Превращается char const*... В char*!