- 1
- 2
- 3
$(".rent_table._rent_list tbody input").each(function() {
$(this).attr("checked", "checked");
});
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+155
$(".rent_table._rent_list tbody input").each(function() {
$(this).attr("checked", "checked");
});
$(".rent_table._rent_list tbody input"). attr("checked", "checked");
PEOPLE WHY Y NO RTFM?
PS этот each отрабатывался на сотне inputов, чем вешал ie6
+161
QString str[5][5] = {"a", "b", "c", "d", "e",
"f", "g", "h", "i", "k",
"l", "m", "n", "o", "p",
"q", "r", "s", "t", "u",
"v", "w", "x", "y", "z"};
QString enc, text = ui->lineEdit->text();
int l = text.length();
QString tmp[1][8] = {"s", "o", "m", "e", "t", "e", "x", "t"};
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < 9; j++)
{
for (int ix = 0; ix < 6; ix++)
{
for (int jx = 0; jx < 6; jx++)
{
if(tmp[i][j] == str[ix][jx])
enc = str[ix][jx + 1];
ui->lineEdit_2->setText(enc);
}
}
}
}
}
Такой-то квадрат Полибия!
+147
QT project:
t=x1; x1=x2; x2=t;
t=y1; x1=y2; y2=t;
И еще 90 говнопятнышек!
Налетай: http://www.viva64.com/ru/a/0077/
+70
for (AllResponseCache actionResponse : allResponses) {
if (null != actionResponse.getResponseStatus() && actionResponse.getResponseStatus().length() > 0) {
for (ResponseSubjectCache subj : actionResponse.getSubjects()) {
// find needed element
if (subj.getClaims() != null) {
for (ClaimCache claimCache : subj.getClaims()) {
Seller seller = getSellerByPersonMatched(pool, claimCache);
if (seller != null) {
if (mapToSyncronize.get(seller) == null) {
mapToSyncronize.put((SellerrEntity) seller, new LinkedList<ReportResponseCache>());
}
mapToSyncronize.get(seller).add(actionResponse);
}
}
}
}
}
}
Индусы и "for-if"-ы.
Я уж думал будет хронология как в России с "президентами" - "лысый, волосатый, лысый, волосатый" и так далее.
А тут "for, if, for, if" но в конце всё-таки 2 иф-а!
+160
$bError=true;
do {
$logistType = $_REQUEST['logistType'];
if (!preg_match("|^\d+$|", $logistType)) { break; }
if ($_SESSION['cartaddon']['***'] and $logistType>=1 and $logistType<=5) {
} elseif (!$_SESSION['cartaddon']['***'] and $logistType>=3 and $logistType<=5) {
} else {
break;
}
$_SESSION['cartaddon']['logistType'] = $logistType;
$bError = false;
$text = $_REQUEST['text'];
$text = trim(strip_tags($text));
$_SESSION['cartaddon']['pozhelania'] = $text;
} while (0);
Проверка если ли ошибки при оформлении заказа
На месте звездочек - палевное название, так что зацензурил
ПыСы: код не мой. И спасибо богам за это
+128
public class BusinessUnitDetail
{
public string Description { get; set; }
}
...
[TestMethod]
public void DescriptionTest()
{
BusinessUnitDetail target = new BusinessUnitDetail();
string expected = "test test test\n test";
string actual;
target.Description = expected;
actual = target.Description;
Assert.AreEqual(expected, actual);
}
беспощадная проверка всего и вся
+83
public static long getDifference(Date date1, Date date2, int unit) {
if (date1 == null || date2 == null) {
throw new IllegalArgumentException("Date cannot be null!");
}
if (date1.after(date2)) {
Date swap = date1;
date1 = date2;
date2 = swap;
}
long result = 0;
long diff = date2.getTime() - date1.getTime() + (60 * 60 * 1000L);
switch (unit) {
case Calendar.YEAR:
result = diff / (60 * 60 * 24 * 365 * 1000L);
break;
case Calendar.MONTH:
result = diff / (60 * 60 * 24 * 30 * 1000L);
break;
case Calendar.DAY_OF_YEAR:
result = diff / (60 * 60 * 24 * 1000L);
break;
default:
throw new UnsupportedOperationException("Impossible to get time difference in coerced unit.");
}
return result;
}
Опять даты, опять.... Java?
Удивительно, но этот код использовался в вычислениях, связанных с начислением выплат. Разумеется, считалось всё неправильно, в связи с чем было обнаружено ЭТО.
+146
vec->elements = realloc(vec->elements, sizeof(struct _vector_element)*newcapacity);
if(vec->elements == NULL) {
// Lol. All your data is lost.
vc_set_error("Unable to allocate space for elements.");
return 1;
}
Автор не догадался сохранить старый указатель.
+75
/**
* Workaround ObjectInputStream for maintaining backward compatibility with serialization.
*
* In the future, please, please, PLEASE assign each serializable class an explicit serialVersionUID.
*
*/
public final class DecompressibleInputStream extends ObjectInputStream {
private static final Logger logger = Logger.getLogger(DecompressibleInputStream.class);
public DecompressibleInputStream(InputStream in) throws IOException {
super(in);
}
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
ObjectStreamClass resultClassDescriptor = super.readClassDescriptor();
Class<?> localClass;
try {
localClass = Class.forName(resultClassDescriptor.getName());
} catch (ClassNotFoundException e) {
logger.error("No local class for " + resultClassDescriptor.getName(), e);
return resultClassDescriptor;
}
ObjectStreamClass localClassDescriptor = ObjectStreamClass.lookup(localClass);
if (localClassDescriptor != null) { // only if class implements serializable
final long localSUID = localClassDescriptor.getSerialVersionUID();
final long streamSUID = resultClassDescriptor.getSerialVersionUID();
if (streamSUID != localSUID &&
(localClass == ByteArraySerial.class || localClass == Vector2D.class)) {
// Workaround: check for serialVersionUID mismatch with two specific classes
logger.error(String.format("Overriding serialized class version mismatch for %s: " +
"local serialVersionUID = %s, stream serialVersionUID = %s",
localClass.getName(), localSUID, streamSUID));
resultClassDescriptor = localClassDescriptor; // Use local class descriptor for deserialization
}
}
return resultClassDescriptor;
}
}
Продукт использует в качестве бинарного формата сохранённых файлов встроенную сериализацию. При этом ранние версии полагались на встроенный serialVersionUID.
Вот теперь приходится расхлёбывать. Наши воркэраунды - самые воркэраундные воркэраунды в мире.
+122
<html>
<head> <title> PROEKT</title> </head>
<body>
<body background="images/фон.JPeG" TEXT="crimson">
<h1 align="center">LIVE IN MUSIC</H1>
<br><img src="images/music.gif"><img src="images/music.gif">
<br><form action="avtor.php" method="get">
Логин: <input name="login" type="text">
Пароль: <input name="pass" type="text">
<a href="indexator.html">Войти</a>
</form>
<br><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif">
</body>
</html>
<br><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif">