Wednesday, 26 April 2017

How to set c++11 or c++14 flag in compiler in CodeBlock

Hello All,


Many times you come across the word of std=c++11 or std=c++14 in compiler world.It is actually compiler flag that contain all functionality which release on that version.Number comes from year.

every few compiler with newer functionality. So In any software we need to set flag to use those functionality if it is not set by default. Here I will show you for Code Block software or IDE.

1) Open Code block IDE .Page will Look like below image.




2) Then you need to go "Settings" Tab in upper status bar.Then select "Compiler.." option.

3) Now you can see various compiler version available. From this You can enable any compiler which available.Here I have tick std=c++11 version.Now press OK.






Friday, 29 April 2016

Download design patterns explained simply pdf






Capturing a wealth of experience about the design of object-oriented software, four top-notch designers present a catalog of simple and succinct solutions to commonly occurring design problems. Previously undocumented, these 23 patterns allow designers to create more flexible, elegant, and ultimately reusable designs without having to rediscover the design solutions themselves.
The authors begin by describing what patterns are and how they can help you design object-oriented software. They then go on to systematically name, explain, evaluate, and catalog recurring designs in object-oriented systems. With Design Patterns as your guide, you will learn how these important patterns fit into the software development process, and how you can leverage them to solve your own design problems most efficiently.
Each pattern describes the circumstances in which it is applicable, when it can be applied in view of other design constraints, and the consequences and trade-offs of using the pattern within a larger design. All patterns are compiled from real systems and are based on real-world examples. Each pattern also includes code that demonstrates how it may be implemented in object-oriented programming languages like C++ or Smalltalk.


  Press Download Button ----->     Download Now

Tuesday, 15 March 2016

Android N features (Nought)




The first Android N developer preview is now out and it gives us a sneak peek into what Android 7.0 will eventually look like when it arrives officially later this year. Of course, developer previews quite often contain features that won’t make it to the final release, but there’s still plenty to get excited about, so let’s dive right in. Here are all the confirmed, rumored and expected Android N features, with a particular focus on what currently exists in the first Android N preview update. Please note that some features have been officially confirmed by Google, while others, “confirmed” by the developer preview, could still disappear before Android 7.0.



1. Multitasking support


                                               Picture Courtesy :Android Authority

Android devices by the likes of Samsung and LG have supported multiple apps on the same window for a long time, but Google is finally making it a native feature for Android with the next build. Android N will allow users to open two apps in split-screen mode on Nexus devices as well as other smartphones and tablets that get the OS later on.
The OS will intuitively gauge and change the screen display of various apps, but a user can himself recreate it too with new dimensions. This means, for example, users can keep tweeting while watching a video on YouTube.


2. More Quick Settings options


                                                    Picture Courtesy :Android Authority

Android N brings with it more Quick Settings when you slide the notifications pane down. You can have up to nine toggles in a single Quick Settings screen, and access more of the toggles by swiping to the right.

3. Revamped notifications


                                                 Picture Courtesy :Android Authority

Find your notifications a mess? Android N may help solve this, courtesy the new feature called 'Bundled notifications'. With this feature, users can group together notifications from each app in the menu and one will just need to tap the bundle to read individual alerts.

'Bundled notifications' is similar to the 'Notification Stacks' feature in Android Wear devices.

4. Better battery life

                                                   Picture Courtesy :AndroidPit

Doze, a feature that was introduced with Android Marshmallow, gets a few improvements. With Android 7.0, Doze will work not only when your phone is not in use, but also when the screen is turned off. This is expected to improve the battery life of devices running on the latest version of Google’s mobile OS, but the company has not released any figures yet.


5. All-new Recent Apps

The Recent Apps button at the bottom of the screen has remained very one-dimensional so far in terms of function, but that will change with the debut of Android N. In the new build of Android, double-tapping the Recent Apps button from homescreeen will open the last-used app, while double-tapping the button when an app is already open will take you to the app you had open just before.

Pressing the Recent Apps menu will open the menu of all recently-used apps; you can sift through the apps by hitting the Recent Apps key successively. When you stop pressing the key, the app you selected will open in full-screen.


6. Native file manager gets better

Android got a native file manager with the release of Marshmallow (even though file manager apps have been available on Google Play Store for long). However, this file manager is quite basic and does not let you do much than just explore folders and copy files.

Among the new features of the Android N native file browser are: hamburger menus, search ability by file types and folders, the option to move and share files, and Google Drive integration. You can even have multiple instances of the file browser open at the same time.'


