text:
<?php

namespace PHPExiftool\Driver\Tag\PNG;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class ProfileName extends AbstractTag
{

    protected $Id = 'iCCP-name';

    protected $Name = 'ProfileName';

    protected $FullName = 'PNG::Main';

    protected $GroupName = 'PNG';

    protected $g0 = 'PNG';

    protected $g1 = 'PNG';

    protected $g2 = 'Image';

    protected $Type = '?';

    protected $Writable = false;

    protected $Description = 'Profile Name';
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
F. W. H. A. von Humboldt et al. , Nov. gen. sp. 1:258[folio]; 1:322[quarto]. 1816

#### Original name
null

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
"""
A script to dump some dummy datas

WARNING: Remember to comment Entry model method "save" before using this to
         avoid 'created' attribute to be automatically filled with datetime.now()
"""
import os, datetime
import click
import peewee
import random, shutil

import arrow

from captains_log.conf.install import install_app
from captains_log.backend.init import init_database
from captains_log.backend.models import CaptainsLogDatabase, Category, Entry

from captains_log.conf import settings

DUMMY_CATEGORIES = [
    u"General",
    u"ACME",
    u"Foo-bar",
    u"Dummy",
    u"Customer1",
    u"Starfleet",
    u"DS9",
    u"Emencia",
    u"R&D",
    u"Customer2",
]

TRIBUNE_TITLES = (
    u'Avengers Mansion', # Marvel Comics
    u'Gotham City', # DC Comics
    u'Morrison Hotel', # Album des Doors
    u'Maysaf', # Assassin's Creed
    u'Cheyenn Mountain', # Stargate
    u'Mines of Moria', # LOTRO
    # Red Dead Redemption
    u'Armadillo',
    u'Chuparosa',
    u'Tumbleweed',
    # Babylon 5
    u'Secteur Gris, niveau 6',
    u'Zahadum',
    # Fallout3
    u'Abri 101',
    u'Rockopolis',
    u'Megaton',
    # GTA
    u'Vice City',
    u'San Andreas',
    u'Liberty City',
    # Papers, Please
    u"La voix de l'Arstotzka",
    # Hercule Poirot
    u'Whitehaven Mansions',
    # Walking dead
    u'Woodbury',
    u'West Georgia Correctional Facility',
    # Zorel
    u'La trouée des Trolls',
    u'Twilight Zone',
    u'Mon curé chez les musselidés',
    u'One mussel on the moon',
    u"Nan c'est à côté",
    u'Here be dragons',
    # Profitroll
    u'Le petit bonhomme en mousse',
    # Fab&lhg
    u'Au royaume des lusers, les geeks sont rois',
    # Eddy
    u'Parle à ma main',
    # Sensei
    u"Place de l'inquisition",
    # Nostromo
    u"On n'est pas à C dans l'air ici",
    # Divers
    u"Tom Petty Fan club",
    u"L'île aux pirates",
    u'Environnement Confiné',
    u'Hôtel Palace',
    u'La Tour de Gay',
    u'1 rue Sésame',
    u'Zone 42',
    u'Dance Floor',
    u'Poire Mécanique',
    u'Tibet Libre',
    u'PaTribune PaLibre',
    u'Hello World',
    u'Hello Kitty Land',
    u'La Tour Sombre',
    u'[:uxam]',
    u'Grrrrrr',
    u'I can haz shiny post too',
    u'Institut de la connaissance universelle',
    u'Please, insert coin',
    u'alt.tribune.dax',
    u'/b/',
    u"Only Classic Rock n' Roll",
    u"Dollarmussels",
)

# Remove previous config
if os.path.exists(settings.CONFIG_DIR):
    shutil.rmtree(settings.CONFIG_DIR)

# Then redo install
install_app()

# Connect database again
init_database()
print

# Create categories
print "Creating Categories"
categories_choices = [None,]
for name in DUMMY_CATEGORIES:
    categories_choices.append(Category.create(name=name))
print

# Create datetime hour ranges for two years
# First year
start = datetime.datetime(2014, 3, 5, 12, 30)
end = datetime.datetime(2014, 7, 10, 13, 30)
datetimes_choices = arrow.Arrow.span_range('hour', start, end)
# Second year
start = datetime.datetime(2014, 12, 10, 10, 5)
end = datetime.datetime(2015, 3, 2, 18, 0)
datetimes_choices = datetimes_choices + arrow.Arrow.span_range('hour', start, end)

# Keep only the start from the ranges
datetimes_choices = [start for start,end in datetimes_choices]

print "Datetimes choices:", len(datetimes_choices)

# Filter datetime to be only between 9h and 19h
def filter_scope_working_hours(item):
    if item.hour < 9 or item.hour > 19:
        return False
    return True
datetimes_choices = filter(filter_scope_working_hours, datetimes_choices)
print "Filtered results:", len(datetimes_choices)

# Selected X random datetime items
ENTRY_ITEMS_MAX = 400
selected_datetimes = []
while len(selected_datetimes)<ENTRY_ITEMS_MAX:
    # Choose a random item
    choosed = random.choice(datetimes_choices)
    # Append it to selected list
    selected_datetimes.append(choosed)
    # Remove item so it can be selected only once
    datetimes_choices.pop(datetimes_choices.index(choosed))

# Re order selected datetimes
selected_datetimes = sorted(selected_datetimes)

def safe_category_name(category):
    if not category:
        return None
    return category.name

# Prepare entry datas for each selected datetimes
bulk_datas = []
for item in selected_datetimes:
    category = random.choice(categories_choices)
    message = random.choice(TRIBUNE_TITLES)
    print item.format('YYYY-MM-DD HH:mm'), safe_category_name(category), message
    print type(item.datetime)
    print
    #entry_obj = Entry.create(created=item.datetime, category=category, content=message)
    bulk_datas.append({
        #'created': item.datetime,
        'created': item.naive, # Use naive datetime, seems at least sqlite does not like TZ
        'category': category,
        'content': message,
    })

# Create this in bulk mode
with CaptainsLogDatabase.transaction():
    for idx in range(0, len(bulk_datas), 1000):
        Entry.insert_many(bulk_datas[idx:idx+1000]).execute()

print "Finished!"


text:
- Vagrant 2.0.1 or later
- Hypervisors:
  - VirtualBox 5.2.8 or later
  - VMWare Fusion 10.1.0 or later or VmWare Workstation 14
    - For use VmWare Fusion you will need the Vagrant VmWare Fusion plugin (https://www.vagrantup.com/vmware/index.html)
- Laptop or server with at least 4 CPU cores and 16 Gig of RAM

### Creating / shutting down / destroying the cluster:
This folder contains the Vagrant file to create a single or multi-node
Kubernetes cluster using Contiv-VPP as a Network Plugin.

It is recommended to use the following provided scripts for managing the cluster:

 * [`vagrant-up`](vagrant-up) to start a default cluster with 1 master and 1 worker,
 * [`vagrant-start`](vagrant-up) to start start a cluster using an interactive script asking for options,
 * [`vagrant-cleanup`](vagrant-cleanup) to destroy the cluster.

The following environment variables can be used to customize the cluster options
(defaults are defined and can be also customized in the [defaults](defaults) file):

Environment variable | Description | Default
--------- | ----------- | -------
`K8S_NODE_OS` | OS to be used for cluster node. Vagrantfile currently supports only `ubuntu` | `ubuntu`
`K8S_NODE_OS_RELEASE` | Version of the OS to be used for cluster nodes `16.04` or `18.04`| `16.04`
`K8S_MASTER_CPUS` | Number of CPUs to be allocated for a master node | `4`
`K8S_NODE_CPUS` | Number of CPUs to be allocated for a worker node | `4`
`K8S_MASTER_MEMORY` | Memory size for master node | `4096`
`K8S_NODE_MEMORY` | Memory size for worker nodes | `4096`
`K8S_NODES` | Number of worker nodes (except from the master) | `1`
`K8S_MASTER_NODES` | Number of master nodes (Beware: multimaster feature is experimental doesn't work for all option combination) | `1`
`K8S_VERSION` | Kubernetes version to be installed | `1.12.3`
`K8S_DEPLOYMENT_SCENARIO` | Contiv deployment scenario to be used: `nostn` (default) or [`stn`](../docs/setup/SINGLE_NIC_SETUP.md) or [`calico-vpp`](calico-vpp/README.md) | `nostn`
`K8S_DEPLOYMENT_ENV` | Contiv deployment environment to be used: `prod` (production) or `dev` (development) | `prod`
`CONTIV_IMAGE_TAG` | Docker image tag denoting contiv/vpp version to be installed | `latest`
`CRD_DISABLED` | If set to `true` nodeconfig must be set in contiv deployment file. Otherwise it is configure using crd. | `true`
`HELM_EXTRA_OPTS` | Allows to pass arbitrary helm option see [available parameters](../k8s/contiv-vpp)| `""`

If you want to customize the default behavior via environment variables, export the
variables that need to be overridden and execute `./vagrant-up`, e.g.:
```bash
cd vagrant
export K8S_NODE_OS_RELEASE=18.04
export K8S_NODES=2
./vagrant-up
```

You can use the interactive `vagrant-start` script to customize the default behavior, alternatively.
The `vagrant-start` script prompts the user to select the number of worker nodes of the kubernetes cluster.
Zero (0) worker nodes mean that a single-node cluster (with one kubernetes master node) will be deployed.
Next, the user is prompted to select either the *production environment* or the *development environment*.
Instructions on how to build the development contiv/vpp-vswitch image can be found in the
next paragraph. The last option asks the user to select between *Without StealTheNIC* and *With StealTheNIC*
Given option With *StealTheNIC* the plugin will "steal" interfaces owned by Linux and use their configuration in VPP.

For the production environment run:
```bash
$ cd vagrant/
$ ./vagrant-start
Please provide the number of workers for the Kubernetes cluster (0-50) or enter [Q/q] to exit: 1

Please choose Kubernetes environment:
1) Production
2) Development
3) Quit
--> 1
You chose Production environment

Please choose deployment scenario:
1) Without StealTheNIC	3) Calico		5) Quit
2) With StealTheNIC	4) Calico-VPP
--> 1
You chose deployment without StealTheNIC

Creating a production environment, without STN and 1 worker node(s)

Creating VirtualBox DHCP server...
...
```

For the development environment run:
```bash
$ cd vagrant/
$ ./vagrant-start
Please provide the number of workers for the Kubernetes cluster (0-50) or enter [Q/q] to exit: 1

Please choose Kubernetes environment:
1) Production
2) Development
3) Quit
--> 2
You chose Development environment

Please choose deployment scenario:
1) Without StealTheNIC	3) Calico		5) Quit
2) With StealTheNIC	4) Calico-VPP
--> 1
You chose deployment without StealTheNIC

Creating a development environment, without STN and 1 worker node(s)
...
```

To destroy and clean-up the cluster, run the `vagrant-cleanup` script:
```bash
cd vagrant/
./vagrant-cleanup
```

To shutdown the cluster run the `vagrant-shutdown` script:
```
cd vagrant/
./vagrant-shutdown
```

To reboot the cluster run the `vagrant-reload` script
```
cd vagrant/
./vagrant-reload
```

From a suspended state, or after a reboot of the host machine, the cluster
can be brought up by running the `vagrant-up` script.

### Building and deploying the contivvpp/dev-vswitch image (optional)
If you chose the deployment with the development environment follow the
instructions to build a modified contivvpp/vswitch image.

1. Make sure changes in the code have been saved. From the k8s-master node,
   build the new contivvpp/vswitch image (run as sudo)

```
vagrant ssh k8s-master
cd /vagrant/config
sudo ./save-dev-image
```

2. The newly built contivvpp/vswitch image is now tagged as latest. Verify
with `sudo docker images`; contivvpp/vswitch should have been created a few
seconds ago. The new image with all the changes must become available to all
the nodes in the K8s cluster. To do so, load the docker image into the running
worker nodes (run as sudo).

```
vagrant ssh k8s-worker1
cd /vagrant/config
sudo ./load-dev-image
```

Verify with `sudo docker images`; old contivvpp/vswitch should now be tagged as
`<none>` and the latest tagged  contivvpp/vswitch should have been created a
few seconds ago.

### Exploring the cluster:
Once the cluster is up, log into the master:
```
$ cd vagrant
$ vagrant ssh k8s-master

Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-21-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
vagrant@k8s-master:~$
```
Verify the Kubernetes/Contiv-VPP installation. First, verify the nodes in the cluster:

```
vagrant@k8s-master:~$ kubectl get nodes -o wide

NAME          STATUS   ROLES    AGE     VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE           KERNEL-VERSION     CONTAINER-RUNTIME
k8s-master    Ready    master   6m46s   v1.12.3   10.20.0.2     <none>        Ubuntu 16.04 LTS   4.4.0-21-generic   docker://18.3.0
k8s-worker1   Ready    <none>   4m56s   v1.12.3   10.20.0.10    <none>        Ubuntu 16.04 LTS   4.4.0-21-generic   docker://18.3.0
```

Next, verify that all pods are running correctly:

```
vagrant@k8s-master:~$ kubectl get pods -n kube-system -o wide

NAME                                 READY   STATUS    RESTARTS   AGE     IP           NODE          NOMINATED NODE
contiv-crd-qgg6g                     1/1     Running   0          6m52s   10.20.0.2    k8s-master    <none>
contiv-etcd-0                        1/1     Running   0          6m52s   10.20.0.2    k8s-master    <none>
contiv-ksr-55g4g                     1/1     Running   0          6m52s   10.20.0.2    k8s-master    <none>
contiv-vswitch-6l5s4                 1/1     Running   0          6m52s   10.20.0.2    k8s-master    <none>
contiv-vswitch-wz42q                 1/1     Running   0          5m20s   10.20.0.10   k8s-worker1   <none>
coredns-576cbf47c7-7ct48             1/1     Running   0          6m52s   10.1.1.2     k8s-master    <none>
coredns-576cbf47c7-bt8qs             1/1     Running   0          6m52s   10.1.1.3     k8s-master    <none>
etcd-k8s-master                      1/1     Running   0          6m16s   10.20.0.2    k8s-master    <none>
kube-apiserver-k8s-master            1/1     Running   0          5m54s   10.20.0.2    k8s-master    <none>
kube-controller-manager-k8s-master   1/1     Running   0          5m55s   10.20.0.2    k8s-master    <none>
kube-proxy-kqpk6                     1/1     Running   0          5m20s   10.20.0.10   k8s-worker1   <none>
kube-proxy-swfnk                     1/1     Running   0          6m52s   10.20.0.2    k8s-master    <none>
kube-scheduler-k8s-master            1/1     Running   0          6m2s    10.20.0.2    k8s-master    <none>
```

Check VPP and its interfaces:
```
vagrant@k8s-master:~$ sudo vppctl
    _______    _        _   _____  ___
 __/ __/ _ \  (_)__    | | / / _ \/ _ \
 _/ _// // / / / _ \   | |/ / ___/ ___/
 /_/ /____(_)_/\___/   |___/_/  /_/

vpp# sh interface
              Name               Idx       State          Counter          Count
              Name               Idx    State  MTU (L3/IP4/IP6/MPLS)     Counter          Count
GigabitEthernet0/8/0              1      up          9000/0/0/0     rx packets                     8
                                                                    rx bytes                     821
                                                                    tx packets                     9
                                                                    tx bytes                     566
                                                                    drops                          5
                                                                    ip4                            3
...
```
Make sure that `GigabitEthernet0/8/0` is listed and that its status is `up`.

Next, create an example deployment of nginx pods:
```
vagrant@k8s-master:~$ kubectl run nginx --image=nginx --replicas=2
deployment "nginx" created
```
Check the status of the deployment:

```
vagrant@k8s-master:~$ kubectl get deploy -o wide

NAME      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE       CONTAINERS   IMAGES    SELECTOR
nginx     2         2         2            2           2h        nginx        nginx     run=nginx
```

Verify that the pods in the deployment are up & running:
```
vagrant@k8s-master:~$ kubectl get pods -o wide

NAME                   READY     STATUS    RESTARTS   AGE       IP         NODE
nginx-8586cf59-6kx2m   1/1       Running   1          1h        10.1.2.3   k8s-worker1
nginx-8586cf59-j5vf9   1/1       Running   1          1h        10.1.2.2   k8s-worker1
```

Issue an HTTP GET request to a pod in the deployment:

```
vagrant@k8s-master:~$ wget 10.1.2.2

--2018-01-19 12:34:08--  http://10.1.2.2/
Connecting to 10.1.2.2:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 612 [text/html]
Saving to: 'index.html.1'

index.html.1                100%[=========================================>]     612  --.-KB/s    in 0s

2018-01-19 12:34:08 (1.78 MB/s) - 'index.html.1' saved [612/612]
```

#### How to SSH into k8s worker node

```
$ cd vagrant
$ vagrant status
$ vagrant ssh k8s-worker1
```

### Using Windows 10 host machine
These Vagrant files and scripts work on Windows machine too. Windows Subsystem
for Linux (WSL) used in this case. Windows 10 and 16 GB of RAM is required.

1) Install VirtualBox on Windows
2) Make Windows Subsystem for Linux (WSL) working and install preferably
Ubuntu 18.04 (you can follow https://docs.microsoft.com/en-us/windows/wsl/install-win10
or https://www.windowscentral.com/how-install-bash-shell-command-line-windows-10 or similar guides)
3) Install Vagrant inside WSL (https://www.vagrantup.com/docs/other/wsl.html)

The idea is to have VirtualBox in Windows and Vagrant in Linux. To make it work you should
enable vagrant to access host Windows (export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1").
You may have problems with paths (see, e.g. https://github.com/mitchellh/vagrant-aws/issues/363
for inspiration; or you can create symlinks in windows if needed "mklink VirtualBox VirtualBox.exe"
to make Linux command working).

Once done, you can follow the steps above inside WSL. You can also run robot tests from WSL
if the cognitive/vpp environment is set up using vagrant.


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace DtoGenerator.Logic.Infrastructure.TreeProcessing
{
    public class CustomCodeLocator : CSharpSyntaxWalker
    {
        public List<int> CustomCodeBeginLocations { get; set; }
        public List<int> CustomCodeEndLocations { get; set; }

        public CustomCodeLocator() : base(SyntaxWalkerDepth.Trivia)
        {
            this.CustomCodeBeginLocations = new List<int>();
            this.CustomCodeEndLocations = new List<int>();
        }

        public bool IsLocationWithinCustomCode(int location)
        {
            foreach(var b in CustomCodeBeginLocations)
            {
                var e = this.CustomCodeEndLocations.OrderBy(p => p).Where(p => p >= b).First();
                if (location >= b && location <= e)
                    return true;
            }

            return false;
        }

        public override void VisitTrivia(SyntaxTrivia trivia)
        {
            if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia)
            {
                var text = trivia.ToString();

                if (text.Contains("////BCC/"))
                    this.CustomCodeBeginLocations.Add(trivia.Span.Start);
                if (text.Contains("////ECC/"))
                    this.CustomCodeEndLocations.Add(trivia.Span.Start);
            }

            base.VisitTrivia(trivia);
        }

        public bool IsNodeWithinCustomCode(SyntaxNode node)
        {
            return this.IsLocationWithinCustomCode(node.SpanStart);
        }
    }
}


text:
import createDebug from 'debug';
import fs from 'fs';
import path from 'path';
import { CharacteristicValue, Nullable } from '../types';
import { Accessory } from './Accessory';
import {
  Characteristic,
  CharacteristicEventTypes,
  CharacteristicGetCallback,
  CharacteristicSetCallback
} from './Characteristic';
import { Service } from './Service';
import * as uuid from './util/uuid';

const debug = createDebug('HAP-NodeJS:AccessoryLoader');

/**
 * Loads all accessories from the given folder. Handles object-literal-style accessories, "accessory factories",
 * and new-API style modules.
 */

export function loadDirectory(dir: string): Accessory[] {

  // exported accessory objects loaded from this dir
  let accessories: unknown[] = [];

  fs.readdirSync(dir).forEach((file) => {
    const suffix = file.split('_').pop();

    // "Accessories" are modules that export a single accessory.
    if (suffix === 'accessory.js' || suffix === 'accessory.ts') {
      debug('Parsing accessory: %s', file);
      const loadedAccessory = require(path.join(dir, file)).accessory;
      accessories.push(loadedAccessory);
    }
    // "Accessory Factories" are modules that export an array of accessories.
    else if (suffix === 'accfactory.js' ||suffix === 'accfactory.ts') {
      debug('Parsing accessory factory: %s', file);

      // should return an array of objects { accessory: accessory-json }
      const loadedAccessories = require(path.join(dir, file));
      accessories = accessories.concat(loadedAccessories);
    }
  });

  // now we need to coerce all accessory objects into instances of Accessory (some or all of them may
  // be object-literal JSON-style accessories)
  return accessories.map((accessory) => {
    if(accessory === null || accessory === undefined) { //check if accessory is not empty
      console.log("Invalid accessory!");
      return false;
    } else {
      return (accessory instanceof Accessory) ? accessory : parseAccessoryJSON(accessory);
    }
  }).filter((accessory: Accessory | false) => { return !!accessory; }) as Accessory[];
}

/**
 * Accepts object-literal JSON structures from previous versions of HAP-NodeJS and parses them into
 * newer-style structures of Accessory/Service/Characteristic objects.
 */

export function parseAccessoryJSON(json: any) {

  // parse services first so we can extract the accessory name
  const services: Service[] = [];

  json.services.forEach(function(serviceJSON: any) {
    const service = parseServiceJSON(serviceJSON);
    services.push(service);
  });

  let displayName = json.displayName;

  services.forEach(function(service) {
    if (service.UUID === '0000003E-0000-1000-8000-0026BB765291') { // Service.AccessoryInformation.UUID
      service.characteristics.forEach(function(characteristic) {
        if (characteristic.UUID === '00000023-0000-1000-8000-0026BB765291') {// Characteristic.Name.UUID
          displayName = characteristic.value;
        }
      });
    }
  });

  const accessory = new Accessory(displayName, uuid.generate(displayName));

  // create custom properties for "username" and "pincode" for Core.js to find later (if using Core.js)
  // @ts-ignore
  accessory.username = json.username;
  // @ts-ignore
  accessory.pincode = json.pincode;

  // clear out the default services
  accessory.services.length = 0;

  // add services
  services.forEach(function(service) {
    accessory.addService(service);
  });

  return accessory;
}

export function parseServiceJSON(json: any) {
  const serviceUUID = json.sType;

  // build characteristics first so we can extract the Name (if present)
  const characteristics: Characteristic[] = [];

  json.characteristics.forEach((characteristicJSON: any) => {
    const characteristic = parseCharacteristicJSON(characteristicJSON);
    characteristics.push(characteristic);
  });

  let displayName: Nullable<CharacteristicValue> = null;

  // extract the "Name" characteristic to use for 'type' discrimination if necessary
  characteristics.forEach(function(characteristic) {
    if (characteristic.UUID == '00000023-0000-1000-8000-0026BB765291') // Characteristic.Name.UUID
      displayName = characteristic.value;
  });

  // Use UUID for "displayName" if necessary, as the JSON structures don't have a value for this
  const service = new Service(displayName || serviceUUID, serviceUUID, `${displayName}`);

  characteristics.forEach(function(characteristic) {
    if (characteristic.UUID != '00000023-0000-1000-8000-0026BB765291') // Characteristic.Name.UUID, already present in all Services
      service.addCharacteristic(characteristic);
  });

  return service;
}

export function parseCharacteristicJSON(json: any) {
  const characteristicUUID = json.cType;

  const characteristic = new Characteristic(json.manfDescription || characteristicUUID, characteristicUUID, {
    format: json.format, // example: "int"
    minValue: json.designedMinValue,
    maxValue: json.designedMaxValue,
    minStep: json.designedMinStep,
    unit: json.unit,
    perms: json.perms // example: ["pw","pr","ev"]
  });

  // copy simple properties
  characteristic.value = json.initialValue;

  // monkey-patch legacy "locals" property which used to exist.
  // @ts-ignore
  characteristic.locals = json.locals;

  const updateFunc = json.onUpdate; // optional function(value)
  const readFunc = json.onRead; // optional function(callback(value))
  const registerFunc = json.onRegister; // optional function

  if (updateFunc) {
    characteristic.on(CharacteristicEventTypes.SET, (value: CharacteristicValue, callback: CharacteristicSetCallback) => {
      updateFunc(value);
      callback && callback();
    });
  }

  if (readFunc) {
    characteristic.on(CharacteristicEventTypes.GET, (callback: CharacteristicGetCallback) => {
      readFunc((value: any) => {
        callback(null, value); // old onRead callbacks don't use Error as first param
      });
    });
  }

  if (registerFunc) {
    registerFunc(characteristic);
  }

  return characteristic;
}


text:
import arcpy
import os
from arcpy.sa import *

arcpy.CheckOutExtension("Spatial")

class TerrainToolsCalculateSlopeVariability(object):
    """This class has the methods you need to define
       to use your code as an ArcGIS Python Tool."""

    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Calculate the variability of slope"
        self.description = """# Equation taken from http://gis4geomorphology.com/roughness-topographic-position/
        Slope Variability, Best calculated using a slope raster and a relatively large roving window (>100m),
        slope variability (SV = Smax - Smin) is a measure of the relief of slope of a landscape
        (Ruszkiczay-Rudiger et al., 2009).
        """
        self.canRunInBackground = True
        self.category = "Terrain Tools"  # Use your own category here, or an existing one.

    def getParameterInfo(self):
        params = []

        input_slope = arcpy.Parameter(name="input_slope",
                                       displayName="Input Slope Raster",
                                       datatype="DERasterDataset",
                                       parameterType="Required",
                                       direction="Input",
                                       )
        input_slope.value = "D:\Example\TerrainToolsCalculateSlopeVariability\slope_deg"
        params.append(input_slope)

        output_directory = arcpy.Parameter(name="output_directory",
                                       displayName="Output Directory",
                                       datatype="DEWorkspace",
                                       parameterType="Required",
                                       direction="Output",
                                       )
        output_directory.value = "D:\Example\TerrainToolsCalculateSlopeVariability\/"
        params.append(output_directory)

        focal_neighbourhood = arcpy.Parameter(name="focal_neighbourhood",
                                           displayName="Focal Neighbourhood",
                                           datatype="GPSANeighborhood",
                                           parameterType="Required",
                                           direction="Output",
                                           )
        focal_neighbourhood.value = "Rectangle 3 3 CELL"
        params.append(focal_neighbourhood)

        return params

    def isLicensed(self):
        """Set whether tool is licensed to execute."""
        return True

    #def updateParameters(self, parameters):

        #return

    def updateMessages(self, parameters):
        """Modify the messages created by internal validation for each tool
        parameter.  This method is called after internal validation."""
        return

    def execute(self, parameters, messages):
        """The source code of your tool."""
        arcpy.env.overwriteOutput = True

        for param in parameters:
            arcpy.AddMessage("Parameter: %s = %s" % (param.name, param.valueAsText) )

        input_slope = parameters[0].valueAsText
        output_directory = parameters[1].valueAsText
        focal_neighbourhood = parameters[2].valueAsText

        if not os.path.exists(output_directory):
            os.makedirs(output_directory)

        Smax = FocalStatistics(input_slope, focal_neighbourhood, "MAXIMUM", "DATA")
        Smin = FocalStatistics(input_slope, focal_neighbourhood, "MINIMUM", "DATA")

        slopevar = (Smax - Smin)
        slopevar.save(os.path.join(output_directory, "var_slope"))

        return

def main():
    tool = TerrainToolsCalculateSlopeVariability()
    tool.execute(tool.getParameterInfo(), None)

if __name__ == '__main__':
    main()


text:
var PageName = 'Run Query With Timepoints I - Standard';
var PageId = 'p23bd16b473ee4fb0a81738508ac9417f'
var PageUrl = 'Run_Query_With_Timepoints_I_-_Standard.html'
document.title = 'Run Query With Timepoints I - Standard';

if (top.location != self.location)
{
	if (parent.HandleMainFrameChanged) {
		parent.HandleMainFrameChanged();
	}
}

var $OnLoadVariable = '';

var $CSUM;

var hasQuery = false;
var query = window.location.hash.substring(1);
if (query.length > 0) hasQuery = true;
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
    var pair = vars[i].split("=");
    if (pair[0].length > 0) eval("$" + pair[0] + " = decodeURI(pair[1]);");
}

if (hasQuery && $CSUM != 1) {
alert('Prototype Warning: Variable values were truncated.');
}

function GetQuerystring() {
    return encodeURI('#OnLoadVariable=' + $OnLoadVariable + '&CSUM=1');
}

function PopulateVariables(value) {
  value = value.replace(/\[\[OnLoadVariable\]\]/g, $OnLoadVariable);
  value = value.replace(/\[\[PageName\]\]/g, PageName);
  return value;
}

function OnLoad() {

}

var u109 = document.getElementById('u109');
gv_vAlignTable['u109'] = 'center';
var u86 = document.getElementById('u86');

var u54 = document.getElementById('u54');
gv_vAlignTable['u54'] = 'top';
var u60 = document.getElementById('u60');
gv_vAlignTable['u60'] = 'top';
var u29 = document.getElementById('u29');

var u115 = document.getElementById('u115');
gv_vAlignTable['u115'] = 'top';
var u102 = document.getElementById('u102');

var u104 = document.getElementById('u104');

var u45 = document.getElementById('u45');

var u83 = document.getElementById('u83');

var u51 = document.getElementById('u51');

var u96 = document.getElementById('u96');
gv_vAlignTable['u96'] = 'top';
var u79 = document.getElementById('u79');

var u42 = document.getElementById('u42');
gv_vAlignTable['u42'] = 'top';
var u80 = document.getElementById('u80');
gv_vAlignTable['u80'] = 'top';
var u26 = document.getElementById('u26');
gv_vAlignTable['u26'] = 'top';
var u106 = document.getElementById('u106');

var u99 = document.getElementById('u99');

var u5 = document.getElementById('u5');

var u23 = document.getElementById('u23');

var u76 = document.getElementById('u76');
gv_vAlignTable['u76'] = 'top';
var u110 = document.getElementById('u110');

var u14 = document.getElementById('u14');
gv_vAlignTable['u14'] = 'top';
var u67 = document.getElementById('u67');

var u20 = document.getElementById('u20');
gv_vAlignTable['u20'] = 'top';
var u73 = document.getElementById('u73');

var u48 = document.getElementById('u48');
gv_vAlignTable['u48'] = 'top';
var u4 = document.getElementById('u4');

var u11 = document.getElementById('u11');

var u64 = document.getElementById('u64');
gv_vAlignTable['u64'] = 'top';
var u70 = document.getElementById('u70');
gv_vAlignTable['u70'] = 'top';
var u39 = document.getElementById('u39');

var u119 = document.getElementById('u119');
gv_vAlignTable['u119'] = 'top';
var u87 = document.getElementById('u87');
gv_vAlignTable['u87'] = 'top';
var u55 = document.getElementById('u55');

var u93 = document.getElementById('u93');
gv_vAlignTable['u93'] = 'top';
var u61 = document.getElementById('u61');

var u116 = document.getElementById('u116');

var u103 = document.getElementById('u103');
gv_vAlignTable['u103'] = 'center';
var u107 = document.getElementById('u107');
gv_vAlignTable['u107'] = 'center';
var u84 = document.getElementById('u84');
gv_vAlignTable['u84'] = 'top';
var u52 = document.getElementById('u52');
gv_vAlignTable['u52'] = 'top';
var u90 = document.getElementById('u90');

var u36 = document.getElementById('u36');
gv_vAlignTable['u36'] = 'top';
var u89 = document.getElementById('u89');
gv_vAlignTable['u89'] = 'top';
var u81 = document.getElementById('u81');

var u27 = document.getElementById('u27');

var u33 = document.getElementById('u33');

var u101 = document.getElementById('u101');
gv_vAlignTable['u101'] = 'center';
var u0 = document.getElementById('u0');

var u24 = document.getElementById('u24');
gv_vAlignTable['u24'] = 'top';
var u77 = document.getElementById('u77');

var u30 = document.getElementById('u30');
gv_vAlignTable['u30'] = 'top';
var u100 = document.getElementById('u100');

var u58 = document.getElementById('u58');
gv_vAlignTable['u58'] = 'top';
var u15 = document.getElementById('u15');

var u21 = document.getElementById('u21');

var u74 = document.getElementById('u74');
gv_vAlignTable['u74'] = 'top';
var u49 = document.getElementById('u49');

var u12 = document.getElementById('u12');
gv_vAlignTable['u12'] = 'top';
var u65 = document.getElementById('u65');

var u71 = document.getElementById('u71');

var u121 = document.getElementById('u121');
gv_vAlignTable['u121'] = 'top';
var u94 = document.getElementById('u94');

var u62 = document.getElementById('u62');
gv_vAlignTable['u62'] = 'top';
var u46 = document.getElementById('u46');
gv_vAlignTable['u46'] = 'top';
var u126 = document.getElementById('u126');
gv_vAlignTable['u126'] = 'top';
var u117 = document.getElementById('u117');
gv_vAlignTable['u117'] = 'top';
var u85 = document.getElementById('u85');

var u120 = document.getElementById('u120');

var u91 = document.getElementById('u91');
gv_vAlignTable['u91'] = 'top';
var u125 = document.getElementById('u125');
gv_vAlignTable['u125'] = 'top';
var u37 = document.getElementById('u37');

var u43 = document.getElementById('u43');

var u17 = document.getElementById('u17');

var u18 = document.getElementById('u18');
gv_vAlignTable['u18'] = 'top';
var u82 = document.getElementById('u82');
gv_vAlignTable['u82'] = 'top';
var u1 = document.getElementById('u1');
gv_vAlignTable['u1'] = 'center';
var u34 = document.getElementById('u34');
gv_vAlignTable['u34'] = 'top';
var u40 = document.getElementById('u40');
gv_vAlignTable['u40'] = 'top';
var u68 = document.getElementById('u68');
gv_vAlignTable['u68'] = 'top';
var u25 = document.getElementById('u25');

var u31 = document.getElementById('u31');

var u97 = document.getElementById('u97');
gv_vAlignTable['u97'] = 'top';
var u59 = document.getElementById('u59');

var u22 = document.getElementById('u22');
gv_vAlignTable['u22'] = 'top';
var u75 = document.getElementById('u75');

var u88 = document.getElementById('u88');

var u8 = document.getElementById('u8');
gv_vAlignTable['u8'] = 'top';
var u112 = document.getElementById('u112');

var u72 = document.getElementById('u72');
gv_vAlignTable['u72'] = 'top';
var u56 = document.getElementById('u56');
gv_vAlignTable['u56'] = 'top';
var u95 = document.getElementById('u95');
gv_vAlignTable['u95'] = 'top';
var u122 = document.getElementById('u122');

var u108 = document.getElementById('u108');

var u113 = document.getElementById('u113');
gv_vAlignTable['u113'] = 'top';
var u47 = document.getElementById('u47');

var u53 = document.getElementById('u53');

var u114 = document.getElementById('u114');

var u28 = document.getElementById('u28');
gv_vAlignTable['u28'] = 'top';
var u92 = document.getElementById('u92');

var u2 = document.getElementById('u2');
gv_vAlignTable['u2'] = 'top';
var u124 = document.getElementById('u124');

var u44 = document.getElementById('u44');
gv_vAlignTable['u44'] = 'top';
var u50 = document.getElementById('u50');
gv_vAlignTable['u50'] = 'top';
var u19 = document.getElementById('u19');

var u78 = document.getElementById('u78');
gv_vAlignTable['u78'] = 'top';
var u7 = document.getElementById('u7');

var u41 = document.getElementById('u41');

var u111 = document.getElementById('u111');
gv_vAlignTable['u111'] = 'top';
var u69 = document.getElementById('u69');

var u123 = document.getElementById('u123');
gv_vAlignTable['u123'] = 'top';
var u32 = document.getElementById('u32');
gv_vAlignTable['u32'] = 'top';
var u16 = document.getElementById('u16');
gv_vAlignTable['u16'] = 'top';
var u98 = document.getElementById('u98');

var u9 = document.getElementById('u9');

var u13 = document.getElementById('u13');

var u66 = document.getElementById('u66');
gv_vAlignTable['u66'] = 'top';
var u105 = document.getElementById('u105');
gv_vAlignTable['u105'] = 'center';
var u6 = document.getElementById('u6');
gv_vAlignTable['u6'] = 'top';
var u35 = document.getElementById('u35');

var u57 = document.getElementById('u57');

var u10 = document.getElementById('u10');
gv_vAlignTable['u10'] = 'top';
var u63 = document.getElementById('u63');

var u38 = document.getElementById('u38');
gv_vAlignTable['u38'] = 'top';
var u118 = document.getElementById('u118');

var u3 = document.getElementById('u3');
gv_vAlignTable['u3'] = 'top';
if (window.OnLoad) OnLoad();


text:
using System;
using System.Windows.Controls;
using System.Windows.Input;

namespace NoelPush.Objects.ViewModel
{
    /// <summary>
    /// View model containing a <see cref="ICommand"/>.
    /// <para>
    /// This view model can be used to add information for the diplay of a
    /// command in a view.
    /// </para>
    /// <para>
    /// Each property of this view model can be binded as needed.
    /// </para>
    /// </summary>
    public class CommandViewModel : ViewModelBase
    {
        private string iconUri;

