Tutorial by Examples: l

From your project directory, run the go build command and specify the operating system and architecture target with the GOOS and GOARCH environment variables: Compiling for Mac (64-bit): GOOS=darwin GOARCH=amd64 go build Compiling for Windows x86 processor: GOOS=windows GOARCH=386 go build ...
A while loop executes statements repeatedly until the given condition evaluates to false. This control statement is used when it is not known, in advance, how many times a block of code is to be executed. For example, to print all the numbers from 0 up to 9, the following code can be used: int i =...
This type of Singleton is thread safe, and prevents unnecessary locking after the Singleton instance has been created. Java SE 5 public class MySingleton { // instance of class private static volatile MySingleton instance = null; // Private constructor private MySingleton()...
A namespace declaration can look as follows: namespace MyProject; - Declare the namespace MyProject namespace MyProject\Security\Cryptography; - Declare a nested namespace namespace MyProject { ... } - Declare a namespace with enclosing brackets. It is recommended to only declare a single na...
As shown in Declaring Namespaces, we can define a class in a namespace as follows: namespace MyProject\Shapes; class Rectangle { ... } To reference this class the full path (including the namespace) needs to be used: $rectangle = new MyProject\Shapes\Rectangle(); This can be shortened by ...
You can split a String on a particular delimiting character or a Regular Expression, you can use the String.split() method that has the following signature: public String[] split(String regex) Note that delimiting character or regular expression gets removed from the resulting String Array. Exa...
Using the Reflection API, it is possible to change or get the value of a field at runtime. For example, you could use it in an API to retrieve different fields based on a factor, like the OS. You can also remove modifiers like final to allow modifing fields that are final. To do so, you will need t...
Install .NET Core on macOS 10.11+, after install homebrew: brew update brew install openssl mkdir -p /usr/local/lib ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/ Install .NET Core SDK from https://go...
When defining discriminated unions you can name elements of tuple types and use these names during pattern matching. type Shape = | Circle of diameter:int | Rectangle of width:int * height:int let shapeIsTenWide = function | Circle(diameter=10) | Rectangle(width=10) -> t...
To use Vagrant on Windows platform you need to install virtualization software and an ssh command-line tool first. This example will use freeware VirtualBox and Cygwin. Install VirtualBox Download the latest VirtualBox version from the official download page and run the downloaded file. Note that ...
Clicking the Select an element in the page to inspect it button in the upper left corner of the Elements tab in Chrome or Inspector tab in Firefox, available from Developer Tools, and then clicking on a element of the page highlights the element and assigns it to the $0 variable. Elements inspecto...
5 <input type="datetime-local" /> Dependent on browser support, a date and time picker will pop up on screen for you to choose a date and time.
PrimeFaces can be used in all web applications based on Java Server Faces (version 2.x) which are run on Servlet Containers (e.g. Wildlfy or Tomcat or GlassFish). There are several ways you can add PrimeFaces to your application. Manually Download the primefaces-{version}.jar and add it to you cl...
A class can be defined using classdef in an .m file with the same name as the class. The file can contain the classdef...end block and local functions for use within class methods. The most general MATLAB class definition has the following structure: classdef (ClassAttribute = expression, ...) Cla...
Classes in MATLAB are divided into two major categories: value classes and handle classes. The major difference is that when copying an instance of a value class, the underlying data is copied to the new instance, while for handle classes the new instance points to the original data and changing val...
Setup for Yii 1.1 Step 1 - downloading Yii Download the Yii framework bundle from the Yii website Inside the downloaded bundle there are 3 folders, namely: demos framework requirements demos, as the name suggests contains a number of demo Yii applications. framework contains the Yii framew...
Use a subquery to filter the result set. For example this will return all employees with a salary equal to the highest paid employee. SELECT * FROM Employees WHERE Salary = (SELECT MAX(Salary) FROM Employees)
A subquery in a FROM clause acts similarly to a temporary table that is generated during the execution of a query and lost afterwards. SELECT Managers.Id, Employees.Salary FROM ( SELECT Id FROM Employees WHERE ManagerId IS NULL ) AS Managers JOIN Employees ON Managers.Id = Employees.Id ...
SELECT Id, FName, LName, (SELECT COUNT(*) FROM Cars WHERE Cars.CustomerId = Customers.Id) AS NumberOfCars FROM Customers
Macros allow us to abstract syntactical patterns that are repeated many times. For instance: /// Computes `a + b * c`. If any of the operation overflows, returns `None`. fn checked_fma(a: u64, b: u64, c: u64) -> Option<u64> { let product = match b.checked_mul(c) { Some(p) =&...

Page 80 of 861