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

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

    −117

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    SELECT *
    FROM table1
    WHERE
    COALESCE(
      field1,
      field2,
      field3,
      field4,
      field5,
      fieldN,  
      "lol"
    )!="lol"

    huitka, 24 Января 2012

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

    +74

    1. 1
    String.format("USR-БГПУ", new Object[] { new SimpleDateFormat("dd MMMM yyyy", new Locale("ru", "RU")) })

    Нашёл в самолично написанной утильке (из серии блиц-[говно]кодинга). Думал.

    0rt, 19 Января 2012

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

    +81

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public void getApplicationContext(ApplicationContext applicationContext ) {
        applicationContext.setUserId(currentUserService.getCurrentUser().getName());
        applicationContext.setTransactionType(transactionType);
        applicationContext.setApplication(applicationName);
        applicationContext.setSubSystem(subSystemName);
        applicationContext.setAddress(ipAddress);
        applicationContext.setCorrelationId(correlationIDGenerator.getRandomGUID());
    }

    *facepalm*

    roman-kashitsyn, 12 Января 2012

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

    +171

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $date_day = date("d");
    $date_month = date("m");
    $date_year = date("Y");
    $date_time = date("H:i");
    $date_cont = " " . $date_day . "-" . $date_month . "-" . $date_year . " " . $date_time;

    Вот так мы получаем дату строкой :)
    Впоследствии используется только $date_cont.

    andymitrich, 12 Января 2012

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

    +164

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    private function _arrayToString($array)
        {
            $count = count($array);
            $str = '';
            for ($i = 0; $i < $count; $i++) {
                $str .= $array[$i] . ',';
            }
            $str = substr($str, 0, strlen($str) - 1);
            return $str;
        }

    implode ?? не, не слышал!

    sqrt, 11 Января 2012

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

    +88

    1. 1
    LinkedHashMap<Long, Map<String, Map<Long, List<Long>>>> propertyTemplates;

    bozho, 09 Января 2012

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    $curdate=gmdate("Y.m.d H:i:s");
    if(DateDayDiff($curdate,"2008.01.01")==0)$hny = true; else $hny = false;
    if(DateDayDiff($curdate,"2008.04.01")==0)$fd = true; else $fd = false;
    if((DateDayDiff($curdate,"2008.05.09")>=-1) && (DateDayDiff($curdate,"2008.05.09")<=1)) $nine_mai = true; else $nine_mai = false;

    Оригинальная проверка "а-сегодня-ли-девятое-мая?" на форуме Elemental Games.

    ru_maniac, 09 Января 2012

    Комментарии (8)
  9. JavaScript / Говнокод #9003

    +163

    1. 1
    d = d ? d.push({ajax: true}) : {ajax: true};

    Похоже, что программист отметил весело новый год

    Sulik78, 08 Января 2012

    Комментарии (8)
  10. Pascal / Говнокод #8903

    +98

    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
    if RadioGroup1.ItemIndex=0   then cpr:=cpr+1;
    if RadioGroup1.ItemIndex=1   then cth:=cth+1;
    if RadioGroup2.ItemIndex=0   then cch:=cch+1;
    if RadioGroup2.ItemIndex=1  then czs:=czs+1;
    if RadioGroup3.ItemIndex=0   then chd:=chd+1;
    if RadioGroup3.ItemIndex=1  then cpr:=cpr+1;
    if RadioGroup4.ItemIndex=0   then  cth:=cth+1;
    if RadioGroup4.ItemIndex=1  then cch:=cch+1;
    if RadioGroup5.ItemIndex=0   then czs:=czs+1;
    if RadioGroup5.ItemIndex=1  then chd:=chd+1;
    if RadioGroup6.ItemIndex=0   then cpr:=cpr+1;
    if RadioGroup6.ItemIndex=1  then cch:=cch+1;
    if RadioGroup7.ItemIndex=0   then chd:=chd+1;
    if RadioGroup7.ItemIndex=1  then cth:=cth+1;
    ....// Это всё в 60 строк
    if (cpr>cth) and (cpr>cch) and (cpr>czs) and (cpr>chd) then cpr1:=+1
    else
    if (cth>cpr) and (cth>cch) and (cth>czs) and (cth>chd) then cth1:=+1
    else
    if (cch>cpr) and (cch>cth) and (cch>czs) and (cch>chd) then cch1:=+1
    else
    if (czs>cpr) and (czs>cch) and (czs>cth) and (czs>chd) then czs1:=+1
    else
    if (chd>cpr) and (chd>cch) and (chd>czs) and (chd>cth) then chd1:=+1;
    
    if cpr>chd or czs or cth or cch     then
    begin
    ShowMessage('человек-природа – все профессии, связанные с растениеводством, животноводством и лесным хозяйством;')   ;
    Datamodule4.ADOTable1.Edit;
    Datamodule4.ADOTable1.FieldValues['test2']:=('человек-природа – все профессии, связанные с растениеводством, животноводством и лесным хозяйством;');
    Datamodule4.ADOTable1.Post;
    end
    else
    if chd>cpr or cth or cch or czs   then   begin
    ShowMessage('человек-техника – все технические профессии;')   ;
    Datamodule4.ADOTable1.Edit;
    Datamodule4.ADOTable1.FieldValues['test2']:=('человек-техника – все технические профессии;');
    Datamodule4.ADOTable1.Post;
    ...... И далее результаты в общем их 5
    отдельная кнопка для вывода остальных 10 вопросов х)
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    Radiogroup11.Visible:=true;
    Radiogroup12.Visible:=true;
    Radiogroup13.Visible:=true;
    Radiogroup14.Visible:=true;
    Radiogroup15.Visible:=true;
    Radiogroup16.Visible:=true;
    Radiogroup17.Visible:=true;
    Radiogroup18.Visible:=true;
    Radiogroup19.Visible:=true;
    Radiogroup20.Visible:=true;
    Button2.Visible:=True;
    end;

    Программа тестирования на профориентацию
    хД сколько он radiogroup создал)

    Ryuko, 05 Января 2012

    Комментарии (8)
  11. PHP / Говнокод #8864

    +156

    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
    <?php
    	if(!isset($legal_include)) { header("HTTP/1.0 404 Not Found"); die(); }
    	
    	if(!isset($_POST['login']) OR !isset($_POST['password']) OR !isset($_POST['password_retype'])) {
    		text(gic('tpl/register_form.html'));
    	} else {
    		$_POST = postget();
    		$error = array();
    		if(strlen($_POST['login']) < 4 OR empty($_POST['login'])) {
    			array_push($error, 'len_login');
    		} else {
    			if(preg_match('/^[a-z0-9]+$/', $_POST['login'])) {
    				if(check_avalaibility($_POST['login']) != true) {
    					array_push($error, 'login_used');
    				}
    			} else {
    				array_push($error, 'inc_login');
    			}
    		}
    			
    		if(strlen($_POST['password']) < 4 OR empty($_POST['password'])) {
    			array_push($error, 'len_passwd');
    		} else {
    			if($_POST['password'] != $_POST['password_retype']) {
    				array_push($error, 'inc_passwds');
    			}
    		}
    		
    		if(count($error) > 0) {
    			$fields = array('inc_login' => language($_SESSION['lang'], 'inc_login'), 
    			'len_login' => language($_SESSION['lang'], 'len_login'),
    			'len_passwd' => language($_SESSION['lang'], 'len_passwd'),
    			'login_used' => language($_SESSION['lang'], 'login_used'),
    			'inc_passwds' => language($_SESSION['lang'], 'inc_passwds'));
    			$text = language($_SESSION['lang'], 'have_errs').'<ul>';
    			foreach($error as $value) {
    				$text .= '<li>'.$fields[$value].'</li>';
    			}
    			$text .= '</ul>';
    			error($text, 'text');
    			sendback('?register');
    		} else {
    			$SQL = 'INSERT INTO `'.pr.'users` (`login`, `password`, `levels`) VALUES (\''.$_POST['login'].'\', \''.md5($_POST['password']).'\', 1)';
    			mysql_query($SQL);
    			$_SESSION['logined'] = true;
    			$_SESSION['levels'] = 1;
    			$_SESSION['name'] = $_POST['login'];
    		}
    	}
    	
    	function check_avalaibility($username) {
    		$SQL = 'SELECT `login` FROM `'.pr.'users` WHERE `login` = \''.$username.'\'';
    		$result = mysql_query($SQL);
    		if(mysql_num_rows($result) > 0) {
    			return false;
    		} else {
    			return true;
    		}
    	}
    ?>

    why so serious?

    afr0xED, 18 Декабря 2011

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