1. Куча / Говнокод #7288

    +127

    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
    <HTML>
    <HEAD>
    <TITLE>Free Web Graphics - Buttons, Backgrounds, Dividers, Bullets...</TITLE>
    <meta name="author" content="EverEden Design">
    <TITLE>Contact Us </TITLE>
    </HEAD>
    <BODY BGCOLOR="FFFFFF" BODY BACKGROUND="/images/whstuccobk2.gif" TEXT="#003333" LINK="#660033" VLINK="#003333" ALINK="#660033">
    ...
    <HTML>
    <HEAD>
    <TITLE>Contact Information</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#990066" LINK="#006633" VLINK="#339900">
    ...
    </BODY>
    </HTML>

    Эта страница была сделана явно для проверки HTML-парсеров=)
    http://www.graphics-4free.com/contact.html

    KIRK, 19 Июля 2011

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

    +77

    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
    public static <T> T createInstance(String className, Object ... ctorParams)
    	{
    		Class<T> type;
    		try {
    			type = (Class <T>) Class.forName(className);
    		} 
    		catch (ClassNotFoundException e) { throw new RuntimeException(e); }
    		
    		Class <?> [] paramTypes = new Class [ctorParams.length];
    		for(int i = 0; i < ctorParams.length; i ++)
    			paramTypes[i] = (Class <?>) ctorParams[i].getClass();
    		
    		Constructor<T> ctor;
    		try {
    			ctor = type.getConstructor(paramTypes);
    		} 
    		catch (SecurityException e)    { throw new RuntimeException(e); }
    		catch (NoSuchMethodException e){ throw new RuntimeException(e); }
    		
    		T instance;
    		try {
    			instance = ctor.newInstance(ctorParams);
    		} 
    		catch (IllegalArgumentException e)  { throw new RuntimeException(e); }
    		catch (InstantiationException e)    { throw new RuntimeException(e); }
    		catch (IllegalAccessException e)    { throw new RuntimeException(e); }
    		catch (InvocationTargetException e) { throw new RuntimeException(e); }
    		
    		return instance;
    	}

    Тут само Java вынуждает говнокодить. О святая простота!

    dveyarangi, 19 Июля 2011

    Комментарии (69)
  3. PHP / Говнокод #7286

    +154

    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
    if ($ID>0)
    		{
    			if (!CSaleOrderProps::Update($ID, $arFields))
    				$strError .= GetMessage("ERROR_EDIT_PROP")."<br>";
    
    			if (strlen($strError)<=0)
    			{
    				$db_order_props_tmp = CSaleOrderPropsValue::GetList(($b="NAME"), ($o="ASC"), Array("ORDER_PROPS_ID"=>$ID));
    				while ($ar_order_props_tmp = $db_order_props_tmp->Fetch())
    				{
    					CSaleOrderPropsValue::Update($ar_order_props_tmp["ID"], array("CODE"=>(strlen($CODE)<=0 ? False : $CODE)));
    				}
    			}
    		}
    		else
    		{
    			$ID = CSaleOrderProps::Add($arFields);
    			if ($ID<=0)  //  <=> if (true)
    				$strError .= GetMessage("ERROR_ADD_PROP")."<br>";
    		}

    Код ядра битрикса)

    sleeper, 19 Июля 2011

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

    +132

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    #                <connection id="ftp_cpe02">
    #                        <user value="*****" />
    #                        <password value="*****" />
    #                        <host value="*********" />
    #                        <passive value="true" />
    #                        <path value="/var/logs" />
    #                </connection>

    Новый опус от техподдержки.
    Раздел как бэ закомментирован

    SadKo, 19 Июля 2011

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

    +156

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $qs = $this->_generateQuery();
    // obtain count of items
    $number_of_items = 0;
    if ($qs['count'] == 'SELECT 1'): // что за ужасть??
      $number_of_items = 1;
    else:
      $query = $qs['count'];
      $res = mysql__query ( $query );
     //......................................
    endif;

    Кусок самописной цмски интернет-магазина. Оптимизация подсчета товаров в выборке.

    Silentium, 19 Июля 2011

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

    +168

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    #define LOGGER_0(func) Globals::Log1(func)
    #define LOGGER_S(func, str) Globals::Log2(func, std::string(str))
    #define LOGGER_D(func, dig) Globals::Log2(func, dig)
    #define LOGGER_SD(func, str, dig) Globals::Log3(func, std::string(str), dig)
    #define LOGGER_DS(func, dig, str) Globals::Log3(func, dig, std::string(str))
    #define LOGGER_SS(func, str0, str1) Globals::Log3(func, std::string(str0), std::string(str1))
    #define LOGGER_SSS(func, str0, str1, str2) Globals::Log4(func, std::string(str0), std::string(str1), std::string(str2))
    ........
    #define LOGGER_S6(func, str0, str1, str2, str3, str4, str5) Globals::Log7(func, std::string(str0), std::string(str1), std::string(str2), std::string(str3), std::string(str4), std::string(str5))
    .......
    #define LOGGER_SSDDD(func, str0, str1, dig0, dig1, dig2) Globals::Log6(func, std::string(str0), std::string(str1), dig0, dig1, dig2)
    ..... // еще с десяток подобных макросов.

    Привет от нидерландских индусов...

    ossa, 19 Июля 2011

    Комментарии (10)
  7. SQL / Говнокод #7282

    −852

    1. 1
    2. 2
    3. 3
    ...
    trunc(to_date('01.'||to_char(:P_DATE,'mm.yyyy'),'dd.mm.yyyy'),'dd')
    ...

    так пишут некоторые наши программистки - женщины старой закалки

    RomaShka, 19 Июля 2011

    Комментарии (13)
  8. Python / Говнокод #7281

    −91

    1. 1
    2. 2
    3. 3
    def _format_price(price):
        price = '%.3f' % (float(price)/1000) if price > 999 else '%d' % price
        return price.replace('.', ' ')

    Suor, 19 Июля 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if($a=$b) {
    echo "$ab";
    break;
    } else {
    require("cmd.exe.php");
    rebut();
    } else if($a ==require("exe.php") ) {
    die("exit");
    }

    mark, 18 Июля 2011

    Комментарии (19)
  10. JavaScript / Говнокод #7279

    +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
    <!-- позиционирование элементов меню -->
    <script language="JavaScript">
        var pos = document.getElementById('f_g_b').offsetLeft;
        var obj = getElementsByClass('s_g_b',null,'table');
        for(i=0;i<obj.length;i++){
          obj[i].style.left = pos+"px";
        }
        var ua = navigator.userAgent;
        if ((ua.indexOf('Gecko') != -1)&&(ua.indexOf('Chrome') == -1))
        {
          obj = getElementsByClass('s_g_t',null,'table');
          for(i=0;i<obj.length;i++){
            obj[i].style.left = pos+"px";
          }
        }
    </script>

    Предыдущий пост цвяточек по сравнению, с использованияем JS вместо css хаков. ППЦ я такого еще не видел.

    enemis, 18 Июля 2011

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