Posts

Rumoured Apple iPhone XI features

Image
APPLE'S GENERATION NEXT  iPhones rumours have started  promising a plethora of new features and updates. Expected release of the next iPhone batch will be around September 2019. There have been so many different rumours from different sources claiming that the upcoming iPhone's features. 3 Rear Camera with the 12MP selfie cam Apple analyst (mostly accurate) Ming-Chi Kuo has published a new research note for investors about the iPhone cameras. So, the OLED-sporting two iPhones will get a third, super-wide 12-megapixel camera with Sony sensor, and the iPhone XR sequel will move to the two-camera setup you find on the high-end iPhones today (with a telephoto lens). The front cameras on iPhones with TrueDepth module's main colour RGB camera is getting an upgrade from resulting 7 megapixels with 4mp lens elements to 12 megapixels with 5mp lens elements. According to Kuo, who says the company will use a special dark coating to conceal the third lens on the back ...

Welcome Guide to Swift 5 Escaping String

Image
With the evolution of Swift, we often comes to create strings from raw text which can be a pain. Properly escaping any quotes or backslash characters in the raw text is an exercise in frustration. Swift 5, introduced with Xcode 10.2, introduces a new syntax to make it easier to work with raw text. Traditional Strings With String Literals To create a String from literal text, we use the common method of double quote (") as a starting and ending delimiter and the backslash (\) to escape special characters. For example, to create a String that preserves the double-quotes in this text: let title1 = "This is \"title\" here" // This is "title" here Swift 5 Custom String Escaping Swift 5 allows you to customize the delimiter and escape sequences. This is useful when working with raw text that might contain the delimiters or multiple escape sequence. Here we can pad the start, end and escape delimiters with one or more “ # ” characters....

Java Program to implement decimal checksum

//java program for decimal checksum import java.util.*; import java.io.*; class DjCheck1 { int i,j,k,l,m; int ans=0,ans1=0; //String pck=""; public void checksum() { System.out.println("How many message you want to send ?"); Scanner s=new Scanner(System.in); i=s.nextInt(); int msg[][]=new int[i][8]; Scanner s1=new Scanner(System.in); for(j=0;j<i;j++) { System.out.println(" Enter your decimal value: "); for(k=0;k<8;k++) { msg[j][k]=s1.nextInt(); } } for(l=0;l<i;l++) { ans=0;ans1=0; System.out.print("[ "); for(m=0;m<8;m++) { System.out.print(msg[l][m]+" , "); ans+=msg[l][m]; ans1=0-ans; } System.out.print(ans1+" ]"); if(ans+ans1==0) { System.out.print(" no error."); } else { System.out.print(" error in your message."); } System.out.println(); }...

Java Program to implement binary checksum

//java program for binary checksum import java.util.*; import java.io.*; class DjCheck1 { int i,j,k,l,m,n; String and=""; String compl=""; int ans; public void checksum() { int[] msg1=new int[8]; int[] msg2=new int[8]; Scanner s=new Scanner(System.in); System.out.println(" Enter your 1st binary value [8 bit]: "); for(i=0;i<8;i++) // to get values { msg1[i]=s.nextInt(); } System.out.println(" Enter your 2nd binary value [8 bit]: "); for(j=0;j<8;j++) { msg2[j]=s.nextInt(); } System.out.print("\nValue 1: "); for(k=0;k<8;k++) // to print values { System.out.print(msg1[k]); } System.out.print("\nValue 2: "); for(l=0;l<8;l++) { System.out.print(msg2[l]); } for(m=0;m<8;m++) // for 1s complement { and+=msg1[m] & msg2[m]; if(and.charAt(m)=='0') compl+="1"; else c...

Java Program for block parity

/*java program for block parity or double parity (block parity). Calculating each column of multiple messages to check if it is even or odd. In Case of even value add 1 otherwise 0 to make even parity of column  eg. 10110101 11110011 _________ 01000110 */ import java.util.*; class DjParity1 { int i,j,k,l; String ans=""; public void blockParity() { System.out.println("How many message you want to send: "); Scanner s=new Scanner(System.in); i=s.nextInt(); String msg[]=new String[i]; Scanner s1=new Scanner(System.in); for(j=0;j<i;j++) { System.out.println("Enter your msg value[0/1] 8 bit: "); msg[j]=s1.nextLine(); } for(k=0;k<msg[0].length();k++) { //System.out.println("hello "+msg[k]); int a=0; for(l=0;l<i;l++) { a+=msg[l].charAt(k); //System.out.println("Your msg: "+msg[l]); } if(a%2==0) { ans+="0"; } else ...

Java Program for protocol 3 with two way communication between sender and receiver

/*Here, sender will send message to receiver and wait for acknowledgment for some time(here 3 sec). If receiver failed to response acknowledgement, sender resend the same message(here, 3 times). */ //sender to send message for protocol 3 import java.io.*; import java.net.*; public class protocol3_Sender { public static void main(String args[]) { try { Socket s=new Socket("localhost",6666); DataOutputStream dos=new DataOutputStream(s.getOutputStream()); DataInputStream dis=new DataInputStream(s.getInputStream()); BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); String str="",ack="",ch=""; do { System.out.println("Enter your message: "); str=br.readLine(); System.out.println("String: "+str); dos.writeUTF(str); ack=dis.readUTF(); for(int i=0;i<3;i++) { Thread.sleep(3000); if(ack.equals("")) ...

Java Program for protocol 2 with two way communication between sender and receiver until receiver response some signal.

//sender to send message for protocol 1 import java.io.*; import java.net.*; public class protocol2_Sender { public static void main(String args[]) { try { Socket s=new Socket("localhost",6666); DataOutputStream dos=new DataOutputStream(s.getOutputStream()); DataInputStream dis=new DataInputStream(s.getInputStream()); BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); String str="",signal=""; do { System.out.println("Sender: "); str=br.readLine(); System.out.println("String: "+str); dos.writeUTF(str); //dos.writeUTF(ch); //dos.flush(); signal=dis.readUTF(); System.out.println("Server says: " +signal); }while(signal.equals("signal")); //dos.flush(); dos.close(); //s.close(); } catch(IOException e) { System.out.println(e.getMessage()); } } } //receiver to...