Friday 11 November 2016

Android or iOS





Comparison between android and iOS


Developer
Google
Apple Inc.
Initial release
September 23, 2008
July 29, 2007
Source model
Open source
Closed, with open source components.
Customizability
A lot. Can change almost anything.
Limited unless jailbroken
File transfer
Easier than iOS. Using USB port and Android File Transfer desktop app. 
Photos can be transferred via USB without apps.
More difficult. Media files can be transferred using iTunes desktop app.
 Photos can be transferred out via USB without apps.
Available on
Many phones and tablets. Major manufacturers are Samsung, Motorola, LG, HTC
 and Sony. Kindle Fire also uses a modified version of Android. Nexus line of devices
 is pure Android, others bundle manufacturer software.
iPod Touch, iPhone, iPad, Apple TV (2nd and 3rd generation)
Calls and messaging
Google Hangouts. 3rd party apps like Facebook Messenger, WhatsApp, Google Duo
 and Skype all work on Android and iOS both.
iMessage, FaceTime (with other Apple devices only). 3rd party apps like Google Hangouts,
 Facebook Messenger, WhatsApp, Google Duo and Skype all work on Android and iOS both.
App store , Affordability and interface
Google Play – 1,000,000+ apps. Other app stores like Amazon and Getjar also distribute 
Android apps. (unconfirmed ".APKs")
Apple app store – 1,000,000+ apps
Video chat
Google Hangouts and other 3rd party apps
FaceTime (Apple devices only) and other 3rd party apps
OS family
Linux
OS X, UNIX
Programmed in
C, C++, Java
C, C++, Objective-C, Swift
Open source
Kernel, UI, and some standard apps
The iOS kernel is not open source but is based on the open-source Darwin OS.
Widgets
Yes
No, except in NotificationCenter
Internet browsing
Google Chrome (or Android Browser on older versions; other browsers are available)
Mobile Safari (Other browsers are available)
Voice commands
Google Now (on newer versions)
Siri
Maps
Google Maps
Apple Maps (Google Maps also available via a separate app download)
Market share
81.5% of smartphones globally (2014), 3.7% of tablets in North America (as of Jan'13) 
and 44.4% of tablets in Japan (as of Jan'13). In the United States in Q1 2013 - 52.3% phones,
 47.7% tablets.
14.8% of smartphones globally (2014), 22.8% of tablets globally (2014), 87% of tablets in
 North America (as of Jan'13) and 40.1% of tablets in Japan (as of Jan'13)
Available language(s)
32 Languages
34 Languages
Latest stable release and Updates
Android 6.0.1 (Marshmallow) (October 2015)
9.3 (March 21, 2016)
Alternative app stores and side loading
Several alternative app stores other than the official Google Play Store. It's risky to
 download apps from other stores because they may be malware.
Apple blocks 3rd party app stores. The phone needs to be jailbroken if you want to 
download apps from other stores.
Battery life and management
Many Android phone manufacturers equip their devices with large batteries with a longer life.
Apple batteries are generally not as big as the largest Android batteries. However,
 Apple is able to squeeze decent battery life via hardware/software optimizations.
Rooting, bootloaders, and jailbreaking
Access and complete control over your device is available and you can unlock the 
bootloader.
Complete control over your device is not available.
File manager
Yes, available.
Not available
Cloud services
Native integration with Google cloud storage. 15GB free, $2/mo for 100GB, 1TB
 for $10. Apps available for Amazon Photos, OneDrive and Dropbox.
Native integration with iCloud. 5GB free, 50GB for $1/mo, 200GB for $3/mo, 1TB
 for $10/mo. Apps available for Google Drive and Google Photos, Amazon Photos,
 OneDrive and Dropbox.
Photos & Videos backup
Apps available for automatic backup of photos and videos. Google Photos allows 
unlimited backup of photos if you select the low-resolution option. OneDrive, Amazon 
Photos and Dropbox are other alternatives.
Up to 5 GB of photos and videos can be automatically back up with iCloud. All other
 vendors like Google, Amazon, Dropbox, Flickr and Microsoft have auto-backup apps 
for both iOS and Android.
Security
Android software patches are available soonest to Nexus device users. Manufacturers
 tend to lag behind in pushing out these updates. So at any given time a vast majority
 of Android devices are not running updated fully patched software.
Most people will never encounter a problem with malware because they don’t go 
outside the Play Store for apps. Apple's software updates support older iOS devices also.









iOS ☺ and Android ☹.
Everything seems smoother, faster and more stable.
Unlocking iPhone with fingerprints is more secure and accurate than with Android’s pattern.
Widgets in Notification area is more convenient solution than widgets on Android’s launcher.
Now I can spy for people! I mean taking pictures without annoying shutter sound.
Dedicated shutter release hardware button, easier to take selfies with main camera.
 I tend to not sacrifice the quality by taking pictures with front camera. It was so
 difficult and unreliable to hold the phone in one hand and hit the small shutter 
button on the other side of it.
I can install Bank of America app, I couldn’t do it on Android due to my phone’s
 original location, which is not United States. I guess it’s common to some other apps.
Some third party apps are designed with more attention to detail than those for Android.
More control of notifications and data usage.
Torch and calculator are accessible without unlocking the phone.
Easier to uninstall applications.
Easier to upload new music thanks to iTunes. I hated using Android File Transfer MacOS app.
iPhone is integrated into Apple ecosystem tightly, so now I can accept phone calls on Mac
 not touching the phone, use same Notes app across platform with data stored in iCloud
, transfer files over Airdrop, etc.
Apple devices remember Wi-Fi networks and passwords and automatically connect my new 
iPhone in places I was before.
Headphones (AKG K451) remote control designed for Apple devices (well, most of headphones
 on the market are) is way more useful now with activated volume control. Especially it’s 
appreciated when you bring your iPhone in a pocket, and it’s upside down due to location 
of mini jack hole which is at the bottom of the phone, while volume buttons are at the top 
part of device. Without remote control you’ll have to take out your iPhone from the pocket
 to adjust volume.
Probably not Android issue, but headphones suddenly started sound louder and cleaner.
iOS ☹ and Android ☺.
I have a paranoia of very soon worn out Home button, I saw this issue many times, and 

seems like Chinese environment influence my peace of mind. Read @joulee’s story about 
iPhone users in China.
No way to share a photo to Instagram from Photos. You have to do it directly from Instagram.
I’m in Contacts, tap a contact and start ringing. WTF, I was supposed to get a person’s details
 first. Never mind, I can get used to it. What’s worse is if I accidentally tap SMS instead of Call
 (these two icons are very close to each other and have the same colour), I get to Message
 Composing screen. I tap Cancel and get to the list of messages. There is no way to tap another
 Back and get back to the contact details screen. I have to double tap Home button and select
 Contacts app, not forgetting to close Messaging app. So much hassle, Apple!
I can’t open a link to a service with available on my iPhone application inside this application,
 it’s opened in Safari instead. Some services suggest to open the link in the app though, but not
 all, and you still have to load all the data 2 times — Safari and then native app.
I miss people avatars in Contacts.
Can’t download music lyrics from Music app. You have to use iTunes on a computer to add
 lyrics to your audio files.
Can’t attach files in Email app. Can’t attach files from Dropbox composing an email in Gmail 
or Inbox. In Gmail you can attach files from Google Drive though.
It’s a challenge to change Wi-Fi network. You have to leave your current app, 
go to Settings > Wi-Fi. In Android you tap and hold Wi-Fi icon in notification center.


Friday 14 October 2016

Coding the Regula Falsi

The convergce process in the bisection method is very slow. It depends only on the choice of end points of the interval [a,b]. The function f(x) does not have any role in finding the point c (which is just  the mid-point of a and b). It is used only to decide the next smaller interval [a,c] or [c,b]. A better approximation to c can be obtained by taking the straight line L joining the points (a,f(a)) and (b,f(b)) intersecting the x-axis. To obtain the value of c we can equate the two expressions of the slope m of the line L.






Let's take an Equation   :-  x*x*x-17




#include<stdio.h>
 struct iter
 {
     float x1;
     float x0;
 };
 float f(float x)
 {

    float y;
    y=x*x*x-17;

    return y;
 }
 float f1(float x)
 {
     float y1;
      y1=3*x*x;
      return y1;
 }

 void main()
 {
     int n,i;
     float a,b,x0,x1,x2,x3,x4,x5,x6;

     printf("enter the intervals");
     scanf("%f%f" ,&a,&b);
     printf("\nEnter the number of iterations\n");
     scanf("%d",&n);
     if(f(a)*f(b)<0)
     {
         printf("root is possible between interval %f %f " ,a,b);

     }
     else
     {

    printf("root does not lie between %f %f \n" ,a,b);
    exit(1);

     }

 if(fabs(f(a))<fabs(f(b)))
 x0=f(a);

 else

 x0=f(b);
 x0=a;

 printf("xnot is %f \n " ,x0 );
struct iter k[1000];
 k[0].x0=x0;
i=0;
while(n!=0)
{

  k[i].x1=k[i].x0-(f(k[i].x0)/f1(k[i].x0));

 printf("\n%f" ,k[i].x1);
 k[i+1].x0= k[i].x1;

--n;
++i;

}


 }




Tuesday 4 October 2016

multi threading in JAVA



Java is a multi-threaded programming language which means we can develop multi-threaded program using Java. A multi-threaded program contains two or more parts that can run concurrently and each part can handle a different task at the same time making optimal use of the available resources specially when your computer has multiple CPUs.
By definition, multitasking is when multiple processes share common processing resources such as a CPU. Multi-threading extends the idea of multitasking into applications where you can subdivide specific operations within a single application into individual threads. Each of the threads can run in parallel. The OS divides processing time not only among different applications, but also among each thread within an application.
Multi-threading enables you to write in a way where multiple activities can proceed concurrently in the same program.


A thread is a basic process that can be made run individually!!

class main
{
public static void main(String args[])
{
A ob =new A();
ob.start();
}
}
class A extends Thread   // creating a thread

{
public void run()

{
System.out.println(" A thread is running ");
}
}








Sunday 25 September 2016

Pop Ups in JAVA

import javax.swing.JOptionPane;
public class stringvar
{
public static void main(String args[])
{
String fn,fn2,fn3;      
fn = JOptionPane.showInputDialog("Enter your first name");
fn2= JOptionPane.showInputDialog("Enter your family name");

fn3 = "You are "+ fn+" "+fn2;
JOptionPane.showMessageDialog(null,fn3);
}
}






Sunday 18 September 2016

A CODE that finds the greatest number among three


import java.util.Scanner;
class G
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a,b,c;
System.out.println("Enter the three numbers ");
a=in.nextInt();                                  
b=in.nextInt();                             // taking three inputs from user
c=in.nextInt();
if(a!=b&&b!=c&&c!=a){          // Checking whether there is more than one same input
if(a>b&&a>b)                             //Checking for first number
System.out.println(a+" is greatest");
else if(b>a&&b>c)                       //Checking for second number
System.out.println(b+" is greatest");
else                                              // In case all conditions are false the third condition becomes true
System.out.println(c+" is greatest");
}
else
System.out.println("One or more numbers are equal ;try again ");
}
}



