1. SQL / Говнокод #5930

    −860

    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
    SELECT i.id AS i__id, i.title AS i__title, i.description AS i__description, i.meta_title AS i__meta_title, i.meta_keywords AS i__meta_keywords, i.meta_description AS i__meta_description, i.lang AS i__lang FROM item_translation i WHERE (i.id IN ('8845'))
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Акция' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Акция' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Розница' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Оптом' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Безнал' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Дилер' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'Кредит' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT p.id AS p__id, p.item_id AS p__item_id, p.type AS p__type, p.currency AS p__currency, p.value AS p__value, p.date AS p__date FROM price p WHERE (p.item_id = '8845' AND p.type = 'A') ORDER BY p.date DESC LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'В корзину' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection
    #
    
    SELECT t.id AS t__id, t.source AS t__source, t.target AS t__target, t.lang AS t__lang FROM translation t WHERE (t.source = 'В корзину' AND t.lang = 'ru') LIMIT 1
    0.00s, "doctrine" connection

    Это часть запросов которые выполняются для генерации главной страницы для одного интернет магазина. И таких запросов: 360 :-)

    aleksey, 09 Марта 2011

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

    +146

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                                    <td id="menu"><a id="1" href="javascript:void(0);">Link 1</a></td>
                                    <td id="menu"><a id="2" href="javascript:void(0);">Link 2</a></td>
                                    <td id="menu"><a id="3" href="javascript:void(0);">Link 3</a></td>
                    </tr>                
    </table>

    ну вкладки html тут нет

    nepster, 09 Марта 2011

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

    −117

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Если пФорма<>1 Тогда
    	СтрокаСФ="№";
    Иначе
    	СтрокаСФ="№";
    КонецЕсли;

    Загадочное условие в печатной форме ветеринарного свидетельства :)

    CYFiVE, 09 Марта 2011

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

    +137

    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
    program c2;
    const n=30;
    var
    a: array [1..n] of integer;
    i,x,y: integer;
    s: real;
    begin
    x:=0;
    y:=0;
    for i:=1 to n do
    begin
    a[i]:= random(10);    { !! число 10 !! }
    writeln(a[i]);
    if(a[i]>20) then          { !!!! }
    begin
    x:=x+a[i];
    y:=y+1;
    end;
    end;
    s:=x/y;
    writeln;
    writeln(s);
    readln;
    end.

    Обнаружил в ЕГЭ по информатике, задание «повышенного» уровня сложности. Надо найти ср. арифм. среди элементов массива, которые больше 20.
    В книжке с задачами имелись ответы и заглянув туда я заметил этот говнокод. Вы только приглядитесь внимательней ведь массив заполняется рандомом до 10, а цикле программы проверяем элементы, которые больше 20. Такая программа в принципе работать не будет :)

    stalkersev, 08 Марта 2011

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

    +72

    1. 1
    Object key = (Object) (iterator.next());

    alt, 08 Марта 2011

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

    +32

    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
    if (!empty($forum_actions))
    {
    
    ?>
    <div class="linksb">
    	<div class="inbox crumbsplus">
    		<p class="subscribelink clearb"><?php echo implode(' - ', $forum_actions); ?></p>
    	</div>
    </div>
    <?php
    
    }
    
    ?>
    <div id="brdstats" class="block">
    	<h2><span><?php echo $lang_index['Board info'] ?></span></h2>
    	<div class="box">
    		<div class="inbox">
    			<dl class="conr">
    				<dt><strong><?php echo $lang_index['Board stats'] ?></strong></dt>
    				<dd><span><?php printf($lang_index['No of users'], '<strong>'.forum_number_format($stats['total_users']).'</strong>') ?></span></dd>
    				<dd><span><?php printf($lang_index['No of topics'], '<strong>'.forum_number_format($stats['total_topics']).'</strong>') ?></span></dd>
    				<dd><span><?php printf($lang_index['No of posts'], '<strong>'.forum_number_format($stats['total_posts']).'</strong>') ?></span></dd>
    			</dl>
    			<dl class="conl">
    				<dt><strong><?php echo $lang_index['User info'] ?></strong></dt>
    				<dd><span><?php printf($lang_index['Newest user'], $stats['newest_user']) ?></span></dd>
    <?php
    
    if ($pun_config['o_users_online'] == '1')
    {
    	// Fetch users online info and generate strings for output
    	$num_guests = 0;
    	$users = array();
    	$result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
    
    	while ($pun_user_online = $db->fetch_assoc($result))
    	{
    		if ($pun_user_online['user_id'] > 1)
    		{
    			if ($pun_user['g_view_users'] == '1')
    				$users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>';
    			else
    				$users[] = "\n\t\t\t\t".'<dd>'.pun_htmlspecialchars($pun_user_online['ident']);
    		}
    		else
    			++$num_guests;
    	}

    главная страница форумного движка fluxbb
    moar тут по сцылке https://github.com/fluxbb/fluxbb/blob/fluxbb-1.4/index.php

    Блядь... зато скока у них там этого самого прекрасно пафоса про секурность и прочие ништяки.

    Имхо пора на написание опенсорсного говнокода давать лицензию сродни водительским правам

    brainstorm, 08 Марта 2011

    Комментарии (21)
  7. C++ / Говнокод #5924

    +162

    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
    void Exf2dMW::closeEvent(QCloseEvent* event)
    {
      int win_num = _winManager->numberOfModellingWindows();
      // if more than one modelling windows, just destroy current one:
      if (win_num > 1) {
        event->accept();
        delete this;
      }
      // if only one window and handle closing model properly, then destroy it:
      else {
        if( handleCloseModel() ) {
          event->accept();
          delete this;
          delete _winManager;
        }
        else
          event->ignore();
      }
    }

    Еще кусочек говнокода коллеги, я не думал что так можно писать..

    kitaec, 08 Марта 2011

    Комментарии (32)
  8. Си / Говнокод #5923

    +109

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    while(1) {
        :cycle
        goto cycleCode;
    }
    
    // ...
    
    :cycleCode
    //код
    goto cycle;

    danilissimus, 08 Марта 2011

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

    +175

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    //из какого то мануала
    
    Switch($_POST['ingame'])
    {
          case $_POST['ingame']:{
          //тут какая то ебень
         }
    
    }

    Судя по всему - мануал реально удался.. и там в скобках реально какая то ебень!

    Aios, 08 Марта 2011

    Комментарии (20)
  10. PHP / Говнокод #5921

    +168

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if ($_POST['role'] == 's')
    {
    			
    }   
    elseif ($_POST['role'] == 't')
    {
    			
    } 
    else echo "Попытка наебать";

    Интересная заглушка ;)

    daemon_master, 08 Марта 2011

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