-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+119
- 1
- 2
- 3
- 4
- 5
- 6
- 7
> Наша фирма разрабатывает серьезный софт на CL, Scheme и
некоторых других языках. Но в последнее время в нашей продукции
часто стали находить эксплоиты (что-бы не пугать наших клиентов -
подробнее не скажу). Нам для LISP-подобных языков необходима
DEP (Data Execution Prevention). Есть ли подобные наработки в этой области?
Пока ничего побобного для языков этого семейства мы не находили и очень
расстроены сложившимися обстоятельствами.
Не мог ни запостить.
HaskellGovno,
27 Августа 2012
-
+24
- 1
- 2
- 3
Fixed f = 0.2;
f = std::abs(f);
std::cout << (float)f;
Угадайте, чему будет равно f?
Fixed - тип из той же библиотеки, что и в http://govnokod.ru/11294
TarasB,
10 Июля 2012
-
+15
Красивое, оптимальное, и самое главное, кроссплатформенное решение для ожидания нажатия клавиши.
http://habrahabr.ru/post/147104/
Предупреждая вопрос "где здесь с++", отвечу - автор считал, что он пишет на с++, и даже использовал пару конструкций оттуда - перегрузку функций и new/delete.
bormand,
05 Июля 2012
-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
class SumClass
{
int A, B;
public:
void Set_A(int A) {this->A = A;}
void Set_B(int B) {this->B = B;}
int Sum() {return A+B;}
}
class MultiSumClass
{
SumClass Sum;
int count;
public:
void Set_A(int A) {Sum.Set_A(A);}
void Set_B(int B) {Sum.Set_B(B);}
void Set_Count(int count) {this->count = count;}
int GetSum() {return Sum->Sum()*count;}
}
void main()
{
MultiSumClass MSC;
MSC.Set_A(5); MSC.Set_B(10);
MSC.Set_Count(2);
cout << MSC.GetSum();
}
Вот зачем ООП нужно
http://www.gamedev.ru/flame/forum/?id=164035
извените за игрстрй
TarasB,
02 Июля 2012
-
−109
- 1
monthes = ['Нулября', 'Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря']
Вот, оказывается, как лечится, что индексы в массиве начинаются с нуля, а номера месяца с 1
solenko,
24 Января 2012
-
+76
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD})
public static @interface Property { String value(); }
public static class PropertyImpl implements Property {
private final String value;
public PropertyImpl(String value) { this.value = value; }
@Override public Class<? extends Annotation> annotationType() { return Property.class; }
@Override public String value() { return this.value; }
@Override public int hashCode() { return (127 * "value".hashCode()) ^ value.hashCode(); }
@Override public boolean equals(Object o) {
if (!(o instanceof Property)) { return false; }
Property other = (Property) o;
return value.equals(other.value());
}
}
отформатировал для компактности.
Идеи для чего делать реализцию аннотации?
tir,
06 Декабря 2011
-
+165
- 1
- 2
- 3
- 4
- 5
- 6
@jfredys 23-Mar-2011 01:07
I was looking for trimming all the elements in an array, I found this as the simplest solution:
<?php
array_walk($ids, create_function('&$val', '$val = trim($val);'));
?>
array_map? не, не слышал.
DrFreez,
27 Ноября 2011
-
+126
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
//javax.swing.JTree
public void setBounds(Rectangle r) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setBounds(r);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setBounds(r);
}
}
}
public void setSize (Dimension d) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setSize(d);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setSize(d);
}
}
}
public void requestFocus() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).requestFocus();
} else {
Component c = getCurrentComponent();
if (c != null) {
c.requestFocus();
}
}
}
public void addFocusListener(FocusListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).addFocusListener(l);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.addFocusListener(l);
}
}
}
public boolean isFocusTraversable() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isFocusTraversable();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isFocusTraversable();
} else {
return false;
}
}
}
3.14159265,
10 Октября 2011
-
+134
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
<style type="text/css">
p, div, ol, ul {
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
background: transparent;
}
.exception {
width: 700px;
border: 1px solid #D6D6D6;
background-color: #FAFAFA;
font-family: arial, tahoma, verdana;
font-size: 75%;
padding: 10px;
line-height: 140%;
}
.exception img {
float: left;
margin-right: 7px;
}
.exceptionTitle {
padding-top: 2px;
color: #AA0000;
font-size: 120%;
font-weight: bold;
}
.exceptionMessage {
background-color: white;
border: 1px solid #E1E1E1;
padding: 5px;
font-size: 110%;
margin: 10px 0;
}
.exception a {
cursor: pointer;
padding: 1px;
border-bottom: 1px dotted #555;
color: #000;
}
.exceptionTraceContainer {
font-size: 95%;
line-height: 150%;
font-family: verdana, tahoma, arial;
margin: 10px 0;
}
.exceptionTraceContainer ol {
padding-left: 25px;
}
.exceptionTraceContainer li {
padding-top: 5px;
}
.exceptionSystemInfo {
font-size: 90%;
border-top: 1px solid #E1E1E1;
padding: 10px 5px;
color: #666;
}
</style>
<!--[if IE]>
<style type="text/css">
img { display: none; }
</style>
<![endif]-->
<script type="text/javascript">
function _showAllTrace() {
var trace = document.getElementById('exceptionTrace');
trace.style.display = (trace.style.display == 'none') ? '' : 'none';
}
</script>
<div class="exception">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAxMi8wMi8wOOE6tm4AAAAYdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3Jrc0+zH04AAAHsSURBVDiNlZDNahNhFIaf+clkkknSNNHUohSRYlyIyxYRXLhVL8B7qCIKigUR3IobewOC0EWgdyCIf4sstLSRlopasQhxmkyTSTIZJ/PjIiZlzJTEB87iO3w8vO8RHMcJiOBX+Qad6iu0E1eYWVyN+jJEjFoalfvYtTKZmUXsepnqu+v/J3Gam5g/SqSOXyCuFZiavchvcwujcm9yiVFZJqZOo6g5CDwkSSGVP09j9wVd/eV4idPcwDI+oGXnIfCGo6hZEuk59tdvj5cYlQfEEwUkSQlJCDy0qTP4PRNj8+7REs+uYtXXSWbnABdwyS+UyC+UABdBDEjlzmLureE0N6IlB5+WkZUUsqweJhjw9x1PTBNT0tQ+LkVLOvprkpmT4Rr/SPq1TuF0vtPZWw1LWl+fEfg94onMsEp/BhzuJDmGqhU42HkSljR3n6Nq+ZFjRiUh8EikjuF292lsPwJAaOvl4Ofba+QK5xCl2Mjlj6LbqWG1DU5f/Ybc2H6MomiIogCBG/qYv/QGgPr7yyOSRDJLt6XT2HqI8HmtEKSzsyhqauIUA2yrSdvUkQUxhu854RtMiO/3EMUYYq64RNvU6XbqBL7TrzRmfNfGatWw2nVyxZsIjuMErS9PMXZW8Fx74hSSrJIr3iI9f4c/ZwP51LVnSksAAAAASUVORK5CYII=" alt="exception" />
<div class="exceptionTitle">Application was halted by an exception.</div>
<p>Debug-mode is off.</p></div>
Это что-то новенькое на говнокоде. Вылезло при попытке открыть один говнокод на отдельной странице (после другого сбоя, неудачи голосования). Кстати, это весь код страницы, никаких <html>, <head> и <body> не было.
gegMOPO4,
10 Августа 2011
-
+160
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
public function isValidModule($module)
{
if (!is_string($module)) {
return false;
}
$module = strtolower($module);
$controllerDir = $this->getControllerDirectory();
foreach (array_keys($controllerDir) as $moduleName) {
if ($module == strtolower($moduleName)) {
return true;
}
}
return false;
}
Великий и могучий Zend Framework в очередной раз очаровывает своих адептов изяществом и простотой(((
hacpaka,
21 Апреля 2011