CODE to reverse a number in JAVA

import java.util.Scanner;   // Scanner class is impoerted to perform input functions
class Rev
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);   // Creating Object of Scanner Class
int s=0,n,r;            
n=in.nextInt();    // Taking input form user and storing in 'n' variable.
while(n!=0)
{
r=n%10;             // remainder is determined(if n is 998 then r will be 8)
s=s*10+r;          
n=n/10;
}
System.out.println("Revers is "+s);
}
}




Thursday 8 September 2016

Passing an attribute through main method

class CmdLimit  // Creating a class
{
public static void main(String args[])   //Arguments would be passed through main.                            {
int n,i;
n =  args.length;   // length of the argument is stored in n
for(i=0;i<n;i++)
{
System.out.println("Arguement" +i+" "+args[i]);      //arguments would be printed one by one
}
}
}


or Goto BlueJ





Tuesday 6 September 2016

Area of Rectangle - Functions and classes in JAVA an introduction

Class - In JAVA class is a way to bind functions and objects together in a single unit.
unlike C it requires no header files.
Functions - Functions are a self contained block of statements, that perform a specific task.
import java.util.Scanner;

class Rectangle // it's a custom to write the first letter of class in Capitals.

{

int height,breadth; // Global variables

void getData(int x,int y)  // x and y are the formal parameters

{

height = x;

breadth= y;

}

int area()

{

return breadth*height;

}

}

