text:
package org.kiji.commons;

import java.util.Iterator;

import javax.annotation.concurrent.NotThreadSafe;

import com.google.common.collect.Iterators;
import com.google.common.collect.PeekingIterator;
import com.google.common.collect.UnmodifiableIterator;

import org.kiji.annotations.ApiAudience;
import org.kiji.annotations.ApiStability;

/**
 * Utilities for working with {@link Iterator}s. Also see {@link Iterators}.
 */
@ApiAudience.Framework
@ApiStability.Experimental
public final class IteratorUtils {

  /**
   * Wraps an existing iterator and removes consecutive duplicate elements.
   *
   * @param iterator The iterator to deduplicate.
   * @param <T> The value type of the iterator.
   * @return An iterator which lazily deduplicates elements.
   */
  public static <T> Iterator<T> deduplicatingIterator(final Iterator<T> iterator) {
    return new DeduplicatingIterator<T>(iterator);
  }

  /**
   * A deduplicating iterator which removes consecutive duplicate elements from another iterator.
   *
   * @param <T> The value type of elements in the iterator.
   */
  @NotThreadSafe
  private static final class DeduplicatingIterator<T> extends UnmodifiableIterator<T> {
    private final PeekingIterator<T> mIterator;

    /**
     * Create an iterator which will remove consecutive duplicate elements in an iterator.
     *
     * @param iterator The iterator to deduplicate.
     */
    private DeduplicatingIterator(final Iterator<T> iterator) {
      mIterator = Iterators.peekingIterator(iterator);
    }

    /** {@inheritDoc} */
    @Override
    public boolean hasNext() {
      return mIterator.hasNext();
    }

    /** {@inheritDoc} */
    @Override
    public T next() {
      final T next = mIterator.next();

      while (mIterator.hasNext() && next.equals(mIterator.peek())) {
        mIterator.next();
      }

      return next;
    }
  }

  /** Private constructor for utility class. */
  private IteratorUtils() { }
}


text:
/*---------------------------------------------------------------------
 * IDENTIFICATION	shared_mem.c
 *
 * VERSION		$Id: shared_mem.c,v 1.2 2007/07/03 00:10:25 jschimpf Exp $
 *
 * AUTHOR		Joachim Schimpf
 *
 * CONTENTS		Shared memory allocation
 *---------------------------------------------------------------------*/

#include "config.h"

#include <sys/types.h>

//asq:
#include <stdint.h>
#include <barrelfish_kpi/types.h>

#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
#include <sys/stat.h>
//#include <fcntl.h>
#include <errno.h>

#include "memman.h"

#ifdef _WIN32
#  include 	<stdlib.h>
#  define MAX_PATH_LEN	_MAX_PATH
#else
#ifdef PATH_IN_LIMITS
#  include 	<limits.h>
#  define MAX_PATH_LEN	PATH_MAX
#else
#  include <sys/param.h>
#  define MAX_PATH_LEN	MAXPATHLEN
#endif
#endif

#ifdef HAVE_UNISTD_H
#include	<unistd.h>
#endif

#ifdef SBRK_UNDEF
extern char	*sbrk();
#endif

#ifndef MAP_NORESERVE
#define MAP_NORESERVE 0
#endif
#ifndef MAP_VARIABLE
#define MAP_VARIABLE 0
#endif
#ifndef MAP_FAILED
#define MAP_FAILED ((capaddr_t) (-1))
#endif
#if defined(MAP_ANONYMOUS) || defined(MAP_ANON)
#  ifndef MAP_FILE
#  define MAP_FILE 0
#  endif
#  ifndef MAP_ANONYMOUS
#  define MAP_ANONYMOUS MAP_ANON
#  endif
#endif

#ifdef HAVE_STRING_H
#include <string.h>
#else
extern char	*strcpy();
#endif

static generic_ptr shared_sbrk(word size, int align, struct heap_descriptor *hd);
static int shared_release(generic_ptr address, word size, struct heap_descriptor *hd);

/*---------------------------------------------------------------------
 * Shared memory
 *---------------------------------------------------------------------*/

#undef KB
#undef MB
#define MB			1048576
#define KB			1024
#undef VIRTUAL_SHARED_DEFAULT
#define VIRTUAL_SHARED_DEFAULT	(64*MB)
#define MAP_INCREMENT_DEFAULT	(16*KB)
#define RoundTo(n,unit)		((n) - ((n) - 1) % (unit) -1 + (unit))

#ifdef HAVE_MMAP
char *
shared_mem_init(
	int create,			/* create/attach shared memory flag */
	char *mapfile,			/* file to map to (NULL:private on swap) */
	char *start_shared_area,	/* start address for mapping (or NULL) */
	word size,			/* maxium size in bytes (0:automatic) */
	word incr,			/* mapping increment (multiple of pagesize) */
	void (*panic_func)(const char*, const char*),		/* function to call when out of memory */
	struct heap_descriptor *hd)	/* output: heap descriptor */
{
    hd->panic = panic_func;
    hd->more = shared_sbrk;
    hd->less = shared_release;

    if (!size) size = VIRTUAL_SHARED_DEFAULT;
    if (!incr) incr = MAP_INCREMENT_DEFAULT;
    if (!mapfile) create = 1;

    if (create)		/* setup shared memory */
    {
	/* With shared memory we map everything at once to avoid
	 * synchronisation problems when extending the mapping.
	 * When mapping to /dev/zero we extend the mapping incrementally
	 * otherwise a lot of swap space is reserved
	 */
#if (defined(_PA_RISC1_0) || defined(_PA_RISC1_1))
	int map_mode = (!mapfile && start_shared_area)? MAP_FIXED: MAP_VARIABLE;
#else
	int map_mode = start_shared_area? MAP_FIXED: MAP_VARIABLE;
#endif
	int map_default = mapfile ? size : incr;
	char *map_result;

	if (!mapfile)	/* no shared memory */
	{
#ifdef MAP_ANONYMOUS
	    hd->map_fd = -1;
#else
	    hd->map_fd = open("/dev/zero", O_RDWR);
#endif
	}
	else
	{
	    /* The file must not exist yet. This is to make sure that
	     * 1. slaves cannot accidentally attach to an old version.
	     * 2. The file is empty and contains zeros after truncating.
	     */
	    hd->map_fd = open(mapfile, O_RDWR|O_CREAT|O_EXCL, 0700);
	}
	if (hd->map_fd == -1
#ifdef MAP_ANONYMOUS
	    && mapfile
#endif
	    )
	{
	    perror("ECLiPSe: can't create shared map file");
	    return (char *) -1;
	}

	if (mapfile && ftruncate(hd->map_fd, (off_t) size) == -1)
	{
	    perror("ECLiPSe: can't extend shared map file");
	    return (char *) -1;
	}
_retry_map_:
	map_result = (char *) mmap(start_shared_area, map_default,
	    PROT_READ|PROT_WRITE|PROT_EXEC,
#ifdef MAP_ANONYMOUS
	    (mapfile? MAP_FILE: MAP_ANONYMOUS)|
#endif
	    (mapfile? MAP_SHARED: MAP_PRIVATE)|
	    MAP_NORESERVE|
	    map_mode,
	    hd->map_fd, (off_t) 0);
	if ((capaddr_t) map_result == MAP_FAILED)
	{
	    if (map_mode == MAP_FIXED)
	    {
		map_mode = MAP_VARIABLE;
		goto _retry_map_;
	    }
	    perror("ECLiPSe: can't map shared memory");
	    return (char *) -1;
	}
	start_shared_area = map_result;
	hd->shared_header = (struct shm_desc *) start_shared_area;
	hd->shared_header->mapfile = mapfile;	/* preliminary, see below */
	hd->shared_header->incr = incr;
	hd->shared_header->start = start_shared_area;
	hd->shared_header->lim = start_shared_area + map_default;
	hd->shared_header->brk = start_shared_area + sizeof(struct shm_desc);
	hd->shared_header->stop = start_shared_area + size;
	a_mutex_init(&hd->shared_header->lock);
	hd->heap = &hd->shared_header->heap;
	hd->pages = &hd->shared_header->pages;
	hd->shared_header->mapfile = mapfile ?
		strcpy(hd->shared_header->mapfile_buf, mapfile) : mapfile;
	pagemanager_init(hd);
	alloc_init(hd);
	hd->shared_header->processes = 1; /* done last, for synchronisation */
    }
    else		/* connect to existing shared memory in mapfile */
    {
	struct stat st;
	struct shm_desc *tmp_header;
	char *lim;

	for(;;)		/* wait for the mapfile to appear */
	{
	    hd->map_fd = open(mapfile, O_RDWR, 0600);
	    if (hd->map_fd != -1)
		break;
	    if (errno != ENOENT)
	    {
		perror("ECLiPSe: can't open shared map file");
		return (char *) -1;
	    }
	    sleep(1);
	}
	do {		/* wait for the mapfile to be non-empty */
	    (void) fstat(hd->map_fd, &st);
	} while (!st.st_size);

	/* preliminarily map admin page to look at the shared_header */
	tmp_header = (struct shm_desc *) mmap((capaddr_t) 0, incr,
	    PROT_READ,
#ifdef MAP_ANONYMOUS
	    MAP_FILE|
#endif
	    MAP_SHARED,
	    hd->map_fd, (off_t) 0);
	if ((capaddr_t) tmp_header == MAP_FAILED)
	{
	    perror("ECLiPSe: can't map shared memory");
	    return (char *) -1;
	}
	while (tmp_header->processes == 0)
	{
	    sleep(1);		/* wait for creator to finish initialisation */
	}
	if (start_shared_area)
	{
	    if (tmp_header->start != start_shared_area)
	    {
		errno = EINVAL;
		perror("ECLiPSe: cannot map shared memory at required address");
		return (char *) -1;
	    }
	}
	else	/* use the start address provided in the mapfile */
	{
	    start_shared_area = tmp_header->start;
	}
	lim = tmp_header->lim;
	(void) munmap((capaddr_t) tmp_header, incr);

	/* Now do the real mapping */
	if ((char *) mmap(start_shared_area,
	    lim - start_shared_area,
	    PROT_READ|PROT_WRITE|PROT_EXEC,
#ifdef MAP_ANONYMOUS
	    MAP_FILE|
#endif
	    MAP_NORESERVE|
	    MAP_SHARED|MAP_FIXED,
	    hd->map_fd, (off_t) 0) != start_shared_area)
	{
	    perror("ECLiPSe: can't map shared memory");
	    return (char *) -1;
	}
	hd->shared_header = (struct shm_desc *) start_shared_area;
	hd->heap = &hd->shared_header->heap;
	hd->pages = &hd->shared_header->pages;
	a_mutex_lock(&hd->shared_header->lock);
	hd->shared_header->processes++;
	a_mutex_unlock(&hd->shared_header->lock);
    }
    return start_shared_area;
}
#endif /* HAVE_MMAP */

