1. SQL / Говнокод #221

    −352.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
    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
    SELECT DISTINCT BE.ID as ID,BE.NAME as NAME,BE.CODE as CODE,BE.IBLOCK_ID as
    IBLOCK_ID,BE.IBLOCK_SECTION_ID as IBLOCK_SECTION_ID,B.DETAIL_PAGE_URL as
    DETAIL_PAGE_URL,BE.DETAIL_TEXT as DETAIL_TEXT,BE.DETAIL_TEXT_TYPE as
    DETAIL_TEXT_TYPE,BE.DETAIL_PICTURE as DETAIL_PICTURE,BE.PREVIEW_TEXT as
    PREVIEW_TEXT,BE.PREVIEW_TEXT_TYPE as PREVIEW_TEXT_TYPE,BE.PREVIEW_PICTURE as
    PREVIEW_PICTURE,L.DIR as LANG_DIR,BE.XML_ID as EXTERNAL_ID,B.IBLOCK_TYPE_ID as
    IBLOCK_TYPE_ID,B.CODE as IBLOCK_CODE,B.XML_ID as IBLOCK_EXTERNAL_ID FROM
    b_iblock B INNER JOIN b_lang L ON B.LID=L.LID INNER JOIN b_iblock_element BE
    ON BE.IBLOCK_ID = B.ID INNER JOIN b_iblock_section_element BSE ON
    BSE.IBLOCK_ELEMENT_ID = BE.ID INNER JOIN b_iblock_section BSubS ON
    BSE.IBLOCK_SECTION_ID = BSubS.ID INNER JOIN b_iblock_section BS ON
    (BSubS.IBLOCK_ID=BS.IBLOCK_ID AND BSubS.LEFT_MARGIN>=BS.LEFT_MARGIN AND
    BSubS.RIGHT_MARGIN<=BS.RIGHT_MARGIN) INNER JOIN b_iblock_property FP1 ON
    FP1.IBLOCK_ID=B.ID AND FP1.CODE='code2' INNER JOIN b_iblock_element_property
    FPV1 ON FP1.ID=FPV1.IBLOCK_PROPERTY_ID AND FPV1.IBLOCK_ELEMENT_ID=BE.ID INNER
    JOIN b_iblock_property FP2 ON FP2.IBLOCK_ID=B.ID AND FP2.CODE='code3' INNER
    JOIN b_iblock_element_property FPV2 ON FP2.ID=FPV2.IBLOCK_PROPERTY_ID AND
    FPV2.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP3 ON
    FP3.IBLOCK_ID=B.ID AND FP3.CODE='code4' INNER JOIN b_iblock_element_property
    FPV3 ON FP3.ID=FPV3.IBLOCK_PROPERTY_ID AND FPV3.IBLOCK_ELEMENT_ID=BE.ID INNER
    JOIN b_iblock_property FP4 ON FP4.IBLOCK_ID=B.ID AND FP4.CODE='code5' INNER
    JOIN b_iblock_element_property FPV4 ON FP4.ID=FPV4.IBLOCK_PROPERTY_ID AND
    FPV4.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP5 ON
    FP5.IBLOCK_ID=B.ID AND FP5.CODE='code7' INNER JOIN b_iblock_element_property
    FPV5 ON FP5.ID=FPV5.IBLOCK_PROPERTY_ID AND FPV5.IBLOCK_ELEMENT_ID=BE.ID INNER
    JOIN b_iblock_property FP6 ON FP6.IBLOCK_ID=B.ID AND FP6.CODE='code9' INNER
    JOIN b_iblock_element_property FPV6 ON FP6.ID=FPV6.IBLOCK_PROPERTY_ID AND
    FPV6.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP7 ON
    FP7.IBLOCK_ID=B.ID AND FP7.CODE='code12' INNER JOIN b_iblock_element_property
    FPV7 ON FP7.ID=FPV7.IBLOCK_PROPERTY_ID AND FPV7.IBLOCK_ELEMENT_ID=BE.ID INNER
    JOIN b_iblock_property FP8 ON FP8.IBLOCK_ID=B.ID AND FP8.CODE='code15' INNER
    JOIN b_iblock_element_property FPV8 ON FP8.ID=FPV8.IBLOCK_PROPERTY_ID AND
    FPV8.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP9 ON
    FP9.IBLOCK_ID=B.ID AND FP9.CODE='code16' INNER JOIN b_iblock_element_property
    FPV9 ON FP9.ID=FPV9.IBLOCK_PROPERTY_ID AND FPV9.IBLOCK_ELEMENT_ID=BE.ID INNER
    JOIN b_iblock_property FP10 ON FP10.IBLOCK_ID=B.ID AND FP10.CODE='code18'
    INNER JOIN b_iblock_element_property FPV10 ON FP10.ID=FPV10.IBLOCK_PROPERTY_ID
    AND FPV10.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP11 ON
    FP11.IBLOCK_ID=B.ID AND FP11.CODE='code23' INNER JOIN
    b_iblock_element_property FPV11 ON FP11.ID=FPV11.IBLOCK_PROPERTY_ID AND
    FPV11.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP12 ON
    FP12.IBLOCK_ID=B.ID AND FP12.CODE='code26' INNER JOIN
    b_iblock_element_property FPV12 ON FP12.ID=FPV12.IBLOCK_PROPERTY_ID AND
    FPV12.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP13 ON
    FP13.IBLOCK_ID=B.ID AND FP13.CODE='code27' INNER JOIN
    b_iblock_element_property FPV13 ON FP13.ID=FPV13.IBLOCK_PROPERTY_ID AND
    FPV13.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP14 ON
    FP14.IBLOCK_ID=B.ID AND FP14.CODE='code32' INNER JOIN
    b_iblock_element_property FPV14 ON FP14.ID=FPV14.IBLOCK_PROPERTY_ID AND
    FPV14.IBLOCK_ELEMENT_ID=BE.ID INNER JOIN b_iblock_property FP15 ON
    FP15.IBLOCK_ID=B.ID AND FP15.CODE='code34' INNER JOIN
    b_iblock_element_property FPV15 ON FP15.ID=FPV15.IBLOCK_PROPERTY_ID AND
    FPV15.IBLOCK_ELEMENT_ID=BE.ID WHERE 1=1 AND B.ID IN (0,42) AND (
    (BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL) ) AND ((((
    (upper(BE.NAME) like upper('%acer7730G%') and BE.NAME is not null) )))) AND
    (((( (upper(FPV1.VALUE) like upper('%Intel%') and FPV1.VALUE is not null) AND
    (upper(FPV1.VALUE) like upper('%Core2Duo%') and FPV1.VALUE is not null) AND
    (upper(FPV1.VALUE) like upper('%T5850%') and FPV1.VALUE is not null) AND
    (upper(FPV1.VALUE) like upper('%2.16GHz%') and FPV1.VALUE is not null) ))))
    AND (((( (upper(FPV2.VALUE) like upper('%4096Mb%') and FPV2.VALUE is not null)
    AND ( (upper(FPV2.VALUE) like upper('%4Gb%') and FPV2.VALUE is not null) ) AND
    (upper(FPV2.VALUE) like upper('%DDRII%') and FPV2.VALUE is not null) )))) AND
    (((( (upper(FPV3.VALUE) like upper('%2x320Gb%') and FPV3.VALUE is not null)
    AND (upper(FPV3.VALUE) like upper('%5400rpm%') and FPV3.VALUE is not null) AND
    (upper(FPV3.VALUE) like upper('%SATA%') and FPV3.VALUE is not null) )))) AND
    (((( (upper(FPV4.VALUE) like upper('%17%') and FPV4.VALUE is not null) ))))
    AND (((( (upper(FPV5.VALUE) like upper('%??%') and FPV5.VALUE is not null)
    )))) AND (((( (upper(FPV6.VALUE) like upper('%64Mb%') and FPV6.VALUE is not
    null) AND ( (upper(FPV6.VALUE) like upper('%??%') and FPV6.VALUE is not null)
    AND (upper(FPV6.VALUE) like upper('%958Mb%') and FPV6.VALUE is not null) )))))
    AND (((( (upper(FPV7.VALUE) like upper('%??%') and FPV7.VALUE is not null)
    )))) AND (((( (upper(FPV8.VALUE) like upper('%Bluetooth%') and FPV8.VALUE is
    not null) AND (upper(FPV8.VALUE) like upper('%V2.0%') and FPV8.VALUE is not
    null) AND (upper(FPV8.VALUE) like upper('%EDR%') and FPV8.VALUE is not null)
    )))) AND (((( (upper(FPV9.VALUE) like upper('%4%') and FPV9.VALUE is not null)
    )))) AND (((( (upper(FPV10.VALUE) like upper('%??%') and FPV10.VALUE is not
    null) )))) AND (((( (upper(FPV11.VALUE) like upper('%??%') and FPV11.VALUE is
    not null) )))) AND (((( (upper(FPV12.VALUE) like upper('%??%') and FPV12.VALUE
    is not null) )))) AND (((( (upper(FPV13.VALUE) like upper('%WebCam%') and
    FPV13.VALUE is not null) AND (upper(FPV13.VALUE) like upper('%1,3Mpx%') and
    FPV13.VALUE is not null) )))) AND (((( (upper(FPV14.VALUE) like
    upper('%?????%') and FPV14.VALUE is not null) )))) AND ((((
    (upper(FPV15.VALUE) like upper('%12%') and FPV15.VALUE is not null) AND
    (upper(FPV15.VALUE) like upper('%???????%') and FPV15.VALUE is not null) ))))
    AND ((((BE.IBLOCK_ID = '42')))) AND (((BE.ACTIVE_TO >= now() OR BE.ACTIVE_TO
    IS NULL) AND (BE.ACTIVE_FROM <= now() OR BE.ACTIVE_FROM IS NULL))) AND
    ((((BE.ACTIVE='Y')))) AND ((BS.ID = 224)) ORDER BY BE.SORT asc , BE.ID desc
    LIMIT 0, 30

    Битрикс (http://dev.1c-bitrix.ru/community/forums/forum6/topic14898/)

    guest, 19 Декабря 2008

    Комментарии (34)
  2. Java / Говнокод #220

    −47.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public AlarmKey(AlarmKey key)
        {
            oc = "";
            id = "";
            source = null;
            oc = key.oc;
            id = key.id;
            source = key.source;
        }

    DoubleCheck :)

    guest, 18 Декабря 2008

    Комментарии (4)
  3. VisualBasic / Говнокод #219

    −519.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
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    '/**
    ' * Parser
    ' * @param String text
    ' * @param Scripting.Dictionary text
    ' */
    private function Parse(text, data)
        dim RE, EM, MO, res, lastIndex, val
        res = ""
        Set RE = New RegExp
        RE.Pattern = "(\\?)\$(?:(\w+)|\{(\w+)\})"
        RE.IgnoreCase = False
        RE.Global = True
        Set EM = RE.Execute(text)
        if EM.Count > 0 then
            lastIndex = 1
            for each MO in EM
                if Mid(MO.Value,1,2) = "\$" then
                    val = Mid(MO.Value,2)
                else
                    if Mid(MO.Value,1,2) = "${" then 
                        val = Mid(Mid(MO.Value,1,Len(MO.Value)-1),3) 
                    else 
                        val = Mid(MO.Value,2)
                    end if
                    val = data(val)
                end if
                res = res & Mid(text, lastIndex, MO.FirstIndex-lastIndex+1) & val
                lastIndex = MO.FirstIndex+MO.Length+1
            next
            res = res & Mid(text, lastIndex)
            Parse = res
        else
            Parse = text
        end if
    end function

    Пример, как функция, которая в других языках описывается одной строкой, реализуется на этом говноязыке

    guest, 18 Декабря 2008

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

    +48.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
    <?php
        global
            $_REQUEST,
            $_SERVER,
            $_FILES,
            $PHP_SELF,
            $_GET_VARS,$_GET,
            $_POST_VARS,  
            $_POST,
            $_COOKIE,
            $HTTP_ENV_VARS,
            $HTTP_SERVER_VARS,
            $_page,
            $_text,
            $_user,
            $_cook_session,
            $_page_index,
            $_page_title,
            $parce_page;
    
        extract($_GET);
        extract($_POST);
        extract($_FILES);
    
        while (list($key123, $value123) = each($_GET))    ${$key123}=$value123;
        while (list($key123, $value123) = each($_POST))   ${$key123}=$value123;
        while (list($key123, $value123) = each($_FILES))  ${$key123}=$value123;
    
        foreach ($_POST as $key=>$value) {
    	    ${$key}=$value;
    	}
        foreach ($_GET as $key=>$value) {
    	    ${$key}=$value;
    	}
    ?>

    Цитирую весь файл, как есть

    guest, 18 Декабря 2008

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

    +26

    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
    protected function _buildParamsUrl($additional = array()) {
           $url = array();
           $params = $this->_request->getParams();
           $params = array_merge($params);
           foreach ($params as $var => $val) {
               if (in_array($var,$this->_neededParams) && is_scalar($val)) {
                    $url[$var] = $val;
               }
           }
           
           $url = array_merge($url,$additional);
           
           return $url;
        }

    Было нужно подставлять параметры из POST в action формы. Почему осталось в таком виде - хз... Видимо было выпито мало кофе с утра...

    guest, 18 Декабря 2008

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

    −47.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    n=1;
    	while ( n <= d_after )
    	{	
    		++n;
    	}
    
    	int secs = n-1;

    Best Practices(made by indian)

    guest, 18 Декабря 2008

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

    −40.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
    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
    /* This is bad. Reaaly bad. It's a really, really bad hack. If you're an employee of 
     * Intertrode Communication, then I'm really, really sorry that you have to maintain
     * this. I was honestly planning on removing this tomorrow, but I've been known to 
     * forget things like this. It happens.
     *
     * So here's the thing. I can't seem to figure out why the AccountId variable isn't 
     * set. I've looked and looked, but I gotta leave now. Anyway, I've found that I can
     * just grab the AccountID from the debugging logs.  I suppose that to fix it, you'd
     * have to locate where it's clearing out the ID.
     *
     * Again, I'm sorry.
     */
    
    if ( (AccountId == NULL) || (AccountId == "") ||
         (ServerSesion["AccountId"] == NULL) || (ServerSesion["AccountId"] == "") )
    {
      //open session logs
      FileHandle file = f_open(LOG_PATH + "\sessionlog-" + LOG_FILE_DATE + ".log", 1);
      while (file != NULL)
      {
        
        TString line = f_readline(file);
    
        //look for IP and changereg
        if ( (sfind(line,REMOTE_ADDR) != -1) && (sfind(line,"changereg") != -1) )
        {
          //0000-00-00 00:00 /accountmaint/changereg/?AccountId=123456 255.255.255.255 ...
          //                                                    *
          AccountId = substr(line, 52, 6);
        }
    
        if (f_EOF(file)) { f_close(file); file = NULL; }
      }
    
    }

    У чувака где то перетирается AccountId, так он берет данные из логов IIS'а :) Главное, что он сожалеет об этом.
    Отсюда: http://thedailywtf.com/Articles/The_Apologetic_Coder.aspx

    guest, 18 Декабря 2008

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

    −156.8

    1. 1
    2. 2
    3. 3
    4. 4
    Почему нет раздела по 1С? )))
    Почему нет раздела по 1С? )))
    Почему нет раздела по 1С? )))
    Почему нет раздела по 1С? )))

    Почему нет раздела по 1С? )))

    guest, 18 Декабря 2008

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

    −27.3

    1. 1
    2. 2
    3. 3
    cout<<"enterX"<<endl;
         cin >>x;
    x = 0.125;

    guest, 18 Декабря 2008

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

    +1429.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
    58. 58
    59. 59
    bool IsBukva(char symbol)
    {
    switch(symbol)
    {
    case'a':return 1;break;
    case'b':return 1;break;
    case'c':return 1;break;
    case'd':return 1;break;
    case'e':return 1;break;
    case'f':return 1;break;
    case'g':return 1;break;
    case'h':return 1;break;
    case'i':return 1;break;
    case'j':return 1;break;
    case'k':return 1;break;
    case'l':return 1;break;
    case'm':return 1;break;
    case'n':return 1;break;
    case'o':return 1;break;
    case'p':return 1;break;
    case'q':return 1;break;
    case'r':return 1;break;
    case's':return 1;break;
    case't':return 1;break;
    case'u':return 1;break;
    case'v':return 1;break;
    case'w':return 1;break;
    case'x':return 1;break;
    case'y':return 1;break;
    case'z':return 1;break;
    case'A':return 1;break;
    case'B':return 1;break;
    case'C':return 1;break;
    case'D':return 1;break;
    case'E':return 1;break;
    case'F':return 1;break;
    case'G':return 1;break;
    case'H':return 1;break;
    case'I':return 1;break;
    case'J':return 1;break;
    case'K':return 1;break;
    case'L':return 1;break;
    case'M':return 1;break;
    case'N':return 1;break;
    case'O':return 1;break;
    case'P':return 1;break;
    case'Q':return 1;break;
    case'R':return 1;break;
    case'S':return 1;break;
    case'T':return 1;break;
    case'U':return 1;break;
    case'V':return 1;break;
    case'W':return 1;break;
    case'X':return 1;break;
    case'Y':return 1;break;
    case'Z':return 1;break;
    default:return 0;
    }
    }

    Женский вариант проверки символа на букву.
    Оригинал тут: http://forum.vingrad.ru/forum/topic-240593.html

    guest, 17 Декабря 2008

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