1. JavaScript / Говнокод #2445

    +168.4

    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 IsNumeric(sText)
    {
       var ValidChars = "0123456789.";
       var IsNumber=true;
       var Char;
    
     
       for (i = 0; i < sText.length && IsNumber == true; i++) 
          { 
              Char = sText.charAt(i); 
              if (ValidChars.indexOf(Char) == -1) 
             {
                IsNumber = false;
             }
          }
       return IsNumber;
     }

    Только что нашел на нашем сайте. Просто слов нет...
    А это из выдержка ис его послужного списка:

    Current
    R&D Team Leader at Dynamic Video
    Past
    R&D Software Architect at FIS
    Senior software engineer at Berale Software Solutions LTD

    wvxvw, 19 Января 2010

    Комментарии (11)
  2. Java / Говнокод #2444

    +76.4

    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
    public String getServiceClient(final Service service) {
            SqlDao dao = (SqlDao) getBean("sqlDao");
            return (String) dao.getTemplate().query(SQL_GET_CLIENT, new Long[]{service.getClient().getId()}, new ResultSetExtractor() {
                public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
                    String result;
                    SqlDao dao = (SqlDao) getBean("sqlDao");
                    rs.next();
                    if (rs.getInt("IS_ORG") == 1) {
                        result = (String) dao.getTemplate().query(SQL_GET_LEGAL_INFO, new Long[]{service.getClient().getId()}, new ResultSetExtractor() {
                            public Object extractData(ResultSet rsi) throws SQLException, DataAccessException {
                                if (rsi.next()) {
    			        return rsi.getString("C_INN") + ", " + rsi.getString("C_NAME");
                                } else {
                                    log.debug("====== No legal client found for service: " + service.getRegistrationNumber() + " (" + service.getId() + ")");
                                    return null;
                                }
                            }
                        });
                     } else {
                         result = (String) dao.getTemplate().query(SQL_GET_PERSONINFO, new Long[]{service.getClient().getId()}, new ResultSetExtractor() {
                             public Object extractData(ResultSet rsi) throws SQLException, DataAccessException {
                                 if (rsi.next()) {
                                     return rsi.getString("LASTNAME") + " " + rsi.getString("FIRSTNAME") + " " + rsi.getString("MIDDLENAME");
                                 } else {
                                     log.debug("====== No phisical client found for service: " + service.getRegistrationNumber() + " (" + service.getId() + ")");
                                     return null;
                                 }
                            }
                        });
                    }
                    return result;
                }
          });
    }

    Я конечно все понимаю, deadline, все эти вещи... Но return на 20 с чем-то строк это сильно.

    nagakhl, 19 Января 2010

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

    +59.6

    1. 1
    *reinterpret_cast<int *>(&showFlags) = behavior.value("showFlags", 0xfffffff);

    Немножко эзотерики, нашел в нашем проекте, писалось видимо в 3 часа ночи.

    Sauron, 18 Января 2010

    Комментарии (4)
  4. SQL / Говнокод #2442

    −852.1

    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
    CREATE TABLE account(
    	balance INT DEFAULT 0,
    	name VARCHAR(60) NOT NULL,
    	surname VARCHAR(60) DEFAULT NULL,
    	login VARCHAR(60) NOT NULL,
    	password VARCHAR(256) NOT NULL,
    	active BOOLEAN DEFAULT FALSE,
    	UNIQUE KEY login (login),
    	id INT AUTO_INCREMENT PRIMARY KEY 
    ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8
    
    CREATE TABLE email(
    	email VARCHAR(255) NOT NULL,
    	user_id INT NOT NULL,
    	UNIQUE KEY email (email),
    	id INT AUTO_INCREMENT PRIMARY KEY,
    	FOREIGN KEY (user_id) REFERENCES account (id)
    		ON DELETE CASCADE
    		ON UPDATE CASCADE
    ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8
    
    CREATE TABLE prefered_email(
    	email_id VARCHAR(255) NOT NULL,
    	user_id INT NOT NULL,
    	id INT AUTO_INCREMENT PRIMARY KEY,
    	FOREIGN KEY (user_id) REFERENCES account (id)
    		ON DELETE CASCADE
    		ON UPDATE CASCADE,
    	FOREIGN KEY (email_id) REFERENCES email (id)
    		ON DELETE CASCADE
    		ON UPDATE CASCADE
    ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8

    При попытке создать prefered_email получаю ошибку: Error: Can't create table './nightfol_print/prefered_phone.frm' (errno: 150)
    В чем может быть беда?
    Максимум что нашел, это что http://www.sql.ru/forum/actualthread.aspx?tid=626099 типы id должны быть одинаковы ... но они и есть. И все таблицы InnoDB.
    Подскажите, пожалуйста.

    SilentImp, 18 Января 2010

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

    +185.5

    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
    <?
    //------проверяем на совпадение логинов--------
    $query = "SELECT login FROM clients";
    $result = mysql_query($query, $dbConn);
    	while ($row = mysql_fetch_assoc($result)){
    		foreach ($row as $val){
    			if ($val==$login){
    				$flag_login='true';
    			}// if	
    		} // завершение цикла foreach
    	} // завершение цикла while 
    	//----------------------------------------
    if ($flag_login=='true'){$output.= "<li class='text_blue'>клиент с таким логином уже сужествует, введите другой</li><br>"; $z='1';};
    ?>

    (говно)проверка на совпадение логинов

    xXx_totalwar, 18 Января 2010

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

    +156.4

    1. 1
    Fatal error: Maximum life time of 2009 years exceeded in /core/WORLD!

    Нужно было кидать в кучу, но тут - точно поймут)

    mE, 18 Января 2010

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

    +144.8

    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
    __inline BOOL
    SearchOneDirectory(
                      IN  LPSTR Directory,
                      IN  LPSTR FileToFind,
                      IN  LPSTR SourceFullName,
                      IN  LPSTR SourceFilePart,
                      OUT PBOOL FoundInTree
                      )
    {
        //
        // This was way too slow. Just say we didn't find the file.
        //
        *FoundInTree = FALSE;
        return(TRUE);
    }

    Оптимизация Microsoft. Найдено в исходниках Windows, утекших в 2004.

    Lockal, 18 Января 2010

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

    +156.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    class BaseDateTimeField extends SmartField{
    var $years = array("1999"=>"1999","2000"=>"2000","2001"=>"2001","2002"=>"2002","2003"=>"2003","2004"=>"2004","2005"=>"2005","2006"=>"2006","2007"=>"2007","2008"=>"2008","2009"=>"2009","2010"=>"2010");
    var $months = array('01'=>'Jan','02'=>'Feb', '03'=>'Mar', '04'=>'Apr', '05'=>'May', '06'=>'Jun', '07'=>'Jul', '08'=>'Aug','09'=>'Sep', '10'=>'Oct', '11'=>'Nov', '12'=>'Dec');
    var $days = array('01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $hours = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $minutes = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $secundes = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    
    }

    Самописная CMS для веб-сайта

    nikl, 18 Января 2010

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

    +171.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    class BaseDateTimeField extends SmartField{
    var $years = array("1999"=>"1999","2000"=>"2000","2001"=>"2001","2002"=>"2002","2003"=>"2003","2004"=>"2004","2005"=>"2005","2006"=>"2006","2007"=>"2007","2008"=>"2008","2009"=>"2009","2010"=>"2010");
    var $months = array('01'=>'Jan','02'=>'Feb', '03'=>'Mar', '04'=>'Apr', '05'=>'May', '06'=>'Jun', '07'=>'Jul', '08'=>'Aug','09'=>'Sep', '10'=>'Oct', '11'=>'Nov', '12'=>'Dec');
    var $days = array('01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $hours = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $minutes = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $secundes = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    
    }

    Самописная CMS для веб-сайта

    nikl, 18 Января 2010

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

    +151.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    class BaseDateTimeField extends SmartField{
    var $years = array("1999"=>"1999","2000"=>"2000","2001"=>"2001","2002"=>"2002","2003"=>"2003","2004"=>"2004","2005"=>"2005","2006"=>"2006","2007"=>"2007","2008"=>"2008","2009"=>"2009","2010"=>"2010");
    var $months = array('01'=>'Jan','02'=>'Feb', '03'=>'Mar', '04'=>'Apr', '05'=>'May', '06'=>'Jun', '07'=>'Jul', '08'=>'Aug','09'=>'Sep', '10'=>'Oct', '11'=>'Nov', '12'=>'Dec');
    var $days = array('01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $hours = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $minutes = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    var $secundes = array('00'=>'00','01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'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');
    
    }

    Самописная CMS для веб-сайта

    nikl, 18 Января 2010

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