Tutorial by Examples: f

Given a pair of points A and B in a vector space of arbitrary dimension, one can describe the line between them as X = A + t*(B - A) = (1 - t)*A + t*B so in 2d this would be x = Ax + t*(Bx - Ax) = (1 - t)*Ax + t*Bx y = Ay + t*(By - Ay) = (1 - t)*Ay + t*By As t assumes any real value, this w...
A line in the plane can be described as a*x + b*y + c = 0 This uses a three-element parameter vector [a, b, c] to describe the line. Sometimes the constant term c is moved to the right hand side of the equation instead. The representation is not unique, since the length of that vector is arbitra...
Sometimes it is required to implement Enum on your own. E.g. there is no clear way to extend other enums. Custom implementation allows this: class Enum { constructor(protected value: string) {} public toString() { return String(this.value); } public is(value: Enum | string) { ...
Simple form, validation and submission functions to create a "mailing list" feature. This can then be applied to either the basic page or basic block examples. Assumes you have created a table in the drupal database called 'mailing_list' with the fields first name, last name and email ad...
As most of the information contained within Google drive is private user data. You must have an access token in order to access the information. Access tokens can be retrieved via the Oauth2 authentication process. GET https://www.googleapis.com/drive/v2/files?access_token={Valid Access Token} ...
Simple form, validation and submission functions to create a "mailing list" feature. This can then be applied to either the basic page or basic block examples. Assumes you have created a table in the drupal database called 'mailing_list' with the fields first name, last name and email ad...
Can be used in conjunction with the custom form example to create a table in the drupal database for a Mailing List feature. This example was made by creating the table directly in my development database, then created the data for hook_schema() using the Schema module. This allows for automatic t...
Whenever you FIND a record you can aquire a lock of it. NO-LOCK: Used for read only operations. If you do a FIND <record> NO-LOCK you cannot in any way modify the record. FIND FIRST Customer NO-LOCK NO-ERROR. EXCLUSIVE-LOCK: Used for updates and deletes. If you do this you will "own&...
This is the definition of a TEMP-TABLE named ttTempTable with three fields. NO-UNDO indicates that no undo handling is needed (this is usually what you want to do unless you really need the opposite). DEFINE TEMP-TABLE ttTempTable NO-UNDO FIELD field1 AS INTEGER FIELD field2 AS CHARACTER ...
This is probably the most famous example of a sort optimization making use of Perl's functional programming facilities, to be used where the sort order of items depend on an expensive function. # What you would usually do @sorted = sort { slow($a) <=> slow($b) } @list; # What you do to ma...
To run a flink program from your IDE(we can use either Eclipse or Intellij IDEA(preffered)), you need two dependencies:flink-java / flink-scala and flink-clients (as of february 2016). These JARS can be added using Maven and SBT(if you are using scala). Maven <dependency> <group...
Given the CSV file peoples.csv: 1,Reed,United States,Female 2,Bradley,United States,Female 3,Adams,United States,Male 4,Lane,United States,Male 5,Marshall,United States,Female 6,Garza,United States,Male 7,Gutierrez,United States,Male 8,Fox,Germany,Female 9,Medina,United States,Male 10,Nich...
Unlike other languages, Python doesn't have a do-until or a do-while construct (this will allow code to be executed once before the condition is tested). However, you can combine a while True with a break to achieve the same purpose. a = 10 while True: a = a-1 print(a) if a<7: ...
Reading in a single step: IFS=$'\n' read -r -a arr < file Reading in a loop: arr=() while IFS= read -r line; do arr+=("$line") done 4.0 Using mapfile or readarray (which are synonymous): mapfile -t arr < file readarray -t arr < file
Create a build job (according to your requirement). For this example I have created a freestyle job (AutoPush) to perform ANT build. We are going to create two variables, PUSH (Choice Parameter) and TAG_NUMBER (String Parameter). We can choose the value YES or NO for PUSH, this will decide whether...
Java technology is both a programming language and a platform. The Java programming language is a high-level object-oriented language that has a particular syntax and style. A Java platform is a particular environment in which Java programming language applications run. There are several Java platf...
The 0.9 release of Kafka introduced a complete redesign of the kafka consumer. If you are interested in the old SimpleConsumer (0.8.X), have a look at this page. If your Kafka installation is newer than 0.8.X, the following codes should work out of the box. Configuration and initialization Kaf...
The user can call Incrementor.Increment K number of times by pressing a key within '0' .. '9' and it's possible to call Incrementor.Increment faster than the task Incrementor can increment I. with Ada.Text_IO; with Ada.Integer_Text_IO; procedure Main is use Ada.Text_IO; task Incrementor...
Configuration and initialization First, create a maven project and add the following dependency in your pom: <dependencies> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> <version&...
By changing mappoint x and y values as you need you can change offset possition of google map,by default it will be in the center of the map view. Call below method where you want to change it! Better to use it inside your onLocationChanged like changeOffsetCenter(location.getLatitude(),location.ge...

Page 384 of 457