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

    +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
    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
    1.3 @@ -89,9 +89,6 @@
         1.4     public void openFile(File f) {
         1.5        try {
         1.6           Desktop.getDesktop().open(f);
         1.7 -//         String s = "cmd /c \"" + f.getAbsolutePath() + "\" ";
         1.8 -//         System.out.println(s);
         1.9 -//         java.lang.Process p = Runtime.getRuntime().exec(s);
        1.10        }
        1.11        catch (Exception e) {
        1.12           JOptionPane.showMessageDialog(null, "Ошибка при открытии файла", "Ошибка", JOptionPane.ERROR_MESSAGE);
        1.13 @@ -112,21 +109,6 @@
        1.14           temp.mkdir();
        1.15        }
        1.16        String fName = entry.getName();
        1.17 -      fName = fName.replaceAll("\\&", "_");
        1.18 -      fName = fName.replaceAll("\\(", "_");
        1.19 -      fName = fName.replaceAll("\\)", "_");
        1.20 -      fName = fName.replaceAll("\\[", "_");
        1.21 -      fName = fName.replaceAll("\\]", "_");
        1.22 -      fName = fName.replaceAll("\\{", "_");
        1.23 -      fName = fName.replaceAll("\\}", "_");
        1.24 -      fName = fName.replaceAll("\\^", "_");
        1.25 -      fName = fName.replaceAll("\\=", "_");
        1.26 -      fName = fName.replaceAll("\\!", "_");
        1.27 -      fName = fName.replaceAll("\\`", "_");
        1.28 -      fName = fName.replaceAll("\\+", "_");
        1.29 -      fName = fName.replaceAll("\\~", "_");
        1.30 -      fName = fName.replaceAll(" ", "_");
        1.31 -      fName = fName.replaceAll(("№"), "_");
        1.32        String dnFileName = temp.getName() + File.separator + fName;
        1.33  
        1.34        File dlFname = new File(dnFileName);

    Так как открытие файла происходило весьма оригинальным образом через cmd.exe - вполне логично было написано фильтрование символов, неперевариваемых этой cmd.exe.
    Как видно - задача решалась одной строкой - " Desktop.getDesktop().open(f);".

    maxt, 08 Июня 2011

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

    +147

    1. 1
    $APPLICATION->SetTitle('Хуй на рыло, чтоб душа не ныла');

    код скриптов админ-панели, взято с продакшена

    elw00d, 08 Июня 2011

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

    −88

    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
    try:
            dday = time.strftime("%d", time.localtime(os.path.getmtime(path + d))).lstrip('0')
            dmonth = time.strftime("%m", time.localtime(os.path.getmtime(path + d))).lstrip('0')
            dhour = time.strftime("%H", time.localtime(os.path.getmtime(path + d))).lstrip('0')
            dmin = time.strftime("%M", time.localtime(os.path.getmtime(path + d))).lstrip('0')
            screenpath = os.listdir(spath)
            for screen in screenpath:
                sday = time.strftime("%d", time.localtime(os.path.getmtime(spath + screen))).lstrip('0')
                smonth = time.strftime("%m", time.localtime(os.path.getmtime(spath + screen))).lstrip('0')
                shour = time.strftime("%H", time.localtime(os.path.getmtime(spath + screen))).lstrip('0')
                smin = time.strftime("%M", time.localtime(os.path.getmtime(spath + screen))).lstrip('0')
                if dday == sday:
                    if dmonth == smonth:
                        if dhour == shour:
                            if dmin == smin:
                                scr = spath + screen
                                if scr:
                                    return str(scr)
                                else:
                                    return None
        except:
            return "None"

    Проверка даты создания двух файлов

    pztrn, 08 Июня 2011

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

    +129

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    \begin{equation*}
    \begin{split}
      \Delta B_m^{(\text{Т})} &= \left(\left(\frac{\upmu_0N}{2L}\left(\frac{\frac{1}{2}L - z}{\sqrt{R^2 + (\frac{1}{2}L - z)^2}} + \frac{\frac{1}{2}L + z}{\sqrt{R^2 + (\frac{1}{2}L + z)^2}}\right)\Delta I\right)^2 + \right.\\
      &+ \left(\frac{\upmu_0NI_mD}{8L}\left(\frac{\frac{1}{2}L - z}{\sqrt{(\frac{D^2}{4} + (\frac{1}{2}L - z)^2)^3}} + \frac{\frac{1}{2}L + z}{\sqrt{(\frac{D^2}{4} + (\frac{1}{2}L + z)^2)^3}}\right)\Delta D\right)^2 + \\
      &+ \left(\frac{\upmu_0NI_m}{4L^2}\left(\frac{L(\frac{1}{2}L - z)^2}{\sqrt{(R^2 + (\frac{1}{2}L - z)^2)^3}} + \frac{L(\frac{1}{2}L + z)^2}{\sqrt{(R^2 + (\frac{1}{2}L + z)^2)^3}} - \right.\right. \\
      &- \left.\left.\frac{2z}{\sqrt{R^2 + (\frac{1}{2}L - z)^2}} + \frac{2z}{\sqrt{R^2 + (\frac{1}{2}L + z)^2}}\right)\Delta L\right)^2 + \\
      &+ \left(\frac{\upmu_0NI_m}{2L}\left(\frac{(\frac{1}{2}L - z)^2}{\sqrt{(R^2 + (\frac{1}{2}L - z)^2)^3}} - \frac{(\frac{1}{2}L + z)^2}{\sqrt{(R^2 + (\frac{1}{2}L + z)^2)^3}} - \right.\right. \\
      &- \left.\left.\left.\frac{1}{\sqrt{R^2 + (\frac{1}{2}L - z)^2}} + \frac{1}{\sqrt{R^2 + (\frac{1}{2}L + z)^2}}\right)\Delta z\right)^2 \right)^{\frac{1}{2}}
    \end{split}
    \end{equation*}

    LaTeX

    mityada, 07 Июня 2011

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

    +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
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    MACROFIRE-MACRO 5.0.0
    
    [Info]
    Name = 
    Hotkey = 
    Repeat = 1
    
    [Macro]
    ButtonsPress = Circle
    Delay = 66
    ButtonsRelease = Circle
    Delay = 83
    ButtonsPress = Circle
    Delay = 83
    ButtonsRelease = Circle
    Delay = 50
    ButtonsPress = Circle
    Delay = 66
    ButtonsRelease = Circle
    Delay = 66
    ButtonsPress = Circle
    Delay = 83
    ButtonsRelease = Circle
    Delay = 66
    ButtonsPress = Down
    Delay = 50
    ButtonsPress = Right
    Delay = 83
    ButtonsRelease = Down
    ButtonsPress = Square
    Delay = 116
    ButtonsRelease = Right
    ButtonsRelease = Square
    Delay = 266
    ButtonsPress = RTrigger
    Delay = 83
    ButtonsRelease = RTrigger
    Delay = 50
    ButtonsPress = Circle
    Delay = 66
    ButtonsRelease = Circle
    Delay = 83
    ButtonsPress = Circle
    Delay = 66
    ButtonsRelease = Circle
    Delay = 66
    ButtonsPress = Circle
    Delay = 66
    ButtonsRelease = Circle
    Delay = 49
    ButtonsPress = Circle
    Delay = 83
    ButtonsRelease = Circle
    Delay = 66
    ButtonsPress = Circle
    Delay = 50
    ButtonsRelease = Circle
    Delay = 66
    ButtonsPress = Circle
    Delay = 100
    ButtonsChange = Down
    Delay = 83
    ButtonsPress = Right
    Delay = 66
    ButtonsRelease = Down
    Delay = 100
    ButtonsPress = Triangle
    ButtonsRelease = Right
    Delay = 83
    ButtonsRelease = Triangle
    Delay = 917
    ButtonsPress = Down
    Delay = 200
    ButtonsPress = Circle
    Delay = 83
    ButtonsRelease = Circle
    Delay = 66
    ButtonsPress = Circle
    Delay = 66
    ButtonsRelease = Circle
    Delay = 83
    ButtonsPress = Circle
    Delay = 133
    ButtonsRelease = Circle
    Delay = 50
    ButtonsRelease = Down
    Delay = 83
    ButtonsPress = Left
    ButtonsPress = Up
    Delay = 166
    ButtonsChange = Left + Circle
    ButtonsRelease = Left
    Delay = 116
    ButtonsRelease = Circle

    Lambda-11 Challenge 6

    minlexx, 07 Июня 2011

    Комментарии (24)
  6. SQL / Говнокод #6883

    −121

    1. 1
    2. 2
    3. 3
    4. 4
    update RPout
    set ReserveCalculated = round((Base * ElementNorm) /100.0 + 1e-9, 2) * 
    sign(convert(money, floor(Base * ElementNorm) / 100.0)) * sign( 1 + 
    sign(convert(money, floor(Base * ElementNorm) / 100.0)))

    Отрицательные значения изменить на ноль плюс феерическая работа с типами данных.

    Blackened, 07 Июня 2011

    Комментарии (6)
  7. Java / Говнокод #6882

    +73

    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
    elem = request.getParameter("max_price");
        if ((elem != null) && (elem.trim().length() != 0)) {
          filter.setMax_price_id(elem);
          switch (Integer.parseInt(elem))
          {
          case 1:
            filter.setMax_price("price <= 10000");
            break;
          case 2:
            filter.setMax_price("price > 10000 and price <= 20000");
            break;
          case 3:
            filter.setMax_price("price > 20000 and price <= 30000");
            break;
          case 4:
            filter.setMax_price("price > 30000 and price <= 40000");
            break;
          case 5:
            filter.setMax_price("price > 50000");
          }
        }

    получение диапазона цен

    kakon, 07 Июня 2011

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

    +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
    function message($mess,$font,$border,$backgr){
    $bsize = '2';
    if ($font == "" || $border == "" || $backgr == "" ){
    $font   = '#ffffff';
    $border = 'none';
    $backgr = 'none';
    $backgr = 'none';
    $bsize = '0';
    }
    //exit();
    echo $top_pan.'<br>
    <div align="center">
    <div align="center"
    style="width: 60%; border-width: '.$bsize.'; border-style: solid;color: '.$font.'; border-color: '.$border.'; background-color: '.$backgr.';">'
    .$mess.'</div></div>'.$bottom_pan;
    
    }

    Оттуда же.
    А вообще там все можно выкладывать.

    7ion, 07 Июня 2011

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

    +161

    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
    <?php
    /*
    =====================================================
     Esay Engne Site CMS
    -----------------------------------------------------
     http://ees-co.com
    -----------------------------------------------------
     Copyright © 2010 - 2011  EES
    =====================================================
     Назначение: просмотр offline сайта
    =====================================================
    */
    
    require_once("engine/class/security_mod.php");
    $status_a = "000";
    require_once("index.php");
    
    ?>

    Esay Enigme MKS
    offline.php из корня системы.
    Долго думал.

    7ion, 07 Июня 2011

    Комментарии (10)
  10. Python / Говнокод #6879

    −167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    def word(long):
       s=''
       for j in range(0,long):
          lit =  struct.unpack('c',plik.read(1))[0]
          if ord(lit)!=0:
             s+=lit
             if len(s)>300:
                break
       return s

    WGH, 06 Июня 2011

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