text:
package org.jboss.arquillian.graphene.enricher;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.graphene.GrapheneElement;
import org.jboss.arquillian.graphene.context.GrapheneContext;
import org.jboss.arquillian.graphene.enricher.exception.PageFragmentInitializationException;
import org.jboss.arquillian.graphene.findby.FindByUtilities;
import org.jboss.arquillian.graphene.fragment.Root;
import org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler;
import org.jboss.arquillian.graphene.proxy.GrapheneProxy;
import org.jboss.arquillian.graphene.proxy.GrapheneProxy.FutureTarget;
import org.jboss.arquillian.graphene.proxy.GrapheneProxyInstance;
import org.jboss.arquillian.graphene.spi.configuration.GrapheneConfiguration;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

/**
 * Enricher injecting page fragments ({@link FindBy} annotation is used) to the fields of the given object.
 *
 * @author Juraj Huska
 * @author Jan Papousek
 */
public class PageFragmentEnricher extends AbstractSearchContextEnricher {

    @Inject
    private Instance<GrapheneConfiguration> configuration;

    public PageFragmentEnricher() {
    }

    // because of testing
    public PageFragmentEnricher(Instance<GrapheneConfiguration> configuration) {
        this.configuration = configuration;
    }

    @Override
    public void enrich(final SearchContext searchContext, Object target) {
        List<Field> fields = FindByUtilities.getListOfFieldsAnnotatedWithFindBys(target);
        for (Field field : fields) {
            GrapheneContext grapheneContext = searchContext == null ? null : ((GrapheneProxyInstance) searchContext)
                .getGrapheneContext();
            final SearchContext localSearchContext;
            if (grapheneContext == null) {
                grapheneContext = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(field.getAnnotations()));
                localSearchContext = grapheneContext.getWebDriver(SearchContext.class);
            } else {
                localSearchContext = searchContext;
            }
            // Page fragment
            if (isPageFragmentClass(field.getType(), target)) {
                setupPageFragment(localSearchContext, target, field);
                // List<Page fragment>
            } else {
                try {
                    if (field.getType().isAssignableFrom(List.class) && isPageFragmentClass(getListType(field), target)) {
                        setupPageFragmentList(localSearchContext, target, field);
                    }
                } catch (ClassNotFoundException e) {
                    throw new PageFragmentInitializationException(e.getMessage(), e);
                }
            }
        }
    }

    protected final boolean isPageFragmentClass(Class<?> clazz, Object target) {
        if(Modifier.isInterface(clazz.getModifiers())) {
            return false;
        }

        Class<?> outerClass = clazz.getDeclaringClass();

        if (outerClass == null || Modifier.isStatic(clazz.getModifiers())) {
            // check whether there is an empty constructor
            return ReflectionHelper.hasConstructor(clazz);
        } else {
            // check whether there is an empty constructor with outer class
            return ReflectionHelper.hasConstructor(clazz, outerClass);
        }
    }

    protected final <T> List<T> createPageFragmentList(final Class<T> clazz, final SearchContext searchContext, final By rootBy) {
        GrapheneContext grapheneContext = ((GrapheneProxyInstance) searchContext).getGrapheneContext();
        List<T> result = GrapheneProxy.getProxyForFutureTarget(grapheneContext, new FutureTarget() {
            @Override
            public Object getTarget() {
                List<WebElement> elements = searchContext.findElements(rootBy);
                List<T> fragments = new ArrayList<T>();
                for (int i = 0; i < elements.size(); i++) {
                    fragments.add(createPageFragment(clazz, WebElementUtils.findElementLazily(rootBy, searchContext, i)));
                }
                return fragments;
            }
        }, List.class);
        return result;
    }

    public static <T> T createPageFragment(Class<T> clazz, final WebElement root) {
        try {
            GrapheneContext grapheneContext = ((GrapheneProxyInstance) root).getGrapheneContext();
            T pageFragment = null;

            if (Modifier.isFinal(clazz.getModifiers())) {
                throw new PageFragmentInitializationException("Page Fragment must not be final class. It is, your "
                    + clazz + ", declared in: " + clazz);
            }

            Class<?> webElementInterface = extractWebElementType(clazz);
            if (webElementInterface != null) {
                pageFragment = createProxyDelegatingToRoot(root, clazz, webElementInterface);
            } else {
                pageFragment = instantiate(clazz);
            }
            List<Field> roots = new LinkedList<Field>();
            roots.addAll(ReflectionHelper.getFieldsWithAnnotation(clazz, Root.class));
            if (roots.size() > 1) {
                throw new PageFragmentInitializationException("The Page Fragment " + NEW_LINE + pageFragment.getClass()
                    + NEW_LINE + " can not have more than one field annotated with Root annotation!"
                    + "Your fields with @Root annotation: " + roots + NEW_LINE);
            }
            if (roots.size() == 1) {
                setValue(roots.get(0), pageFragment, root);
            }
            enrichRecursively(root, pageFragment);
            T proxy = GrapheneProxy.getProxyForHandler(GrapheneContextualHandler.forTarget(grapheneContext, pageFragment),
                clazz);
            enrichRecursively(root, proxy); // because of possibility of direct access to attributes from test class
            return proxy;
        } catch (NoSuchMethodException ex) {
            throw new PageFragmentInitializationException(" Check whether declared Page Fragment has no argument constructor!",
                ex);
        } catch (IllegalAccessException ex) {
            throw new PageFragmentInitializationException(
                " Check whether declared Page Fragment has public no argument constructor!", ex);
        } catch (InstantiationException ex) {
            throw new PageFragmentInitializationException(
                " Check whether you did not declare Page Fragment with abstract type!", ex);
        } catch (Exception ex) {
            throw new PageFragmentInitializationException(ex);
        }
    }

    private static Class<?> extractWebElementType(Class<?> clazz) {
        List<Class<?>> interfaces = Arrays.asList(clazz.getInterfaces());
        if (interfaces.contains(GrapheneElement.class)) {
            return GrapheneElement.class;
        } else if (interfaces.contains(WebElement.class)) {
            return WebElement.class;
        } else {
            Class<?> superclass = clazz.getSuperclass();
            if (!Object.class.equals(superclass)) {
                return extractWebElementType(superclass);
            }
        }
        return null;
    }

    private static <T> T createProxyDelegatingToRoot(final WebElement root, Class<T> clazz, final Class<?> webElementType) {
        return ClassImposterizer.INSTANCE.imposterise(new MethodInterceptor() {

            @Override
            public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
                List<Method> webElementMethods = Arrays.asList(webElementType.getMethods());
                if (webElementMethods.contains(method)) {
                    try {
                        return method.invoke(root, args);
                    } catch (InvocationTargetException e) {
                        // unwrap original exception
                        throw e.getCause();
                    }
                } else {
                    return proxy.invokeSuper(obj, args);
                }
            }
        }, clazz, webElementType);
    }

    protected final void setupPageFragmentList(SearchContext searchContext, Object target, Field field)
        throws ClassNotFoundException {
        GrapheneContext grapheneContext = ((GrapheneProxyInstance) searchContext).getGrapheneContext();
        // the by retrieved in this way is never null, by default it is ByIdOrName using field name
        By rootBy = FindByUtilities.getCorrectBy(field, configuration.get().getDefaultElementLocatingStrategy());
        List<?> pageFragments = createPageFragmentList(getListType(field), searchContext, rootBy);
        setValue(field, target, pageFragments);
    }

    protected final void setupPageFragment(SearchContext searchContext, Object target, Field field) {
        GrapheneContext grapheneContext = ((GrapheneProxyInstance) searchContext).getGrapheneContext();
        // the by retrieved in this way is never null, by default it is ByIdOrName using field name
        By rootBy = FindByUtilities.getCorrectBy(field, configuration.get().getDefaultElementLocatingStrategy());
        WebElement root = WebElementUtils.findElementLazily(rootBy, searchContext);
        Object pageFragment = createPageFragment(field.getType(), root);
        setValue(field, target, pageFragment);
    }

    @Override
    public int getPrecedence() {
        return 1;
    }
}


text:
title: <%= hoc_s(:title_prizes_thanks) %>
layout: wide
nav: prizes_nav

---

# Thanks for signing up for a chance to win the $10,000 Hardware Prize

Your whole school is now entered to win a class-set of laptops (or $10,000 for other technology). We'll be reviewing your application and announcing the winners in December.

## 1. Reci svima

Recite svojim prijateljima o #HourOfCode.

## 2. Pitajte cijelu školu da ugoste Sat programiranja

[Send this email](<%= resolve_url('/promote/resources#email') %>) to your principal.

## 3. Pitajte svog poslodavca da se uključite

[Send this email](<%= resolve_url('/promote/resources#email') %>) to your manager, or the CEO.

## 4. Promote the Hour of Code in your community

Recruit a local group — boy/girl scouts club, church, university, veterans group or labor union. Or host an Hour of Code "block party" for your neighborhood. [Send this email](<%= resolve_url('/promote/resources#email') %>).

## 5. Pitajte lokalno izabranog u zajednici da podrži Sata programiranja

[Send this email](<%= resolve_url('/promote/resources#politicians') %>) to your mayor, city council, or school board and invite them to visit your school.

redpajama_set_name: RedPajamaGithub


text:
package io.opencensus.trace;

import com.google.common.annotations.VisibleForTesting;
import io.opencensus.common.Clock;
import io.opencensus.internal.Provider;
import io.opencensus.trace.config.TraceConfig;
import io.opencensus.trace.export.ExportComponent;
import io.opencensus.trace.propagation.PropagationComponent;
import java.util.logging.Level;
import java.util.logging.Logger;

