1. Objective C / Говнокод #10290

    −1065

    1. 1
    @property (nonatomic, retain) NSString *totalCount;

    Чуть глаза от такого не лопнули

    QuickNick, 16 Мая 2012

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

    −19

    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
    TElement* get(void)
    {
    	TElement* result = this->allocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement; //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->deallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };
    
    template<class TArg1>
    TElement* get(TArg1 arg1)
    {
    	TElement* result = this->allocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement(arg1); //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->deallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };
    
    //...
    
    template<class TArg1, class TArg2, class TArg3, class TArg4, class TArg5, class TArg6>
    TElement* get(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6)
    {
    	TElement* result = this->AllocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement(arg1, arg2, arg3, arg4, arg5, arg6); //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->DeallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };

    Хотя этот баян мы уже видели на Action Script.

    Говногость, 16 Мая 2012

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

    +91

    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
    private void changeTabItem(object parameter)
            {
                if (SelectedTabIndex == SelectedTabIndexOld) return;
                if (SelectedTabIndex != 0)
                {
                    if ([надо сохранить])
                    {
                        if ([попытка сохранить удалась]) SelectedTabIndexOld = SelectedTabIndex;
                        else SelectedTabIndex = 0;
                    }
                    else SelectedTabIndexOld = SelectedTabIndex;
    
                    if (SelectedTabIndex == 1)
                        [обновить древо]
    
                }
                else if (SelectedTabIndex != 1)
                {
                    if ([надо сохранить])
                    {
                        if ([попытка сохранить удалась]) SelectedTabIndexOld = SelectedTabIndex;
                        else SelectedTabIndex = 1;
                    }
                    else SelectedTabIndexOld = SelectedTabIndex;
                    if (SelectedTabIndex == 0)
                        [обновить древо]
                }
            }

    Раскопки продолжаются. Теперь Вашему вниманию предлагается "женское" переключение вкладок, работающее "от противного". В данном случае две вкладки, а теперь представим что надо добавить ещё пару. =)

    DukeGonzo, 16 Мая 2012

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

    −22

    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
    class TFunctorMap
    	{
    	public:
    		typedef bool (*TFunctor)(const TSentenceList&, unsigned short &);
    	private:
    		std::map<char, TFunctor> _functorMap;
    	public:
    		TFunctorMap(void)
    		{
    			_functorMap.insert(std::make_pair('g', &RZC));
    			_functorMap.insert(std::make_pair('t', &STN));
    			_functorMap.insert(std::make_pair('d', &RTC));
    		}
    		TFunctor GetFunctor(const char Key)
    		{
    			if (_functorMap.find(Key) == _functorMap.end())
    				return NULL;
    			return _functorMap[Key];
    		}
    	};

    Говногость, 16 Мая 2012

    Комментарии (16)
  5. C++ / Говнокод #10286

    −24

    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
    template <bool ValueToLock>
    	class TBoolLocker
    	{
    	private:
    		bool _lockedValue;
    	public:
    		TBoolLocker(void) : _lockedValue(!ValueToLock) {}
    		TBoolLocker(const TBoolLocker & Copy) : _lockedValue(Copy._lockedValue) {}
    		const TBoolLocker & operator=(const TBoolLocker & Copy)
    		{
    			_lockedValue = Copy._lockedValue;
    			return *this;
    		}
    		bool update(const bool NewValue)
    		{
    			if (_lockedValue != ValueToLock)
    				_lockedValue = NewValue;
    			return _lockedValue;
    		}
    	};

    Говногость, 16 Мая 2012

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

    +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
    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
    83. 83
    84. 84
    85. 85
    86. 86
    /* Данные пользователя*/
    $fio=$_POST['fio'];
    $sex=$_POST['sex'];
    $sdate=$_POST['sdate'];
    $city=$_POST['city'];
    $age=$_POST['age'];
    $hage=$_POST['hage'];
    $cage=$_POST['cage'];
    $page=$_POST['page'];
    $stime=$_POST['stime'];
    $ip=$_POST['ip'];
    /* Вопросы*/
    $a1=$_POST['a1'];
    $a1b1=$_POST['1a1'];
    $a1b2=$_POST['1a2'];
    $a1b3=$_POST['1a3'];
    $a1b4=$_POST['1a4'];
    $com1=$_POST['com1'];
    $a2=$_POST['a2'];
    $a2b1=$_POST['2a1'];
    $a2b2=$_POST['2a2'];
    $com2=$_POST['com2'];
    $a3=$_POST['a3'];
    $b1a1=$_POST['b1a1'];
    $b1a2=$_POST['b1a2'];
    $b1a3=$_POST['b1a3'];
    $a4=$_POST['a4'];
    $a3b1=$_POST['3a1'];
    $a3b2=$_POST['3a2'];
    $a3b3=$_POST['3a3'];
    $a3b4=$_POST['3a4'];
    $a3b5=$_POST['3a5'];
    $a3b6=$_POST['3a6'];
    $a3b7=$_POST['3a7'];
    $a3b8=$_POST['3a8'];
    $a3b9=$_POST['3a9'];
    $a3b10=$_POST['3a10'];
    $com3=$_POST['com3'];
    $a5=$_POST['a5'];
    $b2a1=$_POST['b2a1'];
    $b2a2=$_POST['b2a2'];
    $b2a3=$_POST['b2a3'];
    $a6=$_POST['a6'];
    $a4b1=$_POST['4a1'];
    $a4b2=$_POST['4a2'];
    $a4b3=$_POST['4a3'];
    $a4b4=$_POST['4a4'];
    $a4b5=$_POST['4a5'];
    $a4b6=$_POST['4a6'];
    $a4b7=$_POST['4a7'];
    $com4=$_POST['com4'];
    $a7=$_POST['a7'];
    $b3a1=$_POST['b3a1'];
    $b3a2=$_POST['b3a2'];
    $b3a3=$_POST['b3a3'];
    $a8=$_POST['a8'];
    $a5b1=$_POST['5a1'];
    $a5b2=$_POST['5a2'];
    $a5b3=$_POST['5a3'];
    $a5b4=$_POST['5a4'];
    $a5b5=$_POST['5a5'];
    $a5b6=$_POST['5a6'];
    $a5b7=$_POST['5a7'];
    $a5b8=$_POST['5a8'];
    $a5b9=$_POST['5a9'];
    $a5b10=$_POST['5a10'];
    $a5b11=$_POST['5a11'];
    $com5=$_POST['com5'];
    $a9=$_POST['a9'];
    $a6b1=$_POST['6a1'];
    $a6b2=$_POST['6a2'];
    $a6b3=$_POST['6a3'];
    $a6b4=$_POST['6a4'];
    $a6b5=$_POST['6a5'];
    $a6b6=$_POST['6a6'];
    $a6b7=$_POST['6a7'];
    $a6b8=$_POST['6a8'];
    $com6=$_POST['com6'];
    
    echo "<CENTER>";
    echo "Привет, ".$_POST['fio'];
    echo "<BR><BR>";
    echo "Спасибо за ваш интерес.<BR><BR>";
    
    
    ....

    нашли в прокте вот такое извращение :)

    olegpro, 16 Мая 2012

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

    +66

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    catch (com.google.gwt.event.shared.UmbrellaException ex) {
    					Iterator<Throwable> it = ex.getCauses().iterator();
    					while (it.hasNext()) {
    						Throwable msg = it.next();
    						System.out.println(msg.getStackTrace());
    					}

    обрабатываем exception......

    sermolaev, 16 Мая 2012

    Комментарии (6)
  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 / Говнокод #10282

    +78

    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
    private function isRussianCar($car){
    
                               # Определялка российских машин.
    
                                if ($car['make_id'] == '107') return true;
                                if ($car['make_id'] == '108') return true;
    		if ($car['make_id'] == '109') return true;
    		if ($car['make_id'] == '110') return true;
    		if ($car['make_id'] == '111') return true;
    		if ($car['make_id'] == '112') return true;
    		if ($car['make_id'] == '113') return true;
    		if ($car['make_id'] == '114') return true;
    		if ($car['make_id'] == '115') return true;
    		if ($car['make_id'] == '116') return true;
    		if ($car['make_id'] == '117') return true;
    		return false;
    	
        }

    Нашёл в одном из проектов

    daemon_master, 15 Мая 2012

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

    +71

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $template_archive_footer = stripslashes(get_option('poll_template_pollarchivefooter'));
    		$template_archive_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_TOTALVOTES%", number_format_i18n($polls_question['totalvotes']), $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_TOTALVOTERS%", number_format_i18n($polls_question['totalvoters']), $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_MOST_ANSWER%", $poll_most_answer, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_MOST_VOTES%", number_format_i18n($poll_most_votes), $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_MOST_PERCENTAGE%", $poll_most_percentage, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_LEAST_ANSWER%", $poll_least_answer, $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_LEAST_VOTES%", number_format_i18n($poll_least_votes), $template_archive_footer);
    		$template_archive_footer = str_replace("%POLL_LEAST_PERCENTAGE%", $poll_least_percentage, $template_archive_footer);

    wp-polls. пиздец.

    TBoolean, 15 Мая 2012

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