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

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

    +75

    1. 1
    2. 2
    <input type="text" value="1" id="Count" size="1">
    <a href="<?=$arResult["ADD_URL"]?>" rel="nofollow" onclick="return addToCart(this, 'catalog_detail_image', 'detail', '<?=GetMessage("CATALOG_IN_BASKET")?>');" id="catalog_add2cart_link"><span><img src="/upload/cart.jpg"></span>

    o1eg, 29 Апреля 2012

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

    +75

    1. 1
    if(batchControlImpl.startJobActivity(JobStatusType.STARTED));

    К проекту подключили активированных активных индусов.

    http://tinyurl.com/cvwefek

    roman-kashitsyn, 09 Апреля 2012

    Комментарии (9)
  4. Pascal / Говнокод #9891

    +75

    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
    program pr8;
    uses crt;
    var
    a:array [1..32] of char;
    b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r:integer;
    a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1: integer;
    begin
    a[1]:=' ';
    a[2]:='Ў';
    a[3]:='ў';
    a[4]:='Ј';
    a[5]:='¤';
    a[6]:='Ґ';
    a[7]:='¦';
    a[8]:='§';
    a[9]:='Ё';
    a[10]:='©';
    a[11]:='Є';
    a[12]:='«';
    a[13]:='¬';
    a[14]:='­';
    a[15]:='®';
    a[16]:='Ї';
    a[17]:='а';
    a[18]:='б';
    a[19]:='в';
    a[20]:='г';
    a[21]:='д';
    a[22]:='е';
    a[23]:='ж';
    a[24]:='з';
    a[25]:='и';
    a[26]:='й';
    a[27]:='к';
    a[28]:='л';
    a[29]:='м';
    a[30]:='н';
    a[31]:='о';
    a[32]:='п';
    b:=21;
    c:=24;
    d:=6;
    e:=13;
    f:=15;
    g:=19;
    h:=18;
    i:=20;
    j:=10;
    k:=21;
    l:=10;
    m:=10;
    n:=14;
    o:=9;
    p:=10;
    q:=18;
    for r:=1 to 32 do
    begin
    a1:=b+r;
    if a1>32 then a1:=a1-32;
    b1:=c+r;
    if b1>32 then b1:=b1-32;
    c1:=d+r;
    if c1>32 then c1:=c1-32;
    d1:=e+r;
    if d1>32 then d1:=d1-32;
    e1:=f+r;
    if e1>32 then e1:=e1-32;
    f1:=g+r;
    if f1>32 then f1:=f1-32;
    g1:=h+r;
    if g1>32 then g1:=g1-32;
    h1:=i+r;
    if h1>32 then h1:=h1-32;
    i1:=j+r;
    if i1>32 then i1:=i1-32;
    j1:=k+r;
    if j1>32 then j1:=j1-32;
    k1:=l+r;
    if k1>32 then k1:=k1-32;
    l1:=n+r;
    if l1>32 then l1:=l1-32;
    m1:=m+r;
    if m1>32 then m1:=m1-32;
    n1:=o+r;
    if n1>32 then n1:=n1-32;
    o1:=p+r;
    if o1>32 then o1:=o1-32;
    p1:=q+r;
    if p1>32 then p1:=p1-32;
    writeln(a[a1],a[b1],a[c1],a[d1],a[e1],a[f1],a[g1],'  ',a[h1],a[i1],a[j1],a[k1],a[l1],a[m1],a[n1],a[o1],a[p1]);
    end;
    readln;
    CLRSCR
    end.

    Парниша пытался написать шифр Цезаря... :)

    Vendetta, 08 Апреля 2012

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

    +75

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    boolean retval = serviceCategory.equalsIgnoreCase("transportation");
    if (retval) {
        String serviceLocation = bp.getParameterValueObjectFromAnyComponent("ReqTDQuestions", "svcLocation") + "";
        if(serviceLocation.equalsIgnoreCase("GreaterChina")) {
            retval=true;
         }
    }
    return retval;

    После деобфускации получаем:
    return serviceCategory.equalsIgnoreCase("transp ortation");

    zloizerg, 27 Марта 2012

    Комментарии (4)
  6. Java / Говнокод #9628

    +75

    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
    for (i = 0; i < pArgs.length; ++i) {
        if (!(pArgs[i].equalsIgnoreCase("-startable"))) {
            continue;
        }
        // ... обработка
        return true;
    }
    
    for (i = 0; i < pArgs.length; ++i) {
        if (!(pArgs[i].equalsIgnoreCase("-isRunning"))) {
            continue;
        }
        // ... обработка
        return true;
    }
    
    for (i = 0; i < pArgs.length; ++i) {
        if (!(pArgs[i].equalsIgnoreCase("-shutdown"))) {
            continue;
        }
        // ... обработка
        return true;
    }

    из main()а жаба аппликухи. и еще три таких цикла для еще трех параметров коммандной строки.

    любимая тонкость (которая сюда не попала): на ошибки коммандной строки бросается IndexOutOfBoundsException.

    ЗЫ а че в жабе нет штатного парсера коммандной строки? как-то загадочно. хотя если задуматся и вспомнить что писали жабу юниксоиды, которые сами тридцать лет толковго штатного парсера коммандной строки сделать не могли, то становится в какой-то степени даже логично.

    Dummy00001, 08 Марта 2012

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

    +75

    1. 1
    2. 2
    StringBuilder append = new StringBuilder();
    ...

    redenemy, 03 Января 2012

    Комментарии (29)
  8. Java / Говнокод #8721

    +75

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if(false || DEBUG)
        {
          System.out.print("analysis: "+Integer.toBinaryString(analysis));
          System.out.println(", "+WalkerFactory.getAnalysisString(analysis));
        }

    Вычурный способ делать комментарии. Пример может и боян, но зато где: в исходниках API Android 2.2 Froyo.

    google-moogle, 04 Декабря 2011

    Комментарии (35)
  9. Java / Говнокод #8710

    +75

    1. 1
    2. 2
    3. 3
    if(getFillColor().length() > 0){
    		/***/
    	}

    проверка на инициализацию переменной

    JJunior, 02 Декабря 2011

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

    +75

    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
    // Gets the starting position for the endtag of the first element in text.
        private int getEndTagPosition(String element, String text) {
            String startTag = "<" + element;
            String endTag = "</" + element;
            int nestingLevel = 1;
            int end = 0;
            int startPos = 1;
    
            while (nestingLevel > 0) { // loop until matching endtag is found
                int start = text.indexOf(startTag, startPos);
                end = text.indexOf(endTag, startPos);
    
                if ((start == -1) || (start > end)) {   // next tag is an endtag
                    nestingLevel--;
                    startPos = end + 1;
                } else {    // next tag is a starttag
                    nestingLevel++;
                    startPos = start + 1;
                }
            }
    
            return end;
        }

    euee, 03 Ноября 2011

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

    +75

    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
    private Connection getConnection() throws SQLException {
    		Connection conn = null;
    		try{
    			conn = DriverManager.getConnection(OnlineUsers.db,OnlineUsers.user,OnlineUsers.pass);
    		} catch (Exception e) {
    			log.severe(name + ": " + e.getMessage());
    		}
    		checkConnection(conn);
    		return conn;
    	}
    	
    	private boolean checkConnection (Connection conn) throws SQLException {
    		if (conn == null) {
    				log.severe("Could not connect to the database. Check your credentials in online-users.settings");
    			throw new SQLException();
    		}
    		if (!conn.isValid(5)) {
            	log.severe("Could not connect to the database.");
            	throw new SQLException();
            }
    		return true;
    	}
    	
    	private boolean execute(String sql) {
    		return execute(sql, null);
    	}
    	
    	private boolean execute(String sql, String player) {
    		Connection conn = null;
            PreparedStatement ps = null;
            try {
            	conn = getConnection();
            	ps = conn.prepareStatement(sql);
            	if (player != null && !player.equalsIgnoreCase("")) {
            		ps.setString(1, player);
            	}
            	
            	if (ps.execute()) {
            		return true;
            	}
            } catch (SQLException ex) {
            	log.severe(name + ": " + ex.getMessage());
            	String msg = name + ": could not execute the sql \"" + sql + "\"";
            	if (player != null ) {
            		msg += "    ?=" +player;
            	}
            	log.severe(msg);
            } finally {
                try {
                    if (ps != null) {
                        ps.close();
                    }
                    if (conn != null) {
                        conn.close();
                    }
                } catch (SQLException ex) {
                	log.severe(name + ": " + ex.getMessage());
                }
            }
            return false;
    	}

    Мартин, 02 Ноября 2011

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