Saturday, 15 December 2018

Save Your Friends Status - WhatsApp Status Saver App

Love your friend's status ? Hesitate to ask? you are on the right page.

Its been easy to grab the whatsapp status of your whatsapp contacts.

So here are the steps to save or share the status (Image or Video) of whatsApp.

1. Install  WhatsApp Status Saver App by ProgrammingDesire.com in your phone.


2. Open whatsApp and watch some status.

3.Come back to Status Saver and you will find the status there to download and share.



Directly open whatsapp from status saver . 


You can save status to your internal storage. 


You can directly share the status to whatsApp or any other social medial very easily by clicking on the share button. 

Now Enjoy the life with pride.









Sunday, 9 December 2018

How to insert images in C/ C++ using graphics(100% working)

Hello friends today we will learn how to insert images in  C++ language very easily using graphics. The things that are required for this work are listed here .....

1.Code blocks compiler installed on your system:

Code::Blocks is a freeopen-source cross-platform IDE that supports multiple compilers including GCCClang and Visual C++. It is developed in C++ using wxWidgets as the GUI toolkit. Using a plugin architecture, its capabilities and features are defined by the provided plugins. Currently, Code::Blocks is oriented towards CC++, and Fortran. It has a custom build system and optional Make support.(by wikipedia).

2.Graphics libraries should set up with code blocks:

When we install code blocks then there is no library and header file of graphics are given by the developers with it, so we have to configure these things manually.I come across a lots of videos on youtube to configure graphics in codeblocks and i found all the videos are just waste of time except one video and i learnt  from that video .It was a bit difficult for me to configure graphics in codeblocks.
This is why because i was getting the libraries and header file with bug.
So i thought to create a video on this topic on my own  :How to use graphics in codeblocks video






  If you did these two things then you can use this program or concept to insert images in C++ language using graphics in Codeblocks.
Here we go:
 #include<iostream>  
 #include<graphics.h>  
 int main()  
 {  
   initwindow(600,400,"Images");  
   readimagefile("image_name.jpg",0,0,600,400);  
   getch();  
   readimagefile("image_name.jpg",0,0,600,400);  
   getch();  
   return 0;  
 }  



Description of the program:


If you are using code blocks to make programs in graphics mode then we can make the programs in only C++ because in the graphics.h header file there is reference to iostream and if we work in C language then it will not link and then we get error in header file graphics.h. Download File



here we have used the two important predefinded functions of graphics they are....

  • initwindow():this function is used to initialise a new window or you can say a  new window
  • readimagefile():this is the function that is used to set images in our program.
readimagefile() takes five parameters the first parameter is the name of the image with extension of the image and the rest are the co-ordinates of the screen where to set.


Thanks for visiting ...we will come with new typical programs so stay connected.







How to insert image in c language in turboc IDE

Its been very interesting as well as difficult to work with graphics in c or c++ languages.
But it will be more interesting to work with image insertion in C or C++ language.

