Fixed – NetworkUXBroker.exe Runtime error – Windows 10

December 29th, 2015 No comments

With the latest Windows 10 november update, most of you must have experienced NetworkUXbroker.exe Runtime error while trying to connect to a 802.11x. A dialog box appears Microsoft Visual C++ Runtime Library.

This dialog box appears every time you click on the network connections icon at the taskbar. And after showing up this dialog box the college’s wifi connection does not respond to the click.

Here a fix. Just download the registry file “Disable_TLS_1.2“, unzip and execute it and restart your PC. Hope it helps.

Categories: Computer Software Tags:

Simulation Of a Cognitive Radio System In Matlab

April 1st, 2015 No comments

Save the following as crad.m and execute!

    clc
    close all
    clear all
    
    t = 0:0.00001:0.001;
    Fc1 = 1000;
    Fc2 = 2000;
    Fc3 = 3000;
    Fc4 = 4000;
    Fc5 = 5000;
    Fs = 12000;
    y1 = 1; y2 = 0; y3 = 0; y4 = 0; y5 = 0; Y = 0; y = 0;
    
    x1 = cos(2*pi*1000*t);
  
    in_p = input('\nDo you want to enter first primary user Y/N:  ','s');
   
    
    if(in_p == 'Y' | in_p == 'y')
        y1 = ammod(x1,Fc1,Fs);
        
    end
    
    in_p = input('Do you want to enter second primary user Y/N:  ','s');
    
    if(in_p == 'Y' | in_p == 'y')
        y2 = ammod(x1,Fc2,Fs);
    
    end
        
    in_p = input('Do you want to enter third primary user Y/N:  ','s');

    if(in_p == 'Y' | in_p == 'y')
        y3 = ammod(x1,Fc3,Fs);
       
    end

    in_p = input('Do you want to enter fourth primary user Y/N:  ','s');

    if(in_p == 'Y' | in_p == 'y')
        y4 = ammod(x1,Fc4,Fs);
    
    end

    in_p = input('Do you want to enter fifth primary user Y/N:  ','s');
    
    if(in_p == 'Y' | in_p == 'y')
        y5 = ammod(x1,Fc5,Fs);
        
    end
    
    y = y1 + y2 + y3 + y4 + y5;
    
