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

    +68

    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
    <span class="realty_price"><?php echo $ad['price']?>
                        <?php if(! empty($ad['addinfo']['unit'])): ?>
                          <?php echo $ad['addinfo']['unit']['value'] ?>
                          <?php
                          unset($ad['addinfo']['unit']);
                          else:
                          ?>
                          <?php
    					  // Говнокод
    					  if($ad['addinfo']['type_service']['value'] == 'аренда'):
    					  ?>
                          руб.мес.
                          <?php else: ?>
                          тыс.руб.
                          <?php endif; ?>
                        <?php endif; ?>
                      </span>

    Хороший человек, искренний...

    nethak, 12 Мая 2012

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

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    <tr>
                     <td valign="top" align="center"> <?=($image = $gallery->setId($line['id'])->getImaget("s")) ? "<a href='news/$line[id]'><img src='$image[src]' alt='$line[name]' width='50' title='$line[name]' style='float: left; border: 0px; margin-right: 10px;'></a>" : ""?></td>
                     <td valign="top"><a href="<?=$line['link'];?>"><?=$line['name'];?></a><br /><?=$line['announce'];?></td>
                  </tr>

    Скопировал как нашел

    kindofbear, 12 Мая 2012

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

    +69

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    //JAVA
    request.setAttribute("sexForRegi", person.getSex().getLogicConstant());
    //А теперь и JSTL: 
    <c:choose>
       <c:when test="${sexForRegi == 'MALE'}">
          <div class="sys-icon-128x128 icon-128x128-RegEndMan"></div>
       </c:when>
       <c:when test="${sexForRegi == 'FEMALE'}">
          <div class="sys-icon-128x128 icon-128x128-RegEndWoman"></div>
       </c:when>                  
    </c:choose>

    Sex - это у меня сущность, которая определяет половую принадлежность.
    Regi - Action, отвечающий за регистрацию.
    Вот и назвал переменную, чтобы определять какую картинку выводить "sexForRegi".
    Вдумавшись, такое название наталкивает на мнение, что регистрация возможна только через секс =)

    Dvelopp, 12 Мая 2012

    Комментарии (18)
  4. C# / Говнокод #10251

    +97

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    namespace Interface.module1
    {  class Sort_text
        { private string[] str;
            public Sort_text(string[] astr)
            { if (astr.Length == 0)
                {   str = new String[1];
                    str[0] = "";
                }
                else
                {   str = new String[astr.Length];
                    str = astr; }
    
            }
            public string[] Str
            {   get { return str; }
                set { this.str = value; }
            }
            public void sort_poslovno_pryamoi()
            {   string ss = "";
                List<string> t = new List<string>();
                for (int i = 0; i < Str.Count(); i++)
                    for (int j = 0; j < Str[i].Length; j++)
                    {  if (Str[i][j] == ' ')
                        { if (ss == "")
                                continue;
                            t.Add(ss);
                            ss = "";
                        }
                        else
                        {   ss = ss + Str[i][j];
                            if (j + 1 == Str[i].Length && ss != "")
                            {   t.Add(ss);
                                ss = ""; }
                        }
                    }
                t.Sort();
                Str = t.ToArray();
            }
            public void sort_poslovno_obratnyi()
            {   string ss = "";
                List<string> t = new List<string>();
                for (int i = 0; i < Str.Count(); i++)
                    for (int j = 0; j < Str[i].Length; j++)
                    { if (Str[i][j] == ' ')
                        {   if (ss == "")
                                continue;
                            t.Add(ss);
                            ss = ""; }
                        else
                        {   ss = ss + Str[i][j];
                            if (j + 1 == Str[i].Length && ss != "")
                            {   t.Add(ss);
                                ss = "";  }
                        }
                    }
                t.Sort();
                t.Reverse();
                Str = t.ToArray();
            }
            public void sort_postrochno_pryamoi()
            {   string ss = "";
                List<string> t = new List<string>();
                for (int i = 0; i < Str.Count(); i++)
                { t.Add(Str[i]);
                }
                t.Sort();
                Str = t.ToArray();
            }
            public void sort_postrochno_obratnyi()
            {   string ss = "";
                List<string> t = new List<string>();
                for (int i = 0; i < Str.Count(); i++)
                { t.Add(Str[i]);
                }
                t.Sort();
                t.Reverse();
                Str = t.ToArray();
            }
    
        }
        class Sort_bin
        {   private byte[] b;
            public Sort_bin(byte[] ab)
            {  b = ab; }
            public byte[] B
            {   get { return b; }
                set { this.b = value; }
            }
            public void sort_bin_pryamoi()
            {   List<byte> t = new List<byte>(B.ToList());
                t.Sort();
                B = t.ToArray();
            }
            public void sort_bin_obratnyi()
            {   List<byte> t = new List<byte>(B.ToList());
                t.Sort();
                t.Reverse();
                B = t.ToArray();  }
        }
    }

    legati, 12 Мая 2012

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

    +69

    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
    if(isset($_POST['submit'])){
    				$cat = $_POST['cat'];
    				
    				/** Определяем переменную дириктории */
    				if($cat == 1) :
    				$uploaddir = '../uploads/poli/'; 
    				elseif($cat == 2) : $uploaddir = '../uploads/site/';
    				elseif($cat == 3) : $uploaddir = '../uploads/style/';
    				elseif($cat == 4) : $uploaddir = '../uploads/illustration/';
    				endif;
    				
    				$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
    				$file_name = $_FILES['userfile']['name'];
    				$desc = trim(htmlspecialchars($_POST['desc']));
    				$position = $_POST['pos'];
    				
    				if (!file_exists($uploadfile)){
    					/** Перемещаем фаил из временной дириктории в папку uploads */
    					if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    						/** НИКашерное обрезание  да бля стыдно ,но конец рабочего дня в голову не чего не лезит */
    						$uploadfile = substr($uploadfile,3);
    						$result = $db->INSERT('pfolio',array('img','description','cat','position'),array($uploadfile,$desc,$cat,$position));
    						if($result) : echo '<h2 style="color:green;"> Фаил успешно загружен </h2> <a href="admin.php?am=mod[portfolio]&add">Назад</a>'; else: echo 'Не удачно'; endif;
    					} else {
    						echo "Возможная атака с помощью файловой загрузки!\n";
    					}
    				}else{
    					echo '<h2 style="color:red;"> Фаил с таким именем уже сущевствует !</h2> <br /> <p style="text-decoration:underline; color : red; cursor:pointer;" onClick="history.back()">Назад</a>';
    				}

    НИкашерно обрезал

    ilussion, 12 Мая 2012

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

    −26

    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
    Apply_Deferred_Lighting_Template< LIGHT_STAGE, ELightType::Light_Point >(
     context, queue,
     lightsArray + lightOffsets[ LIGHT_STAGE, ELightType::Light_Point ],
     lightCounts[LIGHT_STAGE][ELightType::Light_Point]
    );
    
    Apply_Deferred_Lighting_Template< LIGHT_STAGE, ELightType::Light_Point >(
     context, queue,
     lightsArray + lightOffsets[ LIGHT_STAGE, ELightType::Light_Spot ],
     lightCounts[LIGHT_STAGE][ELightType::Light_Spot]
    );
    
    Apply_Deferred_Lighting_Template< LIGHT_STAGE, ELightType::Light_Beam >(
     context, queue,
     lightsArray + lightOffsets[ LIGHT_STAGE, ELightType::Light_Beam],
     lightCounts[LIGHT_STAGE][ELightType::Light_Beam]
    );

    Здесь больше:

    http://www.gamedev.ru/code/forum/?id=162116

    HaskellGovno, 11 Мая 2012

    Комментарии (15)
  7. Куча / Говнокод #10247

    +123

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    import Data.Array.IO
    main = do arr <- newArray (1,10) 37 :: IO (IOArray Int Int)
              a <- readArray arr 1
              writeArray arr 1 64
              b <- readArray arr 1
              print (a, b)

    Вот такое вот говно приходится терпеть, если хочешь работать в хаскеле с массивами. Дальше будет только нос закрывай. To be continued...

    HaskellGovno, 11 Мая 2012

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

    +72

    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
    final String sqlString=
    					" select distinct 1 "+
    					" , c_rep.card_id as rep_id "+
    					" , av_rep_xml.long_binary_value as rep_xml "+
    					" , av_sname_nm.string_value as name "+
    					" , av_c_date.date_value as date \n"+
    					" from	card c_res \n"+
    					" 	join 	attribute_value av_res_rep on (av_res_rep.card_id = c_res.card_id and av_res_rep.attribute_code = 'JBR_RIMP_REPORT') \n"+
    					" 	join	attribute_value av_res_exec on (av_res_exec.card_id = c_res.card_id and av_res_exec.attribute_code = 'JBR_INFD_EXEC_LINK') \n"+
    					" 	join 	card c_rep on (c_rep.card_id = av_res_rep.number_value ) \n"+
    					" 	left outer join attribute_value av_rep_xml on (av_rep_xml.card_id = c_rep.card_id and av_rep_xml.attribute_code = 'ADMIN_702354') \n"+
    					" 	left outer join attribute_value av_c_date on (av_c_date.card_id = c_rep.card_id and av_c_date.attribute_code = 'CREATED') \n"+
    					" 	left outer join	attribute_value av_rep_exec on (av_rep_exec.card_id = c_rep.card_id and av_rep_exec.attribute_code ='ADMIN_702335') \n"+
    					" 	left outer join	person person_card on (person_card.person_id=av_rep_exec.number_value) \n"+
    					" 	left outer join attribute_value av_sname_nm on (av_sname_nm.card_id = person_card.card_id and av_sname_nm.attribute_code = 'JBR_PERS_SNAME_NM') \n"+
    					" 	left outer join attribute_value av_on_control on ( av_on_control.attribute_code = 'JBR_TCON_ONCONT' and av_on_control.card_id = c_res.card_id) \n"+
    					" where	c_res.card_id = " + sResId+ "\n"+
    					" 	and av_res_exec.number_value = av_rep_exec.number_value \n"+
    					" 	and av_on_control.value_id=1449 \n"+
    					" 	and c_res.status_id in (103, 206) \n"+
    
    					// UNION
    					" UNION select 51 \n"+
    					" , c_rep.card_id as rep_id \n"+
    					" , av_rep_xml.long_binary_value as rep_xml \n"+
    					" , av_sname_nm.string_value as name \n"+
    					" , av_c_date.date_value as date \n"+
    					" from card c_prnt \n"+
    					" 	left outer join attribute_value av_res on ( av_res.attribute_code = 'JBR_IMPL_RESOLUT' and av_res.card_id = c_prnt.card_id) "+
    					" 	left outer join card c_res on (c_res.card_id=av_res.number_value)"+
    					" 	join 	attribute_value av_res_rep on (av_res_rep.card_id = c_res.card_id and av_res_rep.attribute_code = 'JBR_RIMP_REPORT') "+
    					" 	join	attribute_value av_res_exec on (av_res_exec.card_id = c_res.card_id and av_res_exec.attribute_code = 'JBR_INFD_EXEC_LINK') "+
    					" 	join 	card c_rep on (c_rep.card_id = av_res_rep.number_value ) "+
    					" 	left outer join attribute_value av_rep_xml on (av_rep_xml.card_id = c_rep.card_id and av_rep_xml.attribute_code = 'ADMIN_702354') "+
    					" 	left outer join attribute_value av_c_date on (av_c_date.card_id = c_rep.card_id and av_c_date.attribute_code = 'CREATED') "+
    					" 	left outer join	attribute_value av_rep_exec on (av_rep_exec.card_id = c_rep.card_id and av_rep_exec.attribute_code = 'ADMIN_702335') "+
    					" 	left outer join	person person_card on (person_card.person_id=av_rep_exec.number_value) "+
    					" 	left outer join attribute_value av_sname_nm on (av_sname_nm.card_id = person_card.card_id and av_sname_nm.attribute_code = 'JBR_PERS_SNAME_NM') "+
    					" 	left outer join attribute_value av_on_control on ( av_on_control.attribute_code = 'JBR_TCON_ONCONT' and av_on_control.card_id = c_res.card_id)  "+
    					" where "+
    					" 	c_prnt.card_id = "+ sResId+ "\n"+
    					" 	and c_prnt.template_id <> 324 \n"+
    					" 	and av_res_exec.number_value = av_rep_exec.number_value \n"+
    					" 	and av_on_control.value_id=1449 \n"+
    					" 	and c_res.status_id in (103, 206) \n"+
    	
    .... и еще 8 UNION, куча строчек в том же стиле и с тем же смыслом

    Формирование SQL запроса в методе, который возвращает строковое представление хода исполнения поручения (кто сделал, что сделал, когда и в какой последовательности). Сам метод, если кому интересно дергается из Jasper report.

    Мало того, что запросик имеет длину 250 строк кода (большая часть которых копи/паст с небольшими изменениями), так он ещё и возвращает полную ахинею вместо того что нужно. Чего хотел сказать автор - теперь уже не узнать...

    amberLord, 11 Мая 2012

    Комментарии (12)
  9. C# / Говнокод #10245

    +105

    1. 1
    2. 2
    var hour = Convert.ToInt32(DateTime.Now.ToString("HH"));
    var min = Convert.ToInt32(DateTime.Now.ToString("mm"));

    А вам слабо?
    Автор через день напоминает всем, что у него больше 5 лет опыта программирования на C#.)))))

    MegaZver, 11 Мая 2012

    Комментарии (10)
  10. C# / Говнокод #10244

    +96

    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
    List<LocalBusiness> sortedLocalBusinesses = new List<LocalBusiness>();
    foreach (LocalBusiness business in foundLocalBusinesses)
    {
    	if (!business.Logo.UrlSmall.Equals("/images/local_business_default_logo.png"))
    	{
    		sortedLocalBusinesses.Add(business);
    	}
    }
    foreach (LocalBusiness business in foundLocalBusinesses)
    {
    	if (business.Logo.UrlSmall.Equals("/images/local_business_default_logo.png"))
    	{
    		sortedLocalBusinesses.Add(business);
    	}
    }

    Сортировка - первыми должны быть объекты с не дефолтными картинками.

    mastermindCsharp, 11 Мая 2012

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