void
shared_mem_release(struct heap_descriptor *hd)
{
    if (!hd->shared_header)
    {
	pagemanager_fini(hd);
	return;
    }
    a_mutex_lock(&hd->shared_header->lock);
    if (--hd->shared_header->processes == 0 && hd->shared_header->mapfile)
    {
	if (unlink(hd->shared_header->mapfile) == -1 && errno != ENOENT)
	{
	    perror("ECLiPSe warning: can't get rid of shared map file");
	}
    }
    a_mutex_unlock(&hd->shared_header->lock);
}

#ifdef HAVE_MMAP
static generic_ptr
shared_sbrk(word size, int align, struct heap_descriptor *hd)
{
    char *p;
    word avail;

    /* already inside the lock
    a_mutex_lock(&hd->shared_header->lock);
    */
    p = hd->shared_header->brk;
    if ((word) p % align)
    {
	p += align - ((word) p % align);
    }
    avail = hd->shared_header->lim - p;
    if (size > avail)
    {
	word needed = RoundTo(size - avail, hd->shared_header->incr);
	if (hd->shared_header->lim + needed > hd->shared_header->stop)
	{
	    errno = ENOMEM;
	    perror("ECLiPSe: shared heap overflow");
	    p = (char *) -1;
	    goto _return_;
	}
	if ((char *) mmap(hd->shared_header->lim, needed,
		PROT_READ|PROT_WRITE|PROT_EXEC,
#ifdef MAP_ANONYMOUS
		(hd->shared_header->mapfile? MAP_FILE: MAP_ANONYMOUS)|
#endif
		(hd->shared_header->mapfile? MAP_SHARED: MAP_PRIVATE)|MAP_FIXED,
		hd->map_fd,
		(off_t) (hd->shared_header->lim - hd->shared_header->start))
	    != hd->shared_header->lim)
	{
	    perror("ECLiPSe: can't map more shared memory");
	    p = (char *) -1;
	    goto _return_;
	}
	hd->shared_header->lim += needed;
    }
    hd->shared_header->brk = p + size;
_return_:
    /*
    a_mutex_unlock(&hd->shared_header->lock);
    */
    return (generic_ptr) p;
}

static int
shared_release(generic_ptr address, word size, struct heap_descriptor *hd)
{
    return 1;
}
#endif /* HAVE_MMAP */

/*---------------------------------------------------------------------
 * Save and restore
 * They return -1 and set errno on error, otherwise 0
 *---------------------------------------------------------------------*/

int
shared_mem_save(struct heap_descriptor *hd, int fd)
{
    if (!hd->shared_header)
    {
	errno = EINVAL;
	return -1;
    }
    return write(fd, hd->shared_header->start,
	hd->shared_header->brk - hd->shared_header->start);
}

int
shared_mem_restore(struct heap_descriptor *hd, int fd)
{
#ifdef HAVE_MMAP
    char mapfile_buf[MAX_PATH_LEN];
    char *start;
    char *lim;					/* current mapping limit */
    int processes;
    char *mapfile;
#endif

    if (!hd->shared_header)
    {
	errno = EINVAL;
	return -1;
    }

#ifdef HAVE_MMAP
    start = hd->shared_header->start;
    lim = hd->shared_header->lim;
    processes = hd->shared_header->processes;
    mapfile = hd->shared_header->mapfile;
    if (mapfile)
	(void) strcpy(mapfile_buf, hd->shared_header->mapfile);

    /* read the shared memory descriptor */
    if (read(fd, start, sizeof(struct shm_desc)) != sizeof(struct shm_desc))
	return -1;

    if (start != hd->shared_header->start)
    {
	errno = EINVAL;
	return -1;
    }
    hd->shared_header->processes = processes;
    hd->shared_header->mapfile = mapfile ?
	    strcpy(hd->shared_header->mapfile_buf, mapfile_buf) : mapfile;

    if (mapfile)			/* Adjust the memory mapping */
    {
	/* with shared memory map everything at once */
	hd->shared_header->lim = hd->shared_header->stop;
    }
    if (hd->shared_header->lim > lim)
    {
	if ((char *) mmap(lim,
	    hd->shared_header->lim - lim,
	    PROT_READ|PROT_WRITE|PROT_EXEC,
#ifdef MAP_ANONYMOUS
	    (mapfile? MAP_FILE: MAP_ANONYMOUS)|
#endif
	    MAP_NORESERVE|
	    (mapfile? MAP_SHARED: MAP_PRIVATE)|MAP_FIXED,
	    hd->map_fd, (off_t) 0) != lim)
	{
	    return -1;
	}
    }
    else if (hd->shared_header->lim < lim)
    {
	if (munmap(hd->shared_header->lim, lim - hd->shared_header->lim) < 0)
	{
	    return -1;
	}
    }

    /* Now read the rest of the data and return */
    return read(fd, start + sizeof(struct shm_desc),
		hd->shared_header->brk - start - sizeof(struct shm_desc));
#endif /* HAVE_MMAP */
}

/*---------------------------------------------------------------------
 * Auxliliary functions
 *---------------------------------------------------------------------*/

/*
 * Check whether a given address is in this heap
 */

int
address_in_heap(struct heap_descriptor *hd, generic_ptr ptr)
{
    if (!hd->shared_header)
	return 0;
    return ptr >= (generic_ptr) hd->shared_header->start
	&& ptr <  (generic_ptr) hd->shared_header->brk;
}

redpajama_set_name: RedPajamaGithub


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.content.model;

/**
 * Model definition for ProductWeight.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Content API for Shopping. For a detailed explanation
 * see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class ProductWeight extends com.google.api.client.json.GenericJson {

  /**
   * Required. The weight unit. Acceptable values are: - "`g`" - "`kg`" - "`oz`" - "`lb`"
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String unit;

  /**
   * Required. The weight represented as a number. The weight can have a maximum precision of four
   * decimal places.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Double value;

  /**
   * Required. The weight unit. Acceptable values are: - "`g`" - "`kg`" - "`oz`" - "`lb`"
   * @return value or {@code null} for none
   */
  public java.lang.String getUnit() {
    return unit;
  }

  /**
   * Required. The weight unit. Acceptable values are: - "`g`" - "`kg`" - "`oz`" - "`lb`"
   * @param unit unit or {@code null} for none
   */
  public ProductWeight setUnit(java.lang.String unit) {
    this.unit = unit;
    return this;
  }

  /**
   * Required. The weight represented as a number. The weight can have a maximum precision of four
   * decimal places.
   * @return value or {@code null} for none
   */
  public java.lang.Double getValue() {
    return value;
  }

  /**
   * Required. The weight represented as a number. The weight can have a maximum precision of four
   * decimal places.
   * @param value value or {@code null} for none
   */
  public ProductWeight setValue(java.lang.Double value) {
    this.value = value;
    return this;
  }

  @Override
  public ProductWeight set(String fieldName, Object value) {
    return (ProductWeight) super.set(fieldName, value);
  }

  @Override
  public ProductWeight clone() {
    return (ProductWeight) super.clone();
  }

}


text:
package vmwarevsphere

import (
	"fmt"
	"io/ioutil"
	"os"

	"github.com/rancher/machine/libmachine/drivers"
	"github.com/rancher/machine/libmachine/mcnflag"
	"github.com/vmware/govmomi/vim25/types"
)