class Rectangle2   // another class(Main class because main function is in this class)

{

public static void main(String args[])

{

Scanner in = new Scanner (System.in);

int z,h,g;

System.out.println("Enter the height and breadth");

h= in.nextInt();

g= in.nextInt();

 Rectangle e = new Rectangle();

 e.getData(h,g);

 z = e.area();

 System.out.println("Area is "+z);

 }

 }


1. Open terminal in case of linux
2. set the path
3. type javac  classname.java
4. java classname



Thursday 25 August 2016

Coding the well known Bisection Method

Getting root of an equation by Bisection Method through C programming language.

The Method:
The method is applicable for numerically solving the equation f(x) = 0 for the real variable x, where f is a continuous function defined on an interval [ab] and where f(a) and f(b) have opposite signs. In this case a and b are said to bracket a root since, by the intermediate value theorem, the continuous function f must have at least one root in the interval (ab).
At each step the method divides the interval in two by computing the midpoint c = (a+b) / 2 of the interval and the value of the function f(c) at that point. Unless c is itself a root (which is very unlikely, but possible) there are now only two possibilities: either f(a) and f(c) have opposite signs and bracket a root, or f(c) and f(b) have opposite signs and bracket a root.[5] The method selects the subinterval that is guaranteed to be a bracket as the new interval to be used in the next step. In this way an interval that contains a zero of f is reduced in width by 50% at each step. The process is continued until the interval is sufficiently small.
Explicitly, if f(a) and f(c) have opposite signs, then the method sets c as the new value for b, and if f(b) and f(c) have opposite signs then the method sets c as the new a. (If f(c)=0 then c may be taken as the solution and the process stops.) In both cases, the new f(a) and f(b) have opposite signs, so the method is applicable to this smaller interval.