/** Class that manages a global instance of the {@link TraceComponent}. */
public final class Tracing {
  private static final Logger logger = Logger.getLogger(Tracing.class.getName());
  private static final TraceComponent traceComponent =
      loadTraceComponent(Provider.getCorrectClassLoader(TraceComponent.class));

  /**
   * Returns the global {@link Tracer}.
   *
   * @return the global {@code Tracer}.
   */
  public static Tracer getTracer() {
    return traceComponent.getTracer();
  }

  /**
   * Returns the global {@link PropagationComponent}.
   *
   * @return the global {@code PropagationComponent}.
   */
  public static PropagationComponent getPropagationComponent() {
    return traceComponent.getPropagationComponent();
  }

  /**
   * Returns the global {@link Clock}.
   *
   * @return the global {@code Clock}.
   */
  public static Clock getClock() {
    return traceComponent.getClock();
  }

  /**
   * Returns the global {@link ExportComponent}.
   *
   * @return the global {@code ExportComponent}.
   */
  public static ExportComponent getExportComponent() {
    return traceComponent.getExportComponent();
  }

  /**
   * Returns the global {@link TraceConfig}.
   *
   * @return the global {@code TraceConfig}.
   */
  public static TraceConfig getTraceConfig() {
    return traceComponent.getTraceConfig();
  }

  // Any provider that may be used for TraceComponent can be added here.
  @VisibleForTesting
  static TraceComponent loadTraceComponent(ClassLoader classLoader) {
    try {
      // Call Class.forName with literal string name of the class to help shading tools.
      return Provider.createInstance(
          Class.forName("io.opencensus.trace.TraceComponentImpl", true, classLoader),
          TraceComponent.class);
    } catch (ClassNotFoundException e) {
      logger.log(
          Level.FINE,
          "Couldn't load full implementation for TraceComponent, now trying to load lite "
              + "implementation.",
          e);
    }
    try {
      // Call Class.forName with literal string name of the class to help shading tools.
      return Provider.createInstance(
          Class.forName("io.opencensus.trace.TraceComponentImplLite", true, classLoader),
          TraceComponent.class);
    } catch (ClassNotFoundException e) {
      logger.log(
          Level.FINE,
          "Couldn't load lite implementation for TraceComponent, now using "
              + "default implementation for TraceComponent.",
          e);
    }
    return TraceComponent.getNoopTraceComponent();
  }

  // No instance of this class.
  private Tracing() {}
}


text:
void Ray::draw(sf::RenderTarget & target, sf::RenderStates states) const
{
	target.draw(m_sprite);
}

Ray::Ray(Side side)
	:m_side(side)
{

}

Ray::~Ray()
{
}

void Ray::SetAnimator(Animator & animator)
{
	m_animator = &animator;
	m_animator->SetSprite(m_sprite);
	m_animator->SetDelayBetweenFrames(0.1f);
	m_animator->ChangeActiveState("explosion");
}

int Ray::GetSide()
{
	return m_side;
}

void Ray::SetRaySpriteSize(unsigned short size)
{

	m_size = size;
	m_sprite.setTextureRect(sf::IntRect(0, 0, m_size*TILE_SIZE,TILE_SIZE));
	m_sprite.setOrigin(0, m_sprite.getGlobalBounds().height / 2.f);
	m_sprite.getTexture();
	switch (m_side)
	{
	case Ray::Up:
		m_sprite.setPosition(m_sprite.getPosition().x,m_sprite.getPosition().y - TILE_SIZE/2);
		m_sprite.setRotation(270);
		SetSize(TILE_SIZE, TILE_SIZE*size + TILE_SIZE);
		SetPositionY(static_cast<int>(GetPositionY() / TILE_SIZE) * TILE_SIZE);
		PhysicalBody::SetPositionY(GetPositionY()- ((TILE_SIZE*size) + TILE_SIZE)/2 + TILE_SIZE);
		break;
	case Ray::Down:
		SetPositionY(static_cast<int>(GetPositionY() / TILE_SIZE) * TILE_SIZE);
		m_sprite.setPosition(m_sprite.getPosition().x, m_sprite.getPosition().y + TILE_SIZE/2);
		m_sprite.setRotation(90);
		SetSize(TILE_SIZE, TILE_SIZE*size);
		PhysicalBody::SetPositionY(GetPositionY() +TILE_SIZE + (TILE_SIZE*size) / 2 );
		break;
	case Ray::Left:
		SetPositionX(static_cast<int>(GetPositionX() / TILE_SIZE) * TILE_SIZE);
		m_sprite.setPosition(m_sprite.getPosition().x - TILE_SIZE/2, m_sprite.getPosition().y );
		m_sprite.setRotation(180);
		SetSize(TILE_SIZE*size, TILE_SIZE);
		PhysicalBody::SetPositionX(GetPositionX() - (TILE_SIZE*size) / 2);
		break;
	case Ray::Right:
		SetPositionX(static_cast<int>(GetPositionX() / TILE_SIZE) * TILE_SIZE);
		m_sprite.setPosition(m_sprite.getPosition().x + TILE_SIZE/2, m_sprite.getPosition().y);
		SetSize(TILE_SIZE*size, TILE_SIZE);
		PhysicalBody::SetPositionX(GetPositionX() +TILE_SIZE + (TILE_SIZE*size) / 2);
		break;
	default:
		break;
	}

}

void Ray::SetPosition(float x, float y)
{
	m_sprite.setPosition(x,y);
	PhysicalBody::SetPositionX(x);
	PhysicalBody::SetPositionY(y);
}

void Ray::Update(float dt)
{

}


text:
package com.inepex.ineFrame.server.auth;

import java.util.Map;
import java.util.Set;

public interface AuthUser {

    Long getUserId();

    String getDisplayName();

    /**
     * for login (may e-mail address, may nickname...)
     *
     */
    String getUserAuthString();

    /**
     * role set of user
     */
    Set<String> getAllowedRoles();

    Map<String, String> getUserJsonProps();

}


text:
"""
This module contains an implementation of the non-Markovian transfer tensor
method (TTM), introduced in [1].

[1] Javier Cerrillo and Jianshu Cao, Phys. Rev. Lett 112, 110401 (2014)
"""

import numpy as np

from qutip import (Options, spre, vector_to_operator, operator_to_vector,
                   ket2dm, isket)
from qutip.solver import Result
from qutip.expect import expect_rho_vec

class TTMSolverOptions:
    """Class of options for the Transfer Tensor Method solver.

    Attributes
    ----------
    dynmaps : list of :class:`qutip.Qobj`
        List of precomputed dynamical maps (superoperators),
        or a callback function that returns the
        superoperator at a given time.

    times : array_like
        List of times :math:`t_n` at which to calculate :math:`\\rho(t_n)`

    learningtimes : array_like
        List of times :math:`t_k` to use as learning times if argument
        `dynmaps` is a callback function.

    thres : float
        Threshold for halting. Halts if  :math:`||T_{n}-T_{n-1}||` is below
        treshold.

    options : :class:`qutip.solver.Options`
        Generic solver options.
    """

    def __init__(self, dynmaps=None, times=[], learningtimes=[],
                 thres=0.0, options=None):
        if options is None:
            options = Options()

        self.dynmaps = dynmaps
        self.times = times
        self.learningtimes = learningtimes
        self.thres = thres
        self.store_states = options.store_states

def ttmsolve(dynmaps, rho0, times, e_ops=[], learningtimes=None, tensors=None,
             **kwargs):
    """
    Solve time-evolution using the Transfer Tensor Method, based on a set of
    precomputed dynamical maps.

    Parameters
    ----------
    dynmaps : list of :class:`qutip.Qobj`
        List of precomputed dynamical maps (superoperators),
        or a callback function that returns the
        superoperator at a given time.

    rho0 : :class:`qutip.Qobj`
        Initial density matrix or state vector (ket).

    times : array_like
        list of times :math:`t_n` at which to compute :math:`\\rho(t_n)`.
        Must be uniformily spaced.

    e_ops : list of :class:`qutip.Qobj` / callback function
        single operator or list of operators for which to evaluate
        expectation values.

    learningtimes : array_like
        list of times :math:`t_k` for which we have knowledge of the dynamical
        maps :math:`E(t_k)`.

    tensors : array_like
        optional list of precomputed tensors :math:`T_k`

    kwargs : dictionary
        Optional keyword arguments. See
        :class:`qutip.nonmarkov.transfertensor.TTMSolverOptions`.

    Returns
    -------
    output: :class:`qutip.solver.Result`
        An instance of the class :class:`qutip.solver.Result`.
    """

    opt = TTMSolverOptions(dynmaps=dynmaps, times=times,
                           learningtimes=learningtimes, **kwargs)

    diff = None

    if isket(rho0):
        rho0 = ket2dm(rho0)

    output = Result()
    e_sops_data = []

    if callable(e_ops):
        n_expt_op = 0
        expt_callback = True

    else:
        try:
            tmp = e_ops[:]
            del tmp

            n_expt_op = len(e_ops)
            expt_callback = False

            if n_expt_op == 0:
                # fall back on storing states
                opt.store_states = True

            for op in e_ops:
                e_sops_data.append(spre(op).data)
                if op.isherm and rho0.isherm:
                    output.expect.append(np.zeros(len(times)))
                else:
                    output.expect.append(np.zeros(len(times), dtype=complex))
        except TypeError:
            raise TypeError("Argument 'e_ops' should be a callable or" +
                            "list-like.")

    if tensors is None:
        tensors, diff = _generatetensors(dynmaps, learningtimes, opt=opt)

    if rho0.isoper:
        # vectorize density matrix
        rho0vec = operator_to_vector(rho0)
    else:
        # rho0 might be a super in which case we should not vectorize
        rho0vec = rho0

    K = len(tensors)
    states = [rho0vec]
    for n in range(1, len(times)):
        # Set current state
        state = None
        for j in range(1, min(K, n + 1)):
            tmp = tensors[j] * states[n - j]
            state = tmp if state is None else tmp + state
        # Append state to all states
        states.append(state)
    for i, r in enumerate(states):
        if opt.store_states or expt_callback:
            if r.type == 'operator-ket':
                states[i] = vector_to_operator(r)
            else:
                states[i] = r
            if expt_callback:
                # use callback method
                e_ops(times[i], states[i])
        for m in range(n_expt_op):
            if output.expect[m].dtype == complex:
                output.expect[m][i] = expect_rho_vec(e_sops_data[m], r, 0)
            else:
                output.expect[m][i] = expect_rho_vec(e_sops_data[m], r, 1)

    output.solver = "ttmsolve"
    output.times = times

    output.ttmconvergence = diff

    if opt.store_states:
        output.states = states

    return output

