1. Лучший говнокод

    В номинации:
    За время:
  2. SQL / Говнокод #2799

    −157.8

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    CREATE PROCEDURE "auot".uot_inv_procs2
    (
      NumFunc Integer,	-- Номер функции :
    		    -- 1 - Вставляет строку 
                        -- 2 - Создает временную таблицу 
                        -- 3 - Удаляет временную таблицу 
                        -- 4 - Создает временную таблицу 
                        -- 5 - Удаляет временную таблицу 
                        -- 6 - Возвращает Dogovor.Dog_id
                        -- 7 - Создает TempTableInvoice
                        -- 8 - Создает TmpTabDeclInv
                        -- 9 - Создает TmpTabDeclSel
                        --10 - Заолняет TmpTabDeclSel 
                        --11 - Добавляет в TmpTabVCSel
                        --12 - Обновляет информацию 
    
      n_Numb_inv        NVarChar(10,0) DEFAULT NULL,	
      n_Date_inv        Date DEFAULT NULL,	
      n_Code_exp        Char(2) DEFAULT NULL,	
      n_Prod_code       Char(3) DEFAULT NULL,
      n_Code_Transport  Char(1) DEFAULT NULL,
      n_Code_Date_Cen   Char(1) DEFAULT NULL,
      n_Contract        NVarChar(30,0) DEFAULT NULL,
      n_DateContract    Date DEFAULT NULL,		
      n_Weight          Numeric(10,3) DEFAULT NULL,
      n_Price           Numeric(8,2) DEFAULT NULL,	
      n_Total           Numeric(15,2) DEFAULT NULL,	
      n_Kod_val_id      Integer DEFAULT NULL,		
      n_Date_konos      Date DEFAULT NULL,		
      n_SHB_Signature   Char(6) DEFAULT NULL,	
      n_Seller_Sign     Char(6) DEFAULT NULL,		
      n_Date_prix       Date DEFAULT NULL,		
      n_Date_move       Date DEFAULT NULL,		
      n_SUM_CLS         Numeric(15,2) DEFAULT NULL,
      n_Consignee       NVarChar(150,0) DEFAULT NULL,
      n_Buyer           NVarChar(150,0) DEFAULT NULL,	
      n_Pnt_departure   NVarChar(150,0) DEFAULT NULL,
      n_Destination     NVarChar(150,0) DEFAULT NULL,
      n_Steam_vessel    NVarChar(50,0) DEFAULT NULL,
      n_Delivery_terms  NVarChar(18,0) DEFAULT NULL,
      n_Status          Char(1) DEFAULT 'N',				
      n_Dogovor_id      Integer DEFAULT NULL,		
      n_Date_min        Date DEFAULT NULL,			
      n_Date_max        Date DEFAULT NULL,			
      n_Invoice_id      Integer DEFAULT NULL,			
      n_Res_Code        Char(8) DEFAULT NULL,			
      n_Date_Sale_Uved  Date DEFAULT NULL,			
      n_Month           Date DEFAULT NULL				
    
    )	
    RETURNING INTEGER;
    
    
    DEFINE GLOBAL __current_user INTEGER  DEFAULT NULL;
    DEFINE GLOBAL err_sqlcode    INTEGER  DEFAULT 0;
    DEFINE GLOBAL err_isamcode   INTEGER  DEFAULT 0;
    DEFINE GLOBAL err_detail     CHAR(80) DEFAULT '';
    
    DEFINE _inv_id         Integer;
    
    DEFINE _Name_exp       NVarChar(40,0);
    DEFINE _Name_rus       NVarChar(50,0);
    DEFINE _Smlval         Char(3);
    DEFINE _rlw_id         Integer;
    DEFINE _weight_brutto  Decimal(12,3);
    DEFINE _Bes_inv        Decimal(12,3);
    DEFINE _Sum_inv        Numeric(15,2);
    DEFINE _Bes_free       Decimal(12,3);
    DEFINE _Sum_free       Numeric(15,2);
    DEFINE _Sum_Weight_Inv DECIMAL(12,3);
    DEFINE _SHB_Name       NVARCHAR(60,0);
    DEFINE _dogovor        NChar(15);
    DEFINE _dlv_id         Integer;
    DEFINE _Decl_num       Char(23);
    DEFINE _Decl_date      Date;
    DEFINE _Buyer          NVarChar(80);
    DEFINE _Currency_rate  Money(16,2);
    DEFINE _CenaRus        Money(16,2);
    DEFINE _Prod_All       NVarChar(93);
    DEFINE _org_name       NVarChar(80,0);
    DEFINE _SumRUR         Money(16,2);
    DEFINE _SumKinef       Money(16,2);
    DEFINE _Delta          Money(16,2);
    DEFINE _Effect         Money(16,2);
    DEFINE _Dog_id         Integer;
    DEFINE _Res_code       Char(8);
    DEFINE _carriage_num   NChar(18);
    DEFINE _nom_nakl       NChar(10);
    DEFINE _Shpok_char     Char(4);
    DEFINE _Parent         SmallInt;
    DEFINE _Date_otgr      DateTime YEAR TO SECOND;
    
    IF NumFunc=2 THEN  -- Создаем временную табл. SprInvByProd
      CREATE TEMP TABLE SprInvByProd......

    и так далее по каждому из 12 пунктов.....просто процедура на все случаи жизни..чувак реально попотел когда сие изобретал....

    Grizzly, 15 Марта 2010

    Комментарии (5)
  3. Pascal / Говнокод #2778

    +96.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    procedure AsmRGBBiter15;assembler;
    procedure AsmRGBBiter16;assembler;
    //procedure AsmRGBBiter24;assembler;
    procedure AsmRGBBiter32;assembler;
    procedure AsmRGBBiterEx15;assembler;
    procedure AsmRGBBiterEx16;assembler;
    //procedure AsmRGBBiterEx24;assembler;
    procedure AsmRGBBiterEx32;assembler;
    procedure RGBBiterEx32(RGB32Stream,RGBNeed:pointer;Count:dword);pascal;assembler;
    //procedure RGBBiterEx24(RGB32Stream,RGBNeed:pointer;Count:dword);pascal;assembler;
    procedure RGBBiterEx16(RGB32Stream,RGBNeed:pointer;Count:dword);pascal;assembler;
    procedure RGBBiterEx15(RGB32Stream,RGBNeed:pointer;Count:dword);pascal;assembler;
    procedure AsmRGB16;assembler;
    procedure AsmRGB15;assembler;
    //procedure AsmRGB24;assembler;
    procedure AsmRGB32;assembler;
    function GetRValue32(color:dword):byte;Pascal;
    function GetGValue32(color:dword):byte;Pascal;
    function GetBValue32(color:dword):byte;Pascal;
    //function GetRValue24(color:dword):byte;Pascal;
    //function GetGValue24(color:dword):byte;Pascal;
    //function GetBValue24(color:dword):byte;Pascal;
    function GetRValue16(color:dword):byte;Pascal;
    function GetGValue16(color:dword):byte;Pascal;
    function GetBValue16(color:dword):byte;Pascal;
    function GetRValue15(color:dword):byte;Pascal;
    function GetGValue15(color:dword):byte;Pascal;
    function GetBValue15(color:dword):byte;Pascal;
    function GetSceenRect:trect;
    procedure DrawSceenHLine32(x1,x2,y,color:dword);pascal;assembler;
    procedure DrawSceenHLine15(x1,x2,y,color:dword);pascal;assembler;
    procedure DrawSceenHLine16(x1,x2,y,color:dword);pascal;assembler;
    //procedure DrawSceenHLine24(x1,x2,y,color:dword);pascal;assembler;
    procedure DrawSceenVLine32(x,y1,y2,color:dword);pascal;assembler;
    //procedure DrawSceenVLine24(y1,y2,x,color:dword);pascal;assembler;
    procedure DrawSceenVLine15(x,y1,y2,color:dword);pascal;assembler;
    procedure DrawSceenVLine16(x,y1,y2,color:dword);pascal;assembler;

    Программа работает только в 32битном режиме экрана. :D

    Говногость, 13 Марта 2010

    Комментарии (5)
  4. Pascal / Говнокод #2775

    +99.7

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    function RegisterSceenButton(Caption:shortstring;Rect:trect;dx,dy,ShadowWidth:dword;Style:dword;VerticalGradient,VerticalGradientifMouse,VerticalGradientIfClick:bool;TextColor,ColorTop,ColorBottom,TextColorIfMouse,ColorTopIfMouse,ColorBottomIfMouse,TextColorIfClick,ColorTopIfClick,ColorBottomIfClick,LeftTopColor,RightBottomColor:dword;pushProc:tSBPushProc;Surface:idirectdrawsurface7):dword;
    var i:dword;
    begin
    result:=0;
    for i:=1 to SMaxSceenButton do
    if SceenButton[i].isNotEmpty=false then break;
    if i=SMaxSceenButton then exit;
    ZeroMemory(@SceenButton[i],sizeof(SceenButton[i]));
    SceenButton[i].Caption:=caption;
    SceenButton[i].PushProc:=@pushproc;
    SceenButton[i].Rect:=rect;
    SceenButton[i].dx:=dx;
    SceenButton[i].dy:=dy;
    SceenButton[i].TextColor:=textcolor;
    SceenButton[i].ColorTop:=ColorTop;
    SceenButton[i].ColorBottom:=ColorBottom;
    SceenButton[i].TextColorIfMouse:=textcolorifmouse;
    SceenButton[i].ColorTopIfMouse:=colorTopifmouse;
    SceenButton[i].ColorBottomIfMouse:=colorBottomifmouse;
    SceenButton[i].LeftTopColor:=lefttopcolor;
    SceenButton[i].RightBottomColor:=rightbottomcolor;
    SceenButton[i].ShadowWidth:=ShadowWidth;
    SceenButton[i].TextColorIfClick:=textcolorifclick;
    SceenButton[i].ColorTopIfClick:=colorTopifclick;
    SceenButton[i].ColorBottomIfClick:=colorBottomifclick;
    SceenButton[i].surface:=surface;
    SceenButton[i].Style:=Style;
    SceenButton[i].VerticalGradient:=VerticalGradient;
    SceenButton[i].VerticalGradientIfMouse:=VerticalGradientIfMouse;
    SceenButton[i].VerticalGradientIfClick:=VerticalGradientIfClick;
    SceenButton[i].state:=SSTB_Normal;
    SceenButton[i].isNotEmpty:=true;
    SceenButton[i].State:=SSTB_normal;
    result:=i;
    end;

    Программа, полностью на скинах через DDraw. Гуевое лишь POPUP окно. Зачем мне было это нужно? Работает только в 32битном режиме. В остальных глючит. :D

    Говногость, 13 Марта 2010

    Комментарии (5)
  5. 1C / Говнокод #2773

    −369.1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    Процедура СформироватьТаблицуГрафика()
    	//Заполнение месяцев
    	Для НомерМесяца = 1 По 12 Цикл
    		
    		НомерГода = Число(Прав(Год(ТекущаяДата()), 1));
    		ДатаМесяца = Дата(НомерГода, НомерМесяца, 1);
    		ДнейВМесяце = День(КонецМесяца(ДатаМесяца));
    
    		НоваяСтрока = КалендарьНаборЗаписей.Добавить();
    		НазваниеМесяца = Формат(ДатаМесяца, "ДФ=""ММММ""");
    		НоваяСтрока.Установить(0, НазваниеМесяца);
    		НоваяСтрока.НомерМесяца = НомерМесяца;
    		
    	КонецЦикла;
    КонецПроцедуры

    Помимо дикости написанного, эта штука не работает в 2010 году.

    Зарплата и Управление Персоналом 2.5.18.3

    Smallrat, 12 Марта 2010

    Комментарии (5)
  6. Ruby / Говнокод #2749

    −116.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    class Vector
      def -@
        map(&:-@)
      end
    end

    Код мой, говнокодом бы не назвал, но без улыбки точно не взглянешь на такое =)
    (тут определение унарного минуса через вызов того же унарного минуса у всех элементов вектора, Кэп)

    rakoth3d, 11 Марта 2010

    Комментарии (5)
  7. C# / Говнокод #2706

    +965.2

    1. 1
    string k = Convert.ToString(s_kto.Text);

    s_kto - TextBox

    alex_donetsk, 03 Марта 2010

    Комментарии (5)
  8. Perl / Говнокод #2673

    −155.2

    1. 1
    %words = map { $_ => $hash{$_} } grep { !proper($_) } keys %words;

    Фильтрация хэша - удаление элементов, чьи ключи не удовлетворяют некому условию.
    Конечно же использование православного for для Perl-истов ниже собственного достоинства.... :X

    Balza, 25 Февраля 2010

    Комментарии (5)
  9. Java / Говнокод #2672

    +72.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    public class CountUnique {
        //here objects will be stored
        private Object[] variants;
        //temporaly array to store copying variants
        private Object[] temparr;
    
        private int total = 0;
    
        public CountUnique() {}
    
        public boolean test(Object obj) {
            total++;
            boolean hasSame = false;
            if(variants == null) {
                variants = new Object[1];
                variants[0] = obj;
                hasSame = false;
            } else {
                for(int i = 0; i < variants.length; i++) {
                    if(variants[i] == null) {} else {
                        if(variants[i].equals(obj)) {
                            hasSame = true;
                            break;
                        }
                    }
                }
    
                if(hasSame == false) {
                    temparr = variants;
                    variants = new Object[temparr.length+1];
                    for(int i = 0; i < temparr.length; i++) {
                        variants[i] = temparr[i];
                    }
    
                    variants[temparr.length] = obj;
                    temparr = null;
                }
            }
    
            return hasSame;
        }
    
        public int unique() {
            if(variants == null) {
                return 0;
            } else return variants.length;
        }
    
        public int total() {
            return total;
        }
    
        public void free() {
            variants = null;
            temparr = null;
        }
    }

    некий класс для подсчета уникальных обьектов.
    особенно умиляет функция test()

    danilissimus, 25 Февраля 2010

    Комментарии (5)
  10. JavaScript / Говнокод #2635

    +159.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    var res_html = "";
      for (var i = 0; i < title_section.length; i++)
      {
      	if (title_section[i].id == sel) {
        res_html += '<div class="'+prefix+'section_title" onmouseover="section_sel(this,\''+ prefix +'\')" onmouseout="section_unsel(this,\''+ prefix +'\')"' +
    										'onclick="section_choise(this,'+'\''+url+'\'' + ')"' +
    										'id='+'"'+title_section[i].id+'" '	
    										+'style='+'"font-weight: bold"'+'>'+
    										'<span class="'+ prefix +'dashed_anchor">' + title_section[i].name + '</span>&nbsp;';
       // res_html += '(' + number_section[i] + ')';
        res_html += '</div>';
    	}
    	else{
    		res_html += '<div class="'+prefix+'section_title" onmouseover="section_sel(this,\''+ prefix +'\')" onmouseout="section_unsel(this,\''+ prefix +'\')"' +
    										'onclick="section_choise(this,'+'\''+url+'\'' + ')"' +
    										'id='+'"'+title_section[i].id+'" '	
    										+'>'+
    										'<span class="'+ prefix +'dashed_anchor">' + title_section[i].name + '</span>&nbsp;';
       // res_html += '(' + number_section[i] + ')';
        res_html += '</div>';
    	}
    	}
      
      document.getElementById(prefix + "sections").innerHTML += res_html;
      document.getElementById(prefix + "sections").innerHTML += '<a href='+'"?id=all"'+'><div class="'+prefix+'all_sections"><img src="media/img/01/arrow.jpg" alt=""/>' +
            '<span style="color:black">Все разделы</span>&nbsp;</div></a>';
    
      document.getElementById(prefix + "column_sections").style.width = (max_length + 7) + "ex";
    /*  document.getElementById(prefix + "green_sector").style.height = (document.getElementById(prefix + "column_other").offsetHeight - 14) + "px";*/
    }

    Яваскрипт от местного умельца:)

    HollyGeek, 18 Февраля 2010

    Комментарии (5)
  11. Куча / Говнокод #2630

    +133.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    <target name="test-boolean">
    		<condition property="if-true" value="true" else="false">
    			<!-- 
    				Попробуйте попереключайте true / false 
    				и посмотрите на результат - вам однозначно понравится :) 
    			-->
    			<istrue value="false"/>
    		</condition>
    		<antcall target="test-boolean-true"/>
    		<antcall target="test-boolean-false"/>
    	</target>
    	
    	<target name="test-boolean-true" if="if-true">
    		<echo>The condition evaluates to "true"</echo>
    	</target>
    	
    	<target name="test-boolean-false" unless="if-true">
    		<echo>The condition evaluates to "false"</echo>
    	</target>

    Язык - Ant, для тех, кто не в курсе. Я думаю, можно спокойно зачислить в говноязыки.

    wvxvw, 18 Февраля 2010

    Комментарии (5)