        /// <summary>
        /// The command contained in the view model.
        /// </summary>
        public ICommand Command { get; set; }

        /// <summary>
        /// The icon to display for the command.
        /// </summary>
        public Image Icon { get; set; }

        /// <summary>
        /// The URI of the icon to diaply for the command.
        /// </summary>
        public string IconUri
        {
            get { return this.iconUri; }
            set
            {
                this.iconUri = value;
                this.OnPropertyChanged(NameOf<CommandViewModel>.Property(v => v.IconUri));
            }
        }

        /// <summary>
        /// Content of the dialog linked to the command.
        /// </summary>
        public Control DialogContent { get; set; }

        /// <summary>
        /// Indicates if the command is expected to take some time to execute.
        /// </summary>
        public bool IsHeavyCommand { get; set; }

        /// <summary>
        /// Indicates if the command can be executed.
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// Creates a new instance of CommandViewModel.
        /// </summary>
        /// <param name="displayName">The name to display for the command.</param>
        public CommandViewModel(string displayName)
        {
            this.DisplayName = displayName;
        }

        /// <summary>
        /// Creates a new instance of CommandViewModel.
        /// </summary>
        /// <param name="displayName">The name to display for the command.</param>
        /// <param name="icon">The icon to display for the command.</param>
        public CommandViewModel(string displayName, Image icon)
            : this(displayName)
        {
            this.Icon = icon;
        }

