- 1
- 2
- 3
- 4
protected override Type GetEntryType()
{
return typeof(ReportEntry);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+141
protected override Type GetEntryType()
{
return typeof(ReportEntry);
}
Код из реального проекта
+118
void dwflt_to_str(DWORD dw, char *pch, int &nsmb)
{
DWORD dw_a = dw;
char ch_a;
char tbldec[] = "0123456789";
nsmb = 0;
if (dw_a == 0) { pch[0] = '0'; nsmb++; goto lab2; }
while (dw_a != 0)
{
pch[nsmb] = tbldec[dw_a%10]; dw_a /= 10; nsmb++;
}
dw_a = nsmb/2;
while (dw_a)
{
ch_a = pch[nsmb - dw_a]; pch[nsmb - dw_a] = pch[dw_a - 1]; pch[dw_a - 1] = ch_a; dw_a--;
}
lab2:
pch[nsmb] = 0;
}
const int n_fr2 = 7; // - эта константа определяет фиксированное число цифр после точки в выводимой строке, представляющей float.
void float_to_str(float flt, char *pchar, int &nsmb)
{
int i, deg, ns_int, ns_frac;
double frac_dbl;
DWORD dw_f, mant, intg, fract;
DW_FL f_flt;
char szfl_int[16], szfl_frac[16];
f_flt.fl = flt;
dw_f = f_flt.dw;
if (dw_f == 0) { pchar[0] = '0'; pchar[1] = '.'; pchar[2] = '0'; pchar[3] = 0; nsmb = 3; return; }
if (dw_f & 0x80000000) { pchar[0] = '-'; } else { pchar[0] = '+'; }
deg = int((dw_f & 0x7F800000) >> 23) - 127;
mant = (dw_f & 0x007FFFFF) | 0x00800000;
if (deg == 0) { intg = 1; fract = dw_f & 0x007FFFFF; goto lab_1; }
if (deg > 0) { intg = mant >> (23 - deg); fract = ((dw_f & 0x007FFFFF) << deg) & 0x007FFFFF; goto lab_1; }
if (deg < 0) { intg = 0; fract = ((dw_f & 0x007FFFFF) | 0x00800000) >> (-deg); }
lab_1:
frac_dbl = double(fract)*1.1920928955078125;// 1.1920928955078125 = 10^n_fr2 / 2^23 = 10^7 / 2^23
fract = (int)frac_dbl;
dwflt_to_str(intg, szfl_int, ns_int);
nsmb = 1; i = ns_int; while (i) { pchar[i + 1] = szfl_int[i]; i--; } pchar[1] = szfl_int[0];
nsmb += ns_int; pchar[nsmb] = '.'; nsmb++;
dwflt_to_str(fract, szfl_frac, ns_frac); szfl_frac[n_fr2] = 0;
i = ns_frac; while (i) { szfl_frac[6 - ns_frac + i] = szfl_frac[i - 1]; i--; }
i = n_fr2 - ns_frac; while (i) { szfl_frac[i - 1] = '0'; i--; }
i = n_fr2 - 1; while (i) { pchar[nsmb + i] = szfl_frac[i]; i--; } pchar[nsmb] = szfl_frac[0];
nsmb += n_fr2; pchar[nsmb] = 0;
}
void float_to_str_exp(float flt, char *pchar, int &nsmb)
{
int i, deg, poli, ns_int, ns_frac, ns_poli;
double frac_dbl;
DWORD dw_f, mant, intg, fract;
DW_FL f_flt;
char szfl_int[16], szfl_frac[16];
f_flt.fl = flt;
dw_f = f_flt.dw;
if (dw_f == 0) { pchar[0] = '0'; pchar[1] = '.'; pchar[2] = '0'; pchar[3] = 0; nsmb = 3; return; }
if (dw_f & 0x80000000) { pchar[0] = '-'; } else { pchar[0] = '+'; }
deg = int((dw_f & 0x7F800000) >> 23) - 127;
mant = (dw_f & 0x007FFFFF) | 0x00800000;
if (deg == 0) { intg = 1; fract = dw_f & 0x007FFFFF; goto lab_1; }
if (deg > 0) { intg = mant >> (23 - deg); fract = ((dw_f & 0x007FFFFF) << deg) & 0x007FFFFF; goto lab_1; }
if (deg < 0) { intg = 0; fract = ((dw_f & 0x007FFFFF) | 0x00800000) >> (-deg); }
lab_1:
frac_dbl = double(fract)*1.1920928955078125;// 1.1920928955078125 = 10^n_fr2 / 2^23 = 10^7 / 2^23
fract = (int)frac_dbl;
dwflt_to_str(intg, szfl_int, ns_int);
dwflt_to_str(fract, szfl_frac, ns_frac); szfl_frac[n_fr2] = 0;
if (intg != 0)
{
nsmb = 1; i = ns_int; while (i) { pchar[i + 2] = szfl_int[i]; i--; } pchar[1] = szfl_int[0];
pchar[2] = '.'; nsmb += ns_int + 1; poli = ns_int - 1;
}
else
{
i = ns_frac - 1; while (i) { pchar[2 + i] = szfl_frac[i]; i--; } pchar[1] = szfl_frac[0];
pchar[2] = '.'; nsmb = 3;//nsmb += ns_frac + 1;
poli = ns_frac - n_fr2 - 1; goto lab_2;
}
i = ns_frac; while (i) { szfl_frac[6 - ns_frac + i] = szfl_frac[i - 1]; i--; }
i = n_fr2 - ns_frac; while (i) { szfl_frac[i - 1] = '0'; i--; }
i = n_fr2 - 1; while (i) { pchar[nsmb + i] = szfl_frac[i]; i--; } pchar[nsmb] = szfl_frac[0];
lab_2:
nsmb += n_fr2; pchar[nsmb] = 'E';
int_to_str(poli, &pchar[nsmb + 1], ns_poli);
nsmb += ns_poli + 1; pchar[nsmb] = 0;
}
оттуда
+137
using System;
class TLockCriticalSystemResource : IDisposable
{
public TLockCriticalSystemResource(){Console.WriteLine("Acquire critical system resource");}
public void Dispose(){Console.WriteLine("Release critical system resource");}
public bool Property1{private get{return true;}set{throw new Exception();}}
}
public class Test
{
public static void Main()
{
using (var file = new TLockCriticalSystemResource()
{
Property1=true
})
{
// Делаем чего-то с ресурсом
}
}
}
Ололо. using не даёт гарантию безопасности с точки зрения исключений:
http://ideone.com/nHDIJ
Системный ресурс остался захваченным.
+156
@show[]
$cars[^table::sql{select * from count_cars order by sortir}]
<script>
var CarsDescription = new Array()^;
$counter(1)
^cars.menu{
CarsDescription[$counter] = '$cars.characteristic'^;
^counter.inc[]
}
</script>
<script type="text/javascript" src="/cars_calc/script.js"></script>
<link rel="stylesheet" type="text/css" href="/cars_calc/style.css">
<section class="page">
<section class="scheme">
<span id="cr" class="cr"></span>
$cars_count(16)
^for[car](1;$cars_count){
<span id="select-car-$carId" class="car-$carId">$car</span>
}
</section>
Код из одной веб-студии. Смысл в том что в javascript должен быть передан массив из базы данных, вместо того чтобы послать пакет с нужными данными в формате json (или любом другом) и обработать его, в исходный файл html-разметки (тут как видно и javascript вставлен) добавили код Parser'а (для тех кто-незнаком это язык для быстрой разработки веб-сайтов от Лебедева, что-то вроде простой альтернативы php), который перед тем как отдать пользователю страницу, обрабатывает её и вставляет в нужные места, нужные данные. В общем сами оценивайте этот маразм...
+55
<option <? if(isset($_POST['day']) and $_POST['day']=="01") echo "selected"; ?> value="01">1</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="02") echo "selected"; ?> value="02">2</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="03") echo "selected"; ?> value="03">3</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="04") echo "selected"; ?> value="04">4</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="05") echo "selected"; ?> value="05">5</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="06") echo "selected"; ?> value="06">6</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="07") echo "selected"; ?> value="07">7</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="08") echo "selected"; ?> value="08">8</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="09") echo "selected"; ?> value="09">9</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="10") echo "selected"; ?> value="10">10</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="11") echo "selected"; ?> value="11">11</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="12") echo "selected"; ?> value="12">12</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="13") echo "selected"; ?> value="13">13</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="14") echo "selected"; ?> value="14">14</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="15") echo "selected"; ?> value="15">15</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="16") echo "selected"; ?> value="16">16</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="17") echo "selected"; ?> value="17">17</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="18") echo "selected"; ?> value="18">18</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="19") echo "selected"; ?> value="19">19</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="20") echo "selected"; ?> value="20">20</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="21") echo "selected"; ?> value="21">21</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="22") echo "selected"; ?> value="22">22</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="23") echo "selected"; ?> value="23">23</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="24") echo "selected"; ?> value="24">24</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="25") echo "selected"; ?> value="25">25</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="26") echo "selected"; ?> value="26">26</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="27") echo "selected"; ?> value="27">27</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="28") echo "selected"; ?> value="28">28</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="29") echo "selected"; ?> value="29">29</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="30") echo "selected"; ?> value="30">30</option>
<option <? if(isset($_POST['day']) and $_POST['day']=="31") echo "selected"; ?> value="31">31</option>
вЫводим дни в селекте )) А как ты выводишь дни в селекте? %)
+49
$em = $this->getDoctrine()->getEntityManager();
$user = $em->getRepository('AdminBundle:AdminUser')
->findOneById($id);
if ($user == $this->get('security.context')->getToken()->getUser()) {
$this->get('session')->setFlash('admin-delete', 'TODO:TRANSLATE: Suicide is not allowed. Thank you!');
} else {
$em->remove($user);
$em->flush();
$this->get('session')->setFlash('admin-delete', 'TODO:TRANSLATE: User ' . $user->getEmail(). ' was deleted.');
}
Текст ошибок просто супер!
+121
ignore(MainForm.g.Items.Add
(
if(! $['A'..'Z'].Concat($['а'..'я']).Concat($['А'..'Я']).Concat($['a'..'z']).Contains(tok[0])) $"#$code" else tok
));
+38
const NMath::TLineEquation<> C_E_(C_, E_);
const NMath::TLineEquation<> D_A_(D_, A_);
const NMath::TVector<2> F_=C_E_.Intersection(D_A_);
TSafeFloat lpr=_state._safeDistance->Value()+_state._instrumentRadius->Value();
if((F_-B).Length()>lpr)
{
const NMath::TVector<2> F__=(D_+E_)/2.0;//F
//...
const NMath::TVector<2> TV=D_-E_;
const NMath::TVector<2> F___=PointAtDistance(B,TV,lpr, m90);//F*
const NMath::TVector<2> DEDir=rt90(F___-B, m90).Normalize()*10;
const NMath::TLineEquation<> DE(F___,F___+DEDir);
const NMath::TVector<2> E=DE.Intersection(C_E_);
const NMath::TVector<2> D=DE.Intersection(D_A_);
TpointerAnyCommand result;
result=new TLineCommand(CurrentCommand.SourceCommand(),E-C_,OnOffCorrectionEmpty);
_resultDestination.push(result);
result=new TLineCommand(CurrentCommand.SourceCommand(),D-E,OnOffCorrectionEmpty);
_resultDestination.push(result);
result=new TLineCommand(CurrentCommand.SourceCommand(),D_-D,OnOffCorrectionEmpty);
_resultDestination.push(result);
}
+70
public static class TrollException extends RuntimeException {
@Override
public String getMessage() {
throw new TrollException();
}
@Override
public String getLocalizedMessage() {
throw new TrollException();
}
@Override
public Throwable getCause() {
throw new TrollException();
}
@Override
public synchronized Throwable initCause(Throwable cause) {
throw new TrollException();
}
@Override
public String toString() {
throw new TrollException();
}
@Override
public void printStackTrace() {
throw new TrollException();
}
@Override
public void printStackTrace(PrintStream s) {
throw new TrollException();
}
@Override
public void printStackTrace(PrintWriter s) {
throw new TrollException();
}
@Override
public synchronized Throwable fillInStackTrace() {
throw new TrollException();
}
@Override
public StackTraceElement[] getStackTrace() {
throw new TrollException();
}
@Override
public void setStackTrace(StackTraceElement[] stackTrace) {
throw new TrollException();
}
}
+129
return GetByteArray((Object)obj);
На всякий случай.