SOURCE CODE:


#include<stdio.h>
float f(float x)
{
    float z;
    z= x*x*x-4*x-9;
    return z;
}// Getting the value of f(x)
void main()
{


    printf("\n \n Equation is \tx^3-4x-9\n");
    int n;
    float c,i,a,b,r,A,B,C;
    printf("\n Enter the number of iterations\n");
    scanf("%d",&n);// n is the number of the iterations

    for(i=0.0;i<3.0;i=i+0.001)
    {
        if(f(i)<0.001)
        {
            a=i;

            }
    }
    b=a+0.01;
//Here a and b variables are the intervals
    printf("Root lies between %f and %f ", a,b);
do
{
    c=(a+b)/2;
   if(f(a)*f(c)<0)
    b=c;
   if(f(b)*f(c)<0)
    a=c;

    r=f(c);
    --n;
}while(n!=0);
printf("\n Root is %f \n",(a+b)/2);


}

C program to find the sum of two matrices of order mxn.

#include<stdio.h>
void main()
{
   int i,j,a[20][20],b[20][20],s[20][20],max,m,n;
   printf("Name: Viraj Singh\nRoll No.:-1503213117\n\n");
   printf("Enter order of the matrix\n");
   scanf("%d%d",&m,&n);
   printf("Enter the matrix A\n");
   for(i=0;i<m;i++)
       for(j=0;j<n;j++)
       scanf("%d",&a[i][j]);
   printf("Enter the matrix B\n");
   for(i=0;i<m;i++)
       for(j=0;j<n;j++)
       scanf("%d",&b[i][j]);
   for(i=0;i<m;i++)
   {
       for(j=0;j<n;j++)
       {
           s[i][j]=a[i][j]+b[i][j];
       }
   }
   printf("Sum is:-\n");
   for(i=0;i<m;i++)
   {
       for(j=0;j<n;j++)
       printf("%d   ",s[i][j]);
       printf("\n");
   }

}

