1. C++ / Говнокод #5514

    +162

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    vector<int> vi;
      vector<bool> vi_index;
      const unsigned unicode_size=0x10FFF;
      vi.resize (unicode_size+1);
      vi_index.resize (unicode_size+1);
      for (int fa=0;fa<vi.size();fa++) 
        vi[fa]=0;
      
      for (int fa=0;fa<vi.size();fa++) 
        vi_index[fa]=false;

    Человек не умеет инициализировать вектор. Ну, и пр.

    panter_dsd, 03 Февраля 2011

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

    +156

    1. 1
    2. 2
    3. 3
    4. 4
    $q = "SELECT tax_rate FROM #__{vm}_tax_rate WHERE tax_country='$country'\n";
    if( !empty($state)) {
    $q .= "AND (tax_state='$state' OR tax_state=' $state ' OR tax_state='-')";
    }

    Странное формирование запроса при загрузке налога по стране и конкретному региону...

    kolibri, 03 Февраля 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (!isset($caseMenu['child']))	{
    		$catsArr['list'][$caseMenu['parent']]['status'] = "active";				
    	}else{
    		$catsArr['list'][$caseMenu['parent']]['children']['list'][0]['status'] = "active";	
    	}

    помоему это охуенно

    warider, 03 Февраля 2011

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

    +146

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    static void WriteToFile()
    {
    StreamWriter SW;
    SW=File.CreateText("c:\\MyTextFile.txt");
    SW.WriteLine("God is greatest of them all");
    SW.WriteLine("This is second line");
    SW.Close();
    Console.WriteLine("File Created SucacessFully");
    }

    SucacessFully, что здесь непонятного!)
    А строки 3 и 4 стоило написать в одну строчку сразу.
    Источник: http://www.csharphelp.com/2005/12/simple-text-file-operations-in-c/

    RaZeR, 03 Февраля 2011

    Комментарии (7)
  5. JavaScript / Говнокод #5510

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if($('#month1').attr('value') == 2 || 
    	$('#month2').attr('value') == 2){
    		if($('#day1').attr('value') > 29 || 
    			$('#day2').attr('value') > 29){
    			alert('Неправильная дата');
    			return 0;
    		}
    	}

    Проверка двух дат на 30 февраля.

    regex, 03 Февраля 2011

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

    +131

    1. 1
    DateTime dt = DateTime.Parse(DateTime.Now.ToString("dd.MM.yyyy"));

    Вот такие гении встречаются в нашей местности....

    Buzurud, 03 Февраля 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    static string GetRequestParam(string request)
            {
                string result="";
                int i = 4;
                for(char c=request[i];c!=' ';c=request[++i])
                    result+=c;
                return result;
            }

    Говногость, 03 Февраля 2011

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    String^ TDebug::GetCurrentThreadFunctionName(int CallFunctionIndex)
    {
    	return (gcnew StackTrace(true))->GetFrame(CallFunctionIndex)->GetMethod()->ToString();
    };
    
    void TDebug::ShowCurrentFunctionName(void)
    {
    	Windows::Forms::MessageBox::Show(GetCurrentThreadFunctionName(2));
    };

    Помоему, в Microsoft Visual Studio 2010 отладчик для С++\CLI давно есть. :)

    Говногость, 03 Февраля 2011

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

    +116

    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
    namespace Containers
    {
        public class TBinaryWaitingQueue<TItem> where TItem : struct
        {
            private readonly TBinaryQueue<TItem> _queue;
            TBinaryWaitingQueue(int amountOfitem)
            {
                _queue = new TBinaryQueue<TItem>(amountOfitem);
            }
    
            public void Enqueue(TItem[] items)
            {
                throw new NotImplementedException();
            }
    
            public void Enqueue(TItem[] items, int beginItem, int amountOfItem)
            {
                throw new NotImplementedException();
            }
    
            public void Dequeue(TItem[] items, int beginItem, int amountOfItem)
            {
                throw new NotImplementedException();
            }
    
            public TItem[] Dequeue(int amountOfItem)
            {
                throw new NotImplementedException();
            }
        }
    }

    Досталось в наследство от предков. Этому коду уже года 4.

    Говногость, 03 Февраля 2011

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

    +118

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public class TWriteableForEach
    	{
    		public delegate void TForEachDelegate<TItem>(TItem item);
    
    		public static void Exec<TItem>(IList<TItem> itemsCollection, TForEachDelegate<TItem> forEachDelegate)
    		{
    			for (int i = 0; i < itemsCollection.Count(); ++i)
    				forEachDelegate(itemsCollection[i]);
    		}
    	} ;

    Велосипед с квадратными колёсами?

    Говногость, 03 Февраля 2011

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