        /// <summary>
        /// Creates a new instance of CommandViewModel.
        /// </summary>
        /// <param name="displayName">The name to display for the command.</param>
        /// <param name="command">The command to associate to the view model.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="command"/> is null.</exception>
        public CommandViewModel(string displayName, ICommand command)
            : this(displayName)
        {
            if (command == null)
                throw new ArgumentNullException("command");

            this.Command = command;
        }

        /// <summary>
        /// Creates a new instance of CommandViewModel.
        /// </summary>
        /// <param name="displayName">The name to display for the command.</param>
        /// <param name="command">The command to associate to the view model.</param>
        /// <param name="icon">The icon to display for the command.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="command"/> is null.</exception>
        public CommandViewModel(string displayName, ICommand command, Image icon)
            : this(displayName, command)
        {
            this.Icon = icon;
        }

        /// <summary>
        /// Creates a new instance of CommandViewModel.
        /// </summary>
        /// <param name="displayName">The name to display for the command.</param>
        /// <param name="command">The command to associate to the view model.</param>
        /// <param name="iconUri">The URI of the icon to display for the command.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="command"/> is null.</exception>
        public CommandViewModel(string displayName, ICommand command, string iconUri)
            : this(displayName, command)
        {
            this.IconUri = iconUri;
        }
    }
}


text:
    From date

