Programs List | Programming ExamplesA list of programs or programming examples on C, C++, Java, C#, Python and PHP are given below.
Basic Programs1) Program to calculate the area of rectangle Input: Width = 10, Height = 5 Output: Area of Rectangle = Width * Height = 10 * 5 = 50 2) Program to calculate the volume of sphere Input: Radius = 48, Pie = 3.14 Output: Volume = (4.0/3.0) * pie * (radius * radius * radius); = (4.0/3.0) * 3.14 * 48 * 48 * 48 =<PHONE_NUMBER>12 3) Program to find the area of the pentagon Input: s = 13 a = 5; Output: Area of Pentagon = (5.0/2.0) * s * a = (5.0/2.0) * 13 * 5 = 162.5 4) Program to find the area of parallelogram Input: base = 4; height = 18; Output: Area of Parallelogram = base * height; = 4 * 18 = 72 5) Program to find the area of square Input: a = 13 Output: Area of Square = a2 = 132 = 169 6) Program to find the surface area of sphere Input: Radius = 37, Pie = 3.14 Output: Volume = 4 * pie * (radius * radius); = 4 * 3.14 * 37 * 37 = 17210.285714 7) Program to find the volume of cone Input: Radius = 38, Height = 35, Pie = 3.14 Output: Volume = pie * radius * radius * height/3; = 3.14 * 38 * 38 * 35/3 = 48766.666667 8) Program to find the volume of the cube Input: side = 4 Output: Volume of cube = side3 = 43 = 64 9) Program to find the volume of cylinder Input: radius (r) = 38 , height (h) = 35 Output: Volume of the cylinder = pie * radius2 * height = 3.14 * 38* 38 * 35 =<PHONE_NUMBER>00 10) Program to calculate the CGPA percentage CGPA percentage is = (float)(9.5 * (CGPA)); Input: CGPA = (Grades in all Subjects) / (Total Number of Subjects). English = 9.1; Hindi = 8.5; Maths = 9.5; Science =9.6; SocialStudy = 8.6; CGPA = (9.1+8.5+9.5+9.6+8.6)/(5.0); Output: CGPA percentage is = 86.070000 11) Program to convert Celsius into Fahrenheit Temperature in Fahrenheit = ((celsius * 9) / 5) + 32 Input: celsius= 12 Output: Temperature in Fahrenheit = 53.6 12) Program to convert days into years Input: days= 799; Output: Number of years = days / 365; = 799 / 365 = 2 13) Program to convert Fahrenheit into Celsius Temperature in Celsius = ((Fahrenheit-32)*5)/9 Input: Fahrenheit = 54 Output: Temperature in Celsius= ((54-32)*5)/9 = 12.22222 14) Program to find the area of an equilateral triangle Input: side (a) = 5 Output: Area of Equilateral Triangle = ( 1.73 * a * a) / 4 = ( 1.73 * 5 * 5) / 4 = 10.81250 15) Program to find the area of a triangle Input: b = 5 h = 12 Output: Area of Triangle = (b * h) / 2 = (5 * 12) / 2 = 30.0 16) Program to find the area of the right angle triangle Input: b = 5 h = 8 Output: Area of Triangle = (b * h) / 2 = (5 * 8) / 2 = 20.0 17) Program to find the perimeter of the rectangle Input: a = c = 5 b = d = 4 Output: Perimeter of Rectangle = 2 * ( a + b); = 2 * (5 + 4) = 18.00000 18) Program to find the simple interest Simple Interest = (P × R × T) / 100 Input: P = 34000, R = 30,T = 5 where P = Principal Amount, R = Rate per Annum, T = Time (years) Output: Simple Interest = 51000.000 19) Program to find the surface area of a cube Surface Area Of Cube = 6 ( a * a ) Input: b = 5, h = 5 a (side) = length = breadth = height Output: Surface Area Of Cube = 6 * 5 * 5=150.00000 20) Program to find the surface area of cuboid Input: l= 2, w = 3, h = 5; where l = length, w = width and h = height. Output: Surface Area OfCuboid = 2 * (l * w+ w * h + h * l) = 2 * (2 * 3 + 3 * 5 + 5 * 2) = 62.00000 21) Program to find the surface area of the cylinder Surface Area of Cylinder = 2 Π (r + h) Input: r = 2.0, h = 5.0 Output: Surface Area of Cylinder = 2 Π (r + h) Here, r = radius, h = height, and Π ( pie ) = 3.14 = 2 * 3.14 * ( 2.0 + 5.0) = 44.00000 Number Programs1) Program to Check Disarium number Input: num = 175 Output: 11 + 72 + 53 = 1 + 49 + 125 = 175 175 is a disarium number 2) Program to Check Happy number Input: num = 82 Output: 82 + 22 = 68 62 + 82 = 100 12 + 02 + 02 = 1 82 is a happy number number 3) Program to Check Harshad number A number is said to be the Harshad number if it is divisible by the sum of its digit. Input: num = 156 Output: 156 is a Harshad number 4) Program to print all Disarium numbers between 1 to 100 Input: range(1, 101) Output: Disarium numbers between 1 and 100 are: 1 2 3 4 5 6 7 8 9 89 5) Program to print all Happy numbers between 1 to 100 Input: range(1, 101) Output: List of happy numbers between 1 and 100: 1 7 10 13 19 23 28 31 32 44 49 68 70 79 82 86 91 94 97 100 6) Program to print all Pronic numbers between 1 to 100 A number is said to be pronic number if it is a product of two consecutive numbers. For examples: 6 = 2 x 3 Input: range(1, 101) Output: Pronic numbers between 1 and 100: 2 6 12 20 30 42 56 72 90 7) Program to determine whether a given number is a Deficient number 8) Program to determine whether a given number is an abundant number 9) Program to determine whether a given number is a twisted prime number 10) Program to print all abundant numbers between 1 to 100 11) Program to print all Kaprekar numbers between 1 to 100 12) Program to print all prime numbers between 1 to 100 13) Program to print the average of n numbers 14) Program to print the combination (nCr) of the given number 15) Program to print the first 10 prime numbers 16) Program to print the permutation (nPr) of the given number 17) Program to print the sum of digits without using modulus 18) Program to swap two numbers 19) Program to swap two numbers without using the third variable Array Programs1) Program to copy all the elements of one array into another array Input: arr1 = [1, 2, 3, 4, 5]; arr2 = [None] * len(arr1); Output: Elements of original array: 1 2 3 4 5 Elements of new array: 1 2 3 4 5 2) Program to find the frequency of each element of an array Input: arr = [1, 2, 8, 3, 2, 2, 2, 5, 1] Output: Element | Frequency 1|2 2|4 8|1 3|1 5|1 3) Program to left rotate the elements of an array Input: arr = [1, 2, 3, 4, 5] Here, n determine the number of times an array should be rotated n = 3 Output: Original array: 1 2 3 4 5 Array after left rotation: 4 5 1 2 3 4) Program to print the duplicate elements of an array Input: arr = [1, 2, 3, 4, 2, 7, 8, 8, 3]; Output: Duplicate elements in given array: 2 3 8 5) Program to print the elements of an array Input: arr = [1, 2, 3, 4, 5] Output: Elements of given array: 1 2 3 4 5 6) Program to print the elements of an array in reverse order Input: arr = [1, 2, 3, 4, 5] Output: Original array: 1 2 3 4 5 Array in reverse order: 5 4 3 2 1 7) Program to print the elements of an array present on even position Input: arr = [1, 2, 3, 4, 5] Output: Elements of given array present on even position: 2 4 8) Program to print the elements of an array present on odd position Input: arr = [1, 2, 3, 4, 5] Output: Elements of given array present on odd position: 1 3 5 9) Program to print the largest element present in an array Input: arr = [25, 11, 7, 75, 56] Output: Largest element present in given array: 75 10) Program to print the number of elements present in an array Input: arr = [1, 2, 3, 4, 5] Output: Number of elements present in given array: 5 11) Program to print the smallest element present in an array Input: arr = [25, 11, 7, 75, 56] Output: Smallest element present in given array: 7 12) Program to print the sum of all the elements of an array Input: arr = [1, 2, 3, 4, 5] sum = 0 Output: Sum of all the elements of an array: 15 13) Program to right rotate the elements of an array Input: arr = [1, 2, 3, 4, 5] Here, n determine the number of times an array should be rotated n = 3 Output: Original array: 1 2 3 4 5 Array after right rotation: 3 4 5 1 2 14) Program to sort the elements of an array in ascending order Input: arr = [5, 2, 8, 7, 1] Output: Elements of original array: 5 2 8 7 1 Elements of array sorted in ascending order: 1 2 5 7 8 15) Program to sort the elements of an array in descending order Input: arr = [5, 2, 8, 7, 1] Output: Elements of original array: 5 2 8 7 1 Elements of array sorted in descending order: 8 7 5 2 1 Matrix Programs1) Program to calculate the addition of 2 matrices Input: Matrix a = [1, 0, 1] [4, 5, 6] [1, 2, 3] matrix b = [1, 1, 1] [2, 3, 1] [1, 5, 1] Output: Addition of two matrices: [2 1 2] [6 8 7] [2 7 4] 2) Program to calculate the subtraction of 2 matrices Input: Matrix a = [4, 5, 6] [3, 4, 1] [1, 2, 3] Matrix b = [2, 0, 3] [2, 3, 1] [1, 1, 1] Output: Subtraction of two matrices: [2 5 3] [1 1 0] [0 1 2] 3) Program to determine whether a given matrix is an identity matrix Input: Matrix a =[1, 0, 0] [0, 1, 0] [0, 0, 1] Output: Given matrix is an identity matrix 4) Program to determine whether a given matrix is a sparse matrix Input: Matrix a = [4, 0, 0] [0, 5, 0] [0, 0, 6] Output: Given matrix is a sparse matrix 5) Program to determine whether two matrices are equal Input: Matrix a = [1, 2, 3] [8, 4, 6] [4, 5, 7] matrix b = [1, 2, 3] [8, 4, 6] [4, 5, 7] Output: Matrices are equal 6) Program to display the lower triangular matrix Input: Matrix a = [1, 2, 3] [8, 6, 4] [4, 5, 6] Output: Lower triangular matrix: [1 0 0] [8 6 0] [4 5 6] 7) Program to display the upper triangular matrix Input: Matrix a = [1, 2, 3] [8, 6, 4] [4, 5, 6] Output: Upper triangular matrix: [1 2 3] [0 6 4] [0 0 6] 8) Program to find the frequency of odd & even numbers in the given Matrix Input: Matrix a = [4, 1, 3] [3, 5, 7] [8, 2, 6] Output: Frequency of odd numbers: 5 Frequency of even numbers: 4 9) Program to find the product of two matrices Input: Matrix a = [1, 3, 2] [3, 1, 1] [1, 2, 2] matrix b = [2, 1, 1] [1, 0, 1] [1, 3, 1] Output: Product of two matrices: [7 7 6] [8 6 5] [6 7 5] 10) Program to find the sum of each row and each column of a matrix Input: Matrix a = [1, 2, 3] [4, 5, 6] [7, 8, 9] Output: Sum of 1 row: 6 Sum of 2 row: 15 Sum of 3 row: 24 Sum of 1 column: 12 Sum of 2 column: 15 Sum of 3 column: 18 11) Program to find the transpose of a given matrix Input: Matrix a = [1, 2, 3] [4, 5, 6] [7, 8, 9] Output: Transpose of given matrix: [1 4 7] [2 5 8] [3 6 9] String Programs1) Program to count the total number of punctuation characters exists in a string Input: char str [] = "Good Morning! Mr. James Potter. Had your breakfast?" Output: If any character in the string is matched with ('!', "," ,"\'" ,";" ,"\"", ".", "-" ,"?"), increment the count by 1. Total number of punctuation characters exists in string: 4 2) Program to count the total number of vowels and consonants in a string Input: str = "This is a really simple sentence" Output: vowels = a, e, i, o, u consonants = b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z 3) Program to determine whether two strings are the anagram Input: Two Strings are called the anagram if they contain the same characters. However, the order or sequence of the characters can be different. str1 = "Grab"; str2 = "Brag"; Output: Both the strings are anagram. 4) Program to divide a string in 'N' equal parts Input: str = "aaaabbbbcccc" Output: Equal parts of given string are aaaa bbbb cccc 5) Program to find all the permutations of a string Input: char str[] = "ABC" Output: All the permutations of the string are: ABC ACB BAC BCA CBA CAB 6) Program to find all possible subsets of a string Input: str = "ABC" Output: All subsets for given string are: A AB ABC B BC C 7) Program to find the longest repeating sequence in a string Input: str = "acbdfghybdf" Output: Longest repeating sequence: bdf 8) Program to remove all the white spaces from a string Input: str1 = "Remove white spaces" Output: String after removing all the white spaces : Removewhitespaces 9) Program to replace lower-case characters with upper-case and vice versa Input: str1 = "Great Power" Output: String after case conversion : gREAT pOWER 10) Program to replace the spaces of a string with a specific character Input: char string[] = "Once in a blue moon" char ch = '-' Output: String after replacing spaces with given character: Once-in-a-blue-moon 11) Program to Count the Total Number of Characters in a String Input: string = "The best of both worlds" Output: Total number of characters in a string: 19 12) Program to Count the Total Number of Words in a String Input: sentence = "Beauty lies in the eyes of beholder" Output: Total number of words in the given string: 7 13) Program to Determine Whether a Given String is Palindrome Input: string = "Kayak" Output: Given string is palindrome. 14) Program to Determine Whether One String is a Rotation of Another Input: str1 = "abcde" str2 = "deabc" Output: Second string is a rotation of first string. 15) Program to Find Maximum and Minimum Occurring Character in a String Input: string = "grass is greener on the other side" Output: Minimum occurring character: a Maximum occurring character: e 16) Program to Find Reverse of a String Input: string = "Dream big" Output: Original string: Dream big Reverse of given string: gib maerD 17) Program to Find the Duplicate Characters in a String Input: string = "Great responsibility" Output: Duplicate characters in a given string: r e t s i 18) Program to Find the Duplicate Words in a String Input: string = "big black bug bit a big black dog on his big black nose" Output: Duplicate words in a given string: big black 19) Program to Find the Frequency of Characters Input: string = "picture perfect" Output: Characters and their corresponding frequencies p-2 i-1 c-2 t-2 u-1 r-2 e-3 f-1 20) Program to Find the Largest and Smallest Word in a String Input: string = "Hardships often prepare ordinary people for an extraordinary destiny" Output: Smallest word: an Largest word: extraordinary 21) Program to Find the Most Repeated Word in a Text File Input: file = open("data.txt", "r") data.txt file content: The term "computer" is derived from Latin word "computare" which means to calculate. Computer is a programmable electronic device. Computer accepts raw data as input and processes it with set of instructions to produce result as output. The history of computer begins with the birth of abacus which is believed to be the first computer. Output: Most repeated word: computer 22) Program to Find the Number of Words in the Given Text File Input: file = open("data.txt", "r") data.txt file content: The term "computer" is derived from Latin word "computare" which means to calculate. Computer is a programmable electronic device. Computer accepts raw data as input and processes it with set of instructions to produce result as output. The history of computer begins with the birth of abacus which is believed to be the first computer. Output: Number of words present in given file: 117 23) Program to Print Smallest and Biggest Possible Palindrome Word in a Given String Input: string = "Wow you own kayak" Output: Smallest palindromic word: wow Biggest palindromic word: kayak 24) Program to Separate the Individual Characters from a String Input: string = "characters" Output: Individual characters from given string: characters 25) Program to Swap two String Variables Without Using Third or Temp Variable Input: str1 = "Good"; str2 = "morning"; Output: Strings before swapping: Good morning Strings after swapping: morning Good Pattern Programs1) Program To Print Following Pattern 2) Program To Print Following Pattern 5432* 3) Program To Print Following Pattern *000*000* 4) Program To Print Following Pattern 1 5) Program To Print Following Pattern 6) Program To Print Following Pattern 7) Program To Print Following Pattern 12344321 8) Program To Print Following Pattern 9) Program To Print Following Pattern 0 10) Program to Print Following Pattern 11) Program to Print Following Pattern A 12) Program to Print Following Pattern 13) Program to Print Following Pattern 1 2 3 4 5 14) Program to Print Following Pattern 15) Program to Print Following Pattern 16) Program to Print Following Pattern 17) Program to Print Following Pattern 1 18) Program to Print Following Pattern 1 19) Program to Print Following Pattern Tree ProgramsInput: Output: OddLevelSum = 1 + 4 + 5 + 6 = 16 EvenLevelSum = 2 + 3 = 5 Difference = |16 - 5| = 11 2) Program to Construct a Binary Search Tree and Perform Deletion and Inorder Traversal Input: Output: Binary search tree after insertion: 10 30 50 60 70 90 Binary search tree after deleting node 90: 10 30 50 60 70 Binary search tree after deleting node 30: 10 50 60 70 Binary search tree after deleting node 50: 10 60 70 3) Program to Convert Binary Tree to Binary Search Tree Input: Output: Inorder representation of binary tree: 4 2 5 1 6 3 7 Inorder representation of resulting binary search tree: 1 2 3 4 5 6 7 4) Program to Determine Whether all Leaves are at Same Level Input: Output: All leaves are at same level 5) Program to Determine Whether two Trees are Identical Input: Output: Both the binary trees are identical 6) Program to Find Maximum Width of a Binary Tree Input: Output: Maximum width of the binary tree: 4 7) Program to Find the Largest Element in a Binary Tree Input: Output: Largest element in the binary tree: 74 8) Program to Find the Maximum Depth or Height of a Tree Input: Output: Maximum height of given binary tree: 5 9) Program to Find the Nodes Which are at the Maximum Distance in a Binary Tree Input: Output: Nodes which are at maximum distance: ( 4,9 ) ( 5,9 ) 10) Program to Find the Smallest Element in a Binary Tree Input: Output: Smallest element in the binary tree: 1 11) Program to Find the Sum of all the Nodes of a Binary Tree Input: Output: Sum of all nodes of binary tree: 31 12) Program to Find the Total Number of Possible Binary Search Trees with N Keys Input: Output: Total number of possible Binary Search Trees with given key: 42 13) Program to Implement Binary Tree using the Linked List Input: Output: Binary tree after insertion: 1 Binary tree after insertion: 2 1 3 Binary tree after insertion: 4 2 5 1 3 Binary tree after insertion: 4 2 5 1 6 3 7 14) Program to Search a Node in a Binary Tree Input: Search for node 5 in the binary tree Output: Element is present in the binary tree Singly Linked List Programs1) Singly Linked List Examples Input: Head Node = 100 Second Node = 200 Third Node = 300 Output: 100 200 300 2) Program to create and display a singly linked list Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); Output: Nodes of singly linked list: 1 2 3 4 3) Program to create a singly linked list of n nodes and count the number of nodes Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); Output: Nodes of singly linked list: 1 2 3 4 Count of nodes present in the list: 4 4) Program to create a singly linked list of n nodes and display it in reverse order Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); Output: Original List: 1 2 3 4 Reversed List: 4 3 2 1 5) Program to delete a new node from the beginning of the singly linked list Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); Output: Original List: 1 2 3 4 Updated List: 2 3 4 Updated List: 3 4 Updated List: 4 Updated List: List is empty 6) Program to delete a new node from the middle of the singly linked list Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); Output: Original List: 1 2 3 4 Updated List: 1 3 4 Updated List: 1 4 Updated List: 4 Updated List: List is empty 7) Program to delete a node from the end of the singly linked list Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); Output: Original List: 1 2 3 4 Updated List: 1 2 3 Updated List: 1 2 Updated List: 1 Updated List: List is empty 8) Program to determine whether a singly linked list is the palindrome Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(2); sList.addNode(1); Output: Nodes of the singly linked list: 1 2 3 2 1 Given singly linked list is a palindrome 9) Program to find the maximum and minimum value node from a singly linked list Input: #Add nodes to the list sList.addNode(5); sList.addNode(8); sList.addNode(1); sList.addNode(6); Output: Minimum value node in the list: 1 Maximum value node in the list: 8 10) Program to insert a new node at the middle of the singly linked list Input: #Adds data to the list sList.addNode(1); sList.addNode(2); #Inserting node '3' in the middle sList.addInMid(3); #Inserting node '4' in the middle sList.addInMid(4); Output: Original list: 1 2 Updated List: 1 3 2 Updated List: 1 3 4 2 11) Program to insert a new node at the beginning of the singly linked list Input: #Adding 1 to the list sList.addAtStart(1); #Adding 2 to the list sList.addAtStart(2); #Adding 3 to the list sList.addAtStart(3); #Adding 4 to the list sList.addAtStart(4); Output: Adding nodes to the start of the list: 1 Adding nodes to the start of the list: 2 1 Adding nodes to the start of the list: 3 2 1 Adding nodes to the start of the list: 4 3 2 1 12) Program to insert a new node at the end of the singly linked list Input: #Adding 1 to the list sList.addAtEnd(1); #Adding 2 to the list sList.addAtEnd(2); #Adding 3 to the list sList.addAtEnd(3); #Adding 4 to the list sList.addAtEnd(4); Output: Adding nodes to the end of the list: 1 Adding nodes to the end of the list: 1 2 Adding nodes to the end of the list: 1 2 3 Adding nodes to the end of the list: 1 2 3 4 13) Program to remove duplicate elements from a singly linked list Input: #Adds data to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(2); sList.addNode(2); sList.addNode(4); sList.addNode(1); Output: Originals list: 1 2 3 2 2 4 1 List after removing duplicates: 1 2 3 4 14) Program to search an element in a singly linked list Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); #Search for node 2 in the list sList.searchNode(2); #Search for the nodein the list sList.searchNode(7); Output: Element is present in the list at the position : 2 Element is not present in the list 15) Program to sort the elements of the singly linked list Input: #Adds data to the list sList.addNode(9); sList.addNode(7); sList.addNode(2); sList.addNode(5); sList.addNode(4); Output: Original list: 9 7 2 5 4 Sorted list: 2 4 5 7 9 16) Program to swap nodes in a singly linked list without swapping data Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); sList.addNode(5); #Swaps the node 2 with node 5 sList.swap(2,5); Output: Original list: 1 2 3 4 5 List after swapping nodes: 1 5 3 4 2 17) Program to swap the last element of the singly linked list from the first one Input: #Add nodes to the list sList.addNode(1); sList.addNode(2); sList.addNode(3); sList.addNode(4); Output: Originals list: 1 2 3 4 List after swapping the first node with last: 4 2 3 1 Circular Linked List Programs1) Program to Create a Circular Linked List of N Nodes and Count the Number of Nodes Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(4); cl.add(1); cl.add(2); cl.add(3); Output: Count of nodes present in circular linked list: 6 2) Program to Create a Circular Linked List of N Nodes and Display it in Reverse Order Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(3); cl.add(4); cl.add(5); cl.add(6); Output: Original List: 1 2 3 4 5 6 Reversed List: 6 5 4 3 2 1 3) Program to Create and Display a Circular Linked List Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(3); cl.add(4); Output: Nodes of the circular linked list: 1 2 3 4 4) Program to Delete a New Node From the Beginning of the Circular Linked List Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(3); cl.add(4); Output: Original List:1 2 3 4 Updated List:2 3 4 Updated List:3 4 Updated List:4 Updated List: List is empty 5) Program to Delete a New Node From the End of the Circular Linked List Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(3); cl.add(4); Output: Original List:1 2 3 4 Updated List:1 2 3 Updated List:1 2 Updated List:1 Updated List: List is empty 6) Program to Delete a New Node From the Middle of the Circular Linked List Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(3); cl.add(4); Output: Original List:1 2 3 4 Updated List:1 3 4 Updated List:1 4 Updated List:4 Updated List: List is empty 7) Program to Find the Maximum and Minimum Value Node From a Circular Linked List Input: #Adds data to the list cl.add(5); cl.add(20); cl.add(10); cl.add(1); Output: Minimum value node in the list: 1 Maximum value node in the list: 20 8) Program to Insert a New Node at the Beginning of the Circular Linked List Input: #Adding 1 to the list cl.addAtStart(1); #Adding 2 to the list cl.addAtStart(2); #Adding 3 to the list cl.addAtStart(3); #Adding 4 to the list cl.addAtStart(4); Output: Adding nodes to the start of the list: 1 Adding nodes to the start of the list: 2 1 Adding nodes to the start of the list: 3 2 1 Adding nodes to the start of the list: 4 3 2 1 9) Program to Insert a New Node at the End of the Circular Linked List Input: #Adding 1 to the list cl.addAtEnd(1); #Adding 2 to the list cl.addAtEnd(2); #Adding 3 to the list cl.addAtEnd(3); #Adding 4 to the list cl.addAtEnd(4); Output: Adding nodes to the end of the list: 1 Adding nodes to the end of the list: 1 2 Adding nodes to the end of the list: 1 2 3 Adding nodes to the end of the list: 1 2 3 4 10) Program to Insert a New Node at the Middle of the Circular Linked List Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(3); cl.add(4); #Inserting node '5' in the middle cl.addInMid(5); #Inserting node '6' in the middle cl.addInMid(6); Output: Original list: 1 2 3 4 Updated List: 1 2 5 3 4 Updated List: 1 2 5 6 3 4 11) Program to Remove Duplicate Elements From a Circular Linked List Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(3); cl.add(2); cl.add(2); cl.add(4); Output: Originals list:1 2 3 2 2 4 List after removing duplicates:1 2 3 4 12) Program to Search an Element in a Circular Linked List Input: #Adds data to the list cl.add(1); cl.add(2); cl.add(3); cl.add(4); #Search for node 2 in the list cl.search(2); #Search for node in the list cl.search(7); Output: Element is present in the list at the position : 2 Element is not present in the list 13) Program to Sort the Elements of the Circular Linked List Input: #Adds data to the list cl.add(70); cl.add(90); cl.add(20); cl.add(100); cl.add(50); Output: Original list:70 90 20 100 50 Sorted list:20 50 70 90 100 Doubly Linked List Programs1) Program to Convert a Given Binary Tree to Doubly Linked List Input: #Add nodes to the binary tree bt.root = Node(1); bt.root.left = Node(2); bt.root.right = Node(3); bt.root.left.left = Node(4); bt.root.left.right = Node(5); bt.root.right.left = Node(6); bt.root.right.right = Node(7); Output: Nodes of generated doubly linked list: 4 2 5 1 6 3 7 2) Program to Create a Doubly Linked List From a Ternary Tree Input: #Add nodes to the ternary tree tree.root = Node(5); tree.root.left = Node(10); tree.root.middle = Node(12); tree.root.right = Node(15); tree.root.left.left = Node(20); tree.root.left.middle = Node(40); tree.root.left.right = Node(50); tree.root.middle.left = Node(24); tree.root.middle.middle = Node(36); tree.root.middle.right = Node(48); tree.root.right.left = Node(30); tree.root.right.middle = Node(45); tree.root.right.right = Node(60); Output: Nodes of the generated doubly linked list: 5 10 20 40 50 12 24 36 48 15 30 45 60 3) Program to Create a Doubly Linked List of N Nodes and Count the Number of Nodes Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); dList.addNode(3); dList.addNode(4); dList.addNode(5); Output: Nodes of doubly linked list: 1 2 3 4 5 Count of nodes present in the list: 5 4) Program to Create a Doubly Linked List of N Nodes and Display it in Reverse Order Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); dList.addNode(3); dList.addNode(4); dList.addNode(5); Output: Original List: 1 2 3 4 5 Reversed List: 5 4 3 2 1 5) Program to Create and Display a Doubly Linked List Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); dList.addNode(3); dList.addNode(4); dList.addNode(5); Output: Nodes of doubly linked list: 1 2 3 4 5 6) Program to Delete a New Node From the Beginning of the Doubly Linked List Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); dList.addNode(3); dList.addNode(4); dList.addNode(5); Output: Original List: 1 2 3 4 5 Updated List: 2 3 4 5 Updated List: 3 4 5 Updated List: 4 5 Updated List: 5 Updated List: List is empty 7) Program to Delete a New Node From the End of the Doubly Linked List Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); dList.addNode(3); dList.addNode(4); dList.addNode(5); Output: Original List: 1 2 3 4 5 Updated List: 1 2 3 4 Updated List: 1 2 3 Updated List: 1 2 Updated List: 1 Updated List: List is empty 8) Program to Delete a New Node From the Middle of the Doubly Linked List Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); dList.addNode(3); dList.addNode(4); dList.addNode(5); Output: Original List: 1 2 3 4 5 Updated List: 1 2 4 5 Updated List: 1 4 5 Updated List: 1 5 Updated List: 5 Updated List: List is empty 9) Program to Find the Maximum and Minimum Value Node From a Doubly Linked List Input: #Add nodes to the list dList.addNode(5); dList.addNode(7); dList.addNode(9); dList.addNode(1); dList.addNode(2); Output: Minimum value node in the list: 1 Maximum value node in the list: 9 10) Program to Insert a New Node at the Beginning of the Doubly Linked List Input: #Adding 1 to the list dList.addAtStart(1); #Adding 2 to the list dList.addAtStart(2); #Adding 3 to the list dList.addAtStart(3); #Adding 4 to the list dList.addAtStart(4); #Adding 5 to the list dList.addAtStart(5); Output: Adding a node to the start of the list: 1 Adding a node to the start of the list: 2 1 Adding a node to the start of the list: 3 2 1 Adding a node to the start of the list: 4 3 2 1 Adding a node to the start of the list: 5 4 3 2 1 11) Program to Insert a New Node at the End of Doubly Linked List Input: #Adding 1 to the list dList.addAtEnd(1); #Adding 2 to the list dList.addAtEnd(2); #Adding 3 to the list dList.addAtEnd(3); #Adding 4 to the list dList.addAtEnd(4); #Adding 5 to the list dList.addAtEnd(5); Output: Adding a node to the end of the list: 1 Adding a node to the end of the list: 1 2 Adding a node to the end of the list: 1 2 3 Adding a node to the end of the list: 1 2 3 4 Adding a node to the end of the list: 1 2 3 4 5 12) Program to Insert a New Node at the Middle of Doubly Linked List Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); #Adding node '3' in the middle dList.addInMid(3); #Adding node '4' in the middle dList.addInMid(4); #Adding node '5' in the middle dList.addInMid(5); Output: Original list: 1 2 Updated List: 1 3 2 Updated List: 1 3 4 2 Updated List: 1 3 5 4 2 13) Program to Remove Duplicate Elements From a Doubly Linked List Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); dList.addNode(3); dList.addNode(2); dList.addNode(2); dList.addNode(4); dList.addNode(5); dList.addNode(3); Output: Originals list: 1 2 3 2 2 4 5 3 List after removing duplicates: 1 2 3 4 5 14) Program to Rotate Doubly Linked List by N Nodes Input: #Add nodes to the list dList.addNode(1); dList.addNode(2); dList.addNode(3); dList.addNode(4); dList.addNode(5); Output: Original List: 1 2 3 4 5 Updated List: 4 5 1 2 3 15) Program to Search an Element in a Doubly Linked List Input: #Add nodes to the list dList.addNode(1); dList.addNode(5); dList.addNode(4); dList.addNode(2); dList.addNode(3); Output: Node is present in the list at the position : 3 Node is not present in the list 16) Program to Sort the Elements of the Doubly Linked List Input: #Add nodes to the list dList.addNode(7); dList.addNode(1); dList.addNode(4); dList.addNode(5); dList.addNode(2); Output: Original list: 7 1 4 5 2 Sorted list: 1 2 4 5 7 |


