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

    В номинации:
    За время:
  2. Куча / Говнокод #6474

    +130

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    <table>
      ...
      <tr>
        <td class="_r13 toggler" onclick='$("td").removeClass("selected"); $("._r13").addClass("selected")'>7</td>
        <td class="_r13 toggler" onclick='$("td").removeClass("selected"); $("._r13").addClass("selected")'>1</td>
        <td class="_r13">ПУ1</td>
        <td class="_r13">схр.</td>
        <td class="_r13">При &omega;=1; АМ=СчК</td>
        <td class="_r13">2, 4, 7, 8</td>
      </tr>
      ...
    </table>

    И так много-много раз ^^

    Surendil, 26 Апреля 2011

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

    +130

    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
    POST /a/my-domain.com/accounts/ClientLogin HTTP/1.1
    Host: www.google.com
    User-Agent: Drakma/1.2.3 (SBCL 1.0.29.11.debian; Linux; 2.6.32-30-generic; http://weitz.de/drakma/)
    Accept: */*
    Connection: close
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 97
    
    HTTP/1.1 301 Moved Permanently
    Location: /a/cpanel/my-domain.com/accounts/ClientLogin
    Content-Type: text/html; charset=UTF-8
    Content-Length: 223
    Date: Tue, 22 Mar 2011 12:44:53 GMT
    Expires: Tue, 22 Mar 2011 12:44:53 GMT
    Cache-Control: private, max-age=0
    X-Content-Type-Options: nosniff
    X-XSS-Protection: 1; mode=block
    Server: GSE
    Connection: close
    
    ;;; Ну ладно, попробуем еще раз...
    
    POST /a/cpanel/my-domain.com/accounts/ClientLogin HTTP/1.1
    Host: www.google.com
    User-Agent: Drakma/1.2.3 (SBCL 1.0.29.11.debian; Linux; 2.6.32-30-generic; http://weitz.de/drakma/)
    Accept: */*
    Connection: close
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 97
    
    HTTP/1.1 404 Not Found
    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    Pragma: no-cache
    Expires: Fri, 01 Jan 1990 00:00:00 GMT
    Date: Tue, 22 Mar 2011 12:46:32 GMT
    Content-Type: text/html; charset=UTF-8
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1; mode=block
    Server: GSE
    Connection: close

    Шутники, однако :)

    wvxvw, 22 Марта 2011

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

    +130

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    csu = 0;
    for i=1:1:devices
    	csu = csu + device_twt(i);
    end;
    csu = csu / (devices * time);
    fprintf('коэффициент использования системы = %f\n', csu);

    Говнокод на MATLAB.

    1_and_0, 21 Февраля 2011

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

    +130

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    private int FindIndexOfItemWithValue(object value)
    {
        for (int i = 0; i < base.Items.Count; i++)
        {
            object item = base.Items[i];
            if (InternalUtils.AreValuesEqual(this.SelectedValue, this.GetSelectedValue(item)))
            {
                return i;
            }
        }
        return -1;
    }

    Код комбобокса из System.Windows, Version=2.0.5.0 (Silverlight). Где тут ищется value - загадка природы.

    Unseen, 27 Января 2011

    Комментарии (2)
  6. Куча / Говнокод #5364

    +130

    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
    83. 83
    84. 84
    85. 85
    86. 86
    <td rowspan="1" colspan="3">e-mail</td>
          <td><textarea name="e-mail" rows=1 cols=10></textarea></td>
          <td>TEXTAREA</td>
        </tr>
        <tr>
          <td rowspan="1" colspan="3">Отзывы</td>
          <td><textarea name="otziv" rows=10 cols=20></textarea></td>
          <td>TEXTAREA</td>
        </tr>
        <tr>
          <td colspan="4" rowspan="1">
    	<input type="checkbox" name="news"  checked="yes">Желаете ли вы получать новости на свой e-mail факультета?
          </td>
          <td>INPUT<br>CHECKBOX</td>
        </tr>
        <tr>
          <td colspan="4" rowspan="1">
          <center>
    	<input type="reset" value="Отмена" name="Cancel">
    	<input type="submit" value="Отправить" name="Send" onClick="SendMsg();">
          </center>
          </td>
          <td>INPUT<br>RESET<br>SUBMIT</td>
        </tr>
        <tr>
          <td
     colspan="2" rowspan="3">Вход для зарегистрированных пользователей:</td>
          <td>Имя</td>
          <td><input type="text" name="name" value=""></td>
          <td>TEXT</td>
        </tr>
        <tr>
          <td>Пароль</td>
          <td><input type="password" name="password" value=""></td>
           <input type="hidden" name="recipient" value="[email protected]">
           <input type="hidden" name="subject" value="Message From My Form otzivi.html"> 
           <input type="hidden" name="required" value="name,password"> 
           <input type="hidden" name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT"> 
           <input type="hidden" name="title" value="Результаты заполнения формы"> 
           <input type="hidden" name="return_link_title" value="Назад на мою домашнюю страничку"> 
           <input type="hidden" name="bgcolor" value="white"> 
           <input type="hidden" name="text_color" value="black"> 
          <td>INPUT<br>PASSWORD</td>
        </tr>
      </tbody>
    </table>
    <p align="center"><input type="submit" value="Отправить" name="Send"></p>
    </form>
    <form enctype="multipart/form-data" action="" method=POST> Choose file upload: <input name="userfile" type="file"><br>
    Name <input type="text" name="name"><br>
    <p style="background-attachment : inherit; background-image : url('../Pictures/Alice-Cullen-twilight-movie-2185809-800-600.jpg'); background-position : center; font-family : ; table-layout : inherit;">
    <input type="submit" value="Upload file">
    </form>
    <?php
       echo $_SERVER['DOCUMENT_ROOT'];
        $FILEREPOSITORY=$_SERVER['DOCUMENT_ROOT']."/";
       if (isset($_FILES['userfile'])) {
    
          if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
    
             if ($_FILES['userfile']['type'] != "image/jpeg" & $_FILES['userfile']['type'] != "image/pjpeg" & $_FILES['userfile']['type'] & "image/gif"  ) {
                echo "<p>Homework must be uploaded in jpeg format.</p>";
             } else {
    	    include_once("connect.php");
    	    connect_db("downloads");
    	    echo "connect<br>";
                $today = @date("m-d-Y");
                echo $today;
                if (! is_dir($today)) {
                   mkdir($today);
                }
                $name = $_POST['name'];
                $result = move_uploaded_file($_FILES['userfile']['tmp_name'], $_SERVER['DOCUMENT_ROOT']."/".$today."/"."$name");
                if ($result == 1){ 
                   echo "<p>File successfully uploaded.</p>";
    		$fn=$_SERVER['DOCUMENT_ROOT']."/".$today."/".$name;
    		$query="INSERT INTO downloads(path) VALUES('$fn')";
    		mysql_query($query);
    		echo $fn;
    	      }
                else 
                   echo "<p>There was a problem uploading the homework.</p>";
             }
          }
       }
    ?>

    Закачка файла на сервер

    AliceGoth, 23 Января 2011

    Комментарии (5)
  7. Си / Говнокод #5220

    +130

    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
    char unsigned c;
    DWORD m;
    DWORD n;
    int i = 0;
    BOOL b = TRUE;
    
    HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if (hFile == INVALID_HANDLE_VALUE) 
    { 
    	printf("Could not open File");
    	return NULL;
    } 
    // узнаем размер файла
    while (b)
    {
    	b = ReadFile(hFile, &c, 1, &m, NULL);
    	if (m == 0)
    	{
    		printf("STOP ");
    		printf("%i\n", i);
    		break;
    	}
    	i++;
    }

    собственно узнаем размер файла, что тут еще скажешь)

    dIsoVi, 11 Января 2011

    Комментарии (34)
  8. C# / Говнокод #4590

    +130

    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
    if ((!(((constmonth == 1) && (Finalday > 31))
    || ((constmonth == 2) && (Finalyear % 4 == 0) && (Finalday > 29))
    || ((constmonth == 2) && (Finalyear % 4 != 0) && (Finalday> 28))
    || ((constmonth == 3) && (Finalday > 31))
    || ((constmonth == 4) && (Finalday > 30))
    || ((constmonth == 5) && (Finalday > 31))
    || ((constmonth == 6) && (Finalday > 30))
    || ((constmonth == 7) && (Finalday > 31))
    || ((constmonth == 8) && (Finalday > 31))
    || ((constmonth == 9) && (Finalday > 30))
    || ((constmonth == 10) && (Finalday > 31))
    || ((constmonth == 11) && (Finalday > 30))
    || ((constmonth == 12) && (Finalday > 31))))
    && ((((constmonth + 1 == 1) && (Finalday > 31))
    || ((constmonth + 1 == 2) && (Finalyear % 4 == 0) && (Finalday > 29))
    || ((constmonth + 1 == 2) && (Finalyear % 4 != 0) && (Finalday > 28))
    || ((constmonth + 1 == 3) && (Finalday > 31))
    || ((constmonth + 1 == 4) && (Finalday > 30))
    || ((constmonth + 1 == 5) && (Finalday > 31))
    || ((constmonth + 1 == 6) && (Finalday > 30))
    || ((constmonth + 1 == 7) && (Finalday > 31))
    || ((constmonth + 1 == 8) && (Finalday > 31))
    || ((constmonth + 1 == 9) && (Finalday > 30))
    || ((constmonth + 1 == 10) && (Finalday > 31))
    || ((constmonth + 1 == 11) && (Finalday > 30))
    || ((constmonth + 1 == 12) && (Finalday > 31)))))
    {
    if ((constmonth + 1 == 2) && (Finalyear % 4 == 0)) { Finalday = 29; }
    if ((constmonth + 1 == 2) && (Finalyear % 4 != 0)) { Finalday = 28; }
    
    switch (constmonth + 1)
    {
    case 1: Finalday = 31; break;
    case 3: Finalday = 31; break;
    case 4: Finalday = 30; break;
    case 5: Finalday = 31; break;
    case 6: Finalday = 30; break;
    case 7: Finalday = 31; break;
    case 8: Finalday = 31; break;
    case 9: Finalday = 30; break;
    case 10: Finalday = 31; break;
    case 11: Finalday = 30; break;
    case 12: Finalday = 31; break;
    }
    //constmonth++;

    GreBer, 11 Ноября 2010

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

    +130

    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
    public static string[] cInt = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
    
    ...
    
    bool cont = true;
    int i=0;
    string ss = "";
    
    ...
    
    while ((cont) && (i < e_number.Text.Length))
    {
      if (Array.IndexOf(cInt, e_number.Text[i].ToString()) > -1)
      {
        ss = ss + e_number.Text[i];
        num = Convert.ToInt32(ss);
      }
      else { cont = false; }
      i = i + 1;
    }
    if (ss == "")
    { num = 0; }

    Это повергло меня в ужас. Проверка, введено ли в e_number числовое значение и преобразование его в int.

    WalterSullivan, 28 Июля 2010

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

    +130

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    function Wait-ProcessStart{
    param([string]$PName)
    $pname = $PName
    $started = $false
    $countONstart = if((Get-Process|Where{$_.Name -eq $pname}).Length -eq $null){if((Get-Process|Where{$_.Name -eq $pname}).Name -eq $null){0}else{1}}else{(Get-Process|Where{$_.Name -eq $pname}).Length}
    while($started -eq $false){
    $ccount = if((Get-Process|Where{$_.Name -eq $pname}).Length -eq $null){if((Get-Process|Where{$_.Name -eq $pname}).Name -eq $null){0}else{1}}else{(Get-Process|Where{$_.Name -eq $pname}).Length}
    if($ccount -le $countONstart){$countONstart = $ccount;continue}
    if($ccount -gt $countONstart){$started = $true}
    }
    }

    Это мой высер вместо WMI-событий.
    Ждем запуска процесса с определенным именем.

    x0wl, 23 Июля 2010

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

    +130

    1. 1
    awk -F "" 'BEGIN{OFS=""}$890$891$892$893=="0003"{sub("5","2",$917)}{print}' < posting.dat

    Свеженькое:) Только что написал.
    Оказывается, и -F "" на что-то сгодился, зря я на него гнал.

    nil, 24 Июня 2010

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