var supportedCreationTypes = map[string]bool{
	creationTypeVM:      true,
	creationTypeTmpl:    true,
	creationTypeLibrary: true,
	creationTypeLegacy:  true,
}

func (d *Driver) GetCreateFlags() []mcnflag.Flag {
	return []mcnflag.Flag{
		mcnflag.IntFlag{
			EnvVar: "VSPHERE_CPU_COUNT",
			Name:   "vmwarevsphere-cpu-count",
			Usage:  "vSphere CPU number for docker VM",
			Value:  defaultCpus,
		},
		mcnflag.IntFlag{
			EnvVar: "VSPHERE_MEMORY_SIZE",
			Name:   "vmwarevsphere-memory-size",
			Usage:  "vSphere size of memory for docker VM (in MB)",
			Value:  defaultMemory,
		},
		mcnflag.IntFlag{
			EnvVar: "VSPHERE_DISK_SIZE",
			Name:   "vmwarevsphere-disk-size",
			Usage:  "vSphere size of disk for docker VM (in MB)",
			Value:  defaultDiskSize,
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_BOOT2DOCKER_URL",
			Name:   "vmwarevsphere-boot2docker-url",
			Usage:  "vSphere URL for boot2docker image",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_VCENTER",
			Name:   "vmwarevsphere-vcenter",
			Usage:  "vSphere IP/hostname for vCenter",
		},
		mcnflag.IntFlag{
			EnvVar: "VSPHERE_VCENTER_PORT",
			Name:   "vmwarevsphere-vcenter-port",
			Usage:  "vSphere Port for vCenter",
			Value:  defaultSDKPort,
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_USERNAME",
			Name:   "vmwarevsphere-username",
			Usage:  "vSphere username",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_PASSWORD",
			Name:   "vmwarevsphere-password",
			Usage:  "vSphere password",
		},
		mcnflag.StringSliceFlag{
			EnvVar: "VSPHERE_NETWORK",
			Name:   "vmwarevsphere-network",
			Usage:  "vSphere network where the virtual machine will be attached",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_DATASTORE",
			Name:   "vmwarevsphere-datastore",
			Usage:  "vSphere datastore for virtual machine",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_DATASTORE_CLUSTER",
			Name:   "vmwarevsphere-datastore-cluster",
			Usage:  "vSphere datastore cluster for virtual machine",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_DATACENTER",
			Name:   "vmwarevsphere-datacenter",
			Usage:  "vSphere datacenter for virtual machine",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_FOLDER",
			Name:   "vmwarevsphere-folder",
			Usage:  "vSphere folder for the docker VM. This folder must already exist in the datacenter",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_POOL",
			Name:   "vmwarevsphere-pool",
			Usage:  "vSphere resource pool for docker VM",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_HOSTSYSTEM",
			Name:   "vmwarevsphere-hostsystem",
			Usage:  "vSphere compute resource where the docker VM will be instantiated. This can be omitted if using a cluster with DRS",
		},
		mcnflag.StringSliceFlag{
			EnvVar: "VSPHERE_CFGPARAM",
			Name:   "vmwarevsphere-cfgparam",
			Usage:  "vSphere vm configuration parameters (used for guestinfo)",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_CLOUDINIT",
			Name:   "vmwarevsphere-cloudinit",
			Usage:  "vSphere cloud-init filepath or url to add to guestinfo, filepath will be read and base64 encoded before adding",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_CLOUD_CONFIG",
			Name:   "vmwarevsphere-cloud-config",
			Usage:  "Filepath to a cloud-config yaml file to put into the ISO user-data",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_VAPP_IPPROTOCOL",
			Name:   "vmwarevsphere-vapp-ipprotocol",
			Usage:  "vSphere vApp IP protocol for this deployment. Supported values are: IPv4 and IPv6",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_VAPP_IPALLOCATIONPOLICY",
			Name:   "vmwarevsphere-vapp-ipallocationpolicy",
			Usage:  "vSphere vApp IP allocation policy. Supported values are: dhcp, fixed, transient and fixedAllocated",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_VAPP_TRANSPORT",
			Name:   "vmwarevsphere-vapp-transport",
			Usage:  "vSphere OVF environment transports to use for properties. Supported values are: iso and com.vmware.guestInfo",
		},
		mcnflag.StringSliceFlag{
			EnvVar: "VSPHERE_VAPP_PROPERTY",
			Name:   "vmwarevsphere-vapp-property",
			Usage:  "vSphere vApp properties",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_CREATION_TYPE",
			Name:   "vmwarevsphere-creation-type",
			Usage:  "Creation type when creating a new virtual machine. Supported values: vm, template, library, legacy",
			Value:  creationTypeLegacy,
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_CLONE_FROM",
			Name:   "vmwarevsphere-clone-from",
			Usage:  "If you choose creation type clone a name of what you want to clone is required",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_CONTENT_LIBRARY",
			Name:   "vmwarevsphere-content-library",
			Usage:  "If you choose to clone from a content library template specify the name of the library",
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_SSH_USER",
			Name:   "vmwarevsphere-ssh-user",
			Usage:  "If using a non-B2D image you can specify the ssh user",
			Value:  defaultSSHUser,
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_SSH_PASSWORD",
			Name:   "vmwarevsphere-ssh-password",
			Usage:  "If using a non-B2D image you can specify the ssh password",
			Value:  defaultSSHPass,
		},
		mcnflag.IntFlag{
			EnvVar: "VSPHERE_SSH_PORT",
			Name:   "vmwarevsphere-ssh-port",
			Usage:  "If using a non-B2D image you can specify the ssh port",
			Value:  drivers.DefaultSSHPort,
		},
		mcnflag.StringFlag{
			EnvVar: "VSPHERE_SSH_USER_GROUP",
			Name:   "vmwarevsphere-ssh-user-group",
			Usage:  "If using a non-B2D image the uploaded keys will need chown'ed, defaults to staff e.g. docker:staff",
			Value:  defaultSSHUserGroup,
		},
		mcnflag.StringSliceFlag{
			EnvVar: "",
			Name:   "vmwarevsphere-tag",
			Usage:  "vSphere tag id e.g. urn:xxx",
		},
		mcnflag.StringSliceFlag{
			EnvVar: "",
			Name:   "vmwarevsphere-custom-attribute",
			Usage:  "vSphere custom attribute, format key/value e.g. '200=my custom value'",
		},
	}
}

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
	d.SSHUser = flags.String("vmwarevsphere-ssh-user")
	d.SSHPassword = flags.String("vmwarevsphere-ssh-password")
	d.SSHPort = flags.Int("vmwarevsphere-ssh-port")
	d.SSHUserGroup = flags.String("vmwarevsphere-ssh-user-group")
	d.CPU = flags.Int("vmwarevsphere-cpu-count")
	d.Memory = flags.Int("vmwarevsphere-memory-size")
	d.DiskSize = flags.Int("vmwarevsphere-disk-size")
	d.Boot2DockerURL = flags.String("vmwarevsphere-boot2docker-url")
	d.IP = flags.String("vmwarevsphere-vcenter")
	d.Port = flags.Int("vmwarevsphere-vcenter-port")
	d.Username = flags.String("vmwarevsphere-username")
	d.Password = flags.String("vmwarevsphere-password")
	d.Networks = flags.StringSlice("vmwarevsphere-network")
	d.Tags = flags.StringSlice("vmwarevsphere-tag")
	d.CustomAttributes = flags.StringSlice("vmwarevsphere-custom-attribute")
	d.Datastore = flags.String("vmwarevsphere-datastore")
	d.DatastoreCluster = flags.String("vmwarevsphere-datastore-cluster")
	d.Datacenter = flags.String("vmwarevsphere-datacenter")
	// Sanitize input on ingress.
	d.Folder = flags.String("vmwarevsphere-folder")
	d.Pool = flags.String("vmwarevsphere-pool")
	d.HostSystem = flags.String("vmwarevsphere-hostsystem")
	d.CfgParams = flags.StringSlice("vmwarevsphere-cfgparam")
	d.CloudInit = flags.String("vmwarevsphere-cloudinit")
	d.CloudConfig = flags.String("vmwarevsphere-cloud-config")
	if d.CloudConfig != "" {
		if _, err := os.Stat(d.CloudConfig); err != nil {
			return err
		}
		ud, err := ioutil.ReadFile(d.CloudConfig)
		if err != nil {
			return err
		}
		d.CloudConfig = string(ud)
	}

	d.VAppIpProtocol = flags.String("vmwarevsphere-vapp-ipprotocol")
	d.VAppIpAllocationPolicy = flags.String("vmwarevsphere-vapp-ipallocationpolicy")
	d.VAppTransport = flags.String("vmwarevsphere-vapp-transport")
	d.VAppProperties = flags.StringSlice("vmwarevsphere-vapp-property")
	d.SetSwarmConfigFromFlags(flags)
	d.ISO = d.ResolveStorePath(isoFilename)

	d.CreationType = flags.String("vmwarevsphere-creation-type")
	if _, ok := supportedCreationTypes[d.CreationType]; !ok {
		return fmt.Errorf("Creation type %s not supported", d.CreationType)
	}

	d.ContentLibrary = flags.String("vmwarevsphere-content-library")
	if d.CreationType != "legacy" {
		d.CloneFrom = flags.String("vmwarevsphere-clone-from")
		if d.CloneFrom == "" {
			return fmt.Errorf("creation type clone needs a VM name to clone from, use --vmwarevsphere-clone-from")
		}
	}

	return nil
}

