1. Куча / Говнокод #3563

    +130

    1. 1
    awk -F "" 'BEGIN{OFS=""}$890$891$892$893=="0003"{sub("5","2",$917)}{print}' < posting.dat

    Свеженькое:) Только что написал.
    Оказывается, и -F "" на что-то сгодился, зря я на него гнал.

    nil, 24 Июня 2010

    Комментарии (21)
  2. C++ / Говнокод #3562

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    re:    data=new unsigned char[sz+1];
    #ifdef SAFEMEM
        if(!data){ SAFEMEM Sleep(1); goto re;}
    #endif
    
    Источник: http://rsdn.ru/forum/cpp.applied/3852182.aspx

    alexander-berezin, 24 Июня 2010

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ($cmp['id_rcp_prod']) {
        $data['consumed'][] = $det;
    } elseif ($cmp['id_rcp_raw']) {
        $data['consumed'][] = $det;
    } else {
        $data['consumed'][] = $det;
    }

    nekufa, 24 Июня 2010

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

    +179

    1. 1
    ... else document.write("Ваш браузер не поддерживает JavaScript<br>");

    боян с БАШа, прикололо

    ganja_boy, 24 Июня 2010

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

    +152

    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
    $da=0;
    		foreach($_COOKIE as $w=>$e)
    		{
    		if(($e!='') && (substr($w,0,1)=='!')) {$da++;}
    		}
    		if($da==0) {$arResult["ERRORS"][]="Не выбран товар для оформления заказа!";}
    		
    		for($i=2;$i<=2;$i++)
    		{
    		if($i==1) {$str=$_REQUEST["PROPERTY"]["63"]["0"];}
    		if($i==2) {$str=$_REQUEST["PROPERTY"]["67"]["0"];}
    		$e_1=0;
    		$e_2=1;
    		$e_3=0;
    		for($j=0;$j<=strlen($str)-1;$j++)
    		{
    		if(substr($str,$j,1)!=" ") {$e_1=1;}
    		if(substr($str,$j,1)=="." || substr($str,$j,1)==",") {$e_2=0;}
    		}
    		if((int)$str>0) {$e_3=1;}
    		if($e_1==0 || $e_2==0 || $e_3==0) 
    		{
    		if($i==1) {$arResult["ERRORS"][]="Неправильно заполнено поле 'Количество'!";}
    		if($i==2) {$arResult["ERRORS"][]="Неправильно заполнено поле 'Телефон'!";}
    		}

    Круче обфускатора.

    shiz, 24 Июня 2010

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

    +78

    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
    public static Date convertStringToDate(String s) {
            Calendar cl = Calendar.getInstance();
            
            if (s.length() < 8) {
                return null;
            }
            if (s.length() > 8) {
                cl.set((new Integer(s.substring(0, 4))).intValue(),
                        (new Integer(s.substring(4, 6))).intValue() - 1,
                        (new Integer(s.substring(6, 8))).intValue(),
                        (new Integer(s.substring(8, 10))).intValue(),
                        (new Integer(s.substring(10, 12))).intValue(),
                        (new Integer(s.substring(12, 14))).intValue());
            } else {
                cl.set((new Integer(s.substring(0, 4))).intValue(),
                        (new Integer(s.substring(4, 6))).intValue() - 1,
                        (new Integer(s.substring(6, 8))).intValue(), 0, 0, 0);
            }
            return cl.getTime();
        }

    Люблю велосипеды

    lotik, 24 Июня 2010

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

    +72

    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
    String.format(
            "<b>%s:%s %s %s %d</b>",
            setDisplayFromNumber(calendar.get(GregorianCalendar.HOUR_OF_DAY)), 
            setDisplayFromNumber(calendar.get(GregorianCalendar.MINUTE)),
            setDisplayFromNumber(calendar.get(GregorianCalendar.DAY_OF_MONTH)),
            getMonthNameFromNumber(calendar.get(GregorianCalendar.MONTH)),
            calendar.get(GregorianCalendar.YEAR)
    );
    
    private String setDisplayFromNumber(Integer number) {
        if(number < 10) {
            return String.format("0%d", number);
        }
        else {
            return number.toString();
        }
    }

    yvu, 24 Июня 2010

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

    +115

    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
    private int? ID {
    	set {
    		if (ViewState["ID"] != null)
    			ViewState["ID"] = value;
    		else
    			ViewState.Add("ID", value);
    	}
    	get {
    		if (ViewState["ID"] != null)
    			return Convert.ToInt32(ViewState["ID"]);
    		else
    			return null;
    	}
    }

    Back, 24 Июня 2010

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

    +148

    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
    struct table1
    
    {
    
    	char name_of_function[3];
    
    	char name_of_variable[3];
    
    	char values[50];
    
    };
    
    struct table2
    
    {
    
    	char name_of_function[3];
    
    	char name_of_variable[3];
    
    	char values[50];
    
    };
    
    ///
    
    table1 potential[10];
    table2 returned[10];
    
    ///
    
     if(strcmp(s,returned[m].name_of_function)==0)
    						 {
    							while((strcmp(potential[mm].name_of_function,returned[m].name_of_function)!=0)&&mm<10){mm++; mmm=mm;}
    							if((strcmp(potential[mmm].name_of_function,returned[m].name_of_function)==0)&&mm<10)
    							{	
    								while(strcmp(potential[mmm].name_of_function,returned[m].name_of_function)==0){mmm++;}
    								mmm--;
    								while((mm<=mmm)&&bo==false)
    								{
    									if(strcmp(potential[mmm].name_of_variable,returned[m].name_of_variable)==0)
    									{
    										strcpy(returned[m].values,potential[mmm].values);
    										bo=true;
    									}
    									mmm--;
    								}
    								if(bo==false)
    								{
    									strcpy(returned[m].values,"ax\0");
    								}
    							}							
    						 }
    ///

    Лишь небольшой кусок из курсового проекта.

    Mifodix, 24 Июня 2010

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

    +82

    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
    //i dont know full description of this errors. i just copied it from official specification :)
        String[] eType =  new String[] {
            "Pending communication transaction in progress (0x20)",
            "Specified mailbox queue is empty (0x40)",
            "Request failed (i.e. specified file not found) (0xBD)",
            "Unknown command opcode (0xBE)",
            "Insane packet (0xBF)",
            "Data contains out-of-range values (0xC0)",
            "Communication bus error (0xDD)",
            "No free memory in communication buffer (0xDE)",
            "Specified channel/connection is not valid (0xDF)",
            "Specified channel/connection not configured or busy (0xE0)",
            "No active program (0xEC)",
            "Illegal size specified (0xED)",
            "Illegal mailbox queue ID specified (0xEE)",
            "Attempted to access invalid field of a structure (0xEF)",
            "Bad input or output specified (0xF0)"
        };

    перевод: Я не знаю, что все эти ошибки означают. Я просто скопировал это из оффициальной документации.
    всясуть жаба-кодеров.

    danilissimus, 23 Июня 2010

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