We have already released two release candidates for React 15, and the final version is coming soon.
However Ian Christian Myers discovered a memory leak related to server rendering in React 0.14 and contributed a fix. While this memory leak has already been fixed in a different way in the React 15 release candidates, we decided to cut another 0.14 release that contains just this fix.
The release is now available for download:
We've also published version 0.14.8
of the react
, react-dom
, and addons
packages on npm and the react
package on bower.


Pending
Sample Header
25/06/1992
Lorem Ipsum Dolor Sit Amet
In Progress
Completed
Add a task
Drag Here to Delete


YouTube now follows system-level device theme on Android 10
by Abner LiWhen YouTube introduced a dark theme last year, it was ahead of most other Google services. However, as more apps were updated, the Android client stood out for not respecting the default appearance. YouTube for Android now follows the user-set device theme.
First spotted in testing last month, the “Dark theme” toggle under Settings > General has been replaced with an “Appearance” menu. If you previously had the night-friendly mode switched on, that look is retained. Gone is the copy noting how you can “Reduce glare & improve night viewing.”
Switching to “Use device theme” allows the app to automatically update its color scheme with the “Dark theme” toggle in Android 10 Quick Settings. It results in a uniform and consistent experience for users. The other two options let you set a theme independent of the system and other apps.
YouTube for Android following the device theme is widely available with version 14.46.52. That update rolled out to the Play Store earlier this week, but a server-side switch could also be involved as more and more users encountered it over the past month. With Android 10 nearly three months old, almost all first-party apps are not only offering a consistent look, but identical experience.
More about YouTube:
- YouTube starts widely rolling out its massive, auto-playing Masthead ad on TVs
- YouTube Premium and Music add prepaid plans for Indian subscribers
- YouTube for Android tests radical comments redesign
FTC: We use income earning auto affiliate links. More.


