1. Java / Говнокод #20123

    +11

    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
    XmlPullParser xpp = ...
    
    xpp.nextTag();
    
    switch (xpp.getName()) {
        case "airport":
            if (xpp.getName().equals("airport")) {
                parseAirport(xpp, place);
            }
        case "border":
            if (xpp.getName().equals("border")) {
                parsePlaceBorder(xpp, place);
            }
        case "trainStation":
            if (xpp.getName().equals("trainStation")) {
                parseTrainStation(xpp, place);
            }
        default:
            break;
    }

    "Блин, че-то свитч не работает, что за хрень, сделаю-ка я дополнительную проверку внутри для надежности"

    moonson, 02 Июня 2016

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

    −4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Maven
    
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <classifier>sources</classifier>
        <scope>provided</scope>
    </dependency>

    Кто-то изобретательный прицепил исходники библиотеки к проекту таким способом, чтобы переходить к ним при разработке.

    morph, 02 Июня 2016

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

    −100

    1. 1
    Если  (ПользователиИнформационнойБазы.ТекущийПользователь().Роли.Содержит(Метаданные.Роли.Префикс_Кадровик)) тогда

    Франчайзи видимо не всегда знают о РольДоступна()

    znsoft, 02 Июня 2016

    Комментарии (42)
  4. JavaScript / Говнокод #20119

    +2

    1. 1
    $ npm install ember-cli-phone-number --save-dev

    Всё достаточно просто. Нам нужен текстовый инпут, в который пользователь вводит свой номер мобильного телефона. Предназначение: sms-оповещение. Проблема в том, что все существующие решения привязываются к определённому формату номера (US, Canada), а при использовании международного формата для US-номера выясняется, что в нём 11 цифр, а не 12. Пользователь же может иметь номер хоть в ёбаном Вануату. Текущее решение: принимать любой текст в инпут, делать .replace(/[^0-9]/g, ''), схоронять в базу и ебаться с этим потом. Чувствую запашок, но не могу понять откуда. Швабрашвабр про телефонные номера читал. inb4, js не нужен.
    Запашок наверное всё-таки от стандартов телефонных номеров...

    bakagaijin, 01 Июня 2016

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <ul>
        {foreach $сity as $c}
            {if Core::model()->getValue($c,'name') === $form->city_name}
                {assign $form->city_id $c['id']}
            {/if}
            <li data-value="{$c['id']}" class="{if $c['id']===$form->city_id}active{/if}"><span>{Core::model()->getValue($c,'name')}</span></li>
        {/foreach}
    </ul>

    Типичный шаблон на фреймворках PHP, в данном случае Yii 1.1

    M-A-X, 01 Июня 2016

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

    −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
    [Wed Jun 01 10:13:25.866953 2016] [autoindex:error] [pid 30710] [client 77.222.112.203:24108] AH01276: Cannot serve directory /home/u325415/test.alpina-nerud.ru/www/: No matching DirectoryIndex (index.html,index.htm,index.php,index.php3,index.phtml,index.cgi,index.pl,index.shtml,default.htm,default.html) found, and server-generated directory index forbidden by Options directive
    [Wed Jun 01 10:21:28.044222 2016] [autoindex:error] [pid 4437] [client 77.222.112.203:30432] AH01276: Cannot serve directory /home/u325415/test.alpina-nerud.ru/www/: No matching DirectoryIndex (index.html,index.htm,index.php,index.php3,index.phtml,index.cgi,index.pl,index.shtml,default.htm,default.html) found, and server-generated directory index forbidden by Options directive
    [Wed Jun 01 10:28:39.825066 2016] [autoindex:error] [pid 10534] [client 77.222.112.203:36957] AH01276: Cannot serve directory /home/u325415/test.alpina-nerud.ru/www/: No matching DirectoryIndex (index.html,index.htm,index.php,index.php3,index.phtml,index.cgi,index.pl,index.shtml,default.htm,default.html) found, and server-generated directory index forbidden by Options directive
    [Wed Jun 01 12:11:48.394301 2016] [:error] [pid 6058] [client 77.222.112.203:37192] PHP Warning:  require(typo3/sysext/core/Classes/Core/Bootstrap.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/u325415/test.alpina-nerud.ru/www/index.php on line 48
    [Wed Jun 01 12:11:48.394400 2016] [:error] [pid 6058] [client 77.222.112.203:37192] PHP Warning:  require(typo3/sysext/core/Classes/Core/Bootstrap.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/u325415/test.alpina-nerud.ru/www/index.php on line 48
    [Wed Jun 01 12:11:48.394426 2016] [:error] [pid 6058] [client 77.222.112.203:37192] PHP Fatal error:  require() [<a href='function.require'>function.require</a>]: Failed opening required 'typo3/sysext/core/Classes/Core/Bootstrap.php' (include_path='.:/usr/share/php53:/usr/share/pear53') in /home/u325415/test.alpina-nerud.ru/www/index.php on line 48
    [Wed Jun 01 12:18:39.840563 2016] [:error] [pid 12269] [client 77.222.112.203:15356] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1, referer: http://test.alpina-nerud.ru/typo3/
    [Wed Jun 01 12:18:42.839703 2016] [:error] [pid 12319] [client 77.222.112.203:15413] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:18:45.376653 2016] [:error] [pid 12333] [client 77.222.112.203:15456] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:19:02.624195 2016] [:error] [pid 12557] [client 77.222.112.203:15794] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:19:04.446064 2016] [:error] [pid 12573] [client 77.222.112.203:15826] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:20:25.263810 2016] [:error] [pid 13455] [client 77.222.112.203:17281] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:21:43.511456 2016] [:error] [pid 14762] [client 77.222.112.203:18648] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:21:54.006698 2016] [:error] [pid 14760] [client 77.222.112.203:18644] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:21:56.294966 2016] [:error] [pid 14894] [client 77.222.112.203:18855] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:22:11.178438 2016] [:error] [pid 15124] [client 77.222.112.203:19238] PHP Parse error:  syntax error, unexpected T_CLASS in /home/u325415/test.alpina-nerud.ru/www/typo3conf/ext/chgallery/lib/class.tx_chgallery_tca.php on line 1
    [Wed Jun 01 12:23:17.882880 2016] [:error] [pid 15798] [client 77.222.112.203:20386] PHP Warning:  require(sysext/core/Classes/Core/Bootstrap.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/u325415/test.alpina-nerud.ru/www/typo3/init.php on line 55
    [Wed Jun 01 12:23:17.882976 2016] [:error] [pid 15798] [client 77.222.112.203:20386] PHP Warning:  require(sysext/core/Classes/Core/Bootstrap.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/u325415/test.alpina-nerud.ru/www/typo3/init.php on line 55
    [Wed Jun 01 12:23:17.883003 2016] [:error] [pid 15798] [client 77.222.112.203:20386] PHP Fatal error:  require() [<a href='function.require'>function.require</a>]: Failed opening required 'sysext/core/Classes/Core/Bootstrap.php' (include_path='.:/usr/share/php53:/usr/share/pear53') in /home/u325415/test.alpina-nerud.ru/www/typo3/init.php on line 55

    Ошибка в логах

    ponoroshca, 01 Июня 2016

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

    −3

    1. 1
    { "destination_addresses" : [ "Seattle, Washington, USA" ], "origin_addresses" : [ "Vancouver, Britisch-Kolumbien, Kanada" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "229 km", "value" : 229112 }, "duration" : { "text" : "2 Stunden, 35 Minuten", "value" : 9311 }, "status" : "OK" } ] } ], "status" : "OK" }

    viromax, 01 Июня 2016

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <?
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC&destinations=Seattle&mode=driving&language=de");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    $response = curl_exec($ch);
    echo $response;
    $array = json_decode($response, true);
    echo $array["destination_addresses"];
    ?>

    viromax, 01 Июня 2016

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

    +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
    public void TrimExcess()
    {
    	int num;
    	num = (int) (((double) ((int) this._items.Length)) * 0.9);
    	if (this._size >= num)
    	{
    		goto Label_002A;
    	}
    	this.Capacity = this._size;
    Label_002A:
    	return;
    }

    Хуброхапр

    dm_fomenok, 01 Июня 2016

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

    +2

    1. 1
    2. 2
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="format-detection" content="telephone=no"/><title>MINI-MBA Professional</title></head><body style="-webkit-text-size-adjust: none; margin: 0; padding: 0; background-color: #f5f5f5"><img src="http://outlineagency.go2cloud.org/aff_i?offer_id=14&aff_id=1004&aff_sub=release_1&source=mailing" width="1" height="1" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#f5f5f5"><tr><td valign="top" style="border-collapse: collapse"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td style="border-collapse: collapse"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"><tr>

    всего-то две строчки поправить
    https://gyazo.com/1a9d5a74da2212b7f758adbf908d2c1c

    ngc-598, 01 Июня 2016

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