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

    +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
    $sql = "SELECT aps.* FROM apps_applicationinterfaceincoming aps
    WHERE aps.applicationid = '$id' ORDER BY aps.name ASC";
                           $Result = $Database->query( $sql );
                           foreach( $Result as $aResult )
                           {
                                   $editIcon = Common_Image_Icon_Overlay::fetchIcon(
    Common_Image_Icon_Overlay::EDIT, _('Edit interface' ),
    '/apps/serveroverlay.php?table=apps_applicationinterfaceincoming&edit=1&mode='.AppsEnvironment::iVIEWMODE_EDIT.'&id='.$aResult['id']
    );
                                   $deleteIcon = Common_Image_Icon_Ajax::fetch(
    Common_Image_Icon_Ajax::DELETE, array( 'aLinkAttributes' => array(
    'onclick' => "new Browser.Http.Ajax.Updater( '#interfacein',
    '/apps/interfacein_ajax.php?action=remove&id={$aResult['id']}' );" ) )
    );
                                   $html .= <<<EOF
                                                   <tr>
                                                           <td>{$aResult['name']}</td>
                                                           <td>{$aResult['frequency_data_transfers']}</td>
                                                           <td>{$aResult['type_of_interface']}</td>
                                                           <td>{$aResult['internal_external']}</td>
                                                           <td>{$aResult['description']}</td>
                                                           <td class="actions">{$editIcon} {$deleteIcon}</td>
                                                   </tr>
    EOF;
                           }
                           $html .= <<<EOF
                                           </tbody>
                                   </table>
                           </fieldset>
    EOF;

    PHP Bestpractice php + sql + html + js in one file
    или даэже in one String.

    ... 800 строк в том же духе. (толко в етом файле)

    andrejlr, 10 Октября 2011

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

    +126

    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
    //javax.swing.JTree
                public void setBounds(Rectangle r) {
                    AccessibleContext ac = getCurrentAccessibleContext();
                    if (ac instanceof AccessibleComponent) {
                        ((AccessibleComponent) ac).setBounds(r);
                    } else {
                        Component c = getCurrentComponent();
                        if (c != null) {
                            c.setBounds(r);
                        }
                    }
                }
            
                public void setSize (Dimension d) {
                    AccessibleContext ac = getCurrentAccessibleContext();
                    if (ac instanceof AccessibleComponent) {
                        ((AccessibleComponent) ac).setSize(d);
                    } else {
                        Component c = getCurrentComponent();
                        if (c != null) {
                            c.setSize(d);
                        }
                    }
                }  
        
    
                public void requestFocus() {
                    AccessibleContext ac = getCurrentAccessibleContext();
                    if (ac instanceof AccessibleComponent) {
                        ((AccessibleComponent) ac).requestFocus();
                    } else {
                        Component c = getCurrentComponent();
                        if (c != null) {
                            c.requestFocus();
                        }
                    }
                }
        
                public void addFocusListener(FocusListener l) {
                    AccessibleContext ac = getCurrentAccessibleContext();
                    if (ac instanceof AccessibleComponent) {
                        ((AccessibleComponent) ac).addFocusListener(l);
                    } else {
                        Component c = getCurrentComponent();
                        if (c != null) {
                            c.addFocusListener(l);
                        }
                    }
                }
                public boolean isFocusTraversable() {
                    AccessibleContext ac = getCurrentAccessibleContext();
                    if (ac instanceof AccessibleComponent) {
                        return ((AccessibleComponent) ac).isFocusTraversable();
                    } else {
                        Component c = getCurrentComponent();
                        if (c != null) {
                            return c.isFocusTraversable();
                        } else {
                            return false;
                        }
                    }
                }

    3.14159265, 10 Октября 2011

    Комментарии (50)
  3. Java / Говнокод #8142

    +77

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public static void main(final String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
        try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          JFrame.setDefaultLookAndFeelDecorated(false);
          JDialog.setDefaultLookAndFeelDecorated(false);
        } finally {
          new ImageMaps().start();
        }
      }

    НАКОНЕЦ запускаю десктоп-приложение.
    Не знаю как вам, а по мне - выглядит весьма странно.

    Lure Of Chaos, 10 Октября 2011

    Комментарии (153)
  4. Pascal / Говнокод #8141

    +89

    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
    unit uIsPalindrome; 
      
    interface
      
    function IsPalindrome(const aString: string): Boolean; 
      
    implementation
      
    uses
           Spring.Collections 
         , {$IF CompilerVersion >= 230}System.{$IFEND}SysUtils 
         ; 
      
    function CleanString(const aString: string): string; 
    var
      C: char; 
    begin
      // Remove all non-alpha chars and make all lower case 
      // Spaces don't matter, so let's count only letters 
      Result := ''; 
      for C in LowerCase(aString) do
      begin
        if CharInSet(C, ['a'..'z', 'A'..'Z']) then
        begin
          Result := Result + C; 
        end; 
      end; 
    end; 
      
    function IsPalindrome(const aString: string): Boolean; 
    var
      Stack: IStack<Char>; 
      C: Char; 
      NoSpaces: string; 
      Temp: string; 
    begin
      NoSpaces :=  CleanString(aString); 
      
      Stack := TCollections.CreateStack<Char>; 
      for C in NoSpaces do
      begin
        Stack.Push(C); 
      end; 
      Temp := ''; 
      repeat
        Temp := Temp + Stack.Pop; 
      until Stack.Count = 0; 
      Result := Temp = NoSpaces; 
    end; 
      
    end.

    true java style...

    d_dev, 10 Октября 2011

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

    +170

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    //...
    include_once("includes/global.php");
    //check_license("license/license.zl");
    db_connection();
    //...

    jokz, 10 Октября 2011

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

    +150

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $login='55526723433';
    for($n=0; $n!=strlen($login)-2; $n++)
    {
    	if( $login[$n] == $login[$n+1] && $login[$n] == $login[$n+2] )
    	{
    		echo 'есть повторение';
    		exit;
    	}
    }

    снова на ваш суд))

    суть проблемы: проверка содержания строки, есть ли более двух одинаковых символов.

    beetle, 09 Октября 2011

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

    +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
    class array
    {
        int data[256];
        int p;
    
    public:
        array ():
            p (0)
        {}
    
        array & operator , (int a)
        {
            data[p++] = a;
            return *this;
        }
    
        array & operator = (const array & arr)
        {
            p = 0;
            memcpy (data, arr.data, sizeof (data));
            return *this;
        }
    
        int & operator [] (size_t i)
        {
            return data[i];
        }
    };
    
    #define _I array(),
    #define I_
    #define o_O ,
    
    int _tmain(int argc, _TCHAR* argv[])
    {
        array arr;
        arr = _I 1,2,3,4,5,6 I_;    // init
        arr o_O 7,8,9,10;           // append new
        arr o_O 11 o_O 12;          // append new
    }

    http://www.gamedev.ru/flame/forum/?id=153265#m4

    RS-232, 09 Октября 2011

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

    +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
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    var BrowserDetect={
    init: function () {
    this.browser=this.searchString(this.dataBrowser) || "An unknown browser";
    this.version=this.searchVersion(navigator.userAgent)
    || this.searchVersion(navigator.appVersion)
    || "an unknown version";
    this.OS=this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function (data) {
    for (var i=0;i<data.length;i++) {
    var dataString=data[i].string;
    var dataProp=data[i].prop;
    this.versionSearchString=data[i].versionSearch || data[i].identity;
    if (dataString) {
    if (dataString.indexOf(data[i].subString) !=-1)
    return data[i].identity;
    }
    else if (dataProp)
    return data[i].identity;
    }},
    searchVersion: function (dataString) {
    var index=dataString.indexOf(this.versionSearchString);
    if (index==-1) return;
    return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    },
    dataBrowser: [
    {
    string: navigator.userAgent,
    subString: "Chrome",
    identity: "Chrome"
    },
    {  string: navigator.userAgent,
    subString: "OmniWeb",
    versionSearch: "OmniWeb/",
    identity: "OmniWeb"
    },
    
    },
       ...... // сокращу 
    {
    string: navigator.userAgent,
    subString: "MSIE",
    identity: "Explorer",
    versionSearch: "MSIE"
    },
    {
    string: navigator.userAgent,
    subString: "Gecko",
    identity: "Mozilla",
    versionSearch: "rv"
    },
    {
    string: navigator.userAgent,
    subString: "Mozilla",
    identity: "Netscape",
    versionSearch: "Mozilla"
    }
    ],
    dataOS : [
    {
    string: navigator.platform,
    subString: "Win",
    identity: "Windows"
    },
    {
    string: navigator.platform,
    subString: "Mac",
    identity: "Mac"
    },
    {
    string: navigator.userAgent,
    subString: "iPhone",
    identity: "iPhone/iPod"
    },
    {
    string: navigator.platform,
    subString: "Linux",
    identity: "Linux"
    }
    ]
    };
    BrowserDetect.init();

    Самое интересное, что после сего мудозвонства в коде идет : google.load("jquery", "1"); ради одной карусельки.

    http://sng.garena.com/ - вот здесь этот стыд, и много-много чего еще интересного.

    jQuery, 09 Октября 2011

    Комментарии (15)
  9. 1C / Говнокод #8136

    −154

    1. 1
    2. 2
    Задача о двух стеках. Как продвигается решение?
    Через 2 часа будет рабочий вариант.

    alexoy, 09 Октября 2011

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

    +141

    1. 1
    http://www.google.com/insights/search/#q=c%2B%2B&date=today%203-m&cmpt=q

    OH SHI~

    Uhehesh, 09 Октября 2011

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