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

    +75

    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
    //...
            Hashtable somehash = new Hashtable();
    //...
    
            public String keyByValue (String value) {
                String s;
    
                    while (somehash.elements().hasMoreElements()) {
                        s = (String) somehash.elements().nextElement(); //!!!
    
                        if (s.equals(value)) { //!!!
                         return s;
                        }
                    }
                return null;
            }

    Cr0s, 05 Ноября 2010

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

    +150

    1. 1
    2. 2
    3. 3
    $stat_connect = @mysql_connect("stats.amxbans.de","amxbstats","");
    *skipped…*
    @mysql_close($stat_connect) or die(mysql_error());

    desagr, 05 Ноября 2010

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

    −158

    1. 1
    2. 2
    ParticleArray.push(new ParticleExplosion());
    var par:ParticleExplosion = ParticleArray[ParticleArray.length - 1];

    Запихнуть в массив, а потом сразу же выдернуть, чтобы с этим поработать ))

    NeonSelf, 05 Ноября 2010

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

    +165

    1. 1
    alert(( (/([^(A-z)&&(А-я)])/ || prompt.length<1 ).test(prompt('Введите Ваше имя',''))) ? 'Ошибка' : 'Принято')

    Не совсем говнокод, просто весёлый бред. Найдено здесь http://tinyurl.com/22w4b8q

    eval, 05 Ноября 2010

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

    +151

    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
    void TPEForm::LoadFromFile(AnsiString _FileName)
    {
        FileName = _FileName;
        Caption = FileName + " - " + DOS_HEADER_STRING;
        iPEFileHandle = FileOpen(FileName,fmOpenRead);
        FileRead(iPEFileHandle,&dos_header,sizeof(IMAGE_DOS_HEADER));
        TreeView->Items->AddChild(NULL,DOS_HEADER_STRING);
        dos_header_frame = new TDOSHeader(this);
        dos_header_frame->Parent = Panel;
        dos_header_frame->e_magic->Text = "0x"+IntToHex(dos_header.e_magic,4);
        dos_header_frame->e_cblp->Text = "0x"+IntToHex(dos_header.e_cblp,4);
        dos_header_frame->e_cp->Text = "0x"+IntToHex(dos_header.e_cp,4);
        dos_header_frame->e_crlc->Text = "0x"+IntToHex(dos_header.e_crlc,4);
        dos_header_frame->e_cparhdr->Text = "0x"+IntToHex(dos_header.e_cparhdr,4);
    ...
        dos_header_frame->e_ovno->Text = "0x"+IntToHex(dos_header.e_ovno,4);
        dos_header_frame->e_oemid->Text = "0x"+IntToHex(dos_header.e_oemid,4);
        dos_header_frame->e_oeminfo->Text = "0x"+IntToHex(dos_header.e_oeminfo,4);
        dos_header_frame->e_lfanew->Text = "0x"+IntToHex((int)dos_header.e_lfanew,4);
    
    ...
    
        TreeView->Items->AddChild(nt_header_node,FILE_HEADER_STRING);
        file_header_frame = new TFileHeader(this);
        file_header_frame->Parent = Panel;
        file_header_frame->Machine->Text = "0x"+IntToHex((int)nt_header.FileHeader.Machine,4);
        file_header_frame->NumberOfSections->Text = "0x"+IntToHex((int)nt_header.FileHeader.NumberOfSections,4);
        file_header_frame->TimeDateStamp->Text = "0x"+IntToHex((int)nt_header.FileHeader.TimeDateStamp,8);
        file_header_frame->PointerToSymbolTable->Text = "0x"+IntToHex((int)nt_header.FileHeader.PointerToSymbolTable,8);
        file_header_frame->NumberOfSymbols->Text = "0x"+IntToHex((int)nt_header.FileHeader.NumberOfSymbols,8);
        file_header_frame->SizeOfOptionalHeader->Text = "0x"+IntToHex((int)nt_header.FileHeader.SizeOfOptionalHeader,4);
        file_header_frame->Characteristics->Text = "0x"+IntToHex((int)nt_header.FileHeader.Characteristics,4);
    
        TTreeNode *optional_header_node = TreeView->Items->AddChild(nt_header_node,OPTIONAL_HEADER_STRING);
        optional_header_frame = new TOptionalHeader(this);
        optional_header_frame->Parent = Panel;
    
        TreeView->Items->AddChild(optional_header_node,STANDARD_FIELDS_STRING);
        standard_fields_frame = new TStandardFieldsFrame(this);
        standard_fields_frame->Parent = Panel;
        TTreeNode *additional_fields_node = TreeView->Items->AddChild(optional_header_node,ADDITIONAL_FIELDS_STRING);
        additional_fields_frame = new TAdditionalFieldsFrame(this);
        additional_fields_frame->Parent = Panel;
    
        standard_fields_frame->Magic->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.Magic,4);
        standard_fields_frame->MajorLinkerVersion->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.MajorLinkerVersion,2);
    ...
        additional_fields_frame->ImageBase->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.ImageBase,8);
        additional_fields_frame->SectionAlignment->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.SectionAlignment,8);
        additional_fields_frame->FileAlignment->Text = "0x"+IntToHex((int)nt_header.OptionalHeader.FileAlignment,8);
    
    ...

    писал на третьем курсе загрузку заголовка PE-файлов в GUI

    stas, 05 Ноября 2010

    Комментарии (6)
  6. 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)
  7. PHP / Говнокод #4535

    +164

    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
    $img_type = ".jpg";
    $s = getimagesize($image);
    if ($s[2] == "1") {
    $img_type = ".gif";
    } elseif ($as2] == "3") {
    $img_type = ".png";
    }
    if ($img_type == ".jpg") {
    $img = imagecreatefromjpeg($image);
    } elseif($img_type == ".gif") {
    $img = imagecreatefromgif($image);
    } elseif ($img_type == ".png") {
    $img = imagecreatefrompng($image);
    }
    $im = add_watermark($img, $image, $watermark);
    if ($img_type == ".jpg") {
    imagejpeg($im, $image, 85);
    } elseif { ($img_type == ".gif")
    imagegif($im , $image);
    } elseif { ($img_type == ".png")
    imagepng($im , $image);
    }

    Накладываем водяной знак на изображение

    Мартин, 04 Ноября 2010

    Комментарии (16)
  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. PHP / Говнокод #4533

    +187

    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
    function get_rand_symbols($numeric) { 
    
       if($numeric == '1') { return 'п'; }
       if($numeric == '2') { return 'р'; }
       if($numeric == '3') { return 'о'; }
       if($numeric == '4') { return 'к'; }
       if($numeric == '5') { return 'е'; }
       if($numeric == '6') { return 'а'; }
       if($numeric == '7') { return 'д'; }
       if($numeric == '8') { return 'е'; }
       if($numeric == '9') { return 'й'; }
       if($numeric == '10') { return 'в'; }
       if($numeric == '11') { return 'м'; }
       if($numeric == '12') { return 'л'; }
       if($numeric == '13') { return 'с'; }
       if($numeric == '14') { return 'т'; }
       if($numeric == '15') { return 'у'; }
       if($numeric == '16') { return 'н'; }
       if($numeric == '17') { return 'ш'; }
       if($numeric == '18') { return 'х'; }
       if($numeric == '19') { return 'щ'; }
       if($numeric == '20') { return 'ъ'; }
       if($numeric == '21') { return 'ю'; }
       if($numeric == '22') { return 'б'; }
       if($numeric == '23') { return 'я'; }
       if($numeric == '24') { return 'ц'; }
       if($numeric == '25') { return 'ч'; }
       if($numeric == '26') { return 'ё'; }
       if($numeric == '27') { return 'э'; }
       if($numeric == '28') { return 'з'; }
       if($numeric == '29') { return 'и'; }
       if($numeric == '30') { return 'ы'; }
      }
      function all_rand() {
      return get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30)).get_rand_symbols(rand(1, 30));
      }

    случайная строка с русскими символами

    Shiz89, 04 Ноября 2010

    Комментарии (165)
  10. SQL / Говнокод #4532

    −196

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    SELECT SQL_CALC_FOUND_ROWS h.hotel_id , h.class, h.review_score, hr.view_count, MIN(r.min_price) as min_price 
    FROM hotel_facility hf11, hotel_facility hf39, hotel h 
    LEFT JOIN hotels.room r ON r.hotel_id = h.hotel_id 
    LEFT JOIN hotels.hotel_reiting_our hr ON h.hotel_id = hr.hotel_id 
    WHERE h.is_closed != 1 AND city_id=2760 and h.hotel_id = hf11.hotel_id and h.hotel_id = hf39.hotel_id AND hf11.hotelfacilitytype_id = 11 AND hf39.hotelfacilitytype_id = 39 
    GROUP BY h.hotel_id 
    ORDER BY h.ranking DESC;

    rO_ot, 04 Ноября 2010

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