Tutorial by Examples: is

Bool is a Boolean type with two possible values: true and false. let aTrueBool = true let aFalseBool = false Bools are used in control-flow statements as conditions. The if statement uses a Boolean condition to determine which block of code to run: func test(_ someBoolean: Bool) { if som...
MATLAB supports (and encourages) vectorized operations on vectors and matrices. For example, suppose we have A and B, two n-by-m matrices and we want C to be the element-wise product of the corresponding elements (i.e., C(i,j) = A(i,j)*B(i,j)). The un-vectorized way, using nested loops is as follo...
The ~ operator will flip all of the bits in the number. Since computers use signed number representations — most notably, the two's complement notation to encode negative binary numbers where negative numbers are written with a leading one (1) instead of a leading zero (0). This means that if you w...
The function strtok breaks a string into a smaller strings, or tokens, using a set of delimiters. #include <stdio.h> #include <string.h> int main(void) { int toknum = 0; char src[] = "Hello,, world!"; const char delimiters[] = ", !"; char *to...
C11 Reading an object will cause undefined behavior, if the object is1: uninitialized defined with automatic storage duration it's address is never taken The variable a in the below example satisfies all those conditions: void Function( void ) { int a; int b = a; } 1 (Quo...
toList flattens a Foldable structure t a into a list of as. ghci> toList [7, 2, 9] -- t ~ [] [7, 2, 9] ghci> toList (Right 'a') -- t ~ Either e "a" ghci> toList (Left "foo") -- t ~ Either String [] ghci> toList (3, True) -- t ~ (,) Int [True] toList is ...
List Comprehensions can use nested for loops. You can code any number of nested for loops within a list comprehension, and each for loop may have an optional associated if test. When doing so, the order of the for constructs is the same order as when writing a series of nested for statements. The ge...
docker ps --format 'table {{.ID}}\t{{.Names}}\t{{.Status}}'
git bisect allows you to find which commit introduced a bug using a binary search. Start by bisecting a session by providing two commit references: a good commit before the bug, and a bad commit after the bug. Generally, the bad commit is HEAD. # start the git bisect session $ git bisect start ...
A table can be replicated as follows: CREATE TABLE ClonedPersons LIKE Persons; The new table will have exactly the same structure as the original table, including indexes and column attributes. As well as manually creating a table, it is also possible to create table by selecting data from anot...
When a method need to accept an "extensible" set of enum values, the programmer can apply polymorphism like on a normal class by creating an interface which will be used anywere where the enums shall be used: public interface ExtensibleEnum { String name(); } This way, any enum t...
Method 1: Below query will be applicable for SQL Server 2000+ version (Contains 12 columns) SELECT * FROM dbo.sysdatabases Method 2: Below query extract information about databases with more informations (ex: State, Isolation, recovery model etc.) Note: This is a catalog view and will be availa...
The standard division symbol (/) operates differently in Python 3 and Python 2 when applied to integers. When dividing an integer by another integer in Python 3, the division operation x / y represents a true division (uses __truediv__ method) and produces a floating point result. Meanwhile, the ...
Step 1: Open a Workbook Step 2 Option A: Press Alt + F11 This is the standard shortcut to open the VBE. Step 2 Option B: Developer Tab --> View Code First, the Developer Tab must be added to the ribbon. Go to File -> Options -> Customize Ribbon, then check the box for developer. ...
In Python 2, reduce is available either as a built-in function or from the functools package (version 2.6 onwards), whereas in Python 3 reduce is available only from functools. However the syntax for reduce in both Python2 and Python3 is the same and is reduce(function_to_reduce, list_to_reduce). A...
With any variadic function, the function must know how to interpret the variable arguments list. With the printf() or scanf() functions, the format string tells the function what to expect. The simplest technique is to pass an explicit count of the other arguments (which are normally all the same ...
The static (compile-time) type is used rather than the dynamic (run-time type) to match parameters. public class Base { public virtual string GetName() { return "Base"; } } public class Derived : Base { public override string GetName() { ...
It is possible to treat a GoogleMap as an Android view if we make use of the provided MapView class. Its usage is very similar to MapFragment. In your layout use MapView as follows: <com.google.android.gms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" ...
This is the Python 2 syntax, note the commas , on the raise and except lines: Python 2.x2.3 try: raise IOError, "input/output error" except IOError, exc: print exc In Python 3, the , syntax is dropped and replaced by parenthesis and the as keyword: try: raise IOErro...
Lists can be created in multiple ways. The recommended way is to use a List literal: var vegetables = ['broccoli', 'cabbage']; The List constructor can be used as well: var fruits = new List(); If you prefer stronger typing, you can also supply a type parameter in one of the following ways:...

Page 9 of 109