SceneJS
- ray picking performance demo
uses a fast technique that uses the depth buffer to find 3D ray-object intersections
learn more in
this tutorial
click on an object to ray-pick it


contact
Best way to reach PAIR PI is over email:
- About Georgia Tech<EMAIL_ADDRESS>- About UofT<EMAIL_ADDRESS>Affiliations
University of Toronto, Department of Computer Science.
University of Toronto, Mississauga, Mathematical & Computational Sciences.
University of Toronto, Mechanical & Industrial Engineering (courtesy).
Faculty Member, Vector Institute.
Steering Committee, Robotics Insitute.
Senior Research Scientist, Nvidia Research.
Mailing Address
- St. George Campus
- DCS, University of Toronto
D.L. Pratt Building, Office 283E
6 King’s College Road, Toronto, ON, M5S 3H5. - UTM
- Department of MCS,
University of Toronto, Mississauga
Deerfield Hall, Office 3068
3359 Mississauga Road, Mississauga, ON, L5L 1C6.


{%extends 'base.html'%} {{block.super}} {%block content%} {%include 'navbar.html'%}
by kelvin Rated at 9.0
{{project.sitename}}


City centre flats left without water for most of the weekend
One resident bought 64 litres of bottled water for the most vulnerable people in her block
by Emma GrimshawHomes in a block of city centre flats, homing elderly people and young families, were left without water for most of the weekend.
Residents on Deanary Road say they had their water cut off on Saturday, November 16 at 10am.
According to several people affected by the outage, their supply was only restored at 9pm the following day.
However, a spokesperson for the building's managing company Cabot House claims water was turned off temporarily on Saturday to allow engineers to carry out work, it was then switched back on for a four-hour period before a problem arose which caused water to be cut off again.
During this period a number of homes were without water to flush their toilets, cook with or even drink.
Lynn Wiltshire drove to ASDA and bought 64 litres of bottled water for the most vulnerable people in her block, including an woman in her 80s with mobility problems and families with kids aged under three.
The 51-year-old then forked out £35 for a hotel room because she couldn't stay in her home without a working toilet any longer.
"It's been awful," said Lynn.
"We have tried to contact the management company but no one replied. Bristol Water has checked their end three times but they said there's nothing wrong there.
"The worst thing is not being able to flush your toilet. I've also ran out of clean pots and pans.
"We have a lot of vulnerable people living here and there's also young families."
Cabot House sometimes contract work out to Masters to fix leaks.
Michael Gale, operational manager for Masters, said no one contacted him about the issue until Sunday evening.
He then quickly went to Deanary Road, where he discovered there was an issue with the building's pump system and fixed it.
A spokesperson for Cabot House said they have now given residents an emergency out-of-hours contact number should another problem arise.
The company sent emails and letters apologising for the inconvenience over the weekend.
For the latest news in and around Bristol, check back on Bristol Live's homepage.


