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

    Всего: 116

  2. Java / Говнокод #10395

    +123

    1. 1
    createCanvas(); // create canvas!

    Комментарии от Кэпа.

    someone, 29 Мая 2012

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

    +119

    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
    /**
     * crane looks like this: ("----" - fork, "ssss" - stand, "xxx" - crane rail)
     * 
     * ----- .pos2 __/0/ ----- | sssss | sssss | xxx | ----- distance between stands .pos1 __|/distance/ ----- sssss
     * sssss xxx xxx xxx xxx xxx xxx
     * 
     * so if pos2 defined - it will be the second fork; BUT! if the flag "draw second stand" defined - that will draw or
     * not draw the stand for pos1...
     * 
     * if there is just one fork but two TUs to handle is possible:
     * 
     * xxx ________ .pos1 .pos2 ________ sssss sssss xxx xxx xxx
     */

    someone, 29 Мая 2012

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

    +127

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    pFirst = new LinePoints;
    pFirst->ptPixel.x = ptOrig.x*szStart.cx/15 + ptStart.x;
    pFirst->ptPixel.y = (15-ptOrig.y)*szStart.cy/15 + ptStart.y;
    pFirst->next = NULL;
    if(pFirst != NULL)
    {
        ...

    Ну а правда, вдруг NULL?

    someone, 24 Мая 2012

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

    +132

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Asynchronously load the DXF.
    // While we're doing that, the data can change, so we should guard against it.
    new WebappResourceLoader().loadResource(ResourceType.DXF, sDxfName + ".dxf",
    	new ResourceCallback<List<String>>() {
    		@Override
    		public void onSuccess(final List<String> result) {
    			if (!sDxfName.equals(dxfToLoad)) {
    				// Too slow, dude.
    				return;
    			}

    someone, 25 Апреля 2012

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

    +70

    1. 1
    if (sAttrName.equalsIgnoreCase("10")) {

    someone, 23 Апреля 2012

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

    +119

    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
    if(bCanPut)
    {
    	
    	m_RealTexts[nIndex].txtStartPt.x = ptStandard.x + (szStandard.cx-szTxtDC.cx)/2.0;
    	m_RealTexts[nIndex].txtStartPt.y = ptStandard.y + (szStandard.cy-szTxtDC.cy)/2.0;
    	m_RealTexts[nIndex].txtSize = szTxtDC;
    	m_RealTexts[nIndex].txtMovePt.x = 0.0 - (szStandard.cx-szTxtDC.cx)/2.0;
    	m_RealTexts[nIndex].txtMovePt.y = 0.0 - (szStandard.cy-szTxtDC.cy)/2.0;
    }
    else
    {
    	
    	m_RealTexts[nIndex].txtStartPt.x = ptStandard.x + (szStandard.cx-szTxtDC.cx)/2.0;
    	m_RealTexts[nIndex].txtStartPt.y = ptStandard.y + (szStandard.cy-szTxtDC.cy)/2.0;
    	m_RealTexts[nIndex].txtSize = szTxtDC;
    	m_RealTexts[nIndex].txtMovePt.x = 0.0 - (szStandard.cx-szTxtDC.cx)/2.0;
    	m_RealTexts[nIndex].txtMovePt.y = 0.0 - (szStandard.cy-szTxtDC.cy)/2.0;
    }

    someone, 12 Апреля 2012

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

    +110

    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
    public abstract class AbstractSegment<P extends Number, V extends IOffsettable<P, V>,
    		U extends AbstractSegment<P, V, U>> implements IOffsettable<P, U>, Iterable<V>, Serializable {
    	...
    	
    	protected final List<V> offsetHelper(final P dx, final P dy) {
    		return Lists.transform(points, new Function<V, V>() {
    			@Override
    			public V apply(final V input) {
    				return input.offset(dx, dy);
    			}
    		});
    	}
    
    
    
    public final class FloatSegment extends AbstractSegment<Float, FloatPoint, FloatSegment> {
    	...
    	@Override
    	public FloatSegment offset(final Float dx, final Float dy) {
    		return new FloatSegment(offsetHelper(dx, dy));
    	}
    }

    someone, 11 Апреля 2012

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

    +116

    1. 1
    return Long.parseLong(content.substring(content.lastIndexOf('/' + 1)));

    Пришлось поразмыслить, почему не работает.

    someone, 09 Марта 2012

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

    +119

    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
    ApiException(final ResourceException cause, final Representation repr,
    			final Class<? extends ErrorResponse> responseClass) {
    		super(cause);
    		this.cause = cause;
    		
    		ErrorResponse response = null;
    		
    		try {
    			response = new ObjectMapper().readValue(repr.getText(), responseClass);
    		} catch (final Exception e) {
    			log.error("Error attempting to parse the error response", e);
    		} finally {
    			this.response = response;
    		}
    	}

    Возникла ошибка при возникновении ошибки...

    someone, 28 Февраля 2012

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

    +110

    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
    <!--
    			BEGIN RIDICULOUSLY LONG BATIK SECTION
    			
    			Do not touch. This is fragile stuff. Seriously.
    			
    			Batik just *wants* to pull xalan and xml-apis, *everywhere*,
    			even though we do not want this. And Ivy isn't clever enough
    			to ignore the dependencies everywhere.
    			
    			In an ideal world we would just explicitly depend on batik-swing
    			and batik-transcoder and be done with it. Instead we have to do
    			this atrocity. Apache, take a hint, would you kindly?
    		-->
    		<dependency org="org.apache.xmlgraphics" name="batik-xml" rev="[1.7,)">
    			<exclude org="xalan" module="xalan" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-ext" rev="[1.7,)">
    			<exclude org="xml-apis" module="xml-apis" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-css" rev="[1.7,)">
    			<exclude org="xml-apis" module="xml-apis" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-dom" rev="[1.7,)">
    			<exclude org="xml-apis" module="xml-apis" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-parser" rev="[1.7,)">
    			<exclude org="xml-apis" module="xml-apis" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-anim" rev="[1.7,)">
    			<exclude org="org.apache.xmlgraphics" module="batik-svg-dom" />
    			<exclude org="xml-apis" module="xml-apis" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-svg-dom" rev="[1.7,)">
    			<exclude org="xml-apis" module="xml-apis" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-bridge" rev="[1.7,)">
    			<exclude org="org.apache.xmlgraphics" module="batik-script" />
    			<exclude org="org.apache.xmlgraphics" module="batik-gvt" />
    			<exclude org="xml-apis" module="xml-apis" />
    			<exclude org="xalan" module="xalan" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-gvt" rev="[1.7,)">
    			<exclude org="org.apache.xmlgraphics" module="batik-script" />
    			<exclude org="xml-apis" module="xml-apis" />
    			<exclude org="xalan" module="xalan" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-gui-util" rev="[1.7,)">
    			<exclude org="xalan" module="xalan" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-script" rev="[1.7,)">
    			<exclude org="xalan" module="xalan" />
    		</dependency>
    		<dependency org="org.apache.xmlgraphics" name="batik-swing" rev="[1.7,)" />
    		<dependency org="org.apache.xmlgraphics" name="batik-transcoder" rev="[1.7,)" />
    		<!-- END BATIK SECTION -->

    Из ivy.xml.

    someone, 22 Февраля 2012

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