while(1)
    
        Pxx = periodogram(y);
        Hpsd = dspdata.psd(Pxx,'Fs',Fs);
        plot(Hpsd);
    
        
  in_p = input('\nDo you want to enter a secondary user Y/N:  ','s');
 
    if(in_p == 'Y' | in_p == 'y')
    
        
    
        tp=0;
        chek1 = Pxx(25)*10000;
        chek2 = Pxx(46)*10000;
        chek3 = Pxx(62)*10000;
        chek4 = Pxx(89)*10000;
        chek5 = Pxx(105)*10000;
        
        if(chek1 < 8000)
            disp('Assigned to User 1 as it was not present.');
            y1 = ammod(x1,Fc1,Fs);
    

    elseif (chek2 < 8000)
            disp('Assigned to User 2 as it was not present.');
            y2 = ammod(x1,Fc2,Fs);
        
    
        elseif(chek3 < 8000)
            disp('Assigned to User 3 as it was not present.');
            y3 = ammod(x1,Fc3,Fs);
        
    
        elseif(chek4 < 8000)
            disp('Assigned to User 4 as it was not present.');
            y4 = ammod(x1,Fc4,Fs);
        

        elseif(chek5 < 8000)
            disp('Assigned to User 5 as it was not present.');
            y5 = ammod(x1,Fc5,Fs);
        else
            disp('all user slots in use. try again later,');
            tp=1;
        end
        
        figure
        y = y1 + y2 + y3 + y4 + y5 ;
        Pxx = periodogram(y);                   
        Hpsd = dspdata.psd(Pxx,'Fs',Fs);
        plot(Hpsd);
         
         %,,,,,,,,,,,slot empty operation,,,,,,,,,,,,,,
        if(tp==1)
        inp_t=input('do u want to empty a slot:     ','s');
        if(inp_t=='Y'|inp_t=='y')
            inp_t=input('which slot do u want to empty for ur entry:     ','s');
            switch(inp_t)
                
                case ('1')
                    y1=0;
                    disp('slot1 is fired');
                    y = y1 + y2 + y3 + y4 + y5;
                    Pxx = periodogram(y);                   
                    Hpsd = dspdata.psd(Pxx,'Fs',Fs);
                    plot(Hpsd);
                    %break;
                
                case('2')
                    y2=0;
                    disp('slot2 is fired');
                    y = y1 + y2 + y3 + y4 + y5;    
                    Pxx = periodogram(y);
                    Hpsd = dspdata.psd(Pxx,'Fs',Fs);
                    plot(Hpsd);
                    %break;
                
                case('3')
                    y3=0;
                    disp('slot3 is fired');
                    y = y1 + y2 + y3 + y4 + y5;
                    Pxx = periodogram(y);
                    Hpsd = dspdata.psd(Pxx,'Fs',Fs);
                    plot(Hpsd);
                    %break;
                
                case('4')
                    y4=0;
                    disp('slot4 is fired');
                    y = y1 + y2 + y3 + y4 + y5;
                    Pxx = periodogram(y);
                    Hpsd = dspdata.psd(Pxx,'Fs',Fs);
                    plot(Hpsd);
                    %break;
                
                case('5')
                     y5=0;
                    disp('slot5 is fired');
                    y = y1 + y2 + y3 + y4 + y5;
                    Pxx = periodogram(y);
                    Hpsd = dspdata.psd(Pxx,'Fs',Fs);
                    plot(Hpsd);
                    %break;
                
                otherwise disp('invalid slot entered');
                   %break;
            end  %switch end
        end
        end
        %////////////////////Adding Noise////////////////////
        inp_t=input('do u want to add noise: ','s');
        if(inp_t=='y'|inp_t=='Y')
        d = input('Enter the SNR in dB:   ');
        figure
        Y = awgn(y,d);
        Pxx1 = periodogram(Y);
        Hpsd = dspdata.psd(Pxx1,'Fs',Fs);
        plot(Hpsd);
        disp('adding noise');
        
        chek1 = Pxx1(25).*10000;
        chek2 = Pxx1(49).*10000;
        chek3 = Pxx1(62).*10000;
        chek4 = Pxx1(89).*10000;
        chek5 = Pxx1(105).*10000;

        if(chek1 < 8000)
            disp('User 1 is not present.');
        else
            disp('User 1 is present.');
        end

        if(chek2 < 8000)
            disp('User 2 is not present.');
            else
            disp('User 2 is present.');
        end

        if(chek3 < 8000)
            disp('User 3 is not present.');
            else
            disp('User 3 is present.');
        end

        if(chek4 < 8000)
            disp('User 4 is not present.');
            else
            disp('User 4 is present.');
        end

        if(chek5 < 8000)
            disp('User 5 is not present.');
        else
            disp('User 5 is present.');
        end
        
        end
        
        %%%%%%%%%%%%%%%%%%%%%%%Attenuating the signal%%%%%%%
        
        temp = input('Do you want to attenuate the signals? [Y/N]:    ','s');
        if(temp == 'Y' | temp == 'y')
        Yff=0;
        aF = input('Enter the percentage to attenuate the signal:   ');
        
        figure
        tem = aF/100;
        tm = 1-tem;
        Z = y.*tm;
        disp('attenuating');
        
        grid on
        plot(Z);
        
        figure
        
        Pxx4 = periodogram(Z);
        Hpsd = dspdata.psd(Pxx4,'Fs',Fs);
        plot(Hpsd);
        
        chek1 = Pxx4(25).*10000;
        chek2 = Pxx4(49).*10000;
        chek3 = Pxx4(62).*10000;
        chek4 = Pxx4(89).*10000;
        chek5 = Pxx4(105).*10000;

        if(chek1 < 8000)
            disp('User 1 is not present.');
        else
            disp('User 1 is present.');
        end

        if(chek2 < 8000)
            disp('User 2 is not present.');
            else
            disp('User 2 is present.');
        end

        if(chek3 < 8000)
            disp('User 3 is not present.');
            else
            disp('User 3 is present.');
        end

        if(chek4 < 8000)
            disp('User 4 is not present.');
            else
            disp('User 4 is present.');
        end

        if(chek5 < 8000)
            disp('User 5 is not present.');
        else
            disp('User 5 is present.');
        end

        
        end
        
    end
    
    %if rerun the program
    
    temp = input('Do you want to re-run the program? [Y/N]:    ','s');
    
     if(temp == 'Y' | temp == 'y')
         disp('\n\nEnter the users again.\n\n');
     else
         break;
     end
end

Categories: Programming Tags:

How To – Get Current Time in C

December 27th, 2014 No comments

C Code to fetch current system timestamp

#include
#include

int main ()
{
time_t rawtime;
struct tm * timeinfo;

time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf ( “Current local time and date: %s”, asctime (timeinfo) );

return 0;
}

Read more…

Categories: Programming Tags:

How To – Clear content of an entire String or Array

December 20th, 2014 No comments

If you want to zero the entire contents of the string, you can do it this way:

memset(buffer,0,strlen(buffer));

but this will only work for zeroing up to the first NULL character.

If the string is a static array, you can use:

memset(buffer,0,sizeof(buffer));

Categories: ActionScript Tags:

How To – Creating a Variable Query in PostGreSQL using libpq in C

December 18th, 2014 No comments

If you don’t have libpq, you can install it using the following command in Debian

apt-get install libpq-dev

The following code shows how to create an INSERT query using strings and pass it on to the PQexec() function.

#include

#include

//#include

//

#include

int     main() {

PGconn          *conn;

PGresult        *res;

int             rec_count;

int             row;

int             id = 1;

char           dtype = ‘W’;

char           maci[19] = {0};

char            buf[256] = {0};

snprintf(maci,18,”E8:4E:84:A8:68:9C”);

puts(maci);

Read more…

Categories: Programming Tags:

HowTo – Switching between root and user – Debian Linux Commands

June 9th, 2014 No comments

For logging in as root

su

password

For switching back to another user

su – username

password

Categories: Programming Tags:

HowTo – Command to delete a Directory with contents – Debian Linux

June 9th, 2014 No comments

This comes handy while deleting directories those are not empty

rm -rf directoryname/

Categories: Programming Tags: