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

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

    +104

    1. 1
    2. 2
    if doc_lang='UA' then filename:=ExtractFileDir(Application.ExeName)+'/docs/sales_slip_MS_UA.xlt';
    if doc_lang='RU' then filename:=ExtractFileDir(Application.ExeName)+'/docs/sales_slip_MS_RU.xlt';

    Классика жанра, и так пол проги((((((

    Nikitiy_II, 14 Ноября 2010

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

    +117

    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
    private XmlNode GetListItemsXML(bool _flag, string _param, SPList _list)
            {
                SPQuery oEmptyQuery = new SPQuery();
                SPListItemCollection spliColl;
                XmlReaderSettings sett = new XmlReaderSettings();
                Stream stream;
                XmlReader reader;
                XmlDocument listItems = new XmlDocument();
                string str = "";
                try
                {
                    switch (_flag)
                    {
                        case true:
                            //select division
                            oEmptyQuery.Query = "<Where><Eq><FieldRef Name=\"URL\"/><Value Type=\"Text\">" + _param + "</Value></Eq></Where>";
                            spliColl = _list.GetItems(oEmptyQuery);
    
                            str = c_my_headFile + spliColl.Xml;
                            str.Replace("\r\n", "");
                            stream = new MemoryStream(new UTF8Encoding(true).GetBytes(str));
    
                            
                            sett.ConformanceLevel = ConformanceLevel.Auto;
                            reader = XmlReader.Create(new StringReader(str), sett);
    
                            
    
                            listItems.LoadXml(str);
                            return listItems.SelectSingleNode("xml").ChildNodes[1].ChildNodes[0];
                            //return listItems.SelectSingleNode("xml").ChildNodes[1];
                        case false:
                            //select articles
                            //_x0420__x0430__x0437__x0434__x04
                            oEmptyQuery.Query = "<Where><Eq><FieldRef Name=\"_x0420__x0430__x0437__x0434__x04\"  LookupId=\"TRUE\" /><Value Type=\"Lookup\">" + _param + "</Value></Eq></Where>";
                            spliColl = _list.GetItems(oEmptyQuery);
    
                            str = c_my_headFile + spliColl.Xml;
                            str.Replace("\r\n", "");
                            stream = new MemoryStream(new UTF8Encoding(true).GetBytes(str));
    
                            
                            sett.ConformanceLevel = ConformanceLevel.Auto;
                            reader = XmlReader.Create(new StringReader(str), sett);
    
                            
    
                            listItems.LoadXml(str);
                            //return listItems.SelectSingleNode("xml").ChildNodes[1].ChildNodes[0];
                            return listItems.SelectSingleNode("xml").ChildNodes[1];
                    }
                }
                catch (XmlException)
                {
                    return null;
                }
                catch (Exception)
                {
                    return null;
                }
                return null;
            }

    Метод, у которого говорящая сигнатура. Увидев ее можно сразу понять что делает этот мегакусок.
    Если кто-нибудь поймет зачем создается экземпляр ридера - объясните. Блин я не понял, честно... xD
    (SPQuery и др. это опять же SharePoint API.)

    dreaktor, 14 Ноября 2010

    Комментарии (4)
  4. ActionScript / Говнокод #4585

    −159

    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
    if( !ruleWithLongName1 )
    {
    	return;
    }
    if( !ruleWithLongName2 )
    {
    	return;
    }
    if( !ruleWithLongName3 )
    {
    	return;
    }
    if( !ruleWithLongName4 )
    {
    	return;
    }
    if( !ruleWithLongName5 )
    {
    	return;
    }

    клевый кусочек (повторяется в нескольких функциях) имена условий изменены, но скажу что они не Boolean типа

    Werdn, 11 Ноября 2010

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

    +163

    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
    //table[0][i] - win1251
    
            table[0][0]=0xA8;
            for (q=192;q<=255;q++) {
                    table[0][q-191]=(byte)q;
            }
            table[0][65]=0xB8;
    
    //table[1][i] - KOI8
    
            table[1][0]=0xB3; table[2][1]=0xE1; table[1][2]=0xE2; table[1][3]=0xF7; table[1][4]=0xE7; table[1][5]=0xE4;
            table[1][6]=0xE5; table[1][7]=0xF6; table[1][8]=0xFA; table[1][9]=0xE9; table[1][10]=0xEA; table[1][11]=0xEB;
            table[1][12]=0xEC; table[1][13]=0xED; table[1][14]=0xEE; table[1][15]=0xEF; table[1][16]=0xF0; table[1][17]=0xF2;
            table[1][18]=0xF3; table[1][19]=0xF4; table[1][20]=0xF5; table[1][21]=0xE6; table[1][22]=0xE8; table[1][23]=0xE3;
            table[1][24]=0xFE; table[1][25]=0xFB; table[1][26]=0xFD; table[1][27]=0xFF; table[1][28]=0xF9; table[1][29]=0xF8;
            table[1][30]=0xFC; table[1][31]=0xE0; table[1][32]=0xF1; table[1][33]=0xC1; table[1][34]=0xC2; table[1][35]=0xD7;
            table[1][36]=0xC7; table[1][37]=0xC4; table[1][38]=0xC5; table[1][39]=0xD6; table[1][40]=0xDA; table[1][41]=0xC9;
            table[1][42]=0xCA; table[1][43]=0xCB; table[1][44]=0xCC; table[1][45]=0xCD; table[1][46]=0xCE; table[1][47]=0xCF;
            table[1][48]=0xD0; table[1][49]=0xD2; table[1][50]=0xD3; table[1][51]=0xD4; table[1][52]=0xD5; table[1][53]=0xC6;
            table[1][54]=0xC8; table[1][55]=0xC3; table[1][56]=0xDE; table[1][57]=0xDB; table[1][58]=0xDD; table[1][59]=0xDF;
            table[1][60]=0xD9; table[1][61]=0xD8; table[1][62]=0xDC; table[1][63]=0xC0; table[1][64]=0xD1; table[1][65]=0xA3;
    
    // table[2][i] - CP866
    
            table[2][0]=0xf0;
            for (q=128;q<=175;q++) {
                    table[2][q-127]=(byte)q;
            }
            for (q=224;q<=239;q++) {
                    table[2][q+49-224]=(byte)q;
            }
            table[2][65]=0xf1;
    
    // table[3][i] - Unicode
    
            table[3][0]=0x01;
            for (q=16;q<=79;q++) {
                    table[3][q-15]=(byte)q;
            }
            table[3][65]=0x51;

    Таблица кодировок.

    onto, 09 Ноября 2010

    Комментарии (4)
  6. SQL / Говнокод #4567

    −187

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    SELECT ....
               CASE  WHEN  [StatusChange] = 0 THEN 0
                WHEN  [StatusChange] = 1 THEN 1 -- "желтый", изменен
                WHEN [StatusChange] = 2 THEN 2-- "серый", исключенный пункт
                WHEN [StatusChange] = 3 THEN 3 -- "светло-зеленый", добавленный пункт
                WHEN [StatusChange] = 4 THEN 4-- "зеленый", добавленный и измененный пункт
                ELSE 100
          END AS 'StatusColor'
    FROM ....

    HellMaster_HaiL, 09 Ноября 2010

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

    −178

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    try:
    			os.mkdir(conf_path)
    		except WindowsError,e:
    			if "[Error 183]" not in str(e):
    				QMessageBox.critical(self, "Logon error","Я блять настоящий индус!")

    zloe_zlo, 05 Ноября 2010

    Комментарии (4)
  8. JavaScript / Говнокод #4534

    +145

    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
    /*Выпадающее меню - рассчитывание координат и выполнение определенных действий при определенных координатах курсора*/
    
    
    
    //document.onmousemove = function(e){
    
    //    var mCur = mousePageXY(e);
    
    //}
    
    //function mousePageXY(e)
    
    //{
    
    //    var x = 0, y = 0;
    
    //
    
    //    if (!e) e = window.event;
    
    //
    
    //    if (e.pageX || e.pageY)
    
    //    {
    
    //        x = e.pageX;
    
    //        y = e.pageY;
    
    //    }
    
    //
    
    //    else if (e.clientX || e.clientY)
    
    //    {
    
    //        x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    
    //        y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
    
    //    }
    
    //    if ((((screen.width/2-491)>x)||(screen.width/2+409<x))||((screen.width/2-491<x)&&(y<125)&&((screen.width/2-274)>x))||(y>170+height)||(((screen.width/2-274)<x)&&(y<173)))  {
    
    //        document.getElementById("menu").style.display = 'none'
    
    //    }
    
    //    return {
    
    //        "x":x,
    
    //        "y":y
    
    //    };
    
    //}

    minnigaliev-r, 04 Ноября 2010

    Комментарии (4)
  9. Java / Говнокод #4523

    +145

    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
    @Override
      public void run() {
        while (true) {
          try {
            if (this.getTime() == this.peek().getTime()) {
              this.pop().run();
            }
            Thread.sleep(1000);
          } catch (final InterruptedException e) {
            break;
          }
        }
      }

    кто найдет говняшку, тот получит... = )

    если что, я уже исправил )))

    Lure Of Chaos, 03 Ноября 2010

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

    +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
    // преобразование из 12345 в 12 345
    function ValueF($value) {
      $temp=explode(".",$value);
    
      for ($i_f=strlen($temp[0])-1, $i_f2=1; $i_f>=0; $i_f--, $i_f2++) {
        $str.=$temp[0][$i_f];
        if ($i_f2==3) {
          $str.=" ";
          $i_f2=0;
          }
        }
      $str=strrev($str);
    
    return $str;
    }

    2006 год

    dendy_barn, 03 Ноября 2010

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

    −166

    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
    /**
     * Saving game state
     * @return Boolean is game saved 
     */		
    public static function saveCurrentProfileProgress():Boolean
    {
    	if( defProfile != null )
    	{
    		var levelName:String;
    		var sceneName:String;
    		if( Module.getSingleton().getCurrentEpisode() )
    		{
    			if( Module.getSingleton().getCurrentEpisode() == Module.getSingleton().mEpisode1 )
    			{
    				levelName = "1";
    			}
    			else if( Module.getSingleton().getCurrentEpisode() == Module.getSingleton().mEpisode2 )
    			{
    				levelName = "2";
    			}
    			/**
    			* И так далее
    			*/
    			else if( Module.getSingleton().getCurrentEpisode() == Module.getSingleton().mEpisode24 )
    			{
    				levelName = "24";
    			}
    			else if( Module.getSingleton().getCurrentEpisode() == Module.getSingleton().mEpisode25 )
    			{
    				levelName = "25";
    			}
    			
    			if( Module.getSingleton().getCurrentEpisode().getCurrentScene() )
    			{
    				if( Module.getSingleton().getCurrentEpisode().mScene1Window && Module.getSingleton().getCurrentEpisode().getCurrentScene() == Module.getSingleton().getCurrentEpisode().mScene1Window )
    				{
    					sceneName = "1";
    				}
    				else if( Module.getSingleton().getCurrentEpisode().mScene2Window && Module.getSingleton().getCurrentEpisode().getCurrentScene() == Module.getSingleton().getCurrentEpisode().mScene2Window )
    				{
    					sceneName = "2";
    				}
    				else if( Module.getSingleton().getCurrentEpisode().mScene3Window && Module.getSingleton().getCurrentEpisode().getCurrentScene() == Module.getSingleton().getCurrentEpisode().mScene3Window )
    				{
    					sceneName = "3";
    				}
    				else if( Module.getSingleton().getCurrentEpisode().mScene4Window && Module.getSingleton().getCurrentEpisode().getCurrentScene() == Module.getSingleton().getCurrentEpisode().mScene4Window )
    				{
    					sceneName = "4";
    				}
    				else if( Module.getSingleton().getCurrentEpisode().mScene5Window && Module.getSingleton().getCurrentEpisode().getCurrentScene() == Module.getSingleton().getCurrentEpisode().mScene5Window )
    				{
    					sceneName = "5";
    				}
    			}
    		}
    		if ( levelName != null && sceneName != null )
    		{
    			saveLevelName( levelName + "_" + sceneName );
    			return true;
    		}
    	}
    	return false;
    }

    Вот собсна и все

    Werdn, 02 Ноября 2010

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