1. SQL / Говнокод #23

    −408.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
    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
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    SELECT   region_key AS region
            ,NAME(containedobjectsbasement_key) AS building
            ,container_node_id
            ,containedobjectsexchange_key
            ,object_name AS ats
            ,number_ranges AS diapazon
            ,exchange_type_name AS tip_ats
            ,exchange_mount_capacity AS emkost
            ,operator_licence_number AS license
            ,trace_line_relay_type_name AS tip_sl
            ,COUNT(trace_line_id) AS count5
            ,otkuda_nax AS otkuda_ats
            ,kuda_blya AS kuda_ats
            ,seven_nation_army
            ,ROWNUM
            ,cable_type_name
            ,logical_cable_length
            ,ATS_NAME
        FROM (SELECT DISTINCT r.object_id AS region_key
                             ,n.node_id AS containedobjectsbasement_key
                             ,n1.container_node_id AS container_node_id
                             ,e.node_id AS containedobjectsexchange_key
                             ,CAST(name2(e.node_id, e.exchange_class_id) AS VARCHAR2(128) ) AS object_name
                             ,e.exchange_mount_capacity AS exchange_mount_capacity
                             ,CAST( (SELECT stragg(first_number || '-' || last_number || '
                             '              )
                                       FROM number_interval
                                      WHERE exchange_id = e.node_id) AS VARCHAR2(1024) ) AS number_ranges
                             ,(SELECT e1.exchange_type_name
                                 FROM exchange_tl e1
                                WHERE e1.exchange_type_id = e.exchange_type_id) AS exchange_type_name
                             ,CAST( (SELECT s3.licence_number
                                       FROM service_operator_type s3
                                      WHERE s3.service_operator_type_id = e.operator_id) AS VARCHAR2(64) ) AS operator_licence_number
                             ,(SELECT t.trace_line_relay_type_name
                                 FROM trace_line_relay_type t
                                WHERE t.trace_line_relay_type_id = s.trace_line_relay_type_id) AS trace_line_relay_type_name
                             ,s.object_id trace_line_id
                             ,NAME(s1.exchange_id) otkuda_nax
                             ,NAME(trace_line.exchange_id) kuda_blya
                             ,(SELECT SUM(TO_NUMBER(n.last_number) - TO_NUMBER(n.first_number) + 1) AS s
                                 FROM number_interval n, region_l r
                                WHERE LENGTH(r.region_add_code || n.last_number) = 10
                                  AND LENGTH(r.region_add_code || n.first_number) = 10
                                  AND n.region_id = r.object_id
                                  AND n.exchange_id = e.node_id) AS seven_nation_army
                             ,ROWNUM
                         FROM region_l r, node n, exchange_l e, node n1, service_trace_line s, trace_line, service_l s1, node n2, OBJECT o
                        WHERE s.object_id = s1.object_id
                          AND s1.exchange_id = e.node_id
                          AND trace_line.service_id = s1.object_id
                          AND e.node_id = n1.node_id
                          AND n1.container_node_id = n.node_id
                          AND e.exchange_class_id = 100
                          AND n2.container_node_id = n.node_id
                          AND n2.entity_id = 108
                          AND n.region_id = r.object_id
                          AND n.node_type_id = 115
                          AND r.object_id = :region_key
                          AND n1.node_id = o.object_id
                          AND o.object_owner_type_id = 3) sel
            ,(SELECT r.object_id AS region_key2
                    ,c.node_id AS containedcoppercross_key
                    ,s2.linkedobjectsinterexchange_key AS linkedobjectsinterexchange_key
                    ,s2.logical_cable_length AS logical_cable_length
                    ,s2.cable_type_name AS cable_type_name
                    ,NAME(sl.exchange_id) AS ATS_NAME
                    ,NAME(el.node_id) AS el
                FROM region_l r
                    ,CROSS c
                    ,exchange_l el
                    ,node n2
                    ,service_l sl
                    ,trace_line tl
                    ,(SELECT l.node_id AS node_id
                            ,l.logical_cable_id AS linkedobjectsinterexchange_key
                            ,l.logical_cable_length AS logical_cable_length
                            ,(SELECT c.type_name
                                FROM cable_type_name c
                               WHERE c.cable_type_name_id = l.cable_type_id) AS cable_type_name
                        FROM logical_cable l
                       WHERE l.logical_cable_type_id = 455) s2
               WHERE s2.node_id(+) = c.node_id
                 AND c.node_id = n2.node_id
                 AND n2.entity_id = 108
                 AND c.node_id = el.cross_id
                 AND sl.exchange_id = el.node_id
                 AND tl.exchange_id = el.node_id
                 AND sl.entity_id = 156
                 AND r.object_id = :region_key) sel2
       WHERE NAME(kuda_blya) = ATS_NAME
    GROUP BY region_key, containedobjectsbasement_key, container_node_id, containedobjectsexchange_key, number_ranges, object_name, exchange_type_name, operator_licence_number, trace_line_relay_type_name, otkuda_nax, kuda_blya, exchange_mount_capacity
            ,operator_licence_number, seven_nation_army, ROWNUM, cable_type_name, logical_cable_length,ATS_NAME
    ORDER BY otkuda_ats

    Вызывает в Oracle10g внутреннюю ошибку
    ORA-00600: internal error code, arguments: [string], [string], [string], [string], [string], [string], [string], [string]
    Cause: This is the generic internal error number for Oracle progra

    guest, 27 Ноября 2008

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

    −1094

    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
    SELECT A.Id AS AppraiserId, 
    	(SELECT A2.FieldValueInt AS SubcontractorId
    	FROM sm_forms_FieldValues A2
    	WHERE 
    		A2.InstanceId = (
    			SELECT 	FormInstanceId
    			FROM	sm_genericdatabase_Instances
    			WHERE	ModuleId=1736 AND Title='Appraisers'
    			)
    		AND 
    		A2.FieldId = (
    			SELECT Id FROM sm_forms_Fields 
    			WHERE InstanceId= A2.InstanceId 
    			AND Title = 'Subcontractor'	
    			)
    		AND
    		A2.ValueId=A.Id
    	) AS SubcontractorId,
    	
    	(SELECT A3.FieldValueInt
    	FROM sm_forms_FieldValues A3
    	WHERE 
    		InstanceId = (
    			SELECT 	FormInstanceId
    			FROM	sm_genericdatabase_Instances
    			WHERE	ModuleId=1736 AND Title='Appraisers'
    			)
    		AND 
    		FieldId = (
    			SELECT Id FROM sm_forms_Fields 
    			WHERE InstanceId= A3.InstanceId 
    			AND Title = 'Heavy Equipment'	
    			)
    		AND
    		A3.ValueId= A.Id
    	) AS HeavyEquipment,
    	
    	(SELECT A3.FieldValueInt
    	FROM sm_forms_FieldValues A3
    	WHERE 
    		InstanceId = (
    			SELECT 	FormInstanceId
    			FROM	sm_genericdatabase_Instances
    			WHERE	ModuleId=1736 AND Title='Appraisers'
    			)
    		AND 
    		FieldId = (
    			SELECT Id FROM sm_forms_Fields 
    			WHERE InstanceId= A3.InstanceId 
    			AND Title = 'Name'	
    			)
    		AND
    		A3.ValueId= A.Id
    	) AS Name
    	
    	
    	FROM sm_forms_Values A
    	where InstanceId = (
    			SELECT 	FormInstanceId
    			FROM	sm_genericdatabase_Instances
    			WHERE	ModuleId=1736 AND Title='Appraisers'
    			)
    	ORDER BY 2

    выборка из большой базы... И нихрена не понятной.

    guest, 27 Ноября 2008

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

    −70.7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    boolean is_admin;
    // something
    Boolean b = new Boolean( is_admin );
    if( b.toString().length() == 4 ) {
       // something...
    }
    // something

    guest, 27 Ноября 2008

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

    −53.9

    1. 1
    2. 2
    3. 3
    uint32_t getuint32(char *p){
      return (*p<<24)|(*(p+1)<<16)|(*(p+2)<<8)|(*(p+3));
    }

    guest, 27 Ноября 2008

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

    +3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    //
    // true - success
    // false - value not found for given key
    //
    bool CATStorage::getValueForKey(const std::string &key, std::string &value) const
    {
              ...
              std::string().swap(value); 
              ...
    }

    Код очистки содержимого строки, C++, STL

    guest, 27 Ноября 2008

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

    +163.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if ( $condition ) a = 6;
    a = 10;
    
    
    

    Подозвал меня прогер и спросил: "а почему у меня a всегда равно 10, даже если условие выполняется? ((("

    guest, 27 Ноября 2008

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

    +16

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
      // kuso@npj: спорная строка, но мне она нравится:
      error_reporting (E_ALL ^ E_NOTICE);
    
    
    
    

    guest, 27 Ноября 2008

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

    +31.1

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Govnokod.ru  — Накласть говнокод</title>
        <meta name="keywords" content="говнокод, смешной код, быдлокод, быдлокодеры, индусы, для программистов, про программистов, индусский код, записки программиста, говно, говнокод на php, mysql, perl" />
        <meta name="description" content="Сборник говнокода на различных языках программирования" />
        <link rel="stylesheet" type="text/css" href="/templates/css/style.css" />
            <link rel="stylesheet" type="text/css" href="/templates/css/add.css" />
        <script type="text/javascript">
        <!--
        var SITE_PATH = '';
        //-->
        </script>
        <script type="text/javascript" src="/templates/external.php?type=js&files=prototype.js,govnokod.js"></script>
    </head>
    <body>
        <div class="header">
            <a href="/">
                <img src="/templates/images/logo.png" alt="Говнокод.Ру" title="Да, это говно!" />
                Govnokod.ru
            </a>
        </div>
        <div class="add-govno">
            <a href="http://govnokod.ru/add"><img src="/templates/images/icon-plus.png" alt="" /></a>
            <a href="http://govnokod.ru/add">Накласть говнокод</a>
        </div>
        <ul class="menu">
            <li class="active"><a href="http://govnokod.ru">Говнокод</a></li>
                </ul>
        <div style="clear:both"></div>
        <ul class="sub-menu">
            <li class="left"> </li>
        	<li><a href="#">Новый</a></li>
        	<li><a href="#">Лучший</a></li>
        	<li class="right"> </li>
        </ul>
    
        <div style="clear: both;"></div>
    
        
    
    
    
        <table class="rblock">
            <tr>
                <td style="width:20px"><img src="/templates/images/rblock-left-top.png" alt="" /></td>
                <td class="empty"> </td><td style="width:20px"><img src="/templates/images/rblock-right-top.png" alt="" /></td>
            </tr>
            <tr class="content">
                <td> </td>
                <td>
                    <h1>Накласть говнокод</h1>
                                    <form action="http://govnokod.ru/add" method="post">
                        <table width="100%" border="0" cellpadding="5" cellspacing="0">
                            <tr>
                                <td style="vertical-align: top; width: 20%;"><label for="form_category_id">Язык: <span style="color: red;">*</span></label></td>
                                <td style="width: 80%;"><select id="form_category_id" name="category_id">
    <option selected="selected" style="font-weight: bold;" value=""> </option>
    <option value="1">PHP</option>
    <option value="2">JavaScript</option>
    <option value="3">MySQL</option>
    <option value="4">PERL</option>
    <option value="5">Python</option>
    </select></td>
                            </tr>
                            <tr>
                                <td style="vertical-align: top;"><label for="form_description">Описание:</label></td>
                                <td><textarea cols="50" id="form_description" name="description" rows="4"></textarea></td>
                            </tr>
                            <tr>
                                <td> </td>
                                <td> </td>
                            </tr>
                            <tr>
                                <td style="vertical-align: top;"><label for="form_text">Код: <span style="color: red;">*</span></label></td>
                                <td>
                                    <div id="codeSaveContainer" class="codeInput">
                                        <table cellpadding="0" cellspacing="0" style="width: 100%;">
                                            <tr>
                                                <td style="vertical-align: top; width: 5%;">
                                                    <div id="nums" class="linenumbers"></div>
                                                </td>
                                                <td style="vertical-align: top; width: 95%;">
                                                                                                    <textarea class="codeArea" cols="50" id="codeArea" name="text" onkeyup="numbering(this);" rows="1" value="
    
    
    
    
    " wrap="off">
    
    
    
    
    </textarea>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>

    типичный говнокод

    guest, 27 Ноября 2008

    Комментарии (6)
  9. Python / Говнокод #15

    −216

    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
    # -*- coding: utf-8 -*-
    q=0
    def is_sym(li):
    	l=li[:]
    	if len(l)%2==1:
    		l.pop(len(l)/2)
    	half = l[:len(l)/2]
    	sec_half = l[len(l)/2:]
    	sec_half.reverse()
    	if(half==sec_half):
    		return True
    def do_sym(li):
    	global q
    	l=li[:]
    	while (is_sym(l)!=True):
    		l.insert(len(l)-q,l[q])
    		q=q+1
    	return l
    how_much=input("Сколько? ")
    lis=[]
    for z in range(1,how_much+1):
    	lis.append(input("Введите число №%d: " % (z, )))
    sym = do_sym(lis)
    print q
    res = ""
    for z in range(0, len(sym)):
    	res=res + "%d, " % (sym[z],)
    print res

    Задание на школьную олимпиаду, что удивительно - работает.

    guest, 26 Ноября 2008

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

    +23

    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
    long gr, ri, r1, r2, y, z, z_rev;
    	for (i = 2; i < qr_count; i++) {
    		step = 0;
     		ri = r[i];
    		gr = - mpz_fdiv_ui(lowM, pm[i][step]);
    		r1 = gr + ri;
    		r2 = gr + pm[i][step] - ri;
    		if (r1 < 0) {
    			r1 += pm[i][step];
    		}
    		if (r2 < 0) {
    			r2 += pm[i][step];
    		}
    		while (r1 < (long) Ml2) {
    			sieve[r1][i] += 1;
    			r1 += pm[i][step];
    		}
    		while (r2 < (long) Ml2) {
    			sieve[r2][i] += 1;
    			r2 += pm[i][step];
    		}
    		for (step = 1; step < degr[i]; step++) {
    			gr = - mpz_fdiv_ui(lowM, pm[i][step]);
    			y = ri*ri;
    			y -= Npm[i][step];
    			y = y/( (long) pm[i][step-1]);
    			if (y < 0) { y += pm[i][step]; }
    			z_rev = (ri<<1) % QR[i];
    			//?IOOA?EOO ?OI?AOEO IA UAAEEIE?AIEA
    			if (z_rev == 0) { y = 0; }
    			else {
    				z = 1;	
    				while ((z_rev*z % QR[i]) != 1) { z++;}
    				y *= z*pm[i][step-1];
    				y = y % pm[i][step];
    			}
    			ri -= y;
    			if (ri < 0) { ri += pm[i][step]; }
    			r1 = gr+ri;
    			r2 = gr+pm[i][step]-ri;
    			if (r1 < 0) { r1 += pm[i][step]; }
    			if (r2 < 0) { r2 += pm[i][step]; }
    			while (r1 < (long) Ml2) {
    				sieve[r1][i] += 1;
    				r1 += pm[i][step];
    			}
    			while (r2 < (long) Ml2) {
    				sieve[r2][i] += 1;
    				r2 +=pm[i][step];
    			}
    		}
    	}

    Когда лучше, чтобы кода не было, чем, чтобы он был...

    guest, 26 Ноября 2008

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