text:
/*-------------------------------------------------------------------------
 *
 * Created:	H5Adeprec.c
 *		November 27 2006
 *		Quincey Koziol <koziol@hdfgroup.org>
 *
 * Purpose:	Deprecated functions from the H5A interface.  These
 *              functions are here for compatibility purposes and may be
 *              removed in the future.  Applications should switch to the
 *              newer APIs.
 *
 *-------------------------------------------------------------------------
 */

/****************/
/* Module Setup */
/****************/

#define H5A_PACKAGE		/*suppress error about including H5Apkg   */
#define H5O_PACKAGE		/*suppress error about including H5Opkg	*/

/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC	H5A_init_deprec_interface

/***********/
/* Headers */
/***********/
#include "H5private.h"		/* Generic Functions			*/
#include "H5Apkg.h"		/* Attributes				*/
#include "H5Dprivate.h"		/* Datasets				*/
#include "H5Eprivate.h"		/* Error handling		  	*/
#include "H5Iprivate.h"		/* IDs			  		*/
#include "H5Opkg.h"             /* Object headers			*/

/****************/
/* Local Macros */
/****************/

/******************/
/* Local Typedefs */
/******************/

/********************/
/* Package Typedefs */
/********************/

/********************/
/* Local Prototypes */
/********************/

/*********************/
/* Package Variables */
/*********************/

/*****************************/
/* Library Private Variables */
/*****************************/

/*******************/
/* Local Variables */
/*******************/

/*--------------------------------------------------------------------------
NAME
   H5A_init_deprec_interface -- Initialize interface-specific information
USAGE
    herr_t H5A_init_deprec_interface()
RETURNS
    Non-negative on success/Negative on failure
DESCRIPTION
    Initializes any interface-specific data or routines.  (Just calls
    H5A_init() currently).

--------------------------------------------------------------------------*/
static herr_t
H5A_init_deprec_interface(void)
{
    FUNC_ENTER_NOAPI_NOINIT

    FUNC_LEAVE_NOAPI(H5A_init())
} /* H5A_init_deprec_interface() */

#ifndef H5_NO_DEPRECATED_SYMBOLS

/*--------------------------------------------------------------------------
 NAME
    H5Acreate1
 PURPOSE
    Creates an attribute on an object
 USAGE
    hid_t H5Acreate1(loc_id, name, type_id, space_id, plist_id)
        hid_t loc_id;       IN: Object (dataset or group) to be attached to
        const char *name;   IN: Name of attribute to create
        hid_t type_id;      IN: ID of datatype for attribute
        hid_t space_id;     IN: ID of dataspace for attribute
        hid_t plist_id;     IN: ID of creation property list (currently not used)
 RETURNS
    Non-negative on success/Negative on failure

 DESCRIPTION
        This function creates an attribute which is attached to the object
    specified with 'location_id'.  The name specified with 'name' for each
    attribute for an object must be unique for that object.  The 'type_id'
    and 'space_id' are created with the H5T and H5S interfaces respectively.
    The attribute ID returned from this function must be released with H5Aclose
    or resource leaks will develop.

 NOTE
    Deprecated in favor of H5Acreate2

--------------------------------------------------------------------------*/
hid_t
H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
	  hid_t plist_id)
{
    H5G_loc_t           loc;                    /* Object location */
    H5T_t		*type;                  /* Datatype to use for attribute */
    H5S_t		*space;                 /* Dataspace to use for attribute */
    hid_t		ret_value;              /* Return value */

    FUNC_ENTER_API(FAIL)
    H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, plist_id);

    /* check arguments */
    if(H5I_ATTR == H5I_get_type(loc_id))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
    if(H5G_loc(loc_id, &loc) < 0)
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
    if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
	HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file")
    if(!name || !*name)
	HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
    if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type")
    if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")

    /* Go do the real work for attaching the attribute to the dataset */
    if((ret_value = H5A_create(&loc, name, type, space, plist_id, H5AC_dxpl_id)) < 0)
	HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute")

done:
    FUNC_LEAVE_API(ret_value)
} /* H5Acreate1() */

/*--------------------------------------------------------------------------
 NAME
    H5Aopen_name
 PURPOSE
    Opens an attribute for an object by looking up the attribute name
 USAGE
    hid_t H5Aopen_name (loc_id, name)
        hid_t loc_id;       IN: Object (dataset or group) to be attached to
        const char *name;   IN: Name of attribute to locate and open
 RETURNS
    ID of attribute on success, negative on failure

 DESCRIPTION
        This function opens an existing attribute for access.  The attribute
    name specified is used to look up the corresponding attribute for the
    object.  The attribute ID returned from this function must be released with
    H5Aclose or resource leaks will develop.
        The location object may be either a group or a dataset, both of
    which may have any sort of attribute.
 NOTE
    Deprecated in favor of H5Aopen
--------------------------------------------------------------------------*/
hid_t
H5Aopen_name(hid_t loc_id, const char *name)
{
    H5G_loc_t    	loc;            /* Object location */
    H5A_t               *attr = NULL;   /* Attribute opened */
    hid_t		ret_value;

    FUNC_ENTER_API(FAIL)
    H5TRACE2("i", "i*s", loc_id, name);

    /* check arguments */
    if(H5I_ATTR == H5I_get_type(loc_id))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
    if(H5G_loc(loc_id, &loc) < 0)
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
    if(!name || !*name)
	HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")

    /* Open the attribute on the object header */
    if(NULL == (attr = H5A_open_by_name(&loc, ".", name, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)))
        HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name)

    /* Register the attribute and get an ID for it */
    if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
        HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")

done:
    /* Cleanup on failure */
    if(ret_value < 0)
        if(attr && H5A_close(attr) < 0)
            HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")

    FUNC_LEAVE_API(ret_value)
} /* H5Aopen_name() */

/*--------------------------------------------------------------------------
 NAME
    H5Aopen_idx
 PURPOSE
    Opens the n'th attribute for an object
 USAGE
    hid_t H5Aopen_idx (loc_id, idx)
        hid_t loc_id;       IN: Object that attribute is attached to
        unsigned idx;       IN: Index (0-based) attribute to open
 RETURNS
    ID of attribute on success, negative on failure

 DESCRIPTION
        This function opens an existing attribute for access.  The attribute
    index specified is used to look up the corresponding attribute for the
    object.  The attribute ID returned from this function must be released with
    H5Aclose or resource leaks will develop.
        The location object may be either a group or a dataset, both of
    which may have any sort of attribute.
 NOTE
    Deprecated in favor of H5Aopen_by_idx
--------------------------------------------------------------------------*/
hid_t
H5Aopen_idx(hid_t loc_id, unsigned idx)
{
    H5G_loc_t	loc;	        /* Object location */
    H5A_t       *attr = NULL;   /* Attribute opened */
    hid_t	ret_value;

    FUNC_ENTER_API(FAIL)
    H5TRACE2("i", "iIu", loc_id, idx);

    /* check arguments */
    if(H5I_ATTR == H5I_get_type(loc_id))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
    if(H5G_loc(loc_id, &loc) < 0)
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")

    /* Open the attribute in the object header */
    if(NULL == (attr = H5A_open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)))
        HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute")

    /* Register the attribute and get an ID for it */
    if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0)
        HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")

done:
    /* Cleanup on failure */
    if(ret_value < 0)
        if(attr && H5A_close(attr) < 0)
            HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")

    FUNC_LEAVE_API(ret_value)
} /* H5Aopen_idx() */

/*--------------------------------------------------------------------------
 NAME
    H5Aget_num_attrs
 PURPOSE
    Determines the number of attributes attached to an object
 NOTE
    Deprecated in favor of H5Oget_info[_by_idx]
 USAGE
    int H5Aget_num_attrs (loc_id)
        hid_t loc_id;       IN: Object (dataset or group) to be queried
 RETURNS
    Number of attributes on success, negative on failure
 DESCRIPTION
        This function returns the number of attributes attached to a dataset or
    group, 'location_id'.
 NOTE
    Deprecated in favor of H5Oget_info
--------------------------------------------------------------------------*/
int
H5Aget_num_attrs(hid_t loc_id)
{
    H5O_loc_t    	*loc;	/* Object location for attribute */
    void           	*obj;
    int			ret_value;

    FUNC_ENTER_API(FAIL)
    H5TRACE1("Is", "i", loc_id);

    /* check arguments */
    if(H5I_BADID == H5I_get_type(loc_id))
	HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID")
    if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
    if(NULL == (obj = H5I_object(loc_id)))
        HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom")
    switch(H5I_get_type (loc_id)) {
        case H5I_DATASET:
            if(NULL == (loc = H5D_oloc((H5D_t*)obj)))
                HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
            break;

        case H5I_DATATYPE:
            if(NULL == (loc = H5T_oloc((H5T_t*)obj)))
                HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed")
            break;

        case H5I_GROUP:
            if(NULL == (loc = H5G_oloc((H5G_t*)obj)))
                HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object")
            break;

        case H5I_UNINIT:
        case H5I_BADID:
        case H5I_FILE:
        case H5I_DATASPACE:
        case H5I_ATTR:
        case H5I_REFERENCE:
        case H5I_VFL:
        case H5I_GENPROP_CLS:
        case H5I_GENPROP_LST:
        case H5I_ERROR_CLASS:
        case H5I_ERROR_MSG:
        case H5I_ERROR_STACK:
        case H5I_NTYPES:
        default:
            HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target")
    } /*lint !e788 All appropriate cases are covered */

    /* Look up the # of attributes for the object */
    if((ret_value = H5O_attr_count(loc, H5AC_ind_dxpl_id)) < 0)
        HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object")

done:
    FUNC_LEAVE_API(ret_value)
} /* H5Aget_num_attrs() */

