1. PHP / Говнокод #4231

    +144

    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
    
    <?xml version='1.0' encoding='utf-8'?>
    <rss version="2.0">
       <channel>
          <title>behistory - живая история</title>
           <link>http://behistory.ru/</link>
           <lastBuildDate>Sun, 12 Sep 2010 13:17:59 +0300</lastBuildDate>
           <language>ru</language>
    
                  <item>
                    <title>О роли балтского субстрата в истории славянских племен верхнего Поднепровья</title>
                     <link>ololo</link>
                     <description>&lt;html&gt;
    &lt;p style=&quot;text-align: justify;&quot;&gt;В статье большое внимание уделяется роли балтов в истории славянских племен верхнего Днепра. Автор проводит тщательный анализ основных тезисов В.В. Седова, которые сводятся в своей основе к следующему - балтский субстрат был основным при образовании белорусской народности, т. е. при образовании трех летописных племен: кривичей, дреговичей и радимичей. В подтверждение этого он приводит целый ряд лингвистических, этнографических и археологических данных. Автор не согласна с данной позицией и оспаривает выводы В.В. Седова.&lt;/p&gt;
    &lt;/html&gt;</description>
    
                     <pubDate>2009-07-27 03:44:11</pubDate>
                  </item>
                  <item>

    aslikeyou, 12 Сентября 2010

    Комментарии (13)
  2. Java / Говнокод #4230

    +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
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    public class ServiceRunner implements Runnable {
        
        Thread thread = null;
        ServiceUI service;
        public ServiceRunner(ServiceUI service) {       
            this.service = service;
        }
        
        public void start() {
            this.thread = new Thread(this);
            this.thread.start();
        }
    
        public void run() {        
            while (true) {            
                this.service.receiveMessages();            
                try {
    	 	this.thread.sleep(CommonConst.INTERVAL_SERVICE * 1000);
    	    } catch (java.lang.InterruptedException e) {
                    Log.log(Log.ERROR,this,e);
    	}
            this.service.sendMessages();        
            try {
    	       this.thread.sleep(CommonConst.INTERVAL_SERVICE *1000);
    	} catch (java.lang.InterruptedException e) {
                   Log.log(Log.ERROR,this,e);
    	}
        }
        
    }

    очень удивляют предыдущие разрабочтики продукта своими понятиями о потоках в Java

    qnikst, 12 Сентября 2010

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

    +118

    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
    SqlCommand command = new SqlCommand ();
    command.Connection = connection;
    command.CommandText = "select data from filestorage where id=@id;";            
    command.Parameters.AddWithValue ("@id", fileId);
    command.CommandType = CommandType.Text;
    
    byte [] data = (byte []) command.ExecuteScalar ();
    
    System.IO.Stream outStream = Response.OutputStream;
    
    Response.ContentType = "Application/octet-stream";
    Response.AppendHeader ("Connection", "keep-alive");
    
    Response.AppendHeader ("Content-Disposition", " attachment; filename = \"" + fName+"\"" );
    
    outStream.Write (data, 0, data.Length);
    Response.End ();

    продолжение http://govnokod.ru/4227

    akai_mirror, 12 Сентября 2010

    Комментарии (16)
  4. PHP / Говнокод #4228

    +165

    1. 1
    2. 2
    $res = explode(" ", $price);		
    $price = trim(str_replace(".", "", str_replace(",", "", substr(trim($res[0]), 0, strlen(trim($res[0])) - 2))));

    Изначально в переменной $price строка такого вида: 144.07 РУБ.
    Судя по всему автор хотел таким образом получить из нее целое значение

    partizan22, 12 Сентября 2010

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

    +125

    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
    command = new System.Data.SqlClient.SqlCommand();
    command.Connection = connection;
    
    command.CommandText = "select data from filestorage where id=@id;";            
    command.Parameters.AddWithValue("@id", fileId);
    command.CommandType = CommandType.Text;
    byte[] data = (byte[])command.ExecuteScalar();
    
    command.CommandText = "select filename from filestorage where id=@id;";
    string fName = (string)command.ExecuteScalar();
    
    command.CommandText = "select sizebytes from filestorage where id=@id;";
    long lngFileSize = (int)command.ExecuteScalar();
    
    command.CommandText = "select foldername from filestorage where id=@id;";
    string store= command.ExecuteScalar().ToString();

    akai_mirror, 11 Сентября 2010

    Комментарии (7)
  6. Ruby / Говнокод #4226

    −155

    1. 1
    2. 2
    3. 3
    4. 4
    @image = (image unless image.nil?) or 
             (Rubygame::Surface.autoload(image_file) unless image_file.nil?) or 
             (Rubygame::Surface.autoload("#{@name}.png") unless @name.nil?) or 
             Rubygame::Surface.new([16, 16])

    (c) http://stackoverflow.com/questions/3690508

    Nakilon, 11 Сентября 2010

    Комментарии (4)
  7. PHP / Говнокод #4225

    +148

    1. 1
    2. 2
    3. 3
    4. 4
    if( !$this->dirsmodel->isExist(array('alias' => $_POST['alias']))) {
        $this->messages[] = 'Такой алиас уже существует';
        return $this->redirect("admin/dirs/#" . $cat_id);
    }

    Говнокод тонкий особый. Кто найдёт получит пиченьку

    DrFreez, 11 Сентября 2010

    Комментарии (22)
  8. Python / Говнокод #4224

    −305

    1. 1
    if random.randint(1, 9999) is 42:

    Ockonal, 11 Сентября 2010

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

    +165

    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
    case  KEY_F9: {
    			if ( !strcmp( chlist->gettype(), "ethernet" ) ) {
    				/* Редактор канала Ethernet */
    				char buf[0x100];
    				chlist->gen_path_chan( CHANCONFDIR, "/m.cfg", buf );
    				//
    				tethcfgedit* edit = new tethcfgedit( getscr(), buf );
    				edit->layer = layer;
    				edit->Run();
    				delete edit;
    			} else if ( !strcmp( chlist->gettype(), "gprs" ) ) {
    				/* Редактор канала GPRS */
    				char buf[0x100];
    				chlist->gen_path_chan( CHANCONFDIR, "", buf );
    				//
    				tgprscfgedit* edit = new tgprscfgedit( getscr(), buf );
    				edit->layer = layer;
    				edit->Run();
    				delete edit;
    			} else if ( !strcmp( chlist->gettype(), "gsm" ) ) {
    				/* Редактор канала GSM */
    				char buf[0x100];
    				chlist->gen_path_chan( CHANCONFDIR, "", buf );
    				//
    				tgsmcfgedit* edit = new tgsmcfgedit( getscr(), buf );
    				edit->layer = layer;
    				edit->Run();
    				delete edit;
    			} else if ( !strcmp( chlist->gettype(), "gsppp" ) ) {
    				/* Редактор канала GS (пакетный) */
    				char buf[0x100];
    				chlist->gen_path_chan( CHANCONFDIR, "", buf );
    				//
    				tgspppcfgedit* edit = new tgspppcfgedit( getscr(), buf );
    				edit->layer = layer;
    				edit->Run();
    				delete edit;
    			} else if ( !strcmp( chlist->gettype(), "gs" ) ) {
    				/* Редактор канала GS (прямой) */
    				char buf[0x100];
    				chlist->gen_path_chan( CHANCONFDIR, "", buf );
    				//
    				tgscfgedit* edit = new tgscfgedit( getscr(), buf );
    				edit->layer = layer;
    				edit->Run();
    				delete edit;
    			} else if ( !strcmp( chlist->gettype(), "radio" ) ) {
    				/* Редактор канала радиомодема */
    				char buf[0x100];
    				chlist->gen_path_chan( CHANCONFDIR, "", buf );
    				//
    				tradiocfgedit* edit = new tradiocfgedit( getscr(), buf );
    				edit->layer = layer;
    				edit->Run();
    				delete edit;
    			} else if ( !strcmp( chlist->gettype(),"cbs" ) ) {
    				/* Редактор канала Ethernet */
    				char buf[0x100];
    				chlist->gen_path_chan( CHANCONFDIR,"",buf );
    				//
    				tcbscfgedit* edit=new tcbscfgedit( getscr(),buf );
    				edit->layer = layer;
    				edit->Run();
    				delete edit;
    			} else if ( !strcmp( chlist->gettype(), "ptsn" ) ) {
    				/* Редактор канала GSM */
    				char buf[0x100];
    				chlist->gen_path_chan( CHANCONFDIR, "", buf );
    				//
    				tptsncfgedit* edit = new tptsncfgedit( getscr(), buf );
    				edit->layer = layer;
    				edit->Run();
    				delete edit;
    			}
    ......

    Кусок case'a, где запускается редактор настроек соотвествующего канала связи. Код из одной встроенной железки.

    vollmond, 11 Сентября 2010

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

    +131

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    {if $oUserProfile->getProfileIcq()}
    	<strong>{$aLang.profile_social_contacts}</strong>
    	<ul>
    	{if $oUserProfile->getProfileIcq()}
    		<li class="icq"><a href="http://www.icq.com/people/about_me.php?uin={$oUserProfile->getProfileIcq()|escape:'html'}" target="_blank">{$oUserProfile->getProfileIcq()}</a></li>
    	{/if}					
    	</ul>
    {/if}

    Smarty-шаблон. ActionProfile/sidebar.tpl (17-я строчка в скине "new") из LiveStreet.
    Озадачивают 1-я и 4-я строки. Типа: "А вдруг?!"

    hybroid, 11 Сентября 2010

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