I have already created the post to insert image in c/c++ in codeblocks IDE but now its time to achieve this using Turbo C++ IDE.

 Befor writing code we have to take care of  these points.
  • Create a  bmp(16 color Bitmap) image file using paint or any other image editor. 
  • paste that file into bin folder of turbo c where this program will be saved.
  • After pasting we will continue to write the below code.




 
 #include <alloc.h>  
   #include <conio.h>  
   #include <graphics.h>  
   #include <stdio.h>  
   #include <stdlib.h>  
   struct BMP  
   {  
    char Type[2];      //File type. Set to "BM".  
    unsigned long Size;   //Size in BYTES of the file.  
    unsigned long Reserved;   //Reserved. Set to zero.  
    unsigned long OffSet;  //Offset to the data.  
    unsigned long headsize; //Size of rest of header. Set to 40.  
    unsigned long Width;   //Width of bitmap in pixels.  
    unsigned long Height;   // Height of bitmap in pixels.  
    unsigned int Planes;  //Number of Planes. Set to 1.  
    unsigned int BitsPerPixel;    //Number of Bits per pixels.  
    unsigned long Compression;  //Compression. Usually set to 0.  
    unsigned long SizeImage; //Size in bytes of the bitmap.  
    unsigned long XPixelsPreMeter;   //Horizontal pixels per meter.  
    unsigned long YPixelsPreMeter;   //Vertical pixels per meter.  
    unsigned long ColorsUsed;  //Number of colors used.  
    unsigned long ColorsImportant; //Number of "important" colors.  
   };  
   int ShowBMP(int x, int y, char* FileName)  
   {  
     int b,a;  
     struct BMP Obj;  
     unsigned char* Datas;  
     int in=0;  
     unsigned char c=0;  
     FILE * fp;  
     fp = fopen(image.bmp,"rb"); //give filename of image with extension.  
     if(!fp){  
     printf("Error : Unable to open file ..");  
     exit(0);  
     }  
     fread(&Obj, sizeof(Obj), 1, fp);  
     if(Obj.BitsPerPixel!=4) // This isn't a 16 color bmp we can read;  
     {  
      fclose(fp);  
      printf("Error : File format not supported ..");  
      exit(0);  
     };  
     fseek(fp,Obj.OffSet,SEEK_SET);  
     Datas=(unsigned char*) calloc(Obj.Width/2+1, sizeof(unsigned char));  
     for(b=Obj.Height;b>=0;b--)  
     {  
      fread(Datas, sizeof(unsigned char), Obj.Width/2, fp);  
      c=0;  
      in=0;  
      for(a=0;a<=Obj.Width;a+=2)  
      {  
        c = (Datas[in] | 0x00) >>4;  
        putpixel(a+x,b+y,c);  
        c = (Datas[in] | 0xF0) & 0x0F;  
         putpixel(a+1+x,b+y,c);  
        in++;  
      }  
     }  
     free (Datas);  
     fclose(fp);  
     return 1;  
   }  
   void main()  
   {  
   int color;  
   int gd , gm ;  
   gd = VGA ; gm = VGAHI;  
   initgraph(&gd,&gm,"");  
   ShowBMP(0,0,"j.bmp"); /* Enter File Name Here */  
   getch();  
   closegraph();  
   }  

Now Run the code and you will get your image as output.
 
 

Thursday, 29 November 2018

AI helps in detecting water leackage

Scientists have developed an artificial intelligence (AI) technology that can detect even small leaks in pipes, and could potentially help municipal systems significantly reduce water losses.

The system designed by researchers at the University of Waterloo in Canada combines sophisticated signal processing techniques and AI software to identify telltale signs of leaks carried via sound in water pipes.

The acoustic signatures are recorded by hydrophone sensors that can be easily and inexpensively installed in existing fire hydrants without excavation or taking them out of service.

"This would allow cities to use their resources for maintenance and repairs much more effectively. They could be more proactive as opposed to reactive," said Roya Cody, a PhD candidate at Waterloo.

"Major problems such as burst pipes are revealed by pressure changes, volume fluctuations or water simply bubbling to the surface, but small leaks often go undetected for years," said Cody.

In addition to the economic costs of wasting treated water, chronic leaks can create health hazards, do damage to the foundations of structures and deteriorate over time.

"By catching small leaks early, we can prevent costly, destructive bursts later on," said Cody.

Researchers are now doing field tests with the hydrant sensors after reliably detecting leaks as small as 17 litres a minute in the lab.

They are also working on ways to pinpoint the location of leaks, which would allow municipalities to identify, prioritise and carry out repairs.

"Right now they react to situations by sending workers out when there is flooding or to inspect a particular pipe if it's due to be checked because of its age," Cody said.

The sensor technology works by pre-processing acoustic data using advanced signal processing techniques to highlight components associated with leaks.

That makes it possible for machine learning algorithms to identify leaks by distinguishing their signs from the many other sources of noise in a water distribution system.

Tuesday, 27 November 2018

Concept of Threads in Computer Programming:

Basically Thread is concept of System's OS, That is now being implemented by programmers in various places of application development and testing.

What is a Thread?

In computer science, a thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically a part of the operating system. Multiple threads can exist within one process, executing concurrently and sharing resources such as memory, while different processes do not share these resources.
img
 A process with two threads of execution, 
running on one processor
  

What is a Process?

A process is the instance of a computer program that is being executed. It contains the program code and its activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently.

A computer program is a passive collection of instructions, a process is the actual execution of those instructions. Several processes may be associated with the same program; for example, opening up several instances of the same program often results in more than one process being executed.  

Threads vs. processes

Threads differ from traditional multitasking operating system processes in that:
  • processes are typically independent, while threads exist as subsets of a process
  • processes carry considerably more state information than threads, whereas multiple threads within a process share process state as well as memory and other resources.
  • processes have separate address spaces, whereas threads share their address space
  • context switching between threads in the same process is typically faster than context switching between processes.

 Threads in Single Processor  and  Multiprocessor Systems:

