- 1
- 2
- 3
- 4
<button type='button' id='button-download'>download zipfile</button>
$("#button-download").live("click", function() {
$.get("http://localhost/admin/zip/002140.zip"); // doesn't work?
})
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+160
<button type='button' id='button-download'>download zipfile</button>
$("#button-download").live("click", function() {
$.get("http://localhost/admin/zip/002140.zip"); // doesn't work?
})
Ссылка на скачивание файла, современный вариант.
+171
pic = new Array()
for(i=0;i<21;i++)
{
pic[i] = new Image();
if(i==0) pic[i].src = "http://philosophy.do.am/_ph/1/1/272439236.jpg";
if(i==1) pic[i].src = "http://philosophy.do.am/_ph/1/1/987050819.jpg";
if(i==2) pic[i].src = "http://philosophy.do.am/_ph/1/1/442166179.jpg";
if(i==3) pic[i].src = "http://philosophy.do.am/_ph/1/1/925090451.jpg";
if(i==4) pic[i].src = "http://philosophy.do.am/_ph/1/1/833480698.jpg";
if(i==5) pic[i].src = "http://philosophy.do.am/_ph/1/1/958410581.jpg";
if(i==6) pic[i].src = "http://philosophy.do.am/_ph/1/1/472798047.jpg";
if(i==7) pic[i].src = "http://philosophy.do.am/_ph/1/1/657609683.jpg";
if(i==8) pic[i].src = "http://philosophy.do.am/_ph/1/1/559445124.jpg";
if(i==9) pic[i].src = "http://philosophy.do.am/_ph/1/1/292242334.jpg";
if(i==10) pic[i].src = "http://philosophy.do.am/_ph/1/1/2741410.jpg";
if(i==11) pic[i].src = "http://philosophy.do.am/_ph/1/1/312659858.jpg";
if(i==12) pic[i].src = "http://philosophy.do.am/_ph/1/1/333153864.jpg";
if(i==13) pic[i].src = "http://philosophy.do.am/_ph/1/1/811066713.jpg";
if(i==14) pic[i].src = "http://philosophy.do.am/_ph/1/1/108915398.jpg";
if(i==15) pic[i].src = "http://philosophy.do.am/_ph/1/1/661197254.jpg";
if(i==16) pic[i].src = "http://philosophy.do.am/_ph/1/1/255266572.jpg";
if(i==17) pic[i].src = "http://philosophy.do.am/_ph/1/1/507281622.jpg";
if(i==18) pic[i].src = "http://philosophy.do.am/_ph/1/1/996088137.jpg";
if(i==19) pic[i].src = "http://philosophy.do.am/_ph/1/1/870834686.jpg";
if(i==20) pic[i].src = "http://philosophy.do.am/_ph/1/1/507281622.jpg";
if(i==21) pic[i].src = "http://philosophy.do.am/_ph/1/1/496256382.jpg";
}
так ребята с форума присваивают ссылки списку изображений
+68
<span class="realty_price"><?php echo $ad['price']?>
<?php if(! empty($ad['addinfo']['unit'])): ?>
<?php echo $ad['addinfo']['unit']['value'] ?>
<?php
unset($ad['addinfo']['unit']);
else:
?>
<?php
// Говнокод
if($ad['addinfo']['type_service']['value'] == 'аренда'):
?>
руб.мес.
<?php else: ?>
тыс.руб.
<?php endif; ?>
<?php endif; ?>
</span>
Хороший человек, искренний...
+142
<tr>
<td valign="top" align="center"> <?=($image = $gallery->setId($line['id'])->getImaget("s")) ? "<a href='news/$line[id]'><img src='$image[src]' alt='$line[name]' width='50' title='$line[name]' style='float: left; border: 0px; margin-right: 10px;'></a>" : ""?></td>
<td valign="top"><a href="<?=$line['link'];?>"><?=$line['name'];?></a><br /><?=$line['announce'];?></td>
</tr>
Скопировал как нашел
+69
//JAVA
request.setAttribute("sexForRegi", person.getSex().getLogicConstant());
//А теперь и JSTL:
<c:choose>
<c:when test="${sexForRegi == 'MALE'}">
<div class="sys-icon-128x128 icon-128x128-RegEndMan"></div>
</c:when>
<c:when test="${sexForRegi == 'FEMALE'}">
<div class="sys-icon-128x128 icon-128x128-RegEndWoman"></div>
</c:when>
</c:choose>
Sex - это у меня сущность, которая определяет половую принадлежность.
Regi - Action, отвечающий за регистрацию.
Вот и назвал переменную, чтобы определять какую картинку выводить "sexForRegi".
Вдумавшись, такое название наталкивает на мнение, что регистрация возможна только через секс =)
+97
namespace Interface.module1
{ class Sort_text
{ private string[] str;
public Sort_text(string[] astr)
{ if (astr.Length == 0)
{ str = new String[1];
str[0] = "";
}
else
{ str = new String[astr.Length];
str = astr; }
}
public string[] Str
{ get { return str; }
set { this.str = value; }
}
public void sort_poslovno_pryamoi()
{ string ss = "";
List<string> t = new List<string>();
for (int i = 0; i < Str.Count(); i++)
for (int j = 0; j < Str[i].Length; j++)
{ if (Str[i][j] == ' ')
{ if (ss == "")
continue;
t.Add(ss);
ss = "";
}
else
{ ss = ss + Str[i][j];
if (j + 1 == Str[i].Length && ss != "")
{ t.Add(ss);
ss = ""; }
}
}
t.Sort();
Str = t.ToArray();
}
public void sort_poslovno_obratnyi()
{ string ss = "";
List<string> t = new List<string>();
for (int i = 0; i < Str.Count(); i++)
for (int j = 0; j < Str[i].Length; j++)
{ if (Str[i][j] == ' ')
{ if (ss == "")
continue;
t.Add(ss);
ss = ""; }
else
{ ss = ss + Str[i][j];
if (j + 1 == Str[i].Length && ss != "")
{ t.Add(ss);
ss = ""; }
}
}
t.Sort();
t.Reverse();
Str = t.ToArray();
}
public void sort_postrochno_pryamoi()
{ string ss = "";
List<string> t = new List<string>();
for (int i = 0; i < Str.Count(); i++)
{ t.Add(Str[i]);
}
t.Sort();
Str = t.ToArray();
}
public void sort_postrochno_obratnyi()
{ string ss = "";
List<string> t = new List<string>();
for (int i = 0; i < Str.Count(); i++)
{ t.Add(Str[i]);
}
t.Sort();
t.Reverse();
Str = t.ToArray();
}
}
class Sort_bin
{ private byte[] b;
public Sort_bin(byte[] ab)
{ b = ab; }
public byte[] B
{ get { return b; }
set { this.b = value; }
}
public void sort_bin_pryamoi()
{ List<byte> t = new List<byte>(B.ToList());
t.Sort();
B = t.ToArray();
}
public void sort_bin_obratnyi()
{ List<byte> t = new List<byte>(B.ToList());
t.Sort();
t.Reverse();
B = t.ToArray(); }
}
}
+69
if(isset($_POST['submit'])){
$cat = $_POST['cat'];
/** Определяем переменную дириктории */
if($cat == 1) :
$uploaddir = '../uploads/poli/';
elseif($cat == 2) : $uploaddir = '../uploads/site/';
elseif($cat == 3) : $uploaddir = '../uploads/style/';
elseif($cat == 4) : $uploaddir = '../uploads/illustration/';
endif;
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
$file_name = $_FILES['userfile']['name'];
$desc = trim(htmlspecialchars($_POST['desc']));
$position = $_POST['pos'];
if (!file_exists($uploadfile)){
/** Перемещаем фаил из временной дириктории в папку uploads */
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
/** НИКашерное обрезание да бля стыдно ,но конец рабочего дня в голову не чего не лезит */
$uploadfile = substr($uploadfile,3);
$result = $db->INSERT('pfolio',array('img','description','cat','position'),array($uploadfile,$desc,$cat,$position));
if($result) : echo '<h2 style="color:green;"> Фаил успешно загружен </h2> <a href="admin.php?am=mod[portfolio]&add">Назад</a>'; else: echo 'Не удачно'; endif;
} else {
echo "Возможная атака с помощью файловой загрузки!\n";
}
}else{
echo '<h2 style="color:red;"> Фаил с таким именем уже сущевствует !</h2> <br /> <p style="text-decoration:underline; color : red; cursor:pointer;" onClick="history.back()">Назад</a>';
}
НИкашерно обрезал
−26
Apply_Deferred_Lighting_Template< LIGHT_STAGE, ELightType::Light_Point >(
context, queue,
lightsArray + lightOffsets[ LIGHT_STAGE, ELightType::Light_Point ],
lightCounts[LIGHT_STAGE][ELightType::Light_Point]
);
Apply_Deferred_Lighting_Template< LIGHT_STAGE, ELightType::Light_Point >(
context, queue,
lightsArray + lightOffsets[ LIGHT_STAGE, ELightType::Light_Spot ],
lightCounts[LIGHT_STAGE][ELightType::Light_Spot]
);
Apply_Deferred_Lighting_Template< LIGHT_STAGE, ELightType::Light_Beam >(
context, queue,
lightsArray + lightOffsets[ LIGHT_STAGE, ELightType::Light_Beam],
lightCounts[LIGHT_STAGE][ELightType::Light_Beam]
);
Здесь больше:
http://www.gamedev.ru/code/forum/?id=162116
+123
import Data.Array.IO
main = do arr <- newArray (1,10) 37 :: IO (IOArray Int Int)
a <- readArray arr 1
writeArray arr 1 64
b <- readArray arr 1
print (a, b)
Вот такое вот говно приходится терпеть, если хочешь работать в хаскеле с массивами. Дальше будет только нос закрывай. To be continued...
+72
final String sqlString=
" select distinct 1 "+
" , c_rep.card_id as rep_id "+
" , av_rep_xml.long_binary_value as rep_xml "+
" , av_sname_nm.string_value as name "+
" , av_c_date.date_value as date \n"+
" from card c_res \n"+
" join attribute_value av_res_rep on (av_res_rep.card_id = c_res.card_id and av_res_rep.attribute_code = 'JBR_RIMP_REPORT') \n"+
" join attribute_value av_res_exec on (av_res_exec.card_id = c_res.card_id and av_res_exec.attribute_code = 'JBR_INFD_EXEC_LINK') \n"+
" join card c_rep on (c_rep.card_id = av_res_rep.number_value ) \n"+
" left outer join attribute_value av_rep_xml on (av_rep_xml.card_id = c_rep.card_id and av_rep_xml.attribute_code = 'ADMIN_702354') \n"+
" left outer join attribute_value av_c_date on (av_c_date.card_id = c_rep.card_id and av_c_date.attribute_code = 'CREATED') \n"+
" left outer join attribute_value av_rep_exec on (av_rep_exec.card_id = c_rep.card_id and av_rep_exec.attribute_code ='ADMIN_702335') \n"+
" left outer join person person_card on (person_card.person_id=av_rep_exec.number_value) \n"+
" left outer join attribute_value av_sname_nm on (av_sname_nm.card_id = person_card.card_id and av_sname_nm.attribute_code = 'JBR_PERS_SNAME_NM') \n"+
" left outer join attribute_value av_on_control on ( av_on_control.attribute_code = 'JBR_TCON_ONCONT' and av_on_control.card_id = c_res.card_id) \n"+
" where c_res.card_id = " + sResId+ "\n"+
" and av_res_exec.number_value = av_rep_exec.number_value \n"+
" and av_on_control.value_id=1449 \n"+
" and c_res.status_id in (103, 206) \n"+
// UNION
" UNION select 51 \n"+
" , c_rep.card_id as rep_id \n"+
" , av_rep_xml.long_binary_value as rep_xml \n"+
" , av_sname_nm.string_value as name \n"+
" , av_c_date.date_value as date \n"+
" from card c_prnt \n"+
" left outer join attribute_value av_res on ( av_res.attribute_code = 'JBR_IMPL_RESOLUT' and av_res.card_id = c_prnt.card_id) "+
" left outer join card c_res on (c_res.card_id=av_res.number_value)"+
" join attribute_value av_res_rep on (av_res_rep.card_id = c_res.card_id and av_res_rep.attribute_code = 'JBR_RIMP_REPORT') "+
" join attribute_value av_res_exec on (av_res_exec.card_id = c_res.card_id and av_res_exec.attribute_code = 'JBR_INFD_EXEC_LINK') "+
" join card c_rep on (c_rep.card_id = av_res_rep.number_value ) "+
" left outer join attribute_value av_rep_xml on (av_rep_xml.card_id = c_rep.card_id and av_rep_xml.attribute_code = 'ADMIN_702354') "+
" left outer join attribute_value av_c_date on (av_c_date.card_id = c_rep.card_id and av_c_date.attribute_code = 'CREATED') "+
" left outer join attribute_value av_rep_exec on (av_rep_exec.card_id = c_rep.card_id and av_rep_exec.attribute_code = 'ADMIN_702335') "+
" left outer join person person_card on (person_card.person_id=av_rep_exec.number_value) "+
" left outer join attribute_value av_sname_nm on (av_sname_nm.card_id = person_card.card_id and av_sname_nm.attribute_code = 'JBR_PERS_SNAME_NM') "+
" left outer join attribute_value av_on_control on ( av_on_control.attribute_code = 'JBR_TCON_ONCONT' and av_on_control.card_id = c_res.card_id) "+
" where "+
" c_prnt.card_id = "+ sResId+ "\n"+
" and c_prnt.template_id <> 324 \n"+
" and av_res_exec.number_value = av_rep_exec.number_value \n"+
" and av_on_control.value_id=1449 \n"+
" and c_res.status_id in (103, 206) \n"+
.... и еще 8 UNION, куча строчек в том же стиле и с тем же смыслом
Формирование SQL запроса в методе, который возвращает строковое представление хода исполнения поручения (кто сделал, что сделал, когда и в какой последовательности). Сам метод, если кому интересно дергается из Jasper report.
Мало того, что запросик имеет длину 250 строк кода (большая часть которых копи/паст с небольшими изменениями), так он ещё и возвращает полную ахинею вместо того что нужно. Чего хотел сказать автор - теперь уже не узнать...