Tutorial by Examples: er

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 =...
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 ...
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. ...
public function method_name($single, $array) { echo $single; print_r($array); } Beware with the order which pass from controller to model.
Javascript engines first look for variables within the local scope before extending their search to larger scopes. If the variable is an indexed value in an array, or an attribute in an associative array, it will first look for the parent array before it finds the contents. This has implications wh...
The CustomEvent API allows developers to create custom events and trigger them on DOM nodes, passing data along the way. event = new CustomEvent(typeArg, customEventInit); typeArg - DOMString representing the name of the event. customEventInit - is optional parameters (that will be passed as e ...
To copy a data.frame as a data.table, use as.data.table or data.table: DF = data.frame(x = letters[1:5], y = 1:5, z = (1:5) > 3) DT <- as.data.table(DF) # or DT <- data.table(DF) This is rarely necessary. One exception is when using built-in datasets like mtcars, which must be copi...
It is generally not considered 'best practice' to re-purpose the reserved names of Properties or Methods as the name(s) of your own procedures and variables. Bad Form - While the following is (strictly speaking) legal, working code the re-purposing of the Find method as well as the Row, Column and ...
xml_import_example.info.yml type: module name: XML import example package: Examples description: "This module helps understanding the Batch API and Queue API with an XML import example" core: 8.x xml_import_example.permissions.yml import content from xml: title: 'Import content...
There is no built-in to iterate over enumeration. But there are several ways for enum with only consecutive values: enum E { Begin, E1 = Begin, E2, // .. En, End }; for (E e = E::Begin; e != E::End; ++e) { // Do job with e } C++11 with enum clas...
Applying css intuitively doesn't produce the desired results because vertical-align:middle isn't applicable to block-level elements margin-top:auto and margin-bottom:auto used values would compute as zero margin-top:-50% percentage-based margin values are calculated relative to the width of ...
[SerializeField] GameObject[] gameObjects; ProsConsGreat performanceObject collection is staticPortable codeCan only refer to GameObjects from the same scene
Functions allow you to specify these types of parameters: positional, named, variable positional, Keyword args (kwargs). Here is a clear and concise use of each type. def unpacking(a, b, c=45, d=60, *args, **kwargs): print(a, b, c, d, args, kwargs) >>> unpacking(1, 2) 1 2 45 60 ()...
import flash.utils.*; var intervalId:uint=setInterval(schroedingerCat,1000); // execute a function once per second and gather interval ID trace("Cat's been closed in the box."); function schroedingerCat():void { if (Math.random()<0.04) { clearInterval(intervalId); // ...
AlertDialog is a subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. The AlertDialog from android.app package displays differently on different Android OS Versions. The Android V7 Appcompat library pro...
By overloading the indexer you can create a class that looks and feels like an array but isn't. It will have O(1) get and set methods, can access an element at index 100, and yet still have the size of the elements inside of it. The SparseArray class class SparseArray { Dictionary<...
These excellent reference sources provide descriptions and illustrations of the various ranges in Pivot Tables. References Referencing Pivot Table Ranges in VBA - from Jon Peltier's Tech Blog Referencing an Excel Pivot Table Range using VBA - from globaliconnect Excel VBA
Patterns annotated with a bang (!) are evaluated strictly instead of lazily. foo (!x, y) !z = [x, y, z] In this example, x and z will both be evaluated to weak head normal form before returning the list. It's equivalent to: foo (x, y) z = x `seq` z `seq` [x, y, z] Bang patterns are enabled ...
Haskell supports pattern matching expressions in both function definition and through case statements. A case statement is much like a switch in other languages, except it supports all of Haskell's types. Let's start simple: longName :: String -> String longName name = case name of ...

Page 161 of 417