1. Список говнокодов пользователя spbAngel

    Всего: 5

  2. C# / Говнокод #2501

    +135.9

    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
    public class PlayerWindow
    {
        private readonly ScheduleManager _scheduleManager = new ScheduleManager();
    
    ...
    
        private void OpenSchedule(string timesheetFilename)
        {
            if (!_scheduleManager.OpenSchedule(timesheetFilename))
            {
                _isOpen = false;
                return;
            }
    
            _isOpen = false;
        }
    }

    Собственное творчество. ^_^

    spbAngel, 29 Января 2010

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

    +79.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
    String _desc = postParams.get( "description" );
    
    if (_desc == null)
        _desc = "Merchant payment";
    
    _desc = _desc.replace("%20", " ");
    _desc = _desc.replace("%21", "!");
    _desc = _desc.replace("%22", "\"");
    _desc = _desc.replace("%23", "#");
    _desc = _desc.replace("%24", "$");
    _desc = _desc.replace("%25", "%");
    _desc = _desc.replace("%26", "&");
    _desc = _desc.replace("%27", "'");
    _desc = _desc.replace("%28", "(");
    _desc = _desc.replace("%29", ")");
    _desc = _desc.replace("%2A", "*");
    _desc = _desc.replace("%2B", "+");
    _desc = _desc.replace("%2C", ",");
    _desc = _desc.replace("%2D", "-");
    _desc = _desc.replace("%2E", ".");
    _desc = _desc.replace("%2F", "/");
    _desc = _desc.replace("%3A", ":");
    _desc = _desc.replace("%3B", ";");
    _desc = _desc.replace("%3C", "<");
    _desc = _desc.replace("%3D", "=");
    _desc = _desc.replace("%3E", ">");
    _desc = _desc.replace("%3F", "?");
    _desc = _desc.replace("%40", "@");
    _desc = _desc.replace("%5B", "[");
    _desc = _desc.replace("%5C", "\\");
    _desc = _desc.replace("%5D", "]");
    _desc = _desc.replace("%5E", "^");
    _desc = _desc.replace("%5F", "_");
    _desc = _desc.replace("%60", "`");
    _desc = _desc.replace("%7B", "{");
    _desc = _desc.replace("%7C", "|");
    _desc = _desc.replace("%7D", "}");
    _desc = _desc.replace("%7E", "~");

    Разработчики java.net.URLDecoder были идиотами. Напишем КРУЧЕ!

    spbAngel, 24 Октября 2009

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

    +72.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
    TransferInfo info = new QiwiTransferInfo();
    
    if( command.equalsIgnoreCase( "pay" ) )
    {
        ( ( QiwiTransferInfo ) info ).setCommand( QiwiCommand.PAY );
        ( ( QiwiTransferInfo ) info ).setTxnDate( request.getParameter( "txn_date" ) );
    }
    else
    {
        ( ( QiwiTransferInfo ) info ).setCommand( QiwiCommand.CKECK );
    }
    
    ( ( QiwiTransferInfo ) info ).setAmout( Double.parseDouble( amount ) );
    ( ( QiwiTransferInfo ) info ).setTxnId( txn_id );
    ( ( QiwiTransferInfo ) info ).setAccount( account );
    ( ( QiwiTransferInfo ) info ).setCurrency( Currency.getInstance( "RUB" ) );

    C другой стороны, я никогда не могу предсказать что же вернет конструктор...

    spbAngel, 24 Октября 2009

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

    +75.2

    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
    boolean isCustomerWMIDExists = containParameterWithName( request, CUSTOMER_WMID_PARAM_NAME );
    boolean isSellerWMIDExists = containParameterWithName( request, SELLER_WMID_PARAM_NAME );
    boolean isPurseExists = containParameterWithName( request, PURSE_PARAM_NAME );
    boolean isDescriptionExists = containParameterWithName( request, BasePaymentSystem.DESCRIPTION_PARAM_NAME );
    boolean isInvAddressExists = containParameterWithName( request, INVADDRESS_PARAM_NAME );
    boolean isPeriodExists = containParameterWithName( request, PERIOD_PARAM_NAME );
    boolean isExperationExists = containParameterWithName( request, EXPERATION_PARAM_NAME );
    boolean isDateCrtExists = containParameterWithName( request, DATECRT_PARAM_NAME );
    boolean isDateUpdExists = containParameterWithName( request, DATEUPD_PARAM_NAME );
    boolean isWmInvIdExists = containParameterWithName( request, INVID_PARAM_NAME );
    boolean isRequestNExists = containParameterWithName( request, REQUESTN_PARAM_NAME );
    boolean isProjectIdExists = containParameterWithName( request, BasePaymentSystem.PROJECTID_PARAM_NAME );
    boolean isUserIdExists = containParameterWithName( request, BasePaymentSystem.USERID_PARAM_NAME );
    boolean isCurrencyExists = containParameterWithName( request, CURRENCY_PARAM_NAME );
    
    if (isCustomerWMIDExists && isSellerWMIDExists && isPurseExists && isDescriptionExists && isInvAddressExists && isPeriodExists
    		&& isExperationExists && isDateCrtExists && isDateUpdExists && isWmInvIdExists && isRequestNExists && isProjectIdExists
    		&& isUserIdExists && isCurrencyExists)
    {
    	wminfo.setCustomerWMID( request.getParameter( CUSTOMER_WMID_PARAM_NAME ) );
    	wminfo.setSellerWMID( request.getParameter( SELLER_WMID_PARAM_NAME ) );
    	wminfo.setPurse( request.getParameter( PURSE_PARAM_NAME ) );
    	wminfo.setDescription( request.getParameter( BasePaymentSystem.DESCRIPTION_PARAM_NAME ) );
    	wminfo.setInvAddress( request.getParameter( INVADDRESS_PARAM_NAME ) );
    	wminfo.setPeriod( Byte.parseByte( request.getParameter( PERIOD_PARAM_NAME ) ) );
    	wminfo.setExperation( Byte.parseByte( request.getParameter( EXPERATION_PARAM_NAME ) ) );
    	wminfo.setDateCrt( ( getWebMoneyDateString( Long.parseLong( request.getParameter( DATECRT_PARAM_NAME ) ) ) ) );
    	wminfo.setDateUpd( ( getWebMoneyDateString( Long.parseLong( request.getParameter( DATEUPD_PARAM_NAME ) ) ) ) );
    
    	wminfo.setWmInvID( request.getParameter( INVID_PARAM_NAME ) );
    	wminfo.setRequestN( Long.parseLong( request.getParameter( REQUESTN_PARAM_NAME ) ) );
    	wminfo.setCurrency( Currency.getInstance( request.getParameter( CURRENCY_PARAM_NAME ) ) );
    	...
    }

    Разбор параметров GET-запроса, переданных из http://govnokod.ru/2015
    // не дай бог, начальство заметит, что я рабочий код публикую

    spbAngel, 21 Октября 2009

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

    +80.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
    StringBuilder sb = new StringBuilder();
    
    sb.append( "?" + BasePaymentSystem.CHECKPAYMENT_PARAM_NAME + "=true&" + WebMoneyXmlSystem.CUSTOMER_WMID_PARAM_NAME + "="
    		+ getCustomerWMID() + "&" + WebMoneyXmlSystem.CURRENCY_PARAM_NAME + "=" + getCurrency().toString() + "&"
    		+ WebMoneyXmlSystem.SELLER_WMID_PARAM_NAME + "=" + _sellerWMID + "&" + WebMoneyXmlSystem.PURSE_PARAM_NAME + "=" + _purse
    		+ "&" + WebMoneyXmlSystem.DESCRIPTION_PARAM_NAME + "=" + getDescription() + "&" + WebMoneyXmlSystem.INVADDRESS_PARAM_NAME
    		+ "=" + _invAddress + "&" + WebMoneyXmlSystem.PERIOD_PARAM_NAME + "=" + _period + "&"
    		+ WebMoneyXmlSystem.EXPERATION_PARAM_NAME + "=" + _experation + "&" + WebMoneyXmlSystem.DATECRT_PARAM_NAME + "="
    		+ dateCreateMills.toString() + "&" + WebMoneyXmlSystem.DATEUPD_PARAM_NAME + "=" + dateUpdateMills.toString() + "&wmInvId="
    		+ _wmInvId + "&requestN=" + String.valueOf( _requestn ) + "&" + BasePaymentSystem.PROJECTID_PARAM_NAME + "="
    		+ _projectId.toString() + "&" + BasePaymentSystem.USERID_PARAM_NAME + "=" + _userId.toString() );
    
    return new String( sb );

    Формирование строки GET запроса.

    spbAngel, 21 Октября 2009

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