1. Список говнокодов пользователя crastinus

    Всего: 14

  2. SQL / Говнокод #13156

    −162

    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
    95. 95
    96. 96
    97. 97
    RIGHT(
      CAST( LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2) AS BIT)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2) AS BIT))) +LTRIM(STR(CAST(TRIP_NO&1 AS BIT))) AS VARCHAR ),
        
    len(
    
    CAST( LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2*2) AS BIT)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2*2) AS BIT)))
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2*2*2) AS BIT)))
     +LTRIM(STR(CAST(TRIP_NO&(2*2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2*2) AS BIT))) 
    +LTRIM(STR(CAST(TRIP_NO&(2) AS BIT))) +LTRIM(STR(CAST(TRIP_NO&1 AS BIT))) AS VARCHAR )
    )
    -
    cast(
    CHARINDEX('1',
    CAST(
    LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2*2*2) as bit)))+
    LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2*2) as bit)))
    +LTRIM(STR(cast(trip_no&(2*2*2*2*2*2*2*2*2) as bit)))
    ..................................................................................................................................................................................
              +    2*t02.bin
              +    4*t03.bin
              +    8*t04.bin
              +   16*t05.bin
              +   32*t06.bin
              +   64*t07.bin
              +  128*t08.bin
              +  256*t09.bin
              +  512*t10.bin
              + 1024*t11.bin
              + 2048*t12.bin
              + 4096*t13.bin
              + 8192*t14.bin
              +16384*t15.bin
              +32768*t16.bin
             ) AS n_10
           , (
              CAST(t16.bin AS CHAR(1))
             +CAST(t15.bin AS CHAR(1))
             +CAST(t14.bin AS CHAR(1))
             +CAST(t13.bin AS CHAR(1))
             +CAST(t12.bin AS CHAR(1))
             +CAST(t11.bin AS CHAR(1))
             +CAST(t10.bin AS CHAR(1))
             +CAST(t09.bin AS CHAR(1))
             +CAST(t08.bin AS CHAR(1))
             +CAST(t07.bin AS CHAR(1))
             +CAST(t06.bin AS CHAR(1))
             +CAST(t05.bin AS CHAR(1))
             +CAST(t04.bin AS CHAR(1))
    ......................................................................................................................................................................
    100000000000000*        (trip_no/2/2/2/2/2         /2/2/2/2/2/2/2/2/2%2)+
      10000000000000*      (trip_no/2/2/2/2/2/2       /2/2/2/2/2/2/2%2)+
      1000000000000*     (trip_no/2/2/2/2/2/2/      2/2/2/2/2/2%2)+
      100000000000*     (trip_no  /2/2/2/2/2/      2/2/2/2/2/2%2)+
       10000000000*   (trip_no    /2/2/2/2/2/     2/2/2/2/2%2)+
       1000000000*   (trip_no      /2/2/2/2/     2/2/2/2/2%2)+
        100000000*  (trip_no        /2/2/2/2    /2/2/2/2%2)+
        10000000*  (trip_no          /2/2/2/    2/2/2/2%2)+
         1000000* (trip_no           /2/2/2/   2/2/2%2)+
          100000* (trip_no            /2/2/2/  2/2%2)+
           10000* (trip_no              /2/2/  2/2%2)+
             1000*(trip_no               /2/2/ 2%2)+
              100*(trip_no                  /2/2%2)+
               10*(trip_no                     /2%2)+
                  1*(trip_no                       %2)
    ..................................................................................................................................................................
    		CASE WHEN trip_no/32768>0 		THEN CAST((trip_no & 32768)/32768	AS varchar)ELSE '' END +
    		CASE WHEN trip_no/16384>0 		THEN CAST((trip_no & 16384)/16384   AS varchar)ELSE '' END +
    		CASE WHEN trip_no/8192>0 		THEN CAST((trip_no & 8192)/8192		AS varchar)ELSE ''END+
    		CASE WHEN trip_no/4096>0 		THEN CAST((trip_no & 4096)/4096		AS varchar)ELSE ''END+
    		CASE WHEN trip_no/2048>0 		THEN CAST((trip_no & 2048)/2048		AS varchar)ELSE ''END+
    		CASE WHEN trip_no/1024>0 		THEN CAST((trip_no & 1024)/1024		AS varchar)ELSE ''END+
    		CASE WHEN trip_no/512>0 		THEN CAST((trip_no & 512)/512		AS varchar)ELSE ''END+
    ..............................................................................................................................
    --И еще с десяток таких же

    Еще выдержки из вариатов с sql-ex.
    Задача:Предполагая, что не существует номера рейса большего 65535, вывести номер рейса и его представление в двоичной системе счисления (без ведущих нулей)

    Как всегда обращаю внимание, что выложенны только части вариантов решения и они не могут быть поданы за свои кем-либо.

    crastinus, 11 Июня 2013

    Комментарии (31)
  3. SQL / Говнокод #13130

    −160

    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
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    select model,
    case when c1>='0' and c1<='9' then cast(c1 as integer) else 0 end +
    case when c2>='0' and c2<='9' then cast(c2 as integer) else 0 end +
    case when c3>='0' and c3<='9' then cast(c3 as integer) else 0 end +
    case when c4>='0' and c4<='9' then cast(c4 as integer) else 0 end +
    case when c5>='0' and c5<='9' then cast(c5 as integer) else 0 end +
    case when c6>='0' and c6<='9' then cast(c6 as integer) else 0 end +
    case when c7>='0' and c7<='9' then cast(c7 as integer) else 0 end +
    case when c8>='0' and c8<='9' then cast(c8 as integer) else 0 end +
    case when c9>='0' and c9<='9' then cast(c9 as integer) else 0 end +
    case when c10>='0' and c10<='9' then cast(c10 as integer) else 0 end +
    case when c11>='0' and c11<='9' then cast(c11 as integer) else 0 end +
    case when c12>='0' and c12<='9' then cast(c12 as integer) else 0 end +
    case when c13>='0' and c13<='9' then cast(c13 as integer) else 0 end +
    case when c14>='0' and c14<='9' then cast(c14 as integer) else 0 end +
    case when c15>='0' and c15<='9' then cast(c15 as integer) else 0 end +
    case when c16>='0' and c16<='9' then cast(c16 as integer) else 0 end +
    case when c17>='0' and c17<='9' then cast(c17 as integer) else 0 end +
    case when c18>='0' and c18<='9' then cast(c18 as integer) else 0 end +
    case when c19>='0' and c19<='9' then cast(c19 as integer) else 0 end +
    case when c20>='0' and c20<='9' then cast(c20 as integer) else 0 end +
    case when c21>='0' and c21<='9' then cast(c21 as integer) else 0 end +
    case when c22>='0' and c22<='9' then cast(c22 as integer) else 0 end +
    case when c23>='0' and c23<='9' then cast(c23 as integer) else 0 end +
    case when c24>='0' and c24<='9' then cast(c24 as integer) else 0 end +
    case when c25>='0' and c25<='9' then cast(c25 as integer) else 0 end +
    case when c26>='0' and c26<='9' then cast(c26 as integer) else 0 end +
    case when c27>='0' and c27<='9' then cast(c27 as integer) else 0 end +
    case when c28>='0' and c28<='9' then cast(c28 as integer) else 0 end +
    case when c29>='0' and c29<='9' then cast(c29 as integer) else 0 end +
    case when c30>='0' and c30<='9' then cast(c30 as integer) else 0 end +
    case when c21>='0' and c31<='9' then cast(c31 as integer) else 0 end +
    case when c22>='0' and c32<='9' then cast(c32 as integer) else 0 end +
    case when c23>='0' and c33<='9' then cast(c33 as integer) else 0 end +
    case when c34>='0' and c34<='9' then cast(c34 as integer) else 0 end +
    case when c35>='0' and c35<='9' then cast(c35 as integer) else 0 end +
    case when c36>='0' and c36<='9' then cast(c36 as integer) else 0 end +
    case when c37>='0' and c37<='9' then cast(c37 as integer) else 0 end +
    case when c38>='0' and c38<='9' then cast(c38 as integer) else 0 end +
    case when c39>='0' and c39<='9' then cast(c39 as integer) else 0 end +
    case when c40>='0' and c40<='9' then cast(c40 as integer) else 0 end +
    case when c41>='0' and c41<='9' then cast(c41 as integer) else 0 end +
    case when c42>='0' and c42<='9' then cast(c42 as integer) else 0 end +
    case when c43>='0' and c43<='9' then cast(c43 as integer) else 0 end +
    case when c44>='0' and c44<='9' then cast(c44 as integer) else 0 end +
    case when c45>='0' and c45<='9' then cast(c45 as integer) else 0 end +
    case when c46>='0' and c46<='9' then cast(c46 as integer) else 0 end +
    case when c47>='0' and c47<='9' then cast(c47 as integer) else 0 end +
    case when c48>='0' and c48<='9' then cast(c48 as integer) else 0 end +
    case when c49>='0' and c49<='9' then cast(c49 as integer) else 0 end +
    case when c50>='0' and c50<='9' then cast(c50 as integer) else 0 end from(
    select model,
    coalesce(substring(m,1,1),'0') as c1,
    coalesce(substring(m,2,1),'0') as c2,
    coalesce(substring(m,3,1),'0') as c3,
    coalesce(substring(m,4,1),'0') as c4,
    coalesce(substring(m,5,1),'0') as c5,
    coalesce(substring(m,6,1),'0') as c6,
    coalesce(substring(m,7,1),'0') as c7,
    coalesce(substring(m,8,1),'0') as c8,
    coalesce(substring(m,9,1),'0') as c9,
    coalesce(substring(m,10,1),'0') as c10,
    coalesce(substring(m,11,1),'0') as c11,
    coalesce(substring(m,12,1),'0') as c12,
    coalesce(substring(m,13,1),'0') as c13,
    coalesce(substring(m,14,1),'0') as c14,
    coalesce(substring(m,15,1),'0') as c15,
    coalesce(substring(m,16,1),'0') as c16,
    coalesce(substring(m,17,1),'0') as c17,
    coalesce(substring(m,18,1),'0') as c18,
    coalesce(substring(m,19,1),'0') as c19,
    coalesce(substring(m,20,1),'0') as c20,
    coalesce(substring(m,21,1),'0') as c21,
    coalesce(substring(m,22,1),'0') as c22,
    coalesce(substring(m,23,1),'0') as c23,
    coalesce(substring(m,24,1),'0') as c24,
    coalesce(substring(m,25,1),'0') as c25,
    coalesce(substring(m,26,1),'0') as c26,
    coalesce(substring(m,27,1),'0') as c27,
    coalesce(substring(m,28,1),'0') as c28,
    coalesce(substring(m,29,1),'0') as c29,
    coalesce(substring(m,30,1),'0') as c30,
    coalesce(substring(m,31,1),'0') as c31,
    coalesce(substring(m,32,1),'0') as c32,
    coalesce(substring(m,33,1),'0') as c33,
    coalesce(substring(m,34,1),'0') as c34,
    coalesce(substring(m,35,1),'0') as c35,
    coalesce(substring(m,36,1),'0') as c36,
    coalesce(substring(m,37,1),'0') as c37,
    coalesce(substring(m,38,1),'0') as c38,
    coalesce(substring(m,39,1),'0') as c39,
    coalesce(substring(m,40,1),'0') as c40,
    coalesce(substring(m,41,1),'0') as c41,
    coalesce(substring(m,42,1),'0') as c42,
    coalesce(substring(m,43,1),'0') as c43,
    coalesce(substring(m,44,1),'0') as c44,
    coalesce(substring(m,45,1),'0') as c45,
    coalesce(substring(m,46,1),'0') as c46,
    coalesce(substring(m,47,1),'0') as c47,

    Один из вариантов решения задачи с форума сайта sql-ex (может стебный):
    Посчитать сумму цифр в номере каждой модели из таблицы Product
    Вывод: номер модели, сумма цифр

    Полный код все равно не помещается, значит его нельзя выдать за свой.

    crastinus, 08 Июня 2013

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

    +35

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    #if defined(_WIN32) || defined(_WIN64)
        ofstream outfile("help.txt");
        outfile << message << endl;
        system("notepad.exe help.txt");
     #else
        cout << message ;
    #endif

    Зачем бороться с юникодом в консоли, когда есть блокнот?

    crastinus, 03 Июня 2013

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

    −121

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    //Рарус Обработка МодульОбменаДанными СоставКонтуровОбмена()
    	КешСоставКонтуровОбмена = Новый Соответствие; 
    	КешОбъектовКонтуровОбмена = Новый Соответствие; // м.б. будем использовать для ограничения типов поля "Документ" в запросе по регистру ТаблицаРегистрацииДокументов
    	
    	Попытка
    		//Вот здесь в программу загружается список контуров обмена, представляющии из себя политики для документов
    		Шаблон = ПолучитьМакет("СоставКонтуровОбмена"+Метаданные.Имя);
    		ВерсияВШаблоне = СокрЛП(Шаблон.Область(1, 2).Текст);
    ......
    				КешСоставКонтуровОбмена.Вставить(Тип(ТипСтр+"Ссылка."+ИмяСтр), ПеречислениеСсылка);

    Просто засунули все в макет, раздел макета это тип политик для набора Документов. Это не такой плохой способ, притом что очень хорошо видно в конфигураторе как и куда петкать политики обработки файлов. Но по всем параметрам говнокод.
    http://i54.fastpic.ru/big/2013/0130/34/730bb0d4a34dbccb43c3cb5cd46fea34.jpg

    crastinus, 30 Января 2013

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