Tutorial by Examples

context.bezierCurveTo(control1X, control1Y, control2X, control2Y, endingX, endingY) Draws a cubic Bezier curve starting at the current pen location to a given ending coordinate. Another 2 given control coordinates determine the shape (curviness) of the curve. <!doctype html> <html&gt...
context.arcTo(pointX1, pointY1, pointX2, pointY2, radius); Draws a circular arc with a given radius. The arc is drawn clockwise inside the wedge formed by the current pen location and given two points: Point1 & Point2. A line connecting the current pen location and the start of the arc is au...
context.rect(leftX, topY, width, height) Draws a rectangle given a top-left corner and a width & height. <!doctype html> <html> <head> <style> body{ background-color:white; } #canvas{border:1px solid red; } </style> <script> window.onload...
context.closePath() Draws a line from the current pen location back to the beginning path coordinate. For example, if you draw 2 lines forming 2 legs of a triangle, closePath will "close" the triangle by drawing the third leg of the triangle from the 2nd leg's endpoint back to the firs...
context.beginPath() Begins assembling a new set of path commands and also discards any previously assembled path. It also moves the drawing "pen" to the top-left origin of the canvas (==coordinate[0,0]). Although optional, you should ALWAYS start a path with beginPath The discarding ...
package { import flash.events.NetStatusEvent; import flash.net.NetStream; import flash.net.NetConnection; import flash.events.Event; import flash.media.Video; import flash.display.Sprite; public class VideoWithNetStatus extends Sprite { private var video:V...
It's possible to perform elementary set operations with Matlab. Let's assume we have given two vectors or arrays A = randi([0 10],1,5); B = randi([-1 9], 1,5); and we want to find all elements which are in A and in B. For this we can use C = intersect(A,B); C will include all numbers which ...
Linux Requirements (r0.16.0) Mandatory As per current Apache-Pig documentation it supports only Unix & Windows operating systems. Hadoop 0.23.X, 1.X or 2.X Java 1.6 or Later versions installed and JAVA_HOME environment variable set to Java installation directory Optional Python 2.7 ...
import scala.concurrent.Future import scala.concurrent.ExecutionContext.Implicits.global object FutureDivider { def divide(a: Int, b: Int): Future[Int] = Future { // Note that this is integer division. a / b } } Quite simply, the divide method creates a Future tha...
The easiest way to consume a successful Future-- or rather, get the value inside the Future-- is to use the map method. Suppose some code calls the divide method of the FutureDivider object from the "Creating a Future" example. What would the code need to look like to get the quotient of...
Sometimes the computation in a Future can create an exception, which will cause the Future to fail. In the "Creating a Future" example, what if the calling code passed 55 and 0 to the divide method? It'd throw an ArithmeticException after trying to divide by zero, of course. How would t...
The previous examples demonstrated the individual features of a Future, handling success and failure cases. Usually, however, both features are handled much more tersely. Here's the example, written in a neater and more realistic way: object Calculator { def calculateAndReport(a: Int, b: Int...
To convert exceptions into Either or Option types, you can use methods that provided in scala.util.control.Exception import scala.util.control.Exception._ val plain = "71a" val optionInt: Option[Int] = catching(classOf[java.lang.NumberFormatException]) opt { plain.toInt } val eitherI...
A very interesting type of JOIN is the LATERAL JOIN (new in PostgreSQL 9.3+), which is also known as CROSS APPLY/OUTER APPLY in SQL-Server & Oracle. The basic idea is that a table-valued function (or inline subquery) gets applied for every row you join. This makes it possible to, for example...
One type of JOIN that is less known, is the FULL JOIN. (Note: FULL JOIN is not supported by MySQL as per 2016) A FULL OUTER JOIN returns all rows from the left table, and all rows from the right table. If there are rows in the left table that do not have matches in the right table, or if there a...
Recursive joins are often used to obtain parent-child data. In SQL, they are implemented with recursive common table expressions, for example: WITH RECURSIVE MyDescendants AS ( SELECT Name FROM People WHERE Name = 'John Doe' UNION ALL SELECT People.Name FROM Peopl...
If you implement a text-search as LIKE-query, you usually do it like this: SELECT * FROM T_Whatever WHERE SomeField LIKE CONCAT('%', @in_SearchText, '%') However, (apart from the fact that you shouldn't necessarely use LIKE when you can use fulltext-search) this creates a problem when someb...
Over the course of time B-Tree indexes may become fragmented because of updating/deleting/inserting data. In SQLServer terminology we can have internal (index page which is half empty ) and external (logical page order doesn't correspond physical order). Rebuilding index is very similar to dropping...
Arrays are regular JVM arrays with a twist that they are treated as invariant and have special constructors and implicit conversions. Construct them without the new keyword. val a = Array("element") Now a has type Array[String]. val acs: Array[CharSequence] = a //Error: type misma...
You can override the default vmoptions with your own personal settings by choosing Help > Edit Custom VM Options from the Android Studio toolbar. This will create a local copy which you are free to edit. Alternatively, you can edit the default vmoptions directly using the paths given below. Note...

Page 426 of 1336