        <input
            id="from-date"
            class="data-catalog-date-input from-date form-control"
            value="{{fromDate}}"
        />
        {% if fromDate %}

        {% endif %}

    To date

        <input
            id="to-date"
            class="data-catalog-date-input to-date form-control"
            value="{{toDate}}"
        />
        {% if toDate %}

        {% endif %}

{% if not isValid %}

From date must be earlier than To date

{% endif %}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3074
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Uncas.EBS.UI.Controls {

    /// <summary>
    /// Designer class for the color code control.
    /// </summary>
    public partial class ColorCodes {

        /// <summary>
        /// rlInProgress control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Uncas.EBS.UI.Controls.ResourceLabel rlInProgress;

        /// <summary>
        /// rlNotStarted control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Uncas.EBS.UI.Controls.ResourceLabel rlNotStarted;

        /// <summary>
        /// rlNoTasks control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::Uncas.EBS.UI.Controls.ResourceLabel rlNoTasks;
    }
}


text:
<?php

/**
 * @file
 * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\DecimalFormatter.
 */

namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;

use Drupal\Core\Form\FormStateInterface;

/**
 * Plugin implementation of the 'number_decimal' formatter.
 *
 * The 'Default' formatter is different for integer fields on the one hand, and
 * for decimal and float fields on the other hand, in order to be able to use
 * different settings.
 *
 * @FieldFormatter(
 *   id = "number_decimal",
 *   label = @Translation("Default"),
 *   field_types = {
 *     "decimal",
 *     "float"
 *   }
 * )
 */
class DecimalFormatter extends NumericFormatterBase {

  /**
   * {@inheritdoc}
   */
  public static function defaultSettings() {
    return array(
      'thousand_separator' => '',
      'decimal_separator' => '.',
      'scale' => 2,
      'prefix_suffix' => TRUE,
    ) + parent::defaultSettings();
  }

  /**
   * {@inheritdoc}
   */
  public function settingsForm(array $form, FormStateInterface $form_state) {
    $elements = parent::settingsForm($form, $form_state);

    $elements['decimal_separator'] = array(
      '#type' => 'select',
      '#title' => t('Decimal marker'),
      '#options' => array('.' => t('Decimal point'), ',' => t('Comma')),
      '#default_value' => $this->getSetting('decimal_separator'),
      '#weight' => 5,
    );
    $range = range(0, 10);
    $elements['scale'] = array(
      '#type' => 'select',
      '#title' => t('Scale', array(), array('decimal places')),
      '#options' => array_combine($range, $range),
      '#default_value' => $this->getSetting('scale'),
      '#description' => t('The number of digits to the right of the decimal.'),
      '#weight' => 6,
    );

    return $elements;
  }

  /**
   * {@inheritdoc}
   */
  protected function numberFormat($number) {
    return number_format($number, $this->getSetting('scale'), $this->getSetting('decimal_separator'), $this->getSetting('thousand_separator'));
  }

}


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import update from 'immutability-helper';
import Sticky from 'react-sticky-el';
import './Action.scss';

import Record from '../Record/Record';
import Attributes from '../Attribute/Attributes';
import EditorForm from '../EditorForm/EditorForm';
import Popup from '../../../components/Popup';
import Dropdown from '../../../components/Dropdown';
// import DropdownInput from '../DropdownInput/DropdownInput';
import DeleteView from '../DeleteView/DeleteView';
import ReorderView from '../Reorder/ReorderView';
import ImportView from '../ImportView/ImportView';

export class Action extends Component {
  constructor(props) {
    super(props);
    this.onTypeChange = this.onTypeChange.bind(this);
    this.onTypeInputChange = this.onTypeInputChange.bind(this);
    this.onTypeSpecifierChange = this.onTypeSpecifierChange.bind(this);
    this.createRecord = this.createRecord.bind(this);
    this.cancelRecordCreation = this.cancelRecordCreation.bind(this);
    this.editActionForm = this.editActionForm.bind(this);
    this.editActionWithForm = this.editActionWithForm.bind(this);
    this.complementRecordForm = this.complementRecordForm.bind(this);
    this.cancelRecordComplement = this.cancelRecordComplement.bind(this);
    this.updateTypeSpecifier = this.updateTypeSpecifier.bind(this);
    this.updateActionType = this.updateActionType.bind(this);
    this.updateActionAttribute = this.updateActionAttribute.bind(this);
    this.renderActionButtons = this.renderActionButtons.bind(this);
    this.renderBasicAttributes = this.renderBasicAttributes.bind(this);
    this.disableEditMode = this.disableEditMode.bind(this);
    this.onEditFormShowMoreAction = this.onEditFormShowMoreAction.bind(this);
    this.onEditFormShowMoreRecordAdd = this.onEditFormShowMoreRecordAdd.bind(
      this
    );
    this.complementRecordAdd = this.complementRecordAdd.bind(this);
    this.scrollToAction = this.scrollToAction.bind(this);
    this.scrollToRecord = this.scrollToRecord.bind(this);
    this.updateTopOffsetForSticky = this.updateTopOffsetForSticky.bind(this);

    this.state = {
      attributes: this.props.action.attributes,
      complementingAction: false,
      complementingRecordAdd: false,
      creatingRecord: false,
      deleting: false,
      editingAction: false,
      editingType: false,
      editingTypeSpecifier: false,
      mode: 'view',
      record: null,
      showImportView: false,
      showReorderView: false,
      type: this.props.action.attributes.ActionType || null,
      typeSpecifier: this.props.action.attributes.TypeSpecifier || null,
      complementRecordAdd: false,
      topOffset: 0
    };

    this.records = {};
  }