type AuthFlag struct {
	auth types.NamePasswordAuthentication
}

func NewAuthFlag(u, p string) *AuthFlag {
	return &AuthFlag{
		auth: types.NamePasswordAuthentication{
			Username: u,
			Password: p,
		},
	}
}

func (f *AuthFlag) Auth() types.BaseGuestAuthentication {
	return &f.auth
}

type FileAttrFlag struct {
	types.GuestPosixFileAttributes
}

func (f *FileAttrFlag) SetPerms(owner, group, perms int) {
	owner32 := int32(owner)
	group32 := int32(group)
	f.OwnerId = &owner32
	f.GroupId = &group32
	f.Permissions = int64(perms)
}

func (f *FileAttrFlag) Attr() types.BaseGuestFileAttributes {
	return &f.GuestPosixFileAttributes
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Massarinula phyllodiorum McAlpine

### Remarks
null


text:
function head (array) {
  return array[0]
}

module.exports = head


text:
[![npm][npm-image]][npm-url]
[![npm version][npm-version-image]][npm-version-url]
[![travis][travis-image]][travis-url]
[![stable][stability-image]][stability-url]

[npm-image]: https://nodei.co/npm/source-notes.png
[npm-url]: https://www.npmjs.com/package/source-notes
[npm-version-image]: https://badge.fury.io/js/source-notes.svg
[npm-version-url]: http://badge.fury.io/js/source-notes
[travis-image]: https://secure.travis-ci.org/akiva/source-notes.png
[travis-url]: https://travis-ci.org/akiva/source-notes
[stability-image]: http://badges.github.io/stability-badges/dist/stable.svg
[stability-url]: http://github.com/badges/stability-badges

Search files or directories for `TODO`, `FIXME`, `OPTIMI(S|Z)E`, or
custom annotations.

Current file types included in the search are

- `*.js`
- `*.coffee`
- `*.iced`
- `*.styl`
- `*.jade`

## Example

To run `source-notes` on any files located recursively within `test/`:

```bash
source-notes test
```

yielding:

![source-notes screenshot](https://github.com/akiva/source-notes/raw/master/screenshot.png)

## Usage

```
  Usage: source-notes [options] <target>

  Search files or directories for TODO, FIXME, OPTIMI(S|Z)E, or custom
  annotations.

  Options:

    [target]          File or directory to search (defaults to cwd)
    -h, --help        Output usage information
    -v, --version     Show version number
    -a, --annotation  Search for specific annotation type(s) as a
                      singular or comma-separated value
```

## Installation

With [npm](http://npmjs.org) do:

```bash
npm install -g source-notes
```

## License

MIT, see [LICENSE](LICENSE) for details.


text:
namespace ConsoleApplication16
{
    using System;
    using System.Diagnostics;
    using System.Threading;

    public sealed class FalseSharing
    {
        public static readonly int ThreadCount = Environment.ProcessorCount; // change
        public static readonly long Iterations = 500L * 1000L * 1000L;
        readonly int arrayIndex;

        static readonly VolatileInt[] Ints = new VolatileInt[ThreadCount];

        static FalseSharing()
        {
            for (int i = 0; i < Ints.Length; i++)
            {
                Ints[i] = new VolatileInt();
            }
        }

        public FalseSharing(int arrayIndex)
        {
            this.arrayIndex = arrayIndex;
        }

        public static void Run()
        {
            Stopwatch sw = Stopwatch.StartNew();
            runTest();
            Console.WriteLine("duration = " + (sw.Elapsed));
        }

        static void runTest()
        {
            var threads = new Thread[ThreadCount];

            for (int i = 0; i < threads.Length; i++)
            {
                var falseSharing = new FalseSharing(i);
                threads[i] = new Thread(s => falseSharing.run());
            }

            foreach (Thread t in threads)
            {
                t.Start();
            }

            foreach (Thread t in threads)
            {
                t.Join();
            }
        }

        public void run()
        {
            int i = (int)Iterations + 1;
            while (0 != --i)
            {
                Ints[this.arrayIndex].value = i;
            }
        }

        public class VolatileInt
        {
            public volatile int value;
            //public long p1, p2, p3, p4, p5, p6, p7; // comment out
        }
    }
}


text:
package org.apache.sling.validation.impl;

import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;

@ObjectClassDefinition(name = "Apache Sling Validation Configuration", description = "Allows to influence the validation behaviour")
public @interface ValidationServiceConfiguration {
    @AttributeDefinition(name = "Cache Validation Results on Resources", description = "If enabled will cache the validation result from calls to ValidationService.validate(Resource,ValidationModel) and expose it via Resource.adaptTo('ValidationResult.class').")
    boolean cacheValidationResultsOnResources() default false;
    @AttributeDefinition(name = "Default Severity of Validation Failures", description = "The default severity set for all validation failures where no explicit severity has been set in the model or on the according Validator.")
    int defaultSeverity() default 0;
}


text: This extension provides fast access for esa posts.


text:
<!-- Remove unrelated categories -->

- Bug fix
- New feature
- Documentation / docstrings
- Tests
- Other

## Checklist

- [ ] I've run the latest [black](https://github.com/ambv/black) with default args on new code.
- [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [ ] I've added tests for new code.
- [ ] I accept that @PyFilesystem/maintainers may be pedantic in the code review.

## Description

Please describe your changes here. If this fixes a bug, please link to the issue, if possible.


text:
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE MultiParamTypeClasses #-}

module Job.Say (
  SayJob(..),
  job,
) where

import System.Hworker
import System.IO (hPrint, stderr)

import Control.Monad (forM_)

import Model.Message
import Model.Subscription (Adapter, Topic, getAdapter)

import Data.Aeson (FromJSON, ToJSON)
import GHC.Generics (Generic)

import Database

data SayJob = Say Topic Message deriving (Show, Generic)

instance ToJSON SayJob
instance FromJSON SayJob

instance Job () SayJob where
  job () (Say topic message) = do
    print ("delivering `" ++ show message ++ "` -> `" ++ topic ++ "`")

    subscriptions <- getDatabase >>= flip topicSubscriptions topic

    forM_ subscriptions $ \s ->
      print ("delivering `" ++ show message ++ "` -> `" ++ (show . getAdapter) s ++ "`")

    return Success

    where
      print = hPrint stderr


text:
package cn.com.ebmp.dbmonitor.jdbc;

import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;

import cn.com.ebmp.dbmonitor.common.DBListenerInfo;
import cn.com.ebmp.dbmonitor.common.DBLogger;
import cn.com.ebmp.dbmonitor.common.LoggerException;
import cn.com.ebmp.dbmonitor.common.SQLInfo;
import cn.com.ebmp.dbmonitor.common.SQLTypeEnum;

/**
 * the JDBC Connection of DBMonitor
 *
 * @author yang zhongke
 */
public class DBConnection implements Connection
{
	private Connection conn;

	private DBLogger logger;

	public void logSql(SQLInfo info) throws LoggerException, SQLException
	{
		logger.logSQL(info);
	}

	public DBConnection(Connection conn, DBListenerInfo[] dbListenerInfos, String connectionId)
	{
		super();
		this.conn = conn;
		try
		{
			logger = DBLogger.createLogger(dbListenerInfos, connectionId);
		} catch (LoggerException e)
		{
			e.printStackTrace();
			System.exit(0);
		} catch (SQLException e)
		{
			e.printStackTrace();
			System.exit(0);
		}
	}

	public void clearWarnings() throws SQLException
	{
		conn.clearWarnings();
	}

	public void close() throws SQLException
	{
		try
		{
			logger.close();
		} catch (LoggerException e)
		{
			throw JdbcUtils.toSQLException(e);
		} finally
		{
			conn.close();
			conn = null;
			logger = null;
		}
	}

	public void commit() throws SQLException
	{
		conn.commit();
	}

	public Statement createStatement() throws SQLException
	{
		return new DBStatement(conn.createStatement(), this);
	}

	public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
	{
		return new DBStatement(conn.createStatement(resultSetType, resultSetConcurrency), this);
	}

	public boolean getAutoCommit() throws SQLException
	{
		return conn.getAutoCommit();
	}

	public String getCatalog() throws SQLException
	{
		return conn.getCatalog();
	}

	public DatabaseMetaData getMetaData() throws SQLException
	{
		return conn.getMetaData();
	}

	public int getTransactionIsolation() throws SQLException
	{
		return conn.getTransactionIsolation();
	}

	public Map getTypeMap() throws SQLException
	{
		return conn.getTypeMap();
	}

	public SQLWarning getWarnings() throws SQLException
	{
		return conn.getWarnings();
	}

	public boolean isClosed() throws SQLException
	{
		return conn.isClosed();
	}

	public boolean isReadOnly() throws SQLException
	{
		return conn.isReadOnly();
	}

	public String nativeSQL(String sql) throws SQLException
	{
		return conn.nativeSQL(sql);
	}

	public CallableStatement prepareCall(String sql) throws SQLException
	{
		return conn.prepareCall(sql);
	}

	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
	{
		return conn.prepareCall(sql, resultSetType, resultSetConcurrency);
	}

	public PreparedStatement prepareStatement(String sql) throws SQLException
	{
		return new DBPreparedStatement(conn.prepareStatement(sql), this, sql);
	}

	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
	{
		return new DBPreparedStatement(conn.prepareStatement(sql, resultSetType, resultSetConcurrency), this, sql);
	}

	public void rollback() throws SQLException
	{
		try
		{
			SQLInfo info = new SQLInfo();
			info.setSql("");
			info.setSqlType(SQLTypeEnum.rollback);
			info.setBeginTime(JdbcUtils.getTimeStamp());
			conn.rollback();
			info.setEndTime(JdbcUtils.getTimeStamp());
			logSql(info);
		} catch (LoggerException e)
		{
			throw JdbcUtils.toSQLException(e);
		}
	}

	public void setAutoCommit(boolean autoCommit) throws SQLException
	{
		conn.setAutoCommit(autoCommit);
	}

	public void setCatalog(String catalog) throws SQLException
	{
		conn.setCatalog(catalog);
	}

	public void setReadOnly(boolean readOnly) throws SQLException
	{
		conn.setReadOnly(readOnly);
	}

	public void setTransactionIsolation(int level) throws SQLException
	{
		conn.setTransactionIsolation(level);
	}

	/*
	public void setTypeMap(Map map) throws SQLException
	{
		conn.setTypeMap(map);
	}
  */
	public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
	{
		Statement stmt = conn.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
		return new DBStatement(stmt, this);
	}

	public int getHoldability() throws SQLException
	{
		return conn.getHoldability();
	}

	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
	{
		CallableStatement stmt = conn.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
		return stmt;
	}

	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
	{
		PreparedStatement stmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
		return new DBPreparedStatement(stmt, this, sql);
	}

	public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
	{
		PreparedStatement stmt = conn.prepareStatement(sql, autoGeneratedKeys);
		return new DBPreparedStatement(stmt, this, sql);
	}

	public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
	{
		PreparedStatement stmt = conn.prepareStatement(sql, columnIndexes);
		return new DBPreparedStatement(stmt, this, sql);
	}

	public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
	{
		PreparedStatement stmt = conn.prepareStatement(sql, columnNames);
		return new DBPreparedStatement(stmt, this, sql);
	}

	public void releaseSavepoint(Savepoint savepoint) throws SQLException
	{
		conn.releaseSavepoint(savepoint);
	}

	public void rollback(Savepoint savepoint) throws SQLException
	{
		try
		{
			SQLInfo info = new SQLInfo();
			info.setSql("");
			info.setSqlType(SQLTypeEnum.rollback);
			info.setBeginTime(JdbcUtils.getTimeStamp());
			conn.rollback(savepoint);
			info.setEndTime(JdbcUtils.getTimeStamp());
			logSql(info);
		} catch (LoggerException e)
		{
			throw JdbcUtils.toSQLException(e);
		}

	}

	public void setHoldability(int holdability) throws SQLException
	{
		conn.setHoldability(holdability);
	}

	public Savepoint setSavepoint() throws SQLException
	{
		return conn.setSavepoint();
	}

	public Savepoint setSavepoint(String name) throws SQLException
	{
		return conn.setSavepoint(name);
	}

	/*******************以下为jdk6.0及以上版本实现的方法,目前未加功能,但不影响使用***********************/
	public void setTypeMap(Map<String, Class<?>> arg0) throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public <T> T unwrap(Class<T> iface) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isWrapperFor(Class<?> iface) throws SQLException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Clob createClob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Blob createBlob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public NClob createNClob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SQLXML createSQLXML() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isValid(int timeout) throws SQLException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setClientInfo(String name, String value)
			throws SQLClientInfoException {
		// TODO Auto-generated method stub

	}

	@Override
	public void setClientInfo(Properties properties)
			throws SQLClientInfoException {
		// TODO Auto-generated method stub

	}

	@Override
	public String getClientInfo(String name) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Properties getClientInfo() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Array createArrayOf(String typeName, Object[] elements)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Struct createStruct(String typeName, Object[] attributes)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setSchema(String schema) throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public String getSchema() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void abort(Executor executor) throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public void setNetworkTimeout(Executor executor, int milliseconds)
			throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public int getNetworkTimeout() throws SQLException {
		// TODO Auto-generated method stub
		return 0;
	}
}


text:
<?php

namespace HB\HyperbricoBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class AdresseType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('mail', 'email', array('label' => 'Newsletter :', 'attr' => array('placeholder' => 'Votre adresse-email')));
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
          'data_class' => 'HB\HyperbricoBundle\Entity\Adresse'
        ));
    }

    public function getName()
    {
        return 'hb_hyperbricobundle_adressetype';
    }
}


