Thursday, 7 September 2017

Blogger could not save earnings settings

Hi Friend,

Today I'll tell you how to solve the blogger error Could not save earnings settings. I'm getting this error and I searched a lot. But did not find any solution. But now I'm able to solve this error. So I thought I should post about this error.

When this error occur?

This error occurs when you try to save Your AdSense ad-display setting. After selecting the ad layout, you click on Save Settings button, whoa... You see the error pop up Could not save earning settings.



And you will not be able to setup AdSense ad on your blog. That's means no earning.





What could be the reasons?

  • Your AdSense account may have expired.
  • It is not a browser issue. If it is a browser issue then it should be working with other browsers. I have tried almost all browsers.
  • You have more no of ads running on your single page.
  • Your AdSense account is more then six month old and din't get approved.


How to solve this error?

To solve this error, you should have a approved AdSense account. And if you don't have a approved AdSense account then also you need to follow these steps. Because for getting a AdSense account you need to save Earning Settings. Now there is deadlock, and you can't get approve for your adsense account. That means no money no honey.

Steps to solve this error

If you follow each step, then you will be able to solve the problem and soon you will get a approved AdSense account.

  • Step : 1 If you are already running ads on your blog, check the no of ads. If you are not running any ad then skip this step.








Tuesday, 5 September 2017

Program to implement Peterson’s Algorithm for Mutual Exclusion in C

/*
    Peterson’s Algorithm for Mutual Exclusion
    Created By: Pirate
*/


#include <stdio.h>
#include <pthread.h>

void* process(void *s);
int flag[2];
int turn,count=0,mode=0;
const int MAX = 1e9;

void main()
{
    printf("*** Peterson's Algorithm ***\n");
    pthread_t p1,p2,p3,p4;

    printf("\nFirst without Lock\n");

    pthread_create(&p1, NULL, process, (void*)0);
    pthread_create(&p2, NULL, process, (void*)1);

    pthread_join(p1, NULL);
    pthread_join(p2, NULL);

    printf("Actual Count: %d | Expected Count: %d\n",count, MAX*2);

    printf("\n\nNow with Lock\n");
    count = 0;
    mode = 1;
    lock_init();

    pthread_create(&p3, NULL, process, (void*)0);
    pthread_create(&p4, NULL, process, (void*)1);

    pthread_join(p3, NULL);
    pthread_join(p4, NULL);

    printf("Actual Count: %d | Expected Count: %d\n",count, MAX*2);

}

void lock_init()
{
    flag[0] = flag[1] = 0;
    turn = 0;
}

void lock(int current)
{
    flag[current] = 1;

    turn = 1-current;
    while (flag[1-current]==1 && turn==1-current) ;
}

void unlock(int current)
{
    flag[current] = 0;
}

void* process(void *s)
{
    int i = 0;
    int current = (int *)s;
    printf("Process : %d\n", current);

    if(mode == 1)
        lock(current);
    for (i=0; i<MAX; i++)
        count++;

    if(mode == 1)
        unlock(current);
}





Output :