Thursday, January 15, 2015

How to create,insert,delete and reverse Signly Circular linklist in C++?

//Implementation of Circular List
#include<conio.h>
#include<iostream>
#include<malloc.h>
using namespace std;
void creation();
void traversing();
void addatbeg();
void addafter(int, int);
void deletion(int);
struct node{
    int info;
    node *link;
   
}*last;
int n;
int main()
{
    last = NULL;
    int ch;
    while(1)
    {
        cout<<"1.Creation";
        cout<<endl;
        cout<<"2.Traversing";
        cout<<endl;
        cout<<"3.Insertion at start";
        cout<<endl;
        cout<<"4. Insertion any Where"<<endl;
        cout<<"5.Deletion";
        cout<<endl;
        cout<<"6.exit";
        //cout<<endl;
        cout<<"Enter Your Choice";
        cin>>ch;
   
    switch(ch)
    {
        case 1:
            int n;
            cout<<"enter number of nodes";
            cin>>n;
            for(int i=0;i<n;i++)
            creation();
            break;
            case 2:
                traversing();
                break;
                case 3:
                    
                    addatbeg();
                    break;
                    case 4:
                         int i;
                         cout<<"enter Position"<<endl;
                         cin>>i;
                         int data;
                         cout<<"Enter Data"<<endl;
                         cin>>data;
                        addafter(data,i);
                        break;
                        case 5:
                             int m;
                             cout<<"Enter data to be deleted"<<endl;
                            cin>>m;
                            deletion(m);
                            break;
                        case 6:
                             exit(0);
      default:
                            cout<<"Sorry!Wrong Choice :(";
                            cout<<endl;
                           
    }}
    getch();
    return(0);
}
void creation()
{
    struct node *temp;
    temp=(node*)malloc(sizeof(struct node));
    int data;
    cout<<"Enter Data ";
    cin>>data;
    temp->info=data;
    cout<<endl;
    if(last==NULL)
    {
        last=temp;
        last->link=last;
    }
    else
    {
        temp->link=last->link;
        last->link=temp;
        last=temp;
    }
}
void traversing()
{
    struct node *q;
    q=last->link;
    while(q!=last)
    {
        cout<<"data is "<<q->info;
        cout<<endl;
        q=q->link;
    }
    cout<<last->info;
    cout<<endl;
}
void addatbeg()
{
        int Data,k;
    struct node *tmp,*q;
    tmp=(node*)malloc(sizeof(struct node));
    cout<<"Enter Data";
    cin>>Data;
    cout<<endl;
    tmp->info=Data;
    tmp->link=last->link;
    last->link=tmp;
}
void addafter(int data, int pos)
{
     struct node *q,*tmp;
     int i;
     q=last->link;
     for(i=0;i<pos-1;i++)
     {
                         q=q->link;
                         if(q==last->link)
                         {
                                          cout<<"Less Elements "<<endl;
                                          return;
                         }
     }
                        
     tmp=(node*)malloc(sizeof(struct node));
     tmp->info=data;
     tmp->link=q->link;
     q->link=tmp;
     if(q==last)
     {
                last=tmp;
     }
}
void deletion(int data)
{
//    int chh,m,data;
        struct node *tmp,*q;
       
    if(last->link==last&&last->info==data)
            {
            tmp=last;
            last=NULL;
            free(tmp);
            return;
       
            }
           
                    q=last->link;
                    if(q->info==data)
                    {
                        tmp=q;
                        last->link=q->link;
                        free(tmp);
                        return;
                    }
                    while(q->link!=last)
                            {
                                if(q->link->info==data)
                                {
                                    tmp=q->link;
                                    q->link=tmp->link;
                                free(tmp);
                                return;
                            }
                                q=q->link;
   
                        }
                if(q->link->info==data)
                {
                    tmp=q->link;
                    q->link=last->link;
                    free(tmp);
                    last=q;
                    return;
                }
}

How to create,insert,delete and reverse signly linear linklist in C++?

The program which I am posting here you will not find any where on internet. It is very easy to understand. I have attached some pics. SO that you can learn the algorithm of this program as well.
#include<iostream>
#include<conio.h>
#include<malloc.h>
using namespace std;
void creat(int m);
void display();
void rev();
void insert(int data,int pos);
void del(int data1);
struct node
  {
     int info;
     struct node *link;
  }*start;
