Tutorial by Examples

Html has beginnerProgram mostly for learning purposes. beginnerProgram is not capable of handling Subscriptions or running Commands. It is only capable of handling user input from DOM Events. It only requires a view to render the model and an update function to handle state changes. Example Con...
program is a good pick, when your application does not require any external data for initialization. It is capable of handling Subscriptions and Commands, which enables way more opportunities for handling I/O, such as HTTP communication or interop with JavaScript. The initial state is required to ...
programWithFlags has only one difference from program. It can accept the data upon initialization from JavaScript: var root = document.body; var user = { id: 1, name: "Bob" }; var app = Elm.Main.embed( root, user ); The data, passed from JavaScript is called Flags. In this example ...
Example demonstrates component composition and one-way message passing from parent to children. 0.18.0 Component composition relies on Message tagging with Html.App.map 0.18.0 In 0.18.0 HTML.App was collapsed into HTML Component composition relies on Message tagging with Html.map Example ...
We'll use the popular eslint-config-airbnb as a starter as well as Meteor specific rules using eslint-import-resolver-meteor. We also need to install babel-parser to lint Meteor enabled ES7 features such as async/await. cd my-project npm install --save-dev eslint-config-airbnb eslint-plugin-impor...
Edit your package.json to add the following script : { "scripts": { "lint": "eslint .;exit 0" } } Then run it using npm run lint We use exit 0 as a trick to gracefully terminate the script when linting fails, otherwise npm will use eslint return code an...
This will create a timer to call the doSomething method on self in 5.0 seconds. [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(doSomething) userInfo:nil repeats:NO]; Setting the repeats parameter to false/NO indicates that we...
[timer invalidate]; timer = nil; This will stop the timer from firing. Must be called from the thread the timer was created in, see Apple's notes: You must send this message from the thread on which the timer was installed. If you send this message from another thread, the input source associ...
[timer fire]; Calling the fire method causes an NSTimer to perform the task it would have usually performed on a schedule. In a non-repeating timer, this will automatically invalidate the timer. That is, calling fire before the time interval is up will result in only one invocation. In a repeat...
Two erlang processes can communicate with each other, wich is also known as message passing. This procedure is asynchronous in the form that the sending process will not halt after sending the message. Sending Messages This can be achieved with the construct Pid ! Message, where Pid is a valid pr...
It is possible to register a process (pid) to a global alias. This can be achieved with the build in register(Alias, Pid) function, where Alias is the atom to access the process as and Pid is the process id. The alias will be globally available! It is very easy to create shared state, wich is usu...
Each process in erlang has a process identifier (Pid) in this format <x.x.x>, x being a natural number. Below is an example of a Pid <0.1252.0> Pid can be used to send messages to the process using 'bang' (!), also Pid can be bounded to a variable, both are shown below MyProcessId =...
Subroutines hold code. Unless specified otherwise, they are globally defined. # Functions do not (have to) specify their argument list sub returns_one { # Functions return the value of the last expression by default # The return keyword here is unnecessary, but helps readability. return 1...
using System.Text.RegularExpressions; string pattern = ":(.*?):"; string lookup = "--:text in here:--"; // Instanciate your regex object and pass a pattern to it Regex rgxLookup = new Regex(pattern, RegexOptions.Singleline, TimeSpan.FromSeconds(1)); // Get the match from y...
using System.Text.RegularExpressions; List<string> found = new List<string>(); string pattern = ":(.*?):"; string lookup = "--:text in here:--:another one:-:third one:---!123:fourth:"; // Instanciate your regex object and pass a pattern to it Regex rgxLookup = ...
class Product(models.Model): name = models.CharField(max_length=20) price = models.FloatField() To Get average price of all products: >>> from django.db.models import Avg, Max, Min, Sum >>> Product.objects.all().aggregate(Avg('price')) # {'price__avg': 124.0} To ...
PL/SQL stands for Procedural Language extensions to SQL. PL/SQL is available only as an "enabling technology" within other software products; it does not exist as a standalone language. You can use PL/SQL in the Oracle relational database, in the Oracle Server, and in client-side applicati...
Subtracting the values of two pointers to an object results in a signed integer *1. So it would be printed using at least the d conversion specifier. To make sure there is a type being wide enough to hold such a "pointer-difference", since C99 <stddef.h> defines the type ptrdiff_t. ...
Most performance tips are very dependent of the current state of JS engines and are expected to be only relevant at a given time. The fundamental law of performance optimization is that you must first measure before trying to optimize, and measure again after a presumed optimization. To measure cod...
The package's official wiki has some essential materials: As a new user, you will want to check out the vignettes, FAQ and cheat sheet. Before asking a question -- here on StackOverflow or anywhere else -- please read the support page. For help on individual functions, the syntax is h...

Page 504 of 1336