1. PHP / Говнокод #2642

    +168.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    for ($i=0; $i<count($t__); $i++)
    {
    	$i++;
    	fnc_pars($t__[($i-1)], $pr_i2[($i-1)]);
    	$i= $i-1;
    }

    Прогон по массиву )))

    pasha, 19 Февраля 2010

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

    +73.6

    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
    private void applyFilter(Article article, List<Article> allArticles, RSSFilter filter) {
    
            if (filter != null) {
    
                if ((filter.isAnd()) && (filter.isContent()) && (filter.isTitle())) {
                    if (article.getTitle().toLowerCase().contains(filter.getFilter().toLowerCase())
                            && (article.getContent().toLowerCase().contains(filter.getFilter()
                                    .toLowerCase()))) {
                        allArticles.add(article);
                    }
                }
                if (filter.getFilter() == null || filter.getFilter().isEmpty()) {
                    allArticles.add(article);
                } else if ((filter.isAnd()) && (!filter.isContent()) && (filter.isTitle())) {
                    if (article.getTitle().toLowerCase().contains(filter.getFilter().toLowerCase())) {
                        allArticles.add(article);
                    }
                } else if ((filter.isAnd()) && (filter.isContent()) && (!filter.isTitle())) {
                    if (article.getContent().toLowerCase().contains(filter.getFilter().toLowerCase())) {
                        allArticles.add(article);
                    }
                } else if ((!filter.isAnd() && !filter.isContent()) && (filter.isTitle())) {
                    if (article.getTitle().toLowerCase().contains(filter.getFilter().toLowerCase()))
                        allArticles.add(article);
                } else if ((!filter.isAnd()) && (!filter.isTitle()) && (filter.isContent())) {
                    if (article.getContent().toLowerCase().contains(filter.getFilter().toLowerCase()))
                        allArticles.add(article);
                } else if (!filter.isAnd()) {
                    if (article.getTitle().toLowerCase().contains(filter.getFilter().toLowerCase())
                            || (article.getContent().toLowerCase().contains(filter.getFilter()
                                    .toLowerCase()))) {
                        allArticles.add(article);
                    }
                }
    
            } else {
                allArticles.add(article);
            }
        }

    стыдно, млин у себя нашел)))
    реализация фильтра
    взаимоисключение, нереальные условия (UI на радиобатонах)

    fisherman, 19 Февраля 2010

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

    +65.7

    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
    template <class T>
    struct SLinkedListNode
    {
    public:
    	SLinkedListNode* m_pPrev;  ///<  Pointer to previous node.
    	SLinkedListNode* m_pNext;  ///<  Pointer to next node.
    	int Initialize();
    	int Finalize();
    };
    ...
    struct SWaiterNode : public SLinkedListNode<SContainerNode>, public SLinkedListNode<SWaiterListNode>
    {
    ...
    // container node
    struct SContainerNode
    {
    	// no members needed yet (just for masking SLinkedListNode type)
    };
    
    // container
    struct SContainer
    {
    public:
    	SLinkedListNode<SContainerNode>* m_pObjects;

    сначала делаем тимплейтный класс, параметр которого никому не нужен, а потом делаем заглушку для этого параметра.
    нормально.

    kubrinsky, 19 Февраля 2010

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

    +166.3

    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
    <?php
    
    if (($_COOKIE["prava"]==1)or($_COOKIE["prava"]==2))
    {
    $lstclient[]=mysql_query("select * from lstclient ");
    $lstclient[]=mysql_query("select * from lstclient ");
    $lstclient[]=mysql_query("select * from lstclient ");
    $lstclient[]=mysql_query("select * from lstclient ");
    $lstcou[]=mysql_query("select * from lstcou ");
    $lstcou[]=mysql_query("select * from lstcou ");
    $lstcou[]=mysql_query("select * from lstcou ");
    $lstcou[]=mysql_query("select * from lstcou ");
    $lstcou[]=mysql_query("select * from lstcou ");
    /* ... и так еще два десятк строк ... */
          echo'<tr><td>Страны</td><td>';
          while($mas=mysql_fetch_row($countcou)){$counter=$mas[0];}
          while($maslnk=mysql_fetch_row($lnkcou)){$coulnk[]=$maslnk[0];}
          for ($i=1; $i<6; $i++)
          { 
          	echo' <select name="cou'.$i.'"><option value="0"> </option>';
          	while($mas=mysql_fetch_row($lstcou[$i-1]))
          	{
              if ($i>$counter)
              {
            	echo '<option value="'.$mas[0].'">'.$mas[1].'</option>';
              }
              else
              {
            	if ($coulnk[$i-1]<>$mas[0]){echo '<option value="'.$mas[0].'">'.$mas[1].'</option>';}
            	else {echo '<option selected value="'.$mas[0].'">'.$mas[1].'</option>';}
              }
            }
            echo'</select>';
          }	  
      echo'
        </td>
      </tr>
    ';

    И подобного альтернативно-одаренного творчества там 150Кб (простейший CRUD, с одной таблицей)

    turdman, 19 Февраля 2010

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

    +149.1

    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
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
    <head>
    <?php 
    	$menu = & JSite::getMenu();
    	$flag = ($menu->getActive() == $menu->getDefault()); 
    	$option = JRequest::getVar('option', null); 
    ?>
    <jdoc:include type="head" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
    <link rel="stylesheet" href="templates/<?php echo $this->template ?>/css/template.css" type="text/css" />
    <!--[if lte IE 7]>
    <script language="JavaScript" type="text/javascript" src="?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/DD_belatedPNG.js"></script>
    <script language="JavaScript" type="text/javascript">
    DD_belatedPNG.fix('.icon a, .phone, .menu a, .header '); 
    </script>
    <![endif]-->
    </head>
    
    <body >
    	<div class="wrapper">
    		<div class="header">
    			<ul class="icon">
    				<li class="<?php  if ($flag)  {?>active<?php }?>"><a href="#" class="home"><span></span></a></li>
    				<li><a href="#" class="sitemap"><span></span></a></li>
    				<li><a href="#" class="search"><span></span></a></li>
    			</ul>
    			<h3 class="phone">
    				Тел. 8 (044) 561 66 22
    			</h3>
    			<div class="menu-wrap">
    				<jdoc:include type="modules" name="menu" style="none" />
    			</div>
    			<div class="why">
    				<h1>Преимущества работы с нами</h1>
    				<ul>
    					<li>1) Умеренные цены</li>
    					<li>2) Использование высококлассных материалов</li>
    					<li>3) Кротчайшие сроки выполнение работ</li>
    					<li>4) Лучший спектр услуг в городе</li>
    					<li>5) Гаранатия до 3х лет</li>
    				</ul>
    			</div>
    		</div>
    		<div class="content">
    		<?php  if ($flag)  {?>
    			<div class="scroller">
    				<h3>Наши работы</h3>
    				<div class="scroll">
    					<div class="scroll-visible">
    						<ul>
    							<jdoc:include type="modules" name="slider" style="none" />
    						</ul>
    					</div>
    					<a href="#" class="scroll-right"></a>
    					<a href="#" class="scroll-left"></a>
    				</div>
    			</div>
    			<div class="text-module">
    					<jdoc:include type="modules" name="main-text" style="none" />
    			</div>
    		<?php }else{?>
    			<jdoc:include type="component" />
    		<?php }?>
    		</div>
    		<div class="bottom-modules">
    			<div class="bottom-modules-item item-left"><jdoc:include type="modules" name="user1" style="xhtml" /></div>
    			<div class="bottom-modules-item item-right"><jdoc:include type="modules" name="user3" style="xhtml" /></div>
    			<div class="bottom-modules-item item-center"><jdoc:include type="modules" name="user2" style="xhtml" /></div>
    		</div>
    		<div class="footer-space"></div>
    	</div>
    	<div class="footer">
    		<span class="copyright">
    			© 2009<br />
    			Все права защищены
    		</span>
    		<span class="design"></span>
    	</div>
    </body>
    </html>

    Areks, 19 Февраля 2010

    Комментарии (9)
  6. Си / Говнокод #2637

    +99.4

    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
    #include <iostream>
    
    int *sfirst_function(void);
    int *isecond_function(void);
    
    int * sfirst_function(void)
    {
    	int ilocal_to_first=11;
    	return &ilocal_to_first; // Возвращаем указатель на переменную, размещенную в стеке
    } 
    
    int *isecond_function(void)
    {
    	int ilocal_to_second=44;
    	return &ilocal_to_second; // ну и тут
    }
    void main()
    {
    	int *pi=sfirst_function();
    	printf("First Function = %d\n",*pi);
    	int *si= isecond_function();
    	printf("Second Function = %d\n",*si);
    }

    Найдено на античате, в топике "помощь с лабораторными"
    В этом конкретном примере, конечно, допустим возврат адреса локальной переменной, а вот в более крупном проекте автор столкнулся бы с нефиговой проблемой =)

    RankoR, 18 Февраля 2010

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

    +145.4

    1. 1
    ViewState["Action"] = result.client == "merchantName" ? false : true;

    nettrash, 18 Февраля 2010

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

    +159.3

    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
    var res_html = "";
      for (var i = 0; i < title_section.length; i++)
      {
      	if (title_section[i].id == sel) {
        res_html += '<div class="'+prefix+'section_title" onmouseover="section_sel(this,\''+ prefix +'\')" onmouseout="section_unsel(this,\''+ prefix +'\')"' +
    										'onclick="section_choise(this,'+'\''+url+'\'' + ')"' +
    										'id='+'"'+title_section[i].id+'" '	
    										+'style='+'"font-weight: bold"'+'>'+
    										'<span class="'+ prefix +'dashed_anchor">' + title_section[i].name + '</span>&nbsp;';
       // res_html += '(' + number_section[i] + ')';
        res_html += '</div>';
    	}
    	else{
    		res_html += '<div class="'+prefix+'section_title" onmouseover="section_sel(this,\''+ prefix +'\')" onmouseout="section_unsel(this,\''+ prefix +'\')"' +
    										'onclick="section_choise(this,'+'\''+url+'\'' + ')"' +
    										'id='+'"'+title_section[i].id+'" '	
    										+'>'+
    										'<span class="'+ prefix +'dashed_anchor">' + title_section[i].name + '</span>&nbsp;';
       // res_html += '(' + number_section[i] + ')';
        res_html += '</div>';
    	}
    	}
      
      document.getElementById(prefix + "sections").innerHTML += res_html;
      document.getElementById(prefix + "sections").innerHTML += '<a href='+'"?id=all"'+'><div class="'+prefix+'all_sections"><img src="media/img/01/arrow.jpg" alt=""/>' +
            '<span style="color:black">Все разделы</span>&nbsp;</div></a>';
    
      document.getElementById(prefix + "column_sections").style.width = (max_length + 7) + "ex";
    /*  document.getElementById(prefix + "green_sector").style.height = (document.getElementById(prefix + "column_other").offsetHeight - 14) + "px";*/
    }

    Яваскрипт от местного умельца:)

    HollyGeek, 18 Февраля 2010

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

    +167.8

    1. 1
    date_in.date_ >= '".date("Y")."-".date("m")."-".date("d")."'

    кусок SQL запроса...

    Torch13, 18 Февраля 2010

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

    +151.5

    1. 1
    @$go = (string)$_HTTP_REQUEST_VARS['go'];

    Private Detective, 18 Февраля 2010

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