- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
SELECT *
FROM table1
WHERE
COALESCE(
field1,
field2,
field3,
field4,
field5,
fieldN,
"lol"
)!="lol"
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−117
SELECT *
FROM table1
WHERE
COALESCE(
field1,
field2,
field3,
field4,
field5,
fieldN,
"lol"
)!="lol"
+74
String.format("USR-БГПУ", new Object[] { new SimpleDateFormat("dd MMMM yyyy", new Locale("ru", "RU")) })
Нашёл в самолично написанной утильке (из серии блиц-[говно]кодинга). Думал.
+81
public void getApplicationContext(ApplicationContext applicationContext ) {
applicationContext.setUserId(currentUserService.getCurrentUser().getName());
applicationContext.setTransactionType(transactionType);
applicationContext.setApplication(applicationName);
applicationContext.setSubSystem(subSystemName);
applicationContext.setAddress(ipAddress);
applicationContext.setCorrelationId(correlationIDGenerator.getRandomGUID());
}
*facepalm*
+171
$date_day = date("d");
$date_month = date("m");
$date_year = date("Y");
$date_time = date("H:i");
$date_cont = " " . $date_day . "-" . $date_month . "-" . $date_year . " " . $date_time;
Вот так мы получаем дату строкой :)
Впоследствии используется только $date_cont.
+164
private function _arrayToString($array)
{
$count = count($array);
$str = '';
for ($i = 0; $i < $count; $i++) {
$str .= $array[$i] . ',';
}
$str = substr($str, 0, strlen($str) - 1);
return $str;
}
implode ?? не, не слышал!
+88
LinkedHashMap<Long, Map<String, Map<Long, List<Long>>>> propertyTemplates;
+163
$curdate=gmdate("Y.m.d H:i:s");
if(DateDayDiff($curdate,"2008.01.01")==0)$hny = true; else $hny = false;
if(DateDayDiff($curdate,"2008.04.01")==0)$fd = true; else $fd = false;
if((DateDayDiff($curdate,"2008.05.09")>=-1) && (DateDayDiff($curdate,"2008.05.09")<=1)) $nine_mai = true; else $nine_mai = false;
Оригинальная проверка "а-сегодня-ли-девятое-мая?" на форуме Elemental Games.
+163
d = d ? d.push({ajax: true}) : {ajax: true};
Похоже, что программист отметил весело новый год
+98
if RadioGroup1.ItemIndex=0 then cpr:=cpr+1;
if RadioGroup1.ItemIndex=1 then cth:=cth+1;
if RadioGroup2.ItemIndex=0 then cch:=cch+1;
if RadioGroup2.ItemIndex=1 then czs:=czs+1;
if RadioGroup3.ItemIndex=0 then chd:=chd+1;
if RadioGroup3.ItemIndex=1 then cpr:=cpr+1;
if RadioGroup4.ItemIndex=0 then cth:=cth+1;
if RadioGroup4.ItemIndex=1 then cch:=cch+1;
if RadioGroup5.ItemIndex=0 then czs:=czs+1;
if RadioGroup5.ItemIndex=1 then chd:=chd+1;
if RadioGroup6.ItemIndex=0 then cpr:=cpr+1;
if RadioGroup6.ItemIndex=1 then cch:=cch+1;
if RadioGroup7.ItemIndex=0 then chd:=chd+1;
if RadioGroup7.ItemIndex=1 then cth:=cth+1;
....// Это всё в 60 строк
if (cpr>cth) and (cpr>cch) and (cpr>czs) and (cpr>chd) then cpr1:=+1
else
if (cth>cpr) and (cth>cch) and (cth>czs) and (cth>chd) then cth1:=+1
else
if (cch>cpr) and (cch>cth) and (cch>czs) and (cch>chd) then cch1:=+1
else
if (czs>cpr) and (czs>cch) and (czs>cth) and (czs>chd) then czs1:=+1
else
if (chd>cpr) and (chd>cch) and (chd>czs) and (chd>cth) then chd1:=+1;
if cpr>chd or czs or cth or cch then
begin
ShowMessage('человек-природа – все профессии, связанные с растениеводством, животноводством и лесным хозяйством;') ;
Datamodule4.ADOTable1.Edit;
Datamodule4.ADOTable1.FieldValues['test2']:=('человек-природа – все профессии, связанные с растениеводством, животноводством и лесным хозяйством;');
Datamodule4.ADOTable1.Post;
end
else
if chd>cpr or cth or cch or czs then begin
ShowMessage('человек-техника – все технические профессии;') ;
Datamodule4.ADOTable1.Edit;
Datamodule4.ADOTable1.FieldValues['test2']:=('человек-техника – все технические профессии;');
Datamodule4.ADOTable1.Post;
...... И далее результаты в общем их 5
отдельная кнопка для вывода остальных 10 вопросов х)
procedure TForm1.Button1Click(Sender: TObject);
begin
Radiogroup11.Visible:=true;
Radiogroup12.Visible:=true;
Radiogroup13.Visible:=true;
Radiogroup14.Visible:=true;
Radiogroup15.Visible:=true;
Radiogroup16.Visible:=true;
Radiogroup17.Visible:=true;
Radiogroup18.Visible:=true;
Radiogroup19.Visible:=true;
Radiogroup20.Visible:=true;
Button2.Visible:=True;
end;
Программа тестирования на профориентацию
хД сколько он radiogroup создал)
+156
<?php
if(!isset($legal_include)) { header("HTTP/1.0 404 Not Found"); die(); }
if(!isset($_POST['login']) OR !isset($_POST['password']) OR !isset($_POST['password_retype'])) {
text(gic('tpl/register_form.html'));
} else {
$_POST = postget();
$error = array();
if(strlen($_POST['login']) < 4 OR empty($_POST['login'])) {
array_push($error, 'len_login');
} else {
if(preg_match('/^[a-z0-9]+$/', $_POST['login'])) {
if(check_avalaibility($_POST['login']) != true) {
array_push($error, 'login_used');
}
} else {
array_push($error, 'inc_login');
}
}
if(strlen($_POST['password']) < 4 OR empty($_POST['password'])) {
array_push($error, 'len_passwd');
} else {
if($_POST['password'] != $_POST['password_retype']) {
array_push($error, 'inc_passwds');
}
}
if(count($error) > 0) {
$fields = array('inc_login' => language($_SESSION['lang'], 'inc_login'),
'len_login' => language($_SESSION['lang'], 'len_login'),
'len_passwd' => language($_SESSION['lang'], 'len_passwd'),
'login_used' => language($_SESSION['lang'], 'login_used'),
'inc_passwds' => language($_SESSION['lang'], 'inc_passwds'));
$text = language($_SESSION['lang'], 'have_errs').'<ul>';
foreach($error as $value) {
$text .= '<li>'.$fields[$value].'</li>';
}
$text .= '</ul>';
error($text, 'text');
sendback('?register');
} else {
$SQL = 'INSERT INTO `'.pr.'users` (`login`, `password`, `levels`) VALUES (\''.$_POST['login'].'\', \''.md5($_POST['password']).'\', 1)';
mysql_query($SQL);
$_SESSION['logined'] = true;
$_SESSION['levels'] = 1;
$_SESSION['name'] = $_POST['login'];
}
}
function check_avalaibility($username) {
$SQL = 'SELECT `login` FROM `'.pr.'users` WHERE `login` = \''.$username.'\'';
$result = mysql_query($SQL);
if(mysql_num_rows($result) > 0) {
return false;
} else {
return true;
}
}
?>
why so serious?