1. bash / Говнокод #16771

    −118

    1. 1
    set -xexexe

    из тестового скрипта. началось все с очепятки.

    в дурмане тупого писания тупых тестов, не мог остановится хихикать.

    Dummy00001, 27 Сентября 2014

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

    +57

    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
    class C3D
    {
    public:
      //C3D()  {}  // Constructor
      //~C3D()  {}  // Destructor
    
      void(*init)(float R, float A, float B, float Rmin, float Rmax, float Bmin, float Bmax);  // Initialize work with 3D standard camera
      void(*setCamera)(int iType);  // Set type of camera
      void(*setPosition)(float x, float y, float z);  // Set position
      void(*setRender3D)();
      UINT(*addMesh)(LPCWSTR sMesh);  // Add Mesh
      void(*renderMesh)(UINT idMesh, float x, float y, float z);
      void(*renderMeshSubset)(UINT idMesh, UINT idSubset, float x, float y, float z);
      void(*renderMeshSubsetRotateX)(UINT idMesh, UINT idSubset, float x, float y, float z, float a);
    // простыня указателей на функции урезана
    
      void setHModule(HMODULE hLib)
      {
        m_hLib = hLib;
    
        (FARPROC &)init = GetProcAddress(m_hLib, "init3D");  // Initialize work with 3D standard camera
        (FARPROC &)setCamera = GetProcAddress(m_hLib, "setCamera");  // Set type of camera
        (FARPROC &)setPosition = GetProcAddress(m_hLib, "setPosition");  // Set position
        (FARPROC &)setRender3D = GetProcAddress(m_hLib, "setRender3D");
        (FARPROC &)addMesh = GetProcAddress(m_hLib, "addMesh");  // Add Mesh
        (FARPROC &)renderMesh = GetProcAddress(m_hLib, "renderMesh");
        (FARPROC &)renderMeshSubset = GetProcAddress(m_hLib, "renderMeshSubset");
        (FARPROC &)renderMeshSubsetRotateX = GetProcAddress(m_hLib, "renderMeshSubsetRotateX");
    // простыня GetProcAddress урезана
      }
    
    protected:
      HMODULE  m_hLib;  // NetWars.dll
    };

    Некий SDK для MMO-игр за авторством одного известного разработчика.

    bazhenovc, 25 Сентября 2014

    Комментарии (50)
  3. Java / Говнокод #16768

    +80

    1. 1
    2. 2
    3. 3
    if (!driver.findElement(By.id(DD_LAUNCH_ID)).equals(null)) {
        pause(1000);
    }

    Тогда уж почему не null.equals(...)?

    Actine, 25 Сентября 2014

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

    +60

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    vector <float> items; 
    float *x;
    for(int i = 0; i<100; i++) { 
      x = new float; 
      *x = 1.0f; 
      items.push_back(*x); 
    };

    оттуда...

    Try, 25 Сентября 2014

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

    +138

    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
    public List<string> AutoPublishProjectDepartmentNames { get; private set; }
            public string AutoPublishProjectDepartments
            {
                get { return _projectDepartments; }
                set
                {
                    _projectDepartments = value;
    
                    AutoPublishProjectDepartmentNames.Clear();
                    var departments = _projectDepartments.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    //Get EPT Names
                    foreach (var department in departments)
                    {
                        try
                        {
                            if (department.Length == 36 || department.Length == 38)
                            {
                                var departmentUid = new Guid(department);
                                AutoPublishProjectDepartmentNames.Add(SqlInstance.GetDepartmentName(departmentUid));
                                continue;
                            }
                        }
                        catch (FormatException)
                        {
                        }
    
                        //Not a guid
                        AutoPublishProjectDepartmentNames.Add(department);
                    }
                }
            }

    Очень хитрая пропертя, пока не засетишь одну пропертю - другая не будет работать. А еще она с гуидами работает. Ооочень хитрая. Юсфуль-туль.

    boades, 25 Сентября 2014

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

    +118

    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
    import static com.google.gwt.query.client.GQuery.*;
    import com.google.gwt.query.client.Function;
    
    public void onModuleLoad() {
      //Hide the text and set the width and append an h1 element
      $("#text").hide()
        .css("width", "400px")
        .prepend("<h1>GwtQuery Rocks !</h1>");
        
        //add a click handler on the button
        $("button").click(new Function(){
          public void f() {
            //display the text with effects and animate its background color
            $("#text").as(Effects)
              .clipDown()
              .animate("backgroundColor: 'yellow'", 500)
              .delay(1000)
              .animate("backgroundColor: '#fff'", 1500);
          }
        });
    }

    Не ГК, но мне показалось забавно.

    https://code.google.com/p/gwtquery/

    someone, 25 Сентября 2014

    Комментарии (12)
  7. JavaScript / Говнокод #16763

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    var shops=new Array();
    shops[shops.length] = new Array('',' ');
    shops[shops.length] = new Array(' The Jewel Box', '135956406_923');
    shops[shops.length] = new Array(' Склад 1', '135956406_923');

    И таких вызовов порядка 2к

    via http://pickpoint.ru/monitoring/

    kopoBko, 24 Сентября 2014

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

    +59

    1. 1
    2. 2
    3. 3
    4. 4
    std::transform( keyframes.begin(), keyframes.end(), std::back_inserter( result ),
          boost::bind( & qMakePair< KeyframeType::first_type, KeyframeType::second_type >,
             boost::bind( & Prm::TType::view, _1 ),
             boost::bind( & Prm::Time::value, boost::bind( & Prm::TType::time, _1 ) ) ) );

    boost bind головного мозга

    QBatman, 24 Сентября 2014

    Комментарии (143)
  9. SQL / Говнокод #16761

    −119

    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
    select *
      from (  select ... ,
                     case
                        when     txn_minute >= date '2014-08-01'
                             and txn_minute < date '2014-08-02'
                        then
                           '1 августа'
                        when     txn_minute >= date '2014-08-02'
                             and txn_minute < date '2014-08-03'
                        then
                           '2 августа'
                        when     txn_minute >= date '2014-08-03'
                             and txn_minute < date '2014-08-04'
                        then
                           '3 августа'
                        when     txn_minute >= date '2014-08-04'
                             and txn_minute < date '2014-08-05'
                        then
                           '4 августа'
                        when     txn_minute >= date '2014-08-05'
                             and txn_minute < date '2014-08-06'
                        then
                           '5 августа'
                       ..... 
                        when     txn_minute >= date '2014-08-31'
                             and txn_minute < date '2014-09-01'
                        then
                           '31 августа'
                     end
                        "Дата"
                from txn
               where     txn_minute >= date '2014-08-01'
                     and txn_minute < date '2014-09-01'
            group by ..... 
                    ..... 
                     end) pivot (sum (am)
                          for "Дата"
                          in  ('1 августа',
                    .....
                              '29 августа',
                              '30 августа',
                              '31 августа'))

    Кто-то подсказал правильное решение :-)

    Djayn, 24 Сентября 2014

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    $q=  mysql_query("select * from BillingParam where Name like ('%  %')");
    
    while($r=mysql_fetch_object($q)){
        $name=str_replace("  ", " ", $r->Name);
        $que="update BillingParam set Name='".$name."' where ID='".$r->ID."'";
        echo $que."<br>";
    
    $qq=mysql_query($que)or die(mysql_error());

    Нужно больше, ещё больше запросов к базе!

    Khvorostin, 24 Сентября 2014

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