  UNSAFE_componentWillReceiveProps(nextProps) {
    if (nextProps.action && nextProps.action.attributes.TypeSpecifier) {
      this.setState({
        typeSpecifier: nextProps.action.attributes.TypeSpecifier
      });
    }
    if (nextProps.action && nextProps.action.attributes.ActionType) {
      this.setState({ type: nextProps.action.attributes.ActionType });
    }
    if (nextProps.documentState === 'view') {
      this.disableEditMode();
    }
  }

  updateTopOffsetForSticky() {
    // calculates heights for elements that are already sticking
    // (navigation menu, tos header and phase title)
    const headerEl = document.getElementById('single-tos-header-container');
    const headerHeight = headerEl ? headerEl.getBoundingClientRect().height : 0;
    const menuEl = document.getElementById('navigation-menu');
    const menuHeight = menuEl ? menuEl.getBoundingClientRect().height : 0;
    const phaseTitles = document.getElementsByClassName('phase-title-sticky');
    let phaseTitleHeight = 35; // magic number for a title that fits on one row
    if (phaseTitles.length) {
      phaseTitleHeight = phaseTitles[
        phaseTitles.length - 1
      ].getBoundingClientRect().height;
    }
    this.setState({ topOffset: headerHeight + menuHeight + phaseTitleHeight });
  }

  componentDidMount() {
    this.updateTopOffsetForSticky();
    window.addEventListener('resize', this.updateTopOffsetForSticky);
  }

  componentWillUnmount() {
    window.removeEventListener('resize', this.updateTopOffsetForSticky);
  }

  onEditFormShowMoreAction(e) {
    e.preventDefault();
    this.setState((prevState) => ({
      complementingAction: !prevState.complementingAction,
      editingAction: !prevState.editingAction
    }));
  }

  toggleReorderView() {
    const current = this.state.showReorderView;
    this.setState({ showReorderView: !current });
  }

  toggleImportView() {
    const current = this.state.showImportView;
    this.setState({ showImportView: !current });
  }

  editTypeSpecifier() {
    if (this.props.documentState === 'edit') {
      this.setState({ editingTypeSpecifier: true, mode: 'edit' });
    }
  }

  editType() {
    if (this.props.documentState === 'edit') {
      this.setState({ editingType: true, mode: 'edit' });
    }
  }

  editActionForm() {
    if (this.props.documentState === 'edit') {
      this.setState({ editingAction: true, mode: 'edit' });
    }
  }

  complementRecordAdd() {
    if (this.props.documentState !== 'edit') {
      this.setState({ complementRecordAdd: true });
    }
  }

  disableEditMode() {
    this.setState({
      editingTypeSpecifier: false,
      editingType: false,
      editingAction: false,
      complementingAction: false,
      mode: 'view'
    });
  }

  onTypeSpecifierChange(event) {
    this.setState({ typeSpecifier: event.target.value });
  }

  onTypeChange(value) {
    this.setState(
      update(this.state, {
        type: {
          $set: value
        }
      })
    );
  }

  onTypeInputChange(event) {
    this.setState({ type: event.target.value });
  }

  updateTypeSpecifier(event) {
    event.preventDefault();
    const updatedTypeSpecifier = {
      typeSpecifier: this.state.typeSpecifier,
      actionId: this.props.action.id
    };
    this.props.editActionAttribute(updatedTypeSpecifier);
    this.disableEditMode();
  }

  updateActionType(event) {
    event.preventDefault();
    const updatedActionType = {
      type: this.state.type,
      actionId: this.props.action.id
    };
    this.props.editActionAttribute(updatedActionType);
    this.disableEditMode();
  }

  updateActionAttribute(attribute, attributeIndex, actionId) {
    this.setState({
      attributes: {
        [attributeIndex]: attribute
      }
    });
    const updatedActionAttribute = { attribute, attributeIndex, actionId };
    this.props.editActionAttribute(updatedActionAttribute);
  }

  editActionWithForm(attributes, actionId, disableEditMode = true) {
    this.setState({
      attributes: attributes,
      typeSpecifier: attributes.TypeSpecifier,
      type: attributes.ActionType
    });
    this.props.editAction(attributes, actionId);
    if (disableEditMode) {
      this.disableEditMode();
    }
  }

  createNewRecord() {
    this.setState({ creatingRecord: true, record: { attributes: {} } });
  }

  cancelRecordCreation() {
    this.setState({ creatingRecord: false });
  }

  complementRecordForm(e, recordAttributes) {
    e.preventDefault();
    const newAttrs = {};
    Object.keys(recordAttributes).forEach((key) => {
      if (recordAttributes[key] && recordAttributes[key]['value']) {
        Object.assign(newAttrs, { [key]: recordAttributes[key]['value'] });
      }
    });
    this.setState(
      {
        record: {
          ...this.state.record,
          attributes: newAttrs
        }
      },
      () => {
        this.setState({
          complementingRecordAdd: !this.state.complementingRecordAdd,
          creatingRecord: !this.state.creatingRecord
        });
      }
    );
  }

  onEditFormShowMoreRecordAdd(e, recordAttributes) {
    // TODO: handle merge the attributes of createNewRecordForm here
    e.preventDefault();
    const newAttrs = {};
    Object.keys(recordAttributes).forEach((key) => {
      if (recordAttributes[key] && recordAttributes[key]['value']) {
        Object.assign(newAttrs, { [key]: recordAttributes[key]['value'] });
      }
    });
    this.setState(
      {
        record: {
          ...this.state.record,
          attributes: newAttrs
        }
      },
      () => {
        this.setState({
          complementingRecordAdd: !this.state.complementingRecordAdd,
          creatingRecord: !this.state.creatingRecord
        });
      }
    );
  }

  cancelRecordComplement() {
    this.setState({
      complementingRecordAdd: false,
      recordId: undefined
    });
  }

  delete() {
    this.setState({ deleting: false });
    this.props.removeAction(this.props.action.id, this.props.action.phase);
  }

  cancelDeletion() {
    this.setState({ deleting: false });
  }

  createRecord(attributes, actionId) {
    this.setState({
      creatingRecord: false,
      complementingRecordAdd: false
    });
    this.props.addRecord(attributes, actionId);
  }

  generateRecords(records) {
    const elements = [];
    Object.keys(records).forEach((key) => {
      if (this.props.records.hasOwnProperty(records[key])) {
        elements.push(
          <Record
            key={key}
            record={this.props.records[records[key]]}
            editRecord={this.props.editRecord}
            editRecordAttribute={this.props.editRecordAttribute}
            removeRecord={this.props.removeRecord}
            recordTypes={this.props.recordTypes}
            documentState={this.props.documentState}
            attributeTypes={this.props.attributeTypes}
            displayMessage={this.props.displayMessage}
            setRecordVisibility={this.props.setRecordVisibility}
            ref={(element) => {
              this.records[records[key]] = element;
            }}
          />
        );
      }
    });
    return elements;
  }

  generateDropdownItems() {
    return [
      {
        text: 'Uusi asiakirja',
        icon: 'fa-file-text',
        style: 'btn-primary',
        action: () => this.createNewRecord()
      },
      {
        text: 'Muokkaa toimenpidettä',
        icon: 'fa-pencil',
        style: 'btn-primary',
        action: () => this.editActionForm()
      },
      // {
      //   text: 'Täydennä metatietoja',
      //   icon: 'fa-plus-square',
      //   style: 'btn-primary',
      //   action: () => this.complementActionForm()
      // },
      {
        text: 'Järjestä asiakirjoja',
        icon: 'fa-th-list',
        style: 'btn-primary',
        action: () => this.toggleReorderView()
      },
      {
        text: 'Tuo asiakirjoja',
        icon: 'fa-download',
        style: 'btn-primary',
        action: () => this.toggleImportView()
      },
      {
        text: 'Poista toimenpide',
        icon: 'fa-trash',
        style: 'btn-delete',
        action: () => this.setState({ deleting: true })
      }
    ];
  }

  showAttributeButton(attributes) {
    const { attributeTypes } = this.props;
    const actualAttributes = [];
    Object.keys(attributes).forEach((key) => {
      if (key !== 'TypeSpecifier' && key !== 'ActionType') {
        actualAttributes.push(key);
      }
    });
    Object.keys(attributeTypes).forEach((key) => {
      if (
        attributeTypes.hasOwnProperty(key) &&
        attributeTypes[key].defaultIn.indexOf('action') >= 0
      ) {
        actualAttributes.push(key);
      }
    });
    if (actualAttributes.length) {
      return true;
    }
    return false;
  }

  renderActionButtons() {
    const actionDropdownItems = this.generateDropdownItems();

    return (

        {this.props.documentState === 'edit' && (

            <Dropdown items={actionDropdownItems} extraSmall={true} />

        )}
        {this.showAttributeButton(this.props.action.attributes) && (
          <button
            className='btn btn-info btn-xs record-button pull-right'
            onClick={() =>
              this.props.setActionVisibility(
                this.props.action.id,
                !this.props.action.is_open
              )
            }
          >

          </button>
        )}

    );
  }

  renderBasicAttributes() {
    const classNames = classnames([
      'col-xs-12',
      'basic-attribute',
      this.props.documentState === 'edit' ? 'editable' : null
    ]);
    let typeSpecifier = (
       this.editTypeSpecifier()}>
        {this.state.typeSpecifier}

    );
    // let actionType =
    //   ( this.editType()}>
    //     {this.state.type}
    //
    // );

    if (this.state.mode === 'edit') {
      if (this.state.editingTypeSpecifier) {
        typeSpecifier = (

            <form onSubmit={this.updateTypeSpecifier}>
              <input
                className='input-title form-control col-xs-11'
                value={this.state.typeSpecifier || ''}
                onChange={this.onTypeSpecifierChange}
                onBlur={this.updateTypeSpecifier}
                autoFocus={true}
              />
            </form>

        );
      }
      // if (this.state.editingType) {
      //   actionType = (
      //

      //       <form onSubmit={this.updateActionType}>
      //         <DropdownInput
      //           type={'action'}
      //           valueState={this.state.type}
      //           options={this.props.actionTypes}
      //           onChange={this.onTypeChange}
      //           onInputChange={this.onTypeInputChange}
      //           onSubmit={this.updateActionType}
      //         />
      //       </form>
      //

      //   );
      // }
    }

    if (this.props.action.is_open && this.props.action.records.length) {
      return (
        <Sticky
          topOffset={-1 * this.state.topOffset}
          bottomOffset={this.state.topOffset}
          boundaryElement='.actions '
          hideOnBoundaryHit={true}
          stickyStyle={{
            position: 'fixed',
            top: this.state.topOffset,
            left: 0
          }}
          stickyClassName='action-title-sticky'
          className='action-title action-open'
        >

{typeSpecifier}

        </Sticky>
      );
    }

    return (

{typeSpecifier}

    );
  }

  getTargetText(value) {
    if (value === undefined) {
      return '';
    }
    return value;
  }

  scrollToAction() {
    if (this.element) {
      const parentOffset = this.element.offsetParent
        ? this.element.offsetParent.offsetTop
        : 0;
      window.scrollTo(0, parentOffset + this.element.offsetTop);
    }
  }

  scrollToRecord(recordId) {
    const record = this.records[recordId] || null;
    if (this.element && record) {
      const parentOffset = this.element.offsetParent
        ? this.element.offsetParent.offsetTop
        : 0;
      record.scrollToRecord(parentOffset + this.element.offsetTop);
    }
  }

