Tutorial by Examples

In contrasto to the Singleton, the Monostate is suitable to be inherited to extend its functionalities, as long as member methods are not static. It follows a minimal example in C++: struct Settings { virtual std::size_t width() const noexcept { return width_; } virtual std::size_t heigh...
When only a single argument is supplied to numpy's where function it returns the indices of the input array (the condition) that evaluate as true (same behaviour as numpy.nonzero). This can be used to extract the indices of an array that satisfy a given condition. import numpy as np a = np.arang...
import unittest def addition(*args): """ add two or more summands and return the sum """ if len(args) < 2: raise ValueError, 'at least two summands are needed' for ii in args: if not isinstance(ii, (int, long, float, compl...
Installation npm install forever -g cd /node/project/directory Usages forever start app.js
SOAP is an acronym for Simple Object Access Protocol which defines a protocol that is used to exchange data via a Remote Procedure Call (RPC) with other SOAP services or clients. It is available in two version: SOAP 1.1 [IETF] SOAP 1.2 [IETF] SOAP 1.2 obsoletes SOAP 1.1 it is therefore recomm...
1. Logs: By default, Heroku allows only 1500 lines of consolidated logs. When more than 1500 lines of logs are required, one has to use addons provided Heroku. 2. Router: HTTP request have 30s timeout for initial response and 55s timeout thereafter. Maximum of 1MB buffer allowed for response. 3....
To use the value stored in a variable, use the dollar sign followed by the variable name enclosed by parentheses or curly braces. x = hello y = $(x) # y now contains the value "hello" y = ${x} # parentheses and curly braces are treated exactly the same If a variable's name is only ...
Simply-expanded variables behave like variables from traditional programming languages. The expression on the right-hand side is evaluated, and the result is stored in the variable. If the right-hand side contains a variable reference, that variable is expanded before the assignment takes place. ...
When defining a recursively-expanded variable, the contents of the right-hand side are stored as-is. If a variable reference is present, the reference itself is stored (not the value of the variable). Make waits to expand the variable references until the variable is actually used. x = hello y =...
Within the context of an individual rule, Make automatically defines a number of special variables. These variables can have a different value for each rule in a makefile and are designed to make writing rules simpler. These variables can only be used in the recipe portion of a rule. VariableDesc...
The ?= operator is an extension that behaves like =, except that the assignment only occurs if the variable is not already set. x = hello x ?= world # $(x) will yield "hello"
The += operator is a common extension that adds the specified content to the end of the variable, separated by a space. x = hello x += world Variable references in the right-hand side will be expanded if and only if the original variable was defined as a simply-expanded variable.
Helpers and fakeApplication Class Helpers is used a lot for unit tests. It imitates a Play application, fakes HTTP requests and responses, session, cookies - all whatever may be needed for tests. A controller under the test should be executed in a context of a Play application. The Helpers method f...
This is such a common requirement in iOS development, and it was always something that had to be done purely in code (or using images - yuck!). Now it's incredibly easy to preview his kind of thing in Interface Builder, there's absolutely no excuse for not using it. Here's the code:- import UIKit ...
This tutorial assumes you already have a working OpenGL environment with all necessary libraries and headers available. #include <GL\glew.h> //Include GLEW for function-pointers etc. #include <GLFW\GLFW3.h> //Include GLFW for windows, context etc. //Impor...
glfwDefaultWindowHints(); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_VISIBLE, GL_FALSE); //Window hints are used to manipulate the behavior of later created windows //As the name suggests, they are only hints, not hard constraints, which mea...
File Structure: pom.xml src/test/java/PlayStoreAutomation.java Launch command: mvn test -Dtest=PlayStoreAutomation PlayStoreAutomation.java import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import io.appium.java_client.android.AndroidDriver; import i...
Lets examine the following two examples for reading a file's contents: The first one, which uses an async method for reading a file, and providing a callback function which is called once the file is fully read into the memory: fs.readFile(`${__dirname}/utils.js`, (err, data) => { if (err) {...
Before continuing, make sure you've read the Installation chapter and can access your new Symfony app in the browser. Suppose you want to create a page - /lucky/number - that generates a lucky (well, random) number and prints it. To do that, create a "Controller class" and a "con...
The below example widget demonstrates how to format individual cells of a TreeView column conditionally, depending on value of the field in the particular cell. If value of field is negative, then it'll be displayed in red color and minus symbol will be hidden, otherwise it'll be displayed in normal...

Page 852 of 1336