To find the roots of an equation

#include<stdio.h>
#include<math.h>
void main()
{
   
    int a,b,c;
    float d,x,y;
    printf("enter the value of a,b,c");
    scanf("%d%d%d",&a,&b,&c);
    d=(b*b)-(4*a*c);
    if(d>0){
     printf("roots are real and distinct");
     x=(-b+(sqrt(d)))/2*a;
     y=(-b-(sqrt(d)))/2*a;
     printf("roots are %f %f",x,y);
    }
    else if(d=0)
    {
        printf("roots are real and same");
        x=-b/(2*a);
        y=-b/(2*a);
        printf("roots are %f %f",x,y);
    }
    else
    {
        printf("roots are imaginary");
    }
}



Aim: To perform computer exponential airthmatic (Addition, Subtraction, Multiplication, Divison)

#include<stdio.h>
#include<math.h>
void main()
{
    int ch;
    float e1,e2,x1,x2,k,E,x;
   printf("Enter first number in FPR. \n");
    scanf("%f%f",&x1,&e1);
    printf("Enter second number in FPR. \n");
    scanf("%f%f",&x2,&e2);
    k=fabs(e1-e2);
    if(e1>e2)
    {
        x2=x2/(pow(10,k));
        E=e1;
    }
    else
    {
        x1=x1/(pow(10,k));
        E=e2;
    }
    printf("Enter : \n1 - Addition \n2 - Subtraction \n3 - Multiplication \n4 - Division \n");
    scanf("%d",&ch);
    switch(ch)
    {
        case 1 :
        {
            x=x1+x2;
            if(x>0.1)
            {
                x1=x1/10;
                E=E+1;
            }
            printf("%fe%f ",x,E);
            break;
        }
        case 2 :
        {
            x=fabs(x1-x2);
            if(x<0.1)
            {
                x1=x1*10;
                E=E-1;
            }
            printf("%fe%f ",x,E);
            break;
        }
        case 3 :
        {
            x=fabs(x1*x2);
            E=e1+e2;
            printf("%fe%f ",x,E);
            break;
        }
        case 4 :
        {
            x=x1/x2;
            E=e1-e2;
            if(e1>99)
            {
                printf("Overflow.");
            }
            if(e1<-99)
            {
                printf("Underflow.");
            }
            printf("%fe%f ",x,E);
            break;
        }
        default :
        {
            printf("Invalid Choice. \n");
        }
    }
}




To find the area of the triangle.

#include<stdio.h>
#include<math.h>
void main()
{
  

    float a,b,c,s,area,k;
    printf("enter the three sides of triangle");
    scanf("%f%f%f",&a,&b,&c);
    s=(a+b+c)/2;
     k=s*(s-a)*(s-b)*(s-c);
     if(c<0)
     {
         printf("complex no");
     }
     else
    {
        area=sqrt(c);
    }
    printf("area of triangle is %f",area);
}