Systems with a single processor generally implement multithreading by time slicing: the central processing unit (CPU) switches between different software threads. This context switching generally happens very often and rapidly enough that users perceive the threads or tasks as running in parallel. 
While On a multiprocessor or multi-core system, multiple threads can execute in parallel, with every processor or core executing a separate thread simultaneously; on a processor or core.
The process schedulers of many modern operating systems directly support both time-sliced and multiprocessor threading, and the operating system kernel allows programmers to manipulate threads by exposing required functionality through the system-call interface.

Time Slicing:

The period of time for which a process is allowed to run in a preemptive multitasking system is generally called the time slice or quantum. The scheduler is run once every time slice to choose the next process to run. The length of each time slice can be critical to balancing system performance vs process responsiveness - if the time slice is too short then the scheduler will consume too much processing time, but if the time slice is too long, processes will take longer to respond to input.  
An interrupt is scheduled to allow the operating system kernel to switch between processes when their time slices expire, effectively allowing the processor’s time to be shared between a number of tasks, giving the illusion that it is dealing with these tasks in parallel (simultaneously). The operating system which controls such a design is called a multi-tasking system

Multitasking System:

Multitasking is a method used by system's  OS to allow multiple processes to share processors (CPUs) and other system resources. Each CPU (core) executes a single task at a time. However, multitasking allows each processor to switch between tasks that are being executed without having to wait for each task to finish.

Single-Threading and Multi-Threading:

Single Threading:  

single-threading is the processing of one command at a time. The opposite of single-threading is multi-threading

Multi-Threading:

Multi-threading is mainly found in multitasking operating systems. Multi-threading is a widespread programming and execution model that allows multiple threads to exist within the context of one process. These threads share the process's resources, but are able to execute independently. The threaded programming model provides developers with a useful abstraction of concurrent execution. Multi-threading can also be applied to one process to enable parallel execution on a multiprocessing system. 

Multi-threaded applications have the following advantages:
  • Responsiveness: multi-threading can allow an application to remain responsive to input. In a one-thread program, if the main execution thread blocks on a long-running task, the entire application can appear to freeze. By moving such long-running tasks to a worker thread that runs concurrently with the main execution thread, it is possible for the application to remain responsive to user input while executing tasks in the background. On the other hand, in most cases multi-threading is not the only way to keep a program responsive, with non-blocking I/O and/or Unix signals being available for gaining similar results.[6]
  • Faster execution: this advantage of a multi-threaded program allows it to operate faster on computer systems that have multiple central processing units (CPUs) or one or more multi-core processors, or across a cluster of machines, because the threads of the program naturally lend themselves to parallel execution, assuming sufficient independence (that they do not need to wait for each other).
  • Lower resource consumption: using threads, an application can serve multiple clients concurrently using fewer resources than it would need when using multiple process copies of itself. For example, the Apache HTTP server uses thread pools: a pool of listener threads for listening to incoming requests, and a pool of server threads for processing those requests.
  • Better system utilization: as an example, a file system using multiple threads can achieve higher throughput and lower latency since data in a faster medium (such as cache memory) can be retrieved by one thread while another thread retrieves data from a slower medium (such as external storage) with neither thread waiting for the other to finish.
  • Simplified sharing and communication: unlike processes, which require a message passing or shared memory mechanism to perform inter-process communication (IPC), threads can communicate through data, code and files they already share.
  • Parallelization: applications looking to use multicore or multi-CPU systems can use multithreading to split data and tasks into parallel subtasks and let the underlying architecture manage how the threads run, either concurrently on one core or in parallel on multiple cores. GPU computing environments like CUDA and OpenCL use the multithreading model where dozens to hundreds of threads run in parallel across data on a large number of cores.
Multi-threading has the following drawbacks:
  • Synchronization: since threads share the same address space, the programmer must be careful to avoid race conditions and other non-intuitive behaviors. In order for data to be correctly manipulated, threads will often need to rendezvous in time in order to process the data in the correct order. Threads may also require mutually exclusive operations (often implemented using mutexes) in order to prevent common data from being simultaneously modified or read while in the process of being modified. Careless use of such primitives can lead to deadlocks, livelocks or races over resources.
  • Thread crashes a process: an illegal operation performed by a thread crashes the entire process; therefore, one misbehaving thread can disrupt the processing of all the other threads in the application.

Confusing Terms:

Multi-processing: Multiple processes runs in parallel.
Multi-threading: Multiple Threads runs in parallel.
Multitasking can achieved by multi-processing and multi-threading.