int main ()
{

    start =NULL;
    int ch,n,m,data,pos;
    while(1)
    {
            cout<<"1. Create List"<<endl;
            cout<<"2. Display List"<<endl;
            cout<<"3. Insertion"<<endl;
            cout<<"4. Deletion"<<endl;
            cout<<"5. Reverse"<<endl;
            cout<<"6. Exit"<<endl;
            cin>>ch;
            switch(ch)
            {
                      case 1:
                           cout<<"\nenter num of nodes to create:: ";
                           cin>>n;
                           for(int i=0;i<n;i++)
                           {
                                   cout<<"\nenter data::";
                                   cin>>m;
                                   creat(m);
                                   }
                                   break;
                                   case 2:
                                        display();
                                        break;
                                        case 3:
                                                  cout<<"\nenter data";
                                                  cin>>data;
                                                  cout<<"\nenter position";
                                                  cin>>pos;
                                                  insert(data,pos);
                                                  display();
                                                  break;
                                                  case 4:
                                                          int data1;
                                                            cout<<"\nenter data, u want to del node ";
                                                             cin>>data1;
                                                             del(data1);
                                                             display();
                                                             break;
                                        case 5:
                                             cout<<"\nafter reverse\n";
                                             rev();
                                             display();
                                             break;
                                                                     
                                                             case 6:
                                                                  exit(0);
                                                                 
                                                             default:
                                                                     cout<<"invalid choice";
                                                                     }
                                                                     }
    
     return 0;
}
void creat(int m)
  {
    struct node *temp,*q;
    temp=(node*)malloc(sizeof(node));
    temp->info=m;
    temp->link=NULL;
    if(start==NULL)
     {
     start=temp;
     }

    else
     {
     q=start;
     while(q->link!=NULL)
   
        q=q->link;


      q->link=temp;
    }
  }
  void display()
  {
    struct node *q;
    if (start==NULL)
    {cout<<"List Empty";
    }
    q=start;
    while(q!=NULL)
    {
      cout<<q->info<<endl;
      q=q->link;
    }
  }
  void rev()
  {
    struct node *p1,*p2,*p3;
     if(start==NULL)
     {
       return ;
     }
     p1=start;
     p2=p1->link;
     p3=p2->link;
     p1->link=NULL;
     p2->link= p1;
     while(p3!=NULL)
     {
    p1=p2;
    p2=p3;
    p3=p3->link;
    p2->link=p1;
     }
     start=p2;
  }
  void insert(int data,int pos)
  {
     struct node *temp,*q;
    
     q=start;
     for(int i=0;i<pos-1;i++)
      {
    q=q->link;
      if(q==NULL)
      {
                 cout<<"There are less emelents "<<pos;
                 }
                 }
      temp=(node*)malloc(sizeof(struct node));
     temp->info=data;
     temp->link=q->link;
      q->link=temp;
  }
  void del(int data)
{
    struct node *tmp,*q;
    if(start->info==data)
    {
        tmp=start;
        start=start->link;    /*first element deleted*/
        free(tmp);
        return;
    }
    q=start;
    while(q->link->link!=NULL)
    {
        if(q->link->info==data)           /*element deleted in between*/
        {
            tmp=q->link;
            q->link=tmp->link;
            free(tmp);
            cout<<"Deleted "<<data<<endl;
            return;
        }
        q=q->link;
    }
    if(q->link->info==data)
    {
        tmp=q->link;
        free(tmp);
        q->link=NULL;
        return;
    }
    cout<<"Element "<<data<<" not found"<<endl;
}

Friday, January 9, 2015

How to setup Chitika on Blogger and Wordpress

Chitika is another way to earn money out of your blog.Once you already have a Publisher account on Chitika, you can also earn money by promoting their advertisers' ads on your blog. Chitika ads are mainly texts ads and can be put side by side with the Google Adsense ads. If you wanted to blog for money with Chitika, follow the simple steps below.
Chitika is a search-targeted advertising network that can help you monetize your business's website by placing targeted ad banners throughout the site. These ads then generate revenue for you whenever site visitors click them.

Steps

  1. Click here to  to signup www.chitika.com.
  2. Fill the application form .
  3. After submitting the application form, a message saying "Your application has been submitted for review" will appear. See the image below.
  4. Now go to your email and click the VERIFICATION LINK. After clicking the link the image below will appear. Input your valid address and the Description of your blog. After that click the SUBMIT button.
  5. Wait about a day to know whether Chitika approved or disapproved your blog Publisher application. Assuming that your blog is APPROVED. Log in on your Chitika publisher account.Go to AD SETUP > TYPES OF ADS > TEXT ADS. See the image below.
  6. When you are in the CODE GENERATOR, you can customize your CHITIKA AD there. You can also change the AD SIZE in FORMAT. When you are done customizing your ad, click the GET CODE button.  
  7. Now COPY and PASTE your Chitika Ad Code in your blog. Go to LAYOUT > ADD A GADGET > HTML/JavaScript. 
    For wordpress you can install new plugins and then go to settings and change ads display.
    For blogger you have to get code from Chitika Getcode option from Ad Settings. 
    • Then go to layout and click Add new gadget > HTML/JAVASCRIPT. 
    • Copy the code from Chitika and paste here.
    •  Save arrangements. 
    • Now Chitika ads will display on your blog.
     

