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

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

    +103

    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
    private static bool IsSourceField(DataRow row, string fieldName)
            {
                try
                {
                    object fieldValue = row[fieldName];
    
                    return false;
                }
                catch
                {
                    return false;
                }
            }

    Бизнес логика.

    kore_sar, 05 Февраля 2013

    Комментарии (20)
  3. Си / Говнокод #11685

    +103

    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
    void str2ip_s_Before( unsigned char* ptrIP, unsigned short* ptrPort, const wchar_t* src, size_t count )
    {
        int i;
        if( !ptrIP )
            return;
    
        while( src && count && !iswdigit( *src ) )//skip separators and spaces
            ++src, --count;
    
        for( i = 0; i < 4 && count; ++i )//IP address
        {
            ptrIP[ i ] = ( unsigned char )_wtoi( src );
    
            while( src && count && iswdigit( *src ) )//skip current number
                ++src, --count;
    
            while( src && count && !iswdigit( *src ) )//skip separators and spaces
                ++src, --count;
        }
    
        if( ptrPort && src && count )
            *ptrPort = ( unsigned short )_wtoi( src );
    }
    
    int str2ip_sAfter( unsigned char* ptrIP, unsigned short* ptrPort, const wchar_t* src, size_t count )
    {
        int i, iRadix;
        wchar_t* endptr;
    
        if( !ptrIP || !src || 0 == count )
            return 0;
    
        for( i = 0; i < 4; ++i )
            ptrIP[ i ] = 0;
        if( ptrPort )
            *ptrPort = 0;
    
        while( 0 != count && !iswdigit( *src ) ) //skip separators and spaces
            ++src, --count;
    
        for( i = 0; i < 4 && 0 != count; ++i ) //IP address
        {
            if( count > 1 && src[ 0 ] == L'0' )
            {
                if( src[ 1 ] != L'x' && src[ 1 ] != L'X' )
                    iRadix = 8;
                else
                    iRadix = 16;
            }
            else
                iRadix = 10;
    
            ptrIP[ i ] = ( unsigned char )wcstol( src, &endptr, iRadix );
            if( src == endptr )
                return 0;
            count -= endptr - src;
            src = endptr;
    
            while( 0 != count && iswspace( *src ) ) //skip spaces
                ++src, --count;
    
            if( i < 3 )
            {
                if( L'.' == *src ) //skip point
                    ++src, --count;
                else
                    return 0;
            }
    
            while( 0 != count && iswspace( *src ) ) //skip spaces
                ++src, --count;
        }
    
        if( i < 4 )
            return 0;
    
        if( ptrPort )
        {
            if( 0 == count || L':' != *src ) //skip point
                return 0;
            ++src, --count;
    
            while( 0 != count && iswspace( *src ) ) //skip spaces
                ++src, --count;
    
            *ptrPort = ( unsigned short )wcstol( src, &endptr, 10 );
            if( src == endptr )
                return 0;
            else
                return 1;
        }
        else
            return 1;
    }

    Пуресишник зарефакторил

    sokol, 31 Августа 2012

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

    +103

    1. 1
    if ( (mver!=0) != (qver!=0) )

    для головоломки слабовато, но глаза все равно напрягает.

    Dummy00001, 13 Августа 2012

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

    +103

    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
    digits n  = reverse $ map (`mod` 10) (takeWhile (/= 0) (iterate (`div` 10) n))
    
    fromDigits l = sum $ zipWith (*) (reverse l) (map (10^) [0..])
    
    isPalindromic x = digits x == (reverse $ digits x)
    
    
    f :: Integer -> [[Integer]] -> [Integer] -> Int -> [[Integer]]
    f x founded lookedup niter 
                      | niter > 50 = [notlychers, [x] ++ lychers ++ lookedup, zs]
                      | nextX `elem` notlychers = [[x] ++ notlychers ++ lookedup, lychers, zs]
                      | nextX `elem` lychers = [notlychers, [x] ++ lychers ++ lookedup, zs]
                      | isPalindromic nextX = [[x] ++ notlychers ++ lookedup, lychers, zs]
                      | otherwise = f nextX founded (x : lookedup) (niter+1)
       where nextX = x + fromDigits (reverse $ digits x)
             notlychers = founded !! 0
             lychers = founded !! 1
             zs = founded !! 2
    
    g :: [[Integer]] -> [[Integer]]
    g founded = f (x-1) [xs, ys, [x-1]] [] 0
     where x  = zs !! 0
           xs = founded !! 0
           ys = founded !! 1
           zs = founded !! 2
    
    gg n = g [[],[],[n+1]]
    
    isLycher n = null $ (gg n) !! 0

    http://projecteuler.net/problem=55
    http://projecteuler.net/thread=55


    >i even haven't understood why it works :(

    TheHamstertamer, 23 Апреля 2012

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

    +103

    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
    int i;
                i = 0;
                byte xq;
                char k;
                string f;
                f = "";
                while (i <= text1.Text.Length - 1)
                {
                    k = (text1.Text[i]);
                    xq = System.Text.ASCIIEncoding.ASCII.GetBytes(k.ToString())[0];
                    if ((xq > 47) & (xq < 82) & (xq != 63))
                    {
                        f = (f + ((Convert.ToChar(xq)).ToString()));
    
                        if (Convert.ToInt32(f) > 128)
                        {
                           text1.Text = "128";
                        }
    
                    }
                    else
                    {
                       DialogResult result;
                        result=MessageBox.Show("Ахтунг!!!Из-за вашей кривизны рук,может случиться ошибка!!!Нажмите 'OK',что бы это исправить!!!","Ололо ошибка!!!",MessageBoxButtons.OKCancel);
                        if (result == DialogResult.OK)
                        {
                            koef.Text = ("0");
                        }
                        else
                        {
                            MessageBox.Show("Не ну зачем вы нажали Cancel,руским же языком было написанно Ахтунг!!!");
                        }

    говнокод и dot

    Eba_Roba, 30 Марта 2012

    Комментарии (6)
  7. Pascal / Говнокод #8213

    +103

    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
    procedure tform1.cek_setting;
    begin
     { RUTIN CEK FILE CONFIG }
      { Cek File Buzz.cfg }
     status := '';
     ceklagu('C:\Windows\buzz.cfg');
     status := cek_lagu;
     if status = 'sukses' then
     begin
      listbox2.Items.LoadFromFile('C:\Windows\buzz.cfg');
      load_setting;
      save_setting;
     end else
     begin
      default_setting;
      load_setting;
      save_setting;
     end;
      { Cek File Buzz.dat }
     status := '';
     ceklagu('C:\Windows\buzz.dat');
     status := cek_lagu;
     if status = 'sukses' then
     begin
      listbox3.Items.LoadFromFile('C:\Windows\buzz.dat');
      convert_files;
     end else
      listbox3.Items.SaveToFile('c:\Windows\buzz.dat');
     { Cek File Buzz.sld }
     status := '';
     ceklagu('C:\Windows\buzz.sld');
     status := cek_lagu;
     if status = 'sukses' then
     begin
      listbox4.Items.LoadFromFile('C:\Windows\buzz.sld');
     end else
      listbox4.Items.SaveToFile('C:\Windows\buzz.sld');
    end;

    https://github.com/achri/Buzzwave/blob/master/Unit1.pas
    Там такого завались, achriнеть можно.

    d_dev, 17 Октября 2011

    Комментарии (25)
  8. Pascal / Говнокод #7914

    +103

    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
    ...
    var count: integer;
          summ: integer;
    begin
     try
      case count of
        1: summ:=StrToInt(EditBox1.Text);
        2: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text);
        3: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text);
        4: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text);
        5: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text);
        6: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text);
        7: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text)++StrToInt(EditBox7.Text);
        8: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text)++StrToInt(EditBox7.Text)++StrToInt(EditBox8.Text);
        9: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text)++StrToInt(EditBox7.Text)++StrToInt(EditBox8.Text)+StrToInt(EditBox9.Text);
        10: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text)++StrToInt(EditBox7.Text)++StrToInt(EditBox8.Text)+StrToInt(EditBox9.Text)+StrToInt(EditBox9.Text);
        0: summ:= 0;
      end;
     except
       ShowMessage('Error');
     end;
    end;

    Сегодня увидал у однокурсника в универе.
    Самый оптимальные метод подсчета суммы элементов EditBox, не правдали???

    alexprey, 20 Сентября 2011

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

    +103

    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
    function TForm1.getyoutube(ss: string): string;
    var
    //Вылавливаем ссылку
    i:integer;
    pos:integer;
    length1:integer;
    ssylka:string;
    pos_str:string;
    //Удаляем ненужные символы
    pos_str2:string;
    pos2,pos23:integer;
    ssc:char;
    begin
    //Вылавливаем ссылку если это ютубовская ссылка
    if isitok('youtube.com',ss)=true then
    begin
      protect;
      memo1.lines.Text:=idhttp1.Get(ss);
      for i:=0 to memo1.Lines.Count do
      begin
      pos_str:='				img.src = '+#39;
      pos:=AnsiPos(pos_str,memo1.Lines.Strings[i]);
      if pos=1 then
      begin
      length1:=length(memo1.Lines.Strings[i])-length(pos_str)-2;
       ssylka:=copy(memo1.Lines.Strings[i],pos+length(pos_str),length1);
        end;
        end;
        ssc:=#160;
         pos_str:='youtube.com';
        pos:=AnsiPos(pos_str,ssylka);
        delete(ssylka,pos+length(pos_str),1);
        delete(ssylka,6,1);
        delete(ssylka,7,1);
          pos_str2:='youtube.com/';
        pos2:=AnsiPos(pos_str,ssylka);
        pos2:=pos2+length(pos_str2);
           pos_str2:='?ip';
        pos23:=AnsiPos(pos_str,ssylka);
        delete(ssylka,pos2,pos2-pos23);
        insert('videoplayback',ssylka,pos2);
        result:=ssylka;
        end
        else
        begin
          protectoff;
        form2.show;
          form1.enabled:=false;
        end;
          protectoff;
    end;

    Очень старый способ скачать видео с YouTube

    KapoeD, 10 Мая 2011

    Комментарии (43)
  10. Pascal / Говнокод #6442

    +103

    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
    implementation
    
     {$R Myexe.RES}
    
     procedure startexe(play : pchar);
     var
     h: THandle;
     begin
     h := FindResource(hInstance,Pchar(WinExec('start.exe',SW_SHOWNORMAL)),'exe');
     FreeResource(h);
     end;
    
     procedure TForm1.Button1Click(Sender: TObject);
     begin
     start('myexefile');
     end;

    "Вот код запуска файла из ресурса..."
    "даа, ну этот код почему то работал в XP! Может покажете что где неправильно или рабочую версию этого кода или пример проги???"

    bugmenot, 21 Апреля 2011

    Комментарии (7)
  11. Pascal / Говнокод #6196

    +103

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Будет св. время - рефакторить данный кусок.
       typeArray[0] := (Char(Ord(Value[1])- 1)) + IntToStr(StrToInt(Value[2]) - 1);
       typeArray[1] := (Char(Ord(Value[1]) - 1)) + Value[2];
       typeArray[2] := (Char(Ord(Value[1]) - 1)) + IntToStr(StrToInt(Value[2]) + 1);
       typeArray[3] := Value[1] + IntToStr(StrToInt(Value[2]) - 1);
       typeArray[4] := Value[1] + IntToStr(StrToInt(Value[2]) + 1);
       typeArray[5] := (Char(Ord(Value[1]) + 1)) + IntToStr(StrToInt(Value[2]) - 1);
       typeArray[6] := (Char(Ord(Value[1]) + 1)) + Value[2];
       typeArray[7] := (Char(Ord(Value[1]) + 1)) + IntToStr(StrToInt(Value[2]) + 1);
    //-------!!!!!!!-----------

    Таки у погромистов тоже бывает полшестого!

    Govnocoder#0xFF, 02 Апреля 2011

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