Tutorial by Examples: ti

The Math.random() function should give random numbers that have a standard deviation approaching 0. When picking from a deck of card, or simulating a dice roll this is what we want. But in most situations this is unrealistic. In the real world the randomness tends to gather around an common normal...
class Person(models.Model): name = models.CharField(max_length=50) description = models.TextField() class Club(models.Model): name = models.CharField(max_length=50) members = models.ManyToManyField(Person) Here we define a relationship where a club has many Persons and memb...
Codename One is a set of tools for mobile application development that derive a great deal of its architecture from Java. Codename One's mission statement is: Unify the complex and fragmented task of mobile device programming into a single set of tools, APIs & services. As a result create a...
In F#, all functions take exactly one parameter. This seems an odd statement, since it's trivially easy to declare more than one parameter in a function declaration: let add x y = x + y But if you type that function declaration into the F# interactive interpreter, you'll see that its type signat...
Most functions in F# are created with the let syntax: let timesTwo x = x * 2 This defines a function named timesTwo that takes a single parameter x. If you run an interactive F# session (fsharpi on OS X and Linux, fsi.exe on Windows) and paste that function in (and add the ;; that tells fsharpi ...
Template JS code Template.templateName.onCreated(function(){ this.subscribe('subsription1'); this.subscribe('subscription2'); }); Template HTML code <template name="templateName"> {{#if Template.subscriptionsReady }} //your actual view with data. it can ...
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...
Installing Angular Material npm npm install angular-material --save bower bower install angular-material --save jspm jspm install angular-material From Cloud cdnjs | jsdelivr | googlecdn Getting Started (blank shell) <html lang="en"> <head> <meta name...
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...
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...
Quantifier operations return a Boolean value if some or all of the elements in a sequence satisfy a condition. In this article, we will see some common LINQ to Objects scenarios where we can use these operators. There are 3 Quantifiers operations that can be used in LINQ: All – used to determine w...
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...
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...
Filtering refers to the operations of restricting the result set to contain only those elements that satisfy a specified condition. Where Selects values that are based on a predicate function. Method Syntax // Where var numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; var evens = number...
A join of two data sources is the association of objects in one data source with objects that share a common attribute in another data source. Join Joins two sequences based on key selector functions and extracts pairs of values. Method Syntax // Join class Customer { public int Id ...

Page 122 of 505