text:
'''
Created on Nov 5, 2015

@author: David Zwicker <dzwicker@seas.harvard.edu>
'''

from __future__ import division

import itertools

import numpy as np

class Line(object):
    """ represents a line in n dimensions """

    def __init__(self, origin, direction, mutable=False):
        """ initialize the line with an `origin` point and a `direction` """
        self._mutable = mutable
        self.origin = asanyarray_flags(origin, np.double,
                                       writeable=self.mutable)
        self.direction = direction  # normalizes the direction

    @property
    def direction(self):
        return self._direction

    @direction.setter
    def direction(self, value):
        self._direction = np.array(value, np.double)  # make copy
        if self.origin.shape != self._direction.shape:
            raise ValueError('Direction vector must have the same dimension as '
                             'the origin vector')
        self._direction /= np.linalg.norm(self._direction)
        self._direction.flags.writeable = self.mutable

    @property
    def mutable(self):
        return self._mutable

    @mutable.setter
    def mutable(self, value):
        self._mutable = bool(value)
        self.origin.flags.writeable = self._mutable
        self._direction.flags.writeable = self._mutable

    @classmethod
    def from_points(cls, point1, point2, **kwargs):
        point1 = np.asanyarray(point1, np.double)
        point2 = np.asanyarray(point2, np.double)
        return cls(point1, point2 - point1, **kwargs)

    @property
    def dim(self):
        return len(self.origin)

    def __repr__(self):
        return "{cls}(origin={origin}, direction={direction})".format(
                        cls=self.__class__.__name__,
                        origin=self.origin, direction=self.direction)

    def contains_point(self, points):
        """ tests whether the points lie on the line """
        p_o = points - self.origin
        return np.isclose(np.abs(np.dot(p_o, self.direction)),
                          np.linalg.norm(p_o, axis=-1))

    def project_point(self, points):
        """ projects points onto the line """
        points = np.asanyarray(points, np.double)
        is_1d = (points.ndim == 1)

        p_o = points - self.origin
        dist_projection = np.dot(p_o, self.direction)
        res = self.origin + np.outer(dist_projection, self.direction)
        return res[0] if is_1d else res

    def point_distance(self, points):
        """ calculates the distance of points from the line """
        points = np.asanyarray(points, np.double)
        is_1d = (points.ndim == 1)

        p_o = points - self.origin
        dist_projection = np.dot(p_o, self.direction)
        diff_vector = p_o - np.outer(dist_projection, self.direction)
        dist = np.linalg.norm(diff_vector, axis=1)
        return dist[0] if is_1d else dist

    def distance(self, other):
        """ calculates distance to another line

        The math and the notation used here was taken from
        http://geomalgorithms.com/a07-_distance.html#dist3D_Segment_to_Segment
        """
        if isinstance(other, Line):
            if self.dim != other.dim:
                raise ValueError('Lines must be in space of same dimensions')

            p_0 = self.origin
            u = self.direction
            q_0 = other.origin
            v = other.direction
            w_0 = p_0 - q_0

            # a = np.dot(u, u)  # == 1 because of normalization
            b = np.dot(u, v)
            # c = np.dot(v, v)  # == 1 because of normalization
            d = np.dot(u, w_0)
            e = np.dot(v, w_0)

            denom = 1 - b**2  # == a*c - b**2
            if denom == 0:
                # lines are parallel
                s_c = 0
                t_c = d / b  # Note that b != 0, since b**2 = a*c and a*c != 0
            else:
                # lines are skewed
                s_c = (b*e - d) / denom  # (b*e - c*d) / denom
                t_c = (e - b*d) / denom  # (a*e - b*d) / denom

            diff = w_0 + s_c * u - t_c * v
            return np.linalg.norm(diff)

        else:
            raise TypeError("Don't know how to calculate distance to type `%s`",
                            other.__class__)

class Segment(object):
    """ represents a segment in n dimensions """

    def __init__(self, start, end, mutable=False):
        """ initialize the straight segment from point p1 to p2 """
        self._mutable = mutable
        self.start = asanyarray_flags(start, np.double, writeable=self.mutable)
        self.end = asanyarray_flags(end, np.double, writeable=self.mutable)

        # consistency check
        shape = (self.dim,)
        if self.start.shape != shape or self.end.shape != shape:
            raise ValueError('Both `start` and `end` must be points with the '
                             'same dimension.')

    @property
    def mutable(self):
        return self._mutable

    @mutable.setter
    def mutable(self, value):
        self._mutable = bool(value)
        self.start.flags.writeable = self._mutable
        self.end.flags.writeable = self._mutable

    @property
    def dim(self):
        return len(self.start)

    def __repr__(self):
        return "{cls}(start={start}, end={end})".format(
                    cls=self.__class__.__name__, start=self.start, end=self.end)

    @property
    def length(self):
        """ return the length of the segment """
        return np.linalg.norm(self.end - self.start)

    @property
    def centroid(self):
        """ return the centroid of the segment """
        return 0.5 * (self.start + self.end)

    @property
    def points(self):
        """ return the two endpoints as a single array """
        return np.vstack((self.start, self.end))

    @property
    def line(self):
        """ return the line that corresponds to this segment """
        return Line.from_points(self.start, self.end)

class Plane(object):
    """ represents a plane in n dimensions """

    def __init__(self, origin, normal, mutable=False):
        """ initialize the plane with an `origin` and a `normal` vector """
        self._mutable = mutable
        self.origin = asanyarray_flags(origin, np.double,
                                       writeable=self.mutable)
        self.normal = normal  # normalizes the vector and checks consistency

    @property
    def normal(self):
        return self._normal

    @normal.setter
    def normal(self, value):
        self._normal = np.array(value, np.double)  # make copy
        if self.origin.shape != self._normal.shape:
            raise ValueError('Normal vector (dim=%d) must have the same '
                             'dimension as the origin vector (dim=%d)' %
                             (len(self._normal), len(self.origin)))
        self._normal /= np.linalg.norm(self._normal)
        self._normal.flags.writeable = self.mutable

    @property
    def mutable(self):
        return self._mutable

    @mutable.setter
    def mutable(self, value):
        self._mutable = bool(value)
        self.origin.flags.writeable = self._mutable
        self._normal.flags.writeable = self._mutable

    @classmethod
    def from_points(cls, points, **kwargs):
        """ estimates a plane from a point cloud """
        points = np.array(points, np.double)  # make copy
        num, dim = points.shape
        if num < dim:
            raise ValueError('At least as many points as dimensions are '
                             'required to define a plane.')

        # center the points
        centroid = np.mean(points, axis=0)
        points = points - centroid[None, :]

        # get normal from left singular vector of the smallest singular value
        _, s, v = np.linalg.svd(points, full_matrices=False)
        return cls(centroid, v[np.argmin(s)], **kwargs)

    @classmethod
    def from_average(cls, planes, **kwargs):
        """ creates a plane by averaging other planes """
        return cls(origin=np.mean([plane.origin for plane in planes], axis=0),
                   normal=np.mean([plane.normal for plane in planes], axis=0),
                   **kwargs)

    @property
    def dim(self):
        return len(self.origin)

    def __repr__(self):
        return "{cls}(origin={origin}, normal={normal})".format(
                        cls=self.__class__.__name__,
                        origin=self.origin, normal=self.normal)

    def __hash__(self):
        """ custom hash function """
        return hash((tuple(self.origin), tuple(self.normal)))

    def __eq__(self, other):
        """ override the default equality test """
        if isinstance(other, self.__class__):
            return (np.all(self.origin == other.origin) and
                    np.all(self.normal == other.normal))
        return NotImplemented

    def __ne__(self, other):
        """ overwrite the default non-equality test """
        if isinstance(other, self.__class__):
            return not self.__eq__(other)
        return NotImplemented

    def copy(self, origin=None, normal=None):
        """ create a copy of the current plane with the given attributes """
        return self.__class__(origin=self.origin if origin is None else origin,
                              normal=self.normal if normal is None else normal)

    def distance_point(self, points, oriented=False):
        """ calculates the distance of points to the plane
        If `oriented` is True, the oriented distance is returned, which is
        positive if the point lies in the half space in which the normal points
        """
        p_o = points - self.origin
        distance = np.dot(p_o, self.normal)
        if oriented:
            return distance
        else:
            return np.abs(distance)

    def contains_point(self, points):
        """ tests whether the points lie on the plane """
        return np.isclose(self.distance_point(points), 0)

    def project_point(self, points):
        """ projects points onto this plane and returns the new coordinates """
        points = np.asanyarray(points, np.double)
        is_1d = (points.ndim == 1)

        p_o = points - self.origin
        dist = np.dot(p_o, self.normal)  # oriented distance
        res = points - np.outer(dist, self.normal)
        return res[0] if is_1d else res

    def flip_normal(self):
        """ returns a plane with the normal flipped """
        return self.copy(normal=-self.normal)

    def translate(self, vector=0, inplace=False):
        """ translates the plane by the `vector` """
        vector = np.asarray(vector)
        if inplace:
            self.origin += vector
            return self
        else:
            return self.copy(origin=self.origin + vector)

    def scale(self, factor, inplace=False):
        """ scales the plane by a constant factor """
        assert factor != 0
        if inplace:
            self.origin *= factor
            self.normal *= np.sign(factor)
        else:
            return self.copy(origin=self.origin * factor,
                             normal=self.normal * np.sign(factor))