  render() {
    // TODO: Handle errors where we don't have an valid action (i.e 400 error from API)
    const { action } = this.props;
    const recordElements =
      action && action.records ? this.generateRecords(action.records) : [];

    return (

 {
          this.element = element;
        }}
      >
        {this.state.mode === 'edit' && this.state.editingAction && (
          <EditorForm
            onShowMore={this.onEditFormShowMoreAction}
            targetId={this.props.action.id}
            attributes={this.props.action.attributes}
            attributeTypes={this.props.attributeTypes}
            elementConfig={{
              elementTypes: this.props.actionTypes,
              editWithForm: this.editActionWithForm
            }}
            editorConfig={{
              type: 'action',
              action: 'edit'
            }}
            closeEditorForm={this.disableEditMode}
            displayMessage={this.props.displayMessage}
          />
        )}
        {this.state.mode === 'edit' && this.state.complementingAction && (
          <EditorForm
            onShowMore={this.onEditFormShowMoreAction}
            targetId={this.props.action.id}
            attributes={this.props.action.attributes}
            attributeTypes={this.props.attributeTypes}
            elementConfig={{
              elementTypes: this.props.actionTypes,
              editWithForm: this.editActionWithForm
            }}
            editorConfig={{
              type: 'action',
              action: 'complement'
            }}
            closeEditorForm={this.disableEditMode}
            displayMessage={this.props.displayMessage}
          />
        )}
        {!this.state.editingAction && !this.state.complementingAction && (

              <Attributes
                element={action}
                documentState={this.props.documentState}
                type={'action'}
                attributeTypes={this.props.attributeTypes}
                typeOptions={this.props.actionTypes}
                renderBasicAttributes={this.renderBasicAttributes}
                renderButtons={this.renderActionButtons}
                updateTypeSpecifier={this.updateTypeSpecifier}
                updateType={this.updateActionType}
                updateAttribute={this.updateActionAttribute}
                showAttributes={action.is_open}
              />
              {this.state.creatingRecord && (
                <EditorForm
                  onShowMoreForm={this.complementRecordForm}
                  targetId={this.props.action.id}
                  attributes={this.state.record.attributes}
                  attributeTypes={this.props.attributeTypes}
                  elementConfig={{
                    elementTypes: this.props.recordTypes,
                    createRecord: this.createRecord
                  }}
                  editorConfig={{
                    type: 'record',
                    action: 'add'
                  }}
                  closeEditorForm={this.cancelRecordCreation}
                  displayMessage={this.props.displayMessage}
                />
              )}
              {this.state.complementingRecordAdd && (
                <EditorForm
                  onShowMoreForm={this.onEditFormShowMoreRecordAdd}
                  targetId={this.props.action.id}
                  attributes={this.state.record.attributes}
                  attributeTypes={this.props.attributeTypes}
                  elementConfig={{
                    elementTypes: this.props.recordTypes,
                    createRecord: this.createRecord
                  }}
                  editorConfig={{
                    type: 'record',
                    action: 'complement',
                    from: 'newRecord'
                  }}
                  complementRecordAdd={this.complementRecordAdd}
                  closeEditorForm={this.cancelRecordComplement}
                  displayMessage={this.props.displayMessage}
                />
              )}

            {!!recordElements.length && (

Asiakirjat

                  {recordElements}

            )}

        )}
        {this.state.deleting && (
          <Popup
            content={
              <DeleteView
                type='action'
                target={this.state.typeSpecifier || this.state.type || '---'}
                action={() => this.delete()}
                cancel={() => this.cancelDeletion()}
              />
            }
            closePopup={() => this.cancelDeletion()}
          />
        )}
        {this.state.showReorderView && (
          <Popup
            content={
              <ReorderView
                target='record'
                toggleReorderView={() => this.toggleReorderView()}
                keys={this.props.action.records}
                values={this.props.records}
                changeOrder={this.props.changeOrder}
                parent={this.props.action.id}
                attributeTypes={this.props.attributeTypes}
                parentName={this.state.typeSpecifier || this.state.type}
              />
            }
            closePopup={() => this.toggleReorderView()}
          />
        )}
        {this.state.showImportView && (
          <Popup
            content={
              <ImportView
                level='record'
                toggleImportView={() => this.toggleImportView()}
                title='asiakirjoja'
                targetText={
                  'toimenpiteeseen "' +
                  this.getTargetText(action.attributes.TypeSpecifier) +
                  '"'
                }
                itemsToImportText='asiakirjat'
                phasesOrder={this.props.phasesOrder}
                phases={this.props.phases}
                actions={this.props.actions}
                records={this.props.records}
                importItems={this.props.importItems}
                parent={action.id}
                parentName={action.name}
              />
            }
            closePopup={() => this.toggleImportView()}
          />
        )}

    );
  }
}

Action.propTypes = {
  action: PropTypes.object.isRequired,
  actionTypes: PropTypes.object.isRequired,
  actions: PropTypes.object.isRequired,
  addRecord: PropTypes.func.isRequired,
  attributeTypes: PropTypes.object.isRequired,
  changeOrder: PropTypes.func.isRequired,
  displayMessage: PropTypes.func.isRequired,
  documentState: PropTypes.string.isRequired,
  editAction: PropTypes.func.isRequired,
  editActionAttribute: PropTypes.func.isRequired,
  editRecord: PropTypes.func.isRequired,
  editRecordAttribute: PropTypes.func.isRequired,
  importItems: PropTypes.func.isRequired,
  phases: PropTypes.object.isRequired,
  phasesOrder: PropTypes.array.isRequired,
  recordTypes: PropTypes.object.isRequired,
  records: PropTypes.object.isRequired,
  removeAction: PropTypes.func.isRequired,
  removeRecord: PropTypes.func.isRequired,
  setActionVisibility: PropTypes.func.isRequired,
  setRecordVisibility: PropTypes.func.isRequired
};

export default Action;


text:
package org.ewall;

import org.junit.* ;
import static org.junit.Assert.* ;
import org.ewall.app.HealthportDataProvider;

public class TestHealthportDataProvider {

	private static final String id = "Patient/3.568001602-01";
	private static HealthportDataProvider fhirdata;

	@BeforeClass
	public static void prepare()
	{
		System.out.println("Testing HealthPort...");
		System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "WARN");
		fhirdata = new HealthportDataProvider();
	}

	@Test
	public void test_LoadSomePatients() {
		assertTrue(fhirdata.getXPatients(33).size() == 33);
	}

	@Test
	public void test_LoadALlPatients() {
		assertTrue(fhirdata.getAllPatients().size() == 305);
	}

	@Test
	public void test_LoadObservations() {
		assertTrue(fhirdata.getAllObservationsForPatient(id).size() == 193);
	}

	@Test
	public void test_LoadConditions() {
		assertTrue(fhirdata.getAllConditionsForPatient(id).size() == 1);
	}

	@Test
	public void test_LoadPrescriptions() {
		assertTrue(fhirdata.getAllPrescriptionsForPatient(id).size() == 10);
	}

}


text:
test_name "C99964: no-ruby config field flag disables requiring Ruby" do
  tag 'risk:high'

  require 'facter/acceptance/user_fact_utils'
  extend Facter::Acceptance::UserFactUtils

  config = <<EOM
global : {
    no-ruby : true
}
EOM

  agents.each do |agent|
    step "Agent #{agent}: create config file" do
      config_dir = get_default_fact_dir(agent['platform'], on(agent, facter('kernelmajversion')).stdout.chomp.to_f)
      config_file = File.join(config_dir, "facter.conf")
      agent.mkdir_p(config_dir)
      create_remote_file(agent, config_file, config)

      teardown do
        agent.rm_rf(config_dir)
      end

      step "no-ruby option should disable Ruby and facts requiring Ruby" do
        on(agent, facter("ruby")) do |facter_output|
          assert_equal("", facter_output.stdout.chomp, "Expected Ruby and Ruby fact to be disabled")
          assert_equal("", facter_output.stderr.chomp, "Expected no warnings about Ruby on stderr")
        end
      end
    end
  end
end


text:
package com.tuzi80.holahola.command;

import java.util.ArrayList;

/**
 * Macro command.
 * Created by betsy on 2/20/17.
 */
public class MacroCommand extends Command {
    private ArrayList<Command> mCommandList = new ArrayList<Command>();

    public MacroCommand() {
        super();
        super.init("macro command");
    }

    public void execute() {

    }

    public void addCommand(Command command) {
        if (command != null) {
            mCommandList.add(command);
        }
    }

    public void removeCommand(Command command) {
        mCommandList.remove(command);
    }
}


text:
{
  it("has predefined global variable", () => {
    expect(global.definedInSetupFile).toEqual(true);
  });
}


text:
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
  <link rel="stylesheet" type="text/css" href="css/style.css">
  <script type="text/javascript" src="extjs/ext-all.js"></script>

  <script type="text/javascript" src="scripts/def.js"></script>
  <script type="text/javascript" src="scripts/containers.js"></script>
  <script type="text/javascript" src="scripts/app.js"></script>
</head>
<body>
</body>
</html>


text:
<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/place_holder"/>
    <item>
        <shape android:shape="rectangle">
            <corners android:radius="50dp" />
            <solid android:color="@android:color/transparent" />
        </shape>
    </item>
</layer-list>


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit57fb8c01b564c3afbf75419b7ab48710::getLoader();


text:
#pragma once
#include <aws/proton/Proton_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Proton
{
namespace Model
{

  /**
   *
Compatible environment template data.

See Also:
   AWS
   * API Reference

   */
  class AWS_PROTON_API CompatibleEnvironmentTemplateInput
  {
  public:
    CompatibleEnvironmentTemplateInput();
    CompatibleEnvironmentTemplateInput(Aws::Utils::Json::JsonView jsonValue);
    CompatibleEnvironmentTemplateInput& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The major version of the compatible environment template.

     */
    inline const Aws::String& GetMajorVersion() const{ return m_majorVersion; }

    /**
     *
The major version of the compatible environment template.

     */
    inline bool MajorVersionHasBeenSet() const { return m_majorVersionHasBeenSet; }

    /**
     *
The major version of the compatible environment template.

     */
    inline void SetMajorVersion(const Aws::String& value) { m_majorVersionHasBeenSet = true; m_majorVersion = value; }

    /**
     *
The major version of the compatible environment template.

     */
    inline void SetMajorVersion(Aws::String&& value) { m_majorVersionHasBeenSet = true; m_majorVersion = std::move(value); }

    /**
     *
The major version of the compatible environment template.

     */
    inline void SetMajorVersion(const char* value) { m_majorVersionHasBeenSet = true; m_majorVersion.assign(value); }

    /**
     *
The major version of the compatible environment template.

     */
    inline CompatibleEnvironmentTemplateInput& WithMajorVersion(const Aws::String& value) { SetMajorVersion(value); return *this;}

    /**
     *
The major version of the compatible environment template.

     */
    inline CompatibleEnvironmentTemplateInput& WithMajorVersion(Aws::String&& value) { SetMajorVersion(std::move(value)); return *this;}

    /**
     *
The major version of the compatible environment template.

     */
    inline CompatibleEnvironmentTemplateInput& WithMajorVersion(const char* value) { SetMajorVersion(value); return *this;}

    /**
     *
The compatible environment template name.

     */
    inline const Aws::String& GetTemplateName() const{ return m_templateName; }

    /**
     *
The compatible environment template name.

     */
    inline bool TemplateNameHasBeenSet() const { return m_templateNameHasBeenSet; }

    /**
     *
The compatible environment template name.

     */
    inline void SetTemplateName(const Aws::String& value) { m_templateNameHasBeenSet = true; m_templateName = value; }

    /**
     *
The compatible environment template name.

     */
    inline void SetTemplateName(Aws::String&& value) { m_templateNameHasBeenSet = true; m_templateName = std::move(value); }

    /**
     *
The compatible environment template name.

     */
    inline void SetTemplateName(const char* value) { m_templateNameHasBeenSet = true; m_templateName.assign(value); }

    /**
     *
The compatible environment template name.

     */
    inline CompatibleEnvironmentTemplateInput& WithTemplateName(const Aws::String& value) { SetTemplateName(value); return *this;}

    /**
     *
The compatible environment template name.

     */
    inline CompatibleEnvironmentTemplateInput& WithTemplateName(Aws::String&& value) { SetTemplateName(std::move(value)); return *this;}

    /**
     *
The compatible environment template name.

     */
    inline CompatibleEnvironmentTemplateInput& WithTemplateName(const char* value) { SetTemplateName(value); return *this;}

  private:

    Aws::String m_majorVersion;
    bool m_majorVersionHasBeenSet = false;

    Aws::String m_templateName;
    bool m_templateNameHasBeenSet = false;
  };

} // namespace Model
} // namespace Proton
} // namespace Aws


