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

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

    +70

    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
    public static class TrollException extends RuntimeException {
            @Override
            public String getMessage() {
                throw new TrollException();
            }
    
            @Override
            public String getLocalizedMessage() {
                throw new TrollException();
            }
    
            @Override
            public Throwable getCause() {
                throw new TrollException();
            }
    
            @Override
            public synchronized Throwable initCause(Throwable cause) {
                throw new TrollException();
            }
    
            @Override
            public String toString() {
                throw new TrollException();
            }
    
            @Override
            public void printStackTrace() {
                throw new TrollException();
            }
    
            @Override
            public void printStackTrace(PrintStream s) {
                throw new TrollException();
            }
    
            @Override
            public void printStackTrace(PrintWriter s) {
                throw new TrollException();
            }
    
            @Override
            public synchronized Throwable fillInStackTrace() {
                throw new TrollException();
            }
    
            @Override
            public StackTraceElement[] getStackTrace() {
                throw new TrollException();
            }
    
            @Override
            public void setStackTrace(StackTraceElement[] stackTrace) {
                throw new TrollException();
            }
        }

    kadavrrr, 06 Августа 2012

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

    +70

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    } catch (CacheException e) {
    	e.printStackTrace();
    } catch (Exception e) {
    	e.printStackTrace();
    }

    Привет из Индии

    dzagy, 06 Августа 2012

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

    +70

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (s.startsWith("job."))
    {
        s = s.trim().replaceFirst("job\\.", "");
        String name = s.split("\\.")[0];
        String paramName = s.split("\\.")[1];
        // Ещё немного говнокода, не сильно интересного
    }

    konsoletyper, 12 Июля 2012

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

    +70

    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
    public boolean getOrgType() throws SIRException {
            int type = StoredProcedures.getOrgType(getOrgId());
            boolean result = true;
            try {
                if (type == 3 || type == 4) {
                    result = false;
                }
                return result;
            } catch (NumberFormatException e) {
                log.error(e.getMessage(), e);
                throw new SIRException(e.getMessage(), "Ошибка кода организации");
            } catch (Exception e) {
                log.error(e.getMessage(), e);
                throw new SIRException(e.getMessage(), "Ошибка кода организации");
            }
        }

    stalv, 15 Июня 2012

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

    +70

    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
    function navigationblock() {
    	$lettersarr=array();
    
    function _strtolower($string)
    {
        $small = array('а','б','в','г','д','е','ё','ж','з','и','й',
                       'к','л','м','н','о','п','р','с','т','у','ф',
                       'х','ч','ц','ш','щ','э','ю','я','ы','ъ','ь',
                       'э', 'ю', 'я');
        $large = array('А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й',
                       'К','Л','М','Н','О','П','Р','С','Т','У','Ф',
                       'Х','Ч','Ц','Ш','Щ','Э','Ю','Я','Ы','Ъ','Ь',
                       'Э', 'Ю', 'Я');
        return str_replace($large, $small, $string); 
    }
     
    function _strtoupper($string)
    {
        $small = array('а','б','в','г','д','е','ё','ж','з','и','й',
                       'к','л','м','н','о','п','р','с','т','у','ф',
                       'х','ч','ц','ш','щ','э','ю','я','ы','ъ','ь',
                       'э', 'ю', 'я');
        $large = array('А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й',
                       'К','Л','М','Н','О','П','Р','С','Т','У','Ф',
                       'Х','Ч','Ц','Ш','Щ','Э','Ю','Я','Ы','Ъ','Ь',
                       'Э', 'Ю', 'Я');
        return str_replace($small, $large, $string); 
    }
    
    	$rs=mysql_query("SELECT DISTINCT firstletter FROM mr_gazette WHERE firstletter!=' ' AND parent=0 ORDER BY firstletter");
    	while($one=mysql_fetch_array($rs)) $lettersarr[]=$one["firstletter"];
    	?><form name=findform action='index.php' method=get style="margin:10px 20px 20px 0px; text-align:right; ">
    		<font style='font:bold 8pt Tahoma;'><? 
    		for ($i=0; $i<count($lettersarr);$i++) {
    			?><a href="index.php?&letter=<?=$lettersarr[$i]?>" style='font:bold 8pt Tahoma; text-transform:uppercase;'><?=_strtolower($lettersarr[$i])?></a><img src="img/null.gif" width=5><?
    		}
    		?></font>
    		<input type=hidden name="act" value="search">
    		<input type=text name=searchval class=frmtextsub>&nbsp;&nbsp;<input type=submit value='найти' class=mybutton style="width:50px; height:18px;">
    	</form><?
    	return $lettersarr;
    }

    T_T

    форматирование сохранено

    psycho-coder, 07 Июня 2012

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

    +70

    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
    <? // файл data/conf/config.php
    $user = array (
    "0" => array("administrator", "bita98"),
    "1" => array("ml.administrator", "select11"),
    "2" => array("moderator", "argument19")
    );
    ?>
    
    <? // Другой файл, для смены пароля
    $pass = $_POST["pass"];
    $new_pass = $_POST["new_pass"];
    
    $files = file('data/conf/config.php');
    foreach ($files as $key=>$value)
    {
    $files[$key]=str_replace($pass, $new_pass, $value);
    }
    
    $f = fopen("data/conf/config.php","w+");
    foreach ($files as $keys=>$values)
    {
    fwrite($f,$values);
    }
    fclose($f);
    
    echo "<h2>Пароль " . $pass . " пользователя " . $_SESSION["username"] . ", был изменен на " . $new_pass . "</h2>";
    
    $_SESSION['password'] = null;
    $_SESSION['password'] = $new_pass;
    ?>

    Вот как нужно редактировать массивы в исходниках!
    cbr-admin.v2.1.7

    alex322, 02 Июня 2012

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

    +70

    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
    if(rightTable.isCellPresent(0, 0))
    					for(int i = 0; i < rightTable.getRowCount(); i++)
    						if(((CheckBox)((HorizontalPanel)rightTable.getWidget(i, 0)).getWidget(0)).getValue())
    						{	isChanged = true;
    							
    							leftTableList.add(currentTemplate.getColumns().get(i));
    							for(int j = 0; j < resultTable.getCellCount(0); j++)
    									if(((Label)((HorizontalPanel)resultTable.getWidget(0, j)).getWidget(1)).getText().compareTo(new Integer(currentTemplate.getColumns().get(i).getOrder()).toString()) == 0)
    										resultTable.removeCell(0, j);
    							
    							System.out.println(resultTable.getCellCount(0));
    							
    							rightTable.removeRow(i);
    							currentTemplate.getColumns().remove(i);
    							i--;
    						}

    sermolaev, 16 Мая 2012

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

    +70

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/compare.tpl')) {
    	$this->template = $this->config->get('config_template') . '/template/product/compare.tpl';
    } else {
    	$this->template = 'default/template/product/compare.tpl';
    }

    Спешите видеть в конце каждого контроллера OpenCart. Ох уж это MVC ради MVC...

    telnet, 08 Мая 2012

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

    +70

    1. 1
    if (sAttrName.equalsIgnoreCase("10")) {

    someone, 23 Апреля 2012

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

    +70

    1. 1
    2. 2
    3. 3
    class GGPoint extends Object {
    
    }

    Вспомнилась первая работа с китайцами, где юзали их базовую часть, надстройку над gwt, так вот приходилось такое встречать. Думаю этого достаточно=)

    youngkoss, 16 Марта 2012

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