class Cuboid(object):
    """ class that represents a cuboid in n dimensions """

    def __init__(self, pos, size, mutable=True):
        """ defines a cuboid from a position of one corner and a vector defining
        its size """
        self._mutable = mutable
        # set position and adjust mutable status later
        self.pos = np.array(pos, copy=True)
        self.size = size  # implicitly sets correct shape
        self.pos.flags.writeable = self.mutable

    @property
    def size(self):
        return self._size

    @size.setter
    def size(self, value):
        self._size = np.array(value, self.pos.dtype)  # make copy
        if self.pos.shape != self._size.shape:
            raise ValueError('Size vector (dim=%d) must have the same '
                             'dimension as the position vector (dim=%d)' %
                             (len(self._size), len(self.pos)))

        # flip Cuboid with negative size
        neg = (self._size < 0)
        self.pos[neg] += self._size[neg]
        self._size = np.abs(self._size)
        self._size.flags.writeable = self.mutable

    @property
    def mutable(self):
        return self._mutable

    @mutable.setter
    def mutable(self, value):
        self._mutable = bool(value)
        self.pos.flags.writeable = self._mutable
        self._size.flags.writeable = self._mutable

    @classmethod
    def from_points(cls, p1, p2, **kwargs):
        p1 = np.asarray(p1)
        p2 = np.asarray(p2)
        return cls(p1, p2 - p1, **kwargs)

    @classmethod
    def from_bounds(cls, bounds, **kwargs):
        bounds = np.asarray(bounds).reshape(-1, 2)
        return cls(bounds[:, 0], bounds[:, 1] - bounds[:, 0], **kwargs)

    @classmethod
    def from_centerpoint(cls, centerpoint, size, **kwargs):
        centerpoint = np.asarray(centerpoint)
        size = np.asarray(size)
        return cls(centerpoint - size / 2, size, **kwargs)

    @classmethod
    def from_pointcloud(cls, points, **kwargs):
        """ create bounding box from a point cloud """
        points = np.atleast_2d(points)
        p1 = np.min(points, axis=0)
        p2 = np.max(points, axis=0)
        return cls.from_points(p1, p2, **kwargs)

    def copy(self):
        return self.__class__(self.pos, self.size)

    def __repr__(self):
        return "{cls}(pos={pos}, size={size})".format(
                        cls=self.__class__.__name__,
                        pos=self.pos, size=self.size)

    def __eq__(self, other):
        """ override the default equality test """
        if isinstance(other, self.__class__):
            return (np.all(self.pos == other.pos) and
                    np.all(self.size == other.size))
        return NotImplemented

    def __ne__(self, other):
        """ overwrite the default non-equality test """
        if isinstance(other, self.__class__):
            return not self.__eq__(other)
        return NotImplemented

    @property
    def dim(self):
        return len(self.pos)

    @property
    def bounds(self):
        return [(p, p + s) for p, s in zip(self.pos, self.size)]

    @property
    def corners(self):
        """ return coordinates of two extreme corners defining the cuboid """
        return np.copy(self.pos), self.pos + self.size

    @corners.setter
    def corners(self, points):
        """ set coordinates of two extreme corners defining the cuboid """
        points = np.asarray(points)
        if points.shapes != (2, self.dim):
            raise ValueError('Expect two points with correct dimensions.')
        self.pos[:] = points[0, :]
        self.size = points[1, :] - points[0, :]

    @property
    def vertices(self):
        """ return the coordinates of all the corners """
        return list(itertools.product(*self.bounds))

    @property
    def diagonal(self):
        """ returns the length of the diagonal """
        return np.linalg.norm(self.size)

    @property
    def surface_area(self):
        """ generalization of the surface area of a cuboid in n dimensions. The
        surface area is the volume of the (n-1)-dimensional hypercubes that
        bound the current cuboid:
            n=1, the number of end points (2)
            n=2, the perimeter of the rectangle
            n=3, the surface area of the cuboid
        """
        sides = self.size
        null = (sides == 0)
        null_count = null.sum()
        if null_count == 0:
            return 2 * np.sum(np.product(sides) / sides)
        elif null_count == 1:
            return 2 * np.product(sides[~null])
        else:
            return 0

    @property
    def slices(self):
        return [slice(int(p), int(p + s)) for p, s in zip(self.pos, self.size)]

    @property
    def centroid(self):
        return self.pos + self.size / 2

    @centroid.setter
    def centroid(self, center):
        self.pos[:] = np.asanyarray(center) - self.size / 2

    @property
    def volume(self):
        return np.prod(self.size)

    def contains_point(self, points):
        """ returns a True when `points` are within the Cuboid """
        points = np.asarray(points)
        if len(points) == 0:
            return points

        if points.shape[-1] != self.dim:
            raise ValueError('Last dimension of `points` must agree with '
                             'cuboid dimension %d' % self.dim)

        c1, c2 = self.corners
        return np.all(c1 <= points, axis=-1) & np.all(points <= c2, axis=-1)

    def translate(self, distance=0, inplace=False):
        """ translates the cuboid by a certain distance in all directions """
        distance = np.asarray(distance)
        if inplace:
            self.pos += distance
            return self
        else:
            return self.__class__(self.pos + distance, self.size)

    def buffer(self, amount=0, inplace=False):
        """ dilate the cuboid by a certain amount in all directions """
        amount = np.asarray(amount)
        if inplace:
            self.pos -= amount
            self.size += 2*amount
            return self
        else:
            return self.__class__(self.pos - amount, self.size + 2*amount)

    def scale(self, factor=1, inplace=False):
        """ scale the cuboid by a certain amount in all directions. The corner
        with the smallest coordinates is used as the center """
        factor = np.asarray(factor)
        if inplace:
            self.pos *= factor
            self.size *= factor
            return self
        else:
            return self.__class__(self.pos * factor, self.size * factor)

    def extend(self, direction, magnitude=1, inplace=False):
        """ extends the box in a given direction by the given `magnitude` """
        direction = np.asanyarray(direction)
        if direction.shape != self.pos.shape:
            raise ValueError('`direction` must have same dimensions as box')

        dir_neg = (direction < 0)
        if inplace:
            self.size += np.abs(direction) * magnitude
            self.pos[dir_neg] += direction[dir_neg] * magnitude
            return self

        else:
            size = self.size + np.abs(direction) * magnitude
            pos = self.pos.copy()
            pos[dir_neg] += direction[dir_neg] * magnitude
            return self.__class__(pos, size)

    def adjust_side(self, axis, direction, position, inplace=False):
        """ adjust the position of a single side specified by the `axis` and a
        `direction`, which is either `1` or `-1`. The position of the side will
        be set to `position` """
        if inplace:
            if direction == 1:
                self.size[axis] = position - self.pos[axis]
            elif direction == -1:
                self.size[axis] -= position - self.pos[axis]
                self.pos[axis] = position
            else:
                RuntimeError('Direction should be either 1 or -1')
            return self

        else:
            pos, size = self.pos.copy(), self.size.copy()
            if direction == 1:
                size[axis] = position - pos[axis]
            elif direction == -1:
                size[axis] -= position - pos[axis]
                pos[axis] = position
            else:
                RuntimeError('Direction should be either 1 or -1')
            return self.__class__(pos, size)

    def face_plane(self, axis, direction=1):
        """ returns a Plane object that represents a plane through on of the
        sides perpendicular to `axis`. `direction` can be either -1, 0, or 1 and
        determines which of the sides is used. Here, 0 marks the center """
        if not np.isscalar(axis):
            raise TypeError('The `axis` argument must be a scalar that '
                            'determines along which axis the plane is taken.')

        origin = np.array(self.centroid)
        origin[axis] += 0.5 * np.sign(direction) * self.size[axis]
        normal = np.zeros(self.dim, np.double)
        normal[axis] = 1 if direction >= 0 else -1
        return Plane(origin, normal)

    def __add__(self, other):
        """ add two cuboids """
        if isinstance(other, self.__class__):
            if self.dim != other.dim:
                raise ValueError('Dimensionality mismatch (%d != %d)' %
                                 (self.dim, other.dim))
            p1a, p2a = self.corners
            p1b, p2b = other.corners
            return self.__class__.from_points(np.minimum(p1a, p1b),
                                              np.maximum(p2a, p2b))
        else:
            return NotImplemented

class Cylinder(object):
    """ represents a single cylinder """

    def __init__(self, center_1, center_2, radius, mutable=False):
        """ defines a cylinder from the two centers of the circles and a
        radius """
        self._mutable = mutable
        self.center_1 = asanyarray_flags(center_1, np.double, self.mutable)
        self.center_2 = asanyarray_flags(center_2, np.double, self.mutable)
        self.radius = float(radius)

        # consistency check
        shape = (self.dim,)
        if self.center_1.shape != shape or self.center_2.shape != shape:
            raise ValueError('Both center points must have the same dimension.')

    @property
    def mutable(self):
        return self._mutable

    @mutable.setter
    def mutable(self, value):
        self._mutable = bool(value)
        self.center_1.flags.writeable = self._mutable
        self.center_2.flags.writeable = self._mutable

    @classmethod
    def from_segment(cls, segment, radius):
        """ creates a cylinder from a Segment """
        return cls(segment.start, segment.end, radius)

    def __repr__(self):
        return '{cls}(center_1={p1}, center_2={p2}, radius={radius})'.format(
                cls=self.__class__, p1=self.center_1, p2=self.center_2,
                radius=self.radius)

    @property
    def dim(self):
        return len(self.center_1)

    @property
    def height(self):
        """ return the height of the cylinder """
        return np.linalg.norm(self.center_2 - self.center_1)

    @property
    def centroid(self):
        """ return the centroid of the segment """
        return 0.5 * (self.center_1 + self.center_2)

    def distance_point(self, point):
        """ this does only calculate the distance to the side walls """
        point = np.asanyarray(point, np.double)

        # move origin of the coordinate system onto p1
        p_o = point - self.center_1
        direction = self.center_2 - self.center_1
        direction /= self.height  # normalize direction

        # get normalized vector from (extended) center axis to point
        s_projection = np.dot(p_o, direction)
        proj_vec = p_o - s_projection * direction
        proj_vec /= np.linalg.norm(proj_vec)

        # get the vector to the cylinder surface
        radius_vector = self.radius * proj_vec

        # get point along the center axis, restricted to cylinder
        p_axis = np.clip(s_projection, 0, self.height) * direction

        # get vector from point to cylinder surface
        dist_centerline = np.linalg.norm(p_axis - p_o)
        if dist_centerline < self.radius:
            return 0
        else:
            dist_surface = np.linalg.norm(p_axis + radius_vector - p_o)
            return dist_surface

def asanyarray_flags(data, dtype=None, writeable=True):
    """ turns data into an array and sets the respective flags. A copy is only
    made if necessary """
    try:
        data_writeable = data.flags.writeable
    except AttributeError:
        # `data` did not have the writeable flag => it's not a numpy array
        result = np.array(data, dtype)
    else:
        if data_writeable != writeable:
            # need to make a copy because the flags differ
            result = np.array(data, dtype)
        else:
            # might have to make a copy to adjust the dtype
            result = np.asanyarray(data, dtype)

    # set the flags and return the array
    result.flags.writeable = writeable
    return result


text:
<!doctype html>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
	href="../quickforms/css/quickforms/quickforms.css" />
<link rel="stylesheet" href="css/custom.css" />

Francine App

			Edit

				<form id="ccmForm">

Home

Body

Tips

Baby

				</form>

© 2014 Francine app

redpajama_set_name: RedPajamaGithub


text:
Classes and functions often used in my OpenGL projects

## Required libraries:
* GLEW

## Optional libraries:
* Boost(wave)
Required by cStdShader.

## Required tools:
CMake
### On Linux
gcc
### On Windows
Visual Studio 2015

## How to build and install
```console
git clone https://github.com/demotomohiro/GLUtil.git
mkdir build
cd build
```
On Windows
```console
cmake -G "Visual Studio 14 2015 Win64" ../GLUtil
msbuild INSTALL.vcxproj
```
You can also open batchRIshader.sln with Visual Studio and build it.

On Linux
```console
cmake ../GLUtil
make
make install
```
### cmake options:
* -DCMAKE_BUILD_TYPE=[Debug|Release|RelWithDebInfo|MinSizeRel]
Specifies the build type. This options is ignored when used with Visual Studio.
* -DCMAKE_INSTALL_PREFIX="/path/to/install"
GLUtil will be insalled under the specified directory.
* -DBoost_USE_STATIC_LIBS=[on|off]
Set to ON to force the use of static Boost libraries. Default is OFF.
* -DBUILD_SHARED_LIBS=[on|off]
Set to ON to build shared libraries.

