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

    В номинации:
    За время:
  2. C# / Говнокод #1928

    +137.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
    26. 26
    27. 27
    28. 28
    private ArrayList GetSubscribers(string condition)
            {
               ArrayList subscribers = new ArrayList();
               ArrayList lst =  new user_category_notification().Factory.GetItems(condition, "user_category_notification.id_user");
                ArrayList distinc_lst = new ArrayList();
                ArrayList distinc_lst_ids = new ArrayList();
                ArrayList lst_ids = new ArrayList();
                for (int i = 0; i < lst.Count; i++)
                {
                    lst_ids.Add(((user_category_notification) lst[i]).id_user);
                }
                for (int i = 0; i < lst_ids.Count;i++ )
                {
                    if (distinc_lst_ids.Contains(lst_ids[i])) continue;
                    else
                    {
                        distinc_lst.Add(lst[i]);
                        distinc_lst_ids.Add(lst_ids[i]);
                    }
                }
                foreach (user_category_notification _un in distinc_lst)
                {
                    user _current = (user)new user().Factory.GetByID(_un.id_user);
                    subscribers.Add(_current);
                }
                
                return subscribers;
            }

    Филтрация :)

    bugotrep, 02 Октября 2009

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

    +146.1

    1. 1
    function move($oldname, $newname, $context=null) { retrurn rename($oldname, $newname, $context); }

    greevex, 30 Сентября 2009

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

    +66.6

    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
    package parseit;
    
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    
    public class MysqlConn {
    
        private volatile static Connection instance;
    
        private  MysqlConn() {
        }
    
        public static Connection getInstance() {
    
            try {
                if (instance == null) {
                    synchronized (MysqlConn.class) {
                        if (instance == null) {
                            instance = DriverManager.getConnection("jdbc:mysql://***:3306/******?user=******&password=*******");
                        }
                    }
                }
            } catch (SQLException ex) {
            }
            return instance;
        }
    }

    Объясните почему System.out.println(MysqlConn.getInstance ()); выводит null

    5838151, 30 Сентября 2009

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

    +83.5

    1. 1
    2. 2
    3. 3
    for (Person p : c) {
                return p;
            }

    yvu, 28 Сентября 2009

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

    +95.6

    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
    try
    {
        foreach (Control con in Parent.Parent.Parent.Parent.Parent.Parent.Controls)
        {
            if (con.Name == "numbersPanel")
            {
                ((NumbersPanel)con).sender = (TextBox)sender;
                break;
            }
        }
    }
    catch
    {
    }

    Отыскал в коде winforms приложения гениальнейший способ поиска контрола по имени.
    Теперь Parent.Parent.Parent.Parent придет за мной!

    tonic, 24 Сентября 2009

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

    +66.8

    1. 1
    bind "attack" kill

    Классика консоли CS

    Сан Саныч, 24 Сентября 2009

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

    +159.6

    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
    class SomeClass {
    ...
    	public function get_stop_words(){
    	    $stem_stop_words = array();
    		....
    	    return $stem_stop_words;
    	}
    ...
    }
    
    //далее в коде:
    
    $someClass = new SomeClass();
    if($someClass->connect()){
        $someClass->stem_stop_words = $someClass->get_stop_words();
        ....
    }

    ООП не для нас. Причем $this->stem_stop_words не объявлена в классе.

    VermiVermi, 23 Сентября 2009

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

    +158.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
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    <?php
    
    function secure2() {
        secure();
    }
    
    function secure() {
        secure3();
    }
    
    function secure3() {
        if (!check_session()) {
            $cookie = try_cookie();
            tiny_login($cookie['login'], $cookie['pass'], 1);
            if (check_session()) {
                $ret = true;
            } else {
                $ret = false;
            }
        } else {
            $ret = true;
        }
    
        if (!$ret) {
            $_SESSION['loginerror'] = 'Ошибка авторизации';
            header('location:(ссылка)');
        }
    }
    
    ?>

    В догонку к http://govnokod.ru/1820 по просьбе в комментах
    Реальный код из реального проекта. Что самое интересное — используется secure2
    Как оно работает для меня — загадка.

    Shock, 19 Сентября 2009

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

    +64.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    ReturnType SomeFunction(...)
    {
      ...
      {
        Mutex mutex;
        Mutex::ScopedLock lock(mutex);
        ...
      }
      ...
    }

    убер синхронизация

    g26g, 18 Сентября 2009

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

    +160.6

    1. 1
    2. 2
    3. 3
    $query=mysql_query("SELECT * FROM `PS_card_list` WHERE `id_categ`='".$_GET['point']."';");
    
    while ($row=mysql_fetch_array($query)) $card_on_plan++;

    Наследие военных разработчиков

    vectart, 17 Сентября 2009

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