/*--------------------------------------------------------------------------
 NAME
    H5Aiterate1
 PURPOSE
    Calls a user's function for each attribute on an object
 USAGE
    herr_t H5Aiterate1(loc_id, attr_num, op, data)
        hid_t loc_id;       IN: Object (dataset or group) to be iterated over
        unsigned *attr_num; IN/OUT: Starting (IN) & Ending (OUT) attribute number
        H5A_operator1_t op;  IN: User's function to pass each attribute to
        void *op_data;      IN/OUT: User's data to pass through to iterator operator function
 RETURNS
        Returns a negative value if something is wrong, the return value of the
    last operator if it was non-zero, or zero if all attributes were processed.

 DESCRIPTION
        This function interates over the attributes of dataset or group
    specified with 'loc_id'.  For each attribute of the object, the
    'op_data' and some additional information (specified below) are passed
    to the 'op' function.  The iteration begins with the '*attr_number'
    object in the group and the next attribute to be processed by the operator
    is returned in '*attr_number'.
        The operation receives the ID for the group or dataset being iterated
    over ('loc_id'), the name of the current attribute about the object
    ('attr_name') and the pointer to the operator data passed in to H5Aiterate
    ('op_data').  The return values from an operator are:
        A. Zero causes the iterator to continue, returning zero when all
            attributes have been processed.
        B. Positive causes the iterator to immediately return that positive
            value, indicating short-circuit success.  The iterator can be
            restarted at the next attribute.
        C. Negative causes the iterator to immediately return that value,
            indicating failure.  The iterator can be restarted at the next
            attribute.
 NOTE
    Deprecated in favor of H5Aiterate2
--------------------------------------------------------------------------*/
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data)
{
    H5A_attr_iter_op_t  attr_op;        /* Attribute operator */
    hsize_t		start_idx;      /* Index of attribute to start iterating at */
    hsize_t		last_attr;      /* Index of last attribute examined */
    herr_t	        ret_value;      /* Return value */

    FUNC_ENTER_API(FAIL)
    H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data);

    /* check arguments */
    if(H5I_ATTR == H5I_get_type(loc_id))
	HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")

    /* Build attribute operator info */
    attr_op.op_type = H5A_ATTR_OP_APP;
    attr_op.u.app_op = op;

    /* Call attribute iteration routine */
    last_attr = start_idx = (hsize_t)(attr_num ? *attr_num : 0);
    if((ret_value = H5O_attr_iterate(loc_id, H5AC_ind_dxpl_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, start_idx, &last_attr, &attr_op, op_data)) < 0)
        HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");

    /* Set the last attribute information */
    if(attr_num)
        *attr_num = (unsigned)last_attr;

done:
    FUNC_LEAVE_API(ret_value)
} /* H5Aiterate1() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */


text:
package com.greenpepper.interpreter;

import com.greenpepper.reflect.Fixture;
import com.greenpepper.reflect.PlainOldFixture;
import com.greenpepper.systemunderdevelopment.SystemUnderDevelopment;

public class AnInterpreter extends RuleForInterpreter
{
    public AnInterpreter( SystemUnderDevelopment systemUnderDevelopment )
    {
        this(new PlainOldFixture(new NullFixture()));
    }

    public AnInterpreter(Fixture fixture)
    {
        super(fixture);
    }

    public static class NullFixture
    {
        public String fixtureName()
        {
            return null;
        }

        public String fixtureParameters()
        {
            return null;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import { toPrimitive, toNumber, toInt32, toString, toPropertyKey } from "./native";

function neg (value) {
  if (value === undefined) {
    return false;
  }

  return !value;
}

function pos (value) {
  return !!value;
}

const ops = {
  // algorithms
  areSame (a, b) {
    if (a.type !== b.type) {
      return false;
    }

    if (a.isPrimitive && b.isPrimitive) {
      if (a.value == null) {
        return true;
      }

      if (a.type === "number") {
        if (isNaN(a.value) && isNaN(b.value)) {
          return true;
        }

        if (a.value === 0) {
          // this will account for negative zero
          return 1 / a.value === 1 / b.value;
        }
      }

      return a.value === b.value;
    }

    return a === b;
  },

  areSameOrZero (a, b) {
    if (a.type !== b.type) {
      return false;
    }

    if (a.isPrimitive && b.isPrimitive) {
      if (a.value == null) {
        return true;
      }

      if (a.type === "number") {
        if (isNaN(a.value) && isNaN(b.value)) {
          return true;
        }
      }

      return a.value === b.value;
    }

    return a === b;
  },

  *coerciveEquals (a, b) {
    /* eslint-disable eqeqeq */
    if (a.isPrimitive && b.isPrimitive) {
      return a.value == b.value;
    }

    if (a.type === b.type) {
      return this.strictEquals(a, b);
    }

    let primitiveA = yield toPrimitive(a);
    let primitiveB = yield toPrimitive(b);

    if ((typeof primitiveA === "number" || typeof primitiveB === "number") || (typeof primitiveA === "boolean" || typeof primitiveB === "boolean")) {
      return Number(primitiveA) === Number(primitiveB);
    }

    if (typeof primitiveA === "string") {
      return primitiveA === (yield toPrimitive(b, "string"));
    }

    if (typeof primitiveB === "string") {
      return (yield toPrimitive(a, "string")) === primitiveB;
    }

    // use native implicit comarison
    return primitiveA == primitiveB;
    /* eslint-enable eqeqeq */
  },

  strictEquals (a, b) {
    if (a.isPrimitive && b.isPrimitive) {
      return a.value === b.value;
    }

    if (a.isPrimitive || b.isPrimitive) {
      return false;
    }

    return a === b;
  },

  *relationalCompare (a, b, leftFirst) {
    let primitiveA, primitiveB;
    if (leftFirst) {
      primitiveA = yield toPrimitive(a, "number");
      primitiveB = yield toPrimitive(b, "number");
    } else {
      primitiveB = yield toPrimitive(b, "number");
      primitiveA = yield toPrimitive(a, "number");
    }

    if (typeof primitiveA === "string" && typeof primitiveB === "string") {
      return primitiveA < primitiveB;
    }

    primitiveA = Number(primitiveA);
    primitiveB = Number(primitiveB);

    if (isNaN(primitiveA) || isNaN(primitiveB)) {
      return undefined;
    }

    return primitiveA < primitiveB;
  },

  // equality operators
  *["=="] (a, b) { return yield this.coerciveEquals(a, b); },
  *["!="] (a, b) { return !(yield this.coerciveEquals(a, b)); },

  *["==="] (a, b) { return yield this.strictEquals(a, b); },
  *["!=="] (a, b) { return !(yield this.strictEquals(a, b)); },

  // additive operators
  *["+"] (a, b) {
    if (a.isPrimitive && b.isPrimitive) {
      return a.value + b.value;
    }

    let aa = yield toPrimitive(a);
    let bb = yield toPrimitive(b);

    if (a.isSymbol || b.isSymbol) {
      let convertType = typeof aa === "string" || typeof bb === "string" ? "string" : "number";
      throw TypeError(`Cannot convert Symbol to a ${convertType}`);
    }

    return aa + bb;
  },

  *["-"] (a, b) { return (yield toNumber(a)) - (yield toNumber(b)); },

  // multiplicative operators
  *["/"] (a, b) { return (yield toNumber(a)) / (yield toNumber(b)); },
  *["*"] (a, b) { return (yield toNumber(a)) * (yield toNumber(b)); },
  *["%"] (a, b) { return (yield toPrimitive(a)) % (yield toPrimitive(b)); },

  // bitwise shift operators
  *["<<"] (a, b) { return (yield toPrimitive(a)) << (yield toPrimitive(b)); },
  *[">>"] (a, b) { return (yield toPrimitive(a)) >> (yield toPrimitive(b)); },
  *[">>>"] (a, b) { return (yield toPrimitive(a)) >>> (yield toPrimitive(b)); },

  *["|"] (a, b) { return (yield toInt32(a)) | (yield toInt32(b)); },
  *["^"] (a, b) { return (yield toInt32(a)) ^ (yield toInt32(b)); },
  *["&"] (a, b) { return (yield toInt32(a)) & (yield toInt32(b)); },

  // relational operators
  *["<"] (a, b) { return pos(yield this.relationalCompare(a, b, true)); },
  *["<="] (a, b) { return neg(yield this.relationalCompare(b, a, false)); },
  *[">"] (a, b) { return pos(yield this.relationalCompare(b, a, false)); },
  *[">="] (a, b) { return neg(yield this.relationalCompare(a, b, true)); },

  *["in"] (a, b) {
    let key = yield toPropertyKey(a);

    if (b.isPrimitive) {
      let bString = yield toString(b);
      throw TypeError(`Cannot use 'in' operator to search for '${key}' in ${bString}`);
    }

    return b.has(key);
  },

  ["instanceof"] (a, b) {
    if (b.type !== "function") {
      throw TypeError(`Expecting a function in instanceof check, but got ${b.type}`);
    }

    if (a.isPrimitive) {
      return false;
    }

    return b.hasInstance(a);
  }
};

export default ops;


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
    <title>SimplePattern - SeqAn API Documentation</title>

      <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.css" type="text/css" media="screen" charset="utf-8" />

      <link rel="stylesheet" href="lib/bootstrap-multiselect/css/bootstrap-multiselect.css" type="text/css" media="screen" charset="utf-8" />

      <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
      <link rel="stylesheet" href="css/common.less.css" type="text/css" media="screen" charset="utf-8" />

Spec
SimplePattern

A brute force online searching algorithm.

    Extends

      Pattern

    All Extended

    Pattern

    Defined in

      <seqan/find.h>

    Signature

      template <typename TNeedle>
class Pattern<TNeedle, Simple>;

Template Parameters

        TNeedle
        The needle type. Types: ContainerConcept.

Interface Function Overview

Interface Functions Inherited From Pattern

getBeginScore

host

needle

position

scoringScheme

setNeedle

setScoringScheme

Interface  Metafunction Overview

Interface Metafunctions Inherited From Pattern

Container

Difference

Host

Needle

PexMultiFinder

Position

ScoringScheme

Size

Value

Detailed Description

This specialization should only be used if no other is applicable.

        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Dox Sources

/*!
 * @class SimplePattern
 *
 * @extends Pattern
 *
 * @headerfile <seqan/find.h>
 *
 * @brief A brute force online searching algorithm.
 *
 * @signature template <typename TNeedle> class Pattern<TNeedle, Simple>;
 *
 * @tparam TNeedle The needle type. Types: @link ContainerConcept @endlink.
 *
 * This specialization should only be used if no other is applicable.
 */

        <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>


text:
package gov.va.med.pharmacy.peps.updater.national.messaging.bean;

import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.interceptor.Interceptors;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor;

import gov.va.med.pharmacy.peps.updater.national.messaging.ReceiveFromLocalService;

/**
 * EJB implementation of InboundMessagingService.
 */

@MessageDriven(name = "ReceiveFromLocalService", activationConfig = {
                                                                     @ActivationConfigProperty(propertyName = "connectionFactoryJndiName", propertyValue = "jms/gov/va/med/pharmacy/peps/messagingservice/factory"),
                                                                     @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
                                                                     @ActivationConfigProperty(propertyName = "destinationName", propertyValue = "DatupQueue")

}, mappedName = "jms/gov/va/med/pharmacy/peps/messagingservice/queue/national/datup/receive")
@Interceptors(SpringBeanAutowiringInterceptor.class)
public class ReceiveFromLocalServiceBean implements ReceiveFromLocalService, MessageListener {
    private static final long serialVersionUID = 1L;
    private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ReceiveFromLocalServiceBean.class);

    @Autowired
    private ReceiveFromLocalService receiveFromLocalService;

    /**
     *
     * Called automatically by server.
     *
     * @param message Message from Local.
     *
     * @see gov.va.med.pharmacy.peps.external.local.messagingservice.depricated.inbound.message.MessagingServiceMdb#onMessage(javax.jms.Message)
     */
    @Resource
    javax.ejb.MessageDrivenContext mc;

    public void onMessage(Message message) {
        try {
            receiveFromLocalService.onMessage(message);
        }
        catch (Exception e) {
            LOG.error("Rolling back transaction for message: " + message, e);
            mc.setRollbackOnly();
        }
    }
}


text:
package org.sikuli.slides.api.slideshow;

import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;

import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.sikuli.slides.api.Context;
import org.sikuli.slides.api.actions.ActionExecutionException;
import org.sikuli.slides.api.models.Slide;

import com.google.common.collect.Lists;

public class DefaultSlideShowControllerEventTest {