def _generatetensors(dynmaps, learningtimes=None, **kwargs):
    r"""
    Generate the tensors :math:`T_1,\dots,T_K` from the dynamical maps
    :math:`E(t_k)`.

    A stationary process is assumed, i.e., :math:`T_{n,k} = T_{n-k}`.

    Parameters
    ----------
    dynmaps : list of :class:`qutip.Qobj`
        List of precomputed dynamical maps (superoperators) at the times
        specified in `learningtimes`, or a callback function that returns the
        superoperator at a given time.

    learningtimes : array_like
        list of times :math:`t_k` to use if argument `dynmaps` is a callback
        function.

    kwargs : dictionary
        Optional keyword arguments. See
        :class:`qutip.nonmarkov.transfertensor.TTMSolverOptions`.

    Returns
    -------
    Tlist: list of :class:`qutip.Qobj.`
        A list of transfer tensors :math:`T_1,\dots,T_K`
    """

    # Determine if dynmaps is callable or list-like
    if callable(dynmaps):
        if learningtimes is None:
            raise TypeError("Argument 'learnintimes' required when 'dynmaps'" +
                            "is a callback function.")

        def dynmapfunc(n):
            return dynmaps(learningtimes[n])

        Kmax = len(learningtimes)
    else:
        try:
            tmp = dynmaps[:]
            del tmp

            def dynmapfunc(n):
                return dynmaps[n]

            Kmax = len(dynmaps)
        except TypeError:
            raise TypeError("Argument 'dynmaps' should be a callable or" +
                            "list-like.")

    if "opt" not in kwargs:
        opt = TTMSolverOptions(dynmaps=dynmaps, learningtimes=learningtimes,
                               **kwargs)
    else:
        opt = kwargs['opt']

    Tlist = []
    diff = [0.0]
    for n in range(Kmax):
        T = dynmapfunc(n)
        for m in range(1, n):
            T -= Tlist[n - m] * dynmapfunc(m)
        Tlist.append(T)
        if n > 1:
            diff.append((Tlist[-1] - Tlist[-2]).norm())
            if diff[-1] < opt.thres:
                # Below threshold for truncation
                print('breaking', (Tlist[-1] - Tlist[-2]).norm(), n)
                break
    return Tlist, diff


text:
NG2-Carnival

Sign Up

			It's free and always will be.

				<form>

						Name

							<input type="text" class="form-control" id="name"
								placeholder="Full Name">

						Email

							<input type="email" class="form-control" id="emial"
								placeholder="Email">

						Password

							<input type="password" class="form-control" id="password"
								placeholder="Password">

						Confirm Password

							<input type="password" class="form-control" id="confpassword"
								placeholder="Confirm Password">

								 <input
									class="form-check-input" type="checkbox"> By clicking this check box, you agree to the Terms and Conditions set out by this site, including our Cookie Use.

							Sign up

								Have account? Please login

				</form>

Modal title

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
        </button>

        Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

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


text:
<?php

class Neostrada_Domain
{
	private $_client;

	private $_name;
	private $_extension;
	private $_records = [];

	public function __construct(Neostrada $client, $domain)
	{
		$this->_client = $client;

		if (substr_count($domain, '.') !== 1)
		{
			throw new \InvalidArgumentException('Invalid domain: ' . $domain);
		}

		list($this->_name, $this->_extension) = explode('.', trim($domain));

		$this->_getDns();
	}

	public function getName()
	{
		return $this->_name;
	}

	public function getExtension()
	{
		return $this->_extension;
	}

	public function getDomain()
	{
		return $this->_name . '.' . $this->_extension;
	}

	public function getRecords()
	{
		return $this->_records;
	}

	private function _getDns()
	{
		$this->_records = [];
		$xml = $this->_client->request($this, 'getdns');

		foreach ($xml->dns->item as $item)
		{
			$this->_records[explode(';', (string) $item)[0]] = new Neostrada_Record($this, (string) $item);
		}

		return $this;
	}

	public function create($type)
	{
		$record = new Neostrada_Record($this);
		$record->type = strtoupper($type);
		return $record;
	}

	public function authCode()
	{
		$xml = $this->_client->request($this, 'gettoken');
		return trim((string) $xml->token);
	}

	public function add(Neostrada_Record $record)
	{
		return $this->_client->request($this, 'adddns', $record->toNeostradaFormat());
	}

	private function _single($type, $name, $content = null)
	{
		foreach ($this->_records as $record)
		{
			if ($record->type === $type && $record->name === $name)
			{
				if ($content !== null)
				{
					$record->setContent($content);
					return $this;
				}
				else
				{
					return $record;
				}
			}
		}

		return null;
	}

	private function _multiple($type)
	{
		$rs = new Neostrada_Records($this, $type);

		foreach ($this->_records as $record)
		{
			if ($record->type === $type)
			{
				$rs[] = $record;
			}
		}

		return $rs;
	}

	public function a($name, $content = null)
	{
		return $this->_single('A', $name, $content);
	}

	public function cname($name, $content = null)
	{
		return $this->_single('CNAME', $name, $content);
	}

	public function mx()
	{
		$mxs = $this->_multiple('MX');

		$mxs->sort(function($mx1, $mx2)
		{
			return $mx1->priority - $mx2->priority;
		});

		return $mxs;
	}

	public function spf()
	{
		$txts = $this->_multiple('TXT');

		$txts->filter(function($txt)
		{
			return strpos($txt->content, 'v=spf1') !== false;
		});

		return $txts;
	}

	public function ns()
	{
		$nss = [];
		$xml = $this->_client->request('getnameserver');

		if (isset($xml->nameservers->nameserver0)) $nss[] = (string) $xml->nameservers->nameserver0;
		if (isset($xml->nameservers->nameserver1)) $nss[] = (string) $xml->nameservers->nameserver1;
		if (isset($xml->nameservers->nameserver2)) $nss[] = (string) $xml->nameservers->nameserver2;

		return $nss;
	}

	public function save()
	{
		$this->_client->save($this);
		return $this;
	}
}


text:
layout: default
description: "Toda la informacion que necesitas sobre la cria, el adiestramiento y los cuidados del Border Collie."
---

Últimos articulos

    {% assign categories = site.categories.articulos | sort: 'date' | reverse %}
    {% for post in categories limit:5 %}

{{ post.title }}

{{ post.date | date: '%d.%m.%Y' }}

"{{ post.intro }}"

          Seguir leyendo...

  {% endfor %}
    {% include components/descargar-guia-como-elegir-tu-border-collie-home.html %}

<div

Últimos videos

     {% assign categories = site.categories.border-collie-videos | sort: 'date' | reverse %}
      {% for post in categories limit:6 %}

          {% if post.id-youtube %}

          {% endif %}

                {{ post.title }}

          {% if post.id-youtube %}

          {% endif %}

                {{ post.title }}

    {% endfor %}


text:
<!DOCTYPE HTML>

<title>NearestPointsFloat</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2022-10-10">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../jquery/jquery-ui.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

All Classes

SEARCH:
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Package algorithms.compGeometry

Class NearestPointsFloat

java.lang.Object

algorithms.compGeometry.NearestPointsFloat

public class NearestPointsFloat
extends java.lang.Object

Builds an unmodifiable data structure to make finding member points within
 a distance of a location faster than O(N^2).

 The runtime complexity is O(N*lg2(N)) for the constructor
 and for search is O(lg2(N)) + small number of scans surrounding the nearest x.

Author:

nichole

Constructor Summary

Constructors

Constructor
Description

NearestPointsFloat(float[] xPoints,
                  float[] yPoints,
                  int len)

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method
Description

java.lang.Integer
findClosestNeighborIndex(float xCenter,
                        float yCenter,
                        float radius)

find points within radius of (xCenter, yCenter) in the contained points
 and return the indexes relative to original given array.

java.util.Set<java.lang.Integer>
findNeighborIndexes(float xCenter,
                   float yCenter,
                   float radius)

find points within radius of (xCenter, yCenter) in the contained points.

java.util.Set<algorithms.util.PairFloat>
findNeighbors(float xCenter,
             float yCenter,
             float radius)

find points within radius of (xCenter, yCenter) in the contained points.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

NearestPointsFloat

public NearestPointsFloat(float[] xPoints,
                          float[] yPoints,
                          int len)

Method Detail

findNeighbors

public java.util.Set<algorithms.util.PairFloat> findNeighbors(float xCenter,
                                                              float yCenter,
                                                              float radius)

find points within radius of (xCenter, yCenter) in the contained points.

Parameters:

xCenter -

yCenter -

radius -

Returns:

findNeighborIndexes