This software is released under the MIT License, see LICENSE.


text:
<?php
namespace Lavender\Database;

use Lavender\Contracts\Entity as EntityContract;
use Lavender\Contracts\Entity\Attribute as AttributeContract;

class Attribute implements AttributeContract
{
    /**
     * Entity Attribute Types
     */
    const DATE      = 'date';
    const DECIMAL   = 'decimal';
    const INDEX     = 'index';
    const INTEGER   = 'int';
    const BOOL      = 'bool';
    const TEXT      = 'text';
    const TIMESTAMP = 'timestamp';
    const VARCHAR   = 'varchar';

    protected $entity;

    protected $key;

    public function __construct(EntityContract $entity, $key)
    {
        $this->entity = $entity;

        $this->key = $key;
    }

    public function value()
    {
        return $this->entity->{$this->key};
    }

    public function backend()
    {
        return $this->value();
    }

    public function before_save($value)
    {
        return $value;
    }

    public function __toString()
    {
        return (string)$this->value();
    }
}


text:
require File.join(RAILS_ROOT, "vendor/plugins/minuet_core/lib/minuet_core")

# Add the permissions for this Minuet Engine into MinuetCore's permissions arrays
#MinuetCore.all_minuet_permissions << <%= controller_class_name %>.permissions if defined? MinuetCore


text:
package vizsgaadatok;

import static org.junit.Assert.*;

import java.sql.Timestamp;

import org.junit.Before;
import org.junit.Test;

public class VizsgaAdatokTest {

	private VizsgaAdatok va;

	@Before
	public void létrehoz(){
		va = new VizsgaAdatok(99);
	}

	@Test
	public void vizsgaIDejeBeállít(){
		va.setVizsgaIdeje(Timestamp.valueOf("2015-05-24 16:00:00"));
		assertEquals(Timestamp.valueOf("2015-05-24 16:00:00"), va.getVizsgaIdeje());
	}
	@Test
	public void pontszámBeállít(){
		va.setMegszerzettPontok(22);
		assertEquals(22, va.getMegszerzettPontok());
	}
	@Test
	public void oktatasiAdatokIDBeállít(){
		va.setOktatásiAdatId(16);
		assertEquals(16, va.getOktatásiAdatId());
	}
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using TypeLite.Extensions;
using TypeLite.TsModels;

namespace TypeLite {
    /// <summary>
    /// Creates a script model from CLR classes.
    /// </summary>
    public class TsModelBuilder {
        /// <summary>
        /// Gets or sets collection of classes in the model being built.
        /// </summary>
        internal Dictionary<Type, TsClass> Classes { get; set; }
        internal Dictionary<Type, TsEnum> Enums { get; set; }

        /// <summary>
        /// Initializes a new instance of the TsModelBuilder class.
        /// </summary>
        public TsModelBuilder() {
            this.Classes = new Dictionary<Type, TsClass>();
            this.Enums = new Dictionary<Type, TsEnum>();
        }

        /// <summary>
        /// Adds type with all referenced classes to the model.
        /// </summary>
        /// <typeparam name="T">The type to add to the model.</typeparam>
        /// <returns>type added to the model</returns>
        public TsModuleMember Add<T>() {
            return this.Add<T>(true);
        }

        /// <summary>
        /// Adds type and optionally referenced classes to the model.
        /// </summary>
        /// <typeparam name="T">The type to add to the model.</typeparam>
        /// <param name="includeReferences">bool value indicating whether classes referenced by T should be added to the model.</param>
        /// <returns>type added to the model</returns>
        public TsModuleMember Add<T>(bool includeReferences) {
            return this.Add(typeof(T), includeReferences);
        }

        /// <summary>
        /// Adds type with all referenced classes to the model.
        /// </summary>
        /// <param name="clrType">The type to add to the model.</param>
        /// <returns>type added to the model</returns>
        public TsModuleMember Add(Type clrType) {
            return this.Add(clrType, true);
        }

        /// <summary>
        /// Adds type and optionally referenced classes to the model.
        /// </summary>
        /// <param name="clrType">The type to add to the model.</param>
        /// <param name="includeReferences">bool value indicating whether classes referenced by T should be added to the model.</param>
        /// <returns>type added to the model</returns>
        public TsModuleMember Add(Type clrType, bool includeReferences) {
            var typeFamily = TsType.GetTypeFamily(clrType);
            if (typeFamily != TsTypeFamily.Class && typeFamily != TsTypeFamily.Enum) {
                throw new ArgumentException(string.Format("Type '{0}' isn't class or struct. Only classes and structures can be added to the model", clrType.FullName));
            }

            if (clrType.IsNullable()) {
                return this.Add(clrType.GetNullableValueType(), includeReferences);
            }

            if (typeFamily == TsTypeFamily.Enum) {
                var enumType = new TsEnum(clrType);
                this.AddEnum(enumType);
                return enumType;
            }

            if (clrType.IsGenericType) {
                if (!this.Classes.ContainsKey(clrType)) {
                    var openGenericType = clrType.GetGenericTypeDefinition();
                    var added = new TsClass(openGenericType);
                    this.Classes[openGenericType] = added;
                    if (includeReferences) {
                        this.AddReferences(added);

                        foreach (var e in added.Properties.Where(p => p.PropertyType.Type.IsEnum))
                            this.AddEnum(e.PropertyType as TsEnum);
                    }
                }
            }

            if (!this.Classes.ContainsKey(clrType)) {
                var added = new TsClass(clrType);
                this.Classes[clrType] = added;
                if (clrType.IsGenericParameter) added.IsIgnored = true;
                if (clrType.IsGenericType) added.IsIgnored = true;

                if (added.BaseType != null) {
                    this.Add(added.BaseType.Type);
                }
                if (includeReferences) {
                    this.AddReferences(added);

                    foreach (var e in added.Properties.Where(p => p.PropertyType.Type.IsEnum))
                        this.AddEnum(e.PropertyType as TsEnum);
                }

                foreach (var @interface in added.Interfaces) {
                    this.Add(@interface.Type);
                }

                return added;
            } else {
                return this.Classes[clrType];
            }
        }

        /// <summary>
        /// Adds enum to the model
        /// </summary>
        /// <param name="tsEnum">The enum to add</param>
        private void AddEnum(TsEnum tsEnum) {
            if (!this.Enums.ContainsKey(tsEnum.Type)) {
                this.Enums[tsEnum.Type] = tsEnum;
            }
        }

        /// <summary>
        /// Adds all classes annotated with the TsClassAttribute from an assembly to the model.
        /// </summary>
        /// <param name="assembly">The assembly with classes to add</param>
        public void Add(Assembly assembly) {
            foreach (var type in assembly.GetTypes().Where(t =>
                (t.GetCustomAttribute<TsClassAttribute>(false) != null && TsType.GetTypeFamily(t) == TsTypeFamily.Class) ||
                (t.GetCustomAttribute<TsEnumAttribute>(false) != null && TsType.GetTypeFamily(t) == TsTypeFamily.Enum) ||
                (t.GetCustomAttribute<TsInterfaceAttribute>(false) != null && TsType.GetTypeFamily(t) == TsTypeFamily.Class)
                )) {
                this.Add(type);
            }
        }

        /// <summary>
        /// Build the model.
        /// </summary>
        /// <returns>The script model with the classes.</returns>
        public TsModel Build() {
            var model = new TsModel(this.Classes.Values, this.Enums.Values);
            model.RunVisitor(new TypeResolver(model));
            return model;
        }

        /// <summary>
        /// Adds classes referenced by the class to the model
        /// </summary>
        /// <param name="classModel"></param>
        private void AddReferences(TsClass classModel) {
            foreach (var property in classModel.Properties.Where(model => !model.IsIgnored)) {
                var propertyTypeFamily = TsType.GetTypeFamily(property.PropertyType.Type);
                if (propertyTypeFamily == TsTypeFamily.Collection) {
                    var collectionItemType = TsType.GetEnumerableType(property.PropertyType.Type);
                    while (collectionItemType != null) {
                        var typeFamily = TsType.GetTypeFamily(collectionItemType);

                        switch (typeFamily) {
                            case TsTypeFamily.Class:
                                this.Add(collectionItemType);
                                collectionItemType = null;
                                break;
                            case TsTypeFamily.Enum:
                                this.AddEnum(new TsEnum(collectionItemType));
                                collectionItemType = null;
                                break;
                            case TsTypeFamily.Collection:
                                collectionItemType = TsType.GetEnumerableType(collectionItemType);
                                break;
                            default:
                                collectionItemType = null;
                                break;
                        }
                    }
                } else if (propertyTypeFamily == TsTypeFamily.Class) {
                    this.Add(property.PropertyType.Type);
                }
            }
            foreach (var genericArgument in classModel.GenericArguments) {
                var propertyTypeFamily = TsType.GetTypeFamily(genericArgument.Type);
                if (propertyTypeFamily == TsTypeFamily.Collection) {
                    var collectionItemType = TsType.GetEnumerableType(genericArgument.Type);
                    if (collectionItemType != null) {
                        var typeFamily = TsType.GetTypeFamily(collectionItemType);

                        switch (typeFamily) {
                            case TsTypeFamily.Class:
                                this.Add(collectionItemType);
                                break;
                            case TsTypeFamily.Enum:
                                this.AddEnum(new TsEnum(collectionItemType));
                                break;
                        }
                    }
                } else if (propertyTypeFamily == TsTypeFamily.Class) {
                    this.Add(genericArgument.Type);
                }
            }
        }
    }

}


text:
package com.baasbox.android.samples.phrasebook.utils;

import java.util.Random;

/**
 * Created by Andrea Tortorella on 09/09/14.
 */
public class ThreadLocalRandom extends Random {

    private static final long MULTIPLIER = 0x5DEECE66DL;
    private static final long ADDEND = 0xBL;
    private static final long MASK = (1L << 48) -1;

    private long rnd;

    boolean initialized;

    private long pad0,pad1,pad2,pad3,pad4,pad5,pad6,pad7;

    private static final ThreadLocal<ThreadLocalRandom> LOCAL_RANDOM =
            new ThreadLocal<ThreadLocalRandom>() {
                @Override
                protected ThreadLocalRandom initialValue() {
                    return new ThreadLocalRandom();
                }
            };

    ThreadLocalRandom(){
        super();
        initialized = true;
    }

    public static ThreadLocalRandom current(){
        return LOCAL_RANDOM.get();
    }

    public void setSeed(long seed) {
        if (initialized){
            throw new UnsupportedOperationException();
        }
        rnd = (seed ^ MULTIPLIER) & MASK;
    }

    protected int next(int bits) {
        rnd = (rnd * MULTIPLIER + ADDEND)& MASK;
        return (int) (rnd >>> (48-bits));
    }

    public int nextInt(int least,int bound) {
        if (least >= bound){
            throw new IllegalArgumentException();
        }
        return nextInt(bound-least)+least;
    }

