-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+80
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
public class лаба22 {
int i;
лаба22(int k){
i=k;}
int [] a = new int [i];
void длина(){
System.out.println(a.length);
}
public static void main(String[] args) {
лаба22 s = new лаба22(5);
s.длина();
}
}
Студеньтики... тупоголовые как и их преподы
argamidon,
24 Февраля 2015
-
+165
- 1
- 2
- 3
- 4
- 5
foreach ($user as $field => $value) {
if ($field == 'username') {
$user[$field] = md5($value);
}
}
Обучаю стажера, который целый год кодил на битрикс, частенько у него проскользает такой подход для обновления значений в ассоциативном массиве.
mr-lekafe,
18 Ноября 2014
-
+131
- 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
module Main:
program factorial:
algorithm factorial:
description of the algorithm:
factorial of n is the algorithm that calculates the product of all the positive integers less than or equal to n.
end of description of the algorithm.
example of usage of the algorithm:
var1 is equal to call algorithm with parameter n which is equal to 5;
begin of a comment:
var1 is now1 120 = 5*4*3*2*1.
end of a comment.
end of example of usage of the algorithm.
description of author of the algorithm:
name: John.
surname: Smith.
date of writing of the algorithm: 2009.
end of description of author of the algorithm.
properties of the algorithm:
callable from other modules.
callable from this module.
can be used in expressions.
end of properties of the algorithm.
parameters of the algorithm:
data n: type is positive integer.
end of parameters of the algorithm.
variables of the algorithm:
data res: type is positive integer.
data now1: type is positive integer.
end of variables of the algorithm.
initialization of the variables of the algorithm:
res is equal to 1.
now1 is equal to n.
end of initialization of the variables of the algorithm.
begin of the algorithm:
cycle: while now1 is not 1, repeat:
res is equal to multiply res by now1.
now1 is equal to subtract 1 from now1.
end of cycle.
result of the algorithm is res
end of the algorithm.
algorithm main:
description of the algorithm:
main algorithm that shows the factorial of the inputted number.
end of description of the algorithm.
example of usage of the algorithm:
end of example of usage of the algorithm.
description of author of the algorithm:
name: John.
surname: Smith.
date of writing of the algorithm: 2009.
end of description of author of the algorithm.
properties of the algorithm:
callable from the system.
end of properties of the algorithm.
parameters of the algorithm:
data arguments: type is array of strings.
end of parameters of the algorithm.
variables of the algorithm:
end of variables of the algorithm.
initialization of the variables of the algorithm:
end of initialization of the variables of the algorithm.
begin of the algorithm:
call algorithm writeInteger with parameter str which is equal to
call algorithm factorial with parameter n which is equal to
call algorithm readInteger without parameters.
result of the algorithm is 0.
end of the algorithm.
Небольшой ответ набирающему популярность WCT. Новый язык программирования LOOOONG:
- Отступы обязательны.
- Все блоки в функциях ("алгоритмах") обязательны.
- блоки нужно записывать именно в таком порядке.
- Имена параметров необходимо помнить, когда вызываешь "алгоритм".
- Ключевых слов ОЧЕНЬ МНОГО.
miscff,
22 Августа 2014
-
−163
- 1
- 2
- 3
- 4
Если ЗначениеЗаполнено(Сделка) И ЛЕВ(Сделка.Ссылка, 10) = "Заказ пост" Тогда
//другой говнокод
КонецЕсли;
Правильная проверка типов
alexinzaz,
14 Августа 2014
-
+156
- 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
if ($.browser.msie && $.browser.version < 8) {
$("div.banneritem:gt(0)").remove();
$("#viewnow").remove();
$("#morerealestates").css("margin-top", "-26px");
$("img[align=right]").css("float", "right");
}
else {
setTimeout(function(){
slider();
}, 0);
}
var got = $("div.banneritem:eq(0)").find("#preview").find("a").attr("href");;
var timer = 7500;
var anim = 750;
function slider()
{
setTimeout(function(){
do_slide(0);
setTimeout(function(){
do_slide(1);
setTimeout(function(){
do_slide(2);
setTimeout(function(){
do_slide(2, true);
setTimeout(function(){
do_slide(1, true);
setTimeout(function(){
do_slide(0, true);
slider();
}, timer);
}, timer);
}, timer);
}, timer);
}, timer);
}, timer);
}
function do_slide(v,rev)
{
x = "div.banneritem:eq(" + v + ")";
if(rev==null)
{
$(x).slideUp(anim);
foo = $("div.banneritem:eq(" + (v+1) + ")").find("#preview").find("a").attr("href");
}else
{
$(x).slideDown(anim);
foo = $("div.banneritem:eq(" + (v-1) + ")").find("#preview").find("a").attr("href");
}
if(foo!=null) got = foo;
}
$("#viewnow").click(function(){
window.location=got;
});
Классика, слайдер на 3 елемента, с возавтом ;)
expert,
15 Мая 2014
-
−166
- 1
- 2
- 3
- 4
- 5
- 6
SELECT ...
FROM users_account
....
WHERE
(T.userid=@userid or (@userid=null and @account!=null))
and (T.account=@account or (@userid!=null and @account=null))
Есть табличка с юзерами и счетами на которых у юзеров есть игровая валюта.
Есть индекс по обоим этим полям (userid, account).
Каждый такой запрос сканирует весь индекс,а не делает по ней поиск, чем и грузит субд.
Но попытки оптимизировать запрос не увечались успехом,
т.к. я так и не понял что хотел сказать автор в своём условии where.
bliznezz,
05 Февраля 2014
-
+158
- 1
empty ( $php->p['h']{'p'}{'p'}['h']->p );
__proto__,
01 Февраля 2014
-
+9
- 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
/** фрагмент 0 */
buff[symbols]=0;
printf ("%s\n",buff);
if (strcmp (buff,"Yes!") != 0)
exit (1);
strcpy (buff,"");
sprintf (buff,"%s","File_size?");
printf ("%s\n",buff);
/** фрагмент 1 */
Par2 = 0;
if (number_packet < 10)
Par2 = 1;
else
if (number_packet < 100)
Par2 = 2;
else
if (number_packet < 1000)
Par2 = 3;
else
if (number_packet < 10000)
Par2 = 4;
else
if (number_packet < 100000)
Par2 = 5;
else
if (number_packet < 1000000)
Par2 = 6;
else
if (number_packet < 10000000)
Par2 = 7;
Par2++;
2 фрагмента лабораторной работы
dannikonov,
24 Декабря 2013
-
+157
- 1
- 2
- 3
- 4
- 5
- 6
- 7
var infoDiv = "<div id='fastInfo' style='font-size:16px !important;padding: 6px;padding-bottom:10px; z-index:1000000;position:fixed;top:20%;width:3px;right:0;background:white;border: 1px solid green;border-right:0;'></div>";
$('#navi').before(infoDiv);
var ggwp = $('a[href*="user_info="]');
$.each(ggwp, function(index, value) {
value.setAttribute("onmouseenter", "$('#fastInfo').animate({'width': '300px'}, 200);function received(data) { if ($($(data).find('.gradient_block1:has(\"table\")')[0]).html() == undefined) {dtxs = $($(data).find('.stnd_padd:has(\"table\")')[0]).html().replace('img', 'xuimg');} else {dtxs = $($(data).find('.gradient_block1:has(\"table\")')[0]).html().replace('img', 'xuimg');} $('#fastInfo').html('<span style=\"font-size:small\">' + dtxs + '<hr style=\"border:0;height:1px;background-color:black;margin:6px;color:black\" /><div style=\"padding-left:13px\">' + $($(data).find('.bottom_link_block')[0]).html() + '</div><hr style=\"border:0;height:1px;background-color:black;margin:6px;color:black\" /><div style=\"padding-left:13px;font-size:small\">' + $($(data).find('.blue_border_bottom')[0]).html().replace(/padding-bottom:10px;/gim, ''));}$.ajax({'url': 'http://spaces.ru/anketa/?name=" + value.href.match(/user_info=([a-zA-Z0-9\-\_]+)/gim)[0].replace("user_info=", "") + "', success: received});");
value.setAttribute("onmouseleave", "$('#fastInfo').animate({'width': '3px'}, 200);function clrscr() {$('#fastInfo').html('');} setTimeout(clrscr, 200);");
});
Ребят, это диагноз?
Навесить обработчик через .on/.bind/.live не смог.
Efog,
09 Декабря 2013
-
−132
- 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
1.TextWindow.WriteLine ("Напиши число от 0 до 9 и я переведу его на английский")
2.Число = TextWindow.ReadNumber()
3.If Число = "0" Then
4.TextWindow.WriteLine ("Zero")
5.ElseIf Число = "1" Then
6.TextWindow.WriteLine ("One")
7.ElseIf Число = "2" Then
8.TextWindow.WriteLine ("Two")
9.ElseIf Число = "3" Then
10.TextWindow.WriteLine ("Three")
11.ElseIf Число = "4" Then
12.TextWindow.WriteLine ("Four")
13.ElseIf Число = "5" Then
14.TextWindow.WriteLine ("Five")
15.ElseIf Число = "6" Then
16.TextWindow.WriteLine ("Six")
17.ElseIf Число = "7" Then
18.TextWindow.WriteLine ("Seven")
19.ElseIf Число = "8" Then
20.TextWindow.WriteLine ("Eight")
21.ElseIf Число = "9" Then
22.TextWindow.WriteLine ("Nine")
23.Else
24.TextWindow.WriteLine ("Не знаю таких больших цифр")
25.EndIf
elseif число=10 then
msgbox "программа бо-бо"
else
msgbox "программа бо-бо"
http://vbbook.ru/small-basic/ysloviya--primeru-small-basic/
Stertor,
23 Ноября 2013