- 1
printf("%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%f\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t", ...
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+137
printf("%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%f\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t%u\t", ...
+166
$url=$_SERVER['REQUEST_URI'];
$url9=substr($url,0,9);
$url8=substr($url,0,8);
$url14=substr($url,0,14);
$url10=substr($url,0,10);
$url5=substr($url,0,5);
if ($url9=='/calendar') {
printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Calendar -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
//--><!]]>
</script>
<script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
}elseif ($url8=='/content'){
printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Content -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
//--><!]]>
</script>
<script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
}
elseif ($url14=='/forum_arch'){
printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Forum archiv -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
//--><!]]>
</script>
<script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
}
elseif ($url10=='/forum/'){
printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Forum pages -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
//--><!]]>
</script>
<script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
}
elseif ($url5=='/news'){
printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / News -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
//--><!]]>
</script>
<script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
}
else {
printf('<!-- (C)2000-2010 Gemius SA - gemiusAudience / sitecom / Glavnaja stranitsa sajta -->
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var pp_gemius_identifier = new String(\'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\');
//--><!]]>
</script>
<script type="text/javascript" src=" http://site.com/gemius/xgemius.js"></script>');
}
Вместо xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx в коде оригинальные id счетчиков. Это всё чудо лежит в базе и выполняется через eval()
+159
$difference = strtotime($VipAcc['DateTime']) - time();
$d = floor($difference/60/60/24);
$h = floor(($difference - $d*60*60*24)/60/60);
$m = floor(($difference - $d*60*60*24 - $h*60*60)/60);
так и не выучил функций по работе со временем
($VipAcc['DateTime'] - значение взято з базы)
+162
<script language="javascript" src="http://media.fastclick.net/w/get.media?sid=24280&m=1&tp=5&d=j&t=n"></script><noscript><a href="http://media.fastclick.net/w/click.here?sid=24280&m=1&c=1" target="_blank"><img src="http://media.fastclick.net/w/get.media?sid=24280&m=1&tp=5&d=s&c=1"width=728 height=90 border=1></a></noscript>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>unstyled form</title>
<script type="text/JavaScript">
<!--
function myF(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<form id="form1">
<select name="menu1" onchange="myF('parent',this,0)">
<option>Return to home page</option>
<option>Contact</option>
<option>unnamed1</option>
</select>
</form>
</body>
</html>
С новым 1993-им годом!
+75
public static void getShops(Favorite favoriteBrands,
Favorite favoriteShops, StationItem station,
WorkingTimeFilter workTimeFilter, boolean[] filter, String keyword,
GeoLocationPointItem userLocation,
GeoLocationPointItem searchLocation, String catalogId,
String netId, String page, String pageSize, String api,
AsyncTask callback, ConnectionWatcher watcher) {
//...
//упаковка кучи параметров
boolean emptyFavBrands = false;
if (favoriteBrands != null) {
int i = 0;
for (FavoriteItem item : favoriteBrands) {
String id = item.getId();
Log.i(tag, "addFaforiteBrand " + id);
params.add(new BasicNameValuePair(PARAMS_FAVORITE_BRAND_ID
+ "[" + i + "]", id));
i++;
}
if (i == 0)
emptyFavBrands = true;
}
boolean emptyFavShops = false;
if (favoriteShops != null) {
int i = 0;
for (FavoriteItem item : favoriteShops) {
String id = item.getId();
Log.i(tag, "addFaforiteShop " + id);
params.add(new BasicNameValuePair(PARAMS_FAVORITE_SHOP_ID + "[" + i
+ "]", id));
i++;
}
if (i == 0)
emptyFavShops = true;
}
boolean error = false;
if (emptyFavBrands && emptyFavShops) {
if (favoriteBrands != null || favoriteShops != null)
error = true;
}
if (emptyFavShops) {
if (favoriteBrands == null && favoriteShops != null)
error = true;
}
if (emptyFavBrands) {
if (favoriteBrands != null && favoriteShops == null)
error = true;
}
if (error) {
callback.onError(JsonEntity.FAVORITE_ERROR, new IOException());
return;
}
}
Обращение к веб-сервису. Вызов этого метода при переносе IDE "растекается" на 5-6 строк.
Самое интересное - проверка корректности параметров находится в самом конце метода (длиной 150 строк)
−143
IF @Detail is not null
AND (SELECT
COUNT(AppraisalResponseID)
FROM AppraisalResponseHistory
WHERE AppraisalResponseID = @AppraisalResponseID) >0
BEGIN
INSERT INTO AppraisalResponseHistory
( AppraisalResponseID,
PermissionID,
AppraisalTypeQuestionPromptID,
Detail,
ModifiedDate,
PersonID )
SELECT AppraisalResponse.ID,
AppraisalResponse.PermissionID,
AppraisalResponse.AppraisalTypeQuestionPromptID,
AppraisalResponse.Detail,
AppraisalResponse.ModifiedDate,
PersonID
FROM AppraisalResponse
WHERE AppraisalResponse.ID=@AppraisalResponseID AND AppraisalResponse.Detail<>@Detail
END
ELSE
IF COALESCE(@Detail, '') = ''
--if the reviewer is inserting a blank record after having filled in a response, insert into history
--if the blank record is the place holder, do not insert into history
AND (SELECT
COUNT(AppraisalResponseID)
FROM AppraisalResponseHistory
WHERE AppraisalResponseID = @AppraisalResponseID) >0
BEGIN
INSERT INTO AppraisalResponseHistory
( AppraisalResponseID,
PermissionID,
AppraisalTypeQuestionPromptID,
Detail,
ModifiedDate,
PersonID )
SELECT AppraisalResponse.ID,
AppraisalResponse.PermissionID,
AppraisalResponse.AppraisalTypeQuestionPromptID,
AppraisalResponse.Detail,
AppraisalResponse.ModifiedDate,
PersonID
FROM AppraisalResponse
WHERE AppraisalResponse.ID=@AppraisalResponseID AND AppraisalResponse.Detail<>@Detail
END
If @Detail is not null or blank, I need to check if AppraisalResponse.Detail is blank or null (- I think this is where I am running into so much trouble). If it is blank or null then
I need to check if there is already a record in AppraisalHistory with this ID. If there is, I need to insert the blank record to history, otherwise not.
If @Detail is null.
I need to check if there is already a record in Appraisal History with this ID. If there is, I need to insert the blank record to history, otherwise not.
Даже описание скопипащено
+163
$year = date("Y");
$month = date("m");
$day = date("d");
if ($month == 9 or $month == 10 or $month == 11)
{
$month_new = $month + 1;
echo $year.'-'.$month_new.'-'.$day;
}
else
{
if ($month == 12) {$year_new = $year + 1;
$year_new = $year + 1;
$month_new = 1;
echo $year_new.'-0'.$month_new.'-'.$day; }
else {
$month_new = $month + 1;
echo $year.'-0'.$month_new.'-'.$day;}
}
не удержался )
−115
# Функция обновляет файл базы
# Пользоваться: cut_jnl($bc, $local_ip, $jnl_string_new);
sub cut_jnl
{
my ( $bc, $ip_old, $string_new ) = @_;
open (JNL, "<$bc->{const}{base_jnl}");
undef $\;
my @all_file = <JNL>;
close JNL;
chomp($string_new);
$string_new .= "\n" if ($string_new ne '');
grep { s/.*$ip_old;.*/$string_new/sg } @all_file;
open (JNL, ">$bc->{const}{base_jnl}");
grep { print JNL } @all_file;
close JNL;
$bc->{const}{info}->debug("Update jnl, update string: $ip_old on $string_new");
}
no comments... особенно доставляют инструкции grep {}, это похлеще map {} будет.
+162
CString sLineNumber = _T("Line");
for(int lineIndex = 0; lineIndex < 255; lineIndex++)
{
sLineNumber += (_itot(lineIndex + 1, temp, 10));
...
sLineNumber = _T("Line");
}
Build the string variable in loop, instead of use CString::Format(...)
+130
csu = 0;
for i=1:1:devices
csu = csu + device_twt(i);
end;
csu = csu / (devices * time);
fprintf('коэффициент использования системы = %f\n', csu);
Говнокод на MATLAB.