- 1
LinkedHashMap<Long, Map<String, Map<Long, List<Long>>>> propertyTemplates;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+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?
+167
<?php /*
host=localhost
db_name=db
user=db_user
password=db_pass
charset=utf8
*/ ?>
Совершенно гениальный и единственно верный способ хранить конфиги в PHP.
Имя файла тоже, должно быть именно таким - db.ini.php
+133
/// <summary>
/// Abs function
/// </summary>
private static object Abs(List<Expression> p)
{
return Math.Abs(p[0]);
}
/// <summary>
/// Acos function
/// </summary>
private static object Acos(List<Expression> p)
{
return Math.Acos(p[0]);
}
/// <summary>
/// Asin function
/// </summary>
private static object Asin(List<Expression> p)
{
return Math.Asin(p[0]);
}
/// <summary>
/// Atan function
/// </summary>
private static object Atan(List<Expression> p)
{
return Math.Atan(p[0]);
}
/// <summary>
/// Atan2 function
/// </summary>
private static object Atan2(List<Expression> p)
{
return Math.Atan2(p[0], p[1]);
}
Кусок кода от "Капитана Очевидность"
+145
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define eps 0.001
float Phi1 (float x_pred[1])
{
return asin(1.2 + x_pred[1]) - 1;
}
float Phi2 (float x_pred[0])
{
return acos(2 - 2*x_pred[0]);
}
int main ()
{
float x_pred[1],x[1];
float norma;
x_pred[0] = 0.4;
x_pred[1] = -0.3;
do
{
x[0] = Phi1(x_pred[1]);
x[1] = Phi2(x_pred[0]);
printf("%6.2f",x[0]);
printf(" %6.2f\n",x[1]);
norma = (fabs(x[0] - x_pred[0])) > fabs((x[1] - x_pred[1])) ? fabs(x[0] - x_pred[0]) : fabs(x[1] - x_pred[0]);
if (norma >= eps) break;
else
{
x_pred[0] = x[0];
x_pred[1] = x[1];
}
}
while (1);
getch();
return 0;
}
−102
<div class="pane">
<% #Вывод материалов
if pms.size > 0 %>
<% for pm in pms do %>
<div class="mat">
<div><%= pm.name %></div>
<p>art. <%= pm.id %></p>
<%= image_tag pm.image.url(:small) %>
<%= link_to 'Выбрать +', '#' %>
</div>
<% end %>
<% end %>
</div>
ПМС =)
+150
function fixPNG(element)
{
if(/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){
var src;
src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
if(src){
src = src[1];
element.runtimeStyle.backgroundImage = "none";
}
if(src){
element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src = '" +
src + "',sizingMethod = 'scale')";
}
}
}