Create a file named launch-server.yaml, that will be our playbook.
The first part of the playbook is a list of hosts that your playbook will run on, we only have one, localhost.
- hosts: localhost
Then we need to define a list of tasks to perform in this playbook. We will only have one that lau...
Run the Ansible playbook:
$ ansible-playbook launch-server.yaml
You should see output like
PLAY [localhost]
***************************************************************
TASK [setup]
*******************************************************************
ok: [localhost]
TASK [launch an U...
Using NuGet
Install-Package Cirrious.FluentLayout
An expanded example based on the starter example at the GitHub Page, a simple first name, last name labels and fields all stacked one on top of the other:
public override void ViewDidLoad()
{
//create our labels and fields
var firstNa...
Built-in functionals: lapply(), sapply(), and mapply()
R comes with built-in functionals, of which perhaps the most well-known are the apply family of functions. Here is a description of some of the most common apply functions:
lapply() = takes a list as an argument and applies the specified ...
User-defined functionals
Users can create their own functionals to varying degrees of complexity. The following examples are from Functionals by Hadley Wickham:
randomise <- function(f) f(runif(1e3))
lapply2 <- function(x, f, ...) {
out <- vector("list", length(x...
The following will prompt a user for input, and then store that input as a string (text) in a variable. The variable is then used to give a message to the user.
#!/usr/bin/env bash
echo "Who are you?"
read name
echo "Hello, $name."
The command read here reads one line of ...
In same cases different models could have same fields and same procedures in the product life cycle.
To handle these similarities without having code repetition inheritance could be used.
Instead of inheriting a whole class, mixin design pattern offers us to inherit (or some says include) some met...
To print a test field (TestField) from a test feature class (TestFC) in a test file geodatabase (Test.gdb) located in a temporary folder (C:\Temp):
with arcpy.da.SearchCursor(r"C:\Temp\Test.gdb\TestFC",["TestField"]) as cursor:
for row in cursor:
print row[0]
void main()
{
import std.stdio : writeln;
int[] arr = [1, 3, 4];
int i = 0;
assert(arr.length > 0, "Array must contain at least one element");
do
{
arr[i++] *= 2;
} while (i < arr.length);
writeln(arr); // [2, 6, 8]
}
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='user')
website = models.URLField(default='', ...
If an arithmetic operation that yields a floating point type produces a value that is not in the range of representable values of the result type, the behavior is undefined according to the C++ standard, but may be defined by other standards the machine might conform to, such as IEEE 754.
float x =...
When either a signed or unsigned integer is converted to a signed integer type, and its value is not representable in the destination type, the value produced is implementation-defined. Example:
// Suppose that on this implementation, the range of signed char is -128 to +127 and
// the range of un...
Here is a simple JsonArray which you would like to convert to a Java ArrayList:
{
"list": [
"Test_String_1",
"Test_String_2"
]
}
Now pass the JsonArray 'list' to the following method which returns a corresponding...
Sometimes in a development or testing environment, the SSL certificate chain might not have been fully established (yet).
To continue developing and testing, you can turn off SSL verification programmatically by installing an "all-trusting" trust manager:
try {
// Create a trust mana...
Config values can be set in three ways:
Via private static variables on any class within a SilverStripe project
Via yaml config files (stored in module-folder/_config/[file].yml)
Via PHP at run time (Config::inst()->update('Director', 'environment_type', 'dev')
Generally it's best to se...