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

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

    +161

    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
    #include "header.hpp"
     
    int main(int argc, char** argv) {
       if ( argc != 4 ) {
          std::cout << "client ip port 0/1 - sleed disabled/enabled" << std::endl;
          return 0;
       }
       std::string ip = argv[1];
       boost::uint16_t port = boost::lexical_cast<boost::uint16_t>(argv[2]);
       bool wsleep = (argv[3][0] == '1');
       std::cout << "sleep " << (wsleep?"enabled":"disabled") << std::endl;
       
       FILE* in = fopen("client_in.log", "wb");
       FILE* out= fopen("client_out.log", "wb");
       if ( !out || !in ) {
          std::cout << "can`t open file!" << std::endl;
          return 1;
       }
     
       boost::asio::ip::tcp::endpoint endpoint(
          boost::asio::ip::address::from_string(ip), port
       );
     
       boost::asio::io_service ios;
       boost::shared_ptr<boost::asio::io_service::work> work(new boost::asio::io_service::work(ios));
     
       boost::thread thread(boost::bind(&boost::asio::io_service::run, &ios));
       
       boost::asio::ip::tcp::socket socket(ios);
       socket.connect(endpoint);
     
       boost::asio::socket_base::non_blocking_io non_blocking_io(true);
       socket.io_control(non_blocking_io);
     
       client_read(socket, in);
     
       for ( size_t idx = 0; idx < 100000000; ++idx ) {
          char* buf = new char[send_buffer_size];
          sprintf(buf, "cs:%8dn", idx);
          start_write(socket, buf, out);
          if ( wsleep ) {
             boost::this_thread::sleep(boost::posix_time::microseconds(1000));
          }
       }
     
       std::cout
       << "send data to server finished!" << std::endl
       << "waiting for all ask`s from server..." << std::endl;
     
       work.reset();
     
       while ( counter ) {
          boost::this_thread::sleep(boost::posix_time::microseconds(1000));
          std::cout << "." << std::flush;
       }
     
       std::cout << std::endl << std::endl
       << "all ask`s received." << std::endl
       << "terminate client..." << std::endl;
     
       socket.cancel();
       socket.close();
     
       thread.join();
       fclose(in);
       fclose(out);
    }

    qbasic, 08 Апреля 2011

    Комментарии (11)
  3. 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)
  4. 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)
  5. C++ / Говнокод #6207

    +146

    1. 1
    this++;

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

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

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

    +157

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

    Alex_Slubsky, 01 Апреля 2011

    Комментарии (11)
  7. 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)
  8. 1C / Говнокод #6110

    −87

    1. 1
    2. 2
    ТекЗакладка=0;
    Если ТекЗакладка=0 тогда ТекЗакладка=1;КонецЕсли;

    Путаем следы?

    CYFiVE, 29 Марта 2011

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

    +160

    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
    ##### grab the full name of the agent
    		$stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$VD_login' and pass='$VD_pass'";
    		$rslt=mysql_query($stmt, $link);
    			if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);}
    		$row=mysql_fetch_row($rslt);
    		$LOGfullname =							$row[0];
    		$user_level =							$row[1];
    		$VU_hotkeys_active =					$row[2];
    		$VU_agent_choose_ingroups =				$row[3];
    		$VU_scheduled_callbacks =				$row[4];
    		$agentonly_callbacks =					$row[5];
    		$agentcall_manual =						$row[6];
    		$VU_vicidial_recording =				$row[7];
    		$VU_vicidial_transfers =				$row[8];
    		$VU_closer_default_blended =			$row[9];
    		$VU_user_group =						$row[10];
    		$VU_vicidial_recording_override =		$row[11];
    		$VU_alter_custphone_override =			$row[12];
    		$VU_alert_enabled =						$row[13];
    		$VU_agent_shift_enforcement_override =	$row[14];
    		$VU_shift_override_flag =				$row[15];
    		$VU_allow_alerts =						$row[16];
    		$VU_closer_campaigns =					$row[17];
    		$VU_agent_choose_territories =			$row[18];
    		$VU_custom_one =						$row[19];
    		$VU_custom_two =						$row[20];
    		$VU_custom_three =						$row[21];
    		$VU_custom_four =						$row[22];
    		$VU_custom_five =						$row[23];
    
    		if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';}
    		else {$VU_alert_enabled = 'OFF';}
    		$AgentAlert_allowed = $VU_allow_alerts;
    
    		### Gather timeclock and shift enforcement restriction settings
    		$stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts,agent_status_viewable_groups,agent_status_view_time from vicidial_user_groups where user_group='$VU_user_group';";
    		$rslt=mysql_query($stmt, $link);
    			if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01052',$VD_login,$server_ip,$session_name,$one_mysql_log);}
    		$row=mysql_fetch_row($rslt);
    		$forced_timeclock_login =	$row[0];
    		$shift_enforcement =		$row[1];
    		$LOGgroup_shiftsSQL = eregi_replace('  ','',$row[2]);
    		$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
    		$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
    		$agent_status_viewable_groups = $row[3];
    		$agent_status_viewable_groupsSQL = eregi_replace('  ','',$agent_status_viewable_groups);
    		$agent_status_viewable_groupsSQL = eregi_replace(' ',"','",$agent_status_viewable_groupsSQL);
    		$agent_status_viewable_groupsSQL = "user_group IN('$agent_status_viewable_groupsSQL')";
    		$agent_status_view = 0;
    		if (strlen($agent_status_viewable_groups) > 2)
    			{$agent_status_view = 1;}
    		$agent_status_view_time=0;
    		if ($row[4] == 'Y')
    			{$agent_status_view_time=1;}

    Оказывается, у меня на работе стоит чуть переделанный VICIdial.
    Это звездец.

    7ion, 20 Марта 2011

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

    +91

    1. 1
    2. 2
    3. 3
    4. 4
    procedure TForm.ButtoClick(Sender: TObject);{не вздумай нажимать на эту конопку, уебок!! тогда проект не будет падать!!}
    begin
        {blah blah blah}
    end;

    нашел такой вот коммент в обработчике события 0_о

    TheHamstertamer, 20 Марта 2011

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

    +162

    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
    <?
    defined ('brist') or die('А Вы не охуели ли лазить по таким файлам? оО <br> КГБ уже едет к Вам. Ждите.');
    switch  ($firstl) {
    	case "А": 
    	 	include("config.php");
    		$db = mysql_connect($dblocation, $dbuser, $dbpasswd);
    		mysql_select_db("$dbname",$db);
    		$resultat = mysql_query("SELECT * FROM a WHERE word='$searchword'",$db);
    		$mr = mysql_fetch_array($resultat);
    		$idd = $mr['id'];
    		if (empty($mr['id'])) {
    		print "Слово в базе не найдено. Возможно вы допустили ошибку, или просто это слово еще не было добавлено.";
    		}
    		else {
    		$result = mysql_query("select * from a where id='$idd'",$db);
    		$row2 = mysql_fetch_array($result);
    		?> <font size="+3"> <? print $row2['word']."<br>"; ?> </font> <?
    		print $row2['opisanie'];	
    		}
    			
    		break; 
    	case "Б": 
    	 	include("config.php");
    		$db = mysql_connect($dblocation, $dbuser, $dbpasswd);
    		mysql_select_db("$dbname",$db);
    		$resultat = mysql_query("SELECT * FROM b WHERE word='$searchword'",$db);
    		$mr = mysql_fetch_array($resultat);
    		$idd = $mr['id'];
    		if (empty($mr['id'])) {
    		print "Слово в базе не найдено. Возможно вы допустили ошибку, или просто это слово еще не было добавлено.";
    		}
    		else {
    		$result = mysql_query("select * from b where id='$idd'",$db);
    		$row2 = mysql_fetch_array($result);
    		?> <font size="+3"> <? print $row2['word']."<br>"; ?> </font> <?
    		print $row2['opisanie'];	
    		}
    			
    		break; 
    	case "В": 
    	 	include("config.php");
    		$db = mysql_connect($dblocation, $dbuser, $dbpasswd);
    		mysql_select_db("$dbname",$db);
    		$resultat = mysql_query("SELECT * FROM v WHERE word='$searchword'",$db);
    		$mr = mysql_fetch_array($resultat);
    		$idd = $mr['id'];
    		if (empty($mr['id'])) {
    		print "Слово в базе не найдено. Возможно вы допустили ошибку, или просто это слово еще не было добавлено.";
    		}
    		else {
    		$result = mysql_query("select * from v where id='$idd'",$db);
    		$row2 = mysql_fetch_array($result);
    		?> <font size="+3"> <? print $row2['word']."<br>"; ?> </font> <?
    		print $row2['opisanie'];	
    		}
    			
    		break; 
    	case "Г": 
    	 	include("config.php");
    		$db = mysql_connect($dblocation, $dbuser, $dbpasswd);
    		mysql_select_db("$dbname",$db);
    		$resultat = mysql_query("SELECT * FROM g WHERE word='$searchword'",$db);
    		$mr = mysql_fetch_array($resultat);
    		$idd = $mr['id'];
    		if (empty($mr['id'])) {
    		print "Слово в базе не найдено. Возможно вы допустили ошибку, или просто это слово еще не было добавлено.";
    		}
    		else {
    		$result = mysql_query("select * from g where id='$idd'",$db);
    		$row2 = mysql_fetch_array($result);
    		?> <font size="+3"> <? print $row2['word']."<br>"; ?> </font> <?
    		print $row2['opisanie'];	
    		}
    			
    		break; 
    etc до Я

    По ходу автор этого чудесного кода, пропил инклюды..

    kpucto, 07 Марта 2011

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