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

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

    +117

    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
    int mainCRTStartup()
    {
      int argc = 0;
      char* argv[MAX_CMD_ARGS + 1];
      char** pargv = argv;
      char* cmdLine = strdup(GetCommandLineA());
      int result = 0;
    
      g_module = GetModuleHandle(NULL);
      g_process = GetCurrentProcess();
      g_thread = GetCurrentThread();
      g_heap = GetProcessHeap();
    
      for (*pargv = strtok(cmdLine, " "); *pargv && argc < MAX_CMD_ARGS; *pargv = strtok(NULL, " "))
      {
        ++argc;
        ++pargv;
      }
    
      *pargv = NULL;
      result = main(argc, argv);
      free(cmdLine);
      return result;
    }

    LispGovno, 27 Февраля 2014

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

    +92

    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
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
      with message1 do
      begin
        Subject:='Test subject';
        From := '[email protected]';
        To := '[email protected]';
        Textbody:='Text body';
      [. . .]
        Configuration.Fields.Update;
        Send;
    end;
    
    Лососнул тунца.

    with message1 do
    begin
    Subject:='Test subject';
    From := '[email protected]';
    To := '[email protected]';
    Textbody:='Text body';


    'To' - ключевое слово, смирись, смертный, и забудь о 'with'
    p.s. капча сейчас - 4 семерки.

    Stertor, 19 Февраля 2014

    Комментарии (24)
  4. PHP / Говнокод #14203

    +153

    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
    php_sapi_name() === 'cli' or exit('Only CLI mode allowed');
    
    getenv('API_HOST') or exit(<<<EOT
    
      To run tests you should setup "API_HOST" environment variable.
      Try follow in bash command line:
    
      $ export API_HOST=<api_host>
      cd path/to/tests
      php direct_report_problem.php
    
    
    EOT
    );
    
    defined('API_ENDPOINT') || define('API_ENDPOINT', getenv('API_HOST') . '/webservice/index.php');
    
    $method = API_ENDPOINT . '?op=...';
    
    $describe = function ($msg, $test) {
        printf("\n\n[%s]\n\n%s\n\n", $msg, shell_exec($test()));
        sleep(2);
    };
    
    $describe('Cannot upload empty report', function() use ($method) {
        return 'curl'
        . ' -F user_id=61'
        . ' ' . $method;
    });
    
    $describe('Can upload only direct report note', function() use ($method) {
        return 'curl'
        . ' -F user_id=61'
        . ' -F problem_note=NOTE'
        . ' ' . $method;
    });
    
    $describe('Can upload only direct report sound', function() use ($method) {
        return 'curl'
        . ' -F user_id=61'
        . ' -F [email protected]'
        . ' ' . $method;
    });
    
    $describe('Can upload only direct report image', function() use ($method) {
        return 'curl'
        . ' -F user_id=61'
        . ' -F [email protected]'
        . ' ' . $method;
    });
    
    $describe('Can upload all data direct report note, image, sound', function() use ($method) {
        return 'curl'
        . ' -F user_id=61'
        . ' -F problem_note=NOTE'
        . ' -F [email protected]'
        . ' -F [email protected]'
        . ' ' . $method;
    });

    __proto__, 10 Декабря 2013

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

    +122

    1. 1
    2. 2
    3. 3
    Не смог выделить 100 строк, объединённых общей логикой, да и всей картины это бы не передавало.
    Для любителей покопаться в. 
    Ссылка в описании.

    https://github.com/KustoSoft/ru2ch-toolset
    © Корпорация KustoSoft

    jsgovno, 08 Декабря 2013

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

    +137

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    catch(Exception ex)
    {
        try
        {
            insertAction(TXTextControl.StringStreamType.PlainText);
            GcmExceptionHandlerForm.ShowException(ex);
        }
        catch (Exception ex2)
        {
                GcmExceptionHandlerForm.ShowException(ex2);
        }
    }

    Что-то пошло не так...

    minuzZ, 29 Ноября 2013

    Комментарии (24)
  7. PHP / Говнокод #13840

    +169

    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
    ?><tr><?
        ?><script><?
            ?>$(function(){<?
                ?>$('tr[_hash]').find('#smalllinks').click(function(){<?
                    ?>$(this).parent(0).html($(this).parent(0).find('#fulllinks').html());<?
                ?>});<?
                ?>$('tr[_hash] #rm').click(function(){<?
                    ?>var _hash=$(this).parent(0).parent(0).attr('_hash');<?
                    ?>$.ajax({<?
                        ?>url:'?a&st&rm='+_hash,<?
                        ?>success:function(data){<?
                            ?>if(data=='1')get('st');<?
                        ?>}<?
                    ?>});<?
                ?>});<?
                ?>$('tr[_hash]').find('#stat_domain').click(function(){<?
                    ?>P_domain=$(this).html();<?
                    ?>get('st');<?
                ?>});<?
            ?>});<?
            ?>function rm_all()<?
            ?>{<?
                ?>if(confirm('Удалить всю статистику?'))<?
                ?>{<?
                    ?>$.ajax({<?
                        ?>url:'?a&st&rmall',<?
                        ?>success:function(data){<?
                            ?>if(data=='1')get('st');<?
                        ?>}<?
                    ?>});<?
                ?>}<?
            ?>}<?
            ?>function refresh_dom()<?
            ?>{<?
                ?>var _i='<img src="?i=ld"> ';_i+=_i;_i+=_i;_i+=_i;<?
                ?>$('table#c').prepend('<td class=n align=center colspan=999>'+_i+'</td>');<?
                
                ?>$.ajax({<?
                    ?>url:'?a&st&rdom',<?
                    ?>success:function(data){<?
                            ?>if(data=='1')get('st');<?
                    ?>}<?
                ?>});<?
            ?>}<?
            ?>function update_pr_tic()<?
            ?>{<?
                ?>var _i='<img src="?i=ld"> ';_i+=_i;_i+=_i;_i+=_i;<?
                ?>$('table#c').prepend('<td class=n align=center colspan=999>'+_i+'</td>');<?
                
                ?>$.ajax({<?
                    ?>url:'?a&st&upd_pr_tic',<?
                    ?>success:function(data){<?
                            ?>if(data=='1')get('st');<?
                    ?>}<?
                ?>});<?
            ?>}<?
        ?></script><?
        ?><td class=n colspan=5><?
            ?><input type=button value='   Обновить домены   ' onclick='refresh_dom()'/> <?
            ?><input type=button value='   Удалить все   ' onclick='rm_all()'/> <?
            ?><input type=button value='   Обновить PR, тИЦ   ' onclick='update_pr_tic()'/> <?
            ?>(доменов: <b><?=$result_domains_count?></b>) <?
            ?>Количество: <b><?=$result_count?></b><?
                if (!empty($domain))
                {
                    ?>, домен <b><?=$domain?></b><?
                }
        ?></td><?
        ?><td class=n><?
            if ($pages_count > 1)
            {
                ?><select id="selpage"><?
                for($i=1; $i<=$pages_count; $i++)
                {
                    ?><option <?=$i==($page_num+1)?'selected':''?>><?=$i?></option><?
                }
                ?></select><?
            }
        ?></td><?
    ?></tr><?

    Такой вот необычный код мне попался в одном скрипте.

    Itareo, 21 Сентября 2013

    Комментарии (24)
  8. PHP / Говнокод #13764

    +155

    1. 1
    data-selected-items='[<? $i=0; foreach($children_items as $child) {echo '{"id":"'.$child['id'].'", "text":"'.addslashes($child[$item_title_column]).'"}'; if( ++$i != count($children_items) ) echo ',';} ?>]'

    json_encode не слышали

    jfhs, 10 Сентября 2013

    Комментарии (24)
  9. VisualBasic / Говнокод #13752

    −353

    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
    Dim ll As Byte 
    Private Sub Command1_Click() ' При нажатие на кнопку "Кодировка" 
    For i = 1 To Len(Text1) Step 1 ' Читаем тест 1 от начало до канца с шагом 1 
    l = Asc(Mid(Text1, i, 1)) 
    Text2.Text = Text2 & Len(l) & Asc(Mid(Text1, i, 1)) ' записываем код в text 
    2 
    ' l = Asc(Mid(Text1, i, 1)) и Len(l) - это для того что б знать сколько 
    чисел у закодированого символа. Это нам нужно для раскодировки 
    Next i ' конец чтению текста 1 
    End Sub 
    Private Sub Command2_Click() ' При нажатии кнопки "Раскодировка" 
    ll=1 ' пишим начало от счёта 
    timer1.enabled=true ' включаем таймер 
    End Sub 
    Private Sub Text1_Change() 
    Text2 = "" ' сдесь при изменение текста 1 текст 2 = "" (вы можете этого и не 
    делать) 
    End Sub 
    Private Sub Text2_Change() 
    Text4 = Text2 " тут при изменение кода в тексте 2 этот код копируеться в 
    текст4 
    End Sub 
    Private Sub Text4_Change() 
    Text3 = "" ' сдесь при изменение текста 4 текст 3 = "" (вы можете этого и 
    не делать) 
    End Sub 
    Private Sub Timer1_Timer() 
       
    For i2 = 1 To 255 Step 1 
    If Mid(Text4, ll, 1) = "1" Or Mid(Text4, ll, 1) = "2" Or Mid(Text4, ll, 1) = 
    "3" Then If Val(Mid(Text4, ll + 1, Mid(Text4, ll, 1))) = i2 Then Text3 = 
    Text3 & asc1(Val(Mid(Text4, ll + 1, Mid(Text4, ll, 1)))): ll = ll + 
    Val(Mid(Text4, ll, 1)) + 1 ' сначало сравниваем числа 1,2,3 с кодом , эти 
    чилса обозначают из скольки символов состоит следующий код символа, потом мы 
    читаем и сравниваем код символа с перечисленым кодом , дальше мы записываем 
    каждую прочитанную букву при помощи моей функцией она записана в модуле 
    
    Next i2 
    If ll > Len(Text4) Then Timer1.Enabled = False ' если ll станет больше числа 
    символов в тексте, тогда таймер выключаеться 
    End Sub 
    
    Select Case ch
    Case 48: asc1 = "0": Case 49: asc1 = "1": Case 50: asc1 = "2": Case 51: asc1 
    = "3": Case 52: asc1 = "4": Case 53: asc1 = "5": Case 54: asc1 = "6": Case 
    55: asc1 = "7": Case 56: asc1 = "8": Case 57: asc1 = "9"
    Case 65: asc1 = "A": Case 66: asc1 = "B": Case 67: asc1 = "C": Case 68: asc1 
    = "D": Case 69: asc1 = "E": Case 70: asc1 = "F": Case 71: asc1 = "G": Case 
    72: asc1 = "H": Case 73: asc1 = "I": Case 74: asc1 = "J": Case 75: asc1 = 
    "K": Case 76: asc1 = "L": Case 77: asc1 = "M": Case 78: asc1 = "N": Case 79: 
    asc1 = "O": Case 80: asc1 = "P": Case 81: asc1 = "Q": Case 82: asc1 = "R": 
    Case 83: asc1 = "S": Case 84: asc1 = "T": Case 85: asc1 = "U": Case 86: asc1 
    = "V": Case 87: asc1 = "W": Case 88: asc1 = "X": Case 89: asc1 = "Y": Case 
    90: asc1 = "Z"
    Case 97: asc1 = "a": Case 98: asc1 = "b": Case 99: asc1 = "c": Case 100: 
    asc1 = "d": Case 101: asc1 = "e": Case 102: asc1 = "f": Case 103: asc1 = 
    "g": Case 104: asc1 = "h": Case 105: asc1 = "i": Case 106: asc1 = "j": Case 
    107: asc1 = "k": Case 108: asc1 = "l": Case 109: asc1 = "m": Case 110: asc1 
    = "n": Case 111: asc1 = "o": Case 112: asc1 = "p": Case 113: asc1 = "q": 
    Case 114: asc1 = "r": Case 115: asc1 = "s": Case 116: asc1 = "t": Case 117: 
    asc1 = "u": Case 118: asc1 = "v": Case 119: asc1 = "w": Case 120: asc1 = 
    "x": Case 121: asc1 = "y": Case 122: asc1 = "z"
    Case 192: asc1 = "А": Case 193: asc1 = "Б": Case 194: asc1 = "В": Case 195: 
    asc1 = "Г": Case 196: asc1 = "Д": Case 197: asc1 = "Е": Case 168: asc1 = 
    "Ё": Case 198: asc1 = "Ж": Case 199: asc1 = "З": Case 200: asc1 = "И": Case 
    201: asc1 = "Й": Case 202: asc1 = "К": Case 203: asc1 = "Л": Case 204: asc1 
    = "М": Case 205: asc1 = "Н": Case 206: asc1 = "О": Case 207: asc1 = "П": 
    Case 208: asc1 = "Р": Case 209: asc1 = "С": Case 210: asc1 = "Т": Case 211: 
    asc1 = "У": Case 212: asc1 = "Ф": Case 213: asc1 = "Х": Case 214: asc1 = 
    "Ц": Case 215: asc1 = "Ч": Case 216: asc1 = "Ш": Case 217: asc1 = "Щ": Case 
    218: asc1 = "Ъ": Case 219: asc1 = "Ы": Case 220: asc1 = "Ь": Case 221: asc1 
    = "Э": Case 222: asc1 = "Ю": Case 223: asc1 = "Я"
    Case 224: asc1 = "а": Case 225: asc1 = "б": Case 226: asc1 = "в": Case 227: 
    asc1 = "г": Case 228: asc1 = "д": Case 229: asc1 = "е": Case 184: asc1 = 
    "ё": Case 230: asc1 = "ж": Case 231: asc1 = "з": Case 232: asc1 = "и": Case 
    233: asc1 = "й": Case 234: asc1 = "к": Case 235: asc1 = "л": Ca
    
    
    
    и еще до кучи символов... )

    Суровое школоло на службе КГБ.

    Кодирование и раскодирование текста, Урок 197 чать 2
    http://vbbook.ru/visual-basic/kodirovanie-i-raskodirovanie-teksta-yrok-197-chat-2/

    Stertor, 08 Сентября 2013

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

    +110

    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
    // Двухклеточная прямая.
           ({D2A2}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clBlack) and(Pixels[x+h,y-3]=clBlack)     and{D2A2} (Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clWhite)  and{D2A2}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2A2}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)) or {D2A2}
        ({D2A2A-1}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clBlack) and(Pixels[x+h,y-3]=clWhite)     and{D2A2A-1}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clWhite)  and{D2A2A-1}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clBlack) and{D2A2A-1}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)) or {D2A2A-1}
           ({D2A3}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clBlack) and(Pixels[x+h,y-3]=clWhite)     and{D2A3}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clBlack)  and{D2A3}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2A3}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite) and{D2A3}(Pixels[x+h+4,y-3]=clWhite) and(Pixels[x+h+4,y-4]=clBlack) and(Pixels[x+h+4,y-5]=clWhite)) or {D2A3}
           ({D2A4}(Pixels[X+h,Y-1]=clBlack) and(Pixels[x+h,y-2]=clBlack) and(Pixels[x+h,y-3]=clWhite)     and{D2A4}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clWhite)  and{D2A4}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2A4}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)) or {D2A4}
       ... Ещё 20 строк в таком стиле
           ({D2B2}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clWhite) and(Pixels[x+h,y-3]=clBlack)     and{D2B2}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clWhite)      and{D2B2}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite)    and{D2B2}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)     and{D2B2}(Pixels[x+h+4,y-3]=clWhite) and(Pixels[x+h+4,y-4]=clBlack) and(Pixels[x+h+4,y-5]=clWhite)) or {D2B2}
           ({D2B3}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clWhite) and(Pixels[x+h,y-3]=clWhite)     and{D2B3}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clBlack)      and{D2B3}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite)    and{D2B3}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)     and{D2B3}(Pixels[x+h+4,y-3]=clWhite) and(Pixels[x+h+4,y-4]=clBlack) and(Pixels[x+h+4,y-5]=clWhite)) or {D2B3}
           ({D2B4}(Pixels[X+h,Y-1]=clBlack) and(Pixels[x+h,y-2]=clWhite) and(Pixels[x+h,y-3]=clWhite)     and{D2B4}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clBlack)      and{D2B4}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite)    and{D2B4}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)     and{D2B4}(Pixels[x+h+4,y-3]=clWhite) and(Pixels[x+h+4,y-4]=clBlack) and(Pixels[x+h+4,y-5]=clWhite)) {or} {D2B4}
             {(J1(Pixels[X+h,Y-1]=clWhite) and (Pixels[x+h,y]=clWhite) and (Pixels[x+h,y-2]=clBlack))} then // Проверка, если обрыв по x, начало следующей ступенрки.
             begin
              goto k8;
               end ;
                goto k3;//Если убрать эту строчку,то может фиксироваться вся линия исключая точку с дифектоми, т.к.
                 end;   // если не отрабатывает сравнение пикселей по длине ступеньки и не отрабатывает по переходу на новую ступеньку, прог. прибавляет h и перемещает пиксель опроса в право.
     
        k8: if (CPlx-CPLxI=0) or (CPlx-CPlxI=1) or (CPlxI-CPlx=1)or(CPlxI-CPlx=CPlxI/2) or (CPlx-CPlxI=CPlx/2) or (CPlxI-CPlx=(CPlxI/2)-1) or (CPlx-CPlxI=(CPlx/2)-1) or ((CPlxI-CPlx>(CPlxI/2)-1) and (CPlxI-CPlx<(CPlxI/2)+1)) then
     
        begin
         a:=x+h;
         b:=y-1;
         count:=count+1; // Счет ступеник.
         goto k5;
          end;
     
          k3: OperEnd:=DateTimeToTimeStamp(Now);
     Total:=OperEnd.Time-OperBegin.Time;
     
     
       ListBox1.Items.Add(IntToStr(CPlx0)+' CPlx0');
       ListBox1.Items.Add(IntToStr(CPlxI)+' CPlxI');
       ListBox1.Items.Add(IntToStr(count)+' Ступеньки.');
       ListBox1.Items.Add(IntToStr(Total)+' MSec');
         end; // Конец прог.
           end;
             end.

    Адовый пиздец с киберфорума.

    http://www.cyberforum.ru/delphi-beginners/thread941698.html

    murder, 23 Августа 2013

    Комментарии (24)
  11. C# / Говнокод #13561

    +141

    1. 1
    2. 2
    3. 3
    bool eventWasRaised = false;
    
    eventWasRaised.Should().Be.False();

    иногда удивляет до чего доходят .NET unit testing фреймворки.
    пруф http://joseoncode.com/2010/04/29/event-aggregator-with-reactive-extensions/
    эту конструкцию глядишь и эксепшеном вырвет если не false.

    Irdis, 07 Августа 2013

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