const val DEFAULT_PAGE_NUM: Int
Pagination and Ordering
Provide simple ability to specify an offset within a result set and the number of results to return from that offset (eg. page size) together with (optional) sorting criteria at column level.
Note: it is the responsibility of the calling client to manage page windows.
For advanced pagination it is recommended you utilise standard JPA query frameworks such as Spring Data's JPARepository which extends the PagingAndSortingRepository interface to provide paging and sorting capability: https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/PagingAndSortingRepository.html


---
layout: post
title: "My Week in Review"
date: 2015-12-06 10:59:00 +0000
categories:
tags:
image: https://s3.amazonaws.com/audreywatters/2015-12-06-guitar.jpg
imagecredits: https://www.flickr.com/photos/cogdog/4270950372
---
Travel
- Nope (unless driving to Long Beach to see live music counts)
- Upcoming week: Nope
Hack Education
Writing Elsewhere
Speaking
Other Projects
- I was supposed to speak at a MIT class on Monday, but was sick with (I think) food poisoning.
- Therapy
- As this post makes clear, I’ve kicked off my “Top Ed-Tech Trends of 2015” series. I’ve written three (published two). I’m already exhausted.
- I got a new computer yesterday, and I spent way too long setting it up instead of working on my "Top Ed-Tech Trends" series.
Reading and Viewing and Listening
- I watched, with great joy, the Broncos beat the Patriots
- I watched The Wiz
- I’ve been watching Jessica Jones.
- Kin and I saw Suns of Jimi play.


