1. Java / Говнокод #4741

    +76

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    // Setted bit
    	private static final int TRUE_BIT = 1;
    
    ...
    	public static final int LAST_PARAGRAPH = 0x01;
    	public static final int FIRST_PARAGRAPH = 0x02;
    ...
    	
    	if (TRUE_BIT == (paragraphFlag & ParagraphProperties.FIRST_PARAGRAPH) >>> 1) {

    mlg7, 24 Ноября 2010

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

    +172

    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
    <?php
    	
    	( ( (float)phpversion() < 5.3 ) ) ? die ( 'fail amigo.' ) : '';
    	
    	$site = file_get_contents( "http://www.google.com.br/search?hl=pt-BR&q=VBXMCBVFKJSHDKHDKF" );
    
    	$getLocationViaGoogle = function ( $html ){
    		$regex = "#<\w+\s\w+=\"tbos\">([^<]{3,})<\/\w+>#i";
    		preg_match_all( $regex, $html, $matches );
    		return $matches[1][0];
    	};
    	
    	print $getLocationViaGoogle( $site );
    	
    ?>

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

    Yurik, 24 Ноября 2010

    Комментарии (28)
  3. 1C / Говнокод #4739

    −140

    1. 1
    2. 2
    3. 3
    Если (ШаблонПроводки.Наименование = "Распределять пропорционально расчетной базе") Тогда
    	МожноПроводить = 0;
    	Сообщить(НазваниеДока+"неверно указан шаблон проводки", "!");

    Это так профессионально, сравнивать строки...

    1_and_0, 24 Ноября 2010

    Комментарии (12)
  4. JavaScript / Говнокод #4738

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    function eval()
    {
        this.obj = eval(obj);
    }

    выкопал из сорцов игрушки...

    Lure Of Chaos, 24 Ноября 2010

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

    +143

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    RewriteRule info/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3&d4=$4&d5=$5&d6=$6&d7=$7&d8=$8&d9=$9&d10=$10&d11=$11 [L]
    RewriteRule info/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3&d4=$4&d5=$5&d6=$6&d7=$7&d8=$8&d9=$9&d10=$10 [L]
    RewriteRule info/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3&d4=$4&d5=$5&d6=$6&d7=$7&d8=$8&d9=$9 [L]
    RewriteRule info/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3&d4=$4&d5=$5&d6=$6&d7=$7&d8=$8 [L]
    RewriteRule info/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3&d4=$4&d5=$5&d6=$6&d7=$7 [L]
    RewriteRule info/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3&d4=$4&d5=$5&d6=$6 [L]
    RewriteRule info/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3&d4=$4&d5=$5 [L]
    RewriteRule info/([^/]+)/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3&d4=$4 [L]
    RewriteRule info/([^/]+)/([^/]+)/(.*) /content.php?d1=$1&d2=$2&d3=$3 [L]
    RewriteRule info/([^/]+)/(.*) /content.php?d1=$1&d2=$2 [L]
    RewriteRule info/(.*) /content.php?d1=$1 [L]

    facepalm.php

    wiz, 24 Ноября 2010

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

    +173

    1. 1
    2. 2
    3. 3
    $query = "SELECT `id`, IF(`nalichie` = 0, '0.png', '1.png') AS `nalichieimg`, `cena` FROM `buttons`";
    //не достойные внимания строки опущены.
    echo '<img src="'.$row['nalichieimg'].'">';

    Я понимаю, что для оптимизации некоторые задачи лучше бывает перенести на сторону БД. Но не на столько же!!! o_0

    Uchkuma, 24 Ноября 2010

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

    −857

    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
    -- Возвращает название месяца по русский
       FUNCTION fmonstr (pmon IN VARCHAR2)
          RETURN CHAR
       IS
          TYPE tmon IS TABLE OF VARCHAR2 (60)
             INDEX BY BINARY_INTEGER;
    
          amon   tmon;
       BEGIN
          amon (1) := 'ЯНВАРЬ';
          amon (2) := 'ФЕВРАЛЬ';
          amon (3) := 'МАРТ';
          amon (4) := 'АПРЕЛЬ';
          amon (5) := 'МАЙ';
          amon (6) := 'ИЮНЬ';
          amon (7) := 'ИЮЛЬ';
          amon (8) := 'АВГУСТ';
          amon (9) := 'СЕНТЯБРЬ';
          amon (10) := 'ОКТЯБРЬ';
          amon (11) := 'НОЯБРЬ';
          amon (12) := 'ДЕКАБРЬ';
          RETURN amon (TO_NUMBER (pmon));
          NULL;
       END;                                                        --  End fMonStr

    о наличие nls_date_language=russian и to_char() видимо не догадывались

    itaho, 24 Ноября 2010

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

    −166

    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
    import cgi
    import MySQLdb
     
    MyDB=MySQLdb.connect(host='localhost', user='root', passwd='', db='serv')
    cursor=MyDB.cursor()
    cursor.execute("""SELECT * FROM IndexPage WHERE id=2""")
    zg1=cursor.fetchall()
    zp=cgi.FieldStorage()
    p=zp.has_key('pages')
    lixt='lrof'
    title='{TITLE}'
    Block1='{BLOCK_1}'
     
    if p==1:
        print 'Content-Type: text/html\n'
        sh=open(r'themplates/sh2')
        res=sh.read()
        ...

    Пхпшники пересаживаются на Питон

    qbasic, 24 Ноября 2010

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

    +110

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    protected static string CreateSubIndexName(string prefix, int index) {
                return String.Format(CultureInfo.InvariantCulture, "{0}[{1}]", prefix, index);
            }
    
            protected static string CreateSubIndexName(string prefix, string index) {
                return String.Format(CultureInfo.InvariantCulture, "{0}[{1}]", prefix, index);
            }

    Из исходников ASP.NET MVC 2. Класс DefaultModelBinder.
    Рядышком друг за другом два метода с совершенно одинаковым содержимым.
    Наш девиз: дублирование кода, умещающегося в одну строчку, за дублирование не считается.

    Pauchok-Anaynckiy, 24 Ноября 2010

    Комментарии (11)
  10. Java / Говнокод #4732

    +118

    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
    //-----------------------------------------------------------------------------------------------------------
    // Создаю ПОСВИДЧЕННЯ ПРО ВИДРЯДЖЕННЯ
    // Создаю тело документа
    FunForServices.writeToLog(2, ps, "create PPV");
    
    rs1 = stat1.executeQuery("Select D.DEPAR_Name As Dep, rtrim(L.LDAP_Name) as FIO, P.PEOP_Posit As Pos From IPS..PEOP P, IPS..LDAP L, IPS..DEPAR D Where L.LDA_LDAP_Login=D.LDAP_Login and L.LDAP_Login=P.LDAP_Login and L.LDAP_Login='"+rs.getString("Login")+"'");
    rs1.next();
    rez1="<?xml version=''1.0'' ?><u1><st><![CDATA[";
    rez1+="<table width=\"100%\" border=0><tr><td width=\"33%\" align=right><table width=\"33%\"><tr>";
    rez1+="<td style=\"FONT-WEIGHT: bold; FONT-SIZE: x-small; FONT-FAMILY: Arial; TEXT-ALIGN: center\">";
    rez1+="ЗАТВЕРДЖЕНО</td></tr><tr><td style=\"FONT-WEIGHT: bold; FONT-SIZE: x-small; FONT-FAMILY: Arial; TEXT-ALIGN: center\">";
    rez1+="наказом Державної податкової</td></tr><tr><td style=\"FONT-WEIGHT: bold; FONT-SIZE: x-small; FONT-FAMILY: Arial; TEXT-ALIGN: center\">";
    rez1+="адмiнiстрацiї України вiд</td></tr><tr><td style=\"FONT-WEIGHT: bold; FONT-SIZE: x-small; FONT-FAMILY: Arial; TEXT-ALIGN: center\">";
    rez1+="28.07.97 г. N 260</td></tr></table></td></tr><tr><td><br><br></td></tr><tr><td align=middle><I><B><FONT face=Arial size=4>ПОСВIДЧЕННЯ ПРО ВIДРЯДЖЕННЯ N</FONT></B></I>";
    rez1+="<td>                     </td>";
    //////////////////////////////////////
    //	строк 30 такого
    //////////////////////////////////////
    rez1+="<TR><TD> </TD></TR><TR><TD><TABLE cellSpacing=0 cellPadding=0 width=\"100%\"><TR><TD align=left><STRONG><EM><FONT face=Arial>КЕРIВНИК</FONT></EM></STRONG></TD><TD align=middle id=pod>Пiдпис</TD>";
    rez1+="<TD align=right onclick=StampUtv(\""+sign+"\")><B>"+utvfio+"</B></TD></TR></TABLE></TD></TR><TR><TD> </TD></TR><TR><TD><STRONG><FONT face=Arial>М.П.</FONT></STRONG></TD></TR></TABLE></TD></TR>";
    rez1+="</table>";
    rez1+="]]></tp></u1>";
    
    rs1 = stat1.executeQuery("Declare @Rez int exec GetCardNum "+FunForServices.Year+", '"+rs.getString("Login")+"', 'A', @Rez out Select @Rez");
    rs1.next();
    annNumb1 = rs1.getInt(1);
    
    rs1 = stat1.executeQuery("Declare @Rez int exec GetCardNum "+FunForServices.Year+", '"+rs.getString("Login")+"' , 'C', @Rez out Select @Rez");
    rs1.next();
    ndoc1=rs1.getInt(1);
    FunForServices.CreateBody(ndoc1, 0, "DocB", rez1, stat1);
    FunForServices.writeToLog(2, ps, ndoc1+" for "+rs.getString("Login"));
    
    rs1=stat1.executeQuery("AddDocCard "+rs.getInt("Act")+", '"+utv+"', "+ndoc+", "+rs.getInt("Grup")+", 1, 4,'"+regndoc.substring(0,regndoc.lastIndexOf("-"))+"', 'ПОСВIДЧЕННЯ ПРО ВIДРЯДЖЕННЯ', null,'"+annot+"', 'Нормальный', 4, null, null, null, null, null, null, '"+pk+"', ';"+utv+"', null, ';"+rs.getString("Login")+"', '"+pkdat+"', @IIdDocCard="+ndoc1+", @IIdAttending = "+annNumb1);
    stat1.executeUpdate("Constatation "+ndoc1+", '"+utv+"'");
    FunForServices.writeToLog(6, ps, "");

    лайно з Украïни...

    3.14159265, 24 Ноября 2010

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