1. C# / Говнокод #3770

    +111

    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
    [WebMethod]
    public PackageHoldResult RegisterHold(
        string login,
        string password,
        PackageHoldRequest holdRequest)
    {
        PackageHoldResult result = new PackageHoldResult();
        result.ResultCode = 0;
    
        try
        {
            // ...
        }
        catch
        {
            result.ResultCode = (int) PackageHoldRequestResultCode.InternalError;
        }
    
        return result;
    }

    Логирование?... что это?

    svkandroid, 23 Июля 2010

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

    +159

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    BYTE p1,p2,p3,p4;
    CString p;
    ipa.GetAddress(p1,p2,p3,p4);
    p.Format("%d.", p1);
    s = p;
    p.Format("%d.", p2);
    s += p;
    p.Format("%d.", p3);
    s += p;
    p.Format("%d", p4);
    s += p;
    AfxMessageBox(s);

    книга "Microsoft Visual Studio и MFC", автор Т. Сидорина
    ранее были объявлены
    CIPAddressCtrl ipa;
    CString s;

    s.Format ("%d.%d.%d.%d", p1, p2, p3, p4); //мы не исчем лёгких путей

    daemon_master, 23 Июля 2010

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

    −108

    1. 1
    2. 2
    3. 3
    while([item retainCount] > 1) {
        [item release];
    }

    тут правда objective-c, а не c, но смысл в том, что человек поборол утечки памяти

    psychos, 23 Июля 2010

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

    +161

    1. 1
    2. 2
    width ? width-- : width;
    height ? height-- : height;

    Ахуй нехуевый. Не говнокод, наверно, но всё же.

    Altravert, 23 Июля 2010

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

    +139

    1. 1
    2. 2
    3. 3
    4. 4
    inline Gdiplus::Color colorrefToGdiColor(COLORREF col, char alpha)
    {
    	return (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::RedMask) >> Gdiplus::Color::RedShift)) <<   Gdiplus::Color::BlueShift) | (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::GreenMask) >> Gdiplus::Color::GreenShift)) << Gdiplus::Color::GreenShift) | (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::BlueMask) >> Gdiplus::Color::BlueShift)) << Gdiplus::Color::RedShift) | (static_cast<unsigned long>(alpha) << Gdiplus::Color::AlphaShift);
    }

    Тихо себя ненавижу. Слава Б-г'у это всё выкидывается.

    Altravert, 23 Июля 2010

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

    +122

    1. 1
    Warning: file_get_contents(http://www.bbc.co.uk/radio1/programmes/schedules.xml) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/atomzone/public_html/beta/at0m.rss.class.php on line 65

    Случайно найдено на: http://atomzone.co.uk/beta/audio/Blue%20Sky%20Black%20Death
    Я все понимаю, бета и все такое, но это же паблик бета...

    wvxvw, 23 Июля 2010

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

    +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
    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
    begin
       if not directoryexists('input') then createdir('input');
       if not directoryexists('output') then createdir('output');
       if not directoryexists('temp') then createdir('temp');
       if not directoryexists('temp\temp') then createdir('temp\temp');
       if not directoryexists('temp\temp_') then createdir('temp\temp_');
       if not directoryexists('temp\temp__') then createdir('temp\temp__');
       if not directoryexists('temp\temp___') then createdir('temp\temp___');
       if not directoryexists('temp\temp____') then createdir('temp\temp____');
       if not directoryexists('temp\temp_____') then createdir('temp\temp_____');
       if not directoryexists('temp\temp______') then createdir('temp\temp______');
       if not directoryexists('temp\temp_______') then createdir('temp\temp_______');
       if not directoryexists('temp\temp________') then createdir('temp\temp________');
       if not directoryexists('temp\temp_________') then createdir('temp\temp_________');
       if not directoryexists('temp\temp__________') then createdir('temp\temp__________');
       if not directoryexists('temp\temp___________') then createdir('temp\temp___________');
       if not directoryexists('temp\temp____________') then createdir('temp\temp____________');
       if not directoryexists('temp\temp_____________') then createdir('temp\temp_____________');
       if not directoryexists('temp\temp______________') then createdir('temp\temp______________');
       if not directoryexists('temp\temp_______________') then createdir('temp\temp_______________');
       if not directoryexists('temp\temp________________') then createdir('temp\temp________________');
       print_('Вас приветствует программа для сортировки слвоарей True Sort');
       print_('Если у вас есть какие-то вопросы по её работе - нажмите Help');
       turbo:=false;
    end;

    Кинул знаковый в асю=\

    BlincAttack, 23 Июля 2010

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

    +171

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?php 
    
    $visitor = $_SERVER['REMOTE_ADDR']; 
    if (preg_match("/217.66.26.85/",$visitor))  
    {header('Location: http://site.ru/page.html');} 
    
    ?>

    http://forum.searchengines.ru/showpost.php?p=7312251&postcount=1

    GoodTalkBot, 22 Июля 2010

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

    +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
    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
    #include <cstdio>
    #include <memory.h>
    
    #define maxn 18
    
    char c[maxn][maxn];
    int d[1 << maxn];
    
    int main()
    {
      freopen("network.in", "rt", stdin);
      freopen("network.out", "wt", stdout);
      
      int n; scanf("%d", &n);
      for (int i = 0; i < n; i++)
        scanf("%s", c[i]);
        
      memset(d, 0, sizeof(d));
      
      for (int k = 0; k < (1 << n); k++)
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++)
            if (c[i][j] == 'Y' && k & (1 << i) && k & (1 << j) && d[k - (1 << i) - (1 << j)] + 2 > d[k])
              d[k] = d[k - (1 << i) - (1 << j)] + 2;
              
      int max = 0;
      for (int i = 0; i < (1 << n); i++)
        if (d[i] > max)
          max = d[i];
          
      printf("%d\n", max);
      
      return 0;
    }

    ACM-задачка на динамику по подмножествам.
    Кто поймет, тому 5 ;)

    ystepanov, 22 Июля 2010

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

    +129

    1. 1
    2. 2
    {{ object.xml_data.file.read|safe }}
    {% if object.xml_data.file.close %}{% endif %}

    Мой говнокод. Django template. Не хотелось писать отдельный view, забацал все в шаблоне + generic views. Лень страшная сила)
    object.xml_data обычный FileField

    sbb, 22 Июля 2010

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