text:
//
// Copyright (C) 2008 Irene Ruengeler
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//

#ifndef __INET_SCTPALGORITHM_H
#define __INET_SCTPALGORITHM_H

#include "inet/common/INETDefs.h"

#include "inet/transportlayer/sctp/SCTPAssociation.h"
#include "inet/transportlayer/sctp/SCTPQueue.h"

namespace inet {

namespace sctp {

/**
 * Abstract base class for SCTP algorithms which encapsulate all behaviour
 * during data transfer state: flavour of congestion control, fast
 * retransmit/recovery, selective acknowledgement etc. Subclasses
 * may implement various sets and flavours of the above algorithms.
 */
class INET_API SCTPAlgorithm : public cObject
{
  protected:
    SCTPAssociation *assoc;    // we belong to this association
    SCTPQueue *transmissionQ;
    SCTPQueue *retransmissionQ;

  public:
    /**
     * Ctor.
     */
    SCTPAlgorithm() { assoc = NULL; transmissionQ = NULL; retransmissionQ = NULL; }

    /**
     * Virtual dtor.
     */
    virtual ~SCTPAlgorithm() {}

    inline void setAssociation(SCTPAssociation *_assoc)
    {
        assoc = _assoc;
        transmissionQ = assoc->getTransmissionQueue();
        retransmissionQ = assoc->getRetransmissionQueue();
    }

    virtual void initialize() {}

    virtual SCTPStateVariables *createStateVariables() = 0;

    virtual void established(bool active) = 0;

    virtual void connectionClosed() = 0;

    virtual void processTimer(cMessage *timer, SCTPEventCode& event) = 0;

    virtual void sendCommandInvoked(SCTPPathVariables *path) = 0;

    virtual void receivedDataAck(uint32 firstSeqAcked) = 0;

    virtual void receivedDuplicateAck() = 0;

    virtual void receivedAckForDataNotYetSent(uint32 seq) = 0;

    virtual void sackSent() = 0;

    virtual void dataSent(uint32 fromseq) = 0;
};

} // namespace sctp

} // namespace inet

#endif // ifndef __INET_SCTPALGORITHM_H


text:
#include "RenderCirclesProgram.h"

namespace corde
{
	using namespace system;

