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

    В номинации:
    За время:
  2. Java / Говнокод #6360

    +74

    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
    public static final int TYPE_A_OK = 0;
    public static final int TYPE_R_OPEN = 1;
    public static final int TYPE_R_STOPSID = 2;
    public static final int TYPE_A_STOPSID = 3;
    //....
    public static final int TYPE_R_ALARM = 26;
    HashMap<String, Integer> typesMap = new HashMap<String, Integer>();
    
    //в конструкторе
    
    public Data() {
    typesMap.put("A_OK", TYPE_A_OK);
    typesMap.put("R_OPEN", TYPE_R_OPEN);
    typesMap.put("R_STOPSID", TYPE_R_STOPSID);
    //...
    typesMap.put("R_ALARM", TYPE_R_ALARM);
    //...
    }
    
    
    //в одном из методов
    
    public boolean processPacket(Packet pack) {
    //...
    StringTokenizer strt = new StringTokenizer(body, "\n");
    		try {
    			id = strt.nextToken();
    			sign = strt.nextToken();
    			type = typesMap.get(strt.nextToken());
    			try {
    				commBody = strt.nextToken();
    			} catch (Exception e) {
    				// System.out.println("ERR: " + id + "; " + sign + "; " + type
    				// + "; ");
    			}
    		} catch (Exception e) {
    			System.err.println(sdf.format(Calendar.getInstance().getTime()) +"packet parsing error");
    			outBody += "A_ERR\n" + e.getMessage();
    		}
    
    switch (type) {
    		case TYPE_A_OK:
    			dontsend = true;
    			break;
    		case TYPE_R_OPEN:
    			outBody = processROpen(comm);
    			break;
    		case TYPE_R_CLOSE:
    			outBody = processRClose(comm);
    			break;
    //...
    case TYPE_R_ALARM:
    			outBody = processRAlarm(comm);
    			break;
    default:
    			outBody += "A_ERR";
    			break;
    }
    //...
    if(debug)
    System.err.println(outBody);
    //...
    return true;
    }

    ява она такая. Вот так. Вынужденно-китайский код. Не умеет свич со строками работать... и не хочется с хэшем заморачиваться. А скоро типов будет больше...

    ark, 14 Апреля 2011

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

    +134

    1. 1
    2. 2
    <span id="chap">490</span>
    <img src="ch.php" style="margin-left:-5px;"> 23  </div>

    Вебкилловская капча. Это круто.
    В действии: http://webkill.ru/news/index.php?id=1
    Кстати, дизайн нравится, видно, что парень рисовать умеет.

    7ion, 13 Апреля 2011

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

    −154

    1. 1
    <img src="http://img199.imageshack.us/img199/5446/65715023.jpg" alt="">

    без комментариев))

    cdpoma, 13 Апреля 2011

    Комментарии (11)
  5. Си / Говнокод #6306

    +136

    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
    [...]
    	switch (dssdev->type) {
    #ifdef CONFIG_OMAP2_DSS_DPI
    	case OMAP_DISPLAY_TYPE_DPI:
    #endif
    #ifdef CONFIG_OMAP2_DSS_RFBI
    	case OMAP_DISPLAY_TYPE_DBI:
    #endif
    #ifdef CONFIG_OMAP2_DSS_SDI
    	case OMAP_DISPLAY_TYPE_SDI:
    #endif
    #ifdef CONFIG_OMAP2_DSS_DSI
    	case OMAP_DISPLAY_TYPE_DSI:
    #endif
    #ifdef CONFIG_OMAP2_DSS_VENC
    	case OMAP_DISPLAY_TYPE_VENC:
    #endif
    #ifdef CONFIG_OMAP2_DSS_HDMI
    	case OMAP_DISPLAY_TYPE_HDMI:
    #endif
    		break;
    	default:
    		DSSERR("Support for display '%s' not compiled in.\n",
    				dssdev->name);
    		return;
    	}
    
    	switch (dssdev->type) {
    #ifdef CONFIG_OMAP2_DSS_DPI
    	case OMAP_DISPLAY_TYPE_DPI:
    		r = dpi_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_RFBI
    	case OMAP_DISPLAY_TYPE_DBI:
    		r = rfbi_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_VENC
    	case OMAP_DISPLAY_TYPE_VENC:
    		r = venc_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_SDI
    	case OMAP_DISPLAY_TYPE_SDI:
    		r = sdi_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_DSI
    	case OMAP_DISPLAY_TYPE_DSI:
    		r = dsi_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_HDMI
    	case OMAP_DISPLAY_TYPE_HDMI:
    		r = hdmi_init_display(dssdev);
    		break;
    #endif
    	default:
    		BUG();
    	}
    
    	if (r) {
    		DSSERR("failed to init display %s\n", dssdev->name);
    		return;
    	}
    
    [...]

    linux kernel..
    Драйвер контроллера дисплея (drivers/video/omap2/dss/display.c).
    Про кошмар из #ifndef-ов молчу, но к чему первый switch?

    grub670, 11 Апреля 2011

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

    +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
    // Установка обработкчиков событий
                tbTitle.TextChanged += (x, y) => _target.Title = tbTitle.Text;
                cbContractorType.SelectedIndexChanged += (x, y) => _target.ContractorType = cbContractorType.SelectedIndex;
                tbFullTitle.TextChanged += (x, y) => _target.Title = tbFullTitle.Text;
                tbINN.TextChanged += (x, y) => _target.INN = tbINN.Text;
                // Для физ. лица
                dtpBirthDate.ValueChanged += (x, y) => _target.birthDate = dtpBirthDate.Value;
                tbPassportSeria.TextChanged += (x, y) => _target.PassportSeria = tbPassportSeria.Text;
                tbPassportNumber.TextChanged += (x, y) => _target.PassportNumber = tbPassportNumber.Text;
                dtpPassportDateRegistred.ValueChanged += (x, y) => _target.PassportDateRegistred = dtpPassportDateRegistred.Value;
                tbPassportOrganizationRegistred.TextChanged += (x, y) => _target.PassportOrganizationRegistred = tbPassportOrganizationRegistred.Text;
                tbRegistredPassportAddress.TextChanged += (x, y) => _target.RegistredPassportAddress = tbRegistredPassportAddress.Text;
                // Для юр лица
                tbOgranizationJuridicalAddress.TextChanged += (x ,y) => _target.OgranizationJuridicalAddress = tbRegistredPassportAddress.Text;
                tbOrganizationMainBankAcouuntNumber.TextChanged += (x, y) => _target.OrganizationMainBankAcouuntNumber = tbOrganizationMainBankAcouuntNumber.Text;
                tbOrganizationKPP.TextChanged += (x, y) => _target.OrganizationKPP = tbOrganizationKPP.Text;
                tbOrganizationOGRNIP.TextChanged += (x, y) => _target.OrganizationOGRNIP = tbOrganizationOGRNIP.Text;
                tbOrganizationIFNS.TextChanged += (x, y) => _target.OrganizationIFNS = tbOrganizationIFNS.Text;
                tbOrganizationOKATO.TextChanged += (x, y) => _target.OrganizationOKATO = tbOrganizationOKATO.Text;
                tbOrganizationOKPO.TextChanged += (x, y) => _target.OrganizationOKPO = tbOrganizationOKPO.Text;

    У меня денюха поэтому решил отмаппить форму по новому

    glilya, 10 Апреля 2011

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

    +119

    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
    string[] otgruzka = new string[11] { "Отгрузка компонент 1 Вес 5дк-500", "Отгрузка компонент 2 Вес 5дк-500", "Отгрузка компонент 3 Вес 5дк-500", "Отгрузка компонент 4 Вес 5дк-500", "Отгрузка компонент 5 Вес 5дк-500", "Отгрузка компонент 6 Вес 5дк-500", "Отгрузка компонент 1 Вес 5дк-200", "Отгрузка компонент 2 Вес 5дк-200", "Отгрузка компонент 3 Вес 5дк-200", "Отгрузка компонент 4 Вес 5дк-200", "Отгрузка компонент 5 Вес 5дк-200", };
                        string[] silos = new string[11] { "Силос 1", "Силос 5", "Силос 6", "Силос 7", "Силос 8", "Силос 31-H", "Силос 9", "Силос 11", "Силос 2", "Силос 3", "Силос 4" };
                                           
                        for (int i = 0; i < dataGridView1.RowCount; i++)
                        {
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 1")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[0]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 5")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[1]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 6")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[2]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 7")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[3]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 8")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[4]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 31-H")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[5]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 9")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[6]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 11")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[7]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 2")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[8]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 3")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[9]);
                            if (Convert.ToString(dataGridView1.Rows[i].Cells[5].Value) == "Силос 4")
                                dataGridView1.Rows[i].Cells[3].Value = modbus_master.GetValue(otgruzka[10]);
                        }                    
                        textBox12.Text = Convert.ToString(modbus_master.GetValue("Текущий отвес 5дк-200") + 1);
    
                        if (modbus_master.GetValue("Текущий отвес 5дк-200") > WorkWithArchive.currentOtves200)
                        {
                            WorkWithArchive.WriteArchiveOtves200(modbus_master.GetValue("Текущий отвес 5дк-200"));
                            WorkWithArchive.currentOtves200 = modbus_master.GetValue("Текущий отвес 5дк-200");
                            WorkWithArchive.WriteArchiveKomponent200(dataGridView1);
                            WorkWithArchive.ot200 = true;
                        }

    Программа управления на производстве, взаимодействует с контроллером, получает кучу данных и такую же кучу отправляет.

    fxlancer, 05 Апреля 2011

    Комментарии (11)
  8. VisualBasic / Говнокод #6216

    −110

    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
    Public Class Decoder
        Dim arr_en() As String = {"q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "?", "@"}
        Dim arr_ua() As String = {"й", "ц", "у", "к", "е", "н", "г", "ш", "щ", "з", "х", "ъ", "ф", "ы", "в", "а", "п", "р", "о", "л", "д", "ж", "є", "я", "ч", "с", "м", "и", "т", "ь", "б", "ю", ".", ",", "'"}
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            TextBox2.Clear()
    
            Dim t As Char
            Dim ch As Char
            Dim vv As String
    
            For Each vv In TextBox1.Lines
                For Each t In vv
                    For i As Integer = 0 To arr_en.Count - 1
                        ch = arr_en.GetValue(i)
                        If t = ch Then
                            t = arr_ua.GetValue(i)
                            Exit For
                        End If
                    Next
                    TextBox2.Text = TextBox2.Text & t
                Next
                TextBox2.Text = TextBox2.Text & vbCrLf
            Next
        End Sub
    End Class

    Декодер с английской раскладки за 5 минут.

    undiscovered, 04 Апреля 2011

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

    +146

    1. 1
    this++;

    Думаю, так нельзя в члене класса, но выглядит все равно забавно.

    Говногость, 04 Апреля 2011

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

    +157

    1. 1
    2. 2
    3. 3
    /* FCBKcomplete 2.7.5 */
    
    _item = element.children('option[value="' + value + '"]');

    Alex_Slubsky, 01 Апреля 2011

    Комментарии (11)
  11. JavaScript / Говнокод #6144

    +168

    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
    $('#status:first').html('Выберите нужный подарок и НАЖМИТЕ по нему!');
    $("#status:eq(1)").html("Ваш баланс:<span class='balans'>"+balans);
    $("#status:eq(1)").html($("#status:eq(1)").html()+"</span>");
    function otkritPodarokOdin(){
    	document.getElementById('podarokOdin').style.display='block';
    	if($('.balans').html() == '10' || parseFloat($('.balans').html()) > 10){}else{
    		$('div[id="podarokOdin"]').hide();
    		$('#status:first').html('Ошибка!НЕДОСТАТОЧНО СРЕДСТВ НА СЧЕТУ!');
    	}
    };
    function otkritPodarokDva(){
    	document.getElementById('podarokDva').style.display='block';
    	if($('.balans').html() == '10' || parseFloat($('.balans').html()) > 10){}else{
    		$('div[id="podarokDva"]').hide();
    		$('#status:first').html('Ошибка!НЕДОСТАТОЧНО СРЕДСТВ НА СЧЕТУ!');
    	}
    };
    function otkritPodarokTri(){
    	document.getElementById('podarokTri').style.display='block';
    	if($('.balans').html() == '10' || parseFloat($('.balans').html()) > 10){}else{
    		$('div[id="podarokTri"]').hide();
    		$('#status:first').html('Ошибка!НЕДОСТАТОЧНО СРЕДСТВ НА СЧЕТУ!');
    	}
    };
    function otkritPodarokChetyre(){
    	document.getElementById('podarokChetyre').style.display='block';
    	if($('.balans').html() == '10' || parseFloat($('.balans').html()) > 10){}else{
    		$('div[id="podarokChetyre"]').hide();
    		$('#status:first').html('Ошибка!НЕДОСТАТОЧНО СРЕДСТВ НА СЧЕТУ!');
    	}
    };
    function otkritPodarokPyat(){
    	document.getElementById('podarokPyat').style.display='block';
    	if($('.balans').html() == '10' || parseFloat($('.balans').html()) > 10){}else{
    		$('div[id="podarokPyat"]').hide();
    		$('#status:first').html('Ошибка!НЕДОСТАТОЧНО СРЕДСТВ НА СЧЕТУ!');
    	}
    };
    function otkritPodarokShest(){
    	document.getElementById('podarokShest').style.display='block';
    	if($('.balans').html() == '10' || parseFloat($('.balans').html()) > 10){}else{
    		$('div[id="podarokShest"]').hide();
    		$('#status:first').html('Ошибка!НЕДОСТАТОЧНО СРЕДСТВ НА СЧЕТУ!');
    	}
    };

    Воздержусь указывать где говнокод. Собственно повсюду.

    stuffort, 30 Марта 2011

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