-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+146
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
program chet;
uses crt;
var a,
b,
x,
y:Integer;
begin
clrscr;
Write('Vvedite X=');
ReadLn(x);
Write('Vvedite Y=');
ReadLn(y);
for a:=0 to 30000 do
for b:=0 to 30000 do
begin
if (a+b=x)and(a*b=y) then
begin
Write('a=',a);
WriteLn('b=',b);
end;
end;
ReadLn;
end.
находи все возможные пары A и B!
ITdocer,
23 Октября 2011
-
+162
- 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
template <
typename PropertyOwner // Класс владельца
>
class properties {
public:
// Получить указатель на владельца по указателю на свойство
static PropertyOwner * owner( void * property ) {
int aai = (int)&(((PropertyOwner*)0)->__properties);
return (PropertyOwner *)((char*)property - aai);
}
};
/**
* Шаблон класса свойства
*/
template <
typename PropertyOwner, // Класс владельца
typename PropertyType, // Тип свойства
PropertyType (PropertyOwner::*getter)(), // Геттер
void (PropertyOwner::*setter)(PropertyType) > // Сеттер
class property {
public:
/**
* Чтение свойства - вызов геттера
*/
operator PropertyType() {
return (properties<PropertyOwner>::owner( this )->*getter)();
}
/**
* Запись в свойство - вызов сеттера
*/
void operator = ( const PropertyType & value ) {
(properties<PropertyOwner>::owner( this )->*setter)( value );
}
};
// Макросы для удобного определения свойств /////////
/**
* Начать объявления свойств в классе cls
*/
#define properties_start(cls) union { properties<cls> __properties;
/**
* Закончить объявление свойств в классе cls
*/
#define properties_end() };
/**
* Объявить свойство в классе cls типа type c геттером getter и сеттером setter
*/
#define property(cls,type,getter,setter) property<cls,type,&cls::getter,&cls::setter>
http://www.codenet.ru/progr/cpp/cpp-properties.php
AnimeGovno-_-,
22 Октября 2011
-
−154
- 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
case 2: //редактирование таблицы
do
{
for (i = 0; i < size; i++) //вывод таблицы, чтобы видно было, что нужно изменять
{
for (j = 0; j < 4; j++)
{
for (k = 0; k < 4; k++)
{
adres[k] = ((maska << (24 - 8 * k)) & bin_adres[i][j]) >> (24 - 8 * k);
}
cout << adres [0] << "." << adres [1] << "." << adres [2] << "." << adres [3] << "\t";
}
cout << endl;
}
cto ("Наберите необходимый адрес назначения" , s);
cout << s << endl;
for (j = 0; j < 4; j++)
{
cin >> adres [j];
if (adres[j] < 0 || adres[i] > 255) //проверка каждой введенной цифры на соответствие интервалу
{
cto ("Вы ввели неверное число. Введите число в диапазонe 0-255" , s);
cout << s << endl;
j--;
}
else
crv = (adres[0] << 24) + (adres[1] << 16) + (adres[2] << 8) + adres[3];
}
for (i = 0; i < size; i++) //перебор по строкам всего массива
{
if (crv == bin_adres[i][0]) //сравниваем первый элемент каждой строки, с введенным значением
{
temp = i; //получаем номер строки, которую необходимо редактировать
break;
}
}
cto ("Что необходимо изменить?\n Адрес назначения (нажмите 1)\n Адрес источника (нажмите 2)\n Шлюз(Нажмите 3)\n Маску(нажмите 4)\n", s);
cout << s << endl;
number = 0;
cin >> number; //получаем номер столбца для изменения
number--; //для правильного определения индекса элемента в массиве
cto ("Введите элемент", s);
cout << s << endl;
for (i = 0; i < 4; i++)
{
cin >> adres[i];
if (adres[i] < 0 || adres[i] > 255)
{
cto ("Вы выпали из диапазона 0-255. Введите нормальное число", s);
cout << s << endl;
i--;
}
}
bin_adres[temp][number] = (adres[0] << 24) + (adres[1] << 16) + (adres[2] << 8) + adres[3]; //записываем данный элемент в заданную строку
cto ("Для выхода из редактирования нажмите 1 (продолжить - любая цифра)", s);
cout << s << endl;
cin >> number;
}
while (number != 1);
system("cls"); //очиста окна командной строки
break;
Команда стажеров писала маршрутизатор на базе 1С предприятия и вот что получилось.
alexoy,
19 Октября 2011
-
+141
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
%%%sum_middle_by_formula_div_formula###$$$"""" + @if(Ispoln="" & @Text(a3)!="" &
@Text(CtrlDate)!="";(CtrlDate-a3)/86400;Ispoln="" & @Text(a3)!="" &
@Text(CtrlDate)="";(@Now-a3)/86400;Ispoln="" & @Text(DateDoc)!="" &
@Text(CtrlDate)!="";(CtrlDate-DateDoc)/86400;Ispoln="" & @Text(DateDoc)!="" &
@Text(CtrlDate)="";(@Now-DateDoc)/86400;Ispoln="1" & @Text(a3)!="" &
@Text(a10)!="";(a10-a3)/86400;Ispoln="1" & @Text(a3)!="" &
@Text(a10)="";(@Now-a3)/86400;Ispoln="1" & @Text(DateDoc)!="" &
@Text(a10)!="";(a10-DateDoc)/86400;Ispoln="1" & @Text(DateDoc)!="" &
@Text(a10)="";(@Now-DateDoc)/86400;(@Now-@Created)/86400) + """"~~~"1"&&&
%%%resultsbyselectedcolumns###"ИТОГО"$$$@Text(kolvo) + "~~~" + "-" + "~~~" +
"-" + "~~~" + "-" + "~~~" + @Text(ispor) + "~~~" + @Text(ispolz) + "~~~" +
@Text(vsego) + "~~~" + "-"&&&
Мало того что Lotus Notes сам по себе говно по сути и содержанию, так вот некоторые умельцы умудряются возвести это говно в степень так, что оно начинает глаза резать...
ЗЫ. Это шаблон скрипта используемого в модуле отчетов. Там такого тонны...
ЗЫЗЫ. Если автор этого узнал свое творение, пожалуйста убейся, быстро, решительно, я зае***ся это разгребать.
d_dev,
11 Октября 2011
-
−110
- 1
- 2
- 3
- 4
- 5
...
IF i.R_LITHOLOG_1_UPD_173 IS NOT NULL AND i.R_LITHOLOG_1_INS_69 IS NOT NULL THEN
INSERT INTO R_LITHOLOGY( SOURCE,DESCRIPTION,CODE,NAME,ACTIVE_FLAG)
VALUES(i.SOURCE,i.DESCRIPTION,i.R_LITHOLOG_1_UPD_173,i.CODE,NVL(i.R_LITHOLOG_1_INS_69,'1'));
...
Вдруг i.R_LITHOLOG_1_INS_69 IS NULL ?
Но почему тогда к i.R_LITHOLOG_1_UPD_173 такое доверие?
slbsomeone,
11 Октября 2011
-
−113
- 1
- 2
- 3
- 4
- 5
CURSOR v_cursor IS
SELECT
...
NVL(DECODE(record_status,'CURRENT',1,0),'1') r_grain_ro_1_ins_64,
...
Это в продакшн коде.
Oracle 10.2, PL/SQL
slbsomeone,
11 Октября 2011
-
−853
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
SELECT a.*,r.rating_count,r.rating_sum,cc.params AS catparams,cc.title AS cattle,cc.alias AS category_alias FROM gn_content AS a INNER JOIN gn_categories AS cc ON cc.id = a.catid LEFT JOIN gn_content_rating AS r ON r.content_id = a.id WHERE a.state = 1 AND cc.published = 1
AND ( a.publish_up = '2011-10-07 21:02:32' OR a.publish_up <= '2011-10-07 18:02:38' )
AND ( a.publish_down = '2011-10-07 21:02:32' OR a.publish_down >= '2011-10-07 18:02:38' )
AND (cc.id = 105 OR cc.id = 106 OR cc.id = 107 OR cc.id = 108 OR cc.id = 109 OR cc.id = 110 OR cc.id = 111 OR cc.id = 106 OR cc.id = 107 OR cc.id = 108 OR cc.id = 109 OR cc.id = 110 OR cc.id = 111)
ORDER BY a.created DESC
Это код модуля adinews2 для joomla
Используются всегда только 2 даты: начало, конец
uadeveloper,
07 Октября 2011
-
+146
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
<?php
$sasha = new Person('Sasha', 23, array('hangover', 'sad'));
$sasha->walking();
Sun::getInstance()->shining();
$beer = $sasha->buy('beer');
$sasha->drink($beer);
$sasha->fillingGood();
include STORY_PATH.'/next/part.php';
php?>
Копипаст (http://vk.com/note3292968_11375263)
Пиздец - это как ебануццо, только пиздец (с)
QarezZ,
01 Октября 2011
-
−84
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
def getListOf(points):
i=1
f=open('Welcome_sub.srt', 'a')
for point in points:
print "%d" % i
f.write(str(i)+'\n')
begin = point.getAttribute('begin').split(':')
dur = point.getAttribute('dur').split(':')
h=str( (int(begin[0])+int(dur[0])) if (int(begin[0])+int(dur[0]))>10 else '0'+str(int(begin[0])+int(dur[0])) )
m=str(int(begin[1])+int(dur[1])) if (int(begin[1])+int(dur[1]))>10 else '0'+str(int(begin[1])+int(dur[1]))
f.write(point.getAttribute('begin')+' --> '+''.join(h+':'+m+':'+str(float(begin[2])+float(dur[2])) )+'\n')
print "%s -->%s" % (point.getAttribute('begin'), ''.join(h+':'+m+':'+str(float(begin[2])+float(dur[2])) ))
f.write(getText(point.childNodes)+'\n')
print "%s" % getText(point.childNodes)
i+=1
nyators,
30 Сентября 2011
-
+159
- 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
var resizeTimer,calWidth,$BlockPath,widthLeftPart,widthRightPart,count;
var $headBlock = $('div.hdr');
var $rightBlock = $('li.userFullName');
var $leftBlock = $('li.subMenu-title');
$(document).ready(resizeLabels);
$(window).resize(resizeLabels);
function doResizeLabels($typeBlock) {
count = 2;
resultWidth = 0;
if ($typeBlock==$leftBlock) {
$BlockPath=$('ul.subMenu li:not(.subMenu-title)');
} else {
$BlockPath=$('ul.usersLink li:not(.userFullName)');
};
$BlockPath.each(function() {
eachPosition = $(this).position();
eachWidth = $(this).width();
eachOuterWidth = $(this).outerWidth();
count++;
if ($typeBlock==$leftBlock) {
widthLeftPart = eachPosition.left + eachWidth;
widthPadding = eachOuterWidth - eachWidth;
} else {
if (count==3) widthPadding = eachPosition.left;
widthRightPart = widthRightPart + eachOuterWidth;
};
});
if ($typeBlock==$leftBlock) {
widthLeftPart = widthLeftPart + ((widthPadding / 2) * count);
resultWidth = headWidth/2 - widthLeftPart;
} else {
rightWidth = headWidth/2 - widthRightPart;
resultWidth = rightWidth-(headWidth/2-widthPadding/2)/2;
};
$typeBlock.width(resultWidth);
}
function resizeLabels() {
$leftBlock.width(0);
$rightBlock.width(0);
headWidth = $headBlock.width();
widthLeftPart = widthRightPart = 0;
headWidth = $headBlock.width();
doResizeLabels($leftBlock);
doResizeLabels($rightBlock);
};
Serious_Andy,
30 Сентября 2011