Tutorial by Examples: c

Position configuration for the credits label. Supported properties are align, verticalAlign, x and y. Defaults to: credits: { position: { align: 'right', x: -10, verticalAlign: 'bottom', y: -5 } },
GetLastError returns a numerical error code. To obtain a descriptive error message (e.g., to display to a user), you can call FormatMessage: // This functions fills a caller-defined character buffer (pBuffer) // of max length (cchBufferLength) with the human-readable error message // for a Win32 ...
Object oriented style Connect to Server $conn = new mysqli("localhost","my_user","my_password"); Set the default database: $conn->select_db("my_db"); Connect to Database $conn = new mysqli("localhost","my_user","my_password&q...
When we are finished querying the database, it is recommended to close the connection to free up resources. Object oriented style $conn->close(); Procedural style mysqli_close($conn); Note: The connection to the server will be closed as soon as the execution of the script ends, unless it...
The return statement in Bash doesn't return a value like C-functions, instead it exits the function with a return status. You can think of it as the exit status of that function. If you want to return a value from the function then send the value to stdout like this: fun() { local var="S...
The DATEDIF function returns the difference between two date values, based on the interval specified. It is provided for compatibility with Lotus 1-2-3. The DATEDIF function cannot be found on the function list and autocomplete and screen tips are unavailable. Note: It is pronounced "date diff&...
Some example cases when the result is an optional. var result: AnyObject? = someMethod() switch result { case nil: print("result is nothing") case is String: print("result is a String") case _ as Double: print("result is not nil, any value that is a Dou...
Before C++17, having pointers with a value of nullptr commonly represented the absence of a value. This is a good solution for large objects that have been dynamically allocated and are already managed by pointers. However, this solution does not work well for small or primitive types such as int, w...
Before C++17, a function typically represented failure in one of several ways: A null pointer was returned. e.g. Calling a function Delegate *App::get_delegate() on an App instance that did not have a delegate would return nullptr. This is a good solution for objects that have been dynamicall...
In most examples, the class naming convention is used to define an Aurelia Custom Element. However, Aurelia also provides a decorator that can be used to decorate a class. The class is again treated as a custom element by Aurelia then. The value supplied to the decorator becomes the name of the cus...
This illustrates that union members shares memory and that struct members does not share memory. #include <stdio.h> #include <string.h> union My_Union { int variable_1; int variable_2; }; struct My_Struct { int variable_1; int variable_2; }; int main (void) { ...
You can declare multiple constants within the same const block: const ( Alpha = "alpha" Beta = "beta" Gamma = "gamma" ) And automatically increment constants with the iota keyword: const ( Zero = iota // Zero == 0 One // One == 1...
Assert.That(actual, Is.EqualTo(expected));
Large fluent assertions do become harder to read, but when combined with classes that have good implementations of ToString(), they can generate very useful error messages. [Test] public void AdvancedContraintsGiveUsefulErrorMessages() { Assert.That(actualCollection, Has .Count.Equa...
Invoking a function as a method of an object the value of this will be that object. var obj = { name: "Foo", print: function () { console.log(this.name) } } We can now invoke print as a method of obj. this will be obj obj.print(); This will thus log: Foo...
Invoking a function as an anonymous function, this will be the global object (self in the browser). function func() { return this; } func() === window; // true 5 In ECMAScript 5's strict mode, this will be undefined if the function is invoked anonymously. (function () { "use...
When a function is invoked as a constructor with the new keyword this takes the value of the object being constructed function Obj(name) { this.name = name; } var obj = new Obj("Foo"); console.log(obj); This will log { name: "Foo" }
6 When using arrow functions this takes the value from the enclosing execution context's this (that is, this in arrow functions has lexical scope rather than the usual dynamic scope). In global code (code that doesn't belong to any function) it would be the global object. And it keeps that way, eve...
The apply and call methods in every function allow it to provide a custom value for this. function print() { console.log(this.toPrint); } print.apply({ toPrint: "Foo" }); // >> "Foo" print.call({ toPrint: "Foo" }); // >> "Foo" You mig...
The bind method of every function allows you to create new version of that function with the context strictly bound to a specific object. It is specially useful to force a function to be called as a method of an object. var obj = { foo: 'bar' }; function foo() { return this.foo; } fooOb...

Page 218 of 826