Tutorial by Examples

A common use case for *args in a function definition is to delegate processing to either a wrapped or inherited function. A typical example might be in a class's __init__ method class A(object): def __init__(self, b, c): self.y = b self.z = c class B(A): def __init__(...
You can use a dictionary to assign values to the function's parameters; using parameters name as keys in the dictionary and the value of these arguments bound to each key: def test_func(arg1, arg2, arg3): # Usual function with three arguments print("arg1: %s" % arg1) print("a...
Detailed instructions on getting facebook set up or installed.
In this example a custom LAMP project development environment is created with Vagrant. First of all you will need to install Virtual Box and Vagrant. Then, create a vagrant folder in your home directory, open your terminal and change the current directory to the new vagrant directory. Now, execute...
int ledPin = 13; // LED connected to digital pin 13 void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(le...
NSLog(@"%s %@",__FUNCTION__, @"etc etc"); Inserts the class and method name into the output: 2016-07-22 12:51:30.099 loggingExample[18132:2971471] -[ViewController viewDidLoad] etc etc
Postfix increment X++ will add 1 to x var x = 42; x++; Console.WriteLine(x); // 43 Postfix decrement X-- will subtract one var x = 42 x--; Console.WriteLine(x); // 41 ++x is called prefix increment it increments the value of x and then returns x while x++ returns the value of x and the...
You have a local vagrant box that you want to upload to Amazon AWS. First, you need to create a .box file: vagrant package --base my-virtual-machine This step should take a while depending on the size of your image. Then, you need to get the .vmdk image from the .box file: gunzip -S .box packag...
map() is a builtin that is useful for applying a function to elements of an iterable. In Python 2, map returns a list. In Python 3, map returns a map object, which is a generator. # Python 2.X >>> map(str, [1, 2, 3, 4, 5]) ['1', '2', '3', '4', '5'] >>> type(_) >>> &l...
Predefined operators according to ISO/IEC 13211-1 and 13211-2: PriorityTypeOperator(s)Use1200xfx:- -->1200fx:- ?-Directive, query1100xfy;1050xfy->1000xfy','900fy\+700xfx= \\=Term unification700xfx== \\== @< @=< @> @>=Term comparison700xfx=..700xfxis =:= =\= < > =<...
In Prolog, custom operators can be defined using op/3: op(+Precedence, +Type, :Operator) Declares Operator to be an operator of a Type with a Precedence. Operator can also be a list of names in which case all elements of the list are declared to be identical operators. Precedence is an in...
FlowPane lays out nodes in rows or columns based on the available horizontal or vertical space available. It wraps nodes to the next line when the horizontal space is less than the total of all the nodes' widths; it wraps nodes to the next column when the vertical space is less than the total of all...
GridPane lays out its children within a flexible grid of rows and columns. Children of the GridPane A child may be placed anywhere within the GridPane and may span multiple rows/columns (default span is 1) and its placement within the grid is defined by it's layout constraints: ConstraintDescript...
The extern keyword is used to declare methods that are implemented externally. This can be used in conjunction with the DllImport attribute to call into unmanaged code using Interop services. which in this case it will come with static modifier For Example: using System.Runtime.InteropServices; p...
This example uses four different files: The User model The User mailer The html template for the email The plain-text template for the email In this case, the user model calls the approved method in the mailer and passes the post that has been approved (the approved method in the model may ...
Introduce environment variable VAGRANT_DEFAULT_PROVIDER export VAGRANT_DEFAULT_PROVIDER=vmware_fusion
Vagrant.configure("2") do |config| # ... other config up here config.vm.provider "vmware_fusion" end
vagrant up --provider hyperv
vagrant up --provider docker
vagrant up --provider vmware_fusion

Page 309 of 1336