|
|
|
|||||||||
The java.util.Map
interface represents a mapping between a key and a value.
The Map
interface is not a subtype of the Collection
interface.
Therefore it behaves a bit different from the rest of the collection types.
Here is a list of the topics covered in this text:
Since Map
is an interface you need to instantiate a concrete implementation
of the interface in order to use it. You can choose between the following Map
implementations in the Java Collections API:
In my experience, the most commonly used Map
implementations are
HashMap
and TreeMap
.
Each of these Map
implementations behaves a little differently with
respect to the order of the elements when iterating the Map
, and the
time (big O notation) it takes to insert and access elements in the maps.
HashMap
maps a key and a value. It does not guarantee any order of
the elements stored internally in the map.
TreeMap
also maps a key and a value. Furthermore it guarantees the
order in which keys or values are iterated - which is the sort order of the keys
or values. Check out the JavaDoc for more details.
Here are a few examples of how to create a Map
instance:
Map mapA = new HashMap(); Map mapB = new TreeMap();
To add elements to a Map
you call its put()
method.
Here are a few examples:
Map mapA = new HashMap(); mapA.put("key1", "element 1"); mapA.put("key2", "element 2"); mapA.put("key3", "element 3");
The three put()
calls maps a string value to a string key. You can then
obtain the value using the key. To do that you use the get()
method like
this:
String element1 = (String) mapA.get("key1");
You can iterate either the keys or the values of a Map
. Here is how
you do that:
// key iterator Iterator iterator = mapA.keySet().iterator(); // value iterator Iterator iterator = mapA.values();
Most often you iterate the keys of the Map
and then get the corresponding
values during the iteration. Here is how it looks:
Iterator iterator = mapA.keySet().iterator(); while(iterator.hasNext(){ Object key = iterator.next(); Object value = mapA.get(key); } //access via new for-loop for(Object key : mapA.keySet()) { Object value = mapA.get(key); }
You remove elements by calling the remove(Object key)
method. You thus remove the
(key, value) pair matching the key.
By default you can put any Object
into a Map
, but from Java 5, Java Generics
makes it possible to limit the types of object you can use for both keys and values in a
Map
. Here is an example:
Map<String, MyObject> map = new HashSet<String, MyObject>();
This Map
can now only accept String
objects for keys, and MyObject
instances
for values. You can then access and iterate keys and values without casting them. Here is how it looks:
for(MyObject anObject : map.values()){ //do someting to anObject... } for(String key : map.keySet()){ MyObject value = map.get(key); //do something to value }
For more information about Java Generics, see the Java Generics Tutorial.
There is more you can do with a Map
, but you will have to check out the JavaDoc
for more details. This text focused on the two most common operations: Adding / removing elements,
and iterating the keys and values.


{{ 'success.admiration' | translate }}
{{ 'success.message' | translate }}
Oh snap!
A connection timeout occured. Your browser could not retrieve data. Please check if your server is up and running.
The environment variable TWILIO_ACCOUNT_SID is not set or incorrect. If you are on Heroku please update your application settings.
The environment variable TWILIO_AUTH_TOKEN is not set or incorrect. If you are on Heroku please update your application settings.
The environment variable TWILIO_WORKSPACE_SID is not set or incorrect. If you are on Heroku please update your application settings.
The application could not access the Twilio API with the provided credentials. Please verify Account Sid and Auth Token.
The application could not access the your Twilio Taskrouter workspace please verify the Workspace Sid.
The TwiML Applications SID is not set, please complete http://<your_application>/setup first
The application could not access the TwiML Application.
The configured Twilio number was not found. Please run http://<your_application>/setup
The Twilio number Voice URL does not point to this server. Please run http://<your_application>/setup
Please check the server console.


eBusiness Information¶
Gatling is an open source project supported by eBusiness Information, an Excilys Group company.
Highsoft AS¶
Highsoft AS is the company behind Highcharts and Highstock, two astonishing JavaScript charting libraries.
Gatling’s reports would not be as nice as they are if it wasn’t for Highsoft libraries. They add incontestable value to these reports through their look and feel and their ability to display nicely thousands of points.


AMAZING PEOPLE ARE MAKING AMAZING DESIGNS IN A FUN ENVIRONMENT
When you work with us you are part of a team of committed collaborators. All aspects of our software development process are integrated, interactive
and agile.
Our approach unifies design, development and product management to create exceptional products.
We start each project by understanding
your business needs, the user's needs and the product requirements
then we help translate them into effective and elegant solutions.
Before we sign a contract or write a line of code our team will spend the necessary time needed to understand you product vision.
The outcome of this scooping session is proposal or high-level statement of work.
based on your requirements, we can provide a whole offering or just the pieces you need.
DESIGN
Our design practice offers a full range of services including brand strategy, interaction and visual design and user experience testing. Throughout your project, our designers create and implement visual design and workflows, solicit user feedback and work with you to make sure what gets built is what is needed.
DEVELOPMENT
All engineers are fluent in the latest enterprise, mobile and web development technologies. They collaborate with your team to write, and improve code on a daily basis, using proven practices such as test-driven development and pair programming.
PRODUCT MANAGEMENT
Planning and development is iterative. Because we are constantly coding and testing, the products we build are always ready to go live. This iterative process allows for changes as business requirements evolve.
Weather Information
Design Kenya Pyramids
Ontario Security
Design Kenya
Lets Chat
Mobile App buttons
Mock-up Kenya_burned logo
Giraffe restaurant
DELANI STUDIO
2019


Martín Rodríguez
# == Schema Information
#
# Table name: employees
#
# id :integer not null, primary key
# name :string
# age :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class Employee < ActiveRecord::Base
end
Keep track of the changes of some of our employee's attributes
Allows to Track changes in objects in the same way as Active Record does.
$: employee = Employee.create name: 'Jerome', age: 28
(0.2ms) begin transaction
SQL (0.8ms) INSERT INTO "employees" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "Jerome"], ["age", 28], ["created_at", "2016-04-07 01:22:06.802604"], ["updated_at", "2016-04-07 01:22:06.802604"]]
(2.5ms) commit transaction
=> #<Employee id: 1, name: "Jerome", age: 28, created_at: "2016-04-07 01:22:06", updated_at: "2016-04-07 01:22:06">
$: employee.changed?
=> false
$: employee.name = "Remington"
=> "Remington"
$: employee.changed?
=> true
$: employee.name_changed?
=> true
$: employee.name_changed? from: "Jerome", to: "Remington"
=> true
$: employee.name_was
=> "Jerome"
$: employee.name = "Abelino"
=> "Abelino"
$: employee.name_change
=> ["Jerome", "Abelino"]
$: employee.save
(0.1ms) begin transaction
SQL (0.3ms) UPDATE "employees" SET "name" = ?, "updated_at" = ? WHERE "employees"."id" = ? [["name", "Abelino"], ["updated_at", "2016-04-07 02:15:37.587128"], ["id", 3]]
(0.6ms) commit transaction
=> true
$: employee.changed?
=> false
$: employee.name_changed?
=> false
$: employee.previous_changes
=> {"name"=>["Jerome", "Abelino"], "updated_at"=>[Thu, 07 Apr 2016 02:15:25 UTC +00:00, Thu, 07 Apr 2016 02:15:37 UTC +00:00]}
$: employee.reload
Employee Load (0.2ms) SELECT "employees".* FROM "employees" WHERE "employees"."id" = ? LIMIT 1 [["id", 3]]
=> #<Employee id: 3, name: "Abelino", age: 28, created_at: "2016-04-07 02:15:25", updated_at: "2016-04-07 02:15:37">
$: employee.previous_changes
=> {}
$: employee
=> #<Employee id: 3, name: "Abelino", age: 28, created_at: "2016-04-07 02:15:25", updated_at: "2016-04-07 02:15:37">
$: employee.name = "Martin"
=> "Martin"
$: employee.age = 20
=> 20
$: employee.restore_attributes
=> ["name", "age"]
$: employee
=> #<Employee id: 3, name: "Abelino", age: 28, created_at: "2016-04-07 02:15:25", updated_at: "2016-04-07 02:15:37">
class Employee
include ActiveModel::Dirty
define_attribute_methods :name
def initialize(name)
@name = name
end
def name
@name
end
def name=(val)
name_will_change! unless val == @name
@name = val
end
def save
# do persistence work
changes_applied
end
def reload
# get the values from the persistence layer
clear_changes_information
end
end


