Tutorial by Examples

Sets also have a copymethod. You can use this method to perform a shallow copy. >>> s1 = {()} >>> s2 = s1.copy() >>> s1 is s2 False >>> s2.add(3) >>> s1 {[]} >>> s2 {3,[]}
In functional programming languages like F# null values are considered potentially harmful and poor style (non-idiomatic). Consider this C# code: string x = SomeFunction (); int l = x.Length; x.Length will throw if x is null let's add protection: string x = SomeFunction (); int l = x ...
Error handling is important but can make an elegant algorithm into a mess. Railway Oriented Programming (ROP) is used to make error handling elegant and composable. Consider the simple function f: let tryParse s = let b, v = System.Int32.TryParse s if b then Some v else None let f (g : ...
MATCH (n) WHERE n.some_attribute = "some identifier" SET n.other_attribute = "a new value"
Box Collider A primitive Collider shaped like a cuboid. Properties Is Trigger - If ticked, the Box Collider will ignore physics and become a Trigger Collider Material - A reference, if specified, to the physics material of the Box Collider Center - The Box Collider's central posit...
I create a file called database-servlet.xml somewhere on the classpath. Initially your config file will look like this: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/...
One of the great things about Linq is that it is so easy to extend. You just need to create an extension method whose argument is IEnumerable<T>. public namespace MyNamespace { public static class LinqExtensions { public static IEnumerable<List<T>> Batch<T&...
To print a user-readable error message to stderr, call perror from <stdio.h>. int main(int argc, char *argv[]) { FILE *fout; if ((fout = fopen(argv[1], "w")) == NULL) { perror("fopen: Could not open file for writing"); return EXIT_FAILURE; } r...
Active Patterns can be used to make calling some .NET API's feel more natural, particularly those that use an output parameter to return more than just the function return value. For example, you'd normally call the System.Int32.TryParse method as follows: let couldParse, parsedInt = System.Int32....
The @each directive allows you to iterate through any list or map. It takes the form of @each $var or <list or map> {} where $var can be any variable name and <list or map> can be anything that returns a list or map. In the following example, the loop will iterate through the $authors l...
One of the easiest examples of using shared services is when we want to store some data from a given page of our application, and then get that data again but from another page. One option could be to send that data as a parameter (for instance, if one page calls the other one) but if we want to us...
The following sqoop command will be used to import the data from RDBMS table into HBase table, if the table does not exists in HBase it will create a new table and import the data into this table sqoop import \ --query 'select emp_id, emp_name, emp_sal from employee where $CONDITIONS' \ ...
UITextView has extra paddings by default. Sometimes it's annoying especially if you want to measure some text without view instance and place them at some area precisely. Do this to remove such paddings. messageTextView.textContainerInset = UIEdgeInsetsZero messageTextView.textContainer.lineFragm...

For

For-loops iterate over an iterating collection. An iterating collection is any class which structurally unifies with Iterator<T> or Iterable<T> types from the Haxe standard library. A for-loop which logs numbers in range 0 to 10 (exclusive) can be written as follows: for (i in 0...10) ...
While-loops execute a body expression as long as the loop condition evaluates to true. A while-loop which logs numbers in range 9 to 0 (inclusive) can be written as follows: var i = 10; while (i-- > 0) { trace(i); } Try the example on try.haxe.org. References "While", Ha...
Do-while-loops execute a body expression at least once, and then keep executing it as long as the loop condition evaluates to true. A do-while-loop which logs numbers in range 10 to 0 (inclusive) can be written as follows: var i = 10; do { trace(i); } while (i-- > 0); Try the example ...
The flow or execution of a loop can be controlled by use of break and continue expressions. Break break exits the current loop. In case the loop is nested inside another loop, the parent loop is unaffected. for (i in 0...10) { for (j in 0...10) { if (j == 5) break; trace(i,...
Before starting you must have: Anaconda installed on your system Account on Binstar If you are not using Anaconda 1.6+ install the binstar command line client: $ conda install binstar $ conda update binstar If you are not using Anaconda the Binstar is also available on pypi: $ pip install bin...
Pre -Requsite: Download Visual Studio IDE Create a new project Install specflow visual studio integration, Nunit Adapter & Nunit framework Download specflow for visual studio as shown below
Anonymous class listener Before Java 8, it’s very common that an anonymous class is used to handle click event of a JButton, as shown in the following code. This example shows how to implement an anonymous listener within the scope of btn.addActionListener. JButton btn = new JButton("My Butto...

Page 594 of 1336