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

    +79

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    /**
     * @return
     * true - если все строчки выделены,
     * false - если все строчки не выделены,
     * null - если есть как выделенные, так и не выделенные строчки
     */
    private Boolean lookRowsDownwards(ColumnHolder rowHolder, boolean isPreviousRowsSelected) {

    это реализация переключателя с 3-мя состояниями

    Demetr, 06 Июля 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    WCHAR *qStringToWideChar(const QString &str) {
        if (str.isNull())
            return 0;
        WCHAR *result = new WCHAR[str.length() + 1];
        for (unsigned int i = 0; i < str.length(); ++i)
            result[i] = str[i].unicode();
        result[str.length()] = 0;
        return result;
    }

    Опять неосиляторы ассистента издеваются над Qt.

    panter_dsd, 06 Июля 2011

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $pos = strpos($pp_req, '&FIRSTNAME=');
            if ($pos === false) {
                $pos = strpos($pp_req, '&SHIPTONAME=');
            }
            return $res;

    kovel, 06 Июля 2011

    Комментарии (6)
  4. bash / Говнокод #7174

    −352

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    #!/bin/bash
    function f() {
        sleep "$1"
        echo "$1"
    }
    while [ -n "$1" ]
    do
        f "$1" &
        shift
    done
    wait

    example usage:
    ./sleepsort.bash 5 3 6 3 6 3 1 4 7

    Метод сортировки :)
    Взято с:
    http://dis.4chan.org/read/prog/1295544154

    ramzes_2, 06 Июля 2011

    Комментарии (15)
  5. JavaScript / Говнокод #7173

    +174

    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
    // привет помоги почему скрипт не работает? он делает лоадер загрузки страницы а потом когда уже все загружено то скрипты подключает
    
    if($(document).ready(function(){return "true";})) {
    $(document).ready(function(){//
    $('div:eq(32)').addClass('LOADED'"+);
    $('body').removeClass('LOADIING');
    $("head").html(+$("head").html()+"+<script type=text/javascript src=../jquery.1.6.min.js></script>"+");
    $(function(){
    if(typeof jquery===function && typeof $===typeof jquery){$.get('/load/0-0-0-0-17',function(DATA){
    if(data){
    if(data!=undefined){
    $("div:contains('Друзья')").html($("[id*=entry]", DATA).append("true"))}}
    })} 
    })
    })
    } else {alert("ОШИБКА ЗАГРУЗКИ СТРАНИЦЫ!"+\n")}

    Йобаннаврот!

    stuffort, 06 Июля 2011

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

    +93

    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
    Label 1, 2;
    var
     M,n:integer;
     B:real;
    Begin
     Read(m,n);
     2:
     B:=m mod n;
     If b=0 then goto 1 else
    Begin
     M:=n; n:=b;
     Goto 2;
    End;
     1:
    Write(n);
    End.

    Кaк бэ прогрaммноe рeaлизaциё aлгоритмa Евклидa, нaхождeниe мaксимaльного дeлитeля двух чисeл, кaк-то тaк.

    KATAJIU3ATOP, 06 Июля 2011

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

    +147

    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
    #include <math.h>
    #include <iostream>
    #include <conio.h>
    #include <istream>
    using namespace std;
    
    class Complex{
    public:
    	double real;
    	double image;
    	Complex(){};
    	Complex(double re){real = re;	image = 0;}
    	Complex(double re, double im){real = re ; image = im ;}
    	
    	~Complex(){}
    	
    	Complex & operator=(Complex &);
    	Complex & operator=(double);
    		
    		
    	double abs(){
    	return sqrt(real * real + image * image);
    	}
    	double arg(){
    		return (2*atan(image/(real+abs())));
    	}
    	double imag(){
    		return image;
    	}
    	double re(){
    		return real;
    	}
    	inline friend Complex operator+(const Complex, const Complex);
    	Complex operator+();
    	inline friend Complex operator-(const Complex, const Complex);
    	inline friend Complex operator*(const Complex, const Complex);
    	inline friend Complex operator*(Complex, double);
    	inline friend Complex operator/(const Complex, const Complex);
    	inline friend Complex operator/(const Complex, const double);
    	inline friend Complex operator+=(Complex, Complex);
    	inline friend Complex operator+=(Complex, double);
    	inline Complex conj(Complex fp1);
    	inline Complex Complex::expon(Complex fp1);
    	inline Complex Complex::sinus(Complex fp1);
    	inline Complex Complex::cosinus(Complex fp1);
    	inline Complex Complex::hypercosinus(Complex fp1);
    	inline Complex Complex::hypersinus(Complex fp1);
    	inline Complex Complex::logarithm(Complex fp1);
    	
    	friend ostream &operator<<(ostream &, Complex &);
    	friend istream &operator>>(istream &, Complex &);
    };
    const Complex _i = Complex(0,1);
    
    Complex Complex::operator+()
    {
    	return *this;
    }
    Complex operator+(const Complex fp1, const Complex fp2)
    	{
    		Complex fp;
    	fp.real = fp1.real + fp2.real;
    	fp.image = fp1.image + fp2.image;
    	return fp;
    	} 
    Complex operator+=(Complex fp1, Complex fp2)
    {
    	fp1.real = fp1.real + fp2.real;
    	fp1.image = fp1.image + fp2.image;
    	return fp1;
    }
    Complex operator+=(Complex fp1, double dbl)
    {
    	fp1.real = fp1.real + dbl;
    	return fp1;
    }
    Complex operator-(const Complex fp1, const Complex fp2)
    	{
    		Complex fp;
    	fp.real = fp1.real - fp2.real;
    	fp.image = fp1.image - fp2.image;
    	return fp;
    	} 
    Complex operator*(const Complex fp1, const Complex fp2)
    	{
    	Complex fp;
    		fp.real = fp1.real * fp2.real - fp1.image * fp2.image;
    		fp.image = fp1.real * fp2.image + fp1.image * fp2.real;
    	return fp;
    	}
    Complex operator*(Complex fp1, double dbl)
    {
    		fp1.real = dbl * fp1.real;
    		fp1.image = dbl * fp1.image;
    		return fp1;
    } 	
    Complex operator/(const Complex fp1, const Complex fp2)
    	{
    	double k;
    	Complex fp;

    лаба по ИВТ.. класс для работы с комплексными числами

    Chekist, 06 Июля 2011

    Комментарии (19)
  8. Си / Говнокод #7170

    +148

    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
    #include <stdio.h>
    #include <stdlib.h>
    #include <conio.h>
    #include <iostream>
    #include <string.h>
    #include <io.h>
    #include <fcntl.h>
    
    struct student {
    	char FIO[40];
    	char Group[10];
    	int TaoN;
    	char Ball[3];
    }qt,st,zt,*zap;
    int flen(char * fname){
    	int handle, len;
    	handle = open(fname,O_RDWR);
    	len = filelength(handle);
    	close(handle);
    	return len;
    }
    void writte(FILE *f){
    
    	int  ret;
    	
    	printf("\t\t\tЗАПОЛНЕНИЕ БАЗЫ:\n\n");
    	printf("ФИО:\t\t");
    	scanf("%s", &st.FIO);
    	printf("ГРУППА:\t\t");
    	scanf("%s", &st.Group);
    	printf("НОМЕР ЗАЧЕТКИ:\t");
    	scanf("%d", &st.TaoN);
    	printf("БАЛЛ:\t\t");
    	scanf("%s", &st.Ball);
    
    	ret = atoi(st.Ball);
    	
    	for(;;)
    	if((ret != 1) && (ret != 2) && (ret != 3) && (ret != 4) && (ret != 5)){
    		printf("Неверный символ. Введите число\n");
    		printf("БАЛЛ:\t\t");
    		scanf("%s", &st.Ball);
    		ret = atoi(st.Ball);
    	}
    	else break;
    			
    	f = fopen("data.txt","a+");
    	fwrite(&st, sizeof(st), 1, f);
    fclose(f);
    
    };
    void readd(student st,FILE *f){
    	int len,i,n;
    
    	system("cls");
    	printf("\t\t\tЧТЕНИЕ БАЗЫ:\n\n");
    
    	f = fopen("data.txt","r+");
    	len = flen("data.txt");
    	n = len/sizeof(st);
    
    	for(i = 0; i < n; i++)
    	{
    		fread(&st, sizeof(st), 1, f);		
    		printf("ФИО:\t\t%s\n", st.FIO);
    		printf("ГРУППА:\t\t%s\n", st.Group);
    		printf("ЗАЧЕТКА:\t%d\n", st.TaoN);
    		printf("БАЛЛ:\t\t%d\n", st.Ball);
    	printf("\n");
    	}
    	
    }
    void Searc(student zt,student st,FILE *f){
    	int len, n, i;
    
    	system("cls");
    	printf("\t\t\tПОИСК В БАЗЕ:\n\n");
    	printf("ФИО: ");
    	scanf("%s", &zt.FIO);
    	printf("\n");
    
    	if (strlen(zt.FIO) != 0){
    		f = fopen("data.txt","r+");
    		len = flen("data.txt");
    			n = len/sizeof(st);
    		for(i = 0; i < n; i++){
    			fread(&st, sizeof(st), 1, f);
    			int rt = strcmp(st.FIO, zt.FIO);
    			if (rt == 0)
    			{
    				printf("ФИО: ");
    				printf("\t\t%s\n", st.FIO);
    				printf("ГРУППА: ");
    				printf("\t%s\n", st.Group);
    				printf("ЗАЧЕТКА: ");
    				printf("\t%d\n", st.TaoN);
    				printf("БАЛЛ: ");
    				printf("\t\t%d\n", st.Ball,"\n");
    			}
    		}

    Chekist, 06 Июля 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    <?php
    $opis = trim(esc(implode(NULL,file($dir_loads.'/'.$file.'.txt'))));  // читаем файл
    echo $opis;
    ?>

    Без комментариев даже..

    icq677555, 06 Июля 2011

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

    +132

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <div class="su_mainText">
           <h2>
                    <p>Thank you for taking the time to provide us with your suggestion(s).</p>
                    <p>Out intent is to continually enhance our program and we are</p>
                    <p>looking to our customer for guidance.</p>
            </h2>
    </div>

    ....задаем стиль текста на странице

    _vinka, 06 Июля 2011

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