7. Block phone numbers at system level

Android N allows users to block phone numbers at the system level, directly from apps like Dialler, Hangouts or Messenger. If a number has been blocked at system-level, other apps on the device will also block it without any action required from the user’s side. Moreover, even third-party apps will block these numbers automatically.

What this means is that a number blocked via the Dialler app will be blocked by the Messenger app as well as WhatsApp, Viber, and others automatically. This will continue even when you switch to a new smartphone.


8. Add emergency contact and medical info on lockscreen

                                            Picture Courtesy :AndroidPit

A potentially life-saving feature of Android N is the ability to add your medical information on the lockscreen itself in case of an emergency. You can go to Users in Settings and select the Emergency Information option; fill the details you want to reveal and add an emergency contact for good measure.

The medical information and emergency contact will be on the lockscreen and will be available to others when they open the Emergency Dialler.



9. No more wait for ‘Optimizing Apps’


When an Android phone/tablet running KitKat, Lollipop and Marshmallow gets a software update, it takes quite a while to restart as the system is ‘optimizing apps’ as it says on the screen. This is because Google moved from Dalvik to ART runtime when it released Android KitKat. But this long drawn process of optimizing apps has been skipped in Android N, which means the device will restart faster and even apps in general will take lesser time to install.


More Reference:

-- http://timesofindia.indiatimes.com/tech/slideshow/android-n-vs-android-marshmallow-10-new-features/No-more-wait-for-Optimizing-Apps/itslideshow/51390316.cms

-- http://www.androidpolice.com/

-- http://www.androidauthority.com/android-7-0-features-673002/






Tuesday, 8 March 2016

download Objective English by Hari mohan Prasad and Uma Rani Sinha (for Competitive Examinations) pdf




About The Book
Various books are available on the market for competitive exams. One such book is Objective English for Competitive Exam. This book is a guide for students who are studying for competitive exams and has proved to be useful for preparation.
The book covers all aspects of the English language and is divided into two sections. Section one covers the theory behind comprehension passages, applying grammar by spotting errors, prepositions and sentence improvement, fill in paragraph gaps, sentence skills, building vocabulary, sentence reconstruction and analogy. Section two of the book contains sample test papers for practise. All the sample questions in section one are objective type and are presented in a workbook pattern so that, while learning the theory, grammar can be practised. This way, when a student is learning through this book, he or she will be able to practically apply the learning while doing the tests or the practise chapters.
Objective English for Competitive Exam has been selling fast and the readers have found the book very useful. The book has been published by Tata McGraw Hill Education Pvt. Ltd. It was first published in 2009. This fourth edition of the book was published in 2013. It is available in paperback.
Key Features

  • The book is a good guide for students preparing for competitive exams.
  • It contains practice test papers.

Press Download Button ----->     Download Now

Friday, 19 February 2016

