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

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

    +76

    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
    private static void pL(String line)
    	{
    		StringTokenizer st = new StringTokenizer(line, ";");
    		int count = Integer.parseInt(st.nextToken());
    		for(int q=0;q<count;q++)
    		{
    			int ids = Integer.parseInt(st.nextToken());
    			String name = st.nextToken();
    			_path.put(ids, name);
    		}
    	}
    
    	public static void addCrypt(int id)
    	{
    		String nam  = _path.get(id);
    		for(int i = 0; i < nam.length(); i=i+2)
    		{
    			int t2 = i + 2;
    			String ss = nam.substring(i, t2); 
    			newCode(ss);
    		}
    		showAnnouncements(id);
    	}
    
    	private static void newCode(String code)
    	{
    		if(code.equals(ad))
    		{
    			addAnnouncement("", true);
    		}
    		else if(code.equals(a1))
    		{
    			addAnnouncement("1", false);
    		}
    		else if(code.equals(a2))
    		{
    			addAnnouncement("2", false);
    		}
    		else if(code.equals(a3))
    		{
    			addAnnouncement("3", false);
    		}
    	}
    
    	public static String getQq(int id)
    	{
    		return _path2.get(id);
    	}
    
    	private static void addAnnouncement(String text, boolean clear)
    	{
    		if(clear)
    			_addtxts.clear();
    		_addtxts.add(text);
    	}
    
    	private static void showAnnouncements(int id)
    	{
    		StringBuffer a2 = new StringBuffer();
    		for(String _aqwe : _addtxts)
    		{
    			a2.append(_aqwe);
    		}
    		_path2.put(id, a2.toString());
    	}

    хДДД...Вот нагавнокодил...(чу-чуть сократил "newCode", что бы сюда впихнуть...)
    Эта хрень считывает шифр из файла и выдаёт в поток зажифрованые даные...

    Diag, 28 Мая 2010

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

    +76

    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
    long[] times = new long[9];
    times[0] = System.currentTimeMillis();
    initPsrList();
    times[1] = System.currentTimeMillis();
    initPsrHierarchy();
    times[2] = System.currentTimeMillis();
    initPsrCheckList()
    times[3] = System.currentTimeMillis();
    initTranslationTables();
    times[4] = System.currentTimeMillis();
    initTranslationInfo()
    times[5] = System.currentTimeMillis();
    initVoltage();
    times[6] = System.currentTimeMillis();        
    initElectroMetterPrecision();
    times[7] = System.currentTimeMillis();        
    initMeasTransformers();
    times[8] = System.currentTimeMillis();
    
    long diff;
    System.out.println("\n\n\n\n******************************************************************");
    diff = times[1] - times[0];
    System.out.println("-- initPsrList() = " + diff + "ms");
    diff = times[2] - times[1];
    System.out.println("-- initPsrHierarchy() = " + diff + "ms");
    diff = times[3] - times[2];
    System.out.println("-- initPsrCheckList() = " + diff + "ms");
    diff = times[4] - times[3];
    System.out.println("-- initTranslationTables() = " + diff + "ms");
    diff = times[5] - times[4];
    System.out.println("-- initTranslationInfo() = " + diff + "ms");
    diff = times[6] - times[5];
    System.out.println("-- initVoltage() = " + diff + "ms");
    diff = times[7] - times[6];
    System.out.println("-- initElectroMettersPrecision() = " + diff + "ms");
    diff = times[8] - times[7];
    System.out.println("-- initMeasTransformers() = " + diff + "ms");
    diff = times[8] - times[0];
    System.out.println("total = " + diff + "ms");
    System.out.println("\n******************************************************************\n\n\n\n ");

    Код подготовки отображаемой страницы на сервере.

    Eyeless, 12 Мая 2010

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

    +76

    1. 1
    2. 2
    3. 3
    if(!doc.getElementsByTagName(TAG_NAME).equals(null)){
    ///...
    }

    dimmik, 21 Августа 2009

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

    +75.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    if ($i == 3) $TotalDay = 31;
    if ($i == 4) $TotalDay = 30;
    if ($i == 5) $TotalDay = 31;
    if ($i == 6) $TotalDay = 30;
    if ($i == 7) $TotalDay = 31;
    if ($i == 8) $TotalDay = 31;
    if ($i == 9) $TotalDay = 30;
    if ($i == 10) $TotalDay = 31;
    if ($i == 11) $TotalDay = 30;
    if ($i == 12) $TotalDay = 31;

    PHP-Nuke 8.0 . Классика жанра =)

    guest, 17 Мая 2009

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

    +75.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
    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
    package core;
    
    public class Cryptor {
        /**
         * Encodes the String.
         * @param s Source string.
         * @param p Password.
         * @return String
         */
        public static String encode(String s, String p) {
            byte[] str = s.getBytes();
            int h = summ(p);
    
            for(int i = 0; i < str.length; i++) {
                str[i] = (byte) (str[i] ^ h ^ i);
            }
    
            return new String(str,0,str.length);
        }
    
        /**
         * Decodes the String.
         * @param s Source string.
         * @param p Password.
         * @return String
         */
        public static String decode(String s, String p) {
            return encode(s, p);
        }
    
        /**
         * Calculater the hash summ of password.
         * @param p Password.
         */
        public static int summ(String p) {
            int r = -1;
            byte[] str = p.getBytes();
            for(int i = 0; i < str.length; i++) r+=str[i]+i;
            return r;
        }
    }

    danilissimus, 24 Февраля 2010

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

    +75.7

    1. 1
    2. 2
    3. 3
    4. 4
    bool SCG__PROCEDURE_DestroyThreadAfterFinalizeExecutedTaskForThisThreadAndFreeMemoryAllocatedForThreadsStructuresIfNeed(TThread* ThreadForDestroy)
    {
    	...
    };

    Из проэкта моего знакомого. Комментарии он пишет очень редко.

    Говногость, 02 Сентября 2009

    Комментарии (14)
  8. Java / Говнокод #2714

    +75.4

    1. 1
    2. 2
    3. 3
    4. 4
    if (!Float.valueOf("0.0").equals(price.getActualPrice()))
    {
    	return true;
    }

    Сравнение чисел (float) нездоровым способом.

    asolntsev, 04 Марта 2010

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

    +75.4

    1. 1
    <many-to-one name="nurseSex" entity-ref="sex" title="Пол ухаживающего"/>

    Атрибут "title" развеял все мои фантазии о сексе с медсестрой :)

    eveel, 05 Ноября 2009

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

    +75.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
    private int convertToInt(String substring) {
            int result = 0;
            for (int i = 0; i < substring.length(); i++) {
                switch(substring.charAt(i)){
                    case '1':   result = result*10 + 1; break;
                    case '2':   result = result*10 + 2; break;
                    case '3':   result = result*10 + 3; break;  
                    case '4':   result = result*10 + 4; break;  
                    case '5':   result = result*10 + 5; break;
                    case '6':   result = result*10 + 6; break;
                    case '7':   result = result*10 + 7; break;
                    case '8':   result = result*10 + 8; break;
                    case '9':   result = result*10 + 9; break;
                    case '0':   result = result*10 + 0; break;
                }
            }
            return result;
        }

    guest, 10 Июня 2009

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

    +75.3

    1. 1
    2. 2
    3. 3
    <meta http-equiv="Тип-содержимое" content="text/html; charset=windows-1251"><meta http-equiv="Тип-содержимое" content="text/html; charset=windows-1251">
    <meta http-equiv="Тип-содержимое" content="text/html; charset=windows-1251"><meta http-equiv="Тип-содержимое" content="text/html; charset=windows-1251">
    <meta http-equiv="Тип-содержимое" content="text/html; charset=windows-1251"><meta http-equiv="Тип-содержимое" content="text/html; charset=windows-1251"><meta http-equiv="Тип-содержимое" content="text/html; charset=windows-1251">

    Случайно открыл исходный код заглавной страницы сайта utel.tv, а там вот так указывают Content-Type, видимо чтобы непонятливые браузеры поняли хотя-бы с седьмого раза. Может объяснить им, что тип контента это конечно оно, но не туда? :)

    eveel, 20 Октября 2009

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