Tutorial by Examples: c

Variables can be incremented or decremented by 1 with ++ or --, respectively. They can either precede or succeed variables and slightly vary semantically, as shown below. $i = 1; echo $i; // Prints 1 // Pre-increment operator increments $i by one, then returns $i echo ++$i; // Prints 2 // P...
Concept Use an Event to synchronize the scheduling of multiple coroutines. Put simply, an event is like the gun shot at a running race: it lets the runners off the starting blocks. Example import asyncio # event trigger function def trigger(event): print('EVENT SET') event.set() #...
Electron ports HTML web applications to native applications for a range of devices, including creating native desktop applications. It's also very easy to get started! To begin, we must have electron, nodejs, npm, git and meteor installed. Familiarity with these tools is vital for working with Mete...
Let's download a Meteor Todos example project, using a Linux shell (command line) script, to test out Electrifying a project for the first time: Requirements for this section: Git apt-get install git-all There are many ways to install Git. Check them out here. git is a version control sys...
Given that the function has a proper prototype, integers are widened for calls to functions according to the rules of integer conversion, C11 6.3.1.3. 6.3.1.3 Signed and unsigned integers When a value with integer type is converted to another integer type other than _Bool, if the value can be r...
Pointer conversions to void* are implicit, but any other pointer conversion must be explicit. While the compiler allows an explicit conversion from any pointer-to-data type to any other pointer-to-data type, accessing an object through a wrongly typed pointer is erroneous and leads to undefined beh...
It's fairly common that you may create a class that implements IDisposable, and then derive classes that also contain managed resources. It is recommendeded to mark the Dispose method with the virtual keyword so that clients have the ability to cleanup any resources they may own. public class Paren...
This example wraps the asynchronous method oauth2.client.getToken(callback) from the package NPM package simple-oauth2into a Fiber so that the method may be called synchronously. const oauth2 = require('simple-oauth2')(credentials); const credentials = { clientID: '#####', clientSecret...
An interesting thing to note which may help optimize your applications is that primitives are actually also refcounted under the hood. Let's take a look at numbers; for all integers between -5 and 256, Python always reuses the same object: >>> import sys >>> sys.getrefcount(1) 7...
>>> import sys >>> a = object() >>> sys.getrefcount(a) 2 >>> b = a >>> sys.getrefcount(a) 3 >>> del b >>> sys.getrefcount(a) 2
Install haveged (example sudo apt-get install haveged) to speed up the random byte process. Then: gpg --gen-key gpg --list-keys outputs: pub 2048R/NNNNNNNN 2016-01-01 uid Name <[email protected]> sub 2048R/xxxxxxxx 2016-01-01 Then publish: gpg --keyserver pgp.mi...
var myData = [ { name: "test1", value: "ok" }, { name: "test2", value: "nok" } ] // We have to select elements (here div.samples) // and assign data. The second parameter of data() is really important, // it will determine the "key" t...
Concatenation refers to the operation of appending one sequence to another. Concat Concatenates two sequences to form one sequence. Method Syntax // Concat var numbers1 = new int[] { 1, 2, 3 }; var numbers2 = new int[] { 4, 5, 6 }; var numbers = numbers1.Concat(numbers2); // number...
Projection refers to the operations of transforming an object into a new form. Select Projects values that are based on a transform function. Method Syntax // Select var numbers = new int[] { 1, 2, 3, 4, 5 }; var strings = numbers.Select(n => n.ToString()); // strings = { "1...
Conversion operations change the type of input objects. AsEnumerable Returns the input typed as IEnumerable. Method Syntax // AsEnumerable int[] numbers = { 1, 2, 3, 4, 5 }; var nums = numbers.AsEnumerable(); // nums: static type is IEnumerable<int> Query Syntax // Not app...
Tuples in Python are values separated by commas. Enclosing parentheses for inputting tuples are optional, so the two assignments a = 1, 2, 3 # a is the tuple (1, 2, 3) and a = (1, 2, 3) # a is the tuple (1, 2, 3) are equivalent. The assignment a = 1, 2, 3 is also called packing because it...
In a normal mathematical coordinate system, the point x=0, y=0 is at the lower left corner of the graph. But in the SVG coordinate system, this (0,0) point is at the top left corner of the ‘canvas’, it is sort of similar to CSS when you specify the position to absolute/fix and use top and left to co...
<rect> represents rectangle, apart from aesthetic properties like stroke and fill, rectangle shall be defined by location and size. As for the location, it is determined by the x and y attributes. The location is relative to the rectangle’s parent. And if you don’t specify the x or y attribut...
Components in Vue are like widgets. They allow us to write reusable custom elements with desired behavior. They are nothing but objects which can contain any/all of the options that the root or any Vue instance can contain, including an HTML template to render. Components consist of: HTML marku...
When you bind a service to your application credentials become available through the VCAP_SERVICES environment variable. This environment variable contains JSON containing the credentials for all bound services. Example VCAP_SERVICES environment variable { "push-reappt": [ { ...

Page 196 of 826