	SlideShowController slideshow;
	private SlideShowListener listener;
	private Slide slide1;
	private Slide slide2;
	private Slide slide3;

	void pause(long msecs){
		try {
			Thread.sleep(msecs);
		} catch (InterruptedException e) {
		}
	}

	@Before
	public void setUp(){
		Context context = mock(Context.class);
	    slide1 = mock(Slide.class);
		slide2 = mock(Slide.class);
		slide3 = mock(Slide.class);
		List<Slide> slides = Lists.newArrayList(slide1, slide2, slide3);
		slideshow = new DefaultSlideShowController(context, slides);
		listener = mock(SlideShowListener.class);
		slideshow.addListener(listener);
	}

	@Test
	public void testSlideSelected() throws InterruptedException {
		slideshow.start();
		pause(1000);
		verify(listener).slideSelected(slide1);
		verify(listener).slideSelected(slide2);
		verify(listener).slideSelected(slide3);
	}

	@Test
	public void testDuringSlide1_NextNext() throws ActionExecutionException {
		slideshow.start();

		new Thread(){
			public void run(){
				slideshow.next();
				pause(100);
				slideshow.next();
				pause(100);
			}
		}.start();

		pause(800);

		verify(listener).slideSelected(slide1);
		verify(listener).slideSelected(slide2);
		verify(listener).slideSelected(slide3);
	}

}


text:
package org.apache.tapestry5.internal.services;

import org.apache.tapestry5.ValueEncoder;
import org.apache.tapestry5.services.ContextValueEncoder;
import org.apache.tapestry5.services.ValueEncoderSource;

@SuppressWarnings("all")
public class ContextValueEncoderImpl implements ContextValueEncoder
{
    private final ValueEncoderSource valueEncoderSource;

    public ContextValueEncoderImpl(ValueEncoderSource valueEncoderSource)
    {
        this.valueEncoderSource = valueEncoderSource;
    }

    public String toClient(Object value)
    {
        assert value != null;

        ValueEncoder encoder = valueEncoderSource.getValueEncoder(value.getClass());

        return encoder.toClient(value);
    }

    public <T> T toValue(Class<T> requiredType, String clientValue)
    {
        assert requiredType != null;

        ValueEncoder<T> encoder = valueEncoderSource.getValueEncoder(requiredType);

        return encoder.toValue(clientValue);
    }
}


text:
#pragma once

#include <aws/core/client/CoreErrors.h>
#include <aws/cloudhsm/CloudHSM_EXPORTS.h>

namespace Aws
{
namespace CloudHSM
{
enum class CloudHSMErrors
{
  //From Core//
  //////////////////////////////////////////////////////////////////////////////////////////
  INCOMPLETE_SIGNATURE = 0,
  INTERNAL_FAILURE = 1,
  INVALID_ACTION = 2,
  INVALID_CLIENT_TOKEN_ID = 3,
  INVALID_PARAMETER_COMBINATION = 4,
  INVALID_QUERY_PARAMETER = 5,
  INVALID_PARAMETER_VALUE = 6,
  MISSING_ACTION = 7, // SDK should never allow
  MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow
  MISSING_PARAMETER = 9, // SDK should never allow
  OPT_IN_REQUIRED = 10,
  REQUEST_EXPIRED = 11,
  SERVICE_UNAVAILABLE = 12,
  THROTTLING = 13,
  VALIDATION = 14,
  ACCESS_DENIED = 15,
  RESOURCE_NOT_FOUND = 16,
  UNRECOGNIZED_CLIENT = 17,
  MALFORMED_QUERY_STRING = 18,
  SLOW_DOWN = 19,
  REQUEST_TIME_TOO_SKEWED = 20,
  INVALID_SIGNATURE = 21,
  SIGNATURE_DOES_NOT_MATCH = 22,
  NETWORK_CONNECTION = 99,

  UNKNOWN = 100,
  ///////////////////////////////////////////////////////////////////////////////////////////

  CLOUD_HSM_INTERNAL= static_cast<int>(Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1,
  CLOUD_HSM_SERVICE,
  INVALID_REQUEST
};
namespace CloudHSMErrorMapper
{
  AWS_CLOUDHSM_API Client::AWSError<Client::CoreErrors> GetErrorForName(const char* errorName);
}

} // namespace CloudHSM
} // namespace Aws


text:
<?php

namespace Tsugi\UI;

use \Tsugi\UI\CrudForm;
use \Tsugi\Core\LTIX;

/**
 * Our class to generate pageable tables.
 *
 * This handles all the details for generating pageable, sortable tables
 * that from a particular database query.
 *
 * This is a pretty complex class and for now the best way to understand
 * it is to look at its use in various places throughout the code.
 *
 * This also interoperates with the CrudForm class in those cases where
 * a table needs links to a detail page for a row as seen in
 * admin/key/index.php
 *
 * @todo This is still emergent and as new use cases are encountered it
 * will likely evolve.
 */
class Table {

    public static $DEFAULT_PAGE_LENGTH = 20;  // Setting this to 2 is good for debugging

    public static function doForm($values, $override=Array()) {
        foreach (array_merge($values,$override) as $key => $value) {
            if ( $value === false ) continue;
            if ( is_string($value) && strlen($value) < 1 ) continue;
            if ( is_int($value) && $value === 0 ) continue;
            if ( $key == session_name() ) continue; // Will be added automatically
            echo('<input type="hidden" name="'.htmlent_utf8($key).
                 '" value="'.htmlent_utf8($value).'">'."\n");
        }
    }

    public static function doUrl($values, $override=Array()) {
        $retval = '';
        foreach (array_merge($values,$override) as $key => $value) {
            if ( $value === false ) continue;
            if ( is_string($value) && strlen($value) < 1 ) continue;
            if ( is_int($value) && $value === 0 ) continue;
            if ( $key == session_name() ) continue; // Will be added automatically
            if ( strlen($retval) > 0 ) $retval .= '&';
            $retval .= urlencode($key) . "=" . urlencode($value);
        }
        return $retval;
    }

    public static function makeUrl($url, $values, $override=Array()) {
        $extra = self::doUrl($values, $override);
        if ( strlen($extra) == 0 ) return $url;
        if ( strpos($url,'?') > 0 ) {
            $url .= '&';
        } else {
            $url .= '?';
        }
        $url .= $extra;
        return $url;
    }

    // Function to lookup and match things like R.updated_at to updated_at
    public static function matchColumns($colname, $columns) {
        if ( ! is_array($columns) ) return false;
        foreach ($columns as $v) {
            if ( $colname == $v ) return true;
            if ( strlen($v) < 2 ) continue;
            if ( substr($v,1,1) != '.' ) continue;
            if ( substr($v,2) == $colname ) return true;
        }
        return false;
    }

    // Requires the keyword WHERE to be upper case - if a query has more than one WHERE clause
    // they should all be lower case except the one where the LIKE clauses will be added.

    // We will add the ORDER BY clause at the end using the first field in $orderfields
    // is there is not a 'order_by' in $params

    // Normally $params should just default to $_GET
    public static function pagedQuery($sql, &$queryvalues, $searchfields=array(), $orderfields=false, $params=false) {
        if ( $params === false ) $params = $_GET;
        if ( $orderfields == false ) $orderfields = $searchfields;

        $searchtext = '';
        if ( count($searchfields) > 0 && isset($params['search_text']) ) {
            for($i=0; $i < count($searchfields); $i++ ) {
                if ( $i > 0 ) $searchtext .= " OR ";
                $searchtext .= $searchfields[$i]." LIKE :SEARCH".$i;
                $queryvalues[':SEARCH'.$i] = '%'.$params['search_text'].'%';
            }
        }

        $ordertext = '';
        if ( $params && isset($params['order_by']) && Table::matchColumns($params['order_by'], $orderfields) ) {
            $ordertext = $params['order_by']." ";
            if ( isset($params['desc']) && $params['desc'] == 1) {
                $ordertext .= "DESC ";
            }
        } else if ( count($orderfields) > 0 ) {
            $ordertext = $orderfields[0]." ";
        }

        $page_start = isset($params['page_start']) ? $params['page_start']+0 : 0;
        if ( $page_start < 0 ) $page_start = 0;
        $page_length = isset($params['page_length']) ? $params['page_length']+0 : self::$DEFAULT_PAGE_LENGTH;
        if ( $page_length < 0 ) $page_length = 0;

        $desc = '';
        if ( isset($params['desc']) ) {
            $desc = $params['desc']+0;
        }

        $limittext = '';
        if ( $page_start < 1 ) {
            $limittext = "".($page_length+1);
        } else {
            $limittext = "".$page_start.", ".($page_length+1);
        }

        // Remove any GROUP BY
        $gpos = strpos($sql,"GROUP BY");
        $groupby = false;
        if ( $gpos !== false ) {
            $groupby = substr($sql, $gpos);
            $sql = substr($sql, 0, $gpos);
            // echo("
\n".$sql."\n---\n".$groupby."\n
\n");
        }

        // Fix up the SQL Query
        $newsql = $sql;
        if ( strlen($searchtext) > 0 ) {
            if ( strpos($sql,"WHERE" ) !== false ) {
                $newsql = str_replace("WHERE", "WHERE ( ".$searchtext." ) AND ", $newsql);
            } else {
                $newsql .= "\nWHERE ( ".$searchtext." ) ";
            }
        }

        // Re-add any GROUP BY after WHERE
        if ( $groupby !== false ) {
            $newsql .= "\n" . $groupby;
        }

        if ( strlen($ordertext) > 0 ) {
            $newsql .= "\nORDER BY ".$ordertext." ";
        }
        if ( strlen($limittext) > 0 ) {
            $newsql .= "\nLIMIT ".$limittext." ";
        }
        return $newsql . "\n";
    }