Make Money By Translating

If you can speak two or more languages and can translate. Then don't wait this offer is only for you. Signup and start working from home full or part time.
RealTranslatorJobs.com allows people all over the world who speak two language to make money online translating for companies, translating websites into other languages and more!
With extremely high conversion rates, very effective email campaigns and attractive graphics that are proven to draw clicks; promoting RealTranslatorJobs.com is practically guaranteed to make you some great money!
Go to their website www.realtranslatorjobs.com and signup and start making money.

Saturday, November 29, 2014

How to fix wordpress White Screen Death

If you have been using WordPress for a few years, then you have encountered the white screen of death at least once. The WordPress white screen of death is one of those extremely annoying problems like. The reason why this issue is frustrating for users is because it locks you out of your WordPress admin panel. Because there is no error output in most cases, you are left clueless to figure out what is the issue. The worst thing about white screen of death is that sometimes it will only affect a certain part of your site. For example, you may only see the white screen of death on your WordPress admin while everything else works fine. In other cases, you may only see it on a specific post whereas everything else runs just fine. In this article, we will show you how to fix the WordPress white screen of death by looking at a few possible solutions.
Note: Before you make any changes to your site, make sure you have sufficient backups.

Why do you get this error?

Majority of the time when you see a white screen of death, it means that you exhausted the memory limit. This could be caused by a plugin that you may be using that is not functioning properly. It could also be caused by a poorly coded theme that you are using. It could also mean that there is an issue with your web hosting server. Since the problem can be caused by any number of things, it may require a lot of troubleshooting.

Does the problem occur on your other sites?

If you have multiple sites, then the first thing you should do is to make sure that the white screen of death is happening across the board or just on this one domain. If the issue is with all of your sites, then it is a strong indicator that your web hosting provider is having some issues. However, if the issue is only with one of your sites, then this could be an issue with a plugin or theme that you are running. If the issue is only happening with a single post or page, then you know it is definitely a problem with your specific site.

Increasing the Memory Limit

Usually this issue happens because your memory is being exhausted.

Disabling All Plugins

If increasing the memory limit did not help, or if you have a high memory limit like 256M or 512M, then you need to start troubleshooting. In our experience of troubleshooting this issue, we have always found that the issue is either with a specific plugin or a theme. Let’s go ahead and disable all the plugins.
If this fixes the issue, then enable one plugin at a time to get to the bottom of the issue.

Replace Theme with a Default Theme

If the plugin troubleshooting doesn’t fix the issue, then you should try replacing your current theme with a default twenty ten theme. The best way to do this is by backing up your theme folder. Then deleting the theme. WordPress will automatically fall back to the default theme.
Alternatively, you can go in your phpMyAdmin and update the database tables in wp_options table. The following table names would have to be updated:
template, stylesheet, and current_theme. Change the value to twentyeleven.
If this fixes the issue, then you should look at your theme’s functions.php file. If there are extra spaces at the bottom, then you should consider fixing it. If you are using a poorly coded function in your theme’s functions.php file, then it can cause this as well.

Other Fixes

If none of the above fixes it, then you should try to re-install a fresh copy of WordPress. While it is unlikely, but it is always possible that a core file may have been corrupted.
You can also use the WordPress debug function to see what type of errors are being outputted. Add the following code in your wp-config.php file.
1error_reporting(E_ALL); ini_set('display_errors', 1);
2 
3define( 'WP_DEBUG', true);
Once you add this, the blank screen will now have errors, warnings, and notices. These may be able to help you determine the root cause.
Sometimes, you may have access to the backend, but the front-end of the site has white screen of death. This can happen because of a caching plugin. Simply empty your cache.
If you have a white screen of death only on a very long post page, then you should also try to clearing cache. Another trick that we have found to work is increasing the recursion and backtrack limit. You can paste the following code in your wp-config.php file. Or in some servers you will be required to modify your PHP.INI file.
1/** Trick for long posts */
2ini_set('pcre.recursion_limit',20000000);
3ini_set('pcre.backtrack_limit',10000000);
We understand that this is a very frustrating error, and we hope that one of the tricks above fixed the issue for you. What have you tried that seemed to work for you? If you found another solution to work, then please let us know. We would be happy to expand on this resource, so others do not have to waste as much time finding a solution.

Thursday, November 27, 2014

How to create ,insert, reverse, delete and display doubly linklist

#include<iostream.h>
#include<conio.h>
#include<malloc.h>
#include<process.h>
void create_list();
void display();
void addatbeg( );
void addafter(int);
void del(int);
void rev();



struct node{
        char name[20]; //name
        int r_no; //roll no
        int con_no; // contact no.
       struct node *next;
       struct node *prev;
}* start;

