Tutorial by Examples

The following code can be entered in a Tcl shell (tclsh), or into a script file and run through a Tcl shell: puts "Hello, world!" It gives the string argument Hello, world! to the command puts. The puts command writes its argument to standard out (your terminal in interactive mode) an...
The function angular.merge takes all the enumerable properties from the source object to deeply extend the destination object. The function returns a reference to the now extended destination object angular.merge(destination, source) Examples angular.merge({}, {}) // {} angular.merge({name...
The function angular.isDefined tests a value if it is defined angular.isDefined(someValue) This is the equivalent of performing value !== undefined; // will evaluate to true is value is defined Examples angular.isDefined(42) // true angular.isDefined([1, 2]) // true angular.isDefined(un...
The angular.isDate function returns true if and only if the object passed to it is of the type Date. angular.isDate(value) Examples angular.isDate("lone star") // false angular.isDate(new Date()) // true
The angular.isNumber function returns true if and only if the object or value passed to it is of the type Number, this includes +Infinity, -Infinity and NaN angular.isNumber(value) This function will not cause a type coercion such as "23" == 23 // true Examples angular.isNumber...
This code makes sure that all nested containers are always the same height. This is done by assuring that all nested elements are the same height as the containing parrent div. See working example: https://jsfiddle.net/3wwh7ewp/ This effect is achieved due to the property align-items being set to...
C++11 The type std::conditional in the standard library header <type_traits> can select one type or the other, based on a compile-time boolean value: template<typename T> struct ValueOrPointer { typename std::conditional<(sizeof(T) > sizeof(void*)), T*, T>::type vop; }...
tf get /all /recursive $/ Gets and replaces all files and directories from the last version available
By injecting $filter, any defined filter in your Angular module may be used in controllers, services, directives or even other filters. angular.module("app") .service("users", usersService) .controller("UsersController", UsersController); function usersService...
A custom control does not have to limit itself to trivial things like primitives; it can edit more interesting things. Here we present two types of custom controls, one for editing persons and one for editing addresses. The address control is used to edit the person's address. An example of usage wo...
Passing a context with a timeout (or with a cancel function) to a long running function can be used to cancel that functions work: ctx, _ := context.WithTimeout(context.Background(), 200*time.Millisecond) for { select { case <-ctx.Done(): return ctx.Err() default: ...
The components in angularJS can be visualised as a custom directive (< html > this in an HTML directive, and something like this will be a custom directive < ANYTHING >). A component contains a view and a controller. Controller contains the business logic which is binded with an view , w...
Get the window height and width var width = window.innerWidth var height = window.innerHeight
' sample data Dim sample = {1, 2, 3, 4, 5} ' using "query syntax" Dim squares = From number In sample Select number * number ' same thing using "method syntax" Dim squares = sample.Select (Function (number) number * number) We can project multiple result at once too ...
There are four principle ways to declare a variable in JavaScript: using the var, let or const keywords, or without a keyword at all ("bare" declaration). The method used determines the resulting scope of the variable, or reassignability in the case of const. The var keyword creates a f...
JavaScript variables can hold many data types: numbers, strings, arrays, objects and more: // Number var length = 16; // String var message = "Hello, World!"; // Array var carNames = ['Chevrolet', 'Nissan', 'BMW']; // Object var person = { firstName: "John", ...
String literal types allow you to specify the exact value a string can have. let myFavoritePet: "dog"; myFavoritePet = "dog"; Any other string will give a error. // Error: Type '"rock"' is not assignable to type '"dog"'. // myFavoritePet = "rock&qu...
3.0 let someString = " Swift Language \n" let trimmedString = someString.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) // "Swift Language" Method stringByTrimmingCharactersInSet returns a new string made by removing from both ends of t...
SleekXMPP (Python) import sleekxmpp client = sleekxmpp.Client("[email protected]", "password") client.connect() client.process(blocking=False) client.send_message(mto="[email protected]", mbody=self.msg) Smack (Java / Android) XMPPTCPConnection connectio...
In addition to functional constructs such as Try, Option and Either for error handling, Scala also supports a syntax similar to Java's, using a try-catch clause (with a potential finally block as well). The catch clause is a pattern match: try { // ... might throw exception } catch { case i...

Page 396 of 1336