1. Куча / Говнокод #2346

    +124.3

    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
    Functions called:
     fflush (4 times)
     delete (11 times)
     fclose (1 times)
     free (11 times)
     fread (3 times)
     fopen (1 times)
     vsnprintf (4 times)
     new (11 times)
     SysReallocMem (652 times)
     SysFreeMem (13185 times)
     SysGetMem (13188 times)
     lstrlenA (1 times)
     lstrcpynA (4 times)
     calloc (1 times)
     strlen (98 times)
     realloc (1 times)
     strdup (1 times)
     malloc (8 times)
     memcpy (4 times)
    Resource types used:
     object (11 allocs, 11 max)
     memory block (13199 allocs, 4007 max)
     file stream (1 allocs, 1 max)
     file handle (1 allocs, 1 max)

    Nemerle, 29 Декабря 2009

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

    −409.2

    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
    import urllib, sys, string
    from string import maketrans
    
    bbb = 0
    
    f = urllib.urlopen("http://www.pythonchallenge.com/pc/def/equality.html")
    while 1:
        buf = f.read(200000)
        if not len(buf):
            break
        for x in range(len(buf)):
            if buf[x] in string.ascii_lowercase:
               if buf[x+1] in string.ascii_uppercase:
                   if buf[x-1] in string.ascii_uppercase:
                       if buf[x+2] in string.ascii_uppercase:
                           if buf[x-2] in string.ascii_uppercase:
                               if buf[x+3] in string.ascii_uppercase:
                                   if buf[x-3] in string.ascii_uppercase:
                                       if buf[x+4] in string.ascii_lowercase:
                                           if buf[x-4] in string.ascii_lowercase:
                                               bbb = x
        sys.stdout.write(buf)
        print(buf[bbb-3:bbb+4])

    http://stackoverflow.com/questions/1972693/python-challenge-level-3

    ods, 29 Декабря 2009

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

    +59.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    //и теперь шлём запрос письма
                        reply = QString("<iq type='get' from='%1' to='%2' id='mail-request-%3'>"\
                            "<query xmlns='google:mail:notify' %4 %5/></iq>")
                                .arg(from)
                                .arg(to)
                                .arg(id)
                                .arg((lastCheck.value(QString("%1").arg(account),"")=="")?QString(""):QString("newer-than-time='%1'").arg(lastCheck.value(QString("%1").arg(account))))
                                .arg((lastTid.value(QString("%1").arg(account),"")=="")?QString(""):QString("newer-than-tid='%1'").arg(lastTid.value(QString("%1").arg(account))));
                        stanzaSender->sendStanza(account, reply);

    Раскопано в недрах плагинов к psi:
    Особенно радует шедевральная конвертация int'а в строку при помощи QString("%1").arg(account),"")
    Плюс ко всему комменты на русском в интернациональном проекте это немножко моветон

    Sauron, 29 Декабря 2009

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

    +135.4

    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
    public static BitmapImage ConvertBitmapToBitmapImage(Bitmap bitmap)
            {
                var bitMapImage = new BitmapImage();
                var ms = new MemoryStream();
    
                try
                {
                    bitmap.Save(ms, ImageFormat.Bmp);
                    bitMapImage.BeginInit();
                    bitMapImage.StreamSource = ms;
                    bitMapImage.EndInit();
                }
                catch (NotSupportedException e)
                {
                    try
                    {
                        bitMapImage = new BitmapImage();
                        bitmap.Save(ms, ImageFormat.Png);
                        bitMapImage.BeginInit();
                        bitMapImage.StreamSource = ms;
                        bitMapImage.EndInit();
                    }
                    catch (NotSupportedException e2)
                    {
                        bitMapImage = new BitmapImage();
                        bitmap.Save(ms, ImageFormat.Bmp);
                        ms.Write(ms.ToArray(), 78, (int)(ms.Length - 78));
                        bitMapImage.BeginInit();
                        bitMapImage.StreamSource = ms;
                        bitMapImage.EndInit();
                    }
                }
    
                return bitMapImage;
            }

    wpf + System.Drawing + sql и хз что со всем этим делать )))))

    walash, 28 Декабря 2009

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

    +168.1

    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
    function check($pass) 
    { if (strpos($pass,'0') || strpos($pass,'1') 
        || strpos($pass,'2') || strpos($pass,'3') 
        || strpos($pass,'4') || strpos($pass,'5') 
        || strpos($pass,'6') || strpos($pass,'7') 
        || strpos($pass,'8') || strpos($pass,'9')) 
        { 
         if (strpos($pass,'a') || strpos($pass,'b') || strpos($pass,'c') 
             || strpos($pass,'d') || strpos($pass,'e') || strpos($pass,'f') 
             || strpos($pass,'g') || strpos($pass,'h') || strpos($pass,'i') 
             || strpos($pass,'j') || strpos($pass,'k') || strpos($pass,'l') 
             || strpos($pass,'m') || strpos($pass,'n') || strpos($pass,'o') 
             || strpos($pass,'p') || strpos($pass,'q') || strpos($pass,'r') 
             || strpos($pass,'s') || strpos($pass,'t') || strpos($pass,'u') 
             || strpos($pass,'v') || strpos($pass,'w') || strpos($pass,'x') 
             || strpos($pass,'y') || strpos($pass,'z')) 
             { 
              if (strpos($pass,'A') || strpos($pass,'B') || strpos($pass,'C') 
                  || strpos($pass,'D') || strpos($pass,'E') || strpos($pass,'F') 
                  || strpos($pass,'G') || strpos($pass,'H') || strpos($pass,'I') 
                  || strpos($pass,'J') || strpos($pass,'K') || strpos($pass,'K') 
                  || strpos($pass,'M') || strpos($pass,'N') || strpos($pass,'O') 
                  || strpos($pass,'P') || strpos($pass,'Q') || strpos($pass,'R') 
                  || strpos($pass,'S') || strpos($pass,'T') || strpos($pass,'U') 
                  || strpos($pass,'V') || strpos($pass,'W') || strpos($pass,'X') 
                  || strpos($pass,'Y') || strpos($pass,'Z')) 
                  {                if (ctype_lower(substr($pass,0,1)) || ctype_upper(substr($pass,0,1)) || is_numeric(substr($pass,0,1))) 
                       {                        if (ctype_lower(substr($pass,0,1))) 
                               {                             if (!ctype_lower(substr($pass,-1))) 
                                    {                                  return $pass;                                 }                            } 
                           if (ctype_upper(substr($pass,0,1))) 
                               { 
                                if (!ctype_upper(substr($pass,-1))) 
                                    { 
                                     return $pass; 
                                    } 
                               } 
                           if (is_numeric(substr($pass,0,1))) 
                               { 
                                if (!is_numeric(substr($pass,-1))) 
                                    { 
                                     return $pass; 
                                    } 
                               }                    } 
                  } 
             } 
        } }

    без коментариев. (из одного вап чата)

    [email protected], 28 Декабря 2009

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

    +162.5

    1. 1
    2. 2
    3. 3
    public function run() {
         $this->_stop();
    }

    К концу рабочего дня у себя такое обнаружил = ) Заработался.

    Johnny, 28 Декабря 2009

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

    +148

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    <? if (!$isLogged) {
        echo '
    	<table class="br-table" align="center" cellspacing="0" cellpadding="0">
    			<tr>
    			<td class="corner-lt"></td>
    			<td class="left-br-top"></td>
    			<td class="corner-rt"></td>
    			</tr>
    			<tr>
    			<td colspan="3" class="box">
    			<h1 class="h1-title" ><img src="img/star.png">';
    блаблабла

    Да, и <? if(): ?> <?endif;?> их тоже не учили :(

    azzz, 28 Декабря 2009

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

    +160.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $('input').each(function () { 
      if ($(this).attr('type') == 'text') { 
      this.className = 'textInput'; 
      } 
      if ($(this).attr('type') == 'password') { 
      this.className = 'passwordInput'; 
      } 
     }); 
     $('textarea').each(function () { 
      this.className = 'textarea'; 
     });

    это чудо было найдено здесь http://uweb.ws/publ/javascript/dobavljaem_vsem_ehlementam_input_i_texta rea_klassy/1-1-0-8

    fuckyounoob, 28 Декабря 2009

    Комментарии (12)
  9. Куча / Говнокод #2338

    +122.4

    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
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    
           <!--
    
    POSTER PHOTO
    
    -->
        <div id="poster-photo-container">
            <img src="images/photo-poster.jpg" alt="" class="poster-photo-image" />
              <div id="feature-area-home">
              
                  <div id="login" class="boxed">
    			<h2 class="title">Аккаунт пользователя</h2>
    			<div class="content">
    					<fieldset>
    					<legend>Войти</legend>
    					<label for="inputtext1">Аккаунт :</label>
    					<input id="inputtext1" type="text" name="inputtext1" value="" />
    					<label for="inputtext2">Пароль :</label>
                            <input id="inputtext2" type="password" name="inputtext2" value="" />
                            <asp:Button ID="Button1" runat="server" Text="Войти" onclick="Button1_Click" />
    
                             <p><a href="#">Забыли пароль ?</p>
    					    </a>
    					</fieldset>
    				</div>
    				
    		</div>
            </div>
        </div>
        <!--
    
    CONTENT CONTAINER
    
    -->
        <div id="content-container-two-column">
            <!--
    
    CONTENT MAIN COLUMN
    
    -->
            <div id="content-main-two-column">
                <h1>
                    <span lang="ru">Контроль измерительных приборов.</span> </h1>
                <p>
                    Consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet
                    dolore magna aliquam erat volutpat.</p>
                <div id="three-column-container">
                    <div id="three-column-side1">
                        <a href="Items.aspx">
                            <img src="images/home-photo-1.jpg" class="photo-border" alt="Enter Alt Text Here" /></a>
                        <h2>
                            <span lang="ru">Хромотографы ?</span></h2>
                        <p>
                            <span lang="ru">11111111</span></p>
                        <span lang="ru">
                        <a href="Items.aspx">Подробнее</a></span><img class="arrow" src="images/arrow.gif" alt="" /></div>
                </div>
            </div>
            <!--
    
    CONTENT SIDE COLUMN
    
    -->
            <div class="clear">
            </div>
        </div>
    </asp:Content>

    Найти DIV

    Nemerle, 28 Декабря 2009

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

    +144.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php if (!$mode || true) { ?>
    <div class="yiiForm">
    <?php } else { ?>
    <div class="yiiForm">
    <?php } ?>

    последствия удаления ненужных частей кода

    Bethrezen, 28 Декабря 2009

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