    public long nextLong(long n) {
        if (n <= 0) {
            throw new IllegalArgumentException("n must be positive");
        }
        long offset = 0;
        while (n >= Integer.MAX_VALUE) {
            int bits = next(2);
            long half = n >>> 1;
            long nextn = ((bits & 2) == 0) ? half : n-half;
            if ((bits & 1) == 0) {
                offset += n -nextn;
            }
            n = nextn;
        }
        return offset + nextInt((int)n);
    }

    public long nextLong(long least,long bound){
        if (least >= bound){
            throw new IllegalArgumentException();
        }
        return nextLong((bound-least)) + least;
    }

    public double nextDouble(double n) {
        if (n <= 0) {
            throw new IllegalArgumentException("n must be positive");
        }
        return nextDouble()*n;
    }

    public double nextDouble(double least,double bound) {
        if (least>=bound){
            throw new IllegalArgumentException();
        }
        return nextDouble()*(bound-least)+least;
    }

    private static final long serialVersionUID = -5851777807851030925L;
}


text:
using System.IO;
using System.Threading.Tasks;

namespace Masticore
{
    /// <summary>
    /// Interface for a file hosted in the cloud
    /// </summary>
    public interface IFile
    {
        /// <summary>
        /// Gets  the container name of the cloud file
        /// Azure Contrainer names are between 3 and 63 characters long, thus you may want to annotate implementers of this property with
        /// [Required]
        /// [MinLength(3)]
        /// [MaxLength(63)]
        /// </summary>
        string ContainerName { get; }

        /// <summary>
        /// Gets the blob name
        /// [Required]
        /// [MinLength(1)]
        /// [MaxLength(1024)]
        /// </summary>
        string FileName { get; }
    }

    /// <summary>
    /// Base interface for a File Service that provides the connection string
    /// </summary>
    public interface IFileService : INeedStorageConnectionString, IService
    {
    }

    /// <summary>
    /// Interface for a service that implements cloud file upload, download, and delete
    /// </summary>
    public interface IFileService<FileType> : IFileService
        where FileType : IFile
    {
        /// <summary>
        /// Calculates a URL for the given cloud file, useful for situations like setting the src attribute on an img tag
        /// </summary>
        /// <param name="cloudFile"></param>
        /// <returns></returns>
        string GetFileUrl(FileType cloudFile);

        Task<string> GetFileUrlWithToken(FileType cloudFile);

        string GetFileUrlWithToken(string fileUrl);

        /// <summary>
        /// Deletes the given file from storage
        /// NOTE: This should NOT change the cloudFile properties at all
        /// </summary>
        /// <param name="cloudFile"></param>
        /// <returns></returns>
        Task DeleteAsync(FileType cloudFile);

        /// <summary>
        /// Async returns the stream for the given file
        /// NOTE: This should NOT change the cloudFile properties at all
        /// </summary>
        /// <param name="cloudFile"></param>
        /// <returns></returns>
        Task<Stream> DownloadAsync(FileType cloudFile);

        /// <summary>
        /// Async overwrites the file for the given cloudFile with the given stream
        /// NOTE: This should NOT change the cloudFile properties at all
        /// </summary>
        /// <param name="cloudFile"></param>
        /// <param name="fileStream"></param>
        /// <returns></returns>
        Task UploadAsync(FileType cloudFile, Stream fileStream);

        Task UploadAsync(FileType cloudFile, string fileContent);

        Task UploadAsync(FileType cloudFile, Stream fileStream, bool isSnapshot = false);

        Task UploadAsync(FileType cloudFile, string fileContent, bool isSnapshot = false);
    }
}


text:
<?php

namespace Symfony\Component\Cache\Simple;

use Symfony\Component\Cache\Traits\MemcachedTrait;

class MemcachedCache extends AbstractCache
{
    use MemcachedTrait;

    protected $maxIdLength = 250;

    /**
     * @param \Memcached $client
     * @param string     $namespace
     * @param int        $defaultLifetime
     */
    public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0)
    {
        $this->init($client, $namespace, $defaultLifetime);
    }
}


text:
alter table session alter column notes type oid using notes::oid;
alter table dataset alter column notes type oid using notes::oid;
alter table job alter column screenoutput type oid using screenoutput::oid;
alter table job alter column sourcecode type oid using sourcecode::oid;
alter table job alter column statedetail type oid using statedetail::oid;
alter table job alter column tooldescription type oid using tooldescription::oid;


text:
<?php

namespace Test\Providers;

use Fake\Kernels\Http\StubKernelHttpEmpty;
use Neutrino\Constants\Services;
use Neutrino\Providers\Session;
use Phalcon\Config;
use Phalcon\Session\Adapter\Files;
use Phalcon\Session\Bag;
use Test\TestCase\TestCase;

/**
 * Class ProviderSessionTest
 *
 * @package Test\Providers
 */
class ProviderSessionTest extends TestCase
{
    protected function kernel()
    {
        return StubKernelHttpEmpty::class;
    }

    public function testRegister()
    {
        $this->app->config->session = new Config([
            'default' => 'files',
            'stores' => [
                'files' => [
                    'adapter' => 'Files',
                ]
            ]
        ]);

        $provider = new Session();

        $provider->registering();

        $this->assertTrue($this->getDI()->has(Services::SESSION));

        $this->assertTrue($this->getDI()->getService(Services::SESSION)->isShared());

        $this->assertInstanceOf(
            Files::class,
            $this->getDI()->getShared(Services::SESSION)
        );

        $this->assertTrue($this->getDI()->has(Services::SESSION_BAG));

        $this->assertFalse($this->getDI()->getService(Services::SESSION_BAG)->isShared());

        $this->assertInstanceOf(
            Bag::class,
            $this->getDI()->get(Services::SESSION_BAG, ['name' => ''])
        );
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testWrongStore()
    {
        $this->app->config->session = new Config([
            'default' => 'foo',
            'stores' => [
                'files' => [
                    'adapter' => 'Files',
                ]
            ]
        ]);

        $provider = new Session();

        $provider->registering();

        $this->getDI()->getShared(Services::SESSION);
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testFailRegister()
    {
        $this->app->config->session = new Config([
            'default' => 'my',
            'stores' => [
                'my' => [
                    'adapter' => 'NoValidClass',
                ]
            ]
        ]);

        $provider = new Session();

        $provider->registering();

        $this->getDI()->getShared(Services::SESSION);
    }
}


text:
#ifndef NPFUNCTIONS_H
#define NPFUNCTIONS_H

#include "npruntime.h"
#include "npapi.h"

#ifdef __cplusplus
extern "C" {
#endif

#if defined(XP_WIN)
#define EXPORTED_CALLBACK(_type, _name) _type (__stdcall * _name)
#else
#define EXPORTED_CALLBACK(_type, _name) _type (* _name)
#endif

typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* URL, const char* window, void* notifyData);
typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* URL, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer);
typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message);
typedef const char*(*NPN_UserAgentProcPtr)(NPP instance);
typedef void* (*NPN_MemAllocProcPtr)(uint32_t size);
typedef void (*NPN_MemFreeProcPtr)(void* ptr);
typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size);
typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages);
typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect);
typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region);
typedef void (*NPN_ForceRedrawProcPtr)(NPP instance);
typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* URL, const char* window);
typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* URL, const char* window, uint32_t len, const char* buf, NPBool file);
typedef void* (*NPN_GetJavaEnvProcPtr)(void);
typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance);
typedef void  (*NPN_PushPopupsEnabledStateProcPtr)(NPP instance, NPBool enabled);
typedef void  (*NPN_PopPopupsEnabledStateProcPtr)(NPP instance);
typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP npp, void (*func)(void *), void *userData);
typedef NPError (*NPN_GetValueForURLProcPtr)(NPP npp, NPNURLVariable variable, const char* url, char** value, uint32_t* len);
typedef NPError (*NPN_SetValueForURLProcPtr)(NPP npp, NPNURLVariable variable, const char* url, const char* value, uint32_t len);
typedef NPError (*NPN_GetAuthenticationInfoProcPtr)(NPP npp, const char* protocol, const char* host, int32_t port, const char* scheme, const char *realm, char** username, uint32_t* ulen, char** password, uint32_t* plen);

typedef uint32_t (*NPN_ScheduleTimerProcPtr)(NPP npp, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
typedef void (*NPN_UnscheduleTimerProcPtr)(NPP npp, uint32_t timerID);
typedef NPError (*NPN_PopUpContextMenuProcPtr)(NPP instance, NPMenu* menu);
typedef NPBool (*NPN_ConvertPointProcPtr)(NPP npp, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled);
typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction);
typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow);

typedef void (*NPN_ReleaseVariantValueProcPtr) (NPVariant *variant);

typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr) (const NPUTF8 *name);
typedef void (*NPN_GetStringIdentifiersProcPtr) (const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers);
typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr) (int32_t intid);
typedef int32_t (*NPN_IntFromIdentifierProcPtr) (NPIdentifier identifier);
typedef bool (*NPN_IdentifierIsStringProcPtr) (NPIdentifier identifier);
typedef NPUTF8 *(*NPN_UTF8FromIdentifierProcPtr) (NPIdentifier identifier);

typedef NPObject* (*NPN_CreateObjectProcPtr) (NPP, NPClass *aClass);
typedef NPObject* (*NPN_RetainObjectProcPtr) (NPObject *obj);
typedef void (*NPN_ReleaseObjectProcPtr) (NPObject *obj);
typedef bool (*NPN_InvokeProcPtr) (NPP npp, NPObject *obj, NPIdentifier methodName, const NPVariant *args, unsigned argCount, NPVariant *result);
typedef bool (*NPN_InvokeDefaultProcPtr) (NPP npp, NPObject *obj, const NPVariant *args, unsigned argCount, NPVariant *result);
typedef bool (*NPN_EvaluateProcPtr) (NPP npp, NPObject *obj, NPString *script, NPVariant *result);
typedef bool (*NPN_GetPropertyProcPtr) (NPP npp, NPObject *obj, NPIdentifier  propertyName, NPVariant *result);
typedef bool (*NPN_SetPropertyProcPtr) (NPP npp, NPObject *obj, NPIdentifier  propertyName, const NPVariant *value);
typedef bool (*NPN_HasPropertyProcPtr) (NPP, NPObject *npobj, NPIdentifier propertyName);
typedef bool (*NPN_HasMethodProcPtr) (NPP npp, NPObject *npobj, NPIdentifier methodName);
typedef bool (*NPN_RemovePropertyProcPtr) (NPP npp, NPObject *obj, NPIdentifier propertyName);
typedef void (*NPN_SetExceptionProcPtr) (NPObject *obj, const NPUTF8 *message);
typedef bool (*NPN_EnumerateProcPtr) (NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count);
typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);