Socket programming in C using Threads

    /*
    
        C socket server example, handles multiple clients using threads
    
        Compile
    
        gcc server.c -lpthread -o server
    
    */
    
     
    
    #include <stdio.h>
    #include <string.h>    //strlen
    #include <stdlib.h>    //strlen
    #include <sys/socket.h>
    #include <arpa/inet.h> //inet_addr
    #include <unistd.h>    //write
    #include <pthread.h> //for threading , link with lpthread
    
    //the thread function
    void *connection_handler(void *);
    
    int main(int argc , char *argv[])
    {
        int socket_desc , client_sock , c;
        struct sockaddr_in server , client;
    
        //Create socket
        socket_desc = socket(AF_INET , SOCK_STREAM , 0);
        if (socket_desc == -1)
        {
            printf("Could not create socket");
        }
    
        puts("Socket created");
    
        //Prepare the sockaddr_in structure
        server.sin_family = AF_INET;
        server.sin_addr.s_addr = inet_addr("127.0.0.1");
        server.sin_port = htons( 8888 );
    
        //Bind
        if( bind(socket_desc,(struct sockaddr *)&server , sizeof(server)) < 0)
        {
            //print the error message
            perror("bind failed. Error");
            return 1;
        }
        puts("bind done");
    
        //Listen
        listen(socket_desc , 3);
         
        //Accept and incoming connection
        puts("Waiting for incoming connections...");
        c = sizeof(struct sockaddr_in);
    
        //Accept and incoming connection
        puts("Waiting for incoming connections...");
        c = sizeof(struct sockaddr_in);
        pthread_t thread_id;
    
        
        while( (client_sock = accept(socket_desc, (struct sockaddr *)&client, (socklen_t*)&c)) )
        {
            puts("Connection accepted");
    
            if( pthread_create( &thread_id , NULL ,  connection_handler , (void*) &client_sock) < 0)
            {
                perror("could not create thread");
                return 1;
            }
    
            //Now join the thread , so that we dont terminate before the thread
            //pthread_join( thread_id , NULL);
            puts("Handler assigned");
        }
        if (client_sock < 0)
        {
            perror("accept failed");
            return 1;
        }
        return 0;
    }
    
     
    
    /*
    
     * This will handle connection for each client
    
     * */
    
    void *connection_handler(void *socket_desc)
    {
        //Get the socket descriptor
        int sock = *(int*)socket_desc;
        int read_size;
        char *message , client_message[2000];
    
        //Send some messages to the client
        message = "Greetings! I am your connection handler\n";
        write(sock , message , strlen(message));
        message = "Now type something and i shall repeat what you type \n";
        write(sock , message , strlen(message));
    
        //Receive a message from client
        while( (read_size = recv(sock , client_message , 2000 , 0)) > 0 )
        {
            //end of string marker
            client_message[read_size] = '\0';
    
            //Send the message back to client
            write(sock , client_message , strlen(client_message));
    
            //clear the message buffer
            memset(client_message, 0, 2000);
        }
    
        if(read_size == 0)
        {
            puts("Client disconnected");
            fflush(stdout);
        }
        else if(read_size == -1)
        {
            perror("recv failed");
        }
        return 0;
    } 
    
    
    /*
    
        C socket client example, handles multiple clients using threads
        Compile
        gcc -o client client.c
        run using -->  ./client 
    
    */
    
    #include <stdio.h>
    #include <sys/types.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <string.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>
    
    void error(char *msg)
    {
        perror(msg);
        exit(0);
    }
    
    int main(int argc, char *argv[])
    {
        int sockfd, portno, n,p,count=0;
        struct sockaddr_in serv_addr;
        char buff[256],client[100],temp_buff[100];
        FILE *id;
        id = popen("id -n -u","r");
        fgets(client,100,id);
        strtok(client,"\n");
        portno = 8888;
    
        bzero((char *) &serv_addr, sizeof(serv_addr));
    
        sockfd = socket(AF_INET, SOCK_STREAM, 0);
        if (sockfd < 0)
            error("ERROR opening socket"); 
        bzero((char *) &serv_addr, sizeof(serv_addr));
    
        serv_addr.sin_family = AF_INET;
        serv_addr.sin_port = htons(portno);
        serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
    
        //getnameinfo((struct sockaddr *)&serv_addr, sizeof serv_addr, host, sizeof host, service, sizeof service, 0);
        if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0)
        error("ERROR connecting");
        while(1)
        {
          if (count == 0)
          {
            p = write(sockfd,client,strlen(client));
            if (p < 0)
                error("ERROR writing to socket");
            bzero(temp_buff,sizeof(temp_buff));
            n = read(sockfd,temp_buff,99);
            if (n < 0)
                error("ERROR reading from socket");
            count++;
          }
          else
          {
            printf("%s: ",client);
            bzero(buff,256);
            fgets(buff,255,stdin);
            n = write(sockfd,buff,strlen(buff));
            if (n < 0)
                error("ERROR writing to socket");
            if (buff[0] == 'q')
            {
                close(sockfd);
                break;
            }
    
            n = read(sockfd,buff,255);
            if (n < 0)
                error("ERROR reading from socket");
            printf("%s:%s",temp_buff,buff);
        }
           }    
        return 0;
    }

Wednesday, 17 February 2016

ChatBox using socket programming in c


SERVER CODE

Save It With server.c


/*
*   Usage :  ./server <SERVER IP ID> <PORT NU.> 
*       Use port number between 5000 to 65535
*/

#include <stdio.h>
#include <sys/types.h> 
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>