text:
/*
 * PopupPanel.h
 *
 * Created by Sajid Anwar.
 *
 * Subject to terms and conditions in LICENSE.md.
 *
 */

#import <Cocoa/Cocoa.h>
#import "PopupView.h"

@protocol PopupDelegate <NSObject>

- (void)popupWillShow;
- (void)popupWillClose;

@end

@class PopupView;

@interface PopupPanel : NSPanel<NSWindowDelegate>

@property (assign) id<PopupDelegate> popupDelegate;
@property (assign) IBOutlet PopupView *popupView;

- (void)showRelativeToRect:(NSRect)rect ofView:(NSView *)view preferredEdge:(NSRectEdge)edge;
- (BOOL)isActive;

- (void)closeAndNotify:(BOOL)notify;

@end


text:
<!doctype html>

   {% include head.html %}

    {% include nav.html %}

              {{ content }}

    {% include footer.html %}

    {% include scripts.html %}


text:
package org.apereo.cas.config;

import org.apache.commons.lang3.StringUtils;
import org.apereo.cas.authentication.AuthenticationServiceSelectionPlan;
import org.apereo.cas.authentication.AuthenticationServiceSelectionStrategy;
import org.apereo.cas.authentication.AuthenticationServiceSelectionStrategyConfigurer;
import org.apereo.cas.authentication.principal.ServiceFactory;
import org.apereo.cas.authentication.principal.WebApplicationService;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.support.saml.ShibbolethIdPEntityIdAuthenticationServiceSelectionStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * This is {@link ExternalShibbolethIdPAuthenticationServiceSelectionStrategyConfiguration}.
 *
 * @author Misagh Moayyed
 * @since 5.1.0
 */
@Configuration("externalShibbolethIdPAuthenticationServiceSelectionStrategyConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class ExternalShibbolethIdPAuthenticationServiceSelectionStrategyConfiguration implements AuthenticationServiceSelectionStrategyConfigurer {
    private static final Logger LOGGER = LoggerFactory.getLogger(ExternalShibbolethIdPAuthenticationServiceSelectionStrategyConfiguration.class);

    @Autowired
    private CasConfigurationProperties casProperties;

    @Autowired
    @Qualifier("webApplicationServiceFactory")
    private ServiceFactory<WebApplicationService> webApplicationServiceFactory;

    @ConditionalOnMissingBean(name = "shibbolethIdPEntityIdAuthenticationServiceSelectionStrategy")
    @Bean
    @RefreshScope
    public AuthenticationServiceSelectionStrategy shibbolethIdPEntityIdAuthenticationServiceSelectionStrategy() {
        return new ShibbolethIdPEntityIdAuthenticationServiceSelectionStrategy(webApplicationServiceFactory,
                casProperties.getAuthn().getShibIdp().getServerUrl());
    }

    @Override
    public void configureAuthenticationServiceSelectionStrategy(final AuthenticationServiceSelectionPlan plan) {
        if (StringUtils.isNotBlank(casProperties.getAuthn().getShibIdp().getServerUrl())) {
            plan.registerStrategy(shibbolethIdPEntityIdAuthenticationServiceSelectionStrategy());
        } else {
            LOGGER.warn("Shibboleth IdP url is not specified; External authentication requests by the IdP will not be recognized by CAS");
        }
    }
}


text:
var webpackConfig = require('./webpack.config.js');

module.exports = function(config) {
  config.set({
    files: [
        { pattern: './spec.bundle.js', watched: false }
    ],
    browsers: ['PhantomJS'],
    frameworks: ['mocha', 'chai', 'sinon'],
    preprocessors: {
      './spec.bundle.js': ['coverage', 'webpack', 'sourcemap']
    },
    reporters: ['mocha', 'coverage'],
    coverageReporter: {
      dir : './coverage',
      reporters: [
        { type: 'json', subdir: 'json' },
        { type: 'html', subdir: 'html' }
      ]
    },
    webpack: webpackConfig,
    webpackMiddleware: {
      stats: 'errors-only'
    },
    logLevel: config.LOG_ERROR,
    autoWatch: false,
    singleRun: true
  })
}


text:
package com.codeborne.selenide.commands;

import com.codeborne.selenide.SelenideElement;
import com.codeborne.selenide.impl.WebElementSource;
import org.assertj.core.api.WithAssertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

final class GetWrappedElementCommandTest implements WithAssertions {
  private final SelenideElement proxy = mock(SelenideElement.class);
  private final WebElementSource locator = mock(WebElementSource.class);
  private final SelenideElement mockedElement = mock(SelenideElement.class);
  private final GetWrappedElement getWrappedElementCommand = new GetWrappedElement();

  @BeforeEach
  void setup() {
    when(locator.getWebElement()).thenReturn(mockedElement);
  }

  @Test
  void testExecuteMethod() {
    assertThat(getWrappedElementCommand.execute(proxy, locator, new Object[]{"something more"}))
      .isEqualTo(mockedElement);
  }
}


text:
                            Package `net.db` -- working with networked Bee peers
-----------------------------------------------------------------------------------------

The ``net.db`` package contains connectors to remote database systems. One
variant, ``db.net.sql``, is for connecting to MySQL or MariaDB or PostgreSQL —
that variant is the subject of the :ref:`SQL DBMS plugins <dbms-plugins>` appendix.
In this section the subject is the built-in variant, ``db.net``. This is for
connecting to bee servers via a network.

Call ``require('net.db')`` to get a ``net.db`` object, which will be called
``net_db`` for examples in this section. Call ``net_db.new()`` to connect and
get a connection object, which will be called conn for examples in this section.
Call the other ``net.db()`` routines, passing ``conn:``, to execute requests on
the remote db. Call :func:`conn:close <socket_object.close>` to disconnect.