Above paragraph explains the concept of Threads And How an OS manages to provide multitasking and runs multiple applications in parallel. Further, We will See Threads in Java in next post:

Monday, 12 November 2018

Increase internet speed using 1.1.1.1 DNS resolver app for iOS and Android

Cloudflare announced 1.1.1.1, the fastest public DNS resolver in the world earlier this year. Now, they have launched the 1.1.1.1 mobile app to make it easy to use 1.1.1.1 on your phone.

Steps to follow: 

 



1.1.1.1 features:
  • Greater privacy: By using a secure connection, 1.1.1.1 makes sure no one can snoop your DNS queries.
    Some ISPs use DNS queries to sell your data. Cloudflare will never sell your data or use it to target ads. Period.
  • Fastest way to experience the Internet: 1.1.1.1 makes the Internet faster by using Cloudflare’s global network.
    On average, we are 28% faster than the next fastest public resolver.
  • Easy to use: One-touch setup to make your Internet more safe and private. Install it today, get faster Internet, it’s that simple.
Download the app here for Android and here for iOS devices.

Sunday, 11 November 2018

Start Learning AI

Introduction To Artificial Intelligence 

Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a software think intelligently, in the similar manner the intelligent humans think.

Applications  of AI:
AI can be implemented in various fields, such as in a self driving car, Cancer Prediction, Robot as Lecturer  etc.

Two Subsets of AI:

AI subsets
Artificial Intelligence


  1. Machine Learning 
  2. Deep Learning

  1. Machine Learning  :

    Machine Learning is a subset of Artificial Intelligence.
    ML systems learn how to combine input to produce useful predictions on never-before-seen data.
    In Machine Learning , We train a model using a large set of labeled data, later on this model is used to test a set of test data i.e unlabeled data. Then accuracy is calculated that how accurate  the prediction is.

    Suppose that we need an AI to check whether this object is dog or not, then we provide various sets of  sample inputs during the training of our model.
    inputs consist of feature and label
     Dog can be identified by the way they: speak, run, height, eyes, tail etc.
    Here label is DOG and Features are sound, speed, height, and eye.

    When we say labeled data it means that a large data set  that contains Feature and Label.
    So ML moves around mainly three terminologies:
     (i) Label  (ii) Feature (iii) Model

    (i) Label:

    A label is the thing we're predicting—the y variable in simple linear regression. The label could be the future price of wheat, the kind of animal shown in a picture, the meaning of an audio clip, or just about anything.  
     

    (ii) Feature:

    A feature is an input variable—the x variable in simple linear regression. A simple machine learning project might use a single feature, while a more sophisticated machine learning project could use millions of features, specified as:  x1, x2, ...., xn
     Feature could be a property possessed by that thing which is useful to identify that thing uniquely/partially.

    (iii) Model: 

    A model defines the relationship between features and label.

    • Training means creating or learning the model. That is, you show the model labeled examples and enable the model to gradually learn the relationships

      between features and label.
    • Inference means applying the trained model to unlabeled examples. That is, you use the trained model to make useful predictions (y'). 

     Labeled Example:  

    This example is an instance of training data. 
    {x, y} or      {Feature, Label}  

    In order to train our model, we fed a large set of such instances with features and labels. 

    Unlabeled Example:

    This example is an instance of testing data. 
    {x, ?}  or   {Feature, ?}
    Finally we get a trained model that takes the unlabeled test data and make predictions for each test data. 

    "Regression vs. classification"

    A regression model predicts continuous values. For example, regression models make predictions that answer questions like the following:
    • What is the value of a house in California?
    • What is the probability that a user will click on this ad?

    A classification model predicts discrete values. For example, classification models make    predictions that answer questions like the following:
    • Is a given email message spam or not spam?
    • Is this an image of a dog, a cat, or a hamster?   
       
      Model can learn using two approaches: Supervised Learning and Unsupervised Learning.

      " In supervised learning model is being trained under the supervision of input labeled data.But in unsupervised learning no hint is provided during the training of model. Model learns by its own."

       

      "Machine Learning changes the way you think about a problem. The focus shifts from a mathematical science to a natural science, running experiments and using statistics, not logic, to analyse its results." - Peter Norvig - Google Research Director

       

How to implement Facebook audience network banner ad in android app using Android Studio

Its very simple to implement Facebook audience network banner ad in android app using Android Studio. We will complete it in 4 Steps. 1. ...