typedef NPError (*NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
typedef NPError (*NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
typedef NPError (*NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
typedef NPError (*NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
typedef NPError (*NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
typedef void (*NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
typedef int32_t (*NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
typedef int32_t (*NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
typedef void (*NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
typedef int16_t (*NPP_HandleEventProcPtr)(NPP instance, void* event);
typedef void (*NPP_URLNotifyProcPtr)(NPP instance, const char* URL, NPReason reason, void* notifyData);
typedef NPError (*NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
typedef NPError (*NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
typedef NPBool (*NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
typedef void (*NPP_LostFocusPtr)(NPP instance);
typedef void (*NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
typedef NPError (*NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
typedef char** (*NPP_GetSitesWithDataPtr)(void);

typedef void *(*NPP_GetJavaClassProcPtr)(void);
typedef void* JRIGlobalRef; //not using this right now

typedef struct _NPNetscapeFuncs {
    uint16_t size;
    uint16_t version;

    NPN_GetURLProcPtr geturl;
    NPN_PostURLProcPtr posturl;
    NPN_RequestReadProcPtr requestread;
    NPN_NewStreamProcPtr newstream;
    NPN_WriteProcPtr write;
    NPN_DestroyStreamProcPtr destroystream;
    NPN_StatusProcPtr status;
    NPN_UserAgentProcPtr uagent;
    NPN_MemAllocProcPtr memalloc;
    NPN_MemFreeProcPtr memfree;
    NPN_MemFlushProcPtr memflush;
    NPN_ReloadPluginsProcPtr reloadplugins;
    NPN_GetJavaEnvProcPtr getJavaEnv;
    NPN_GetJavaPeerProcPtr getJavaPeer;
    NPN_GetURLNotifyProcPtr geturlnotify;
    NPN_PostURLNotifyProcPtr posturlnotify;
    NPN_GetValueProcPtr getvalue;
    NPN_SetValueProcPtr setvalue;
    NPN_InvalidateRectProcPtr invalidaterect;
    NPN_InvalidateRegionProcPtr invalidateregion;
    NPN_ForceRedrawProcPtr forceredraw;

    NPN_GetStringIdentifierProcPtr getstringidentifier;
    NPN_GetStringIdentifiersProcPtr getstringidentifiers;
    NPN_GetIntIdentifierProcPtr getintidentifier;
    NPN_IdentifierIsStringProcPtr identifierisstring;
    NPN_UTF8FromIdentifierProcPtr utf8fromidentifier;
    NPN_IntFromIdentifierProcPtr intfromidentifier;
    NPN_CreateObjectProcPtr createobject;
    NPN_RetainObjectProcPtr retainobject;
    NPN_ReleaseObjectProcPtr releaseobject;
    NPN_InvokeProcPtr invoke;
    NPN_InvokeDefaultProcPtr invokeDefault;
    NPN_EvaluateProcPtr evaluate;
    NPN_GetPropertyProcPtr getproperty;
    NPN_SetPropertyProcPtr setproperty;
    NPN_RemovePropertyProcPtr removeproperty;
    NPN_HasPropertyProcPtr hasproperty;
    NPN_HasMethodProcPtr hasmethod;
    NPN_ReleaseVariantValueProcPtr releasevariantvalue;
    NPN_SetExceptionProcPtr setexception;
    NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate;
    NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate;
    NPN_EnumerateProcPtr enumerate;
    NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall;
    NPN_ConstructProcPtr construct;
    NPN_GetValueForURLProcPtr getvalueforurl;
    NPN_SetValueForURLProcPtr setvalueforurl;
    NPN_GetAuthenticationInfoProcPtr getauthenticationinfo;
    NPN_ScheduleTimerProcPtr scheduletimer;
    NPN_UnscheduleTimerProcPtr unscheduletimer;
    NPN_PopUpContextMenuProcPtr popupcontextmenu;
    NPN_ConvertPointProcPtr convertpoint;
    NPN_HandleEventPtr handleevent;
    NPN_UnfocusInstancePtr unfocusinstance;
    NPN_URLRedirectResponsePtr urlredirectresponse;
} NPNetscapeFuncs;

typedef struct _NPPluginFuncs {
    uint16_t size;
    uint16_t version;
    NPP_NewProcPtr newp;
    NPP_DestroyProcPtr destroy;
    NPP_SetWindowProcPtr setwindow;
    NPP_NewStreamProcPtr newstream;
    NPP_DestroyStreamProcPtr destroystream;
    NPP_StreamAsFileProcPtr asfile;
    NPP_WriteReadyProcPtr writeready;
    NPP_WriteProcPtr write;
    NPP_PrintProcPtr print;
    NPP_HandleEventProcPtr event;
    NPP_URLNotifyProcPtr urlnotify;
    JRIGlobalRef javaClass;
    NPP_GetValueProcPtr getvalue;
    NPP_SetValueProcPtr setvalue;
    NPP_GotFocusPtr gotfocus;
    NPP_LostFocusPtr lostfocus;
    NPP_URLRedirectNotifyPtr urlredirectnotify;
    NPP_ClearSiteDataPtr clearsitedata;
    NPP_GetSitesWithDataPtr getsiteswithdata;
} NPPluginFuncs;

typedef EXPORTED_CALLBACK(NPError, NP_GetEntryPointsFuncPtr)(NPPluginFuncs*);
typedef EXPORTED_CALLBACK(void, NPP_ShutdownProcPtr)(void);

#if defined(XP_MACOSX)
typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void);
typedef NPError (*MainFuncPtr)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownProcPtr*);
#endif

#if defined(XP_UNIX)
typedef EXPORTED_CALLBACK(NPError, NP_InitializeFuncPtr)(NPNetscapeFuncs*, NPPluginFuncs*);
typedef EXPORTED_CALLBACK(const char*, NP_GetMIMEDescriptionFuncPtr)(void);
#else
typedef EXPORTED_CALLBACK(NPError, NP_InitializeFuncPtr)(NPNetscapeFuncs*);
#endif

#ifdef __cplusplus
}
#endif

#endif


text:
import Em from 'ember';
import ArrayLimit from 'array-limit';
import ArrayOffset from 'array-offset';

var computed = Em.computed;
var alias = computed.alias;

var DEFAULT_OFFSET = 0;
var DEFAULT_LIMIT = Infinity;

var ArraySlice = Em.ArrayProxy.extend({
	offset: computed({
		get: function () {
			return DEFAULT_OFFSET;
		},
		set: function (key, offset) {
			this.set('_offsetProxy.offset', offset);
			return this.get('_offsetProxy.offset');
		}
	}),

	limit: computed({
		get: function () {
			return DEFAULT_LIMIT;
		},
		set: function (key, limit) {
			this.set('_limitProxy.limit', limit);
			return this.get('_limitProxy.limit');
		}
	}),

	content: computed({
		get: function () {
			return Em.A();
		},
		set:function (key, content) {
			this.set('_offsetProxy.content', content);
			return this.get('_offsetProxy.content');
		}
	}),

	_offsetProxy: computed(function () {
		return ArrayOffset.create({
			content: this.get('content'),
			offset: this.get('offset')
		});
	}),

	_limitProxy: computed(function () {
		return ArrayLimit.create({
			content: this.get('_offsetProxy.arrangedContent'),
			limit: this.get('limit')
		});
	}),

	arrangedContent: alias('_limitProxy')
});

ArraySlice.computed = {
	slice: function (prop, offset, limit) {
		return computed(prop, function () {
			return ArraySlice.create({
				content: this.get(prop),
				offset: offset,
				limit: limit
			});
		});
	}
};

export default ArraySlice;


text:
<title>Simple Constraints - GNU Compiler Collection (GCC) Internals</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Constraints.html#Constraints" title="Constraints">
<link rel="next" href="Multi_002dAlternative.html#Multi_002dAlternative" title="Multi-Alternative">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Multi-Alternative,
Up: Constraints

16.8.1 Simple Constraints

The simplest kind of constraint is a string full of letters, each of
which describes one kind of operand that is permitted.  Here are
the letters that are allowed:

whitespace
Whitespace characters are ignored and can be inserted at any position
except the first.  This enables each alternative for different operands to
be visually aligned in the machine description even if they have different
number of constraints and modifiers.

‘<samp>m</samp>’
A memory operand is allowed, with any kind of address that the machine
supports in general.
Note that the letter used for the general memory constraint can be
re-defined by a back end using the TARGET_MEM_CONSTRAINT macro.

‘<samp>o</samp>’
A memory operand is allowed, but only if the address is
<dfn>offsettable</dfn>.  This means that adding a small integer (actually,
the width in bytes of the operand, as determined by its machine mode)
may be added to the address and the result is also a valid memory
address.

For example, an address which is constant is offsettable; so is an
address that is the sum of a register and a constant (as long as a
slightly larger constant is also within the range of address-offsets
supported by the machine); but an autoincrement or autodecrement
address is not offsettable.  More complicated indirect/indexed
addresses may or may not be offsettable depending on the other
addressing modes that the machine supports.

Note that in an output operand which can be matched by another
operand, the constraint letter ‘<samp>o</samp>’ is valid only when accompanied
by both ‘<samp><</samp>’ (if the target machine has predecrement addressing)
and ‘<samp>></samp>’ (if the target machine has preincrement addressing).

‘<samp>V</samp>’
A memory operand that is not offsettable.  In other words, anything that
would fit the ‘<samp>m</samp>’ constraint but not the ‘<samp>o</samp>’ constraint.

‘<samp><</samp>’
A memory operand with autodecrement addressing (either predecrement or
postdecrement) is allowed.  In inline asm this constraint is only
allowed if the operand is used exactly once in an instruction that can
handle the side-effects.  Not using an operand with ‘<samp><</samp>’ in constraint
string in the inline asm pattern at all or using it in multiple
instructions isn't valid, because the side-effects wouldn't be performed
or would be performed more than once.  Furthermore, on some targets
the operand with ‘<samp><</samp>’ in constraint string must be accompanied by
special instruction suffixes like %U0 instruction suffix on PowerPC
or %P0 on IA-64.

‘<samp>></samp>’
A memory operand with autoincrement addressing (either preincrement or
postincrement) is allowed.  In inline asm the same restrictions
as for ‘<samp><</samp>’ apply.

‘<samp>r</samp>’
A register operand is allowed provided that it is in a general
register.

‘<samp>i</samp>’
An immediate integer operand (one with constant value) is allowed.
This includes symbolic constants whose values will be known only at
assembly time or later.

‘<samp>n</samp>’
An immediate integer operand with a known numeric value is allowed.
Many systems cannot support assembly-time constants for operands less
than a word wide.  Constraints for these operands should use ‘<samp>n</samp>’
rather than ‘<samp>i</samp>’.

‘<samp>I</samp>’, ‘<samp>J</samp>’, ‘<samp>K</samp>’, ... ‘<samp>P</samp>’
Other letters in the range ‘<samp>I</samp>’ through ‘<samp>P</samp>’ may be defined in
a machine-dependent fashion to permit immediate integer operands with
explicit integer values in specified ranges.  For example, on the
68000, ‘<samp>I</samp>’ is defined to stand for the range of values 1 to 8.
This is the range permitted as a shift count in the shift
instructions.

‘<samp>E</samp>’
An immediate floating operand (expression code const_double) is
allowed, but only if the target floating point format is the same as
that of the host machine (on which the compiler is running).

‘<samp>F</samp>’
An immediate floating operand (expression code const_double or
const_vector) is allowed.

‘<samp>G</samp>’, ‘<samp>H</samp>’
‘<samp>G</samp>’ and ‘<samp>H</samp>’ may be defined in a machine-dependent fashion to
permit immediate floating operands in particular ranges of values.

‘<samp>s</samp>’
An immediate integer operand whose value is not an explicit integer is
allowed.

This might appear strange; if an insn allows a constant operand with a
value not known at compile time, it certainly must allow any known
value.  So why use ‘<samp>s</samp>’ instead of ‘<samp>i</samp>’?  Sometimes it allows
better code to be generated.

For example, on the 68000 in a fullword instruction it is possible to
use an immediate operand; but if the immediate value is between −128
and 127, better code results from loading the value into a register and
using the register.  This is because the load into the register can be
done with a ‘<samp>moveq</samp>’ instruction.  We arrange for this to happen
by defining the letter ‘<samp>K</samp>’ to mean “any integer outside the
range −128 to 127”, and then specifying ‘<samp>Ks</samp>’ in the operand
constraints.

‘<samp>g</samp>’
Any register, memory or immediate integer operand is allowed, except for
registers that are not general registers.

‘<samp>X</samp>’
Any operand whatsoever is allowed, even if it does not satisfy
general_operand.  This is normally used in the constraint of
a match_scratch when certain alternatives will not actually
require a scratch register.

‘<samp>0</samp>’, ‘<samp>1</samp>’, ‘<samp>2</samp>’, ... ‘<samp>9</samp>’
An operand that matches the specified operand number is allowed.  If a
digit is used together with letters within the same alternative, the
digit should come last.

This number is allowed to be more than a single digit.  If multiple
digits are encountered consecutively, they are interpreted as a single
decimal integer.  There is scant chance for ambiguity, since to-date
it has never been desirable that ‘<samp>10</samp>’ be interpreted as matching
either operand 1 or operand 0.  Should this be desired, one
can use multiple alternatives instead.

This is called a <dfn>matching constraint</dfn> and what it really means is
that the assembler has only a single operand that fills two roles
considered separate in the RTL insn.  For example, an add insn has two
input operands and one output operand in the RTL, but on most CISC
machines an add instruction really has only two operands, one of them an
input-output operand:

          addl #35,r12

Matching constraints are used in these circumstances.
More precisely, the two operands that match must include one input-only
operand and one output-only operand.  Moreover, the digit must be a
smaller number than the number of the operand that uses it in the
constraint.

For operands to match in a particular case usually means that they
are identical-looking RTL expressions.  But in a few special cases
specific kinds of dissimilarity are allowed.  For example, *x
as an input operand will match *x++ as an output operand.
For proper results in such cases, the output template should always
use the output-operand's number when printing the operand.

‘<samp>p</samp>’
An operand that is a valid memory address is allowed.  This is
for “load address” and “push address” instructions.

‘<samp>p</samp>’ in the constraint must be accompanied by address_operand
as the predicate in the match_operand.  This predicate interprets
the mode specified in the match_operand as the mode of the memory
reference for which the address would be valid.

<var>other-letters</var>
Other letters can be defined in machine-dependent fashion to stand for
particular classes of registers or other arbitrary operand types.
‘<samp>d</samp>’, ‘<samp>a</samp>’ and ‘<samp>f</samp>’ are defined on the 68000/68020 to stand
for data, address and floating point registers.

In order to have valid assembler code, each operand must satisfy
its constraint.  But a failure to do so does not prevent the pattern
from applying to an insn.  Instead, it directs the compiler to modify
the code so that the constraint will be satisfied.  Usually this is
done by copying an operand into a register.

Contrast, therefore, the two instruction patterns that follow:

     (define_insn ""
       [(set (match_operand:SI 0 "general_operand" "=r")
             (plus:SI (match_dup 0)
                      (match_operand:SI 1 "general_operand" "r")))]
       ""
       "...")

which has two operands, one of which must appear in two places, and

     (define_insn ""
       [(set (match_operand:SI 0 "general_operand" "=r")
             (plus:SI (match_operand:SI 1 "general_operand" "0")
                      (match_operand:SI 2 "general_operand" "r")))]
       ""
       "...")

which has three operands, two of which are required by a constraint to be
identical.  If we are considering an insn of the form

     (insn <var>n</var> <var>prev</var> <var>next</var>
       (set (reg:SI 3)
            (plus:SI (reg:SI 6) (reg:SI 109)))
       ...)

the first pattern would not apply at all, because this insn does not
contain two identical subexpressions in the right place.  The pattern would
say, “That does not look like an add instruction; try other patterns”.
The second pattern would say, “Yes, that's an add instruction, but there
is something wrong with it”.  It would direct the reload pass of the
compiler to generate additional insns to make the constraint true.  The
results might look like this:

     (insn <var>n2</var> <var>prev</var> <var>n</var>
       (set (reg:SI 3) (reg:SI 6))
       ...)

     (insn <var>n</var> <var>n2</var> <var>next</var>
       (set (reg:SI 3)
            (plus:SI (reg:SI 3) (reg:SI 109)))
       ...)

It is up to you to make sure that each operand, in each pattern, has
constraints that can handle any RTL expression that could be present for
that operand.  (When multiple alternatives are in use, each pattern must,
for each possible combination of operand expressions, have at least one
alternative which can handle that combination of operands.)  The
constraints don't need to allow any possible operand—when this is
the case, they do not constrain—but they must at least point the way to
reloading any possible operand so that it will fit.

If the constraint accepts whatever operands the predicate permits,
there is no problem: reloading is never necessary for this operand.

For example, an operand whose constraints permit everything except
registers is safe provided its predicate rejects registers.

An operand whose predicate accepts only constant values is safe
provided its constraints include the letter ‘<samp>i</samp>’.  If any possible
constant value is accepted, then nothing less than ‘<samp>i</samp>’ will do;
if the predicate is more selective, then the constraints may also be
more selective.

Any operand expression can be reloaded by copying it into a register.
So if an operand's constraints allow some kind of register, it is
certain to be safe.  It need not permit all classes of registers; the
compiler knows how to copy a register into another register of the
proper class in order to make an instruction valid.

A nonoffsettable memory reference can be reloaded by copying the
address into a register.  So if the constraint uses the letter
‘<samp>o</samp>’, all memory references are taken care of.

A constant operand can be reloaded by allocating space in memory to
hold it as preinitialized data.  Then the memory reference can be used
in place of the constant.  So if the constraint uses the letters
‘<samp>o</samp>’ or ‘<samp>m</samp>’, constant operands are not a problem.

If the constraint permits a constant and a pseudo register used in an insn
was not allocated to a hard register and is equivalent to a constant,
the register will be replaced with the constant.  If the predicate does
not permit a constant and the insn is re-recognized for some reason, the
compiler will crash.  Thus the predicate must always recognize any
objects allowed by the constraint.

If the operand's predicate can recognize registers, but the constraint does
not permit them, it can make the compiler crash.  When this operand happens
to be a register, the reload pass will be stymied, because it does not know
how to copy a register temporarily into memory.

If the predicate accepts a unary operator, the constraint applies to the
operand.  For example, the MIPS processor at ISA level 3 supports an
instruction which adds two registers in SImode to produce a
DImode result, but only if the registers are correctly sign
extended.  This predicate for the input operands accepts a
sign_extend of an SImode register.  Write the constraint
to indicate the type of register that is required for the operand of the
sign_extend.


text:
<!DOCTYPE html>
<html lang='en'>
<META NAME="Robots" CONTENT="all">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title> Cudos - Customer Feedback on Employees </title>
	<link rel="shortcut icon" type="image/x-icon" href="<?php echo base_url("assets/img/favicon.ico"); ?>">
	<!--link local CSS files  :  note that javascript is linked at the bottom of page-->
	<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
	<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" />
	<link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/custom.css"); ?>">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/styles.css"); ?>">
  <link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/login_register.css"); ?>">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/mdb.css"); ?>">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/font-awesome.css"); ?>">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/font-awesome.min.css"); ?>">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/footer.css"); ?>">
	<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Crimson+Text" />
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
	<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
	<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.js"></script>
	<script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url("assets/js/custom.js"); ?>"></script>
  <script type="text/javascript" src="<?php echo base_url("assets/js/scripts.js"); ?>"></script>
  <script type="text/javascript" src="<?php echo base_url("assets/js/login_register.js"); ?>"></script>
	<script type="text/javascript" src="<?php echo base_url("assets/js/mdb.js"); ?>"></script>
	<script type="text/javascript" src="<?php echo base_url("assets/js/mdb.min.js"); ?>"></script>
	<script type="text/javascript" src="<?php echo base_url("assets/js/jquery.raty-fa.js"); ?>"></script>
</head>
<body class="<?php $ci =& get_instance(); echo ucfirst($ci->uri->segment(1)); ?>-body" data-spy="scroll" data-target=".navbar" data-offset="70">

  <?php
  //Due to a flickering issue on page load, authenticated navbar and normal navbar would be stored in seprate files
  if( $this->session->userdata('login') ){
     $this->load->view('template/auth_nav.php');
  }
  else{
    $this->load->view('template/nav.php');
  }
   ?>


text:
<polymer-element name="match-cell" attributes="color rows columns row column">
<template>
	<style>
	@host {
		:scope {
			position: absolute;
		}

		:scope.destroyed {
			-webkit-transform: scale(2);
			opacity: 0;
		}

		:scope.noanimate {
			transition: none;
		}
	}
	</style>
</template>
<script>
(function() {
	var COLORS = ['yellow', 'green', 'blue', 'red', 'orange', 'pink', 'purple', 'black', 'gray'];

	Polymer('match-cell', {
		row 	: 0,
		column 	: 0,
		rows 	: 10,
		columns : 10,
		color 	: 0,
		created : function() {
			var css = {
				width 	: (100 / this.columns) + '%',
				height 	: (100 / this.rows) + '%',
				top		: (100 * (this.row - this.rows) / this.rows) + '%',
				left	: (100 * this.column / this.columns) + '%',
				backgroundColor 	: COLORS[this.color]
			};
			for(var k in css) {
				this.style[k] = css[k];
			}
		},
		attributeChanged: function(attr) {
			switch(attr) {
				case 'columns':
				this.style.width = (100 / this.columns) + '%';
				break;
				case 'rows':
				this.style.height = (100 / this.rows) + '%';
				break;
				case 'color':
				this.style.backgroundColor = COLORS[this.color];
				break;
				case 'row':
				this.style.top = ((this.row - this.rows) * 100 / this.rows) + '%';
				break;
				case 'column':
				this.style.left = (100 * this.column / this.columns) + '%';
				break;
			}
		},
		equals: function(cell) {
			return this.color === cell.color;
		},
		destroy: function() {
			var defer = Q.defer();
			if (this.destroyed) {
				defer.resolve();
				return defer.promise;
			}

			this.destroyed = true;
			this.className += ' destroyed';
			this.addEventListener('transitionend', function once(evt) {
				evt.target.parentNode.removeChild(evt.target);
				evt.target.removeEventListener('transitionend', once);
				defer.resolve();
			});
			return defer.promise;
		}
	})
}())
</script>
</polymer-element>


text:
package nz.co.gregs.dbvolution;

import nz.co.gregs.dbvolution.transactions.DBTransaction;
import nz.co.gregs.dbvolution.actions.DBActionList;

/**
 * A convenient method of implement a database script in DBvolution.
 *
 *

 * DBScript provides automatic transaction control for a collection of
 * DBvolution operations.
 *
 *

 * Use {@link DBDatabase#test(nz.co.gregs.dbvolution.DBScript) } or
 * {@link DBScript#test(nz.co.gregs.dbvolution.DBDatabase)} to run the script
 * within a Read Only Transaction.
 *
 *

 * Use {@link DBDatabase#implement(nz.co.gregs.dbvolution.DBScript)} or
 * {@link DBScript#implement(nz.co.gregs.dbvolution.DBDatabase) } to run the
 * script within a Committed Transaction.
 *
 *
Support DBvolution at
 * Patreon

 *
 * @author Gregory Graham
 */
public abstract class DBScript {

	/**
	 *
	 * Create all the database interaction is this method.
	 *
	 * Call test() or implement() to safely run the script within a transaction.
	 *
	 * Use the {@link DBActionList} to collect the script's actions for saving or
	 * later use.
	 *
	 * @param db	db
	 *
Support DBvolution at
	 * Patreon

	 *
	 * @return DBActionList
	 * @throws java.lang.Exception java.lang.Exception
	 *
	 */
	public abstract DBActionList script(DBDatabase db) throws Exception;

	/**
	 * Run the script in a committed transaction.
	 *
	 *

	 * Implement() wraps the {@link #script(nz.co.gregs.dbvolution.DBDatabase) }
	 * method in a transaction and commits it.
	 *
	 *

	 * Any exceptions will cause the script to abort and rollback safely.
	 *
	 *

	 * When the script executes without exceptions the changes will be committed
	 * and made permanent.
	 *
	 * @param db	db
	 *
Support DBvolution at
	 * Patreon

	 *
	 * @return a DBActionList of all the actions performed on the database
	 * @throws java.lang.Exception java.lang.Exception
	 *
	 */
	public final DBActionList implement(DBDatabase db) throws Exception {
		DBTransaction<DBActionList> trans = getDBTransaction();
		DBActionList revertScript = db.doTransaction(trans);
		return revertScript;
	}

	/**
	 * Run the script in a read-only transaction.
	 *
	 * Test() wraps the {@link #script(nz.co.gregs.dbvolution.DBDatabase) }
	 * method in a transaction but rolls it back.
	 *
	 *

	 * Any changes will be safely rolled back.
	 *
	 *

	 * Any exceptions will cause the script to abort and rollback safely.
	 *
	 * @param db	db
	 *
Support DBvolution at
	 * Patreon

	 *
	 * @return a DBActionList of all the actions performed on the database
	 * @throws java.lang.Exception java.lang.Exception
	 *
	 */
	public final DBActionList test(DBDatabase db) throws Exception {
		DBTransaction<DBActionList> trans = getDBTransaction();
		DBActionList revertScript = db.doReadOnlyTransaction(trans);
		return revertScript;
	}

	/**
	 * Creates and returns a DBtransaction for this DBScript.
	 *
	 *
Support DBvolution at
	 * Patreon

	 *
	 * @return the transaction required to run the script.
	 */
	public final DBTransaction<DBActionList> getDBTransaction() {
		return new DBTransaction<DBActionList>() {
			@Override
			public DBActionList doTransaction(DBDatabase dbd) throws Exception {
				DBActionList revertScript = script(dbd);
				return revertScript;
			}
		};
	}
}


text:
package com.weblyzard.api.model.annotation;

import java.util.HashSet;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.weblyzard.api.model.document.LegacyDocument;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * A compact annotation contains the annotation's metadata and a list of all entities (i.e. mentions) of that particular
 * annotation.
 *
 * @author goebel@weblyzard.com
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@ToString(callSuper = true)
@XmlAccessorType(XmlAccessType.FIELD)
public class CompactAnnotation extends EntityDescriptor {

    @SuppressWarnings("unused")
    private static final long serialVersionUID = 1L;

    @JsonProperty("entities")
    @XmlElement(name = "entities", namespace = LegacyDocument.NS_WEBLYZARD)
    private Set<AnnotationSurface> entities = new HashSet<>();

    public CompactAnnotation(final String key) {
        super(key);
    }

    public CompactAnnotation(final Annotation a) {
        super(a.getKey());
        setPreferredName(a.getPreferredName()).setEntityType(a.getEntityType()).setEntityMetadata(a.getEntityMetadata())
                        .compactAnnotation().addSurface(new AnnotationSurface(a.getStart(), a.getEnd(), a.getSentence(),
                                        a.getMd5sum(), a.getSurfaceForm(), a.getConfidence()));
    }

    public static CompactAnnotation build(String key) {
        return new CompactAnnotation(key);
    }

    public CompactAnnotation addSurface(AnnotationSurface entity) {
        if (!entities.contains(entity)) {
            entities.add(entity);
        }
        return this;
    }
}


text:
@implementation EUWebPageViewCell

-(void)loadDataWithModel:(EUBaseModel *)model
{
    [super loadDataWithModel:model];

    if (!self.webView)
    {
        UIWebView *awebView = [[UIWebView alloc] init];
        awebView.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:awebView];
        self.webView = awebView;
    }

    self.webView.frame = self.bounds;
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:model.resourceUrl]]];
}

- (void)prepareForReuse
{
    [super prepareForReuse];

    if (self.webView.loading)
    {
        [self.webView stopLoading];
    }

    [self.webView stringByEvaluatingJavaScriptFromString:@"document.open();document.close();"];
}

@end


text:
@class NSArray_WallPaper;

@interface TLRPCaccount_getWallPapers : TLMetaRpc

- (Class)responseClass;

- (int)impliedResponseSignature;

@end

@interface TLRPCaccount_getWallPapers$account_getWallPapers : TLRPCaccount_getWallPapers

@end


text:
<?php

namespace AppTest\Action;

use App\Action\HomePageAction;
use Interop\Http\ServerMiddleware\DelegateInterface;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\HtmlResponse;
use Zend\Diactoros\Response\JsonResponse;
use Zend\Expressive\Router\RouterInterface;
use Zend\Expressive\Template\TemplateRendererInterface;

class HomePageActionTest extends TestCase
{
    /** @var RouterInterface */
    protected $router;

    protected function setUp()
    {
        $this->router = $this->prophesize(RouterInterface::class);
    }

    public function testReturnsJsonResponseWhenNoTemplateRendererProvided()
    {
        $homePage = new HomePageAction($this->router->reveal(), null);
        $response = $homePage->process(
            $this->prophesize(ServerRequestInterface::class)->reveal(),
            $this->prophesize(DelegateInterface::class)->reveal()
        );

        $this->assertInstanceOf(JsonResponse::class, $response);
    }

    public function testReturnsHtmlResponseWhenTemplateRendererProvided()
    {
        $renderer = $this->prophesize(TemplateRendererInterface::class);
        $renderer
            ->render('app::home-page', Argument::type('array'))
            ->willReturn('');

        $homePage = new HomePageAction($this->router->reveal(), $renderer->reveal());

        $response = $homePage->process(
            $this->prophesize(ServerRequestInterface::class)->reveal(),
            $this->prophesize(DelegateInterface::class)->reveal()
        );

        $this->assertInstanceOf(HtmlResponse::class, $response);
    }
}


text:
using System;
using System.Web.Mvc;

namespace Enjoy.Templates.Mvc.Specs.TestClasses
{
    internal sealed class TestMvcViewEngine : IViewEngine
    {
        public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache)
        {
            ControllerContext = controllerContext;
            PartialViewName = partialViewName;
            View = new TestMvcView();
            return new ViewEngineResult(View, this);
        }

        public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
        {
            throw new NotImplementedException();
        }

        public void ReleaseView(ControllerContext controllerContext, IView view)
        {
            throw new NotImplementedException();
        }

        public ControllerContext ControllerContext { get; set; }
        public string PartialViewName { get; set; }
        public TestMvcView View { get; set; }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>T-Index</title>
<meta name="date" content="2015-02-27">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G H I L M N O P R S T U V W

T

tearDown() - Method in class org.littleshoot.proxy.HttpStreamingFilterTest

tearDown() - Method in class org.littleshoot.proxy.IdleTest

tearDown() - Method in class org.littleshoot.proxy.ThrottlingTest

test() - Method in class org.littleshoot.proxy.IdleTest

testChangeThrottling() - Method in class org.littleshoot.proxy.ThrottlingTest

testDisableThrottling() - Method in class org.littleshoot.proxy.ThrottlingTest

testFiltering() - Method in class org.littleshoot.proxy.HttpFilterTest

testFiltering() - Method in class org.littleshoot.proxy.HttpStreamingFilterTest

testGetLocalhost() - Method in class org.littleshoot.proxy.impl.NetworkUtilsTest

testHeadRequestFollowedByGet() - Method in class org.littleshoot.proxy.BaseProxyTest

This test tests a HEAD followed by a GET for the same resource, making
 sure that the requests complete and that the Content-Length matches.

testNoChainedProxy() - Method in class org.littleshoot.proxy.NoChainedProxiesTest

testParseHostAndPort() - Method in class org.littleshoot.proxy.impl.ProxyUtilsTest

testProxyWithBadAddress() - Method in class org.littleshoot.proxy.BaseChainedProxyTest

testProxyWithBadAddress() - Method in class org.littleshoot.proxy.BaseProxyTest

testResolutionStartedFilterReturnsUnresolvedAddress() - Method in class org.littleshoot.proxy.HttpFilterTest

testServerFaster() - Method in class org.littleshoot.proxy.VariableSpeedClientServerTest

testServerSlower() - Method in class org.littleshoot.proxy.VariableSpeedClientServerTest

testSimpleGetRequest() - Method in class org.littleshoot.proxy.BaseChainedProxyTest

testSimpleGetRequest() - Method in class org.littleshoot.proxy.BaseProxyTest

testSimpleGetRequest() - Method in class org.littleshoot.proxy.MitmProxyTest

testSimpleGetRequestOverHTTPS() - Method in class org.littleshoot.proxy.BaseProxyTest

testSimpleGetRequestOverHTTPS() - Method in class org.littleshoot.proxy.MitmProxyTest

testSimplePostRequest() - Method in class org.littleshoot.proxy.BaseChainedProxyTest

testSimplePostRequest() - Method in class org.littleshoot.proxy.BaseProxyTest

testSimplePostRequest() - Method in class org.littleshoot.proxy.MitmProxyTest

testSimplePostRequestOverHTTPS() - Method in class org.littleshoot.proxy.BaseProxyTest

testSimplePostRequestOverHTTPS() - Method in class org.littleshoot.proxy.MitmProxyTest

testThrottledRead() - Method in class org.littleshoot.proxy.ThrottlingTest

testThrottledWrite() - Method in class org.littleshoot.proxy.ThrottlingTest

testTimeout() - Method in class org.littleshoot.proxy.IdlingProxyTest

testUnthrottledRead() - Method in class org.littleshoot.proxy.ThrottlingTest

testUnthrottledWrite() - Method in class org.littleshoot.proxy.ThrottlingTest

TestUtils - Class in org.littleshoot.proxy

testWithHttpClient() - Method in class org.littleshoot.proxy.EndToEndStoppingTest

testWithWebDriver() - Method in class org.littleshoot.proxy.EndToEndStoppingTest

ThrottledInputStream - Class in org.littleshoot.proxy

The ThrottleInputStream provides bandwidth throttling on a specified
 InputStream.

ThrottledInputStream(InputStream) - Constructor for class org.littleshoot.proxy.ThrottledInputStream

ThrottledInputStream(InputStream, long) - Constructor for class org.littleshoot.proxy.ThrottledInputStream

ThrottlingTest - Class in org.littleshoot.proxy

ThrottlingTest() - Constructor for class org.littleshoot.proxy.ThrottlingTest

toString() - Method in class org.littleshoot.proxy.ResponseInfo

toString() - Method in class org.littleshoot.proxy.ThrottledInputStream

TransportProtocol - Enum in org.littleshoot.proxy

Enumeration of transport protocols supported by LittleProxy.

A B C D E F G H I L M N O P R S T U V W

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
<!DOCTYPE html>

  {% include head.html %}
  <link rel="stylesheet" href="{{ site.url }}/css/doc.css">
  <link rel="stylesheet" href="{{ site.url }}/css/markdown.css">
  <link rel="stylesheet" href="{{ site.url }}/css/github-gist.css">
  <link rel="stylesheet" href="{{ site.url }}/css/syntax.css">

  {% include header.html
     with_signup_form='true'
     has_sticky_navigation='true'
     cssClass='light' %}

      {{ content }}

      {% if page.url contains '/docs/terraform/' %}

      {% assign size = page.url | remove: '/docs/terraform/' | size | minus: 1 %}

See the source of this document at Terraform.io

      {% endif %}

    {% include nav-docs.html %}

  {% include footer.html %}

  {% if page.url contains '/docs/terraform/' %}

  {% endif %}


text:
module Iptablez
  module Commands
    # @todo
    module Version
      def self.number
        o, e, s = Open3.capture3(Iptablez.bin_path, '--version')
        return o.strip.split[1].gsub('v','') if s.success?
        raise e
      end

      def self.full
        o, e, s = Open3.capture3(Iptablez.bin_path, '--version')
        return o.strip if s.success?
        raise e
      end
    end
  end
end


text:
package org.apache.beam.runners.flink;

import com.google.common.collect.ImmutableList;
import java.util.List;
import org.apache.beam.runners.core.SplittableParDoViaKeyedWorkItems;
import org.apache.beam.runners.core.construction.PTransformMatchers;
import org.apache.beam.runners.core.construction.PTransformTranslation;
import org.apache.beam.runners.core.construction.SplittableParDo;
import org.apache.beam.runners.core.construction.SplittableParDoNaiveBounded;
import org.apache.beam.runners.core.construction.UnsupportedOverrideFactory;
import org.apache.beam.sdk.runners.PTransformOverride;
import org.apache.beam.sdk.transforms.PTransform;

/** {@link PTransform} overrides for Flink runner. */
public class FlinkTransformOverrides {
  public static List<PTransformOverride> getDefaultOverrides(boolean streaming) {
    ImmutableList.Builder<PTransformOverride> builder = ImmutableList.builder();
    builder
        // TODO: [BEAM-5359] Support @RequiresStableInput on Flink runner
        .add(
            PTransformOverride.of(
                PTransformMatchers.requiresStableInputParDoMulti(),
                UnsupportedOverrideFactory.withMessage(
                    "Flink runner currently doesn't support @RequiresStableInput annotation.")))
        .add(
            PTransformOverride.of(
                PTransformMatchers.splittableParDo(), new SplittableParDo.OverrideFactory()))
        .add(
            PTransformOverride.of(
                PTransformMatchers.urnEqualTo(PTransformTranslation.SPLITTABLE_PROCESS_KEYED_URN),
                streaming
                    ? new SplittableParDoViaKeyedWorkItems.OverrideFactory()
                    : new SplittableParDoNaiveBounded.OverrideFactory()));
    if (streaming) {
      builder.add(
          PTransformOverride.of(
              PTransformMatchers.urnEqualTo(PTransformTranslation.CREATE_VIEW_TRANSFORM_URN),
              new CreateStreamingFlinkView.Factory()));
    }
    return builder.build();
  }
}


text:
/* Import CSS from inherited theme alabaster */
@import 'alabaster.css';
/* Import other CSS files */
@import 'css/bootstrap.min.css';
@import 'css/jupytertheme.css';
@import 'css/navbar.css';
@import 'css/footer.css';
@import 'css/search.css';
@import 'css/mobile_sidebar.css';
@import 'css/mediaqueries.css';
@import 'css/sidebar.css';


text:
package hardware::server::dell::idrac::snmp::mode::components::systembattery;

use strict;
use warnings;
use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status %map_state);

my $mapping = {
    systemBatteryStateSettings  => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.4', map => \%map_state },
    systemBatteryStatus         => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.5', map => \%map_status },
    systemBatteryLocationName   => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.7' },
};
my $oid_systemBatteryTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.50.1';

sub load {
    my ($self) = @_;

    push @{$self->{request}}, { oid => $oid_systemBatteryTableEntry };
}

sub check {
    my ($self) = @_;

    $self->{output}->output_add(long_msg => "Checking system batteries");
    $self->{components}->{systembattery} = {name => 'system batteries', total => 0, skip => 0};
    return if ($self->check_filter(section => 'systembattery'));

    foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_systemBatteryTableEntry}})) {
        next if ($oid !~ /^$mapping->{systemBatteryStatus}->{oid}\.(.*)$/);
        my $instance = $1;
        my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_systemBatteryTableEntry}, instance => $instance);

        next if ($self->check_filter(section => 'systembattery', instance => $instance));
        $self->{components}->{systembattery}->{total}++;

        $self->{output}->output_add(long_msg => sprintf("system battery '%s' status is '%s' [instance = %s] [state = %s]",
                                    $result->{systemBatteryLocationName}, $result->{systemBatteryStatus}, $instance,
                                    $result->{systemBatteryStateSettings}));

        my $exit = $self->get_severity(label => 'default.state', section => 'systembattery.state', value => $result->{systemBatteryStateSettings});
        if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
            $self->{output}->output_add(severity => $exit,
                                        short_msg => sprintf("System battery '%s' state is '%s'", $result->{systemBatteryLocationName}, $result->{systemBatteryStateSettings}));
            next;
        }

        $exit = $self->get_severity(label => 'default.status', section => 'systembattery.status', value => $result->{systemBatteryStatus});
        if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
            $self->{output}->output_add(severity => $exit,
                                        short_msg => sprintf("System battery '%s' status is '%s'", $result->{systemBatteryLocationName}, $result->{systemBatteryStatus}));
        }
    }
}