Classes | |
| struct | boost::geometry::cartesian_distance< T > |
| Encapsulate the results of distance calculation. More... | |
| struct | boost::geometry::concept::PointDistanceStrategy< Strategy > |
| Checks strategy for point-segment-distance. More... | |
| struct | boost::geometry::distance_result< Geometry1, Geometry2 > |
| Shortcut to define return type of distance strategy. More... | |
| class | boost::geometry::strategy::distance::cross_track< Point, PointOfSegment > |
| Strategy functor for distance point to segment calculation. More... | |
| class | boost::geometry::strategy::distance::haversine< Point1, Point2 > |
| Distance calculation for spherical coordinates on a perfect sphere using haversine. More... | |
| struct | boost::geometry::strategy::distance::projected_point< Point, PointOfSegment, Strategy > |
| Strategy for distance point to segment. More... | |
| struct | boost::geometry::strategy::distance::pythagoras< Point1, Point2, CalculationType > |
| Strategy for distance point to point: pythagoras. More... | |
| struct | boost::geometry::strategy_distance< T1, T2, P1, P2 > |
| Traits class binding a distance strategy to a (possibly two) coordinate system(s). More... | |
| struct | boost::geometry::strategy_distance_segment< CsTag1, CsTag2, Point, Segment > |
| Traits class binding a distance-to-segment strategy to a (possibly two) coordinate system(s). More... | |
Functions | |
| template<typename T > | |
| bool | boost::geometry::close_to_zero (T const &value) |
| Utility function to check if a distance is very small. | |
| template<typename Geometry1 , typename Geometry2 > | |
| distance_result< Geometry1, Geometry2 >::type | boost::geometry::distance (Geometry1 const &geometry1, Geometry2 const &geometry2) |
| Calculate distance between two geometries. | |
| template<typename Geometry1 , typename Geometry2 , typename Strategy > | |
| Strategy::return_type | boost::geometry::distance (Geometry1 const &geometry1, Geometry2 const &geometry2, Strategy const &strategy) |
| Calculate distance between two geometries with a specified strategy. | |
| template<typename R , typename T > | |
| R | boost::geometry::make_distance_result (T const &value) |
| Object generator to create instance which can be compared. |
{ boost::geometry::point_xy<double> p1(1, 1); boost::geometry::point_xy<double> p2(2, 3); std::cout << "Distance p1-p2 is " << boost::geometry::distance(p1, p2) << " units" << std::endl; /* Extension, other coordinate system: // Read 2 Dutch cities from WKT texts (in decimal degrees) boost::geometry::point_ll<double, boost::geometry::cs::geographic<boost::geometry::degree> > a, r; boost::geometry::read_wkt("POINT(4.89222 52.3731)", a); boost::geometry::read_wkt("POINT(4.47917 51.9308)", r); std::cout << "Distance Amsterdam-Rotterdam is " << boost::geometry::distance(a, r) / 1000.0 << " kilometers " << std::endl; */ }
| Strategy::return_type boost::geometry::distance | ( | Geometry1 const & | geometry1, | |
| Geometry2 const & | geometry2, | |||
| Strategy const & | strategy | |||
| ) |
Calculate distance between two geometries with a specified strategy.
| Geometry1 | first geometry type | |
| Geometry2 | second geometry type | |
| S | point-point-distance strategy type |
| geometry1 | first geometry | |
| geometry2 | second geometry | |
| strategy | strategy to calculate distance between two points |
{ /* Extension, other coordinate system: typedef boost::geometry::point_ll<double, boost::geometry::cs::geographic<boost::geometry::degree> > LL; LL a, r; boost::geometry::read_wkt("POINT(4.89222 52.3731)", a); boost::geometry::read_wkt("POINT(4.47917 51.9308)", r); std::cout << "Distance Amsterdam-Rotterdam is " << boost::geometry::distance(a, r, boost::geometry::strategy::distance::vincenty<LL>() ) / 1000.0 << " kilometers " << std::endl; */ }
Definition at line 313 of file distance.hpp.
| distance_result<Geometry1, Geometry2>::type boost::geometry::distance | ( | Geometry1 const & | geometry1, | |
| Geometry2 const & | geometry2 | |||
| ) |
Calculate distance between two geometries.
The default strategy is used, belonging to the corresponding coordinate system of the geometries
Definition at line 359 of file distance.hpp.
| R boost::geometry::make_distance_result | ( | T const & | value | ) |
Object generator to create instance which can be compared.
If distance results have to be compared to a certain value it makes sense to use this function to generate a distance result of a certain value, and compare the distance result with this instance. SQRT calculations are then avoided
| R | distance result type | |
| T | arithmetic type, e.g. double |
| value | the distance to compare with |
Definition at line 303 of file distance_result.hpp.
| bool boost::geometry::close_to_zero | ( | T const & | value | ) |
Utility function to check if a distance is very small.
Depending on the "distance result" type it checks if it is smaller than epsilon, or (for Cartesian distances) if the square is smaller than epsilon
| R | the distance result type, either arithmetic or cartesian distance |
| value | the distance result to check |
Definition at line 318 of file distance_result.hpp.
|
December 1, 2009 |
Copyright © 1995-2009 Barend Gehrels, Geodan, Amsterdam Copyright © 2008-2009 Bruno Lalande, Paris Copyright © 2009 Mateusz Loskot, Cadcorp, London |