	namespace alpha
	{
		RenderCirclesProgram::RenderCirclesProgram()
		{
			vertexShaderCode(GLSL_Code(
				layout (location = 0) in vec3  BallPosition;
				layout (location = 1) in vec4  BallColor;
				layout (location = 2) in float BallRadius;

				flat          out vec4  VertColor;
				noperspective out float VertRadius;

				uniform mat4 ModelViewMatrix;

				void main()
				{
					gl_Position = ModelViewMatrix * vec4(BallPosition, 1.0);
					VertColor   = BallColor;
					VertRadius  = BallRadius;
				}
			));

			geometryShaderCode(GLSL_Code(
				layout (points) in;

				layout (
					triangle_strip,
					max_vertices = 4
				) out;

				flat          in vec4  VertColor[];
				noperspective in float VertRadius[];

				flat          out vec4  GeomColor;
				noperspective out vec3  GeomPosition;
				noperspective out vec2  GeomOffset;

				uniform mat4  ProjectionMatrix;
				uniform float RadiusLimit;

				void main()
				{
					if (VertRadius[0] / -gl_in[0].gl_Position.z > RadiusLimit)
					{
						return;
					}

					GeomColor  = VertColor[0];

					GeomPosition = gl_in[0].gl_Position.xyz + vec3(-VertRadius[0], -VertRadius[0], 0.0);
					GeomOffset   = vec2(-1.0, -1.0);
					gl_Position  = ProjectionMatrix * vec4(GeomPosition, 1.0);
					EmitVertex();

					GeomPosition = gl_in[0].gl_Position.xyz + vec3(-VertRadius[0],  VertRadius[0], 0.0);
					GeomOffset   = vec2(-1.0,  1.0);
					gl_Position  = ProjectionMatrix * vec4(GeomPosition, 1.0);
					EmitVertex();

					GeomPosition = gl_in[0].gl_Position.xyz + vec3( VertRadius[0], -VertRadius[0], 0.0);
					GeomOffset   = vec2( 1.0, -1.0);
					gl_Position  = ProjectionMatrix * vec4(GeomPosition, 1.0);
					EmitVertex();

					GeomPosition = gl_in[0].gl_Position.xyz + vec3( VertRadius[0],  VertRadius[0], 0.0);
					GeomOffset   = vec2( 1.0,  1.0);
					gl_Position  = ProjectionMatrix * vec4(GeomPosition, 1.0);
					EmitVertex();

					EndPrimitive();
				}
			));

			fragmentShaderCode(GLSL_Code(
				layout (location = 0) out vec4 FragColor;

				flat          in vec4  GeomColor;
				noperspective in vec3  GeomPosition;
				noperspective in vec2  GeomOffset;

				uniform vec3  LightPosition;
				uniform vec3  AmbientColor;
				uniform vec3  DiffuseColor;
				uniform vec3  SpecularColor;
				uniform float Shininess;

				void main()
				{
					float d = dot(GeomOffset, GeomOffset);

					if (d > 1.0)
					{
						discard;
					}

					vec3 n = normalize(vec3(GeomOffset, 0.0) + vec3(0.0, 0.0, sqrt(1.0 - d)));
					vec3 s = normalize(LightPosition - GeomPosition);
					vec3 v = normalize(-GeomPosition);
					vec3 h = normalize(v + s);

					vec3 baseColor = GeomColor.rgb;

					vec3 black = vec3(0.0, 0.0, 0.0);
					vec3 white = vec3(1.0, 1.0, 1.0);

					vec3 ambient = clamp(AmbientColor * baseColor, black, white);
					vec3 diffuse = clamp(DiffuseColor * baseColor * dot(s, n), black, white);

					vec3 result = ambient + diffuse;

					if (diffuse != black)
					{
						vec3 specular = clamp(SpecularColor * vec3(1.0, 1.0, 1.0) * pow(max(dot(h, n), 0.0), Shininess), black, white);
						result += specular;
					}

					FragColor.rgb = clamp(result, black, white);

					if (GeomColor.a == 1.0)
					{
						FragColor.a = 1.0;
					}
					else
					{
						FragColor.a = GeomColor.a * (1.0 - d);
					}
				}
			));

			link();

			u_ModelViewMatrix  = gl4::getUniformLocation(getId(), "ModelViewMatrix");
			u_ProjectionMatrix = gl4::getUniformLocation(getId(), "ProjectionMatrix");
			u_LightPosition    = gl4::getUniformLocation(getId(), "LightPosition");
			u_AmbientColor     = gl4::getUniformLocation(getId(), "AmbientColor");
			u_DiffuseColor     = gl4::getUniformLocation(getId(), "DiffuseColor");
			u_SpecularColor    = gl4::getUniformLocation(getId(), "SpecularColor");
			u_Shininess        = gl4::getUniformLocation(getId(), "Shininess");
			u_RadiusLimit      = gl4::getUniformLocation(getId(), "RadiusLimit");
		}

		RenderCirclesProgram::~RenderCirclesProgram() { }
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="org.jbpm.eclipse.feature"
      label="JBoss jBPM Core"
      version="6.4.0.qualifier"
      provider-name="JBoss by Red Hat">

   <description url="http://www.jboss.org/jbpm/">
      Eclipse support for JBoss jBPM Core.
   </description>

   <copyright>
      (c) 2010 JBoss by Red Hat
   </copyright>

   <license>
Red Hat, Inc. licenses these features and plugins to you under
certain open source licenses (or aggregations of such licenses), which
in a particular case may include the Eclipse Public License, the GNU
Lesser General Public License, and/or certain other open source
licenses. For precise licensing details, consult the corresponding
source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive,
Raleigh NC 27606 USA.
   </license>

   <requires>
      <import plugin="org.eclipse.core.runtime"/>
      <import plugin="org.eclipse.debug.ui"/>
      <import plugin="org.eclipse.ui.ide"/>
      <import plugin="org.eclipse.jdt.core"/>
      <import plugin="org.eclipse.jdt.ui"/>
      <import plugin="org.eclipse.ui.views.properties.tabbed"/>
      <import plugin="org.kie.eclipse"/>
      <import plugin="org.drools.eclipse"/>
   </requires>

   <plugin
         id="org.jbpm.eclipse"
         download-size="0"
         install-size="0"
         version="6.4.0.qualifier"
         unpack="false"/>

</feature>


text:
namespace sharp.Serene.Northwind.Forms
{
    using Serenity.ComponentModel;
    using System;

    [FormScript("Northwind.Supplier")]
    [BasedOnRow(typeof(Entities.SupplierRow))]
    public class SupplierForm
    {
        public String CompanyName { get; set; }
        public String ContactName { get; set; }
        public String ContactTitle { get; set; }
        public String Address { get; set; }
        public String Region { get; set; }
        public String PostalCode { get; set; }
        public String Country { get; set; }
        public String City { get; set; }
        public String Phone { get; set; }
        public String Fax { get; set; }
        public String HomePage { get; set; }
    }
}


text:
set -e
self_path=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
mesos_artifacts_home="${self_path}/.."
source "${mesos_artifacts_home}/common/scripts/base.sh"

function undeploy_product() {
undeploy wso2greg-pubstore-default
undeploy mysql-greg-apim-db
undeploy mysql-greg-db
}

function full_purge() {
  undeploy_product
  undeploy_common_services
}

function main() {
  full_purge=false
  while getopts :f FLAG; do
      case $FLAG in
          f)
              full_purge=true
              ;;
      esac
  done

  if [[ $full_purge == true ]]; then
    echo "Purging WSO2 GREG PUBSTORE deployment..."
    full_purge
  else
    echo "Undeploying WSO2 GREG PUBSTORE product..."
    undeploy_product
  fi
}
main "$@"


text:
supervisor-restarter
====================

Plugin package for supervisor that can perform fast restarts of supervisor
process groups via an xmlrpc call

#### The Problem

Due to inherent architecture design python-supervisor waits (currently,
unpactched) one second after restarting a process. While this can be patched to
a lower time value it represents a scalability issue given sufficient processes
in a process group.

supervisor-restarter provides an xmlrpc call which can rapidly restart a
process group by adding a new module to the `supervisor.plugins` namespace.
Note that while `supervisor` is already a _namespace_, `plugins` will be added
as such via the setuptools `pkg_resources` mechanism.

supervisor-restarter should be compatible with Python 2.4 through 2.7. It is
untested (and probably incompatible) with Python 3 and higher.

#### Configuration

To configure the restarter XML RPC interface you will need a main config
section or drop file for supervisor containing the following:

    [rpcinterface:restarter]
    supervisor.rpcinterface_factory = supervisor.plugins.restarter:make_rpcinterface
    ;delay = 0.1
    ;timeout = 5.0
    ;stagger_factor = 1

The **delay** option can be used to configure the delay, in seconds, between
internal "callback" iterations of the `restartProcessGroup` rpc call.
*A default of 0.2 seconds is used if none is otherwise configured.*

The **timeout** option will configure the maximum amount of time, in seconds,
that the xmlrpc method `restartProcessGroup` will be allowed to run; although
"run" is slightly deceptive because, as indicated above, the underlying method
is actually non-blocking and is called every **delay** seconds until it
indicates the operation is complete. **timeout** simply bounds this to a
maximum time. Once this time limit has been reached the xmlrpc call will return
a Fault or a list containing faults (as dictionaries) if prior errors have
accumulated. The timeout is not exact as it can only be checked every **delay**
seconds.
*A default timeout of 5 seconds is used if not otherwise configured.*

The **stagger_factor** option configures how many iterations (call of the internal
handler every **delay** seconds) it takes to stop all processes. This is useful
because the restarter will first try to start any processes that have completed
stopping before it goes on to stop the next set, thus staggering can cause less
overall disruption by allowing new processes to become available while the old
ones are still being killed off.
*The default value of 1 indicates no staggering will be used.*

#### Usage

    $ python
    Python 2.7.1 (...)
    >>> import xmlrpclib
    >>> server = xmlrpclib.Server('http://localhost:9001/RPC2')
    >>> server.restarter.restartProcessGroup('someconfiguredgroup')
    True

## Client Script

Eventually the plan is to extend `supervisorctl` in a similar fashion. However,
for the moment, it's not possible to extend the ctl interface via a
_supervisor.d/_ *.conf file, only by editing the main config. Thus, the
following tool is now included in this package:

#### supervisorctl_restart_group

Restarts the process group passed on the command line. Takes all the same
arguments as `supervisorctl`.

Example:

    supervisorctl_restart_group -s http://myserver foobar

Restarts the foobar process group on _myserver_.


text:
import unittest

from scrapy.spider import Spider
from scrapy.statscol import StatsCollector, DummyStatsCollector
from scrapy.utils.test import get_crawler

class StatsCollectorTest(unittest.TestCase):

    def setUp(self):
        self.crawler = get_crawler(Spider)
        self.spider = self.crawler._create_spider('foo')