public java.util.Set<java.lang.Integer> findNeighborIndexes(float xCenter,
                                                            float yCenter,
                                                            float radius)

find points within radius of (xCenter, yCenter) in the contained points.

Parameters:

xCenter -

yCenter -

radius -

Returns:

findClosestNeighborIndex

public java.lang.Integer findClosestNeighborIndex(float xCenter,
                                                  float yCenter,
                                                  float radius)

find points within radius of (xCenter, yCenter) in the contained points
 and return the indexes relative to original given array.

Parameters:

xCenter -

yCenter -

radius -

Returns:

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

All Classes

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
module DropboxApi::Metadata
  # Example of a serialized {AccessLevel} object:
  #
  # ```json
  # {
  #   ".tag": "viewer"
  # }
  # ```
  class AccessLevel < DropboxApi::Metadata::Tag
    VALID_ACCESS_LEVELS = [
      :owner,
      :editor,
      :viewer,
      :viewer_no_comment
    ]

    def self.valid_values
      VALID_ACCESS_LEVELS
    end
  end
end


text:
package tipech.thesis.extraction;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;

import opennlp.tools.doccat.DoccatModel;
import opennlp.tools.doccat.DocumentCategorizerME;
import opennlp.tools.doccat.DocumentSampleStream;
import opennlp.tools.util.ObjectStream;
import opennlp.tools.util.PlainTextByLineStream;

public class OpenNLPSentimentAnalyzer {

	private DocumentCategorizerME categorizer;