1;


text:
include Opscode::Aws::Ec2

action :associate do
  addr = address(new_resource.ip)

  if addr.nil?
    raise "Elastic IP #{new_resource.ip} does not exist"
  elsif addr[:instance_id] == instance_id
    Chef::Log.debug("Elastic IP #{new_resource.ip} is already attached to the instance")
  else
    attach(new_resource.ip, new_resource.timeout)
    new_resource.updated_by_last_action(true)
    Chef::Log.info("Attaching Elastic IP #{new_resource.ip} to the instance")
  end
end

action :disassociate do
  addr = address(new_resource.ip)

  if addr.nil?
    Chef::Log.debug("Elastic IP #{new_resource.ip} does not exist, so there is nothing to detach")
  elsif addr[:instance_id] != instance_id
    Chef::Log.debug("Elastic IP #{new_resource.ip} is already detached from the instance")
  else
    Chef::Log.info("Detaching Elastic IP #{new_resource.ip} from the instance")
    detach(new_resource.ip, new_resource.timeout)
    new_resource.updated_by_last_action(true)
  end
end

private

def address(ip)
  ec2.describe_addresses.find{|a| a[:public_ip] == ip}
end

def attach(ip, timeout)
  ec2.associate_address(instance_id, ip)

  # block until attached
  begin
    Timeout::timeout(timeout) do
      while true
        addr = address(ip)
        if addr.nil?
          raise "Elastic IP has been deleted while waiting for attachment"
        elsif addr[:instance_id] == instance_id
          Chef::Log.debug("Elastic IP is attached to this instance")
          break
        else
          Chef::Log.debug("Elastic IP is currently attached to #{addr[:instance_id]}")
        end
        sleep 3
      end
    end
  rescue Timeout::Error
    raise "Timed out waiting for attachment after #{timeout} seconds"
  end