int main(){

int choice,n,position,i;
int a;
int b;
start=NULL;
while(1)
{
cout<<"1. Create List"<<endl;
cout<<"2. Display List"<<endl;
cout<<"3. Add at Begining"<<endl;
cout<<"4. Add in middle"<<endl;
cout<<"5. Deletion"<<endl;
cout<<"6. Reverse"<<endl;
cout<<"7. Quit Program"<<endl;


cin>>choice;
switch(choice)
{
case 1:
cout<<"How many Nodes you Want? "<<endl;
cin>>n;
for (i=1;i<=n;i++)
{

create_list();
}
break;
case 2:
display();
break;
case 3:
    

addatbeg();
break;
case 7:
exit(0);
case 4:
    

cout<<"Enter position";
cin>>position;
addafter(position);
break;
case 5:
     int m;
     cout<<"enter Element to be deleted"<<endl;
     cin>>m;
     del(m);
     break;
     case 6:
          rev();
          display();
          break;
     default:
cout<<"Wrong Choice"<<endl;
}
}
getch();
return 0;
}
void create_list()
{
struct node *q,*tmp;
tmp=(node *)malloc(sizeof(struct node));
cout<<"Enter name"<<endl;
cin>>tmp->name;
cout<<"Enter the roll no: "<<endl;
cin>>tmp->r_no;
cout<<"Enter contact no"<<endl;
cin>>tmp->con_no;

tmp->next=NULL;
if(start==NULL)
{
tmp->prev=NULL;
start=tmp;
}
else
{
q=start;
while(q->next!=NULL)
q=q->next;
q->next=tmp;
tmp->prev=q;
}
}
void display()
{
struct node *q;
if(start==NULL)
{
cout<<"Empty List"<<endl;
return;
}
q=start;
cout<<"List is: "<<"\n"<<endl;
while(q!=NULL)
{
cout<<q->name<<"\t";
cout<<q->r_no<<"\t";
cout<<q->con_no<<"\t";
q=q->next;
}
cout<<"\n";
}
void addatbeg()
{
struct node *tmp;
tmp=(node *)malloc(sizeof(struct node));

cout<<"enter name"<<endl;
cin>>tmp->name;
cout<<"enter roll no"<<endl;
cin>>tmp->r_no;
cout<<"enter con_no."<<endl;
cin>>tmp->con_no;

tmp->prev=NULL;
tmp->next=start;
start->prev=tmp;
start=tmp;
}
void addafter(int pos)
{
struct node *tmp, *q;
tmp=(node *)malloc(sizeof(struct node));
int i;
q=start;
for(i=1;i<pos-1;i++)
{
q=q->next;
if(q==NULL)
{
cout<<"There are less elements"<<pos;
return;
}
}
tmp=(node *)malloc(sizeof(struct node));
cout<<"Enter Name"<<endl;
cin>>tmp->name;
cout<<"Enter roll no"<<endl;;
cin>>tmp->r_no;
cout<<"Enter Contact no"<<endl;
cin>>tmp->con_no;

q->next->prev=tmp;
tmp->next=q->next;
tmp->prev=q;
q->next=tmp;
}

void del(int data)
{
     struct node *q,*tmp;
     if(start->r_no==data)
     {
                          tmp=start;
                          start=start->next;
                          start->prev=NULL;
                          free(tmp);
                          return;
                          }
                          q=start;
                          while(q->next->next!=NULL)
                          {
                                                    if(q->next->r_no==data)
                                                    {
                                                                           tmp=q->next;
                                                    q->next=tmp->next;
                                                    tmp->next->prev=q;
                                                    free(tmp);
                                                    return;
                                                    }
                                                    q=q->next;
                                                    }
                                                    if(q->next->r_no==data)
                                                    {
                                                                           tmp=q->next;
                                                                          
                                                                           q->next=NULL;
                                                                           free(tmp);
                                                                           return;
                                                                           }
}
void rev()
{
     struct node *p1,*p2;
     p1=start;
     p2=p1->next;
     p1->next=NULL;
     p1->prev=p2;
     while(p2!=NULL)
     {
                    p2->prev=p2->next;
                    p2->next=p1;
                    p1=p2;
                    p2=p2->prev;
                    }
                    start=p1;
}
              
                                                                               

Monday, November 10, 2014

How to add traffic counter widget to your website or blogger?

I have added traffic widget counter to this blog . Its very easy and simple , there are many websites that provide traffic counter widget. If u don't know any website that provide widget then just go to this website http://24counter.com Now follow the below steps:


1. Go to Blogger >Layout>Add New Widget
2. Then copy the HTML from the website and paste it in new Widget. Save it and thats all.
3. Now you will be able to see all visitors that visited or online.