	public OpenNLPSentimentAnalyzer(String modelInput) {

		// ----- Model initialization -----

		InputStream dataIn = null;
		BufferedOutputStream modelOut = null;
		DoccatModel model = null;

		try {
			switch(modelInput){
				case "default":	// use pre-trained model
					dataIn = new FileInputStream("../lib/models/openNLP-tweets-sentiment.bin");
					model = new DoccatModel(dataIn);
					break;

				case "new":  	// train and extract a new model from a file named input.txt
					dataIn = new FileInputStream("input.txt");
					modelOut = new BufferedOutputStream(new FileOutputStream("/lib/models/openNLP-tweets-sentiment.bin"));

					ObjectStream lineStream = new PlainTextByLineStream(dataIn, "UTF-8");
					ObjectStream sampleStream = new DocumentSampleStream(lineStream);
					// Specifies the minimum number of times a feature must be seen
					int cutoff = 2;
					int trainingIterations = 30;
					model = DocumentCategorizerME.train("en", sampleStream, cutoff,	trainingIterations);
					model.serialize(modelOut);
					break;

				default:		// use pre-trained location from correct location (manual run)
					dataIn = new FileInputStream("lib/models/openNLP-tweets-sentiment.bin");
					model = new DoccatModel(dataIn);
					break;
			}

		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (dataIn != null) {
				try {
					if(dataIn != null ){
						dataIn.close();
					}
					if(modelOut != null ){
						modelOut.close();
					}
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}

		categorizer = new DocumentCategorizerME(model);
	}

	public float findSentiment(String line) {

		double[] outcomes = categorizer.categorize(line);
		String category = categorizer.getBestCategory(outcomes);

		// our scale is 0 to 5, so we select 1 and 3 as the output, plus/minus 0.01 for rounding outwards
		if (category.equalsIgnoreCase("1")) {

			return 3.01f;

		} else {
			return 0.99f;
		}
	}
}


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

namespace Bundler.Example.Application {
    public abstract class ExampleController : Controller {
        public BundleManager Bundles { get; private set; }

        protected override void Initialize(RequestContext requestContext) {
            base.Initialize(requestContext);
            var bundleProvider = ((MvcApplication) requestContext.HttpContext.ApplicationInstance).BundleProvider;
            Bundles = new BundleManager(bundleProvider, requestContext);
        }
    }
}


text:
- [Usage](#usage)
  - [Solidity Control Flow Graph (CFG) Generation](#solidity-control-flow-graph-cfg-generation)
  - [Solidity Linter (WIP)](#solidity-linter-wip)
  - [EVM CFG Generation](#evm-cfg-generation)

## Usage

### Solidity Control Flow Graph (CFG) Generation

```shell
stack build --profile &&\
  solc --combined-json ast examples/etherscan.io/CryptoKittiesCore.sol |\
  stack exec -- ea-analyze &&\
  find work/ -name "*.dot" -exec dot -Tpng -O \{\} \;
```

generates CFGs like

![Solidity CFG](./doc/img/KittyOwnership.tokensOfOwner.CFG.dot.png)

whose original code looks like

```javascript
function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
  uint256 tokenCount = balanceOf(_owner);
  if (tokenCount == 0) {
    return new uint256[](0);
  } else {
    uint256[] memory result = new uint256[](tokenCount);
    uint256 totalCats = totalSupply();
    uint256 resultIndex = 0;
    uint256 catId;
    for (catId = 1; catId <= totalCats; catId++) {
      if (kittyIndexToOwner[catId] == _owner) {
        result[resultIndex] = catId;
        resultIndex++;
      }
    }
    return result;
  }
}
```

### Solidity Linter (WIP)

``` shell
stack build
solc --combined-json ast\
  examples/analysis-benchmark/selfdestruct-over-suicide.sol |\
  stack exec ea-analyze
```

### EVM CFG Generation

``` shell
stack build
cat examples/etherscan.io/CryptoKittiesSalesAuction.evm | stack exec -- ea-bytecode-vis --outDot=work/tmp.dot &&\
  dot -Tpng work/tmp.dot -O
```

generates a pretty large CFG for the whole EVM bytecode sequence, part of which
looks like

![EVM CFG](./doc/img/CryptoKittiesSalesAuction.evm.part.dot.png)


text:
#ifndef __CMODULE_H
#define __CMODULE_H

#include <module.h>

/*
 * WRS OMX-IL Component Module Symbol
 */
#define WRS_OMXIL_CMODULE_SYMBOL            WRS_OMXIL_CMODULE
#define WRS_OMXIL_CMODULE_SYMBOL_STRING     "WRS_OMXIL_CMODULE"

struct wrs_omxil_cmodule_ops_s {
    OMX_ERRORTYPE (*instantiate)(OMX_PTR *);
};

struct wrs_omxil_cmodule_s {
    const char *name;

    const char **roles;
    const int nr_roles;

    struct wrs_omxil_cmodule_ops_s *ops;
};

class ComponentBase;

class CModule {
 public:
    CModule(const OMX_STRING lname);
    ~CModule();

    /*
     * library loading / unloading
     */
    OMX_ERRORTYPE Load(int flag);
    OMX_U32 Unload(void);

    /* end of library loading / unloading */

    /*
     * accessor
     */
    /* library name */
    const OMX_STRING GetLibraryName(void);

    /* component name and roles */
    const OMX_STRING GetComponentName(void);
    OMX_ERRORTYPE GetComponentRoles(OMX_U32 *nr_roles, OMX_U8 **roles);

    bool QueryHavingThisRole(const OMX_STRING role);

    /* end of accessor */

    /* library symbol method and helpers */
    OMX_ERRORTYPE QueryComponentNameAndRoles(void);
    OMX_ERRORTYPE InstantiateComponent(ComponentBase **instance);

    /* end of library symbol method and helpers */

 private:
    /*
     * library symbol
     */
    struct wrs_omxil_cmodule_s *wrs_omxil_cmodule;

    /* end of library symbol */

    /* component name */
    char cname[OMX_MAX_STRINGNAME_SIZE];

    /* component roles */
    OMX_U8 **roles;
    OMX_U32 nr_roles;

    /* library name */
    char lname[OMX_MAX_STRINGNAME_SIZE];
    /* utils::module */
    struct module *module;
};

#endif /* __CMODULE_H */


text:
class ScreenLockNotificationBlocker
    : public message_center::NotificationBlocker {
 public:
  explicit ScreenLockNotificationBlocker(
      message_center::MessageCenter* message_center);
  ScreenLockNotificationBlocker(const ScreenLockNotificationBlocker&) = delete;
  ScreenLockNotificationBlocker& operator=(
      const ScreenLockNotificationBlocker&) = delete;
  ~ScreenLockNotificationBlocker() override;

  bool is_locked() const { return is_locked_; }

  // message_center::NotificationBlocker overrides:
  void CheckState() override;
  bool ShouldShowNotificationAsPopup(
      const message_center::Notification& notification) const override;

 private:
  bool is_locked_;

  base::OneShotTimer timer_;
};

#endif  // CHROME_BROWSER_NOTIFICATIONS_SCREEN_LOCK_NOTIFICATION_BLOCKER_H_


text:
'use strict';
var gulp = require('gulp'),
gutil = require('gulp-util'),
install = require('gulp-install'),
conflict = require('gulp-conflict'),
template = require('gulp-template'),
rename = require('gulp-rename'),
_ = require('underscore.string'),
inquirer = require('inquirer'),
fs = require('fs'),
path = require('path'),
wiredep = require('wiredep');

function format(string) {
var username = string.toLowerCase();
return username.replace(/\s/g, '');
}
var defaults = (function() {
var homeDir = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
workingDirName = process.cwd().split('/').pop().split('\\').pop(),
osUserName = homeDir && homeDir.split('/').pop() || 'root',
configFile = homeDir + '/.gitconfig',
user = {};
if (require('fs').existsSync(configFile)) {
user = require('iniparser').parseSync(configFile).user;
}
return {
appName: workingDirName,
userName: format(user.name) || osUserName,
authorEmail: user.email || ''
};
})();

gulp.task('default', function(done) {
	gutil.log('Scaffolding Gulp Bower Bourbon Neat for your web app.');
		var prompts = [{
			name: 'appName',
			message: 'What is the name of project?',
			default: defaults.appName
		},
		{
			name: 'projectDesc',
			message: 'Project description?',
			default: ''
		},
		{
			name: 'authorName',
			message: 'What is the name of author?',
			default: defaults.userName
		},
		{
			name: 'authorEmail',
			message: 'Author e-mail?',
			default: ''
		}];
		//Ask
		inquirer.prompt(prompts, function(answers) {
			answers.appNameSlug = _.slugify(answers.appName);
			gulp.src(__dirname + '/templates/**')
			.pipe(template(answers))
			.pipe(rename(function(file) {
			if (file.basename[0] === '_') {
				file.basename = '.' + file.basename.slice(1);
			}
		}))
		.pipe(conflict('./'))
		.pipe(gulp.dest('./'))
		.pipe(install())
		.on('end', function() {
			done();
		});
        process.on('exit', function () {
                var skipInstall = process.argv.slice(2).indexOf('--skip-install') >= 0;

                if (!skipInstall) {

                        var bowerJson = JSON.parse(fs.readFileSync('./bower.json'));

                        // wire Bower packages to .html
                        wiredep({
                                bowerJson: bowerJson,
                                directory: 'app/bower_components',
                                src: 'app/index.html'
                        });

                                // wire Bower packages to .scss
                                wiredep({
                                        bowerJson: bowerJson,
                                        directory: 'app/bower_components',
                                        src: 'app/scss/*.scss'
                                });

                } else {
                        gutil.log('After running `npm install & bower install`, inject your front end dependencies into');
                        gutil.log('your HTML by running:');
                        gutil.log('  gulp wiredep');
                }
               });
			});
		});


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

namespace Barsik.Core
{
    public enum ServerEnvironment
    {
        Unknown,
        Linux,
        Windows,
        Mac,
    }

    public enum ServerType
    {
        Unknown,
        Dedicated,
        NonDedicated,
        Proxy,
    }

    public enum ServerVisibility
    {
        Unknown,
        Public,
        Private,
    }

    public class ServerInfo
    {
        public byte Protocol { get; set; }

        public string Name { get; set; }

        public string Map { get; set; }

        public int Ping { get; set; }

        public byte Players { get; set; }

        public byte MaxPlayers { get; set; }

        public byte Bots { get; set; }

        public string Game { get; set; }

        public short AppId { get; set; }

        public ServerType Type { get; set; }

        public ServerEnvironment Environment { get; set; }

        public ServerVisibility Visibility { get; set; }

        public bool IsSecured { get; set; }

        public string Version { get; set; }

        public string Folder { get; set; }

        public short? Port { get; set; }

        public ulong? SteamId { get; set; }

        public short? SourceTVPort { get; set; }

        public string SourceTVName { get; set; }

        public string Tags { get; set; }

        public ulong? GameId { get; set; }
    }
}


text:
package com.amazon.carbonado.repo.jdbc;

import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import javax.sql.DataSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.cojen.util.ThrowUnchecked;

import com.amazon.carbonado.FetchException;
import com.amazon.carbonado.IsolationLevel;
import com.amazon.carbonado.MalformedTypeException;
import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.Repository;
import com.amazon.carbonado.RepositoryException;
import com.amazon.carbonado.Storable;
import com.amazon.carbonado.Storage;
import com.amazon.carbonado.SupportException;
import com.amazon.carbonado.Transaction;
import com.amazon.carbonado.TriggerFactory;
import com.amazon.carbonado.UnsupportedTypeException;
import com.amazon.carbonado.capability.IndexInfo;
import com.amazon.carbonado.capability.IndexInfoCapability;
import com.amazon.carbonado.capability.ShutdownCapability;
import com.amazon.carbonado.capability.StorableInfoCapability;
import com.amazon.carbonado.info.StorableIntrospector;
import com.amazon.carbonado.info.StorableProperty;
import com.amazon.carbonado.sequence.SequenceCapability;
import com.amazon.carbonado.sequence.SequenceValueProducer;
import com.amazon.carbonado.spi.AbstractRepository;
import com.amazon.carbonado.txn.TransactionManager;
import com.amazon.carbonado.txn.TransactionScope;

/**
 * Repository implementation backed by a JDBC accessible database.
 * JDBCRepository is not independent of the underlying database schema, and so
 * it requires matching tables and columns in the database. It will not alter
 * or create tables. Use the {@link com.amazon.carbonado.Alias Alias} annotation to
 * control precisely which tables and columns must be matched up.
 *
 * @author Brian S O'Neill
 * @author bcastill
 * @author Adam D Bradley
 * @see JDBCRepositoryBuilder
 */
class JDBCRepository extends AbstractRepository<JDBCTransaction>
    implements Repository,
               IndexInfoCapability,
               ShutdownCapability,
               StorableInfoCapability,
               JDBCConnectionCapability,
               SequenceCapability
{
    /**
     * Attempts to close a DataSource by searching for a "close" method. For
     * some reason, there's no standard way to close a DataSource.
     *
     * @return false if DataSource doesn't have a close method.
     */
    public static boolean closeDataSource(DataSource ds) throws SQLException {
        try {
            Method closeMethod = ds.getClass().getMethod("close");
            try {
                closeMethod.invoke(ds);
            } catch (Throwable e) {
                ThrowUnchecked.fireFirstDeclaredCause(e, SQLException.class);
            }
            return true;
        } catch (NoSuchMethodException e) {
            return false;
        }
    }

    static IsolationLevel mapIsolationLevelFromJdbc(int jdbcLevel) {
        switch (jdbcLevel) {
        case Connection.TRANSACTION_NONE: default:
            return IsolationLevel.NONE;
        case Connection.TRANSACTION_READ_UNCOMMITTED:
            return IsolationLevel.READ_UNCOMMITTED;
        case Connection.TRANSACTION_READ_COMMITTED:
            return IsolationLevel.READ_COMMITTED;
        case Connection.TRANSACTION_REPEATABLE_READ:
            return IsolationLevel.REPEATABLE_READ;
        case Connection.TRANSACTION_SERIALIZABLE:
            return IsolationLevel.SERIALIZABLE;
        }
    }

    static int mapIsolationLevelToJdbc(IsolationLevel level) {
        switch (level) {
        case NONE: default:
            return Connection.TRANSACTION_NONE;
        case READ_UNCOMMITTED:
            return Connection.TRANSACTION_READ_UNCOMMITTED;
        case READ_COMMITTED:
            return Connection.TRANSACTION_READ_COMMITTED;
        case REPEATABLE_READ:
            return Connection.TRANSACTION_REPEATABLE_READ;
        case SNAPSHOT:
            // TODO: not accurate for all databases.
            return Connection.TRANSACTION_SERIALIZABLE;
        case SERIALIZABLE:
            return Connection.TRANSACTION_SERIALIZABLE;
        }
    }

    /**
     * Returns the highest supported level for the given desired level.
     *
     * @return null if not supported
     */
    private static IsolationLevel selectIsolationLevel(DatabaseMetaData md,
                                                       IsolationLevel desiredLevel)
        throws SQLException, RepositoryException
    {
        while (!md.supportsTransactionIsolationLevel(mapIsolationLevelToJdbc(desiredLevel))) {
            switch (desiredLevel) {
            case READ_UNCOMMITTED:
                desiredLevel = IsolationLevel.READ_COMMITTED;
                break;
            case READ_COMMITTED:
                desiredLevel = IsolationLevel.REPEATABLE_READ;
                break;
            case REPEATABLE_READ:
                desiredLevel = IsolationLevel.SERIALIZABLE;
                break;
            case SNAPSHOT:
                desiredLevel = IsolationLevel.SERIALIZABLE;
                break;
            case SERIALIZABLE: default:
                return null;
            }
        }
        return desiredLevel;
    }

    private final Log mLog = LogFactory.getLog(getClass());

    private final boolean mIsMaster;
    final Iterable<TriggerFactory> mTriggerFactories;
    private final AtomicReference<Repository> mRootRef;
    private final String mDatabaseProductName;
    private final DataSource mDataSource;
    private final boolean mDataSourceClose;
    private final String mCatalog;
    private final String mSchema;
    private final Integer mFetchSize;
    private final boolean mPrimaryKeyCheckDisabled;

    // Maps Storable types which should have automatic version management.
    private Map<String, Boolean> mAutoVersioningMap;

    // Maps Storable types which should not auto reload after insert or update.
    private Map<String, Boolean> mSuppressReloadMap;

    // Track all open connections so that they can be closed when this
    // repository is closed.
    private Map<Connection, Object> mOpenConnections;
    private final Lock mOpenConnectionsLock;

    private final boolean mSupportsSavepoints;
    private final boolean mSupportsSelectForUpdate;
    private final boolean mSupportsScrollInsensitiveReadOnly;

    private final IsolationLevel mDefaultIsolationLevel;
    private final int mJdbcDefaultIsolationLevel;

    private final JDBCSupportStrategy mSupportStrategy;
    private JDBCExceptionTransformer mExceptionTransformer;

    private final SchemaResolver mResolver;

    private final JDBCTransactionManager mTxnMgr;

    // Mappings from IsolationLevel to best matching supported level.
    final IsolationLevel mReadUncommittedLevel;
    final IsolationLevel mReadCommittedLevel;
    final IsolationLevel mRepeatableReadLevel;
    final IsolationLevel mSerializableLevel;

    /**
     * @param name name to give repository instance
     * @param isMaster when true, storables in this repository must manage
     * version properties and sequence properties
     * @param dataSource provides JDBC database connections
     * @param catalog optional catalog to search for tables -- actual meaning
     * is database independent
     * @param schema optional schema to search for tables -- actual meaning is
     * is database independent
     * @param forceStoredSequence tells the repository to use a stored sequence
     * even if the database supports native sequences
     */
    @SuppressWarnings("unchecked")
    JDBCRepository(AtomicReference<Repository> rootRef,
                   String name, boolean isMaster,
                   Iterable<TriggerFactory> triggerFactories,
                   DataSource dataSource, boolean dataSourceClose,
                   String catalog, String schema,
                   Integer fetchSize,
                   Map<String, Boolean> autoVersioningMap,
                   Map<String, Boolean> suppressReloadMap,
                   String sequenceSelectStatement, boolean forceStoredSequence, boolean primaryKeyCheckDisabled,
                   SchemaResolver resolver)
        throws RepositoryException
    {
        super(name);
        if (dataSource == null) {
            throw new IllegalArgumentException("DataSource cannot be null");
        }
        mIsMaster = isMaster;
        mTriggerFactories = triggerFactories;
        mRootRef = rootRef;
        mDataSource = dataSource;
        mDataSourceClose = dataSourceClose;
        mCatalog = catalog;
        mSchema = schema;
        mFetchSize = fetchSize;
        mPrimaryKeyCheckDisabled = primaryKeyCheckDisabled;

        mAutoVersioningMap = autoVersioningMap;
        mSuppressReloadMap = suppressReloadMap;

        mResolver = resolver;

        mOpenConnections = new IdentityHashMap<Connection, Object>();
        mOpenConnectionsLock = new ReentrantLock(true);

        // Temporarily set to generic one, in case there's a problem during initialization.
        mExceptionTransformer = new JDBCExceptionTransformer();

        mTxnMgr = new JDBCTransactionManager(this);

        getLog().info("Opening repository \"" + getName() + '"');

        // Test connectivity and get some info on transaction isolation levels.
        Connection con = getConnection();
        try {
            DatabaseMetaData md = con.getMetaData();
            if (md == null || !md.supportsTransactions()) {
                throw new RepositoryException("Database does not support transactions");
            }

            mDatabaseProductName = md.getDatabaseProductName();

            boolean supportsSavepoints;
            try {
                supportsSavepoints = md.supportsSavepoints();
            } catch (AbstractMethodError e) {
                supportsSavepoints = false;
            }

            if (supportsSavepoints) {
                con.setAutoCommit(false);
                // Some JDBC drivers (HSQLDB) lie about their savepoint support.
                try {
                    con.setSavepoint();
                } catch (SQLException e) {
                    mLog.warn("JDBC driver for " + mDatabaseProductName +
                              " reports supporting savepoints, but it " +
                              "doesn't appear to work: " + e);
                    supportsSavepoints = false;
                } finally {
                    con.rollback();
                    con.setAutoCommit(true);
                }
            }

            mSupportsSavepoints = supportsSavepoints;
            mSupportsSelectForUpdate = md.supportsSelectForUpdate();
            mSupportsScrollInsensitiveReadOnly = md.supportsResultSetConcurrency
                (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

            mJdbcDefaultIsolationLevel = md.getDefaultTransactionIsolation();
            mDefaultIsolationLevel = mapIsolationLevelFromJdbc(mJdbcDefaultIsolationLevel);

            mReadUncommittedLevel = selectIsolationLevel(md, IsolationLevel.READ_UNCOMMITTED);
            mReadCommittedLevel   = selectIsolationLevel(md, IsolationLevel.READ_COMMITTED);
            mRepeatableReadLevel  = selectIsolationLevel(md, IsolationLevel.REPEATABLE_READ);
            mSerializableLevel    = selectIsolationLevel(md, IsolationLevel.SERIALIZABLE);
        } catch (SQLException e) {
            throw toRepositoryException(e);
        } finally {
            try {
                closeConnection(con);
            } catch (SQLException e) {
                // Don't care.
            }
        }

        mSupportStrategy = JDBCSupportStrategy.createStrategy(this);
        if (forceStoredSequence) {
            mSupportStrategy.setSequenceSelectStatement(null);
        } else if (sequenceSelectStatement != null && sequenceSelectStatement.length() > 0) {
            mSupportStrategy.setSequenceSelectStatement(sequenceSelectStatement);
        }
        mSupportStrategy.setForceStoredSequence(forceStoredSequence);
        mExceptionTransformer = mSupportStrategy.createExceptionTransformer();

        getLog().info("Opened repository \"" + getName() + '"');

        setAutoShutdownEnabled(true);
    }

    public DataSource getDataSource() {
        return mDataSource;
    }

    /**
     * Returns true if a transaction is in progress and it is for update.
     */
    public boolean isTransactionForUpdate() {
        return localTransactionScope().isForUpdate();
    }

    /**
     * Convenience method that calls into {@link JDBCStorableIntrospector}.
     *
     * @param type Storable type to examine
     * @throws MalformedTypeException if Storable type is not well-formed
     * @throws RepositoryException if there was a problem in accessing the database
     * @throws IllegalArgumentException if type is null
     */
    public <S extends Storable> JDBCStorableInfo<S> examineStorable(Class<S> type)
        throws RepositoryException, SupportException
    {
        try {
            return JDBCStorableIntrospector
                .examine(type, mDataSource, mCatalog, mSchema, mResolver, mPrimaryKeyCheckDisabled);
        } catch (SQLException e) {
            throw toRepositoryException(e);
        }
    }

    public <S extends Storable> IndexInfo[] getIndexInfo(Class<S> storableType)
        throws RepositoryException
    {
        return ((JDBCStorage) storageFor(storableType)).getIndexInfo();
    }

    public String[] getUserStorableTypeNames() {
        // We don't register Storable types persistently, so just return what
        // we know right now.
        ArrayList<String> names = new ArrayList<String>();
        for (Storage storage : allStorage()) {
            names.add(storage.getStorableType().getName());
        }
        return names.toArray(new String[names.size()]);
    }

    public boolean isSupported(Class<Storable> type) {
        if (type == null) {
            return false;
        }
        try {
            examineStorable(type);
            return true;
        } catch (RepositoryException e) {
            return false;
        }
    }

    public boolean isPropertySupported(Class<Storable> type, String name) {
        if (type == null || name == null) {
            return false;
        }
        try {
            JDBCStorableProperty<?> prop = examineStorable(type).getAllProperties().get(name);
            return prop == null ? false : prop.isSupported();
        } catch (RepositoryException e) {
            return false;
        }
    }

    /**
     * Convenience method to convert a regular StorableProperty into a
     * JDBCStorableProperty.
     *
     * @throws UnsupportedOperationException if JDBCStorableProperty is not supported
     */
    <S extends Storable> JDBCStorableProperty<S>
        getJDBCStorableProperty(StorableProperty<S> property)
        throws RepositoryException, SupportException
    {
        JDBCStorableInfo<S> info = examineStorable(property.getEnclosingType());
        JDBCStorableProperty<S> jProperty = info.getAllProperties().get(property.getName());
        if (!jProperty.isSupported()) {
            throw new UnsupportedOperationException
                ("Property is not supported: " + property.getName());
        }
        return jProperty;
    }

    public String getDatabaseProductName() {
        return mDatabaseProductName;
    }

    /**
     * Any connection returned by this method must be closed by calling
     * yieldConnection on this repository.
     */
    public Connection getConnection() throws FetchException {
        try {
            if (mOpenConnections == null) {
                throw new FetchException("Repository is closed");
            }

            JDBCTransaction txn = localTransactionScope().getTxn();
            if (txn != null) {
                // Return the connection used by the current transaction.
                return txn.getConnection();
            }

            // Get connection outside lock section since it may block.
            Connection con = mDataSource.getConnection();
            con.setAutoCommit(true);

            mOpenConnectionsLock.lock();
            try {
                if (mOpenConnections == null) {
                    con.close();
                    throw new FetchException("Repository is closed");
                }
                mOpenConnections.put(con, null);
            } finally {
                mOpenConnectionsLock.unlock();
            }

            return con;
        } catch (Exception e) {
            throw toFetchException(e);
        }
    }

    /**
     * Called by JDBCTransactionManager.
     */
    Connection getConnectionForTxn(IsolationLevel level) throws FetchException {
        try {
            if (mOpenConnections == null) {
                throw new FetchException("Repository is closed");
            }

            // Get connection outside lock section since it may block.
            Connection con = mDataSource.getConnection();

            if (level == IsolationLevel.NONE) {
                con.setAutoCommit(true);
            } else {
                con.setAutoCommit(false);
                if (level != mDefaultIsolationLevel) {
                    con.setTransactionIsolation(mapIsolationLevelToJdbc(level));
                }
            }

            mOpenConnectionsLock.lock();
            try {
                if (mOpenConnections == null) {
                    con.close();
                    throw new FetchException("Repository is closed");
                }
                mOpenConnections.put(con, null);
            } finally {
                mOpenConnectionsLock.unlock();
            }

            return con;
        } catch (Exception e) {
            throw toFetchException(e);
        }
    }

    /**
     * Gives up a connection returned from getConnection. Connection must be
     * yielded in same thread that retrieved it.
     */
    public void yieldConnection(Connection con) throws FetchException {
        try {
            if (con.getAutoCommit()) {
                closeConnection(con);
            }
            // Connections which aren't auto-commit are in a transaction. Keep
            // them around instead of closing them.
        } catch (Exception e) {
            throw toFetchException(e);
        }
    }

    void closeConnection(Connection con) throws SQLException {
        mOpenConnectionsLock.lock();
        try {
            if (mOpenConnections != null) {
                mOpenConnections.remove(con);
            }
        } finally {
            mOpenConnectionsLock.unlock();
        }
        // Close connection outside lock section since it may block.
        con.close();
    }

    boolean supportsSavepoints() {
        return mSupportsSavepoints;
    }

    boolean supportsSelectForUpdate() {
        return mSupportsSelectForUpdate;
    }

    boolean supportsScrollInsensitiveReadOnly() {
        return mSupportsScrollInsensitiveReadOnly;
    }

    /**
     * Returns the highest supported level for the given desired level.
     *
     * @return null if not supported
     */
    IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel desiredLevel) {
        if (desiredLevel == null) {
            if (parent == null) {
                desiredLevel = mDefaultIsolationLevel;
            } else {
                desiredLevel = parent.getIsolationLevel();
            }
        } else if (parent != null) {
            IsolationLevel parentLevel = parent.getIsolationLevel();
            // Can promote to higher level, but not lower.
            if (parentLevel.compareTo(desiredLevel) >= 0) {
                desiredLevel = parentLevel;
            } else {
                return null;
            }
        }

        switch (desiredLevel) {
        case NONE:
            return IsolationLevel.NONE;
        case READ_UNCOMMITTED:
            return mReadUncommittedLevel;
        case READ_COMMITTED:
            return mReadCommittedLevel;
        case REPEATABLE_READ:
            return mRepeatableReadLevel;
        case SERIALIZABLE:
            return mSerializableLevel;
        }

        return null;
    }

    JDBCSupportStrategy getSupportStrategy() {
        return mSupportStrategy;
    }

    Repository getRootRepository() {
        return mRootRef.get();
    }

    Integer getFetchSize() {
        return mFetchSize;
    }

    /**
     * Transforms the given throwable into an appropriate fetch exception. If
     * it already is a fetch exception, it is simply casted.
     *
     * @param e required exception to transform
     * @return FetchException, never null
     */
    public FetchException toFetchException(Throwable e) {
        return mExceptionTransformer.toFetchException(e);
    }

    /**
     * Transforms the given throwable into an appropriate persist exception. If
     * it already is a persist exception, it is simply casted.
     *
     * @param e required exception to transform
     * @return PersistException, never null
     */
    public PersistException toPersistException(Throwable e) {
        return mExceptionTransformer.toPersistException(e);
    }

    /**
     * Transforms the given throwable into an appropriate repository
     * exception. If it already is a repository exception, it is simply casted.
     *
     * @param e required exception to transform
     * @return RepositoryException, never null
     */
    public RepositoryException toRepositoryException(Throwable e) {
        return mExceptionTransformer.toRepositoryException(e);
    }

    /**
     * Examines the SQLSTATE code of the given SQL exception and determines if
     * it is a unique constaint violation.
     */
    public boolean isUniqueConstraintError(SQLException e) {
        return mExceptionTransformer.isUniqueConstraintError(e);
    }

    JDBCExceptionTransformer getExceptionTransformer() {
        return mExceptionTransformer;
    }

    @Override
    protected void shutdownHook() {
        // Close all open connections.
        mOpenConnectionsLock.lock();
        try {
            if (mOpenConnections != null) {
                for (Connection con : mOpenConnections.keySet()) {
                    try {
                        con.close();
                    } catch (SQLException e) {
                        getLog().warn(null, e);
                    }
                }
                mOpenConnections = null;
            }
        } finally {
            mOpenConnectionsLock.unlock();
        }

        if (mDataSourceClose) {
            mLog.info("Closing DataSource: " + mDataSource);
            try {
                if (!closeDataSource(mDataSource)) {
                    mLog.info("DataSource doesn't have a close method: " +
                              mDataSource.getClass().getName());
                }
            } catch (SQLException e) {
                mLog.error("Failed to close DataSource", e);
            }
        }
    }

    @Override
    protected Log getLog() {
        return mLog;
    }

    @Override
    protected <S extends Storable> Storage<S> createStorage(Class<S> type)
        throws RepositoryException
    {
        JDBCStorableInfo<S> info = examineStorable(type);
        if (!info.isSupported()) {
            throw new UnsupportedTypeException("Independent type not supported", type);
        }

        Boolean autoVersioning = false;
        if (mAutoVersioningMap != null) {
            autoVersioning = mAutoVersioningMap.get(type.getName());
            if (autoVersioning == null) {
                // No explicit setting, so check wildcard setting.
                autoVersioning = mAutoVersioningMap.get(null);
                if (autoVersioning == null) {
                    autoVersioning = false;
                }
            }
        }

        Boolean suppressReload = false;
        if (mSuppressReloadMap != null) {
            suppressReload = mSuppressReloadMap.get(type.getName());
            if (suppressReload == null) {
                // No explicit setting, so check wildcard setting.
                suppressReload = mSuppressReloadMap.get(null);
                if (suppressReload == null) {
                    suppressReload = false;
                }
            }
        }

        return new JDBCStorage<S>(this, info, mIsMaster, autoVersioning, suppressReload);
    }

    @Override
    protected SequenceValueProducer createSequenceValueProducer(String name)
        throws RepositoryException
    {
        return mSupportStrategy.createSequenceValueProducer(name);
    }

    @Override
    protected final TransactionManager<JDBCTransaction> transactionManager() {
        return mTxnMgr;
    }

    @Override
    protected final TransactionScope<JDBCTransaction> localTransactionScope() {
        return mTxnMgr.localScope();
    }
}


text:
<?php

namespace Dostavista;

use DateTime;

abstract class BaseOrder extends AbstractModel
{
    /**
     * On foot (<=15kg)
     */
    const DELIVERY_TYPE_FOOT = 0;

    /**
     * Passenger car (<=200kg)
     */
    const DELIVERY_TYPE_CAR = 1;

    /**
     * Truck
     */
    const DELIVERY_TYPE_TRUCK = 2;

    /**
     * Online wallet payment
     */
    const BACKPAYMENT_ONLINE = 1;

    /**
     * Transfer to the bank card
     */
    const BACKPAYMENT_CARD = 2;

    /**
     * Buyout buy a courier
     */
    const BACKPAYMENT_BUYOUT = 3;

    /**
     * @var int See DELIVERY_TYPE_* constants.
     */
    protected $requireCar;

    /**
     * @var string Shipment description
     */
    protected $matter;

    /**
     * @var int Insurance size
     */
    protected $insurance;

    /**
     * @var int See BACKPAYMENT_* constants
     */
    protected $backpaymentMethod;

    /**
     * @var string Backpayment additional info (online wallet ID, bank card PAN, ...)
     */
    protected $backpaymentDetails;

    /**
     * @var string See API reference for details
     */
    protected $bapiUserAgent;

    /**
     * @var bool Whether to send or not SMS notification for recipient
     */
    protected $recipientsSmsNotification;

    /**
     * @var int
     */
    protected $requireLoading;

    /**
     * @var string
     */
    protected $note;

    /**
     * @var Point[]
     */
    protected $points = [];

    /**
     * @param Point[]|array $points
     *
     * @return $this
     */
    public function setPoints(array $points)
    {
        foreach ($points as &$point) {
            if (!$point instanceof Point) {
                $point = new Point($point['address'], new DateTime($point['required_time_start']), new DateTime($point['required_time']), $point['phone'], $point);
            }
        }

        $this->points = $points;
        return $this;
    }
}


text:
package com.communote.server.core.blog;

/**
 * @author Communote GmbH - http://www.communote.com/
 */
public class ToplevelTopicCannotBeChildException extends Exception {
    /**
     * default serial version UID
     */
    private static final long serialVersionUID = 1L;
    private final Long topicId;
    private final String title;

    /**
     * Constructor.
     *
     * @param topicId
     *            Id of the top level topic.
     * @param title
     *            the title of the topic
     */
    public ToplevelTopicCannotBeChildException(Long topicId, String title) {
        super("The topic " + topicId
                + " is a top level topic and therefor can't be added as child.");
        this.topicId = topicId;
        this.title = title;
    }

    /**
     * @return Id of the top level topic this exception was thrown for.
     */
    public Long getTopicId() {
        return topicId;
    }

    /**
     * @return the title of the top level topic this exception was thrown for.
     */
    public String getTopicTitle() {
        return title;
    }
}


text:
package net.mostlyoriginal.api.utils.pooling;

import java.util.IdentityHashMap;
import java.util.Map;

/**
 *
Collection of object pools mapped to their object types.

 *
Constructor-less usage is available through {@link Pools} which handles PoolsCollection statically.

 *
 * @author Namek
 * @see Pools
 */
public class PoolsCollection {
	protected final Map<Class<?>, ObjectPool<?>> pools = new IdentityHashMap<Class<?>, ObjectPool<?>>();

	/**
	 * Gets object pool of given type from pools collection.
	 * If pool doesn't exist, ReflectionPool will be created and saved internally.
	 */
	@SuppressWarnings("unchecked")
	public <T> ObjectPool<T> getPool(Class<T> type) {
		ObjectPool<?> pool = (ObjectPool<?>) pools.get(type);

		if (pool == null) {
			pool = new ReflectionPool<T>(type);
			pools.put(type, pool);
		}

		return (ObjectPool<T>) pool;
	}

	/**
	 * Set custom pool. If pool for same type already existed, it will be forgotten.
	 */
	public <T> void setPool(Class<T> type, ObjectPool<T> pool) {
		pools.put(type, pool);
	}

	/**
	 * Clears and removes pool of given type from this collection.
	 */
	public void forgetPool(Class<?> type) {
		ObjectPool<?> pool = pools.remove(type);

		if (pool != null) {
			pool.clear();
		}
	}

	/**
	 * Obtains object from pool of given type. Non-existing pool is being created.
	 *
	 * @see #getPool(Class)
	 * @see ObjectPool#obtain()
	 */
	public <T> T obtain(Class<T> type) {
		ObjectPool<T> pool = getPool(type);
		return pool.obtain();
	}

	/**
	 *
Puts object into the pool.

	 *
Calls reset() if it's class implements {@link Poolable} interface.

	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void free(Object obj) {
		ObjectPool pool = getPool(obj.getClass());
		pool.free(obj);
	}
}


text:
import { Container, Step } from 'semantic-ui-react'

type Props = {
  artist: string
}

const SearchSteps = (props: Props) => (
  <Container>
    <Step.Group size='small'>
      <Step
        active={!props.artist}
        icon={'user'}
        title={props.artist || 'Artist'}
        description={props.artist ? undefined : 'Search for an artist'}
      />
      <Step
        active={!!props.artist}
        disabled={!props.artist}
        icon='map pin'
        title='Location'
        description='Search for a location'
      />
    </Step.Group>
  </Container>
)

export default SearchSteps


text:
ICA_TESTRUNNING="TestRunning"
ICA_TESTCOMPLETED="TestCompleted"
ICA_TESTABORTED="TestAborted"
ICA_TESTFAILED="TestFailed"

LogMsg()
{
    echo `date "+%a %b %d %T %Y"` : ${1}    # To add the timestamp to the log file
}

UpdateTestState()
{
    echo $1 > ~/state.txt
}

# adding check for summary.log
if [ -e ~/summary.log ]; then
    LogMsg "Cleaning up previous copies of summary.log"
    rm -rf ~/summary.log
fi

#
# Create the state.txt file so the ICA script knows
# we are running
#
UpdateTestState $ICA_TESTRUNNING

if [ -e ~/constants.sh ]; then
	. ~/constants.sh
else
	LogMsg "ERROR: Unable to source the constants file."
	UpdateTestState "TestAborted"
	exit 1
fi

#Check for Testcase count
if [ ! ${TC_COUNT} ]; then
    LogMsg "The TC_COUNT variable is not defined."
	echo "The TC_COUNT variable is not defined." >> ~/summary.log
    LogMsg "Terminating the test."
    UpdateTestState "TestAborted"
    exit 1
fi

echo "Covers : ${TC_COUNT}" >> ~/summary.log

### Display info on the Hyper-V modules that are loaded ###

#
# Get the modules tree
#
MODULES=~/modules.txt
lsmod | grep hv_* > $MODULES

#
# Did VMBus load
#
LogMsg "Checking if VMBus loaded"

grep -q "vmbus" $MODULES
if [ $? -ne 0 ]; then
    msg="Vmbus not loaded"
    LogMsg "Error: ${msg}"
    echo $msg >> ~/summary.log
    UpdateTestState $ICA_TESTFAILED
    exit 20
fi

#
# Did storvsc load
#
LogMsg "Checking if storvsc loaded"

grep -q "storvsc" $MODULES
if [ $? -ne 0 ]; then
    msg="storvsc not loaded"
    LogMsg "Error: ${msg}"
    echo $msg >> ~/summary.log
    UpdateTestState $ICA_TESTFAILED
    exit 30
fi

#
# Did netvsc load
#
LogMsg "Checking if netvsc loaded"

grep -q "netvsc" $MODULES
if [ $? -ne 0 ]; then
    msg="netvsc not loaded"
    LogMsg "Error: ${msg}"
    echo $msg >> ~/summary.log
    UpdateTestState $ICA_TESTFAILED
    exit 30
fi

#
# Did utils load
#
LogMsg "Checking if utils loaded"

grep -q "utils" $MODULES
if [ $? -ne 0 ]; then
    msg="utils not loaded"
    LogMsg "Error: ${msg}"
    echo $msg >> ~/summary.log
    UpdateTestState $ICA_TESTFAILED
    exit 30
fi

#
# Is boot disk under LIS control
#
DMESGBOOT=/var/log/boot.log
LogMsg "Checking if boot device is under LIS control"

grep -q "/dev/sda" $DMESGBOOT
if [ $? -ne 0 ]; then
    msg="Boot disk not controlled by LIS"
    LogMsg "Error: ${msg}"
    echo $msg >> ~/summary.log
    UpdateTestState $ICA_TESTFAILED
    exit 70
fi

#
# If we got here, all tests passed
#
echo "LIS modules verified" >> ~/summary.log
LogMsg "Updating test case state to completed"

UpdateTestState $ICA_TESTCOMPLETED

exit 0


text:
package dao;

import java.util.Vector;

import model.Location;

public interface LocationDAO {
	public Vector<Location> getLocations() throws Exception;

	public void saveLocations(Vector<Location> locations) throws Exception;

	public Location getLocationByUniqueId(String uniqueId) throws Exception;

}


text:
package com.atomgraph.server.mapper.jena;

import com.atomgraph.core.MediaTypes;
import org.apache.jena.query.QueryParseException;
import org.apache.jena.rdf.model.ResourceFactory;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import com.atomgraph.server.mapper.ExceptionMapperBase;
import javax.inject.Inject;

/**
 *
 * @author Martynas Jusevičius {@literal <martynas@atomgraph.com>}
 */
@Provider
public class QueryParseExceptionMapper extends ExceptionMapperBase implements ExceptionMapper<QueryParseException>
{

    @Inject
    public QueryParseExceptionMapper(MediaTypes mediaTypes)
    {
        super(mediaTypes);
    }

    @Override
    public Response toResponse(QueryParseException ex)
    {
        return getResponseBuilder(toResource(ex, Response.Status.INTERNAL_SERVER_ERROR,
                        ResourceFactory.createResource("http://www.w3.org/2011/http-statusCodes#InternalServerError")).
                    getModel()).
                status(Response.Status.INTERNAL_SERVER_ERROR).
                build();
    }

}


text:
var config = require('../config');
var app_attr = require('../app_attr');
var whois = require('../whois');

exports.index = function(req, res, next) {
    res.render('index');
};

exports.search = function(req, res, next) {
    console.log(req.body);
    var domain_name = req.body.domain_name;
    var domain_server = req.body.domain_server;
    var whois_servers = app_attr.getWhoisServers();
    var server_host = whois_servers.get(domain_server);
    whois.getDomainWhois(domain_name + domain_server, server_host).then(function(whois) {
        var result = {};
        result.isAvailable = whois.isAvailable();
        res.status(200).json(result);
    }, function(data) {

    });
    console.log(server_host);
    res.status(200);
};

exports.getWhoisServers = function(req, res, next) {

    var result = {};
    var whois_servers = app_attr.getWhoisServers();
    result.keys = whois_servers.keys();

    res.status(200).json(result);
};


text:
var __ = "Fill me in"

var assert = function( booleanvalue, msg ) {
	if( booleanvalue !== true ) {
		var error = "Keep trying" + (msg ? ": " + msg : "");
		throw error;
	}
}
var assertNull = function( value, msg ) {
    return assert( value === undefined || value === null, "Expected null " + msg );
}
var assertNotNull = function( value, msg ) {
    return assert( value !== undefined && value !== null, "Expected not null " + msg );
}

var koan = function( msg, koanfunction ) {
	if( koanfunction ) {
		var _msg = "koan: " + msg;
		console.log( _msg );
		koanprint( _msg );
		try {
			koanfunction()
		} catch( err ) {
			if ( err.toLowerCase().indexOf("assert") > -1 ) {
				_msg = "Failed assertion: " + msg
                    + " - "
                    + err.replace("AssertionError: ", "")
				console.error( _msg );
				koanprinterror( _msg )
			} else {
				_msg = msg + " - Threw Unexpected Error: " + err
				console.error( _msg );
				koanprinterror( _msg )
			}
		}
	}
}

var koansuite = function( msg, suitefunction ) {
	if( suitefunction ) {
		var _msg =  "koan suite: " + msg
		console.log( _msg )
		koanprint( _msg )
		try {
			suitefunction();
		} catch( err ) {
			_msg = "Caught error: " + err + " - msg: " + msg
			console.error( _msg )
			koanprinterror( _msg )
		}
	}
}

var jasmineAssert = function( booleanvalue ) {
    // jasmine way
    expect(booleanvalue).toBe(true);
}

//override with jasmine version(s)
//assert = jasmineAssert;
koansuite = describe;
koan = it;

function koanprinterror( err ) {
	koanprint( err, true );
}

function koanprint( msg, isError ) {
	console.debug("koanprint() - msg:", msg )
	if ( msg ) {
		var koans = document.getElementById("koans")
		console.log( "koans: ", koans )
		if ( koans ) {
			var p = "<p" + (isError ? " class='error'" : "") + ">";
			koans.innerHTML += p + msg + "</p>";
		}
	}
}


text:
package com.github.xdcrafts.flower.core.spring.example.email;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Email sender.
 */
public class EmailSender {

    private static final Logger LOGGER = LoggerFactory.getLogger(EmailSender.class);

    private final AtomicInteger requestsSent = new AtomicInteger();

    public Map send(Map request) {
        LOGGER.info("Sending email request: {}", request);
        this.requestsSent.incrementAndGet();
        return request;
    }

    public int getRequestsSent() {
        return requestsSent.get();
    }
}


text:
import abc
from abstract_base import PluginBase

class SubclassImplementation(PluginBase):

    def load(self):
        print "load overridden"

    def save(self):
        print "save overridden"

if __name__ == '__main__':
    print 'Subclass checked:', issubclass(SubclassImplementation, PluginBase)
    print 'Instance checked:', isinstance(SubclassImplementation(), PluginBase)
    obj = SubclassImplementation()
    obj.load()