end

def detach(ip, timeout)
  ec2.disassociate_address(ip)

  # block until detached
  begin
    Timeout::timeout(timeout) do
      while true
        addr = address(ip)
        if addr.nil?
          Chef::Log.debug("Elastic IP has been deleted while waiting for detachment")
        elsif addr[:instance_id] != instance_id
          Chef::Log.debug("Elastic IP is detached from this instance")
          break
        else
          Chef::Log.debug("Elastic IP is still attached")
        end
        sleep 3
      end
    end
  rescue Timeout::Error
    raise "Timed out waiting for detachment after #{timeout} seconds"
  end
end


text:
/**
 * Exception throw when in a model the attribute label is not be setted
 * @param name {string} The name of model where the label attributed is missed
 *
 * @author Andrea Mantovani
 * @license MIT
 */
var NoLabelException = function (name) {
    this.name = name;
};

NoLabelException.prototype.message = function () {
    return `In the model ${this.name} the attribute 'label' is not be setted`;
};

module.exports = NoLabelException;


text:
var assert = require("assert");
var uglify = require("../../");

describe("With", function() {
    it("Should throw syntaxError when using with statement in strict mode", function() {
        var code = '"use strict";\nthrow NotEarlyError;\nwith ({}) { }';
        var test = function() {
            uglify.parse(code);
        }
        var error = function(e) {
            return e instanceof uglify.JS_Parse_Error &&
                e.message === "SyntaxError: Strict mode may not include a with statement";
        }
        assert.throws(test, error);
    });
    it("Should set uses_with for scopes involving With statements", function() {
        var ast = uglify.parse("with(e) {f(1, 2)}");
        ast.figure_out_scope();
        assert.equal(ast.uses_with, true);
        assert.equal(ast.body[0].expression.scope.uses_with, true);
        assert.equal(ast.body[0].body.body[0].body.expression.scope.uses_with, true);
    });
});


text:
PowerMatcher

		This shows an detailed graphs that each represent the latest bid of an agent, with the received corresponding price (the blue line).