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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Долбанный андроид.
    Почему когда я обновляю приложения памяти всё меньше и меньше?
    Он что, при обновлении оставляет предыдущие версии?
    Просто охуеть. Телефону 3 года, поставлено 2 приложении, а памяти, блять, уже нет.
    ЧЗХ?

    LinuxGovno, 10 Октября 2018

    Комментарии (193)
  2. Куча / Говнокод #24887

    −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
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    func (incident Incident) DeleteResponsibleMicroservices(microservices []string) {
    	var teamsDelete []string
    	responsibleMss := incident.GetResponsibleMicroservices()
    	for _, microservice := range microservices {
    	ResponsibleMssLoop:
    		for _, responsibleMs := range responsibleMss {
    			if microservice == responsibleMs.MicroserviceId {
    				service.GetInstanceDB().Delete(responsibleMs)
    				if team, ok := GetTeamByMs(microservice); ok != false {
    					for _, ms := range incident.GetResponsibleMicroservices() {
    						if teamFind, ok := GetTeamByMs(ms.MicroserviceId); ok != false && teamFind == team {
    							continue ResponsibleMssLoop
    						}
    					}
    					teamsDelete = append(teamsDelete, team)
    				}
    			}
    		}
    	}
    	if len(teamsDelete) > 0 {
    		incident.DeleteResponsibles(teamsDelete)
    	}
    }

    Отличное читается код на Golang

    prostohz, 09 Октября 2018

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

    −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
    int** delete_row(int** arr, int &row_count, int  n) 
    {
            delete arr[n-1];
        	for (int i = n-1; i < row_count-1; i++) 
            {
                    arr[i] = arr[i+1];
        	}
        	arr[row_count-1] = NULL;
        	delete arr[row_count-1];
            row_count--; 
        	return arr;
    }

    dumiv, 09 Октября 2018

    Комментарии (155)
  4. Swift / Говнокод #24885

    0

    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
    enum ErrorViewHelper {
    
        static var errorIsShown = false
        static var errorView: ErrorView?
    
        private static var errorWindow: UIWindow = {
            let width = (UIApplication.shared.delegate as? AppDelegate)?.window?.frame.size.width ?? 300
            let window = UIWindow(frame: CGRect(x: 0, y: 0, width: width, height: 300))
            return window
        }()
    
        static func show(error: Error) {
            if let error = error as? RequestError {
                switch error {
                case .error(description: let text):
                    showErrorView(error: text)
                case .errorWithMeta(description: let text, meta: _):
                    showErrorView(error: text)
                case .needAuthError:
                    showErrorAlert(title: nil, message: R.string.localizable.needAuthError()) {
                        // TODO: remove router from this class
                        AuthRouterImpl().showAuthPage()
                        AuthRouterImpl().showAuthFlowModally()
                    }
                case .badResponse:
                    showErrorView(error: R.string.localizable.badResponse())
                default: break
                }
            } else {
                showErrorView(error: error.text)
            }
        }

    vkasci, 09 Октября 2018

    Комментарии (20)
  5. Perl / Говнокод #24884

    +1

    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
    #! /usr/bin/perl
    
    use strict;
    use warnings;
    
    my %h1 = (one => 1, two => 2);
    my %h2 = (three =>3 , four => 4);
    
    sub h_uno { \%h1 }
    
    sub h_multi {
        my %all = (%h1, %h2);
    
        \%all;
    }
    
    while (my ($k, $v) = each %{h_uno()}) {
        print "k=$k, v=$v\n";
    }
    
    # следующий цикл не завершится никогда
    #while (my ($k, $v) = each %{h_multi()}) {
    #    print "k=$k, $v=$v\n";
    #}

    Один из традиционных подколов собеседований на Perl вакансию.

    https://www.linux.org.ru/forum/job/14518840

    Elvenfighter, 09 Октября 2018

    Комментарии (55)
  6. Куча / Говнокод #24880

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    Давайте обсудим документацию для программ на GNU/Linux, и документацию MSDN.
    
    Я считаю, что по архитектуре и по документации GNU/Linux намного лучше.
    Потому что в man обычно декларативный стиль, и описывается поведение.
    Если же читать о windows программах -- то я обычно натыкаюсь на тупо гайды, где не описано конкнетно для чего такие действия нужно делать, 
    и как это будет обработано внутренней логикой программы.
    
    Linux -- ОС для разработчиков и инженеров ПО. Windows -- сомневаюсь что нацелена на это.

    OlegUP, 08 Октября 2018

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

    +6

    1. 1
    Забаньте DOKTOPuHXO

    3oJloTou_xyeLL, 08 Октября 2018

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

    −5

    1. 1
    2. 2
    3. 3
    4. 4
    Сема. Я чота на винде нажал, теперь у меня любая клавиша - горячая, не могу не написать нихуя
    
    Даже в сонсоле не могу нихуя, что за хуйня? Опять винду переустанавливать?
    В ЛИНУКСЕ ТАКОЙ ХУЙНИ НЕБЫЛО!

    TOPT, 08 Октября 2018

    Комментарии (112)
  9. Pascal / Говнокод #24872

    0

    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
    procedure TMainForm.FormCreate(Sender: TObject);
    var
      s : String;
      reg : TRegistry;
    begin
      SetLength (s, Max_Path);
      SHGetSpecialFolderPath (0, PChar(s), CSIDL_COMMON_APPDATA, false);
      AppDataPath := s + '\Test\';
      ShowMessage (AppDATAPath);
    end;
    
    , где AppDataPath : string;
    Только вот в AppDataPath находиться только S, а должно быть s + '\Test\'
    Вопрос: Почему?
    Заранее благодарен
    
    
    
    Потому что нельзя передавать паскалевскую строку в виде PChar в функцию, которая будет её там модифицировать. Нужно делать так:
    
    Код:
    var
      s : array[ 0..MAX_PATH ] of Char;
      reg : TRegistry;
    begin
      s[ 0 ] := #0;
      SHGetSpecialFolderPath (0, s, CSIDL_COMMON_APPDATA, false);
      AppDataPath := s + '\Test\';
      ShowMessage (AppDATAPath);
    end;
    
    http://www.programmersforum.ru/showthread.php?t=84319

    @Потому что нельзя передавать паскалевскую строку в виде PChar в функцию, которая будет её там модифицировать.
    Ахуенно крутой спец по строкам.

    Кстати, https://primechaniya.ru/home/news/oktyabr-2018/v-tatarstane-18-podrostkov-otravilis-kitajskimi-duhami/

    BagorCtretora, 08 Октября 2018

    Комментарии (66)
  10. Си / Говнокод #24870

    −1

    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
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    #include<stdio.h>
    #include<stdlib.h>	
    #include<string.h>		
    struct masterRecord{ int 		Number; char 		Name[20]; char 		Surname[20]; char 		addres[30]; char 		TelNumber[15]; double  	indebtedness; double    	credit_limit;  double  	cash_payments; };
    	typedef  struct  masterRecord Data;
    	int main(void){
    		int choice = 0;	
    		void masterWrite(FILE *ofPTR, Data   Client       )  ,transactionWrite(FILE *ofPTR, Data transfer     )   ,      blackRecord(FILE *ofPTR, FILE  *ofPTR_2 , FILE *blackrecord , Data	 client_data  ,   Data transfer )                    ;
    		FILE *Ptr, *Ptr_2 , *blackrecord   ;
    	  	Data	 client_data,  transfer  ;
    	printf("%s", "please enter action\n1 enter data client:\n2 enter data transaction:\n3 update base\n" );
    			while (		scanf("%d", &choice )  !=  -1   )  {
    				switch(  choice  )  {
    				case	1:
    					Ptr = fopen("record.dat", "r+" );
    						if(Ptr == NULL ){
    						puts("Not acess");	
    						}
    					else{
    							masterWrite(  Ptr , client_data);	
    							fclose(Ptr);
    							}
    					break;
    				case    2:
    					Ptr = fopen("transaction.dat", "r+" );
    						if(Ptr == NULL ){
    						puts("Not acess");	
    						}
    					else{
    						transactionWrite( Ptr, transfer     );
    						fclose(Ptr);
    					}
    					break;	
    				case    3:
    					Ptr = fopen( "record.dat", "r"  );
    					Ptr_2 = fopen("transaction.dat", "r" );
    					blackrecord = fopen("blackrecord.dat", "w" );	
    				if(	Ptr == NULL ||  	Ptr_2 == NULL ||  		blackRecord == NULL      ){
    						puts("exit");
    					}
    					else{
    					blackRecord( Ptr, Ptr_2 , blackrecord  , client_data  ,    transfer );
    					fclose(Ptr);
    					fclose(Ptr_2);	
    					fclose(blackrecord);
    					}
    					break;
    					default:
    					puts("error");
    					break ;
    				}
     	printf("%s", "please enter action\n1 enter data client:\n2 enter data transaction:\n3 update base\n" );
    		}
                return 0;	
    	}
    	void masterWrite(FILE *ofPTR , Data   Client       )  {
    		printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n",  
    				"1 Number account: ",
    				"2 Client name: ",
    				"3 Surname: ",
    				"4 Addres client: ",
    				"5 Client Telnum: ",
    				"6 Client indebtedness: ",
    				"7 Client credit limit: ",
    				"8 Client cash payments: " );
    		while(  scanf("%d%s%s%s%s%lf%lf%lf", &Client.Number, Client.Name, Client.Surname, Client.addres, Client.TelNumber, &Client.indebtedness,	&Client.credit_limit ,	&Client.cash_payments    ) != -1     ){
    		fprintf( ofPTR, "%-12d%-11s%-11s%-16s%20s%12.2f%12.2f%12.2f\n", Client.Number, Client.Name, Client.Surname, Client.addres, Client.TelNumber, Client.indebtedness,	Client.credit_limit ,		 	Client.cash_payments    ) ;
    		printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n",  
    				"1 Number account: ",
    				"2 Client name: ",
    				"3 Surname: ",
    				"4 Addres client: ",
    				"5 Client Telnum: ",
    				"6 Client indebtedness: ",
    				"7 Client credit limit: ",
    				"9 Client cash payments:"
    										);
    				} }
           void transactionWrite(FILE *ofPtr, Data transfer     ){
    		printf("%s\n%s\n",  
    			"1 Number account: ",
    			"2 Client cash payments: ");
    			while(scanf("%d %lf" , &transfer.Number  , &transfer.cash_payments )   != -1      ){
    				fprintf( ofPtr, "%-3d%-6.2f\n", transfer.Number, 		transfer.cash_payments    ) ;
    				printf("%s\n%s\n",  
    						"1 Number account:",
    						"2 Client cash payments: "
    												);
    			} }
       void blackRecord(FILE *ofPTR, FILE  *ofPTR_2 , FILE *blackrecord , Data	 client_data  ,   Data transfer ){
    	while(fscanf( 	ofPTR  , "%d%s%s%s%s%lf%lf%lf",  &client_data.Number ,  client_data.Name  , client_data.Surname   , client_data.addres, client_data.TelNumber, &client_data.indebtedness, &client_data.credit_limit, &client_data.cash_payments)   != -1 )  {
    			while (	fscanf(	ofPTR_2 , "%d %lf",  &transfer.Number , &transfer.cash_payments       ) 	  !=  -1 ){
    					if(     client_data.Number     ==   transfer.Number   &&  transfer.cash_payments != 0         ){
    						client_data.credit_limit += transfer.cash_payments;
    					} 
    				}
    			fprintf(blackrecord   ,"%-12d%-11s%-11s%-16s%20s%12.2f%12.2f%12.2f\n", client_data.Number, client_data.Name, client_data.Surname, client_data.addres, client_data.TelNumber, client_data.indebtedness,	client_data.credit_limit ,  client_data.cash_payments    ) ;
    			rewind(	ofPTR_2 );
    		} }

    В новом Сорокине мне больше всего понравились "Фиолетовые лебеди".

    tyrin, 07 Октября 2018

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