All `net.db`` methods are fiber-safe, that is, it is safe to share and use the
same connection object across multiple concurrent fibers. In fact, it's perhaps
the best programming practice with Bee. When multiple fibers use the same
connection, all requests are pipelined through the same network socket, but each
fiber gets back a correct response. Reducing the number of active sockets lowers
the overhead of system calls and increases the overall server performance. There
are, however, cases when a single connection is not enough — for example when it's
necessary to prioritize requests or to use different authentication ids.

.. module:: net_db

.. class:: conn

  conn = net_db:new(host, port [, {other parameter[s]}])

    Create a new connection. The connection is established on demand, at the
    time of the first request. It is re-established automatically after a
    disconnect. The returned conn object supports methods for making remote
    requests, such as select, update or delete.

    For the local bee server there is a pre-created always-established
    connection object named net_db.self. Its purpose is to make polymorphic
    use of the ``net_db`` API easier. Therefore ``conn = net_db:new('localhost', 3301)``
    can be replaced by ``conn = net_db.self``. However, there is an important
    difference between the embedded connection and a remote one. With the
    embedded connection, requests which do not modify data do not yield.
    When using a remote connection, any request can yield, and local database
    state may have changed by the time it returns.

    :param string host:
    :param number port:
    :param boolean wait_connect:
    :param string user:
    :param string password:
    :return: conn object
    :rtype:  userdata

    .. code-block:: lua

        EXAMPLE

        conn = net_db:new('localhost', 3301)
        conn = net_db:new('127.0.0.1', db.cfg.listen, {
            wait_connect = false,
            user = 'guest',
            password = ''
        })

    .. method:: ping()

        Execute a PING command.

        :return: true on success, false on error
        :rtype:  boolean

        .. code-block:: lua

            net_db.self:ping()

    .. method:: wait_connected([timeout])

        Wait for connection to be active or closed.

        :param number timeout:
        :return: true when connected, false on failure.
        :rtype:  boolean

        .. code-block:: lua

            net_db.self:wait_connected().

    .. method:: close()

        Close a connection.

        Connection objects are garbage collected just like any other objects in Lua, so
        an explicit destruction is not mandatory. However, since close() is a system
        call, it is good programming practice to close a connection explicitly when it
        is no longer needed, to avoid lengthy stalls of the garbage collector.

        .. code-block:: lua

            conn:close()

    .. method:: conn.space.<space-name>:select{field-value, ...}

        ``conn.space.space-name:select{...}`` is the remote-call equivalent
        of the local call ``db.space.space-name:select{...}``. Please note
        this difference: a local ``db.space.space-name:select{...}`` does
        not yield, but a remote ``conn.space.space-name:select{...}`` call
        does yield, so local data may change while a remote
        ``conn.space.space-name:select{...}`` is running.

    .. method:: conn.space.<space-name>:insert{field-value, ...}

        ``conn.space.space-name:insert(...)`` is the remote-call equivalent
        of the local call ``db.space.space-name:insert(...)``.

    .. method:: conn.space.<space-name>:replace{field-value, ...}

        ``conn.space.space-name:replace(...)`` is the remote-call equivalent
        of the local call ``db.space.space-name:replace(...)``.

    .. method:: conn.space.<space-name>:update{field-value, ...}

        ``conn.space.space-name:update(...)`` is the remote-call equivalent
        of the local call ``db.space.space-name:update(...)``.

    .. method:: conn.space.<space-name>:delete{field-value, ...}

        ``conn.space.space-name:delete(...)`` is the remote-call equivalent
        of the local call ``db.space.space-name:delete(...)``.

    .. method:: call(function-name [, arguments])

        ``conn:call('func', '1', '2', '3')`` is the remote-call equivalent of
        ``func('1', '2', '3')``. That is, ``conn:call`` is a remote
        stored-procedure call.

        .. code-block:: lua

            conn:call('function5').

    .. method:: timeout(timeout)

        ``timeout(...)`` is a wrapper which sets a timeout for the request that
        follows it.

        .. code-block:: lua

            conn:timeout(0.5).space.tester:update({1}, {{'=', 2, 15}}).

        All remote calls support execution timeouts. Using a wrapper object makes
        the remote connection API compatible with the local one, removing the need
        for a separate timeout argument, which the local version would ignore. Once
        a request is sent, it cannot be revoked from the remote server even if a
        timeout expires: the timeout expiration only aborts the wait for the remote
        server response, not the request itself.

============================================================================
                        Example showing use of most of the net.db methods
============================================================================

This example will work with the sanddb configuration described in the preface.
That is, there is a space named tester with a numeric primary key. Assume that
the database is nearly empty. Assume that the bee server is running on
``localhost 127.0.0.1:3301``.

.. code-block:: lua

    bee> db.schema.user.grant('guest', 'read,write,execute', 'universe')
    ---
    ...
    bee> console = require('console'); console.delimiter('!')
    ---
    ...
    bee> net_db = require('net.db')!
    ---
    ...
    bee> function example()
             > if net_db.self:ping() then
             >   table.insert(ta, 'self:ping() succeeded')
             >   table.insert(ta, '  (no surprise -- self connection is pre-established)')
             > end
             > if db.cfg.listen == '3301' then
             >   table.insert(ta,'The local server listen address = 3301')
             > else
             >   table.insert(ta, 'The local server listen address is not 3301')
             >   table.insert(ta, '(  (maybe db.cfg{...listen="3301"...} was not stated)')
             >   table.insert(ta, '(  (so connect will fail)')
             > end
             > conn = net_db:new('127.0.0.1', 3301)
             > conn.space.tester:delete{800}
             > table.insert(ta, 'conn delete done on tester.')
             > conn.space.tester:insert{800, 'data'}
             > table.insert(ta, 'conn insert done on tester, index 0')
             > table.insert(ta, '  primary key value = 800.')
             > wtuple = conn.space.tester:select{800}
             > table.insert(ta, 'conn select done on tester, index 0')
             > table.insert(ta, '  number of fields = ' .. #wtuple)
             > conn.space.tester:delete{800}
             > table.insert(ta, 'conn delete done on tester')
             > conn.space.tester:replace{800, 'New data', 'Extra data'}
             > table.insert(ta, 'conn:replace done on tester')
             > conn:timeout(0.5).space.tester:update({800}, {{'=', 2, 'Fld#1'}})
             > table.insert(ta, 'conn update done on tester')
             > conn:close()
             > table.insert(ta, 'conn close done')
             > end!
    ---
    ...
    bee> console.delimiter('')!
    ---
    ...
    bee> ta = {}
    ---
    ...
    bee> example()
    ---
    ...
    bee> ta
    ---
    - - self:ping() succeeded
      - '  (no surprise -- self connection is pre-established)'
      - The local server listen address = 3301
      - conn delete done on tester.
      - conn insert done on tester, index 0
      - '  primary key value = 800.'
      - conn select done on tester, index 0
      - '  number of fields = 1'
      - conn delete done on tester
      - conn:replace done on tester
      - conn update done on tester
      - conn close done
    ...
    bee> db.space.tester:select{800} -- Prove that the update succeeded.
    ---
    - [800, 'Fld#1', 'Extra data']
    ...


text:
@charset "utf-8";
/* CSS Document */
.banner{width:100%;height:500px; clear:both;}
.main_content{width:100%;height:auto; overflow:hidden; clear:both;}
.anlibox{height:auto; overflow:hidden; margin-top:40px;}
.jieshao{width:100%;height:479px; margin-top:40px; background:url(jieshao_bg.jpg) no-repeat top center; clear:both;}
.jieshao .jiesbox{height:auto; overflow:hidden; text-align:left; padding-top:50px;}
.zhishibox{height:auto; overflow:hidden; margin-top:40px;clear:both;text-align:left;}
.tunlan{width:100%;height:auto; overflow:hidden; margin-top:40px; background-color:#f3f3f3; clear:both;}
.tunlan .tunlanbox{height:auto; overflow:hidden;text-align:left;padding:50px 0;}
.activebox{height:auto; overflow:hidden; margin-top:40px;clear:both;text-align:left;}
.linkbox{height:auto; overflow:hidden; margin-top:40px;clear:both;text-align:left;}
.public_tite{width:100%;height:auto; overflow:hidden; text-align:center;}
.pub_body{width:100%;height:auto; overflow:hidden; margin-top:30px;}
.anlibox ul{width:100%;height:auto; overflow:hidden;}
.anlibox ul li{width:280px;height:375px; background-color:#f7f7f7; float:left; margin-right:26px;}
.anlibox ul li img{width:280px; max-height:315px; overflow:hidden;}
.anlibox ul li span{ display:block; text-align:center; padding-top:15px; font-size:14px; color:#191919;}
a.more_a{ display:block;width:126px;height:38px; text-align:center; line-height:38px; border:1px solid #dcdcdc; margin:0 auto; clear:both; color:#383838; margin-top:30px;}
.jiesleft{width:318px;height:380px; float:left;}
.jiesleft img{ width:318px; max-height:380px; overflow:hidden;}
.jiesright{width:770px;height:300px; background-color:rgba(0, 0, 0, 0.5); float:right; margin-top:20px; padding:30px 30px 30px 60px;}
.jiesright img{ margin-bottom:10px;}
.jiesright p{ color:#fff; line-height:25px; font-size:14px;}
.jiesright p span{ color:#00a7f4;}
.zhishibox ul{width:100%;height:auto; overflow:hidden;}
.zhishibox ul li{width:585px; height:98px; float:left; background-color:#fcfcfc; margin-right:30px; margin-bottom:20px;}
.zhishibox ul li img{width:92px;height:98px; display:block; float:left;}
.zhishibox ul li p{width:450px;height:98px; float:right; padding-right:30px;}
.zhishibox ul li p a{ display:block; font-weight:500; color:#484848; font-size:15px; padding:10px 0;}
.zhishibox ul li p span{ line-height:20px; color:#676767;}
.tunlanbox ul{width:100%;height:auto; overflow:hidden;}
.tunlanbox ul li{width:382px;height:auto; overflow:hidden; float:left; margin-right:27px;}
.tunlanbox ul li img{width:382px; max-height:276px; overflow:hidden;}
.active_left{width:870px;height:auto; overflow:hidden; float:left;}
.active_right{width:320px;height:300px; background-color:#fbfbfb; float:right; text-align:center;}
.active_right img{ margin-top:20px;}
.active_left h3{width:100%;height:20px;}
.active_left ul{width:100%;height:auto; overflow:hidden; margin-top:20px;}
.active_left ul li{width:400px;height:100px; overflow:hidden; float:left; margin-right:30px; margin-bottom:30px;}
.active_left ul li .actimg{width:114px;height:100px; overflow:hidden; float:left;}
.active_left ul li .actimg img{width:114px; height:auto;}
.active_left ul li .actmemo{width:275px;height:auto; overflow:hidden; float:right;}
.active_left ul li .actmemo a{ display:block; font-size:14px; padding:10px 0; color:#000000;}
.active_left ul li .actmemo p{ color:#000; line-height:22px;}
.linkbox a{ display:block;width:164px;height:53px; border:1px solid #e7e7e7; margin-right:5px; float:left; margin-bottom:5px;}

/*内页*/
.page_banner{width:1150px;height:215px; margin:0 auto; margin-top:10px;}
.page_banner img{width:1150px;}
.page_content{width:1150px;height:auto; overflow:hidden; clear:both;  margin:0 auto;margin-top:10px; text-align:left;}
.page_fenlei{width:1148px; background-color:#f3f3f3; border:1px solid #dbdbdb;height:41px; line-height:41px;}
.page_fenlei h3{width:auto; padding-right:15px;height:41px;background:url(shutiao.jpg) no-repeat left center;padding-left:10px;margin-left:10px;font-size:16px;color:#484848;}
.page_fenlei h3 span{ font-size:13px; color:#747474; font-weight:normal;}
.page_fenlei ul{width:900px;heighte:41px; float:left;}
.page_fenlei ul li{width:138px;height:41px; float:left;  text-align:center;}
.page_fenlei ul li a{ display:block;  color:#272727;font-size:15px;}
.page_fenlei ul li a.nowsubmenu{ background-color:#0179d2; color:#fff;}
.product_body{width:100%;height:auto; overflow:hidden; clear:both; margin-top:20px;}
.product_body h2{}
.product_body ul li{width:270px;height:auto; overflow:hidden; border:1px solid #dedede; float:left; margin-right:20px; margin-bottom:20px;}
.product_body ul li img{width:270px; max-height:210px; overflow:hidden; display:block; border-bottom:1px solid #dedede;}
.product_body ul li span{width:100%;height:42px; line-height:42px; display:block; text-align:center; color:#272727;}
.product_body ul li:hover span{ background-color:#0179d2; color:#fff;}
.page_left{width:222px;height:auto; overflow:hidden; float:left;}
.page_right{width:905px;height:auto; overflow:hidden; float:right;}
.pageleft_menu{width:220px;height:auto; overflow:hidden; border:1px solid #ebebeb;}
.pageleftgg{width:222px;height:auto; overflow:hidden; margin-top:15px;}
.pageleftgg img{width:222px;height:auto;}
.pageleftlink{width:100%;height:auto; overflow:hidden;}
.pageleftlink a{width:220px;height:75px; border:1px solid #ebebeb; margin-top:15px; display:block;}
.pageleftit{width:100%;height:72px; background:url(page_tit_bg.jpg) repeat-x;}
.pageleftit h3{width:auto; margin-left:10px; padding:15px 0px 0 10px; background:url(shutiao.jpg) no-repeat left 18px;font-size:16px;}
.pageleftit span{ margin-left:20px;}
.page_menulist{width:201px;height:auto; overflow:hidden; margin-left:10px; padding:15px 0 20px 0;}
.page_menulist ul li{width:201px;height:35px; line-height:35px;}
.page_menulist ul li a{ display:block; font-size:14px; color:#242424; padding-left:20px;}
.page_menulist ul li a.dangqmenu{ background:url(dangqmenu.jpg) no-repeat; color:#fff;}
.pageright_adv{width:100%;height:auto; overflow:hidden;}
.pageright_adv img{width:100%;height:auto;}
.pageright_body{width:100%;height:auto; overflow:hidden; clear:both; margin-top:20px;}
.pageright_body h4{width:100%;height:22px; line-height:22px; border-bottom:1px solid #eee; font-size:15px; color:#484848; position:relative;}
.pageright_body h4 strong{width:128px; text-align:center; display:block;height:22px; border-bottom:2px solid #0170cc; position:absolute; bottom:-1px;left:0;}
.cartpp{width:100%;height:auto; overflow:hidden; clear:both; margin-top:20px;}
.pageright_body h4 strong a{ font-size:15px;color:#484848;  }
.cartpp ul li{width:181px;height:auto; overflow:hidden; float:left; text-align:center; margin-bottom:20px;}
.cartpp ul li div.imgli{width:181px;height:92px; text-align:center; vertical-align:middle; display:table-cell;}
.cartpp ul li img{ vertical-align:middle;width:92px; max-height:92px;}
.cartpp ul li span{ text-align:center; color:#222; line-height:25px; display:block; font-size:14px;}
.anlists{width:100%;height:auto; overflow:hidden;clear:both; margin-top:20px;}
.anlists ul li{width:283px;height:auto; overflow:hidden; float:left; margin-right:18px; margin-bottom:20px; background-color:#eee;}
.anlists ul li img{width:283px; max-height:168px; overflow:hidden;}
.anlists ul li span{ line-height:30px; display:block; text-align:center; color:#525252;}
.yingyinlist{width:100%;height:auto; overflow:hidden;clear:both;}
.yingyinlist ul li{width:100%;height:auto; overflow:hidden; border-bottom:1px dashed #d2d2d2; padding:15px 0; clear:both;}
.yingyinlist ul li:last-child{ border-bottom:none;}
.yingyinlist ul li div.zhishiimg{width:187px;height:113px; overflow:hidden; float:left;}
.yingyinlist ul li div.zhishiimg img{width:187px;height:auto;}
.yingyinlist ul li div.zhishimemo{width:688px;height:auto; overflow:hidden; float:right;}
.yingyinlist ul li div.zhishimemo a{ display:block; font-weight:bold; font-size:15px; color:#3f3f3f; padding:10px 0;}
.yingyinlist ul li div.zhishimemo p{ line-height:22px; color:#6a6a6a;}
.aboutbody{width:100%;height:auto; overflow:hidden; clear:both; font-size:13px; margin-top:20px;}