    def test_collector(self):
        stats = StatsCollector(self.crawler)
        self.assertEqual(stats.get_stats(), {})
        self.assertEqual(stats.get_value('anything'), None)
        self.assertEqual(stats.get_value('anything', 'default'), 'default')
        stats.set_value('test', 'value')
        self.assertEqual(stats.get_stats(), {'test': 'value'})
        stats.set_value('test2', 23)
        self.assertEqual(stats.get_stats(), {'test': 'value', 'test2': 23})
        self.assertEqual(stats.get_value('test2'), 23)
        stats.inc_value('test2')
        self.assertEqual(stats.get_value('test2'), 24)
        stats.inc_value('test2', 6)
        self.assertEqual(stats.get_value('test2'), 30)
        stats.max_value('test2', 6)
        self.assertEqual(stats.get_value('test2'), 30)
        stats.max_value('test2', 40)
        self.assertEqual(stats.get_value('test2'), 40)
        stats.max_value('test3', 1)
        self.assertEqual(stats.get_value('test3'), 1)
        stats.min_value('test2', 60)
        self.assertEqual(stats.get_value('test2'), 40)
        stats.min_value('test2', 35)
        self.assertEqual(stats.get_value('test2'), 35)
        stats.min_value('test4', 7)
        self.assertEqual(stats.get_value('test4'), 7)

    def test_dummy_collector(self):
        stats = DummyStatsCollector(self.crawler)
        self.assertEqual(stats.get_stats(), {})
        self.assertEqual(stats.get_value('anything'), None)
        self.assertEqual(stats.get_value('anything', 'default'), 'default')
        stats.set_value('test', 'value')
        stats.inc_value('v1')
        stats.max_value('v2', 100)
        stats.min_value('v3', 100)
        stats.open_spider('a')
        stats.set_value('test', 'value', spider=self.spider)
        self.assertEqual(stats.get_stats(), {})
        self.assertEqual(stats.get_stats('a'), {})

if __name__ == "__main__":
    unittest.main()


text:
using Dibware.EF.Extensions.Contracts;
using Dibware.Template.Infrastructure.SqlDataAccess.Resources;
using System;
using System.Collections.Generic;

namespace Dibware.Template.Infrastructure.SqlDataAccess.StoredProcedures.Membership
{
    /// <summary>
    /// Represents the security.Membership_SetPasswordConfirmationToken stored procedure
    /// </summary>
    internal class SetPasswordConfirmationTokenStoredProcedure : BaseMembershipStoredProcedure<Int32>, IStoredProcedure<Int32>
    {
        public const String ProcedureName = @"Membership_SetPasswordConfirmationToken";

        /// <summary>
        /// Initializes a new instance of the <see cref="ConfirmAccountStoredProcedure" /> class.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="passwordConfirmationToken">The password confirmation token.</param>
        /// <param name="tokenExpirationTime">The token expiration time.</param>
        public SetPasswordConfirmationTokenStoredProcedure(
            String username,
            String passwordConfirmationToken,
            DateTime tokenExpirationTime)
            : base(SchemaNames.Security, ProcedureName, new Dictionary<String, Object>()
                {
                    { "username", username },
                    { "passwordConfirmationToken", passwordConfirmationToken },
                    { "tokenExpirationTime", tokenExpirationTime }
                })
        { }
    }
}


text:
module Shapes
  module Builder
    class Primitive

      attr_reader :data
      attr_accessor :builder_strategy, :resource

      def initialize(data)
        @data = data
        @builder_strategy = if(data.is_a?(Nokogiri::XML::Element))
          PrimitiveFromXml.new
        else
          PrimitiveFromHash.new
        end
      end

      def build_resource
        @resource = @builder_strategy.build_object @data
      end

      class PrimitiveFromHash
        def build_object(hash)
          primitive = "Shapes::Primitives::#{hash[:type]}".constantize.new hash
          primitive.ident = hash[:ident]
          primitive.description = hash[:description]
          primitive.resource_type = 'Primitive'
          primitive
        end
      end

      class PrimitiveFromXml
        def build_object(node)
          primitive = "Shapes::Primitives::#{node.name.camelize}".constantize.new
          primitive.xml_node = node
          primitive.read_from_node
          primitive
        end
      end

    end
  end
end


text:
local make_manifest = {}

local writer = require("luarocks.manif.writer")
local index = require("luarocks.admin.index")
local cfg = require("luarocks.core.cfg")
local util = require("luarocks.util")
local deps = require("luarocks.deps")
local fs = require("luarocks.fs")
local dir = require("luarocks.dir")

make_manifest.help_summary = "Compile a manifest file for a repository."

make_manifest.help = [[
<argument>, if given, is a local repository pathname.

--local-tree  If given, do not write versioned versions of the manifest file.
              Use this when rebuilding the manifest of a local rocks tree.
]]

--- Driver function for "make_manifest" command.
-- @param repo string or nil: Pathname of a local repository. If not given,
-- the default local repository configured as cfg.rocks_dir is used.
-- @return boolean or (nil, string): True if manifest was generated,
-- or nil and an error message.
function make_manifest.command(flags, repo)
   assert(type(repo) == "string" or not repo)
   repo = repo or cfg.rocks_dir

   util.printout("Making manifest for "..repo)

   if repo:match("/lib/luarocks") and not flags["local-tree"] then
      util.warning("This looks like a local rocks tree, but you did not pass --local-tree.")
   end

   local ok, err = writer.make_manifest(repo, deps.get_deps_mode(flags), not flags["local-tree"])
   if ok and not flags["local-tree"] then
      util.printout("Generating index.html for "..repo)
      index.make_index(repo)
   end
   if flags["local-tree"] then
      for luaver in util.lua_versions() do
         fs.delete(dir.path(repo, "manifest-"..luaver))
      end
   end
   return ok, err
end

return make_manifest


text:
<?php

namespace Tib\SfSandbox\UserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class TibSfSandboxUserBundle extends Bundle
{
}


text:
<?php

namespace ZendTest\Filter\Word;

use Zend\Filter\Word\SeparatorToSeparator as SeparatorToSeparatorFilter;

/**
 * Test class for Zend_Filter_Word_SeparatorToSeparator.
 *
 * @category   Zend
 * @package    Zend_Filter
 * @subpackage UnitTests
 * @group      Zend_Filter
 */
class SeparatorToSeparatorTest extends \PHPUnit_Framework_TestCase
{
    public function testFilterSeparatesWordsByDefault()
    {
        $string   = 'dash separated words';
        $filter   = new SeparatorToSeparatorFilter();
        $filtered = $filter($string);

        $this->assertNotEquals($string, $filtered);
        $this->assertEquals('dash-separated-words', $filtered);
    }

    public function testFilterSeparatesWordsWithSearchSpecified()
    {
        $string   = 'dash=separated=words';
        $filter   = new SeparatorToSeparatorFilter('=');
        $filtered = $filter($string);

        $this->assertNotEquals($string, $filtered);
        $this->assertEquals('dash-separated-words', $filtered);
    }

    public function testFilterSeparatesWordsWithSearchAndReplacementSpecified()
    {
        $string   = 'dash=separated=words';
        $filter   = new SeparatorToSeparatorFilter('=', '?');
        $filtered = $filter($string);

        $this->assertNotEquals($string, $filtered);
        $this->assertEquals('dash?separated?words', $filtered);
    }

}


text:
import { collection, create, text } from 'ember-cli-page-object';
import manager from './instructor-manager';
import userNameInfo from 'ilios-common/page-objects/components/user-name-info';

const definition = {
  scope: '[data-test-instructor-group-users]',
  title: text('[data-test-header] [data-test-title]'),
  manage: {
    scope: '[data-test-manage]',
  },
  save: {
    scope: '[data-test-save]',
  },
  cancel: {
    scope: '[data-test-cancel]',
  },
  manager,
  users: collection('[data-test-users-list] [data-test-user]', {
    userNameInfo,
  }),
};

export default definition;
export const component = create(definition);


text:
require_relative 'test_helper'

TicketPrice = DecisionMaker.define do
  rule(
    child:   { condition:  0..9,   action: 600 },
    student: { condition: 10..16,  action: 1200 },
    adult:   { condition: 17..120, action: 2000 },
  )
end

TICKET_PRICE_TABLE = {
  child:   { condition:  0..9,   action: 600 },
  student: { condition: 10..16,  action: 1200 },
  adult:   { condition: 17..120, action: 2000 },
}

class DecisionMakerTest < Minitest::Test
  def test_define
    ticket_price = TicketPrice.new
    assert_equal 600, ticket_price.for(:child)
  end

  def test_change_condition_name
    ticket_price = DecisionMaker.generate do
      condition_name :age
      table(
        child:   { age:  0..9,   action: 600 },
        student: { age: 10..16,  action: 1200 },
        adult:   { age: 17..120, action: 2000 },
      )
    end
    assert_equal 600, ticket_price.for(:child)
  end

  def test_change_action_name
    ticket_price = DecisionMaker.generate do
      condition_name :age
      action_name :price
      table(
        child:   { age:  0..9,   price: 600 },
        student: { age: 10..16,  price: 1200 },
        adult:   { age: 17..120, price: 2000 },
      )
    end
    assert_equal 600, ticket_price.for(:child)
  end