main(int argc,char **argv)
{

    int sfd, nfd, portno;
    char a[25];
    char reply[100];
    struct sockaddr_in v,v1;
    int  n;
    int size=0;
    FILE *in=NULL;
    char server[256],client[256];

    in=popen("id -n -u", "r");
    fgets(server,100, in);
    strtok(server, "\n");
    //printf("%s",server);

    //socklen_t n;

    // First call to socket() function /
    sfd = socket(AF_INET, SOCK_STREAM, 0);
    if(sfd<0)
    {
        perror("socket");
    }

    v.sin_family = AF_INET;
    v.sin_addr.s_addr =inet_addr(atoi(argv[1]));   /////server ip add
    v.sin_port = htons(atoi(argv[2])); ///// port num

    bind(sfd, (struct sockaddr *) &v, sizeof(v));
    perror("bind");   

    listen(sfd,1);
    perror("listen");   

    n=sizeof(v1);
    printf("n=%d\n",n);
    int cnt = 0;
    nfd = accept(sfd, (struct sockaddr *) &v1, &n);
    perror("accept");   

    while(1)
    {
        if(cnt==0)      //if condition transfer user name on client side.
        {   
            read(nfd,a,sizeof(a));
            strcpy(client,a);
            bzero(a,sizeof(a));
            cnt++;
            send(nfd,server,strlen(server)+1,0);
        }
        else            // else condition use for normal cheting.
        {
            bzero(a,sizeof(a));
            recv(nfd,a,sizeof(a),0);
            if(a[0]=='q')
            {
                close(nfd);
                break;
            }

        
            printf("%s-->%s",client,a);
                sleep(1);
            printf("%s:",server);
            bzero(reply,sizeof(reply));
            fgets(reply,sizeof(reply),stdin);
            send(nfd,reply,strlen(reply)+1,0);
        }
        
    }
}



CLIENT CODE

Save It With client.c

/*
*   Usage :  ./client <SERVER IP ID> <PORT NU.> 
*       Use port number between 5000 to 65535
*/


#include <stdio.h>
#include <sys/types.h> 
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
main(int argc,char **argv)
{

    int sfd, nfd, portno, clilen;
    char a[25],b[25];
    struct sockaddr_in v;
    int  n;
    int size=0;
    FILE *in=NULL;
    char client[256],server[256];

    in=popen("id -n -u", "r");
    fgets(client,100, in);
    strtok(client, "\n");

    // First call to socket() function /
    sfd = socket(AF_INET, SOCK_STREAM, 0);

    v.sin_family = AF_INET;
    v.sin_addr.s_addr =inet_addr(atoi(argv[1]));
    v.sin_port = htons(atoi(argv[2]));
    bind(sfd, (struct sockaddr *) &v,  sizeof(v));

    n=sizeof(v);
    printf("n=%d\n",n);
    int cnt =0;
    connect (sfd, (struct sockaddr *)&v , n);
    perror("connect");

    while(1)
    {   
        if(cnt == 0)            //if condition transfer user name on client side.
        {   
            write (sfd,client,strlen(client)+1);
            bzero(b,sizeof(b));
            cnt++;
            sleep(1);
            recv(sfd,b,sizeof(b),0);
            strcpy(server,b);
        }
        else                // else condition use for normal cheting.
        {
            printf("%s>>",client);
            fgets(a,sizeof(a),stdin);

            if(a[0]=='q')
            {
                close(sfd);
                break;
            }
        
            write (sfd,a,sizeof(a));
            sleep(1);
            bzero(b,sizeof(b));
            read(sfd,b,sizeof(b));
            printf("%s:%s",server,b);
        }
    }
    
}



download Programming Embedded Systems: With C and GNU Development Tools, 2nd Edition pdf


If you have programming experience and a familiarity with C--the dominant language in embedded systems--Programming Embedded Systems, Second Edition is exactly what you need to get started with embedded software. This software is ubiquitous, hidden away inside our watches, DVD players, mobile phones, anti-lock brakes, and even a few toasters. The military uses embedded software to guide missiles, detect enemy aircraft, and pilot UAVs. Communication satellites, deep-space probes, and many medical instruments would have been nearly impossible to create without embedded software.

Whether you are new to embedded systems or have done embedded work before, you'll benefit from the topics in this book, which include:
  • How building and loading programs differ from desktop or servercomputers
  • Basic debugging techniques--a critical skill when working withminimally endowed embedded systems
  • Handling different types of memory
  • Interrupts, and the monitoring and control of on-chip and externalperipherals
  • Determining whether you have real-time requirements, and whetheryour operating system and application can meet those requirements
  • Task synchronization with real-time operating systems and embeddedLinux
  • Optimizing embedded software for size, speed, and power consumption
  • Working examples for eCos and embedded Linux





Press Download Button ----->     Download Now