[viewBag] title = "About us" url = "/about/about-us" layout = "static-layout" is_hidden = 0 navigation_hidden = 0 ==
This is about us sub page


Order Now!
ABOUT US
MENU
ONLINE GIFTS
RESERVATIONS
CONTACT
OUR SWEET TREAT GIFTS
JOLLIE HOLLIE LOLLIE POPS
$
2/lbs
BUY NOW!
SUPER-DUPER SOUR KNOBS
$
5/lbs
BUY NOW!
COLOR-COATED CHOCO BITES
$
8/lbs
BUY NOW!


Hello, I'm Robson Silva Jr.
I'm a full-stack webDapp developer.
View my work
ABOUT
Quality
Scalable and sustanaible code
Availability
Bugs? Doubts? Scope not clear? I'm here!
Deliverable
Agile process, dailys, weekly milestones
Deadlines
Stick to it if it is your priority!
Who's this guy?
Entrepreuner, Fullstack developer, Blockchain passioned.
5+ years experience building technology.
Co-founded Ohmydai! the first Options Builder on Ethereum.
Current working with DeFi at Mainframe Check my CV!


What's New for F# in Xamarin?
Presented by Jeremy Abbott
Not The Figure Skater
Why F# and Xamarin?
- The same reasons you would use F# anywhere else
- Type Inference
- Concise Code
- Correct Code
- Type Providers
What are We Talking About?
- What's new in Xamarin for F#
- F# and Xamarin Forms
- iOS Auto Layout and F#
So. What is new in Xamarin for F# Users?
- Xamarin now supports F# 4.0
-
Multiplatform Templates
- Syntax highlighting and auto-complete in FSI
- Beta support for FAKE
- Xamarin.Forms support for F#
New Project Templates
Demo
FAKE
- Domain specific language for building projects
- F# Make
-
Need to have a bash build script and F# build script in your root directory
F# Enhancements in Xamarin Studio
- Global Symbol Search
-
Syntax Highlighting Improvements
- FAKE Integration (Preview)
Xamarin.Forms
Out of the Box support
F# and XAML
- You can use XAML to markup your pages without a type provider
- Checkout this video to see it in action.
iOS Auto Layout Constraints
- iOS Auto Layout is used to dynamically size UI elements
- Can be setup in storyboards or programmatically
-
Constraints are defined using linear equations:
- y = mx+b
- view1.attribute = m * view2.attribute + constant
The Auto Layout DSL
- Makes use of F# type extensions, custom operators, and record types
- Allows you to create type auto layout constraints semantically
The Auto Layout DSL
Demo
Questions?
Questions?