  def test_change_table_name
    ticket_price = DecisionMaker.generate do
      table_name :price_table
      price_table(
        child:   { condition:  0..9,   action: 600 },
        student: { condition: 10..16,  action: 1200 },
        adult:   { condition: 17..120, action: 2000 },
      )
    end
    assert_equal 1200, ticket_price.call(10)
  end

  def test_change_rule_name
    ticket_price = DecisionMaker.generate do
      rule_name :price
      price(
        child:   { condition:  0..9,   action: 600 },
        student: { condition: 10..16,  action: 1200 },
        adult:   { condition: 17..120, action: 2000 },
      )
    end
    assert_equal 1200, ticket_price.call(16)
  end

  def test_change_evaluation_method_name
    ticket_price = DecisionMaker.generate do
      name :evaluate
      rule(
        child:   { condition:  0..9,   action: 600 },
        student: { condition: 10..16,  action: 1200 },
        adult:   { condition: 17..120, action: 2000 },
      )
    end
    assert_equal 1200, ticket_price.evaluate(10)
  end

  def test_use_proc_on_condition
    ticket_price = DecisionMaker.generate do
      rule(
        child:   { condition:  0..9,   action: 600 },
        student: { condition: 10..16,  action: 1200 },
        adult:   { condition: ->(age) { age > 16 }, action: 2000 },
      )
    end
    assert_equal 2000, ticket_price.call(17)
  end

  def test_conditions_class_instance_match
    dm = DecisionMaker.generate do
      rule(
        fixnum: { condition: Fixnum, action: 'fixnum' },
        hash:   { condition: Hash,   action: 'hash' },
        enum:   { condition: Enumerator, action: 'enumerator' },
      )
    end
    assert_equal 'fixnum', dm.call(1)
  end

  def test_conditions_regexp
    dm = DecisionMaker.generate do
      rule(
        tel: { condition: /^(080|090|070)/, action: 'tel-number' }
      )
    end
    assert_equal 'tel-number', dm.call('080-0000-0000')
  end

  def test_evaluation_method_name_is_not_alias
    dm = DecisionMaker.generate do
      name :another
      rule(a: { condition: 1, action: 'abc' })
    end
    assert_raises(NoMethodError) do
      dm.call(1)
    end
  end

  def test_raise_error_on_missing_condition
    dm = DecisionMaker.generate do
      rule(a: { condition: 1, action: 'abc' })
    end
    assert_raises(RuntimeError) do
      dm.call(:unknown_key)
    end
  end

  class UnknownConditionError < StandardError; end
  def test_to_cutomize_error_handler
    dm = DecisionMaker.generate do
      on_error ->(key) { raise UnknownConditionError }
      rule(a: { condition: 1, action: 'abc' })
    end
    assert_raises(UnknownConditionError) do
      dm.call(2)
    end
  end

  def a(n); "a is called: #{n}"; end
  def b(n); "b is called: #{n}"; end
  def c(n); "c is called: #{n}"; end
  def test_dispatcher
    a_caller = ->(n) { a(n) }
    b_caller = ->(n) { b(n) }
    c_caller = ->(n) { c(n) }
    dispatcher = DecisionMaker.generate do
      name :route
      rule(
        a: { condition: 1, action: ->(n) { a_caller.call(n) } },
        b: { condition: 2, action: ->(n) { b_caller.call(n) } },
        c: { condition: 3, action: ->(n) { c_caller.call(n) } },
      )
    end
    assert_equal "b is called: 10", dispatcher.route(2).call(10)
  end
end


text:
import getWindow from "./getWindow.js";
import getNodeName from "./getNodeName.js";
import getComputedStyle from "./getComputedStyle.js";
import { isHTMLElement } from "./instanceOf.js";
import isTableElement from "./isTableElement.js";
import getParentNode from "./getParentNode.js";

function getTrueOffsetParent(element) {
  if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  getComputedStyle(element).position === 'fixed') {
    return null;
  }

  return element.offsetParent;
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
// return the containing block

function getContainingBlock(element) {
  var isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
  var currentNode = getParentNode(element);

  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
    var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
    // create a containing block.
    // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block

    if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
      return currentNode;
    } else {
      currentNode = currentNode.parentNode;
    }
  }

  return null;
} // Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.

export default function getOffsetParent(element) {
  var window = getWindow(element);
  var offsetParent = getTrueOffsetParent(element);

  while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
    offsetParent = getTrueOffsetParent(offsetParent);
  }

  if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
    return window;
  }

  return offsetParent || getContainingBlock(element) || window;
}


text:
<?php

namespace Drupal\Tests\system\Functional\System;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests output on the status overview page.
 *
 * @group system
 */
class TrustedHostsTest extends BrowserTestBase {

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $admin_user = $this->drupalCreateUser([
      'administer site configuration',
    ]);
    $this->drupalLogin($admin_user);
  }

  /**
   * Tests that the status page shows an error when the trusted host setting
   * is missing from settings.php
   */
  public function testStatusPageWithoutConfiguration() {
    $this->drupalGet('admin/reports/status');
    $this->assertResponse(200, 'The status page is reachable.');

    $this->assertRaw(t('Trusted Host Settings'));
    $this->assertRaw(t('The trusted_host_patterns setting is not configured in settings.php.'));
  }

  /**
   * Tests that the status page shows the trusted patterns from settings.php.
   */
  public function testStatusPageWithConfiguration() {
    $settings['settings']['trusted_host_patterns'] = (object) [
      'value' => ['^' . preg_quote(\Drupal::request()->getHost()) . '$'],
      'required' => TRUE,
    ];

    $this->writeSettings($settings);

    $this->drupalGet('admin/reports/status');
    $this->assertResponse(200, 'The status page is reachable.');

    $this->assertRaw(t('Trusted Host Settings'));
    $this->assertRaw(t('The trusted_host_patterns setting is set to allow'));
  }

  /**
   * Tests that fake requests have the proper host configured.
   *
   * @see \Drupal\Core\Http\TrustedHostsRequestFactory
   */
  public function testFakeRequests() {
    $this->container->get('module_installer')->install(['trusted_hosts_test']);
    $this->container->get('router.builder')->rebuild();

    $host = $this->container->get('request_stack')->getCurrentRequest()->getHost();
    $settings['settings']['trusted_host_patterns'] = (object) [
      'value' => ['^' . preg_quote($host) . '$'],
      'required' => TRUE,
    ];

    $this->writeSettings($settings);

    $this->drupalGet('trusted-hosts-test/fake-request');
    $this->assertText('Host: ' . $host);
  }

  /**
   * Tests that shortcut module works together with host verification.
   */
  public function testShortcut() {
    $this->container->get('module_installer')->install(['block', 'shortcut']);
    $this->rebuildContainer();
    $this->container->get('router.builder')->rebuild();

    /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
    $entity_manager = $this->container->get('entity.manager');
    $shortcut_storage = $entity_manager->getStorage('shortcut');

    $shortcut = $shortcut_storage->create([
      'title' => $this->randomString(),
      'link' => 'internal:/admin/reports/status',
      'shortcut_set' => 'default',
    ]);
    $shortcut_storage->save($shortcut);

    // Grant the current user access to see the shortcuts.
    $role_storage = $entity_manager->getStorage('user_role');
    $roles = $this->loggedInUser->getRoles(TRUE);
    /** @var \Drupal\user\RoleInterface $role */
    $role = $role_storage->load(reset($roles));
    $role->grantPermission('access shortcuts')->save();

    $this->drupalPlaceBlock('shortcuts');

    $this->drupalGet('');
    $this->assertLink($shortcut->label());
  }

}


text:
export class SensorMeasure {
  public constructor(public value: number, public timestamp: number){ }
}

export class SensorMeasureTypeDetails {
  constructor(public typeName: string, public unitName: string, public unitSymbol: string){ }
}

export enum SensorMeasureType { TEMPERATURE,HUMIDITY,PRESSURE }

export class SensorMeasureMetaData {
  private static typeDetails  = {
     TEMPERATURE : new SensorMeasureTypeDetails("Temperature", "Degree Celcius", "°C"),
     HUMIDITY :  new SensorMeasureTypeDetails("Humidity", "Percentage", "%"),
     PRESSURE : new SensorMeasureTypeDetails("Pressure", "Hecto-Pascal", "hPa")
   };

  public constructor(public location: string, public type: SensorMeasureType){ }

  public static getTypeDetail(type: SensorMeasureType) :  SensorMeasureTypeDetails {
      return SensorMeasureMetaData.typeDetails[type];
  }
}


text:
package com.domker.robot.wechat.model;

import com.blade.kit.json.JSONArray;

public class WechatContact {

	// 微信联系人列表,可聊天的联系人列表
	private JSONArray memberList;
	private JSONArray contactList;
	private JSONArray groupList;

	public WechatContact() {
		// TODO Auto-generated constructor stub
	}

	public JSONArray getMemberList() {
		return memberList;
	}

	public void setMemberList(JSONArray memberList) {
		this.memberList = memberList;
	}

	public JSONArray getContactList() {
		return contactList;
	}

	public void setContactList(JSONArray contactList) {
		this.contactList = contactList;
	}

	public JSONArray getGroupList() {
		return groupList;
	}

	public void setGroupList(JSONArray groupList) {
		this.groupList = groupList;
	}

}