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

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

    −110

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    NSString* rarityStr = [[APPDELEGATE daoManager] getDictName:tmpl.rarityId];
    int lengthdiff = [@"Uncommon" length] - [rarityStr length];
    if ([rarityStr isEqualToString:@"Rare"]) {
    	lengthdiff++;
    }				
    NSMutableString* spacesStr = [NSMutableString string];
    while (lengthdiff > 0) {
    	[spacesStr appendString:@" "];
    	lengthdiff--;
    }
    [rarityLabel setText:[NSString stringWithFormat:@"%@%@", spacesStr, rarityStr]];

    выравнивание текста в лейбле по правому краю =)

    GLvRzZZ, 19 Января 2011

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

    −122

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    while(ba.bytesAvailable)
    {
    	try
    	{
    		var b:String = ba.readUTFBytes(1);
    		bas[bas.length - 1] += b;
    	}
    	catch(e:Error)
    	{
    		bas.push("");
    	}
    }

    Это тот же человек, который до этого XML из строк сам строил. Теперь ему нужно было прочитать несколько строк из потока, разделенныхе нуль-байтами.

    wvxvw, 18 Января 2011

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

    +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
    #include <stdio.h>
    
    int main(int argc,char argv)
    {
    
    int start=90;
    int end=2;
    int divd=10;
    for(int i=start;i>=end;i--)
    {
    if(i>=10){
    for(int nm=10;nm>=1;nm--)
    {
    int res=i/nm;
    int ost=i%nm;
    if(ost==0 && res<=10)printf("%d=%d*%d\n",i,res,nm);
    };
    } else {
    for(int nm=i;nm>=1;nm--)
    {
    int res=i/nm;
    int ost=i%nm;
    if(ost==0)printf("%d=%d*%d\n",i,res,nm);
    };
    };
    
    };
    
    return 0;
    };

    Таблица умножения

    AliceGoth, 17 Января 2011

    Комментарии (3)
  5. PHP / Говнокод #5303

    +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
    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
    <?php
    session_start();
    require_once 'connection/ConnectionConfig.php';
    require_once 'classes/DBClass.php';
    $DB = new DB($host, $user, $password);
    
    function LoadContent($DB) {
        if (isset($_GET["ShowTable"]) || isset($_GET["ViewPage"]) || isset($_POST["Cancel"])) {
            $DB->SelectBase($_SESSION["CurrentDB"]);
            include 'loaders/view_table.te.php';
        }
        if (isset($_GET["NewRecord"]) || isset($_GET["EditRecord"])) {
            if (isset($_GET["EditRecord"]) && (!isset($_GET["SelectedRecord"]))) {
                $message = "Не выбрана запись для редактирования!";
                include 'templates/message.te.html';
            }
            else
                include 'loaders/edit_record.te.php';
        }
        if (isset($_POST["Save"])) {
            include 'loaders/edit_function.te.php';
        }
        if (isset($_GET["DeleteRecord"])) {
            if (!isset($_GET["SelectedRecord"])) {
                $message = "Не выбрана запись для удаления!";
                include 'templates/message.te.html';
            } else {
                include 'loaders/del_function.te.php';
            }
        }
    }
    
    function LoadMenu($DB) {
        include 'loaders/menu_bases.te.php';
        if (isset($_GET["SelectDatabase"])) {
            $DB->SelectBase($_GET["SelectedDatabase"]);
            $_SESSION["CurrentDB"] = $DB->GetCurrentBase();
        }
        if (isset($_SESSION["CurrentDB"]))
            include 'loaders/menu_tables.te.php';
    }
    
    include 'templates/common.te.html';
    ?>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
        <head>
            <title></title>
            <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
            <link rel="stylesheet" type="text/css" href="style/style.css">
        </head>
        <body>
            <table border="1" class="common">
                <tr>
                    <td width="250" height="130">
                        <img src="image/logo1.jpg" alt="logo"/>
    
                    </td>
                    <td rowspan="2" valign="top">
                        <?php LoadContent($DB); ?>
                    </td>
                </tr>
                <tr>
                    <td valign="top" class="menu_container">
                        <?php LoadMenu($DB); ?>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <p class="copyright">Разработано: 2011г. Автор: Тяготенков В.Э.</p>
                    </td>
                </tr>
            </table>
        </body>
    </html>

    qbasic, 17 Января 2011

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

    −135

    1. 1
    var messageFormatedForClientView:String = "<font color=\u0022#" + VRSettings.chatClientColor + "\u0022>" + messageFormated + "</font>";

    Человек "нашел выход"...

    wvxvw, 17 Января 2011

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

    +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
    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
    /* Draw the legend of the active series */
       function drawLegend($X,$Y,$Format="")
        {
         $Family	= isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
    ...
         $Mode	= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
         if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
         $YStep = max($this->FontSize,$BoxHeight) + 5;
         $XStep = $BoxWidth + 5;
         $XStep = $XSpacing;
         $Data = $this->DataSet->getData();
         $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
         foreach($Data["Series"] as $SerieName => $Serie)
          {
           if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
            {
             if ( $Mode == LEGEND_VERTICAL )
              {
               $BoxArray = $this->getTextBox($vX+$BoxWidth+4,$vY+$BoxHeight/2,$FontName,$FontSize,0,$Serie["Description"]);
               if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxHeight/2; }
               if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
               if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxHeight/2; }
               $Lines = preg_split("/\n/",$Serie["Description"]);
               $vY = $vY + max($this->FontSize*count($Lines),$BoxHeight) + 5;
              }
             elseif ( $Mode == LEGEND_HORIZONTAL )
              {
               $Lines = preg_split("/\n/",$Serie["Description"]);
               $Width = "";
               foreach($Lines as $Key => $Value)
                {
                 $BoxArray = $this->getTextBox($vX+$BoxWidth+6,$Y+$BoxHeight/2+(($YStep-3)*$Key),$FontName,$FontSize,0,$Value);
                 if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxHeight/2; }
                 if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
                 if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxHeight/2; }
                 $Width[] = $BoxArray[1]["X"];
                }
               $vX=max($Width)+$XStep;
              }
            }
          }
         $vY=$vY-$YStep; $vX=$vX-$XStep;
         $TopOffset  = $Y - $Boundaries["T"];
         if ( $Boundaries["B"]-($vY+$BoxHeight) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxHeight+$TopOffset; }
         if ( $Style == LEGEND_ROUND )      $this->drawRoundedFilledRectangle(...);
         elseif ( $Style == LEGEND_BOX )  $this->drawFilledRectangle(...);
         $RestoreShadow = $this->Shadow; $this->Shadow = FALSE;
         foreach($Data["Series"] as $SerieName => $Serie)
          {
           if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
            {
             $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"];
             $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
             if ( $Family == LEGEND_FAMILY_BOX )
    
          }
         $this->Shadow = $RestoreShadow;
        }

    Наша либа, которая рисует графики: функция рисующая легенду.

    jdmien, 16 Января 2011

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

    +174

    1. 1
    if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("D Index"); titleBar_setSubNav(false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);}

    Разбирал генератор документации, нашлось вот...

    wvxvw, 16 Января 2011

    Комментарии (3)
  9. Си / Говнокод #5287

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    int getRandomNumber()
    {
        return 4;   // chosen by fair dice roll.
                    // guaranteed to be random.
    }

    Sony PlayStation 3
    http://www.youtube.com/watch?v=LP1t_pzxKyE (4:13)

    Altravert, 15 Января 2011

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

    +145

    1. 1
    2. 2
    3. 3
    #ifndef UTF8_ONLY
        I HATE YOU!!!!
    #endif

    Говногость, 12 Января 2011

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

    +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
    21. 21
    22. 22
    function calls() {                                                                                                                                                                  
            //document.frm_param.form.value="client_calls";
            //document.frm_param.title_.value="Работа с клиентом | Звонки";
            s_url="$bill_cgi$?form=calls"+
                    "&date_begin=01.01.1990"+
                    "&date_end=01.01.2010"+
                    "&call_type=100"+
                    "&phone="+
                    "&to_phone="+
                    "&client=$client$"+
                    "&town_code="+
                    "&direction="+
                    "&zone="+
                    "&order_by=date_"+
                    "&order_by2="+
                    "&group_by="+
                    "&calls_recalc="+
                    "&calls_print=1";
    
            window.top.location=s_url;
    
    }

    (c) Руслан Залата

    SanityIO, 12 Января 2011

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