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

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

    +95.9

    1. 1
    2. 2
    3. 3
    string.Format("{1}/{0}/{2}", day.Day, day.Month, day.ToString("yy")
    
    string.Format("{0}", programm.Key)

    2 отличных метода превращения даты и числа в строку :)
    Человек когда-то драйвера писал на ЖД.
    ппц.

    medcom, 04 Февраля 2010

    Комментарии (9)
  3. C++ / Говнокод #2529

    +144.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
    #include <iostream>
    #define lulz int
    #define lulZ main()
    #define luLz {
    #define luLZ }
    #define lUlz cout
    #define lULz cin
    #define lUlZ ;
    #define LuLZ <<
    #define LuLz >>
    #define LULz =
    #define LULZ +
    #define lolz endl
    lulz lulZ
    luLz
      lulz Lulz lUlZ
      lUlz LuLZ" Смешная сумма " LuLZ lolz lUlZ
        lULz LuLz Lulz lUlZ
      lUlz LuLZ Lulz lUlZ
      lUlz LuLZ" + " lUlZ
    lulz lULZ lUlZ
      lUlz LuLZ "LULZ?" LuLZ lolz lUlZ
      lULz LuLz lULZ lUlZ
      lUlz LuLZ Lulz LuLZ " + " LuLZ lULZ LuLZ " = " LuLZ Lulz + lULZ lUlZ
    luLZ

    "Смешная сумма" (c) автор

    darkcheg, 02 Февраля 2010

    Комментарии (9)
  4. Си / Говнокод #2527

    +134.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
    #include "stdafx.h"
    #include "conio.h"
    #include "time.h"
    #include "stdlib.h"
    #include "windows.h"
    #include <iostream>
    
    
    using namespace std;
    void go()
    { int m[10],maxi,mini,max,min,temp;
    srand(time(NULL));
    for(int i=0;i<10;i++)
    m[i]=rand()%30;
    max=0;
    for(int i=0;i<10;i++)
    {if(m[i]>max) { max=m[i]; maxi=i;};
    }
    
    min=max;
    for(int i=0;i<10;i++)
    {if(m[i]<min) {min=m[i]; mini=i;};
    
    }
    for(int i=0;i<10;i++)
    cout<<m[i]<<endl;
    
    m[maxi],m[mini]=m[mini],m[maxi];
    temp=m[maxi];
    m[maxi]=m[mini];
    m[mini]=temp;
    
    
    cout<<"============"<<endl;
    for(int i=0;i<10;i++)
    cout<<m[i]<<endl;
    
    
    cout<<"alala=="<<max<<endl;
    cout<<"ololo=="<<min<<endl;
    }
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    
    go();
    
    getch();
    
    
    	return 0;
    }

    хе-хе, друг написал , меняет макс и мин элементы местами)

    Bor1k, 02 Февраля 2010

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

    +166.3

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <img src="./img/pts/main.gif">
    	<!--<? 	if ($id=="main" or $id=="" or $id=="archmain")
    print "<img src=\"./img/pts/main.gif\">";
    if ($id=="ecotur" or $id=="archecotur")
    print "<img src=\"./img/pts/main_ekotur.gif\">";
    if ($id=="koni" or $id=="archkoni")
    print "<img src=\"./img/pts/main_koni.gif\">";
    if ($id=="piknik" or $id=="archpiknik")
    print "<img src=\"./img/pts/main_piknik.gif\">";
    if ($id=="eco" or $id=="archeco")
    print "<img src=\"./img/pts/main_eco.gif\">";
    if ($id=="maps")
    print "<img src=\"./img/pts/main_maps.gif\">";
    if ($id=="info" or $id=="archinfo")
    print "<img src=\"./img/pts/main_info.gif\">";
    if ($id=="sitemap")
    print "<img src=\"./img/pts/main_sitemap.gif\">";
    if ($id=="contacts")
    print "<img src=\"./img/pts/main_kord.gif\">";
    if ($id=="ny")
    print "<img src=\"./img/pts/main_ny.gif\">";
    if ($id=="mas")
    print "<img src=\"./img/pts/main_mas.gif\">";
    
    	?> -->
    </td>
    </tr>
    <tr>
    	<td bgcolor="#e0ead3" background="./img/pts/left_main.gif" width="11" style="background-image: url(./img/pts/left_main.gif)"></td>
    	<td width="650" bgcolor="#e0ead3"><?
    if ($id=="main" or $id=="")
    include("global.php");
    if ($id=="order")
    include("order.php");
    if ($id=="action")
    include("action.php");
    if ($id=="search")
    {include("search/search.php");}
    if ($id=="about" & $cat=="")
    include("about.php");
    if ($id=="archmain")
    include("archnews.php");
    if ($id=="contacts")
    include("contacts.php");
    if ($id=="about" & $cat=="ecoproj")
    include("about/ecoproj.php");
    if ($id=="about" & $cat=="anim")
    include("about/anim.php");
    if ($id=="about" & $cat=="prof")
    include("about/prof.php");
    if ($id=="about" & $cat=="press")
    include("about/press.php");
    if ($id=="rest" & $cat=="")
    include("rest.php");
    if ($id=="rest" & $cat=="child")
    include("rest/child.php");
    if ($id=="rest" & $cat=="child_eco")
    include("rest/child_eco.php");
    if ($id=="rest" & $cat=="child_edu")
    include("rest/child_edu.php");
    if ($id=="rest" & $cat=="child_gam")
    include("rest/child_gam.php");
    if ($id=="rest" & $cat=="child_his")
    include("rest/child_his.php");
    if ($id=="rest" & $cat=="child_sez")
    include("rest/child_sez.php");
    if ($id=="rest" & $cat=="child_zoo")
    include("rest/child_zoo.php");
    if ($id=="rest" & $cat=="child_str")
    include("rest/child_str.php");
    if ($id=="rest" & $cat=="child_dop")
    include("rest/child_dop.php");
    if ($id=="rest" & $cat=="fam")
    include("rest/fam.php");
    if ($id=="rest" & $cat=="adult")
    include("rest/adult.php");
    if ($id=="rest" & $cat=="eco")
    include("rest/eco.php");
    if ($id=="club" & $cat=="")
    include("club.php");
    if ($id=="club" & $cat=="cafe")
    include("club/cafe.php");
    if ($id=="club" & $cat=="piknik")
    include("club/piknik.php");
    if ($id=="club" & $cat=="gost")
    include("club/gost.php");
    if ($id=="koni" & $cat=="")
    include("koni.php");
    if ($id=="koni" & $cat=="uslugi")
    include("koni/study.php");
    if ($id=="koni" & $cat=="walk")
    include("koni/walk.php");
    if ($id=="koni" & $cat=="dom")
    include("koni/dom.php");
    if ($id=="koni" & $cat=="poni")
    include("koni/poni.php");
    if ($id=="koni" & $cat=="sell")
    include("koni/sell.php");
    if ($id=="koni" & $cat=="ippoter")
    include("koni/ippoter.php");

    Попросили заменить кое что на сайте, начал смотреть исходный код. Умилил ^_^

    kein, 01 Февраля 2010

    Комментарии (9)
  6. C# / Говнокод #2506

    +103.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public static IntPtr StringToBSTR(string s)
    {
        //...
        if ((s.Length + 1) < s.Length)
        {
            throw new ArgumentOutOfRangeException("s");
        }
        //...
    }

    System.Runtime.InteropServices.Marshal Не знаю зачем это, но мне показалось смешным.

    psina-from-ua, 30 Января 2010

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

    +135.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
    public class PlayerWindow
    {
        private readonly ScheduleManager _scheduleManager = new ScheduleManager();
    
    ...
    
        private void OpenSchedule(string timesheetFilename)
        {
            if (!_scheduleManager.OpenSchedule(timesheetFilename))
            {
                _isOpen = false;
                return;
            }
    
            _isOpen = false;
        }
    }

    Собственное творчество. ^_^

    spbAngel, 29 Января 2010

    Комментарии (9)
  8. Assembler / Говнокод #2430

    +246.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
    proc mltcoef
              push ecx
              xor ecx,ecx
              xor edx,edx
              xor ebx,ebx
              mov eax,dword[coef+edx]
              _b:
              add [coef+edx],eax
              jc _c
              _e:
              cmp ecx,9
              jne _b
              inc ecx
    
              _c
              push edx
              _d
              add edx,4
              add [coef+edx],1
              jc _d
              pop edx
              jmp _e
              pop ecx
              ret
              endp

    Пока я писалвысирал эту НЁБ, я уже забыл, зачем оно было нужно.

    Leo_ня, 18 Января 2010

    Комментарии (9)
  9. C++ / Говнокод #2429

    +62.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
    bool failed = true;
    	int count = 0;
    	do
    	{
    		{
    			ADO cnn( service().connectionString() );
    			if (count == 0)
    			{
    				_RecordsetPtr rs = cnn.Command(L"SELECT MAX(MessNo) as MAXNO FROM RobotLog", ADODB::adCmdText)
    					.Execute();
    				if (rs->EndOfFile == VARIANT_FALSE)
    				{
    					vt = rs->Fields->Item[L"MAXNO"]->Value;
    					if (vt.vt != VT_NULL)
    						messNo = vt.lVal + 1;
    				}
    				rs->Close();
    			}
    			else
    				messNo++;
    			try
    			{
    				cnn.Command(L"INSERT INTO RobotLog(MessNo,MessType,MessDate,MessText,Empl_Code,CompName,Robot_Code, "
    					L"Robot_Name,Doc_Name,Doc_No,Doc_CardDate) VALUES(?,?,?,?,?,?,?,?,?,?,?)", ADODB::adCmdText)
    					.CreateParameter(messNo)
    					.CreateParameter((long) messType)
    					.CreateParameter((DATE) COleDateTime::GetCurrentTime())
    					.CreateParameter(bstr_t(messText.AllocSysString()))
    					.CreateParameter((long)m_EmplCode)
    					.CreateParameter(service().computerName())
    					.CreateParameter((long)m_ID)
    					.CreateParameter(sRobotName)
    					.CreateParameter(sDocName, false)
    					.CreateParameter(sDoc_No, false)
    					.CreateParameter(dCardDate)
    					.Execute();
    				failed = false;
    			}
    			catch(_com_error& )
    			{
    //				DebugMsgE("CRobotThread::LogRobotWork[%s] error: 0x%08x::%s - %s. Attempt #:%d", (const char*)m_RobotName, err.Error(), (const char*) err.Description(), 
    //					(const char*) err.ErrorMessage(), count);
    			}
    		}
    		count++;
    		Sleep(100);
    	}while (failed && count < 10000);

    Вычисляемое значение 'messNo' прописывается в PK. Код выполняется мультипоточночно, примерно из 5 - 15 одновременно работающих потоков.
    Вот такая вот попытка 10000 раз прописать неуникальное значение первичного ключа :)
    Но, самое смешное, что на моё предложение перенести заботу об уникальности и инкрементации в SQL, мне было велено "не умничать, ЭТО правильный алгоритм !...".

    UncleVova, 18 Января 2010

    Комментарии (9)
  10. C# / Говнокод #2414

    +144.2

    1. 1
    if ( strlen(f.ToString()) < 5 )

    Проверку булевской переменной.

    Говногость, 14 Января 2010

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

    +78.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public void pause(){
            Object lock=new Object();
            synchronized(lock){
                try{
                    lock.wait(1000);
                }catch(Exception e){
                    System.out.println(e.getMessage());
                }
            }
        }

    _jk_, 29 Декабря 2009

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