1. Лучший говнокод

    В номинации:
    За время:
  2. Куча / Говнокод #9103

    +121

    1. 1
    2. 2
    3. 3
    ibox.com.ua/
    
    ibox.com.ua/index.php

    Решил тут найти почитать что можно пополнить через терминал ibox. Там флешка и закрыть ее я не нашел где... ну ради прикола на index.php ринулся.
    На сервере установлен PHP версии 5.1.6, однако для WordPress 3.3.1 требуется хотя бы 5.2.4.
    Ну вот скажите разве такая прибыльная компания не может себе нормальный сайт заказать?

    LmSys, 12 Января 2012

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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    final List<OrderSpecifier<?>> orderBy = ImmutableList.<OrderSpecifier<?>>of(
    		// Whoa! Sorting by four columns. We really are insane.
    		q.urgent.desc(),
    		q.queued.desc(),
    		q.receiver.asc(),
    		q.created.desc());

    Заказчик попросил.

    someone, 12 Декабря 2011

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

    +121

    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
    // Getting first account data and binding it to control
                    List<string> cardList = new List<string>();
                    List<string> permissionList = new List<string>();
                    string x1 = "";
                    string x2 = "";
                    string x3 = "";
                    string x4 = "";
                    string x6 = "";
                    string x7 = "";
                    string x8 = "";
                    try
                    {
                        x8 = getCardNumberByAccountNumber(CustAcc1.Text);
                    }
                    catch { }
                    GetAllCustomerAccountValue(de_ca1, ref x1, ref x2, ref x3, ref x4, ref cardList, ref permissionList, ref x6, ref x7, ref x8); //, ref x2, ref x3, ref x4, ref cardList, ref x5, ref x6, ref x7, ref x8);
                    FormCustomerAccount1.accountNum = x1;
                    FormCustomerAccount1.fullName = x2;
                    FormCustomerAccount1.streetBuild = x3;
                    FormCustomerAccount1.postalCode = x4;
                    FormCustomerAccount1.creditNote = x6;
                    FormCustomerAccount1.accountBalance = x7;
                    FormCustomerAccount1.cards = cardList;
                    FormCustomerAccount1.permissions = permissionList;

    (

    ellk, 08 Декабря 2011

    Комментарии (1)
  5. Куча / Говнокод #8647

    +121

    1. 1
    DELPHP

                                                           PHI

    TarasGovno, 25 Ноября 2011

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

    +121

    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
    private void txtModel_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (getTag() == 3)
                {
                    if (e.KeyChar != 8 && (e.KeyChar < 97 || e.KeyChar > 122) && (e.KeyChar < 65 || e.KeyChar > 90) && e.KeyChar < 192 && e.KeyChar != 37 && e.KeyChar != 63 && e.KeyChar != 42 && e.KeyChar != 91 && (e.KeyChar < 93 || e.KeyChar > 95) && e.KeyChar != 94 && e.KeyChar != 33)
                    { e.Handled = true; }
                }
                else
                {
                    if (e.KeyChar != 8 && (e.KeyChar < 97 || e.KeyChar > 122) && (e.KeyChar < 65 || e.KeyChar > 90) && e.KeyChar < 192)
                    {
                        e.Handled = true;
                    }
                }
            }

    Очередной говнокод: проверка на ввод в текстовом поле, проверяется если форма вызвана для поиска, то допускаются символы шаблона, если нет, то только буквы в любом регистре, и так далее по всем полям формы проверяется

    MrFeathers, 21 Ноября 2011

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

    +121

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    // This is de facto a Map<Integer, Long> because SUM() returns longs, but
    // QueryDSL's type inference makes a fluke here and thinks sum() is an Integer.
    // So the return type is Map<Integer, Integer>. Aren't generics fun?
    final Map<Integer, ? extends Number> map =
    		dsl.from(q).where(q.department.eq(params.getDepartment()), q.quantity.ne(0),
    		q.action.in(UserAction.ORDER_ENGRAVE, UserAction.ORDER_STOCK_WASTAGE,
    				UserAction.ORDER_INVOICE, UserAction.ORDER_STOCK_ADJUSTMENT),
    		QueryDsl.subFrom(q2).where(q2.order.eq(q.order), q2.timestamp.goe(interval.getA()),
    				q2.timestamp.lt(interval.getB()),
    				q2.action.in(UserAction.ORDER_ENGRAVE, UserAction.ORDER_STOCK_WASTAGE,
    						UserAction.ORDER_INVOICE, UserAction.ORDER_STOCK_ADJUSTMENT)).exists())
    	.groupBy(q.order.id).having(q.quantity.sum().gt(0)).map(q.order.id, q.quantity.sum());

    someone, 15 Ноября 2011

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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public class MainSetting
      {
        // ...
        public void Load(out MainSetting objectToDeserialise) {...}
        // ...
      }

    Использвоание: _mainSetting.Load(out _mainSetting);

    ziaw, 15 Ноября 2011

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

    +121

    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
    private void textBox1_TextChanged(object sender, EventArgs e)
    {
    	if ((textBox1.Text + textBox2.Text).Length + 1 > 255)
    	{
    		textBox1.BackColor = Color.LightPink;
    		textBox2.BackColor = Color.LightPink;
    	}
    	else
    	{
    		textBox1.BackColor = Color.White;
    		textBox2.BackColor = Color.White;
    	}
    
    	if ((textBox3.Text + textBox6.Text).Length + 1 > 255)
    	{
    		textBox3.BackColor = Color.LightPink;
    		textBox6.BackColor = Color.LightPink;
    	}
    	else
    	{
    		textBox3.BackColor = Color.White;
    		textBox6.BackColor = Color.White;
    	}
    }
    
    private void bntSave_Click(object sender, EventArgs e)
    {
    	if (textBox1.BackColor == Color.LightPink)
    	{
    		MessageBox.Show("Длинна полей От и Адрес в сумме не должна превышать 255");
    		return;
    	}
    	if (textBox3.BackColor == Color.LightPink)
    	{
    		MessageBox.Show("Длинна полей Кому и Адрес в сумме не должна превышать 255");
    		return;
    	}
    
    	Properties.Settings.Default.Save();
    	Navigator.Navigate(new ConfigMenuPage());
    }

    ТЗ: "Суммарная длина полей X и Y не должна превышать 255 символов"
    Решение шедеврально как по вычислению длинны суммы строк, так и по цветовой идентификации :)

    ddv_demon, 10 Ноября 2011

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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $ df -k /
    /                      (/dev/vgroot/lvol3     ) :  2083856 total allocated Kb
                                                       1701112 free allocated Kb
                                                        382744 used allocated Kb
                                                            18 % allocation used

    HP-UX. вывод df (disk free) тулзы. почти все тратят минут пять на чтение вывода, пытаясь понять смысл "free allocated" и ту тонкую разницу которая отличает это выражение от "used allocated".

    Dummy00001, 19 Октября 2011

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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    ворд генерирует.......
    
    @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2;
    
    ... понос??? WTF????

    Понос :)

    deep, 03 Октября 2011

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