1. Java / Говнокод #6774

    +82

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    //////////////
       TextBuilder sb = new TextBuilder();
       sb.append("<html>");
       sb.append(new StringBuilder("<head><title>" + this.getTitle() + "</title></head><body><img src=\"....\">"));
       sb.append("</body></html>");

    В детстве видимо, матрёшек было маловато..

    VirtualVoid, 28 Мая 2011

    Комментарии (14)
  2. C# / Говнокод #6773

    +120

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    using System;
    
    class C
    {
        static void Main()
        {
            क्ष(0);
        }
    
        static void क्‍ष(int x) { Console.WriteLine(1); }
        static void क्ष(object x) { Console.WriteLine(2); }
    }

    Что будет напечатано ?


    Оч понравилось, нашел на простора интырнета (пардон если повтор)

    glilya, 28 Мая 2011

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

    +164

    1. 1
    IEB = (uagent.indexOf('msie') != -1) ? true : false;

    Мартин, 28 Мая 2011

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

    +152

    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
    $datetime=strtotime($new["date"]);
        $m=date("m", $datetime);
        if($m=='01') { $month="Янв"; }
        if($m=='02') {  $month="Фев"; }
        if($m=='03') {  $month="Март"; }
        if($m=='04') {  $month="Апр"; }
        if($m=='05') {  $month="Май"; }
        if($m=='06') {  $month="Июнь"; }
        if($m=='07') {  $month="Иль"; }
        if($m=='08') {  $month="Авг"; }
        if($m=='09') {  $month="Сен"; }
        if($m=='10') {  $month="Окт"; }
        if($m=='11') {  $month="Ноя"; }
        if($m=='12') {  $month="Дек"; }
        $date = date("d", $datetime);

    http://www.askdev.ru/php/6048/%D0%A0%D0%B5%D0%B0%D0%BB%D0%B8%D0%B7%D0% B0%D1%86%D0%B8%D1%8F-%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD%D0% BE%D0%B2-%D0%BD%D0%B0-PHP/

    radioheaded, 27 Мая 2011

    Комментарии (19)
  5. Java / Говнокод #6770

    +78

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public static DBFactory getInstance() throws SQLException
    	{
    		synchronized (DBFactory.class)
    		{
    			        if (_dbinstance == null)
    				_dbinstance = new DBFactory();
    		}
    		return _dbinstance;
    	}

    Серийный и беспощадный доступ к инстансу ДБ-Фэктори -_-
    Причем, данный код фурычит в многопоточной среде, где порой по 20-30 потоков одновременно обращаются к Фэктори, чтобы взять коннект с пула.

    VirtualVoid, 27 Мая 2011

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

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (m_socket == INVALID_SOCKET)
        {
    		printf("Client: socket() - Error at socket(): %ld\n", WSAGetLastError());
           
    		WSACleanup();
    
                     return EXIT_SUCCESS;
        }

    Лаба знакомого о сетям.


    Очень, блин, SUCCESS!

    lNevermore, 27 Мая 2011

    Комментарии (32)
  7. Pascal / Говнокод #6768

    +114

    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
    procedure TForm1.Button1Click(Sender: TObject);
      var
        a,b,c,x:integer;
        chas, nedel1,nedel2,nedel3:integer;
    begin
      a:=0;
      b:=0;
      c:=0;
      repeat
        chas:= strtoint (edit1.text);
        nedel1:= strtoint (edit2.text);
        nedel2:= strtoint (edit3.text);
        nedel3:= strtoint (edit4.text);
        x:=((nedel1*a)+(nedel2*b)+(nedel3*c));
        if chas<>((nedel1*a)+(nedel2*b)+(nedel3*c)) then
          a:=a+1;
        if chas<>((nedel1*a)+(nedel2*b)+(nedel3*c)) then
          b:=b+1;
        if chas<>((nedel1*a)+(nedel2*b)+(nedel3*c)) then
          c:=c+1;
      until chas=x;
      label1.Caption:=inttostr (a);
      label2.Caption:=inttostr (b);
      label3.Caption:=inttostr (c);
    end;
    end.

    евклид плачет

    bugmenot, 27 Мая 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $str = $note['count'];
    
    $res = strpos($str, ',');
    
    if($res){echo substr($str,0,$res);}else{echo $str;}

    проверка на целое число

    sanya, 27 Мая 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    class email_selector {
    
    private static $number_per_page = 30;//
    
    public function getNumberPerPage() {
        return self::$number_per_page;
    }
    
    }

    понятно, что это только кусок класса. увидев, просто не смог не запостить....

    CRRaD, 27 Мая 2011

    Комментарии (20)
  10. Haskell / Говнокод #6765

    −357

    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
    chislo :: String -> Bool
    chislo []=True
    chislo (x:xs) =if (x=='1') then chislo xs
                   else if (x=='2') then chislo xs
                     else if (x=='3') then chislo xs
                       else if (x=='4') then chislo xs
                         else if (x=='5') then chislo xs
                           else if (x=='6') then chislo xs
                             else if (x=='7') then chislo xs
                               else if (x=='8') then chislo xs
                                 else if (x=='9') then chislo xs
                                   else if (x=='0') then chislo xs
                                     else if (x=='.') then chislo xs
    							 else False

    haskell

    resettik, 26 Мая 2011

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