This tutorial focuses on the boto interface to AWS’ DynamoDB. This tutorial assumes that you have boto already downloaded and installed.
Warning
This tutorial covers the ORIGINAL release of DynamoDB. It has since been supplanted by a second major version & an updated API to talk to the new version. The documentation for the new version of DynamoDB (& boto’s support for it) is at DynamoDB v2.
The first step in accessing DynamoDB is to create a connection to the service. To do so, the most straight forward way is the following:
>>> import boto.dynamodb
>>> conn = boto.dynamodb.connect_to_region(
'us-west-2',
aws_access_key_id='<YOUR_AWS_KEY_ID>',
aws_secret_access_key='<YOUR_AWS_SECRET_KEY>')
>>> conn
<boto.dynamodb.layer2.Layer2 object at 0x3fb3090>
Bear in mind that if you have your credentials in boto config in your home directory, the two keyword arguments in the call above are not needed. More details on configuration can be found in Boto Config.
The boto.dynamodb.connect_to_region() function returns a boto.dynamodb.layer2.Layer2 instance, which is a high-level API for working with DynamoDB. Layer2 is a set of abstractions that sit atop the lower level boto.dynamodb.layer1.Layer1 API, which closely mirrors the Amazon DynamoDB API. For the purpose of this tutorial, we’ll just be covering Layer2.
Now that we have a DynamoDB connection object, we can then query for a list of existing tables in that region:
>>> conn.list_tables()
['test-table', 'another-table']
DynamoDB tables are created with the Layer2.create_table method. While DynamoDB’s items (a rough equivalent to a relational DB’s row) don’t have a fixed schema, you do need to create a schema for the table’s hash key element, and the optional range key element. This is explained in greater detail in DynamoDB’s Data Model documentation.
We’ll start by defining a schema that has a hash key and a range key that are both strings:
>>> message_table_schema = conn.create_schema(
hash_key_name='forum_name',
hash_key_proto_value=str,
range_key_name='subject',
range_key_proto_value=str
)
The next few things to determine are table name and read/write throughput. We’ll defer explaining throughput to the DynamoDB’s Provisioned Throughput docs.
We’re now ready to create the table:
>>> table = conn.create_table(
name='messages',
schema=message_table_schema,
read_units=10,
write_units=10
)
>>> table
Table(messages)
This returns a boto.dynamodb.table.Table instance, which provides simple ways to create (put), update, and delete items.
To retrieve an existing table, use Layer2.get_table:
>>> conn.list_tables()
['test-table', 'another-table', 'messages']
>>> table = conn.get_table('messages')
>>> table
Table(messages)
Layer2.get_table, like Layer2.create_table, returns a boto.dynamodb.table.Table instance.
Keep in mind that Layer2.get_table will make an API call to retrieve various attributes of the table including the creation time, the read and write capacity, and the table schema. If you already know the schema, you can save an API call and create a boto.dynamodb.table.Table object without making any calls to Amazon DynamoDB:
>>> table = conn.table_from_schema(
name='messages',
schema=message_table_schema)
If you do this, the following fields will have None values:
- create_time
- status
- read_units
- write_units
In addition, the item_count and size_bytes will be 0. If you create a table object directly from a schema object and decide later that you need to retrieve any of these additional attributes, you can use the Table.refresh method:
>>> from boto.dynamodb.schema import Schema
>>> table = conn.table_from_schema(
name='messages',
schema=Schema.create(hash_key=('forum_name', 'S'),
range_key=('subject', 'S')))
>>> print table.write_units
None
>>> # Now we decide we need to know the write_units:
>>> table.refresh()
>>> print table.write_units
10
The recommended best practice is to retrieve a table object once and use that object for the duration of your application. So, for example, instead of this:
class Application(object):
def __init__(self, layer2):
self._layer2 = layer2
def retrieve_item(self, table_name, key):
return self._layer2.get_table(table_name).get_item(key)
You can do something like this instead:
class Application(object):
def __init__(self, layer2):
self._layer2 = layer2
self._tables_by_name = {}
def retrieve_item(self, table_name, key):
table = self._tables_by_name.get(table_name)
if table is None:
table = self._layer2.get_table(table_name)
self._tables_by_name[table_name] = table
return table.get_item(key)
To get a complete description of a table, use Layer2.describe_table:
>>> conn.list_tables()
['test-table', 'another-table', 'messages']
>>> conn.describe_table('messages')
{
'Table': {
'CreationDateTime':<PHONE_NUMBER>.624,
'ItemCount': 0,
'KeySchema': {
'HashKeyElement': {
'AttributeName': 'forum_name',
'AttributeType': 'S'
},
'RangeKeyElement': {
'AttributeName': 'subject',
'AttributeType': 'S'
}
},
'ProvisionedThroughput': {
'ReadCapacityUnits': 10,
'WriteCapacityUnits': 10
},
'TableName': 'messages',
'TableSizeBytes': 0,
'TableStatus': 'ACTIVE'
}
}
Continuing on with our previously created messages table, adding an:
>>> table = conn.get_table('messages')
>>> item_data = {
'Body': 'http://url_to_lolcat.gif',
'SentBy': 'User A',
'ReceivedTime': '12/9/2011 11:36:03 PM',
}
>>> item = table.new_item(
# Our hash key is 'forum'
hash_key='LOLCat Forum',
# Our range key is 'subject'
range_key='Check this out!',
# This has the
attrs=item_data
)
The Table.new_item method creates a new boto.dynamodb.item.Item instance with your specified hash key, range key, and attributes already set. Item is a dict sub-class, meaning you can edit your data as such:
item['a_new_key'] = 'testing'
del item['a_new_key']
After you are happy with the contents of the item, use Item.put to commit it to DynamoDB:
>>> item.put()
Now, let’s check if it got added correctly. Since DynamoDB works under an ‘eventual consistency’ mode, we need to specify that we wish a consistent read, as follows:
>>> table = conn.get_table('messages')
>>> item = table.get_item(
# Your hash key was 'forum_name'
hash_key='LOLCat Forum',
# Your range key was 'subject'
range_key='Check this out!'
)
>>> item
{
# Note that this was your hash key attribute (forum_name)
'forum_name': 'LOLCat Forum',
# This is your range key attribute (subject)
'subject': 'Check this out!'
'Body': 'http://url_to_lolcat.gif',
'ReceivedTime': '12/9/2011 11:36:03 PM',
'SentBy': 'User A',
}
To update an item’s attributes, simply retrieve it, modify the value, then Item.put it again:
>>> table = conn.get_table('messages')
>>> item = table.get_item(
hash_key='LOLCat Forum',
range_key='Check this out!'
)
>>> item['SentBy'] = 'User B'
>>> item.put()
To avoid the loss of precision, you can stipulate that the decimal.Decimal type be used for numeric values:
>>> import decimal
>>> conn.use_decimals()
>>> table = conn.get_table('messages')
>>> item = table.new_item(
hash_key='LOLCat Forum',
range_key='Check this out!'
)
>>> item['decimal_type'] = decimal.Decimal('1.12345678912345')
>>> item.put()
>>> print table.get_item('LOLCat Forum', 'Check this out!')
{u'forum_name': 'LOLCat Forum', u'decimal_type': Decimal('1.12345678912345'),
u'subject': 'Check this out!'}
You can enable the usage of decimal.Decimal by using either the use_decimals method, or by passing in the Dynamizer class for the dynamizer param:
>>> from boto.dynamodb.types import Dynamizer
>>> conn = boto.dynamodb.connect_to_region(dynamizer=Dynamizer)
This mechanism can also be used if you want to customize the encoding/decoding process of DynamoDB types.
To delete items, use the Item.delete method:
>>> table = conn.get_table('messages')
>>> item = table.get_item(
hash_key='LOLCat Forum',
range_key='Check this out!'
)
>>> item.delete()
Warning
Deleting a table will also permanently delete all of its contents without prompt. Use carefully.
There are two easy ways to delete a table. Through your top-level Layer2 object:
>>> conn.delete_table(table)
Or by getting the table, then using Table.delete:
>>> table = conn.get_table('messages')
>>> table.delete()


|
KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
|
MPI utilities for searching geometrical objects. More...
#include <search_utilities.h>
Public Types | |
Type Definitions | |
| using | BoundingBoxType = std::array< double, 6 > |
| The Bounding Box type. More... | |
| using | IndexType = std::size_t |
| The index type definition. More... | |
| using | SizeType = std::size_t |
| The size type definition. More... | |
Static Public Member Functions | |
Operations | |
| static bool | PointIsInsideBoundingBox (const BoundingBox< Point > &rBoundingBox, const array_1d< double, 3 > &rCoords) |
| Check if a point is inside a bounding box. More... | |
| static bool | PointIsInsideBoundingBox (const BoundingBoxType &rBoundingBox, const array_1d< double, 3 > &rCoords) |
| Check if a point is inside a bounding box. More... | |
| static bool | PointIsInsideBoundingBox (const BoundingBox< Point > &rBoundingBox, const array_1d< double, 3 > &rCoords, const double Tolerance) |
| This method checks if a point is inside a bounding box considering a certain tolerance. More... | |
| static void | ComputeBoundingBoxesWithTolerance (const std::vector< double > &rBoundingBoxes, const double Tolerance, std::vector< double > &rBoundingBoxesWithTolerance) |
| Compute the bounding boxes of the given bounding boxes from a given tolerance. More... | |
| static void | ComputeBoundingBoxesWithToleranceCheckingNullBB (const std::vector< double > &rBoundingBoxes, const double Tolerance, std::vector< double > &rBoundingBoxesWithTolerance) |
| Compute the bounding boxes of the given bounding boxes from a given tolerance, additionally checking if the bounding boxes are initialized. More... | |
MPI utilities for searching geometrical objects.
Original implementation from MappingUtilities
| using Kratos::SearchUtilities::BoundingBoxType = std::array<double, 6> |
The Bounding Box type.
| using Kratos::SearchUtilities::IndexType = std::size_t |
The index type definition.
| using Kratos::SearchUtilities::SizeType = std::size_t |
The size type definition.
|
static |
Compute the bounding boxes of the given bounding boxes from a given tolerance.
| rBoundingBoxes | The bounding boxes |
| Tolerance | The tolerance |
| rBoundingBoxesWithTolerance | The resulting bounding boxes with the applied tolerance |
|
static |
Compute the bounding boxes of the given bounding boxes from a given tolerance, additionally checking if the bounding boxes are initialized.
This method is used when the bounding boxes are not initialized
| rBoundingBoxes | The bounding boxes |
| Tolerance | The tolerance |
| rBoundingBoxesWithTolerance | The resulting bounding boxes with the applied tolerance |
|
static |
Check if a point is inside a bounding box.
Bounding box class implementation
| rBoundingBox | The bounding box |
| rCoords | The point |
|
static |
This method checks if a point is inside a bounding box considering a certain tolerance.
| rBoundingBox | The bounding box |
| rCoords | The coordinates of the point |
| Tolerance | The tolerance |
|
inlinestatic |
Check if a point is inside a bounding box.
Bounding box array of 6 doubles implementation
| rBoundingBox | The bounding box |
| rCoords | The point |


This app lets you connect to any RSS feed you would like.
Enter your your RSS URL
You are now connected to . Disconnect account
Please insert number of feed entries you would like to be displayed
Set the widget colors