    public static function pagedHeader($rows, $searchfields=array(), $orderfields=false, $view=false, $params=false, $extra_buttons=false) {
        if ( $params === false ) $params = $_GET;
        if ( $orderfields === false ) $orderfields = $searchfields;

        $page_start = isset($params['page_start']) ? $params['page_start']+0 : 0;
        if ( $page_start < 0 ) $page_start = 0;
        $page_length = isset($params['page_length']) ? $params['page_length']+0 : self::$DEFAULT_PAGE_LENGTH;
        if ( $page_length < 0 ) $page_length = 0;

        $search = '';
        if ( isset($params['search_text']) ) {
            $search = $params['search_text'];
        }

        $count = count($rows);
        $have_more = false;
        if ( $count > $page_length ) {
            $have_more = true;
            $count = $page_length;
        }

        echo('
');
        if ( $page_start > 0 ) {
            echo('<form style="display: inline">');
            echo('<input type="submit" value="Back" class="btn btn-default">');
            $page_back = $page_start - $page_length;
            if ( $page_back < 0 ) $page_back = 0;
            Table::doForm($params,Array('page_start' => $page_back));
            echo("</form>\n");
        }
        if ( $have_more ) {
            echo('<form style="display: inline">');
            echo('<input type="submit" value="Next" class="btn btn-default"> ');
            $page_next = $page_start + $page_length;
            Table::doForm($params,Array('page_start' => $page_next));
            echo("</form>\n");
        }
        echo("
\n");
        echo('<form>');
        if ( $searchfields && count($searchfields) > 0 ) {
        echo('<input type="text" id="paged_search_box" value="'.htmlent_utf8($search).'" name="search_text">');
        Table::doForm($params,Array('search_text' => false, 'page_start' => false));
    ?>
    <input type="submit" value="Search" class="btn btn-default">
    <input type="submit" value="Clear Search" class="btn btn-default"
    onclick="document.getElementById('paged_search_box').value = '';"
    >

<?php
    }
    // Add the sort drop-down
    if ( isset($rows[0]) && $orderfields && count($orderfields) > 0 ) {
        $row = $rows[0];
        $thispage = LTIX::curPageUrlNoQuery();
        if ( $view === false ) $view = $thispage;

        $desc = isset($params['desc']) ? $params['desc'] + 0 : 0;
        $order_by = isset($params['order_by']) ? $params['order_by'] : '';
        $first = true;
        foreach($row as $k => $v ) {
            if ( strpos($k, "_") === 0 ) continue;
            if ( $view !== false && strpos($k, "_id") !== false && is_numeric($v) ) {
                continue;
            }

            if ( $orderfields && ! Table::matchColumns($k, $orderfields ) ) {
                continue;
            }

            if ( $first ) {
?>

  <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
    Sort Order

  </button>

<?php
                $first = false;
            }

            $override = Array('order_by' => $k, 'desc' => 0, 'page_start' => false);
            $d = $desc;
            $note = " ↑";
            if ( $k == $order_by || $order_by == '' && $k == 'id' ) {
                $d = ($desc + 1) % 2;
                $override['desc'] = $d;
                $note = " ↓";
            }
            $detail = Table::makeUrl($thispage,$params,$override);

            echo('
');
            echo(ucwords(str_replace('_',' ',$k)));
            if ( $note ) echo ($note);
            echo("
\n");
        }

        if ( ! $first ) {
            echo("\n
\n");
        }
    }

    if ( is_array($extra_buttons) ) {
        foreach($extra_buttons as $button_text => $button_url ) {
            echo(''._m($button_text).''."\n");
        }
    }
    ?>
    </form>
    <?php
    }

    public static function pagedTable($rows, $searchfields=array(), $orderfields=false, $view=false, $params=false, $extra_buttons=false)
    {
        if ( $params === false ) $params = $_GET;
        self::pagedHeader($rows, $searchfields, $orderfields, $view, $params, $extra_buttons);

        $count = count($rows);

        $page_length = isset($params['page_length']) ? $params['page_length']+0 : self::$DEFAULT_PAGE_LENGTH;
        if ( $page_length < 0 ) $page_length = 0;

        // When we are doing paging, we select page_length+1 rows to know whether
        // we should show a Next button - but we don't want to show that extra
        // row in the output.
        if ( $page_length > 0 && $count > $page_length ) {
            $count = $page_length;
        }

        if ( $count < 1 ) {
            echo("
Nothing to display.
\n");
            return;
        }
    // print_r($orderfields);
    // echo("
\n");
    // print_r($rows[0]);
    ?>

    <?php

        $first = true;
        $thispage = LTIX::curPageUrlNoQuery();

	// Grab the last bit to make sure that session ID is added
        $pieces = explode('/', $thispage);
        if ( count($pieces) > 0 ) $thispage = $pieces[count($pieces)-1];
        if ( $view === false ) $view = $thispage;

        foreach ( $rows as $row ) {
            $count--;
            if ( $count < 0 ) break;
            if ( $first ) {
                echo("\n
\n");
                $desc = isset($params['desc']) ? $params['desc'] + 0 : 0;
                $order_by = isset($params['order_by']) ? $params['order_by'] : '';
                foreach($row as $k => $v ) {
                    if ( strpos($k, "_") === 0 ) continue;
                    if ( $view !== false && strpos($k, "_id") !== false && is_numeric($v) ) {
                        continue;
                    }

                    if ( $orderfields && ! Table::matchColumns($k, $orderfields ) ) {
                        echo("".CrudForm::fieldToTitle($k)."	\n");
                        continue;
                    }

                    $override = Array('order_by' => $k, 'desc' => 0, 'page_start' => false);
                    $d = $desc;
                    $color = "normal";
                    $arrow = '';
                    if ( $k == $order_by || $order_by == '' && $k == 'id' ) {
                        $d = ($desc + 1) % 2;
                        $override['desc'] = $d;
                        $color = $d == 1 ?  'success' : 'info';
                        $arrow = $d == 1 ?  ' ↑' : ' ↓';
                    }
                    $stuff = Table::doUrl($params,$override);
                    echo('');
                    echo('  0 ) {
                        echo("?");
                        echo($stuff);
                    }
                    echo('">');
                    echo(ucwords(str_replace('_',' ',$k)));
                    echo($arrow);
                    echo("	\n");
                }
                echo("
\n");
            }

            $first = false;
            $link_name = false;
            echo("
\n");
            foreach($row as $k => $v ) {
                if ( strpos($k, "_") === 0 ) continue;
                if ( $view !== false && strpos($k, "_id") !== false && is_numeric($v) ) {
                    $link_name = $k;
                    $link_val = $v;
                    continue;
                }
                echo("");
                if ( $link_name !== false ) {
                    $detail = Table::makeUrl($view,$params,Array($link_name => $link_val));
                    echo('');
                    if ( strlen($v) < 1 ) $v = $link_name.':'.$link_val;
                }
                echo(htmlent_utf8($v));
                if ( $link_name !== false ) {
                    echo('');
                }
                $link_name = false;
                $link_val = false;
                echo("	\n");
            }
            if ( $link_val !== false ) {
                echo("");
                echo(htmlent_utf8($link_val));
                echo("	\n");
            }
            echo("
\n");
        }
        echo("
\n");
        echo("
\n");
    }

    public static function pagedAuto($sql, $query_parms, $searchfields,
        $orderfields=false, $view=false, $params=false, $buttons=false) {
        global $PDOX;

        if ( $params === false ) $params = $_GET;

        $newsql = Table::pagedQuery($sql, $query_parms, $searchfields, $orderfields, $params);

        //echo("
\n$newsql\n
\n");

        $rows = $PDOX->allRowsDie($newsql, $query_parms);

        Table::pagedTable($rows, $searchfields, $orderfields, $view, $params, $buttons);
    }

}


text:
require 'spec_helper'

describe TicketPurchase do

  describe 'validations' do
    it 'has a valid factory' do
      expect(build(:ticket_purchase)).to be_valid
    end

    it 'is not valid without a conference_id' do
      should validate_presence_of(:conference_id)
    end

    it 'is not valid without a ticket_id' do
      should validate_presence_of(:ticket_id)
    end

    it 'is not valid without a user_id' do
      should validate_presence_of(:user_id)
    end

    it 'is not valid without a quantity' do
      should validate_presence_of(:quantity)
    end

    it 'is not valid with a quantity equals zero' do
      should_not allow_value(0).for(:quantity)
    end

    it 'is not valid with a quantity smaller than zero' do
      should_not allow_value(-1).for(:quantity)
    end

    it 'is valid with a quantity greater than zero' do
      should allow_value(1).for(:quantity)
    end

  end

  describe 'self#purchase' do
    let!(:participant) { create(:user) }
    let!(:ticket_1) { create(:ticket) }
    let!(:ticket_2) { create(:ticket) }
    let!(:conference) { create(:conference, tickets: [ticket_1, ticket_2]) }

    it 'creates a purchase for one ticket' do
      tickets = { ticket_1.id.to_s => '1' }
      message = TicketPurchase.purchase(conference, participant, tickets)
      purchase = TicketPurchase.where(conference_id: conference.id,
                                      user_id: participant.id,
                                      ticket_id: ticket_1.id).first

      expect(TicketPurchase.count).to eq(1)
      expect(purchase.quantity).to eq(1)
      expect(message.blank?).to be true
    end

    it 'creates several purchases for more than one ticket' do
      tickets = { ticket_1.id.to_s => '1', ticket_2.id.to_s => '1' }
      message = TicketPurchase.purchase(conference, participant, tickets)
      purchase_1 = TicketPurchase.where(conference_id: conference.id,
                                        user_id: participant.id,
                                        ticket_id: ticket_1.id).first

      purchase_2 = TicketPurchase.where(conference_id: conference.id,
                                        user_id: participant.id,
                                        ticket_id: ticket_2.id).first

      expect(TicketPurchase.count).to eq(2)
      expect(purchase_1.quantity).to eq(1)
      expect(purchase_2.quantity).to eq(1)
      expect(message.blank?).to be true
    end

    it 'creates no purchase if quantity is less than 1' do
      tickets = { ticket_1.id.to_s => '-1' }
      TicketPurchase.purchase(conference, participant, tickets)

      expect(TicketPurchase.count).to eq(0)
    end

    it 'creates no purchase if quantity is 0' do
      tickets = { ticket_1.id.to_s => '0' }
      TicketPurchase.purchase(conference, participant, tickets)

      expect(TicketPurchase.count).to eq(0)
    end

    it 'updates the quantity if the user already bought this ticket' do
      purchase = create(:ticket_purchase,
                        conference: conference,
                        user: participant,
                        ticket: ticket_1,
                        quantity: 5)

      tickets = { ticket_1.id.to_s => '10' }
      message = TicketPurchase.purchase(conference, participant, tickets)
      purchase.reload

      expect(TicketPurchase.count).to eq(1)
      expect(purchase.quantity).to eq(10)
      expect(message.blank?).to be true
    end
  end
end


text: User profile for: {{owner}}


text:
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt

using System;

namespace NUnit.Framework.Assertions
{
    [TestFixture]
    public class AssertInconclusiveTests
    {
        [Test]
        public void ThrowsInconclusiveException()
        {
            Assert.That(
                () => Assert.Inconclusive(),
                Throws.TypeOf<InconclusiveException>());
        }

        [Test]
        public void ThrowsInconclusiveExceptionWithMessage()
        {
            Assert.That(
                () => Assert.Inconclusive("MESSAGE"),
                Throws.TypeOf<InconclusiveException>().With.Message.EqualTo("MESSAGE"));
        }

        [Test]
        public void ThrowsInconclusiveExceptionWithMessageAndArgs()
        {
            Assert.That(
                () => Assert.Inconclusive("MESSAGE: {0}+{1}={2}", 2, 2, 4),
                Throws.TypeOf<InconclusiveException>().With.Message.EqualTo("MESSAGE: 2+2=4"));
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item name="baseFloatView" type="id" />
    <item name="baseContentView" type="id" />
</resources>


text:
'use strict';

/* Services */

angular.module('Photobox.js.services', ['ngResource']).
    factory('Index', function ($resource) {
        return $resource('api/index', {}, {
            load: {
                method: 'POST',
                isArray: true
            }
        });
    }).
    value('version', '0.1');


text:
package com.google.gwtorm.schema;

import com.google.gwtorm.client.Column;
import com.google.gwtorm.server.OrmException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public abstract class ColumnModel {
  protected ColumnModel parent;
  private String origName;
  protected int columnId;
  protected String columnName;
  protected Column column;
  protected Collection<ColumnModel> nestedColumns;
  protected boolean rowVersion;
  protected boolean inPrimaryKey;
  protected boolean notNull;

  protected ColumnModel() {
    nestedColumns = Collections.<ColumnModel>emptyList();
  }

  protected void initName(final String fieldName, final Column col) throws OrmException {
    if (col == null) {
      throw new OrmException(
          "Field " + fieldName + " is missing " + Column.class.getName() + " annotation");
    }
    column = col;
    origName = Util.any(column.name(), Util.makeSqlFriendly(fieldName));
    columnName = origName;
    columnId = column.id();
    if (columnId < 1) {
      throw new OrmException("Field " + fieldName + " cannot have id < 1");
    }
    notNull = column.notNull();
  }

  protected void initNestedColumns(final Collection<? extends ColumnModel> col)
      throws OrmException {
    nestedColumns = new ArrayList<>(col);
    recomputeColumnNames();
    if (!isNotNull()) {
      // If we permit NULL we need to make sure our contained columns
      // would also accept NULL, even if they wouldn't otherwise.
      //
      for (final ColumnModel c : getAllLeafColumns()) {
        c.notNull = false;
      }
    }

    Set<Integer> ids = new HashSet<>();
    for (final ColumnModel c : nestedColumns) {
      if (!ids.add(c.columnId)) {
        throw new OrmException(
            "Duplicate @Column id " + c.columnId + " in " + c.getPathToFieldName());
      }
    }
  }

  private void recomputeColumnNames() {
    final boolean thisHasName = !columnName.equals(Column.NONE);
    for (final ColumnModel c : nestedColumns) {
      c.parent = this;
      if (nestedColumns.size() == 1) {
        c.columnName = thisHasName ? columnName : c.origName;
      } else {
        if (thisHasName) {
          c.columnName = columnName + "_" + c.origName;
        } else {
          c.columnName = c.origName;
        }
      }
      c.recomputeColumnNames();
    }
  }

  public Collection<ColumnModel> getNestedColumns() {
    return nestedColumns;
  }

  public ColumnModel getField(final String name) {
    for (final ColumnModel c : nestedColumns) {
      if (c.getFieldName().equals(name)) {
        return c;
      }
    }
    return null;
  }

  public Collection<ColumnModel> getAllLeafColumns() {
    final ArrayList<ColumnModel> r = new ArrayList<>();
    for (final ColumnModel c : nestedColumns) {
      if (c.isNested()) {
        r.addAll(c.getAllLeafColumns());
      } else {
        r.add(c);
      }
    }
    return r;
  }

  public ColumnModel getParent() {
    return parent;
  }

  public String getPathToFieldName() {
    if (getParent() == null) {
      return getFieldName();
    }
    return getParent().getPathToFieldName() + "." + getFieldName();
  }

  public int getColumnID() {
    return columnId;
  }

  public String getColumnName() {
    return columnName;
  }

  public boolean isSqlPrimitive() {
    return getPrimitiveType() != null;
  }

  public boolean isNested() {
    return !isCollection() && getPrimitiveType() == null;
  }

  public boolean isRowVersion() {
    return rowVersion;
  }

  public Column getColumnAnnotation() {
    return column;
  }

  public boolean isNotNull() {
    return notNull;
  }

  public abstract boolean isCollection();

  public abstract String getFieldName();

  public abstract Class<?> getPrimitiveType();

  public abstract Type[] getArgumentTypes();

  public abstract String getNestedClassName();

  @Override
  public String toString() {
    final StringBuilder r = new StringBuilder();
    r.append("Column[\n");
    r.append("  id:       " + getColumnID() + "\n");
    r.append("  field:    " + getPathToFieldName() + "\n");
    r.append("  column:   " + getColumnName() + "\n");
    if (isSqlPrimitive()) {
      r.append("  type:     " + getPrimitiveType().getName() + "\n");
    } else {
      r.append("  contains: " + getNestedClassName() + "\n");
    }
    r.append("]");
    return r.toString();
  }
}


text:
package org.eclipse.egit.github.core;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

public class Reactions implements Serializable {

	/** serialVersionUID */
	private static final long serialVersionUID = 6358575015023539051L;

	private int totalCount;

	@SerializedName("+1")
	private int plusOne;
	@SerializedName("-1")
	private int minusOne;
	private int laugh;
	private int hooray;
	private int confused;
	private int heart;

	public int getTotalCount() {
		return totalCount;
	}

	public int getPlusOne() {
		return plusOne;
	}

	public Reactions setPlusOne(int value) {
		plusOne = value;
		updateTotalCount();
		return this;
	}

	public int getMinusOne() {
		return minusOne;
	}

	public Reactions setMinusOne(int value) {
		minusOne = value;
		updateTotalCount();
		return this;
	}

	public int getLaugh() {
		return laugh;
	}

	public Reactions setLaugh(int value) {
		laugh = value;
		updateTotalCount();
		return this;
	}

	public int getHooray() {
		return hooray;
	}

	public Reactions setHooray(int value) {
		hooray = value;
		updateTotalCount();
		return this;
	}

	public int getConfused() {
		return confused;
	}

	public Reactions setConfused(int value) {
		confused = value;
		updateTotalCount();
		return this;
	}

	public int getHeart() {
		return heart;
	}

	public Reactions setHeart(int value) {
		heart = value;
		updateTotalCount();
		return this;
	}

	private void updateTotalCount() {
		totalCount = plusOne + minusOne + laugh + hooray + confused + heart;
	}
}


text:
package org.gradle.internal.logging.console;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class MultiLineBuildProgressArea implements BuildProgressArea {
    // 2 lines: 1 for BuildStatus and 1 for Cursor parking space
    private final List<DefaultRedrawableLabel> entries = new ArrayList<DefaultRedrawableLabel>(2);
    private final DefaultRedrawableLabel progressBarLabel;

    private final List<StyledLabel> buildProgressLabels = new ArrayList<StyledLabel>();
    private final DefaultRedrawableLabel parkingLabel;
    private final Cursor statusAreaPos = new Cursor();
    private boolean isVisible;
    private boolean isPreviouslyVisible;

    public MultiLineBuildProgressArea() {
        int row = 0;

        progressBarLabel = newLabel(row--);
        entries.add(progressBarLabel);

        // Parking space for the write cursor
        parkingLabel = newLabel(row--);
        entries.add(parkingLabel);
    }

    private DefaultRedrawableLabel newLabel(int row) {
        return new DefaultRedrawableLabel(Cursor.at(row--, 0));
    }

    @Override
    public List<StyledLabel> getBuildProgressLabels() {
        return Collections.unmodifiableList(buildProgressLabels);
    }

    @Override
    public StyledLabel getProgressBar() {
        return progressBarLabel;
    }

    /**
     * The location of the top left of this progress area.
     */
    public Cursor getWritePosition() {
        return statusAreaPos;
    }

    public int getHeight() {
        return entries.size();
    }

    @Override
    public void resizeBuildProgressTo(int buildProgressLabelCount) {
        int delta = buildProgressLabelCount - buildProgressLabels.size();
        if (delta <= 0) {
            // We don't support shrinking at the moment
            return;
        }

        int row = parkingLabel.getWritePosition().row;
        parkingLabel.scrollDownBy(delta);
        while (delta-- > 0) {
            DefaultRedrawableLabel label = newLabel(row--);
            entries.add(entries.size() - 1, label);
            buildProgressLabels.add(label);
        }
    }

    public boolean isVisible() {
        return isVisible;
    }

    @Override
    public void setVisible(boolean isVisible) {
        this.isVisible = isVisible;
        for (DefaultRedrawableLabel label : entries) {
            label.setVisible(isVisible);
        }
    }

    public boolean isOverlappingWith(Cursor cursor) {
        for (DefaultRedrawableLabel label : entries) {
            if (label.isOverlappingWith(cursor)) {
                return true;
            }
        }
        return false;
    }

    public void newLineAdjustment() {
        statusAreaPos.row++;
        for (DefaultRedrawableLabel label : entries) {
            label.newLineAdjustment();
        }
    }

    public void redraw(AnsiContext ansi) {
        int newLines = 0 - statusAreaPos.row + getHeight() - 1;
        if (isVisible && newLines > 0) {
            ansi.cursorAt(Cursor.newBottomLeft()).newLines(newLines);
        }

        // Redraw every entry of this area
        for (int i = 0; i < entries.size(); ++i) {
            DefaultRedrawableLabel label = entries.get(i);

            label.redraw(ansi);

            // Ensure a clean end of the line when the area scrolls
            if (isVisible && newLines > 0 && (i + newLines) < entries.size()) {
                int currentLength = label.getWritePosition().col;
                int previousLength = entries.get(i + newLines).getWritePosition().col;
                if (currentLength < previousLength) {
                    ansi.writeAt(label.getWritePosition()).eraseForward();
                }
            }
        }

        if (isPreviouslyVisible || isVisible) {
            ansi.cursorAt(parkCursor());
        }
        isPreviouslyVisible = isVisible;
    }

    // According to absolute positioning
    private void scrollBy(int rows) {
        statusAreaPos.row -= rows;
        for (DefaultRedrawableLabel label : entries) {
            label.scrollBy(rows);
        }
    }

    // According to absolute positioning
    public void scrollUpBy(int rows) {
        scrollBy(-rows);
    }

    // According to absolute positioning
    public void scrollDownBy(int rows) {
        scrollBy(rows);
    }

    private Cursor parkCursor() {
        if (isVisible || statusAreaPos.row < 0) {
            return Cursor.newBottomLeft();
        } else {
            return statusAreaPos;
        }
    }
}


text:
require 'bio-rdf/extra/gwp'

Given /^I have a digest file with name 'Ce_CDS' and contains$/ do |string|
  @recs = BioRdf::Extra::Parsers::GWP::Digest::parse('Ce_CDS',nil,string)
  # p @recs
end

Then /^I should fetch the cluster names 'cluster(\d+)' and 'cluster(\d+)'$/ do |arg1, arg2|
  @recs['cluster00399'].should_not == nil
  @recs['cluster00400'].should_not == nil
end

Then /^for cluster (\d+)$/ do |arg1|
end

Then /^I should be able fetch the cluster :Ce_CDS_cluster(\d+)$/ do |arg1|
  @recs['cluster00400'][:clusterid].should == :Ce_CDS_cluster00400
end

Then /^I should be able to fetch the model 'M(\d+)\-(\d+)'$/ do |arg1, arg2|
  @recs['cluster00400'][:model].should == 'M78'
end

Then /^I should be able to fetch the lnL '(\d+)\.(\d+)'$/ do |arg1, arg2|
  @recs['cluster00400'][:lnL].should == 12.4
end

Then /^I should be able to fetch sequence size as (\d+)$/ do |arg1|
  @recs['cluster00400'][:seq_size].should == 206
end

Then /^I should be able to assert it is positively selected for (\d+) sites$/ do |arg1|
  @recs['cluster00400'][:is_pos_sel].should == true
  @recs['cluster00400'][:sites].should == 6
end

Then /^I should be able to output RDF$/ do |string|
  BioRdf::Writers::Turtle::Digest::to_rdf(@recs['cluster00400']).should == string
end

Then /^I should be able to output RDF without pos\. sel\.$/ do |string|
  BioRdf::Writers::Turtle::Digest::to_rdf(@recs['cluster00399']).should == string
end

Given /^I have a textual BLAST result with name 'Ce_CDS' in 'cluster(\d+)'  which contains$/ do |arg1, string|
  string.gsub!(/\\t/,"\t")
  @recs = BioRdf::Extra::Parsers::GWP::Blast::parse('Ce_CDS','cluster00400',string)
end

Then /^I should be able fetch the BLAST cluster :Ce_CDS_cluster(\d+)$/ do |arg1|
  @recs[0][:cluster].should == :Ce_CDS_cluster00400
end

Then /^I should be able fetch the Species name 'Ce'$/ do
  @recs[0][:homolog_species].should == 'Ce'
  @recs[0][:homolog_species_full].should == 'Caenorhabditis elegans'
end

Then /^I should be able fetch the gene name 'NP_(\d+)'$/ do |arg1|
  @recs[0][:homolog_gene].should == 'NP_'+arg1.to_s
end

Then /^I should be able fetch the description 'Protein CDC\-(\d+)'$/ do |arg1|
  @recs[0][:descr].should == "Protein CDC-26, isoform c  > Protein CDC-26, isoform cgi|392887062|ref|NP_001251447.1"
end

Then /^I should be able fetch the E\-value (\d+)\.(\d+)e\-(\d+)$/ do |arg1, arg2, arg3|
  @recs[0][:e_value].should == 1.76535e-89
end

Then /^I should be able to output BLAST RDF$/ do |string|
  BioRdf::Writers::Turtle::Blast::to_rdf(@recs[0]).should == string
end

Then /^I should be able to output BLAST RDF from description$/ do |string|
  BioRdf::Writers::Turtle::Blast::to_rdf(@recs[1]).should == string
end

Then /^I should be able to output Mi CDS BLAST RDF$/ do |string|
  BioRdf::Writers::Turtle::Blast::to_rdf(@recs[2]).should == string
end


text:
.Net wrapper for BrowserStack Screenshot API

## Status

![Build status](https://img.shields.io/badge/Build-Passing-brightgreen.svg)
![Nuget status](https://img.shields.io/badge/nuget-v%201.0.0-blue.svg)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)]()

As the name says **BrowserStack.Screenshots.Net** is a .Net wrapper that expose a very simple yet elegant wrapper around the BrowserStack Screenshots RESTful JSON API documented at https://www.browserstack.com/screenshots/api

Support
=====
Search issues(https://github.com/shahriarhossain/BrowserStack.Screenshots.Net/issues) and pull requests to see if your issue/request already exists. If it does, please leave a comment or a reaction. This helps me priortize what I work on next. Create a new issue if you can't find what you're looking for. :)


text:
/**
 * @since 1.0.0
 * @interface
 * @name IProvider
 * @param {any} provide
 * @param {Function} useClass
 * @param {any} useValue
 * @param {Function} useFactory
 *
 * @description
 * Provider config
 */
export interface IProvider {
  provide: any;
  useValue?: any;
  useClass?: Function;
  useFactory?: Function;
  deps?: Array<Function|IProvider>;
}

/**
 * @since 1.0.0
 * @interface
 * @name IAfterConstruct
 *
 * @description
 * After construct interface
 */
export interface IAfterConstruct {
  afterConstruct(): void;
}


text:
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/

This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

#ifndef BT_CONVEX_CAST_H
#define BT_CONVEX_CAST_H

#include "LinearMath/btTransform.h"
#include "LinearMath/btVector3.h"
#include "LinearMath/btScalar.h"
class btMinkowskiSumShape;
#include "LinearMath/btIDebugDraw.h"

/// btConvexCast is an interface for Casting
class btConvexCast
{
public:
    virtual ~btConvexCast();

    ///RayResult stores the closest result
    /// alternatively, add a callback method to decide about closest/all results
    struct CastResult
    {
        //virtual bool	addRayResult(const btVector3& normal,btScalar	fraction) = 0;

        virtual void DebugDraw(btScalar fraction)
        {
            (void)fraction;
        }
        virtual void drawCoordSystem(const btTransform& trans)
        {
            (void)trans;
        }
        virtual void reportFailure(int errNo, int numIterations)
        {
            (void)errNo;
            (void)numIterations;
        }
        CastResult()
            : m_fraction(btScalar(BT_LARGE_FLOAT))
            , m_debugDrawer(0)
            , m_allowedPenetration(btScalar(0))
        {
        }

        virtual ~CastResult(){};

        btTransform m_hitTransformA;
        btTransform m_hitTransformB;
        btVector3 m_normal;
        btVector3 m_hitPoint;
        btScalar m_fraction; //input and output
        btIDebugDraw* m_debugDrawer;
        btScalar m_allowedPenetration;
    };

    /// cast a convex against another convex object
    virtual bool calcTimeOfImpact(
    const btTransform& fromA,
    const btTransform& toA,
    const btTransform& fromB,
    const btTransform& toB,
    CastResult& result) = 0;
};

#endif //BT_CONVEX_CAST_H


text:
package de.undercouch.citeproc.bibtex;

import de.undercouch.citeproc.csl.CSLName;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Tests the name parser
 * @author Michel Kraemer
 */
public class NameParserTest {
    /**
     * Tests if a family name can be parsed
     */
    @Test
    public void familyOnly() {
        CSLName[] names = NameParser.parse("Thompson");
        assertEquals(1, names.length);
        assertEquals("Thompson", names[0].getFamily());
    }

    /**
     * Tests if a simple name can be parsed
     */
    @Test
    public void simple() {
        CSLName[] names = NameParser.parse("Ken Thompson");
        assertEquals(1, names.length);
        assertEquals("Ken", names[0].getGiven());
        assertEquals("Thompson", names[0].getFamily());
    }

    /**
     * Tests if a name with a middle initial can be parsed
     */
    @Test
    public void middleName() {
        CSLName[] names = NameParser.parse("Dennis M. Ritchie");
        assertEquals(1, names.length);
        assertEquals("Dennis M.", names[0].getGiven());
        assertEquals("Ritchie", names[0].getFamily());
    }

    /**
     * Tests if a name with initials can be parsed
     */
    @Test
    public void initials() {
        CSLName[] names = NameParser.parse("S. C. Johnson");
        assertEquals(1, names.length);
        assertEquals("S. C.", names[0].getGiven());
        assertEquals("Johnson", names[0].getFamily());
    }

    /**
     * Tests if a name with a non-dropping particle can be parsed
     */
    @Test
    public void nonDroppingParticle() {
        CSLName[] names = NameParser.parse("Michael van Gerwen");
        assertEquals(1, names.length);
        assertEquals("Michael", names[0].getGiven());
        assertEquals("van", names[0].getNonDroppingParticle());
        assertEquals("Gerwen", names[0].getFamily());
    }

    /**
     * Tests if a family name with a non-dropping particle can be parsed
     */
    @Test
    public void nonDroppingParticleFamilyOnly() {
        CSLName[] names = NameParser.parse("van Gerwen");
        assertEquals(1, names.length);
        assertEquals("van", names[0].getNonDroppingParticle());
        assertEquals("Gerwen", names[0].getFamily());
    }

    /**
     * Tests if a name with a comma can be parsed
     */
    @Test
    public void comma() {
        CSLName[] names = NameParser.parse("Thompson, Ken");
        assertEquals(1, names.length);
        assertEquals("Ken", names[0].getGiven());
        assertEquals("Thompson", names[0].getFamily());
    }

    /**
     * Tests if a name with a suffix can be parsed
     */
    @Test
    public void commaJunior() {
        CSLName[] names = NameParser.parse("Friedman, Jr., George");
        assertEquals(1, names.length);
        assertEquals("George", names[0].getGiven());
        assertEquals("Jr.", names[0].getSuffix());
        assertEquals("Friedman", names[0].getFamily());
    }

    /**
     * Tests if a name with a given name and two family names can be
     * parsed correctly and if the given name is not parsed as suffix
     */
    @Test
    public void commaNoJunior() {
        CSLName[] names = NameParser.parse("Familya Familyb, Given");
        assertEquals(1, names.length);
        assertEquals("Given", names[0].getGiven());
        assertEquals("Familya Familyb", names[0].getFamily());
    }

    /**
     * Tests if a name with a comma and a middle initial can be parsed
     */
    @Test
    public void commaInitials() {
        CSLName[] names = NameParser.parse("Ritchie, Dennis M.");
        assertEquals(1, names.length);
        assertEquals("Dennis M.", names[0].getGiven());
        assertEquals("Ritchie", names[0].getFamily());
    }

    /**
     * Tests if a name with a comma and a non-dropping particle can be parsed
     */
    @Test
    public void commaNonDroppingParticle() {
        CSLName[] names = NameParser.parse("van Gerwen, Michael");
        assertEquals(1, names.length);
        assertEquals("Michael", names[0].getGiven());
        assertEquals("van", names[0].getNonDroppingParticle());
        assertEquals("Gerwen", names[0].getFamily());
    }

    /**
     * Tests if a name with a comma and multiple non-dropping particles can be parsed
     */
    @Test
    public void commaNonDroppingParticles() {
        CSLName[] names = NameParser.parse("Van der Voort, Vincent");
        assertEquals(1, names.length);
        assertEquals("Vincent", names[0].getGiven());
        assertEquals("Van der", names[0].getNonDroppingParticle());
        assertEquals("Voort", names[0].getFamily());
    }

    /**
     * Tests if multiple names can be parsed
     */
    @Test
    public void and() {
        CSLName[] names = NameParser.parse("Michael van Gerwen and Vincent van der Voort");
        assertEquals(2, names.length);
        assertEquals("Michael", names[0].getGiven());
        assertEquals("van", names[0].getNonDroppingParticle());
        assertEquals("Gerwen", names[0].getFamily());
        assertEquals("Vincent", names[1].getGiven());
        assertEquals("van der", names[1].getNonDroppingParticle());
        assertEquals("Voort", names[1].getFamily());
    }

    /**
     * Tests if multiple names with commas can be parsed
     */
    @Test
    public void andComma() {
        CSLName[] names = NameParser.parse("van Gerwen, Michael and Van der Voort, Vincent");
        assertEquals(2, names.length);
        assertEquals("Michael", names[0].getGiven());
        assertEquals("van", names[0].getNonDroppingParticle());
        assertEquals("Gerwen", names[0].getFamily());
        assertEquals("Vincent", names[1].getGiven());
        assertEquals("Van der", names[1].getNonDroppingParticle());
        assertEquals("Voort", names[1].getFamily());
    }

    /**
     * Tests if multiple names with commas can be parsed
     */
    @Test
    public void andComma2() {
        CSLName[] names = NameParser.parse("van Gerwen, Michael and van der Voort, Vincent");
        assertEquals(2, names.length);
        assertEquals("Michael", names[0].getGiven());
        assertEquals("van", names[0].getNonDroppingParticle());
        assertEquals("Gerwen", names[0].getFamily());
        assertEquals("Vincent", names[1].getGiven());
        assertEquals("van der", names[1].getNonDroppingParticle());
        assertEquals("Voort", names[1].getFamily());
    }

    /**
     * Tests if multiple names with commas can be parsed
     */
    @Test
    public void andCommaMix() {
        CSLName[] names = NameParser.parse("van Gerwen, Michael and Vincent van der Voort");
        assertEquals(2, names.length);
        assertEquals("Michael", names[0].getGiven());
        assertEquals("van", names[0].getNonDroppingParticle());
        assertEquals("Gerwen", names[0].getFamily());
        assertEquals("Vincent", names[1].getGiven());
        assertEquals("van der", names[1].getNonDroppingParticle());
        assertEquals("Voort", names[1].getFamily());
    }

    /**
     * Tests if a name with a suffix can be parsed
     */
    @Test
    public void junior() {
        CSLName[] names = NameParser.parse("George Friedman, Jr.");
        assertEquals(1, names.length);
        assertEquals("George", names[0].getGiven());
        assertEquals("Jr.", names[0].getSuffix());
        assertEquals("Friedman", names[0].getFamily());
    }

    /**
     * Tests if a non-parseable name renders a literal string
     */
    @Test
    public void nonParseable() {
        String str = "Jerry Peek and Tim O'Reilly and Mike Loukides and other authors of the Nutshell handbooks";
        CSLName[] names = NameParser.parse(str);
        assertEquals(1, names.length);
        assertEquals(str, names[0].getLiteral());
    }
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HTTP Hound</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">


text:
.atom-single-service:hover i {
  color: #F90706;
}
.atom-single-service:hover .atom-service-info h5 {
  color: #F90706;
}

.atom-scroll-down a,
.atom-scroll-down a:hover,
.atom-scroll-down a:focus {
  color: #F90706;
}

.atom-subscribe-form .atom-subscribe-email:focus {
  border-color: #F90706;
}
.atom-subscribe-form .atom-subscribe-button {
  background-color: #F90706;
  border-color: #F90706;
}


text:
package com.chikeandroid.debtmanager.util;

import android.support.design.widget.TextInputLayout;
import android.view.View;
import android.widget.EditText;

import com.chikeandroid.debtmanager.util.validator.EditTextValidator;

/**
 * Created by Chike on 4/10/2017.
 */

public final class ValidationUtil {

    private ValidationUtil() {}

    public static boolean isEmpty(EditTextValidator editTextValidator) {

        EditText editText = editTextValidator.getEditText();
        String value = editText.getText().toString().trim();

        boolean isEmpty = StringUtil.isEmpty(value);

        if (isEmpty) {
            if (editText.getVisibility() != View.VISIBLE) {
                return false;
            }
            setError(editText, editTextValidator.getErrorMessage());
        }else {
            clearError(editText);
        }
        return isEmpty;
    }

    public static boolean isInValid(EditTextValidator editTextValidator) {
        boolean isValid = editTextValidator.isValid();
        if (isValid) {
            clearError(editTextValidator.getEditText());
        } else {
            setError(editTextValidator.getEditText(), editTextValidator.getErrorMessage());
        }
        return !isValid;
    }

    public static boolean isInValid(EditTextValidator... editTextValidators) {
        boolean isInValid = false;
        for (EditTextValidator editTextValidator : editTextValidators) {
            if (isInValid(editTextValidator)) {
                isInValid = true;
            }
        }
        return isInValid;
    }

    private static void setError(EditText editText, String errorString) {
        if (editText.getParent() != null && editText.getParent() instanceof TextInputLayout) {
            ((TextInputLayout) editText.getParent()).setError(editText.getHint() == null ? errorString : editText.getHint());
            ((TextInputLayout) editText.getParent()).setErrorEnabled(true);
        } else if (editText.getParent() != null
                && editText.getParent().getParent() != null && editText.getParent().getParent() instanceof TextInputLayout) {
            ((TextInputLayout) editText.getParent().getParent()).setError(editText.getHint() == null ? errorString : editText.getHint());
            ((TextInputLayout) editText.getParent().getParent()).setErrorEnabled(true);
        } else {
            editText.setError(editText.getHint() == null ? errorString : editText.getHint());
        }
    }

    public static void setError(EditText editText, int errorStringId) {
        if (editText != null) {
            setError(editText, editText.getResources().getString(errorStringId));
        }
    }

    private static void clearError(EditText editText) {
        if (editText.getParent() != null && editText.getParent() instanceof TextInputLayout) {
            ((TextInputLayout) editText.getParent()).setErrorEnabled(false);
            ((TextInputLayout) editText.getParent()).setError(null);
        }else if (editText.getParent() != null
                && editText.getParent().getParent() != null && editText.getParent().getParent() instanceof TextInputLayout) {
            ((TextInputLayout) editText.getParent().getParent()).setErrorEnabled(false);
            ((TextInputLayout) editText.getParent().getParent()).setError(null);
        }  else {
            editText.setError(null);
        }
    }

}


text:
"use strict";
import { parse } from "markdown-to-ast";
import * as path from "path";
import SourceCode from "../../src/core/source-code";
const testPath = path.join(__dirname, "fixtures", "test.md");
const dummyCode = `dummyCode`;
export default function createDummySourceCode(code = dummyCode, filePath = testPath) {
    return new SourceCode({
        code,
        ast: parse(code),
        ext: path.extname(filePath),
        filePath
    });
}


text:
package cartesianTree.heapKeyResolvers;

public interface IRandomGenerator
{
	long nextLong(long left, long right);
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
J. Econ. Taxon. Bot. 15(2): 477 (1991)

#### Original name
Micropera dahliae Died.

### Remarks
null


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Bloc Jams Angular</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Open+Sans:400,800,600,700,300">
    <link rel="stylesheet" type="text/css" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    <link rel="stylesheet" type="text/css" href="/styles/normalize.css">
    <link rel="stylesheet" type="text/css" href="/styles/main.css">
    <link rel="stylesheet" type="text/css" href="/styles/landing.css">
    <link rel="stylesheet" type="text/css" href="/styles/collection.css">
    <link rel="stylesheet" type="text/css" href="/styles/album.css">
    <link rel="stylesheet" type="text/css" href="/styles/player_bar.css">
    <link rel="stylesheet" type="text/css" href="/styles/user.css">

   <! -- navigation bar -->

      collection
      login
      profile
      register

  <ui-view></ui-view>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Voxalia.Shared
{
    public static class SystemExtensions
    {
        public static string Before(this string input, string match)
        {
            int ind = input.IndexOf(match);
            if (ind < 0)
            {
                return input;
            }

            return input.Substring(0, ind);
        }

        public static string BeforeAndAfter(this string input, string match, out string after)
        {
            int ind = input.IndexOf(match);
            if (ind < 0)
            {
                after = "";
                return input;
            }
            after = input.Substring(ind + match.Length);
            return input.Substring(0, ind);
        }

        public static string After(this string input, string match)
        {
            int ind = input.IndexOf(match);
            if (ind < 0)
            {
                return input;
            }
            return input.Substring(ind + match.Length);
        }

        public static double NextGaussian(this Random input)
        {
            double u1 = input.NextDouble();
            double u2 = input.NextDouble();
            return Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2);
        }
    }
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: craigwann1
 * Date: 3/26/15
 * Time: 10:21 PM
 */

namespace Incraigulous\ContentfulSDK;

use Incraigulous\ContentfulSDK\PayloadBuilders\PayloadBuilderInterface;

class RequestDecorator {
    protected $query;
    protected $resource;
    protected $payload;
    protected $id;
    protected $headers = array();

    function __construct(array $request = array())
    {
        $this->query = $request;
    }

    /**
     * Set the resource.
     * @param $resource
     */
    function setResource($resource)
    {
        $this->resource = $resource;
    }

    /**
     * Set the request ID.
     * @param $id
     */
    function setId($id)
    {
        $this->id = $id;
    }

    /**
     * Add a GET request query string paramater.
     * @param $field
     * @param $operator
     * @param $value
     */
    function addParameter($field, $operator, $value)
    {
        $this->query[] = [$field, $operator, $value];
    }

    /**
     * Add a request header.
     * @param $key
     * @param $value
     */
    function addHeader($key, $value) {
        $this->headers[$key] = $value;
    }

    /**
     * Set the payload. Can be a PayloadBuilder Object, an array, or an array with PayloadBuilder object parts.
     * @param $payload
     */
    function setPayload($payload)
    {
        $this->payload = $this->buildPayload($payload);
    }

    /**
     * Parse the payload to check for PayloadBuilder objects and make them.
     * @param $payload
     * @return array
     */
    function buildPayload(&$payload)
    {
        if (is_array($payload)) {
            $payload = $this->array_map_deep($payload, array($this, 'buildPayloadItemInfo'));
        } else {
            $payload = $this->makePayloadBuilder($payload);
            $this->buildPayload($payload);
        }

        return $payload;
    }

    /**
     * Helper function: Applies the callback to each level of array.
     *
     * @param $array
     * @param $callback
     * @return array|mixed
     */
    function array_map_deep($array, $callback) {
        $new = array();
        if(is_array($array)) foreach ($array as $key => $val) {
            if (is_array($val)) {
                $new[$key] = $this->array_map_deep($val, $callback);
            } else {
                $item = call_user_func($callback, $key, $val);
                $new[$item['key']] = $item['item'];
            }
        }
        else $new = call_user_func($callback, $array);
        return $new;
    }

    /**
     * The array_map_deep callback for buildPayload. If the array part is an object, it attempts to make payloadBuilder.
     *
     * @param $item
     * @return array
     */
    function buildPayloadItemInfo($key, $item)
    {
        if (is_object($item)) {
            $key = ($this->getPayloadBuilderKey($item)) ? $this->getPayloadBuilderKey($item) : $key;
            $item = $this->makePayloadBuilder($item);
        }
        return array(
            'key' => $key,
            'item' => $item
        );
    }

    /**
     * Make a payloadBuilder object.
     * @param PayloadBuilderInterface $payloadBuilder
     * @return array
     */
    function makePayloadBuilder(PayloadBuilderInterface $payloadBuilder)
    {
        return $payloadBuilder->make();
    }

    /**
     * Get the payload builder key. Will return void if no key specified.
     * @param PayloadBuilderInterface $payloadBuilder
     * @return string|void
     */
    function getPayloadBuilderKey(PayloadBuilderInterface $payloadBuilder)
    {
        return $payloadBuilder->getKey();
    }

    /**
     * Return an array ready to be http encoded.
     * @return array
     */
    function makeQuery()
    {
        $query = array();
        foreach($this->query as $paramater) {
            $operator = ($paramater[1] != '=') ? $paramater[1] : '' ;
            $query[$paramater[0] . $operator] = $paramater[2];
        }
        return $query;
    }

    /**
     * Return the payload.
     * @return mixed
     */
    function makePayload() {
        return $this->payload;
    }

    /**
     * Return the headers array.
     * @return array
     */
    function makeHeaders() {
        return $this->headers;
    }

    /**
     * Return the resource url part.
     * @return string
     */
    function makeResource()
    {
        $resource = $this->resource;
        if ($this->id) $resource .= '/' . $this->id;
        return $resource;
    }
}


text:
'use strict';

var PromiseA = require('bluebird');
var cli = require('./cli').create(process.stdin, process.stdout);

cli.ask("Enter an oauth3-enabled URL: ", cli.inputs.url).then(function (/*obj*/) {
  cli.ask("Enter your email address: ", cli.inputs.email).then(function (/*obj*/) {
    // TODO auto-clear line below
    //ws.cursorTo(0);
    cli.ws.clearLine(); // person just hit enter, they are on the next line
    cli.ws.write('\n');
    cli.ws.write('Check your email. You should receive a login code.\n');
    return cli.ask("Enter your auth code: ", {
      onReturnAsync: function (rrs, ws, str) {
        if (!/-/.test(str)) {
          return PromiseA.reject(new Error("[X] That doesn't look like a login code."));
        }
        return PromiseA.resolve();
      }
    }).then(function (obj) {
      console.log(obj);
    });
  });
});


text:
set_default(:unicorn_user) { user }
set_default(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" }
set_default(:unicorn_config) { "#{shared_path}/config/unicorn.rb" }
set_default(:unicorn_log) { "#{shared_path}/log/unicorn.log" }
set_default(:unicorn_workers, 20)

namespace :unicorn do
  desc "Setup Unicorn initializer and app configuration"
  task :setup, roles: :app do
    run "mkdir -p #{shared_path}/config"
    template "unicorn.rb.erb", unicorn_config
    template "unicorn_init.erb", "/tmp/unicorn_init"
    run "chmod +x /tmp/unicorn_init"
    run "#{sudo} mv /tmp/unicorn_init /etc/init.d/unicorn_#{application}"
    run "#{sudo} update-rc.d -f unicorn_#{application} defaults"
  end
  after "deploy:setup", "unicorn:setup"

  %w[start stop restart].each do |command|
    desc "#{command} unicorn"
    task command, roles: :app do
      run "service unicorn_#{application} #{command}"
    end
    after "deploy:#{command}", "unicorn:#{command}"
  end

  desc "Get output of unicorn log file"
  task :tail do
    stream "tail -n 300 -f #{unicorn_log}"
  end
end


text:
Yii 2 Minify View Component
===========================

The main feature of this component - concatenate and compress files
connected through "AssetBundle".

[![License](https://poser.pugx.org/rmrevin/yii2-minify-view/license.svg)](https://packagist.org/packages/rmrevin/yii2-minify-view)
[![Latest Stable Version](https://poser.pugx.org/rmrevin/yii2-minify-view/v/stable.svg)](https://packagist.org/packages/rmrevin/yii2-minify-view)
[![Latest Unstable Version](https://poser.pugx.org/rmrevin/yii2-minify-view/v/unstable.svg)](https://packagist.org/packages/rmrevin/yii2-minify-view)
[![Total Downloads](https://poser.pugx.org/rmrevin/yii2-minify-view/downloads.svg)](https://packagist.org/packages/rmrevin/yii2-minify-view)

Code Status
-----------
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/rmrevin/yii2-minify-view/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/rmrevin/yii2-minify-view/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/rmrevin/yii2-minify-view/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/rmrevin/yii2-minify-view/?branch=master)
[![Travis CI Build Status](https://travis-ci.org/rmrevin/yii2-minify-view.svg)](https://travis-ci.org/rmrevin/yii2-minify-view)
[![Dependency Status](https://www.versioneye.com/user/projects/54119b4b9e1622a6510000e1/badge.svg)](https://www.versioneye.com/user/projects/54119b4b9e1622a6510000e1)

Support
-------
[GutHub issues](https://github.com/rmrevin/yii2-minify-view/issues) or [public chat](https://gitter.im/rmrevin/support).

Installation
------------

The preferred way to install this extension is through [composer](https://getcomposer.org/).

Either run

```bash
composer require rmrevin/yii2-minify-view
```

or add

```
"rmrevin/yii2-minify-view": "^1.15",
```

to the `require` section of your `composer.json` file.

Configure
---------
```php
<?php

return [
	// ...
	'components' => [
		// ...
		'view' => [
			'class' => '\rmrevin\yii\minify\View',
			'enableMinify' => !YII_DEBUG,
			'concatCss' => true, // concatenate css
			'minifyCss' => true, // minificate css
			'concatJs' => true, // concatenate js
			'minifyJs' => true, // minificate js
			'minifyOutput' => true, // minificate result html page
			'webPath' => '@web', // path alias to web base
			'basePath' => '@webroot', // path alias to web base
			'minifyPath' => '@webroot/minify', // path alias to save minify result
			'jsPosition' => [ \yii\web\View::POS_END ], // positions of js files to be minified
			'forceCharset' => 'UTF-8', // charset forcibly assign, otherwise will use all of the files found charset
			'expandImports' => true, // whether to change @import on content
			'compressOptions' => ['extra' => true], // options for compress
			'excludeFiles' => [
            	'jquery.js', // exclude this file from minification
            	'app-[^.].js', // you may use regexp
            ],
            'excludeBundles' => [
            	\app\helloworld\AssetBundle::class, // exclude this bundle from minification
            ],
		]
	]
];
```


text:
<?php

namespace MediaVorus;

use FFMpeg\FFProbe;
use MediaVorus\MediaCollection;
use MediaVorus\Exception\FileNotFoundException;
use MediaVorus\Media\MediaInterface;
use Monolog\Logger;
use Monolog\Handler\NullHandler;
use PHPExiftool\Reader;
use PHPExiftool\Writer;

/**
 *
 * @author      Romain Neutron - imprec@gmail.com
 * @license     http://opensource.org/licenses/MIT MIT
 */
class MediaVorus
{
    private $reader;
    private $writer;
    private $ffprobe;

    public function __construct(Reader $reader, Writer $writer, FFProbe $ffprobe = null)
    {
        $this->reader = $reader;
        $this->writer = $writer;
        $this->ffprobe = $ffprobe;
    }

    /**
     * @return Reader
     */
    public function getReader()
    {
        return $this->reader;
    }

    /**
     * @return Writer
     */
    public function getWriter()
    {
        return $this->writer;
    }

    /**
     * @return FFProbe
     */
    public function getFFProbe()
    {
        return $this->ffprobe;
    }

    /**
     * Build a Media Object given a file
     *
     * @param string $file
     * @return MediaInterface
     * @throws FileNotFoundException
     */
    public function guess($file)
    {
        $fileObj = new File($file);
        $classname = $this->guessFromMimeType($fileObj->getMimeType());

        return new $classname($fileObj, $this->reader->reset()->files($file)->first(), $this->writer, $this->ffprobe);
    }

    /**
     *
     * @param \SplFileInfo $dir
     * @param type $recursive
     *
     * @return MediaCollection
     */
    public function inspectDirectory($dir, $recursive = false)
    {
        $this->reader
            ->reset()
            ->in($dir)
            ->followSymLinks();

        if ( ! $recursive) {
            $this->reader->notRecursive();
        }

        $files = new MediaCollection();

        foreach ($this->reader as $entity) {
            $file = new File($entity->getFile());
            $classname = $this->guessFromMimeType($file->getMimeType());
            $files[] = new $classname($file, $entity, $this->writer, $this->ffprobe);
        }

        return $files;
    }

    /**
     * Create MediaVorus
     *
     * @return MediaVorus
     */
    public static function create()
    {
        $logger = new Logger('MediaVorus');
        $logger->pushHandler(new NullHandler());

        return new static(Reader::create($logger), Writer::create($logger), FFProbe::create(array(), $logger));
    }

    /**
     * Return the corresponding \MediaVorus\Media\* class corresponding to a
     * mimetype
     *
     * @param string $mime
     * @return string The name of the MediaType class to use
     */
    protected function guessFromMimeType($mime)
    {
        $mime = strtolower($mime);

        switch (true) {
            case strpos($mime, 'image/') === 0:
            case $mime === 'application/postscript':
            case $mime === 'application/illustrator':
                return 'MediaVorus\Media\Image';
                break;

            case strpos($mime, 'video/') === 0:
            case $mime === 'application/vnd.rn-realmedia':
                return 'MediaVorus\Media\Video';
                break;

            case strpos($mime, 'audio/') === 0:
                return 'MediaVorus\Media\Audio';
                break;

            /**
             * @todo Implements Documents
             */
            case strpos($mime, 'text/') === 0:
            case $mime === 'application/msword':
            case $mime === 'application/access':
            case $mime === 'application/pdf':
            case $mime === 'application/excel':
            case $mime === 'application/powerpoint':
            case $mime === 'application/vnd.ms-powerpoint':
            case $mime === 'application/vnd.ms-excel':
            case $mime === 'application/vnd.oasis.opendocument.formula':
            case $mime === 'application/vnd.oasis.opendocument.text-master':
            case $mime === 'application/vnd.oasis.opendocument.database':
            case $mime === 'application/vnd.oasis.opendocument.formula':
            case $mime === 'application/vnd.oasis.opendocument.chart':
            case $mime === 'application/vnd.oasis.opendocument.graphics':
            case $mime === 'application/vnd.oasis.opendocument.presentation':
            case $mime === 'application/vnd.oasis.opendocument.speadsheet':
            case $mime === 'application/vnd.oasis.opendocument.text':
                return 'MediaVorus\Media\Document';
                break;

            case $mime === 'application/x-shockwave-flash':
                return 'MediaVorus\Media\Flash';
                break;

            default:
                break;
        }

        return 'MediaVorus\Media\DefaultMedia';
    }
}