To find the relative , percentage, absolute error using normalized floating point representation.

#include<stdio.h>
#include<math.h>
void main()
{
    float abserror, relerror, percerror, trueval, approxval;
    printf("enter true value");
    scanf("%f",&trueval);
    printf("enter approx value");
    scanf("%f",&approxval);
    abserror=fabs(trueval-approxval);
    relerror=abserror/trueval;
    percerror=relerror*100;
    printf("absolute error = %f",abserror);
    printf("relative error = %f",relerror);
    printf("percentage error = %f",percerror);
}







Aim: Write a program in C to find the sum of two matrices of order mxn.

#include<stdio.h>
void main()
{
    int i,j,a[20][20],b[20][20],s[20][20],max,m,n;
    printf("Enter order of the matrix\n");
    scanf("%d%d",&m,&n);
    printf("Enter the matrix A\n");
    for(i=0;i<m;i++)
        for(j=0;j<n;j++)
        scanf("%d",&a[i][j]);
    printf("Enter the matrix B\n");
    for(i=0;i<m;i++)
        for(j=0;j<n;j++)
        scanf("%d",&b[i][j]);
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        {
            s[i][j]=a[i][j]+b[i][j];
        }
    }
    printf("Sum is:-\n");
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        printf("%d   ",s[i][j]);
        printf("\n");
    }

}

Write a program in C to find the largest number from the given n numbers.

#include<stdio.h>
void main()
{
    int i,a[20],max,n;
    printf("Enter no of elements\n");
    scanf("%d",&n);
    printf("Enter the array\n");
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    max=a[0];
    for(i=1;i<n;i++)
    {
        if(a[i]>max)
            max=a[i];
    }
    printf("Max Element=%d",max);
}





Sunday 21 August 2016

Bisection Method

Getting root of an equation by Bisection Method through C programming language.

The Method:
The method is applicable for numerically solving the equation f(x) = 0 for the real variable x, where f is a continuous function defined on an interval [ab] and where f(a) and f(b) have opposite signs. In this case a and b are said to bracket a root since, by the intermediate value theorem, the continuous function f must have at least one root in the interval (ab).
At each step the method divides the interval in two by computing the midpoint c = (a+b) / 2 of the interval and the value of the function f(c) at that point. Unless c is itself a root (which is very unlikely, but possible) there are now only two possibilities: either f(a) and f(c) have opposite signs and bracket a root, or f(c) and f(b) have opposite signs and bracket a root.[5] The method selects the subinterval that is guaranteed to be a bracket as the new interval to be used in the next step. In this way an interval that contains a zero of f is reduced in width by 50% at each step. The process is continued until the interval is sufficiently small.
Explicitly, if f(a) and f(c) have opposite signs, then the method sets c as the new value for b, and if f(b) and f(c) have opposite signs then the method sets c as the new a. (If f(c)=0 then c may be taken as the solution and the process stops.) In both cases, the new f(a) and f(b) have opposite signs, so the method is applicable to this smaller interval.


SOURCE CODE:


#include<stdio.h>
float f(float x)
{
    float z;
    z= x*x*x-4*x-9;
    return z;
}// Getting the value of f(x)
void main()
{


    printf("\n \n Equation is \tx^3-4x-9\n");
    int n;
    float c,i,a,b,r,A,B,C;
    printf("\n Enter the number of iterations\n");
    scanf("%d",&n);// n is the number of the iterations

    for(i=0.0;i<3.0;i=i+0.001)
    {
        if(f(i)<0.001)
        {
            a=i;

            }
    }
    b=a+0.01;
//Here a and b variables are the intervals
    printf("Root lies between %f and %f ", a,b);
do
{
    c=(a+b)/2;
   if(f(a)*f(c)<0)
    b=c;
   if(f(b)*f(c)<0)
    a=c;

    r=f(c);
    --n;
}while(n!=0);
printf("\n Root is %f \n",(a+b)/2);


}