text:
<?xml version="1.0" encoding="UTF-8"?>
<config>
	<!--
		The pdp-client class is responsible for the PEP communicating with a PDP. By substituting
		in different classes for the client you can communicate with virtually any PDP.
	-->
	<pdp-client class="org.fcrepo.server.security.xacml.pep.DirectPDPClient" />

	<!--
		The response cache, as its name suggests, caches XACML responses based on a hash of an
		XACML request. Two identical requests produce the same hash and therefore can be used
		as a cache key. The cache by default is set to store 1000 entries and each entry lives
		for only 10 seconds.

		This can be changed to suit your needs, however if you want immediate
		application of changed policies you are going to have to keep this number very small.
		It is set to 10 seconds by default to handle multiple child/parent resolutions for a
		request when doing searches.

		If an item is found in the cache, then a request is not	sent to the PDP. Instead the previously
		calculated value is used.
	-->
	<response-cache class="org.fcrepo.server.security.xacml.pep.ResponseCacheImpl" active="true">
		<cache-size>1000</cache-size>
		<cache-item-ttl>60000</cache-item-ttl>
	</response-cache>

	<!--
		This class handles the identification of relationships between objects.

    These relationships are used in forming a resource's XACML hierarchical, path-based
    resource-id identifier attribute, which can be used to apply XACML policies to objects
    based on collection memberships.

    The supplied configuration is to use the RIRelationshipResolver, which makes use of
    the resource index.  This allows the use of both relationships to parents, and relationships from
    from parents to the object.

    If the resource index is not available, the RELSRelationshipResolver will be used instead
    (and if the resource index is not available the configuration should be modified to use this
    to prevent warning messages).
	-->

	<relationship-resolver class="org.fcrepo.server.security.xacml.util.RIRelationshipResolver">
    <!-- relationships from object to its parent -->
    <option name="xacml-parent-relationship-1">info:fedora/fedora-system:def/relations-external#isMemberOf</option>
    <option name="xacml-parent-relationship-2">info:fedora/fedora-system:def/relations-external#isMemberOfCollection</option>
    <option name="xacml-parent-relationship-3">info:fedora/fedora-system:def/relations-external#isPartOf</option>
    <!-- relationships from parent object to its child -->
    <!-- NB need to use RIRelationshipResolver to use these -->
    <option name="xacml-child-relationship-1">info:fedora/fedora-system:def/relations-external#hasMember</option>
    <option name="xacml-child-relationship-2">info:fedora/fedora-system:def/relations-external#hasCollectionMember</option>
    <option name="xacml-child-relationship-3">info:fedora/fedora-system:def/relations-external#hasPart</option>
	</relationship-resolver>

	<!--
		This is the class used to handle the evaluation of requests. This implementation does
		this in a hierarchical fashion. It first checks for all policies pertaining to an object.
		Only if an object has no policies associated with it does it then check if the object has
		any parents. If parents are found then the policies are searched for and used. If none are
		found then it checks the parents of the parents until there are no more ancestors or a
		permit is found.
	-->
	<evaluation-engine class="org.fcrepo.server.security.xacml.pep.EvaluationEngineImpl" />

	<!--
		This section maps handlers for REST operations. When an operation is executed the appropriate
		Handler is called and used to generate XACML requests or perform other tasks such as filtering
		in the case of 'search'.
	-->
	<handlers-rest>
		<handler operation="/describe" class="org.fcrepo.server.security.xacml.pep.rest.filters.DescribeFilter" />
		<handler operation="/get" class="org.fcrepo.server.security.xacml.pep.rest.filters.GetFilter" />
		<handler operation="/getObjectHistory" class="org.fcrepo.server.security.xacml.pep.rest.filters.GetObjectHistoryFilter" />
		<handler operation="/listDatastreams" class="org.fcrepo.server.security.xacml.pep.rest.filters.ListDatastreamsFilter" />
		<handler operation="/listMethods" class="org.fcrepo.server.security.xacml.pep.rest.filters.ListMethodsFilter" />
		<handler operation="/search" class="org.fcrepo.server.security.xacml.pep.rest.filters.SearchFilter" />
		<handler operation="/management/getNextPID" class="org.fcrepo.server.security.xacml.pep.rest.filters.GetNextPIDFilter" />
    <handler operation="/management/control"  class="org.fcrepo.server.security.xacml.pep.rest.filters.ControlFilter" />
    <!-- this does no results filtering, but does check for the appropriate xacml action attribute; but note this is currently also mapped to "read" -->
    <handler operation="/risearch" class="org.fcrepo.server.security.xacml.pep.rest.filters.BasicRISearchFilter" />
		<!--
        Filters risearch results, but with a significant performance penalty (and currently not fully tested).
        <handler operation="risearch" class="org.fcrepo.server.security.xacml.pep.rest.filters.RISearchFilter" />
		-->

    <!-- nb, two endpoints, different servlets, but same security -->
    <handler operation="/upload" class="org.fcrepo.server.security.xacml.pep.rest.filters.UploadFilter" />
    <handler operation="/management/upload" class="org.fcrepo.server.security.xacml.pep.rest.filters.UploadFilter" />

    <!-- WSDL - currently no authz -->
    <handler operation="/services" class="org.fcrepo.server.security.xacml.pep.rest.filters.NoopFilter" />

    <!-- handler for REST API - each individual API operation is mapped below in handlers-objects -->
    <handler operation="/objects" class="org.fcrepo.server.security.xacml.pep.rest.filters.ObjectsFilter" />
	</handlers-rest>

	<!--
		This section maps handlers for the new REST API. This section is tied to the 'handlers-rest'
		sections ObjectsFilter and these handlers are loaded through that interface.
	-->
	<handlers-objects>
		<handler operation="findObjects" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.FindObjects" />
		<handler operation="resumeFindObjects" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.FindObjects" />
		<handler operation="getDatastreamDissemination" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetDatastreamDissemination" />
		<handler operation="getDissemination" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetDissemination" />
		<handler operation="getObjectHistory" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetObjectHistory" />
		<handler operation="getObjectProfile" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetObjectProfile" />
		<handler operation="listDatastreams" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.ListDatastreams" />
		<handler operation="listMethods" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.ListMethods" />
		<handler operation="addDatastream" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.AddDatastream" />
		<handler operation="export" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.Export" />
		<handler operation="getDatastream" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetDatastream" />
		<handler operation="getNextPID" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetNextPID" />
		<handler operation="getObjectXML" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetObjectXML" />
		<handler operation="ingest" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.Ingest" />
		<handler operation="modifyDatastream" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.ModifyDatastream" />
		<handler operation="modifyObject" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.ModifyObject" />
		<handler operation="purgeDatastream" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.PurgeDatastream" />
		<handler operation="purgeObject" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.PurgeObject" />
		<handler operation="setDatastreamState" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.SetDatastreamState" />
		<handler operation="setDatastreamVersionable" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.SetDatastreamVersionable" />
    <handler operation="validate" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.Validate" />
    <handler operation="getDatastreamHistory" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetDatastreamHistory" />
    <handler operation="getRelationships" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.GetRelationships" />
    <handler operation="addRelationship" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.AddRelationship" />
    <handler operation="purgeRelationship" class="org.fcrepo.server.security.xacml.pep.rest.objectshandlers.PurgeRelationship" />
	</handlers-objects>

	<!--
		The next sections are WS based filters. Each service has a set of operations. Each operation is mapped to
		a handler class. The handler class is responsible for generating XACML requests or performing other
		tasks such as filtering for searches.
	-->
	<handlers-ws service="access">
		<handler operation="describeRepository" class="org.fcrepo.server.security.xacml.pep.ws.operations.DescribeRepositoryHandler" />
		<handler operation="getObjectProfile" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetObjectProfileHandler" />
		<handler operation="listDatastreams" class="org.fcrepo.server.security.xacml.pep.ws.operations.ListDatastreamsHandler" />
		<handler operation="listMethods" class="org.fcrepo.server.security.xacml.pep.ws.operations.ListMethodsHandler" />
		<handler operation="getDatastreamDissemination" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDatastreamDisseminationHandler" />
		<handler operation="getDissemination" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDisseminationHandler" />
		<handler operation="findObjects" class="org.fcrepo.server.security.xacml.pep.ws.operations.FindObjectsHandler" />
		<handler operation="resumeFindObjects" class="org.fcrepo.server.security.xacml.pep.ws.operations.ResumeFindObjectsHandler" />
		<handler operation="getObjectHistory" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetObjectHistoryHandler" />
	</handlers-ws>
	<handlers-ws service="accessS">
		<handler operation="describeRepository" class="org.fcrepo.server.security.xacml.pep.ws.operations.DescribeRepositoryHandler" />
		<handler operation="getObjectProfile" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetObjectProfileHandler" />
		<handler operation="listDatastreams" class="org.fcrepo.server.security.xacml.pep.ws.operations.ListDatastreamsHandler" />
		<handler operation="listMethods" class="org.fcrepo.server.security.xacml.pep.ws.operations.ListMethodsHandler" />
		<handler operation="getDatastreamDissemination" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDatastreamDisseminationHandler" />
		<handler operation="getDissemination" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDisseminationHandler" />
		<handler operation="findObjects" class="org.fcrepo.server.security.xacml.pep.ws.operations.FindObjectsHandler" />
		<handler operation="resumeFindObjects" class="org.fcrepo.server.security.xacml.pep.ws.operations.ResumeFindObjectsHandler" />
		<handler operation="getObjectHistory" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetObjectHistoryHandler" />
	</handlers-ws>
	<handlers-ws service="management">
		<handler operation="addDatastream" class="org.fcrepo.server.security.xacml.pep.ws.operations.AddDatastreamHandler" />
		<handler operation="describeUser" class="org.fcrepo.server.security.xacml.pep.ws.operations.DescribeUserHandler" />
		<handler operation="export" class="org.fcrepo.server.security.xacml.pep.ws.operations.ExportHandler" />
		<handler operation="getDatastream" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDatastreamHandler" />
		<handler operation="getDatastreamHistory" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDatastreamHistoryHandler" />
		<handler operation="getDatastreams" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDatastreamsHandler" />
		<handler operation="getNextPID" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetNextPIDHandler" />
		<handler operation="getObjectXML" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetObjectXMLHandler" />
		<handler operation="ingest" class="org.fcrepo.server.security.xacml.pep.ws.operations.IngestHandler" />
		<handler operation="modifyDatastreamByReference" class="org.fcrepo.server.security.xacml.pep.ws.operations.ModifyDatastreamByReferenceHandler" />
		<handler operation="modifyDatastreamByValue" class="org.fcrepo.server.security.xacml.pep.ws.operations.ModifyDatastreamByValueHandler" />
		<handler operation="modifyObject" class="org.fcrepo.server.security.xacml.pep.ws.operations.ModifyObjectHandler" />
		<handler operation="purgeDatastream" class="org.fcrepo.server.security.xacml.pep.ws.operations.PurgeDatastreamHandler" />
		<handler operation="purgeObject" class="org.fcrepo.server.security.xacml.pep.ws.operations.PurgeObjectHandler" />
		<handler operation="setDatastreamState" class="org.fcrepo.server.security.xacml.pep.ws.operations.SetDatastreamStateHandler" />
		<handler operation="setDatastreamVersionable" class="org.fcrepo.server.security.xacml.pep.ws.operations.SetDatastreamVersionableHandler" />
		<handler operation="addRelationship" class="org.fcrepo.server.security.xacml.pep.ws.operations.AddRelationshipHandler" />
		<handler operation="getRelationships" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetRelationshipsHandler" />
		<handler operation="purgeRelationship" class="org.fcrepo.server.security.xacml.pep.ws.operations.PurgeRelationshipHandler" />
	</handlers-ws>
	<handlers-ws service="managementS">
		<handler operation="addDatastream" class="org.fcrepo.server.security.xacml.pep.ws.operations.AddDatastreamHandler" />
		<handler operation="describeUser" class="org.fcrepo.server.security.xacml.pep.ws.operations.DescribeUserHandler" />
		<handler operation="export" class="org.fcrepo.server.security.xacml.pep.ws.operations.ExportHandler" />
		<handler operation="getDatastream" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDatastreamHandler" />
		<handler operation="getDatastreamHistory" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDatastreamHistoryHandler" />
		<handler operation="getDatastreams" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetDatastreamsHandler" />
		<handler operation="getNextPID" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetNextPIDHandler" />
		<handler operation="getObjectXML" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetObjectXMLHandler" />
		<handler operation="ingest" class="org.fcrepo.server.security.xacml.pep.ws.operations.IngestHandler" />
		<handler operation="modifyDatastreamByReference" class="org.fcrepo.server.security.xacml.pep.ws.operations.ModifyDatastreamByReferenceHandler" />
		<handler operation="modifyDatastreamByValue" class="org.fcrepo.server.security.xacml.pep.ws.operations.ModifyDatastreamByValueHandler" />
		<handler operation="modifyObject" class="org.fcrepo.server.security.xacml.pep.ws.operations.ModifyObjectHandler" />
		<handler operation="purgeDatastream" class="org.fcrepo.server.security.xacml.pep.ws.operations.PurgeDatastreamHandler" />
		<handler operation="purgeObject" class="org.fcrepo.server.security.xacml.pep.ws.operations.PurgeObjectHandler" />
		<handler operation="setDatastreamState" class="org.fcrepo.server.security.xacml.pep.ws.operations.SetDatastreamStateHandler" />
		<handler operation="setDatastreamVersionable" class="org.fcrepo.server.security.xacml.pep.ws.operations.SetDatastreamVersionableHandler" />
		<handler operation="addRelationship" class="org.fcrepo.server.security.xacml.pep.ws.operations.AddRelationshipHandler" />
		<handler operation="getRelationships" class="org.fcrepo.server.security.xacml.pep.ws.operations.GetRelationshipsHandler" />
		<handler operation="purgeRelationship" class="org.fcrepo.server.security.xacml.pep.ws.operations.PurgeRelationshipHandler" />
	</handlers-ws>
</config>


text:
package kr.pe.kwonnam.hibernate4memcached.strategies;

import kr.pe.kwonnam.hibernate4memcached.regions.NaturalIdMemcachedRegion;
import org.hibernate.cache.spi.NaturalIdRegion;
import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;

/**
 * @author KwonNam Son (kwon37xi@gmail.com)
 * @see org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy
 */
public abstract class BaseNaturalIdMemcachedRegionAccessStrategy extends MemcachedRegionAccessStrategy implements NaturalIdRegionAccessStrategy {
    private NaturalIdMemcachedRegion naturalIdMemcachedRegion;

    public BaseNaturalIdMemcachedRegionAccessStrategy(NaturalIdMemcachedRegion naturalIdMemcachedRegion) {
        super(naturalIdMemcachedRegion);
        this.naturalIdMemcachedRegion = naturalIdMemcachedRegion;
    }

    @Override
    public NaturalIdRegion getRegion() {
        return naturalIdMemcachedRegion;
    }
}

redpajama_set_name: RedPajamaGithub


text:
from __future__ import (unicode_literals, absolute_import,
                        division, print_function)
import logging

from django.http import Http404
from django.shortcuts import render
from django.contrib.auth.decorators import login_required

from snisi_core.permissions import provider_allowed_or_denied
from snisi_core.models.Projects import Cluster
from snisi_core.models.Periods import MonthPeriod, Period
from snisi_core.models.Entities import Entity
from snisi_trachoma.models import TTBacklogMissionR
from snisi_web.utils import (entity_browser_context, get_base_url_for_period,
                             get_base_url_for_periods,
                             ensure_entity_in_cluster,
                             ensure_entity_at_least)

logger = logging.getLogger(__name__)

@login_required
def trachoma_mission_browser(request,
                             entity_slug=None,
                             period_str=None,
                             **kwargs):
    context = {}

    root = request.user.location
    cluster = Cluster.get_or_none('trachoma_backlog')

    entity = Entity.get_or_none(entity_slug)
    if entity is None:
        entity = root

    if entity is None:
        raise Http404("Aucune entité pour le code {}".format(entity_slug))

    # make sure requested entity is in cluster
    ensure_entity_in_cluster(cluster, entity)

    # check permissions on this entity and raise 403
    provider_allowed_or_denied(request.user, 'access_trachoma', entity)

    # mission browser is reserved to district-level and above
    ensure_entity_at_least(entity, 'health_district')

    def period_from_strid(period_str, reportcls=None):
        period = None
        if period_str:
            try:
                period = Period.from_url_str(period_str).casted()
            except:
                pass
        return period
    period = period_from_strid(period_str)
    if period is None:
        period = MonthPeriod.current()

    try:
        first_period = MonthPeriod.find_create_by_date(
            TTBacklogMissionR.objects.all()
            .order_by('period__start_on')[0].period.middle())
    except IndexError:
        first_period = MonthPeriod.current()
    all_periods = MonthPeriod.all_from(first_period)

    context.update({
        'all_periods': [(p.strid(), p) for p in reversed(all_periods)],
        'period': period,
        'base_url': get_base_url_for_period(
            view_name='trachoma_missions', entity=entity,
            period_str=period_str or period.strid())
    })

    context.update(entity_browser_context(
        root=root, selected_entity=entity,
        full_lineage=['country', 'health_region', 'health_district'],
        cluster=cluster))

    # retrieve list of missions for that period
    missions = TTBacklogMissionR.objects.filter(
        period=period,
        entity__slug__in=[e.slug for e in entity.get_health_districts()])

    context.update({'missions': missions})

    return render(request,
                  kwargs.get('template_name', 'trachoma/missions_list.html'),
                  context)

@login_required
def trachoma_mission_viewer(request, report_receipt, **kwargs):
    context = {}

    mission = TTBacklogMissionR.get_or_none(report_receipt)
    if mission is None:
        return Http404("Nº de reçu incorrect : {}".format(report_receipt))

    context.update({'mission': mission})

    return render(request,
                  kwargs.get('template_name', 'trachoma/mission_detail.html'),
                  context)

@login_required
def trachoma_dashboard(request,
                       entity_slug=None,
                       perioda_str=None,
                       periodb_str=None,
                       **kwargs):
    context = {}

    root = request.user.location
    cluster = Cluster.get_or_none('trachoma_backlog')

    entity = Entity.get_or_none(entity_slug)
    if entity is None:
        entity = root

    if entity is None:
        raise Http404("Aucune entité pour le code {}".format(entity_slug))

    # make sure requested entity is in cluster
    ensure_entity_in_cluster(cluster, entity)

    # check permissions on this entity and raise 403
    provider_allowed_or_denied(request.user, 'access_trachoma', entity)

    # mission browser is reserved to district-level and above
    ensure_entity_at_least(entity, 'health_district')

    def period_from_strid(period_str, reportcls=None):
        period = None
        if period_str:
            try:
                period = Period.from_url_str(period_str).casted()
            except:
                pass
        return period
    perioda = period_from_strid(perioda_str)
    periodb = period_from_strid(periodb_str)
    if periodb is None:
        periodb = MonthPeriod.current()
    if perioda is None:
        perioda = periodb

    if perioda is None or periodb is None:
        raise Http404("Période incorrecte.")

    if perioda > periodb:
        t = perioda
        perioda = periodb
        periodb = t
        del(t)

    try:
        first_period = MonthPeriod.find_create_by_date(
            TTBacklogMissionR.objects.all().order_by(
                'period__start_on')[0].period.middle())
    except IndexError:
        first_period = MonthPeriod.current()
    all_periods = MonthPeriod.all_from(first_period)
    periods = MonthPeriod.all_from(perioda, periodb)

    context.update({
        'all_periods': [(p.strid(), p) for p in reversed(all_periods)],
        'periods': periods,
        'perioda': perioda,
        'periodb': periodb,
        'base_url': get_base_url_for_periods(
            view_name='trachoma_dashboard',
            entity=entity,
            perioda_str=perioda_str or perioda.strid(),
            periodb_str=periodb_str or periodb.strid())
    })

    context.update(entity_browser_context(
        root=root, selected_entity=entity,
        full_lineage=['country', 'health_region', 'health_district'],
        cluster=cluster))

    # retrieve Indicator Table
    from snisi_trachoma.indicators import (MissionDataSummary,
                                           CumulativeBacklogData)

    missions_followup = MissionDataSummary(entity=entity,
                                           periods=periods)
    cumulative_backlog = CumulativeBacklogData(entity=entity,
                                               periods=periods)

    context.update({
        'missions_followup': missions_followup,
        'cumulative_backlog': cumulative_backlog,
    })

    return render(request,
                  kwargs.get('template_name', 'trachoma/dashboard.html'),
                  context)


text:
module Godmin
  class Resolver < ::ActionView::FileSystemResolver
    def self.resolvers(controller_path, engine_wrapper)
      [
        EngineResolver.new(controller_path, engine_wrapper),
        GodminResolver.new(controller_path, engine_wrapper)
      ]
    end

    def initialize(path, controller_path, engine_wrapper)
      super(path)
      @controller_path = controller_path
      @engine_wrapper = engine_wrapper
    end

    def find_templates(name, prefix, *args)
      templates = []

      template_paths(prefix).each do |path|
        if templates.present?
          break
        else
          templates = super(name, path, *args)
        end
      end

      templates
    end
  end

  # Matches templates such as:
  #
  # { name: index, prefix: articles } => app/views/resource/index
  # { name: form, prefix: articles }  => app/views/resource/_form
  # { name: title, prefix: columns }  => app/views/resource/columns/_title
  class EngineResolver < Resolver
    def initialize(controller_path, engine_wrapper)
      super(File.join(engine_wrapper.root, "app/views"), controller_path, engine_wrapper)
    end

    def template_paths(prefix)
      [
        resource_path_for_engine(prefix)
      ]
    end

    def resource_path_for_engine(prefix)
      prefix.sub(/\A#{@controller_path}/, File.join(@engine_wrapper.namespaced_path, "resource")).sub(/\A\//, "")
    end
  end

  # Matches templates such as:
  #
  # { name: index, prefix: articles }      => godmin/app/views/godmin/resource/index
  # { name: form, prefix: articles }       => godmin/app/views/godmin/resource/_form
  # { name: welcome, prefix: application } => godmin/app/views/godmin/application/welcome
  # { name: navigation, prefix: shared }   => godmin/app/views/godmin/shared/navigation
  class GodminResolver < Resolver
    def initialize(controller_path, engine_wrapper)
      super(File.join(Godmin::Engine.root, "app/views/godmin"), controller_path, engine_wrapper)
    end

    def template_paths(prefix)
      [
        default_path_for_godmin(prefix),
        resource_path_for_godmin(prefix)
      ]
    end

    def default_path_for_godmin(prefix)
      prefix.sub(/\A#{File.join(@engine_wrapper.namespaced_path)}/, "").sub(/\A\//, "")
    end

    def resource_path_for_godmin(prefix)
      prefix.sub(/\A#{@controller_path}/, "resource").sub(/\A\//, "")
    end
  end
end


text:
package org.jivesoftware.openfire.clearspace;

import static org.jivesoftware.openfire.clearspace.ClearspaceManager.HttpType.GET;

import java.util.StringTokenizer;

import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;

import org.dom4j.Element;
import org.jivesoftware.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.JID;

/**
 * Implements the CLEARSPACE server-side SASL mechanism.
 *
 * @author Armando Jagucki
 */
public class ClearspaceSaslServer implements SaslServer {

	private static final Logger Log = LoggerFactory.getLogger(ClearspaceSaslServer.class);

    private boolean completed;
    private String jid;

    public ClearspaceSaslServer() {
        this.completed = false;
    }

    /**
     * Returns the mechanism name of this SASL server.
     * (e.g. "CRAM-MD5", "GSSAPI").
     *
     * @return A non-null string representing the mechanism name.
     */
    public String getMechanismName() {
        return "CLEARSPACE";
    }

    /**
     * Evaluates the response data and generates a challenge.
     *

     * If a response is received from the client during the authentication
     * process, this method is called to prepare an appropriate next
     * challenge to submit to the client. The challenge is null if the
     * authentication has succeeded and no more challenge data is to be sent
     * to the client. It is non-null if the authentication must be continued
     * by sending a challenge to the client, or if the authentication has
     * succeeded but challenge data needs to be processed by the client.
     * <tt>isComplete()</tt> should be called
     * after each call to <tt>evaluateResponse()</tt>,to determine if any further
     * response is needed from the client.

     *
     * @param response The non-null (but possibly empty) response sent
     *                 by the client.
     * @return The possibly null challenge to send to the client.
     *         It is null if the authentication has succeeded and there is
     *         no more challenge data to be sent to the client.
     * @throws javax.security.sasl.SaslException
     *          If an error occurred while processing
     *          the response or generating a challenge.
     */
    public byte[] evaluateResponse(byte[] response) throws SaslException {
        ClearspaceManager csManager = ClearspaceManager.getInstance();
        String responseStr = new String(response);

        // Parse data and obtain jid & random string
        StringTokenizer tokens = new StringTokenizer(responseStr, "\u0000");
        if (tokens.countTokens() != 2) {
            // Info was not provided correctly
            completed = false;
            return null;
        }

        jid = tokens.nextToken();

        int atIndex = jid.lastIndexOf("@");

        String node = jid.substring(0, atIndex);

        jid = JID.escapeNode(node) + "@" + jid.substring(atIndex + 1);

        try {
            responseStr = StringUtils.encodeBase64(responseStr);
            Element resultElement =
                    csManager.executeRequest(GET, "groupChatAuthService/isAuthTokenValid/" + responseStr);
            if ("true".equals(WSUtils.getReturn(resultElement))) {
                completed = true;
            }
            else {
                // Failed to authenticate the user so throw an error so SASL failure is returned
                throw new SaslException("SASL CLEARSPACE: user not authorized: " + jid);
            }
        } catch (SaslException e) {
            // rethrow exception
            throw e;
        } catch (Exception e) {
            Log.error("Failed communicating with Clearspace", e);
            throw new SaslException("SASL CLEARSPACE: user not authorized due to an error: " + jid);
        }

        return null;
    }

    /**
     * Determines whether the authentication exchange has completed.
     * This method is typically called after each invocation of
     * <tt>evaluateResponse()</tt> to determine whether the
     * authentication has completed successfully or should be continued.
     *
     * @return true if the authentication exchange has completed; false otherwise.
     */
    public boolean isComplete() {
        return completed;
    }

    /**
     * Reports the authorization ID in effect for the client of this
     * session.
     * This method can only be called if isComplete() returns true.
     *
     * @return The authorization ID of the client.
     * @throws IllegalStateException if this authentication session has not completed
     */
    public String getAuthorizationID() {
        if (completed) {
            return jid;
        }
        else {
            throw new IllegalStateException("CLEARSPACE authentication not completed");
        }
    }

    /**
     * Unwraps a byte array received from the client.
     * This method can be called only after the authentication exchange has
     * completed (i.e., when <tt>isComplete()</tt> returns true) and only if
     * the authentication exchange has negotiated integrity and/or privacy
     * as the quality of protection; otherwise,
     * an <tt>IllegalStateException</tt> is thrown.
     *

     * <tt>incoming</tt> is the contents of the SASL buffer as defined in RFC 2222
     * without the leading four octet field that represents the length.
     * <tt>offset</tt> and <tt>len</tt> specify the portion of <tt>incoming</tt>
     * to use.

     *
     * @param incoming A non-null byte array containing the encoded bytes
     *                 from the client.
     * @param offset   The starting position at <tt>incoming</tt> of the bytes to use.
     * @param len      The number of bytes from <tt>incoming</tt> to use.
     * @return A non-null byte array containing the decoded bytes.
     * @throws javax.security.sasl.SaslException
     *                               if <tt>incoming</tt> cannot be successfully
     *                               unwrapped.
     * @throws IllegalStateException if the authentication exchange has
     *                               not completed, or if the negotiated quality of protection
     *                               has neither integrity nor privacy
     */
    public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
        return new byte[0];
    }

    /**
     * Wraps a byte array to be sent to the client.
     * This method can be called only after the authentication exchange has
     * completed (i.e., when <tt>isComplete()</tt> returns true) and only if
     * the authentication exchange has negotiated integrity and/or privacy
     * as the quality of protection; otherwise, a <tt>SaslException</tt> is thrown.
     *

     * The result of this method
     * will make up the contents of the SASL buffer as defined in RFC 2222
     * without the leading four octet field that represents the length.
     * <tt>offset</tt> and <tt>len</tt> specify the portion of <tt>outgoing</tt>
     * to use.

     *
     * @param outgoing A non-null byte array containing the bytes to encode.
     * @param offset   The starting position at <tt>outgoing</tt> of the bytes to use.
     * @param len      The number of bytes from <tt>outgoing</tt> to use.
     * @return A non-null byte array containing the encoded bytes.
     * @throws javax.security.sasl.SaslException
     *                               if <tt>outgoing</tt> cannot be successfully
     *                               wrapped.
     * @throws IllegalStateException if the authentication exchange has
     *                               not completed, or if the negotiated quality of protection has
     *                               neither integrity nor privacy.
     */
    public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
        return new byte[0];
    }

    /**
     * Retrieves the negotiated property.
     * This method can be called only after the authentication exchange has
     * completed (i.e., when <tt>isComplete()</tt> returns true); otherwise, an
     * <tt>IllegalStateException</tt> is thrown.
     *
     * @param propName the property
     * @return The value of the negotiated property. If null, the property was
     *         not negotiated or is not applicable to this mechanism.
     * @throws IllegalStateException if this authentication exchange has not completed
     */

    public Object getNegotiatedProperty(String propName) {
        return null;
    }

    /**
     * Disposes of any system resources or security-sensitive information
     * the SaslServer might be using. Invoking this method invalidates
     * the SaslServer instance. This method is idempotent.
     *
     * @throws javax.security.sasl.SaslException
     *          If a problem was encountered while disposing
     *          the resources.
     */
   public void dispose() throws SaslException {
        completed = false;
    }
}


text:
<?php

namespace Struzik\ErrorHandler\Processor;

use Psr\Log\NullLogger;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;

class LoggerProcessorTest extends \PHPUnit_Framework_TestCase
{
    public function testGetSetErrorTypes()
    {
        $processor = new LoggerProcessor(new NullLogger());
        $this->assertEquals(error_reporting(), $processor->getErrorTypes());

        $errorTypes = E_ALL & ~E_USER_ERROR;
        $processor->setErrorTypes($errorTypes);
        $this->assertEquals($errorTypes, $processor->getErrorTypes());
    }

    public function testNonPSR3Logger()
    {
        if (version_compare(phpversion(), '7.0.0') >= 0) {
            $this->expectException(\TypeError::class);
        } else {
            $this->expectException(\PHPUnit_Framework_Error::class);
        }

        $processor = new LoggerProcessor(new \stdClass());
    }

    public function testHandle()
    {
        $this->expectOutputRegex('/^.+/u');

        $logger = new Logger('LoggerProcessor TEST');
        $logger->pushHandler(new StreamHandler('php://output', Logger::DEBUG));

        $processor = new LoggerProcessor($logger);
        $processor->handle(E_USER_NOTICE, 'Dummy error', __FILE__, __LINE__);
    }
}


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

namespace NLog.AirBrake.TestApp
{
  class Program
  {
    private static Logger logger = LogManager.GetCurrentClassLogger();

    static void Main(string[] args)
    {
      try
      {
          //This should be ignored if Nlog config is set up correctly
        logger.Warn("something bad is about to happen");
        throw new ApplicationException("boom");
      }
      catch (Exception ex)
      {
        logger.InfoException("test", ex);
        logger.Error(ex);
        logger.ErrorException("this is a message", ex);
      }

      Console.WriteLine("Done.");
      Console.ReadLine();
    }
  }
}


text:
require "formula"
require "cli_parser"

module Homebrew
  module_function

  def formula
    Homebrew::CLI::Parser.parse do
      switch :debug
      switch :verbose
    end

    raise FormulaUnspecifiedError if ARGV.named.empty?
    ARGV.resolved_formulae.each { |f| puts f.path }
  end
end


text:
MyJohnDeere API implementation for the Ruby OAuth library

## System Requirments
1. Download Java JDK 1.7 or higher, set the JAVA_HOME variable
2. download the latest jruby binary distribution from http://www.jruby.org/download and oauth gem
3. add the bin directory to your path

   ```setx /m path "%path%;C:\jruby\bin"```

## Run the sample app
1. Execute gem install oauth
2. Update API_KEY and API_SECRET with the details from developer.deere.com app
3. excute jruby ruby_client.rb, which will display url with request token

  ```
  ****  Fetching request token ****
  Request Token received - 9f14e0ed-247e-432d-bb05-2db139dce50a

  ---> Goto to url mentioned below to authorize and paste the access token verifier
  https://my.deere.com/consentToUseOfData?oauth_token=your request token
  ```
4. Copy the url in browser and hit enter.
5. Login with your johndeere userId and password
6. You will get the verifier in the browser
  ```
  Success!

  Now, enter the verifier code hy3OpT into Your app name.

  If anyone asks, your OAuth Request Token is 9f14e0ed-247e-432d-bb05-2db139dce50a
  ```
7. Copy and paste the verfier in the console. This will generate accestoken and calls /organizations
  ```
  ***** Fetching access token *****
  Access token received - Your access token

  ***** Fetching organizations: GET /organizations *****
  ```


text:
layout: api
title: UTCFullYear
permalink: UTCFullYear/index.html
filename: api/UTCFullYear.md
---


text:
package com.hazelcast.internal.json;

import com.hazelcast.core.HazelcastException;

import java.io.IOException;

/**
 * This class is a placeholder for Json object/arrays that are not
 * parsed by {@link com.hazelcast.query.impl.getters.AbstractJsonGetter}.
 * It is used to distinguish between query paths that do not exist and
 * existing ones that does not terminate with either of `true`, `false`,
 * `null`, `number` or `string`.
 */
public class NonTerminalJsonValue extends JsonValue {

    public static final NonTerminalJsonValue INSTANCE = new NonTerminalJsonValue();

    @Override
    void write(JsonWriter writer) throws IOException {
        throw new HazelcastException("This object should not be encoded");
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingLeft="12dp"
    android:paddingBottom="8dp"
    android:paddingTop="16dp"
    >
    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@android:style/Widget.ProgressBar.Small"
        />
    <TextView
        android:id="@+id/txt_message"
        android:paddingLeft="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Typing Indicator"
        android:textSize="12sp"
        android:textStyle="italic"
        android:textColor="#9d9ba5"
        android:gravity="center_vertical"
        android:layout_gravity="center_vertical"
        />
</LinearLayout>


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

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Statistics of DET in UD_Turkish-Atis</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Turkish-Atis: POS Tags: DET

There are 6 DET lemmas (0%), 6 DET types (0%) and 1323 DET tokens (3%).
Out of 13 observed tags, the rank of DET is: 10 in number of lemmas, 11 in number of types and 6 in number of tokens.

The 10 most frequent DET lemmas: bir, tüm, bu, her, o, şu

The 10 most frequent DET types:  bir, tüm, bu, her, o, şu

The 10 most frequent ambiguous lemmas: bir (<tt>DET</tt> 691, <tt>NUM</tt> 25, <tt>NOUN</tt> 3), tüm (<tt>DET</tt> 594, <tt>NOUN</tt> 2), bu (<tt>DET</tt> 18, <tt>PRON</tt> 11), şu (<tt>DET</tt> 3, <tt>PRON</tt> 1)

The 10 most frequent ambiguous types:  bir (<tt>DET</tt> 683, <tt>NUM</tt> 23), bu (<tt>DET</tt> 13, <tt>PRON</tt> 7), şu (<tt>DET</tt> 2, <tt>PRON</tt> 1)

bir

<tt>DET</tt> 683: Memphis'ten Seattle'ye en geç akşam saat 3'te varacak bir uçuş istiyorum

<tt>NUM</tt> 23: Denver'den San Francisco'ya en az bir durakla uçmak istiyorum

bu

<tt>DET</tt> 13: bu öğleden sonra Logan'dan Atlanta'ya uçağa ihtiyacım var

<tt>PRON</tt> 7: bu yıl 23 Kasım'da Atlanta'dan Denver'e Delta ile uçmak istiyorum

şu

<tt>DET</tt> 2: Boston ve Dallas Fort Worth arasında şu anda hangi uçuşlar mevcut

<tt>PRON</tt> 1: sorum şu San Francisco'ya gitmek istiyorum ve Denver'de yaşıyorum ve birleşik havayollarında uçmak istiyorum erken uçuşunuz var mı

Morphology

The form / lemma ratio of DET is 1.000000 (the average of all parts of speech is 1.748764).

The 1st highest number of forms (1) was observed with the lemma "bir": bir.

The 2nd highest number of forms (1) was observed with the lemma "bu": bu.

The 3rd highest number of forms (1) was observed with the lemma "her": her.

DET occurs with 2 features: <tt>PronType</tt> (1323; 100% instances), <tt>Definite</tt> (729; 55% instances)

DET occurs with 3 feature-value pairs: Definite=Def, Definite=Ind, PronType=Art

DET occurs with 3 feature combinations.
The most frequent feature combination is Definite=Ind|PronType=Art (691 tokens).
Examples: bir

Relations

DET nodes are attached to their parents using 8 different relations: <tt>det</tt> (1297; 98% instances), <tt>dep</tt> (5; 0% instances), <tt>fixed</tt> (5; 0% instances), <tt>amod</tt> (4; 0% instances), <tt>compound</tt> (4; 0% instances), <tt>nmod</tt> (4; 0% instances), <tt>advmod</tt> (3; 0% instances), <tt>discourse</tt> (1; 0% instances)

Parents of DET nodes belong to 5 different parts of speech: <tt>NOUN</tt> (1291; 98% instances), <tt>NUM</tt> (9; 1% instances), <tt>ADJ</tt> (8; 1% instances), <tt>VERB</tt> (8; 1% instances), <tt>PROPN</tt> (7; 1% instances)

1316 (99%) DET nodes are leaves.

6 (0%) DET nodes have one child.

1 (0%) DET nodes have two children.

The highest child degree of a DET node is 2.

Children of DET nodes are attached using 3 different relations: <tt>compound</tt> (5; 63% instances), <tt>fixed</tt> (2; 25% instances), <tt>case</tt> (1; 13% instances)

Children of DET nodes belong to 3 different parts of speech: <tt>NOUN</tt> (6; 75% instances), <tt>ADP</tt> (1; 13% instances), <tt>PRON</tt> (1; 13% instances)

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
package org.hibernate.sql.ordering.antlr;

import org.hibernate.HibernateException;

/**
 * Contract for mapping a (an assumed) property reference to its columns.
 *
 * @author Steve Ebersole
 */
public interface ColumnMapper {
	/**
	 * Resolve the property reference to its underlying columns.
	 *
	 * @param reference The property reference name.
	 *
	 * @return References to the columns/formulas that define the value mapping for the given property, or null
	 * if the property reference is unknown.
	 *
	 * @throws HibernateException Generally indicates that the property reference is unknown; interpretation
	 * should be the same as a null return.
	 */
	public SqlValueReference[] map(String reference) throws HibernateException;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.fillodeos.spring.samples</groupId>
    <artifactId>spring-data-rest-webhook</artifactId>
    <version>0.1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.M5</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.awaitility/awaitility -->
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>3.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.dbunit</groupId>
            <artifactId>dbunit</artifactId>
            <version>2.5.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.springtestdbunit</groupId>
            <artifactId>spring-test-dbunit</artifactId>
            <version>1.3.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/libs-milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-milestone</url>
        </pluginRepository>
    </pluginRepositories>
</project>


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

namespace ConcatenateData
{
    class Program
    {
        static void Main(string[] args)
        {
            string firstname = Console.ReadLine();
            string lastName = Console.ReadLine();
            string age = Console.ReadLine();
            string town = Console.ReadLine();
            Console.WriteLine("You are {0} {1}, a {2}-years old person from {3}.", firstname, lastName, age, town);
        }
    }
}


text:
if [ ! -f "run_tests.log" ];
then
  echo "The first time you run this will most likely take quite a while"
  echo "as it will be checking out quite a lot of different vendor"
  echo "packages to test against."
  echo ""
  echo "Running some preliminary setup in 5 seconds."
  sleep 5
  python run_tests.py tests.test_basic:SetupVendorOnly.setup_vendor
fi
python run_tests.py $@ 2> run_tests.log


text:
from bs4 import BeautifulSoup
import requests
import json

html_page = "page_source.html"

def extract_data(page):
    data = {"eventvalidation": "",
            "viewstate": ""}
    with open(page, "r") as html:
        # do something here to find the necessary values
        pass

    return data

def make_request(data):
    eventvalidation = data["eventvalidation"]
    viewstate = data["viewstate"]

    r = requests.post("http://www.transtats.bts.gov/Data_Elements.aspx?Data=2",
                    data={'AirportList': "BOS",
                          'CarrierList': "VX",
                          'Submit': 'Submit',
                          "__EVENTTARGET": "",
                          "__EVENTARGUMENT": "",
                          "__EVENTVALIDATION": eventvalidation,
                          "__VIEWSTATE": viewstate
                    })

    return r.text

def test():
    data = extract_data(html_page)
    assert data["eventvalidation"] != ""
    assert data["eventvalidation"].startswith("/wEWjAkCoIj1ng0")
    assert data["viewstate"].startswith("/wEPDwUKLTI")

test()


text:
package com.ssh.common.subject;

import com.ssh.common.dto.DTO;

import java.util.List;

public class ActiveUser implements DTO {

    private static final long serialVersionUID = 1L;

    private Long id;
    private String code;
    private String name;
    private String pass;
    private String salt;
    private Integer status;
    private List<Permission> menus;
    private List<Permission> functions;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public List<Permission> getMenus() {
        return menus;
    }

    public void setMenus(List<Permission> menus) {
        this.menus = menus;
    }

    public List<Permission> getFunctions() {
        return functions;
    }

    public void setFunctions(List<Permission> functions) {
        this.functions = functions;
    }

    @Override
    public String toString() {
        return "ActiveUser [id=" + id + ", code=" + code
                + ", name=" + name + "]";
    }

}


text:
<?php

namespace Egzaminer;

use Exception;

class DebugException extends Exception
{
}


text:
write-host $('=' * ($HOST.ui.rawui.buffersize.width - 1))
write-host $MyInvocation.MyCommand
write-host $('=' * ($HOST.ui.rawui.buffersize.width - 1))
write-host ''
write-host ''

& {
    $VerbosePreference = 'SilentlyContinue'
    $DebugPreference = 'SilentlyContinue'

    write-host '---------------------------------------------------------------'
    write-host 'There should be no messages'
    write-host '    assert-notexists @(1, 2) {param($n) $n -gt 5} <# line 15 #>'
    write-host '---------------------------------------------------------------'
    assert-notexists @(1, 2) {param($n) $n -gt 5}
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'SilentlyContinue'
    $DebugPreference = 'SilentlyContinue'

    write-host '------------------------------------------------------------------------'
    write-host 'There should be a PASSING VERBOSE message'
    write-host '    assert-notexists @(1, 2) {param($n) $n -gt 5} -verbose <# line 28 #>'
    write-host '------------------------------------------------------------------------'
    assert-notexists @(1, 2) {param($n) $n -gt 5} -verbose
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'SilentlyContinue'
    $DebugPreference = 'SilentlyContinue'

    write-host '----------------------------------------------------------------------'
    write-host 'There should be no messages'
    write-host '    assert-notexists @(1, 2) {param($n) $n -gt 5} -debug <# line 41 #>'
    write-host '----------------------------------------------------------------------'
    assert-notexists @(1, 2) {param($n) $n -gt 5} -debug
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'SilentlyContinue'
    $DebugPreference = 'SilentlyContinue'

    write-host '-------------------------------------------------------------------------------'
    write-host 'There should be a PASSING VERBOSE message'
    write-host '    assert-notexists @(1, 2) {param($n) $n -gt 5} -verbose -debug <# line 54 #>'
    write-host '-------------------------------------------------------------------------------'
    assert-notexists @(1, 2) {param($n) $n -gt 5} -verbose -debug
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'SilentlyContinue'
    $DebugPreference = 'SilentlyContinue'

    write-host '---------------------------------------------------------------'
    write-host 'There should be no messages'
    write-host '    assert-notexists @(1, 2) {param($n) $n -gt 5} <# line 67 #>'
    write-host '---------------------------------------------------------------'
    assert-notexists @(1, 2) {param($n) $n -gt 5}
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'Continue'
    $DebugPreference = 'SilentlyContinue'

    write-host '---------------------------------------------------------------'
    write-host 'There should be a PASSING VERBOSE message'
    write-host '    assert-notexists @(1, 2) {param($n) $n -gt 5} <# line 80 #>'
    write-host '---------------------------------------------------------------'
    assert-notexists @(1, 2) {param($n) $n -gt 5}
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'SilentlyContinue'
    $DebugPreference = 'Continue'

    write-host '---------------------------------------------------------------'
    write-host 'There should be no messages'
    write-host '    assert-notexists @(1, 2) {param($n) $n -gt 5} <# line 93 #>'
    write-host '---------------------------------------------------------------'
    assert-notexists @(1, 2) {param($n) $n -gt 5}
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'Continue'
    $DebugPreference = 'Continue'

    write-host '----------------------------------------------------------------'
    write-host 'There should be a PASSING VERBOSE message'
    write-host '    assert-notexists @(1, 2) {param($n) $n -gt 5} <# line 106 #>'
    write-host '----------------------------------------------------------------'
    assert-notexists @(1, 2) {param($n) $n -gt 5}
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'SilentlyContinue'
    $DebugPreference = 'SilentlyContinue'

    write-host '------------------------------------------------------------------------'
    write-host 'There should be an ERROR message'
    write-host '    try   {assert-notexists @(1, 2) {param($n) $n -gt 0}} <# line 119 #>'
    write-host '------------------------------------------------------------------------'
    try   {assert-notexists @(1, 2) {param($n) $n -gt 0}}
    catch {$_ | out-host}
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'Continue'
    $DebugPreference = 'SilentlyContinue'

    write-host '------------------------------------------------------------------------'
    write-host 'There should be a VERBOSE and an ERROR message (order matters)'
    write-host '    try   {assert-notexists @(1, 2) {param($n) $n -gt 0}} <# line 133 #>'
    write-host '------------------------------------------------------------------------'
    try   {assert-notexists @(1, 2) {param($n) $n -gt 0}}
    catch {$_ | out-host}
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'SilentlyContinue'
    $DebugPreference = 'Continue'

    write-host '------------------------------------------------------------------------'
    write-host 'There should be a DEBUG and an ERROR message (order matters)'
    write-host '    try   {assert-notexists @(1, 2) {param($n) $n -gt 0}} <# line 147 #>'
    write-host '------------------------------------------------------------------------'
    try   {assert-notexists @(1, 2) {param($n) $n -gt 0}}
    catch {$_ | out-host}
    write-host ''
    write-host ''
}

& {
    $VerbosePreference = 'Continue'
    $DebugPreference = 'Continue'

    write-host '------------------------------------------------------------------------'
    write-host 'There should be a VERBOSE, DEBUG and ERROR messages (order matters)'
    write-host '    try   {assert-notexists @(1, 2) {param($n) $n -gt 0}} <# line 161 #>'
    write-host '------------------------------------------------------------------------'
    try   {assert-notexists @(1, 2) {param($n) $n -gt 0}}
    catch {$_ | out-host}
    write-host ''
    write-host ''
}

write-host $('=' * ($HOST.ui.rawui.buffersize.width - 1))
write-host ''


text:
extern zend_class_entry *test_optimizers_ldexp_ce;

ZEPHIR_INIT_CLASS(Test_Optimizers_Ldexp);

PHP_METHOD(Test_Optimizers_Ldexp, testInt);
PHP_METHOD(Test_Optimizers_Ldexp, testDoubleInt);
PHP_METHOD(Test_Optimizers_Ldexp, testDouble);
PHP_METHOD(Test_Optimizers_Ldexp, testVar);
PHP_METHOD(Test_Optimizers_Ldexp, testIntValue1);
PHP_METHOD(Test_Optimizers_Ldexp, testIntParameter);
PHP_METHOD(Test_Optimizers_Ldexp, testVarParameter);

ZEND_BEGIN_ARG_INFO_EX(arginfo_test_optimizers_ldexp_testintparameter, 0, 0, 2)
#if PHP_VERSION_ID >= 70200
	ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
#else
	ZEND_ARG_INFO(0, x)
#endif
#if PHP_VERSION_ID >= 70200
	ZEND_ARG_TYPE_INFO(0, exponent, IS_LONG, 0)
#else
	ZEND_ARG_INFO(0, exponent)
#endif
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_test_optimizers_ldexp_testvarparameter, 0, 0, 2)
	ZEND_ARG_INFO(0, x)
	ZEND_ARG_INFO(0, exponent)
ZEND_END_ARG_INFO()

ZEPHIR_INIT_FUNCS(test_optimizers_ldexp_method_entry) {
	PHP_ME(Test_Optimizers_Ldexp, testInt, NULL, ZEND_ACC_PUBLIC)
	PHP_ME(Test_Optimizers_Ldexp, testDoubleInt, NULL, ZEND_ACC_PUBLIC)
	PHP_ME(Test_Optimizers_Ldexp, testDouble, NULL, ZEND_ACC_PUBLIC)
	PHP_ME(Test_Optimizers_Ldexp, testVar, NULL, ZEND_ACC_PUBLIC)
	PHP_ME(Test_Optimizers_Ldexp, testIntValue1, NULL, ZEND_ACC_PUBLIC)
	PHP_ME(Test_Optimizers_Ldexp, testIntParameter, arginfo_test_optimizers_ldexp_testintparameter, ZEND_ACC_PUBLIC)
	PHP_ME(Test_Optimizers_Ldexp, testVarParameter, arginfo_test_optimizers_ldexp_testvarparameter, ZEND_ACC_PUBLIC)
	PHP_FE_END
};


text:
/**
 * Includes visitor classes.
 *
 * @author amajumdar
 */
package com.netflix.metacat.common.server.partition.visitor;


text:
/**
 * Launch PaymentRequest with a show promise and don't resolve or reject it.
 * @return {string} - The error message, if any.
 */
async function buy() {
  try {
    await new PaymentRequest(
        [{supportedMethods: window.location.href}],
        {total: {label: 'Total', amount: {currency: 'USD', value: '1.00'}}})
        .show(new Promise(function(resolve) { /* Intentionally empty. */ }));
  } catch (error) {
    // Error is both printed and returned as the Java test reads it from the
    // page and the C++ browser test reads the return value.
    print(error);
    return error.toString();
  }
}


text:
package org.antlr.v4.codegen.model;

import org.antlr.v4.codegen.OutputModelFactory;
import org.antlr.v4.tool.ast.GrammarAST;

import java.util.List;

public abstract class LL1Choice extends Choice {
	/** Token names for each alt 0..n-1 */
	public List<TokenInfo[]> altLook;
	@ModelElement public ThrowNoViableAlt error;

	public LL1Choice(OutputModelFactory factory, GrammarAST blkAST,
					 List<CodeBlockForAlt> alts)
	{
		super(factory, blkAST, alts);
	}
}


text:
/* */
(function(Buffer) {
  var xor = require("buffer-xor");
  function getBlock(self) {
    self._prev = self._cipher.encryptBlock(self._prev);
    return self._prev;
  }
  exports.encrypt = function(self, chunk) {
    while (self._cache.length < chunk.length) {
      self._cache = Buffer.concat([self._cache, getBlock(self)]);
    }
    var pad = self._cache.slice(0, chunk.length);
    self._cache = self._cache.slice(chunk.length);
    return xor(chunk, pad);
  };
})(require("buffer").Buffer);


text:
$uvs: PENDING CONFLICT
#include "Docking.h"

#define DOCKBACK(x)               callback(dock, &DockWindow::x)
#define DOCKBACK1(x, arg)         callback1(dock, &DockWindow::x, arg)
#define DOCKBACK2(m, a, b)        callback2(dock, &DockWindow::m, a, b)
#define DOCKBACK3(m, a, b, c)     callback3(dock, &DockWindow::m, a, b, c)
#define DOCKBACK4(m, a, b, c, d)  callback4(dock, &DockWindow::m, a, b, c, d)

#define GROUPMACRO(a, g, m) (m == 0) ? DOCKBACK3(DockGroup, a, g, -1) : ((m == 1) ? DOCKBACK2(AutoHideGroup, a, g) : DOCKBACK3(TabDockGroup, a, g, -1))

#define DOCK_LEFT 	(int)DockWindow::DOCK_LEFT
#define DOCK_TOP 	(int)DockWindow::DOCK_TOP
#define DOCK_RIGHT 	(int)DockWindow::DOCK_RIGHT
#define DOCK_BOTTOM (int)DockWindow::DOCK_BOTTOM

void DockMenu::LayoutListMenu(Bar &bar)
{
	int cnt = dock->LayoutCount();
	for (int i = 0; i < cnt; i++)
		bar.Add(dock->GetLayoutName(i), THISBACK1(MenuLoadLayout, i));
}

void DockMenu::GroupListMenu(Bar &bar)
{
	const Vector<DockableCtrl *> &dcs = dock->GetDockableCtrls();
	Array<String> groups;
	for (int i = 0; i < dcs.GetCount(); i++) {
		String s = dcs[i]->GetGroup();
		if (!s.IsEmpty()) {
			bool found = false;
			for (int j = 0; j < groups.GetCount(); j++)
				if (groups[j] == s) {
					found = true;
					break;
				}
			if (!found)
				groups.Add(s);
		}
	}
	Sort(groups);
	for (int i = 0; i < groups.GetCount(); i++)
		bar.Add(groups[i], THISBACK1(GroupWindowsMenu, groups[i]));
$uvs: REPOSITORY INSERT
	if (dcs.GetCount())
		bar.Add(t_("All"), THISBACK1(GroupWindowsMenu, String(Null)));
$uvs: END REPOSITORY INSERT
$uvs: REPOSITORY DELETE
	bar.Add("All", THISBACK1(GroupWindowsMenu, String(Null)));
$uvs: END REPOSITORY DELETE
}

void DockMenu::WindowListMenu(Bar &bar, String group)
{
	const Vector<DockableCtrl *> &dcs = dock->GetDockableCtrls();
$uvs: REPOSITORY INSERT
	if (group == t_("All")) group = Null;
$uvs: END REPOSITORY INSERT
$uvs: REPOSITORY DELETE
	if (group == "All") group = Null;
$uvs: END REPOSITORY DELETE

	for (int i = 0; i < dcs.GetCount(); i++) {
		if (IsNull(group) || group == dcs[i]->GetGroup())
			bar.Add(AsString(dcs[i]->GetTitle()), dcs[i]->GetIcon(), THISBACK1(WindowMenu, dcs[i]));
	}
}

void DockMenu::GroupMenu(Bar &bar, String group)
{
$uvs: REPOSITORY INSERT
	if (group.IsEmpty()) group = t_("All");
$uvs: END REPOSITORY INSERT
$uvs: REPOSITORY DELETE
	if (group.IsEmpty()) group = "All";
$uvs: END REPOSITORY DELETE
	String text = group;
	text.Insert(0, ' ');

$uvs: REPOSITORY INSERT
	bar.Add(true, t_("Dock") + text, 	THISBACK1(GroupDockMenu, group));
	bar.Add(true, t_("Float") + text, 	DOCKBACK1(FloatGroup, group));
	if (dock->IsAutoHide()) bar.Add(true, t_("Auto-Hide") + text, THISBACK1(GroupHideMenu, group));
	bar.Separator();
	bar.Add(true, t_("Tabify and Dock") + text, THISBACK1(GroupTabDockMenu, group));
	bar.Add(true, t_("Tabify and Float") + text, DOCKBACK1(TabFloatGroup, group));
	bar.Separator();
	bar.Add(true, t_("Close") + text, CtrlImg::Remove(), DOCKBACK1(CloseGroup, group));
$uvs: END REPOSITORY INSERT
$uvs: REPOSITORY DELETE
	bar.Add(true, "Dock" + text, 	THISBACK1(GroupDockMenu, group));
	bar.Add(true, "Float" + text, 	DOCKBACK1(FloatGroup, group));
	if (dock->IsAutoHide()) bar.Add(true, "Auto-Hide" + text, THISBACK1(GroupHideMenu, group));
	bar.Separator();
	bar.Add(true, "Tabify and Dock" + text, THISBACK1(GroupTabDockMenu, group));
	bar.Add(true, "Tabify and Float" + text, DOCKBACK1(TabFloatGroup, group));
	bar.Separator();
	bar.Add(true, "Close" + text, CtrlImg::Remove(), DOCKBACK1(CloseGroup, group));
$uvs: END REPOSITORY DELETE
}

void DockMenu::GroupWindowsMenu(Bar &bar, String group)
{
	GroupMenu(bar, group);
	bar.Separator();
	WindowListMenu(bar, group);
}

void DockMenu::WindowMenu(Bar &bar, DockableCtrl *dc)
{
$uvs: REPOSITORY INSERT
	WindowMenuNoClose(bar, dc);
	bar.Separator();
	bar.Add(true, t_("Close"), CtrlImg::Remove(), THISBACK1(MenuClose, dc));
}

void DockMenu::WindowMenuNoClose(Bar &bar, DockableCtrl *dc)
{
	bar.Add(true, t_("Dock"), 		THISBACK1(WindowDockMenu, dc)).Check(dc->IsDocked() || dc->IsTabbed());
	bar.Add(true, t_("Float"), 		THISBACK1(MenuFloat, dc)).Check(dc->IsFloating());
	if (dock->IsAutoHide())
		bar.Add(true, t_("Auto-Hide"), 	THISBACK1(WindowHideMenu, dc)).Check(dc->IsAutoHide());
$uvs: END REPOSITORY INSERT
$uvs: REPOSITORY DELETE
	bar.Add(true, "Dock", 		THISBACK1(WindowDockMenu, dc));
	bar.Add(true, "Float", 		THISBACK1(MenuFloat, dc));
	if (dock->IsAutoHide()) bar.Add(true, "Auto-Hide", 	THISBACK1(WindowHideMenu, dc));
	bar.Separator();
	bar.Add(true, "Close", CtrlImg::Remove(), THISBACK1(MenuClose, dc));
$uvs: END REPOSITORY DELETE
}

void DockMenu::GroupAlignMenu(Bar &bar, String group, int mode)
{
$uvs: REPOSITORY INSERT
	for (int i = 0; i < 4; i++)
		bar.Add(AlignText(i), 	GROUPMACRO(i, group, mode));
$uvs: END REPOSITORY INSERT
$uvs: REPOSITORY DELETE
	bar.Add("Left", 	GROUPMACRO(DOCK_LEFT, group, mode));
	bar.Add("Top", 		GROUPMACRO(DOCK_TOP, group, mode));
	bar.Add("Right", 	GROUPMACRO(DOCK_RIGHT, group, mode));
	bar.Add("Bottom", 	GROUPMACRO(DOCK_BOTTOM, group, mode));
$uvs: END REPOSITORY DELETE
}

void DockMenu::WindowAlignMenu(Bar &bar, DockableCtrl *dc, bool dodock)
{
$uvs: REPOSITORY INSERT
	for (int i = 0; i < 4; i++)
 		bar.Add(!dodock || dock->IsDockAllowed(i, *dc), AlignText(i),
 			dodock ? THISBACK2(MenuDock, i, dc) : THISBACK2(MenuAutoHide, i, dc));
$uvs: END REPOSITORY INSERT
$uvs: REPOSITORY DELETE
 	bar.Add(dock->IsDockAllowed(DOCK_LEFT, *dc), 	"Left", 	dodock ? THISBACK2(MenuDock, DOCK_LEFT, dc) 	: THISBACK2(MenuAutoHide, DOCK_LEFT, dc));
	bar.Add(dock->IsDockAllowed(DOCK_TOP, *dc), 	"Top", 		dodock ? THISBACK2(MenuDock, DOCK_TOP, dc) 		: THISBACK2(MenuAutoHide, DOCK_TOP, dc));
	bar.Add(dock->IsDockAllowed(DOCK_RIGHT, *dc), 	"Right",	dodock ? THISBACK2(MenuDock, DOCK_RIGHT, dc) 	: THISBACK2(MenuAutoHide, DOCK_RIGHT, dc));
	bar.Add(dock->IsDockAllowed(DOCK_BOTTOM, *dc), 	"Bottom", 	dodock ? THISBACK2(MenuDock, DOCK_BOTTOM, dc) 	: THISBACK2(MenuAutoHide, DOCK_BOTTOM, dc));
$uvs: END REPOSITORY DELETE
}

void DockMenu::MenuDock(int align, DockableCtrl *dc)
{
	dock->Dock(align, *dc);
}

void DockMenu::MenuFloat(DockableCtrl *dc)
{
	dock->Float(*dc);
}

void DockMenu::MenuAutoHide(int align, DockableCtrl *dc)
{
	dock->AutoHide(align, *dc);
}

void DockMenu::MenuClose(DockableCtrl *dc)
{
	dock->Close(*dc);
}

void DockMenu::MenuLoadLayout(int ix)
{
	dock->LoadLayout(ix);
}

$uvs: REPOSITORY INSERT
const char * DockMenu::AlignText(int align)
{
	switch (align) {
	case DOCK_LEFT:
		return t_("Left");
	case DOCK_TOP:
		return t_("Top");
	case DOCK_RIGHT:
		return t_("Right");
	case DOCK_BOTTOM:
		return t_("Bottom");
	}
	return 0;
}

$uvs: END REPOSITORY INSERT


text:
<?php

declare(strict_types=1);

namespace DBD\Utils\OData;

use stdClass;

class EntityType
{
    public $name;
    /** @var Key[] */
    public $Keys = [];
    /** @var Property */
    public $Properties = [];
    /** @var Annotation */
    public $Annotation;
    /** @var NavigationProperty[] */
    public $NavigationProperties;

    public function __construct(stdClass $entityType)
    {
        $this->name = $entityType->{'@attributes'}->Name;

        if (isset($entityType->{'Key'}))
            if (is_array($entityType->Key->PropertyRef))
                foreach ($entityType->Key->PropertyRef as $propertyRef)
                    $this->Keys[] = new Key($propertyRef->{'@attributes'}->Name);
            else
                $this->Keys[] = new Key($entityType->Key->PropertyRef->{'@attributes'}->Name);

        if (isset($entityType->{'Property'}))
            if (is_array($entityType->Property))
                foreach ($entityType->Property as $property)
                    $this->Properties[] = new Property($property);
            else
                $this->Properties[] = new Property($entityType->Property);

        if (isset($entityType->{'NavigationProperty'}))
            if (is_array($entityType->NavigationProperty))
                foreach ($entityType->NavigationProperty as $property)
                    $this->NavigationProperties[] = new NavigationProperty($property);
            else
                $this->NavigationProperties[] = new NavigationProperty($entityType->NavigationProperty);
    }
}


text:
//----------------------------------------------------------------------------
/** @file SgRandom.h
    Random numbers. */
//----------------------------------------------------------------------------

#ifndef SG_RANDOM_H
#define SG_RANDOM_H

#include <algorithm>
#include <list>
#include <boost/random/mersenne_twister.hpp>
#include "SgArray.h"

//----------------------------------------------------------------------------

/** Random number generator.
    Uses a Mersenne Twister, because this is faster than std::rand() and
    game playing programs usually need faster random numbers more than
    high quality ones. All random generators are internally registered to
    make it possible to change the random seed for all of them.

    SgRandom is thread-safe (w.r.t. different instances) after construction
    (the constructor is not thread-safe, because it uses a global variable
    for registration). */
class SgRandom
{
public:
    SgRandom();

    ~SgRandom();

    /** Return the global random number generator.
        The global generator is stored as a static variable in this function
        to ensure that it is initialized at first call if SgRandom is used
        in global variables of other compilation units.
        @note The global random number generator is not thread-safe. */
    static SgRandom& Global();

    /** Set random seed for all existing and future instances of SgRandom.
        @param seed The seed. If negative, no seed will be set. If zero, a
        non-deterministic random seed will be used (e.g. derived from the
        current time).
        Also calls std::srand()
        @note This function is not thread-safe. */
    static void SetSeed(int seed);

    /** Get random seed.
        See SetSeed(int) for the special meaning of zero and negative values. */
    static int Seed();

    /** Get a random integer.
        Uses a fast random generator (the Mersenne Twister boost::mt19937),
        because in games and Monte Carlo simulations, speed is more important
        than quality. */
    unsigned int Int();

    /** Get a random integer in an interval.
        @param range The upper limit of the interval (exclusive)
        @pre range > 0
        @pre range <= SgRandom::Max()
        @return An integer in <tt> [0..range - 1]</tt> */
    int Int(int range);

    /** See SgRandom::Int(int) */
    std::size_t Int(std::size_t range);

    /** Get a small random integer in an interval.
        Uses only the lower 16 bits. Faster than SgRandom::Int(int) because it
        avoids the expensive modulo operation.
        @param range The upper limit of the interval (exclusive)
        @pre range > 0
        @pre range <= (1 << 16)
        @return An integer in <tt> [0..range - 1]</tt> */
    int SmallInt(int range);

    /** See SgRandom::SmallInt(int) */
    std::size_t SmallInt(std::size_t range);

    /** Get a random integer in [min, max - 1] */
    int Range(int min, int max);

    /** Maximum value. */
    unsigned int Max();

    /** convert percentage between 0 and 99 to a threshold for RandomEvent.
        Use as in following example:
        const unsigned int percent80 = PercentageThreshold(80); */
    unsigned int PercentageThreshold(int percentage);

    /** return true if random number SgRandom() <= threshold */
    bool RandomEvent(unsigned int threshold);

private:
    struct GlobalData
    {
        /** The random seed.
            Zero means not to set a random seed. */
        boost::mt19937::result_type m_seed;

        std::list<SgRandom*> m_allGenerators;

        GlobalData();
    };

    /** Return global data.
        Global data is stored as a static variable in this function to ensure
        that it is initialized at first call if SgRandom is used in global
        variables of other compilation units. */
    static GlobalData& GetGlobalData();

    boost::mt19937 m_generator;

    void SetSeed();
};

inline unsigned int SgRandom::Int()
{
    return m_generator();
}

inline int SgRandom::Int(int range)
{
    SG_ASSERT(range > 0);
    SG_ASSERT(static_cast<unsigned int>(range) <= SgRandom::Max());
    int i = Int() % range;
    SG_ASSERTRANGE(i, 0, range - 1);
    return i;
}

inline std::size_t SgRandom::Int(std::size_t range)
{
    SG_ASSERT(range <= SgRandom::Max());
    std::size_t i = Int() % range;
    SG_ASSERT(i < range);
    return i;
}

inline unsigned int SgRandom::Max()
{
    return m_generator.max();
}

inline unsigned int SgRandom::PercentageThreshold(int percentage)
{
    return (m_generator.max() / 100) * percentage;
}

inline bool SgRandom::RandomEvent(unsigned int threshold)
{
    return Int() <= threshold;
}

inline int SgRandom::Range(int min, int max)
{
    return min + Int(max - min);
}

inline int SgRandom::SmallInt(int range)
{
    SG_ASSERT(range > 0);
    SG_ASSERT(range <= (1 << 16));
    int i = ((Int() & 0xffff) * range) >> 16;
    SG_ASSERTRANGE(i, 0, range - 1);
    return i;
}

inline std::size_t SgRandom::SmallInt(std::size_t range)
{
    SG_ASSERT(range <= (1 << 16));
    std::size_t i = ((Int() & 0xffff) * range) >> 16;
    SG_ASSERT(i < range);
    return i;
}

//----------------------------------------------------------------------------

/** Get a random float in [min, max].
    Used std::rand() */
float SgRandomFloat(float min, float max);

//----------------------------------------------------------------------------

#endif // SG_RANDOM_H


text:
/* Tomorrow Night Bright Theme */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */

/* Tomorrow Comment */
.hljs-comment {
  color: #969896;
}

/* Tomorrow Red */
.hljs-variable,
.hljs-attribute,
.hljs-tag,
.hljs-regexp,
.ruby .hljs-constant,
.xml .hljs-tag .hljs-title,
.xml .hljs-pi,
.xml .hljs-doctype,
.html .hljs-doctype,
.css .hljs-id,
.css .hljs-class,
.css .hljs-pseudo {
  color: #d54e53;
}

/* Tomorrow Orange */
.hljs-number,
.hljs-preprocessor,
.hljs-pragma,
.hljs-built_in,
.hljs-literal,
.hljs-params,
.hljs-constant {
  color: #e78c45;
}

/* Tomorrow Yellow */
.ruby .hljs-class .hljs-title,
.css .hljs-rules .hljs-attribute {
  color: #e7c547;
}

/* Tomorrow Green */
.hljs-string,
.hljs-value,
.hljs-inheritance,
.hljs-header,
.ruby .hljs-symbol,
.xml .hljs-cdata {
  color: #b9ca4a;
}

/* Tomorrow Aqua */
.hljs-title,
.css .hljs-hexcolor {
  color: #70c0b1;
}

/* Tomorrow Blue */
.hljs-function,
.python .hljs-decorator,
.python .hljs-title,
.ruby .hljs-function .hljs-title,
.ruby .hljs-title .hljs-keyword,
.perl .hljs-sub,
.javascript .hljs-title,
.coffeescript .hljs-title {
  color: #7aa6da;
}

/* Tomorrow Purple */
.hljs-keyword,
.javascript .hljs-function {
  color: #c397d8;
}

.hljs {
  display: block;
  overflow-x: auto;
  background: black;
  color: #eaeaea;
  padding: 0.5em;
  -webkit-text-size-adjust: none;
}

.coffeescript .javascript,
.javascript .xml,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata {
  opacity: 0.5;
}


text:
@interface PodsDummy_Pods_ARGooglePlacesWebSearch_Tests : NSObject
@end
@implementation PodsDummy_Pods_ARGooglePlacesWebSearch_Tests
@end


text:
//
//  M2Tile.m
//  m2048
//
//  Created by Danqing on 3/16/14.
//  Copyright (c) 2014 Danqing. All rights reserved.
//

#include <stdlib.h>

#import "M2DisplayTile.h"
#import "M2Cell.h"

@implementation M2DisplayTile {
  /** The value of the tile, as some text. */
  SKLabelNode *_value;

  /** Pending actions for the tile to execute. */
  NSMutableArray *_pendingActions;
}

@synthesize level = _level;
@synthesize cell = _cell;

# pragma mark - Tile creation

+ (instancetype)insertNewTileToCell:(M2Cell *)cell
{
  M2DisplayTile *tile = [[M2DisplayTile alloc] init];

  // The initial position of the tile is at the center of its cell. This is so because when
  // scaling the tile, SpriteKit does so from the origin, not the center. So we have to scale
  // the tile while moving it back to its normal position to achieve the "pop out" effect.
  CGPoint origin = [GSTATE locationOfPosition:cell.position];
  tile.position = CGPointMake(origin.x + GSTATE.tileSize / 2, origin.y + GSTATE.tileSize / 2);
  [tile setScale:0];

  cell.tile = tile;
  return tile;
}

- (instancetype)init
{
  if (self = [super init]) {
    // Layout of the tile.
    CGRect rect = CGRectMake(0, 0, GSTATE.tileSize, GSTATE.tileSize);
    CGPathRef rectPath = CGPathCreateWithRoundedRect(rect, GSTATE.cornerRadius, GSTATE.cornerRadius, NULL);
    self.path = rectPath;
    CFRelease(rectPath);
    self.lineWidth = 0;

    // Initiate pending actions queue.
    _pendingActions = [[NSMutableArray alloc] init];

    // Set up value label.
    _value = [SKLabelNode labelNodeWithFontNamed:[GSTATE boldFontName]];
    _value.position = CGPointMake(GSTATE.tileSize / 2, GSTATE.tileSize / 2);
    _value.horizontalAlignmentMode = SKLabelHorizontalAlignmentModeCenter;
    _value.verticalAlignmentMode = SKLabelVerticalAlignmentModeCenter;
    [self addChild:_value];

    // For Fibonacci game, which is way harder than 2048 IMO, 40 seems to be the easiest number.
    // 90 definitely won't work, as we need approximately equal number of 2 and 3 to make the
    // game remotely makes sense.
    if (GSTATE.gameType == M2GameTypeFibonacci) self.level = arc4random_uniform(100) < 40 ? 1 : 2;
    else self.level = arc4random_uniform(100) < 95 ? 1 : 2;

    [self refreshValue];
  }
  return self;
}

# pragma mark - Public methods

- (void)removeFromParentCell
{
  // Check if the tile is still registered with its parent cell, and if so, remove it.
  // We don't really care about self.cell, because that is a weak pointer.
  if (self.cell.tile == self) self.cell.tile = nil;
}

- (BOOL)hasPendingMerge
{
  // A move is only one action, so if there are more than one actions, there must be
  // a merge that needs to be committed. If things become more complicated, change
  // this to an explicit ivar or property.
  return _pendingActions.count > 1;
}

- (void)commitPendingActions
{
  [self runAction:[SKAction sequence:_pendingActions]];
  [_pendingActions removeAllObjects];
}

- (BOOL)canMergeWithTile:(id <M2Tile>)tile
{
  if (!tile || ![tile isKindOfClass:[M2DisplayTile class]]) return NO;
  return [GSTATE isLevel:self.level mergeableWithLevel:tile.level];
}

- (NSInteger)mergeToTile:(id <M2Tile>)tile
{
    if (![tile isKindOfClass:[M2DisplayTile class]]) return 0;
    M2DisplayTile *displayTile = (M2DisplayTile *)tile;

  // Cannot merge with thin air. Also cannot merge with tile that has a pending merge.
  // For the latter, imagine we have 4, 2, 2. If we move to the right, it will first
  // become 4, 4. Now we cannot merge the two 4's.
  if (!displayTile || [displayTile hasPendingMerge]) return 0;

  NSInteger newLevel = [GSTATE mergeLevel:self.level withLevel:tile.level];
  if (newLevel > 0) {
    // 1. Move self to the destination cell.
    [self moveToCell:tile.cell];

    // 2. Remove the tile in the destination cell.
    [displayTile removeWithDelay];

    // 3. Update value and pop.
    [self updateLevelTo:newLevel];
    [_pendingActions addObject:[self pop]];
  }
  return newLevel;
}

- (NSInteger)merge3ToTile:(id <M2Tile>)tile andTile:(id <M2Tile>)furtherTile
{
    if (![tile isKindOfClass:[M2DisplayTile class]] || ![furtherTile isKindOfClass:[M2DisplayTile class]]) return 0;
    M2DisplayTile *displayTile = (M2DisplayTile *)tile;
    M2DisplayTile *furtherDisplayTile = (M2DisplayTile *)furtherTile;
  if (!displayTile || [displayTile hasPendingMerge] || [furtherDisplayTile hasPendingMerge]) return 0;

  NSUInteger newLevel = MIN([GSTATE mergeLevel:self.level withLevel:displayTile.level],
                            [GSTATE mergeLevel:displayTile.level withLevel:furtherTile.level]);
  if (newLevel > 0) {
    // 1. Move self to the destination cell AND move the intermediate tile to there too.
    [tile moveToCell:furtherTile.cell];
    [self moveToCell:furtherTile.cell];

    // 2. Remove the tile in the destination cell.
    [displayTile removeWithDelay];
    [furtherDisplayTile removeWithDelay];

    // 3. Update value and pop.
    [self updateLevelTo:newLevel];
    [_pendingActions addObject:[self pop]];
  }
  return newLevel;
}

- (void)updateLevelTo:(NSInteger)level
{
  self.level = level;
  [_pendingActions addObject:[SKAction runBlock:^{
    [self refreshValue];
  }]];
}

- (void)refreshValue
{
  long value = [GSTATE valueForLevel:self.level];
  _value.text = [NSString stringWithFormat:@"%ld", value];
  _value.fontColor = [GSTATE textColorForLevel:self.level];
  _value.fontSize = [GSTATE textSizeForValue:value];

  self.fillColor = [GSTATE colorForLevel:self.level];
}

- (void)moveToCell:(M2Cell *)cell
{
  [_pendingActions addObject:[SKAction moveBy:[GSTATE distanceFromPosition:self.cell.position
                                                                toPosition:cell.position]
                                     duration:GSTATE.animationDuration]];
  self.cell.tile = nil;
  cell.tile = self;
}

- (void)removeAnimated:(BOOL)animated
{
  [self removeFromParentCell];
  // @TODO: fade from center.
  if (animated) [_pendingActions addObject:[SKAction scaleTo:0 duration:GSTATE.animationDuration]];
  [_pendingActions addObject:[SKAction removeFromParent]];
  [self commitPendingActions];
}

- (void)removeWithDelay
{
  [self removeFromParentCell];
  SKAction *wait = [SKAction waitForDuration:GSTATE.animationDuration];
  SKAction *remove = [SKAction removeFromParent];
  [self runAction:[SKAction sequence:@[wait, remove]]];
}

# pragma mark - SKAction helpers

- (SKAction *)pop
{
  CGFloat d = 0.15 * GSTATE.tileSize;
  SKAction *wait = [SKAction waitForDuration:GSTATE.animationDuration / 3];
  SKAction *enlarge = [SKAction scaleTo:1.3 duration:GSTATE.animationDuration / 1.5];
  SKAction *move = [SKAction moveBy:CGVectorMake(-d, -d) duration:GSTATE.animationDuration / 1.5];
  SKAction *restore = [SKAction scaleTo:1 duration:GSTATE.animationDuration / 1.5];
  SKAction *moveBack = [SKAction moveBy:CGVectorMake(d, d) duration:GSTATE.animationDuration / 1.5];

  return [SKAction sequence:@[wait, [SKAction group:@[enlarge, move]],
                                    [SKAction group:@[restore, moveBack]]]];
}

@end


text:
class SnippetsController < ApplicationController
  before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw]

  # Allow modify snippet
  before_filter :authorize_modify_snippet!, only: [:edit, :update]

  # Allow destroy snippet
  before_filter :authorize_admin_snippet!, only: [:destroy]

  before_filter :set_title

  respond_to :html

  layout 'navless'

  def index
    @snippets = Snippet.public.fresh.non_expired.page(params[:page]).per(20)
  end

  def user_index
    @user = User.find_by(username: params[:username])

    render_404 and return unless @user

    @snippets = @user.snippets.fresh.non_expired

    if @user == current_user
      @snippets = case params[:scope]
                  when 'public' then
                    @snippets.public
                  when 'private' then
                    @snippets.private
                  else
                    @snippets
                  end
    else
      @snippets = @snippets.public
    end

    @snippets = @snippets.page(params[:page]).per(20)

    if @user == current_user
      render 'current_user_index'
    else
      render 'user_index'
    end
  end

  def new
    @snippet = PersonalSnippet.new
  end

  def create
    @snippet = PersonalSnippet.new(params[:personal_snippet])
    @snippet.user = current_user

    if @snippet.save
      redirect_to snippet_path(@snippet)
    else
      respond_with @snippet
    end
  end

  def edit
  end

  def update
    if @snippet.update_attributes(params[:personal_snippet])
      redirect_to snippet_path(@snippet)
    else
      respond_with @snippet
    end
  end

  def show
  end

  def destroy
    return access_denied! unless can?(current_user, :admin_personal_snippet, @snippet)

    @snippet.destroy

    redirect_to snippets_path
  end

  def raw
    send_data(
      @snippet.content,
      type: "text/plain;charset=utf-8",
      disposition: 'inline',
      filename: @snippet.file_name
    )
  end

  protected

  def snippet
    @snippet ||= PersonalSnippet.where('user_id = :user_id or private is false', user_id: current_user.id).find(params[:id])
  end

  def authorize_modify_snippet!
    return render_404 unless can?(current_user, :modify_personal_snippet, @snippet)
  end

  def authorize_admin_snippet!
    return render_404 unless can?(current_user, :admin_personal_snippet, @snippet)
  end

  def set_title
    @title = 'Snippets'
  end
end


text:
#ifndef SRC_MAIN_CC_WFA_PANELMATCH_COMMON_CRYPTO_EC_COMMUTATIVE_CIPHER_KEY_GENERATOR_H_
#define SRC_MAIN_CC_WFA_PANELMATCH_COMMON_CRYPTO_EC_COMMUTATIVE_CIPHER_KEY_GENERATOR_H_

#include "absl/status/statusor.h"
#include "tink/util/secret_data.h"

namespace wfa::panelmatch::common::crypto {

// Random key generator for generating secure keys to be used for creating
// ECCommutativeCiphers
class EcCommutativeCipherKeyGenerator {
 public:
  EcCommutativeCipherKeyGenerator() = default;
  ~EcCommutativeCipherKeyGenerator() = default;

  // Generates a random key for creating an ECCommutativeCipher
  absl::StatusOr<::crypto::tink::util::SecretData> GenerateKey() const;
};

}  // namespace wfa::panelmatch::common::crypto

#endif  // SRC_MAIN_CC_WFA_PANELMATCH_COMMON_CRYPTO_EC_COMMUTATIVE_CIPHER_KEY_GENERATOR_H_


text:
import {readFileSync} from 'fs';
import {transform} from 'babel';
import log from './logger.js';
import {requireParser, mixinParser, propsParser, nameParser} from './parser.js';
import {inspect} from 'util';

export default function reactAnalyzer (file) {
  if (!file) {
    log('error', 'Please specify filepath or source code');
    return file;
  }

  if (typeof file === 'string' && /\.jsx?$/.test(file)) {
    file = readFileSync(file).toString();
    if (!file) {
      return file;
    }
  }

  log('Transforming with Babel');
  var ast = transform(file, {stage: 0}).ast.program;

  return {
    name: nameParser(ast),
    deps: requireParser(ast),
    props: propsParser(ast, file),
    mixins: mixinParser(ast, file)
  };
};


text:
Module ``sphinxcontrib.exceltable`` is an extension for Sphinx_, that adds support for including Excel spreadsheets, or part
of them, into Sphinx document. See documentation for further information. It has been tested to run on both Python 2.7 and 3.4

Usage::

  My document
  ===========
  The contents of the setup script:

  .. exceltable:: Table caption
     :file: path/to/document.xls
     :header: 1
     :selection: A1:B3

Read complete documentation: http://pythonhosted.org/sphinxcontrib-exceltable/
Report issues: http://bitbucket.org/birkenfeld/sphinx-contrib/

.. _Sphinx: http://sphinx.pocoo.org/


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

using Marketplace.Data;
using Marketplace.Domain.Models.Trading;
using Marketplace.Domain.Security;
using Marketplace.Logic.Contracts.Trading;
using Marketplace.Logic.Queries.Trading;

using Prolix.Collections;

namespace Marketplace.Logic.Services.Trading
{
    public sealed class CustomerService : RepositoryService<Customer>, ICustomerService
    {
        public CustomerService(IDataContext context, SecurityContext security) : base(context, security)
        {
        }

        async public override Task Add(Customer model)
        {
            // Simple validations
            Validate(model);

            // Custom validations
            if (Exists(i => i.Name == model.Name))
                Rule.Add("Name", "Name already taken");

            // Throws an exception if there are validation errors
            CheckRule();

            // New records are set to active
            model.Active = true;

            // Persist on database
            await base.Add(model);
        }

        async public override Task<bool> Update(Customer model)
        {
            // Simple validations
            Validate(model);

            // Custom validations
            if (Exists(i => i.Id != model.Id && i.Name == model.Name))
                Rule.Add("Name", "Name already taken");

            if (Exists(i => i.Id != model.Id && i.UserId == model.UserId))
                Rule.Add("UserId", "Invalid user");

            // Throws an exception if there are validation errors
            CheckRule();

            // Retrieves data
            var current = Get(model.Id);

            if (current == null)
                return false;

            // Update fields
            current.Name = model.Name;
            current.UserId = model.UserId;
            current.Active = model.Active;

            // Persist on database
            return await base.Update(current);
        }

        async public override Task<bool> Delete(Customer model)
        {
            if (model == null)
                return false;

            if (model.Orders.Any())
                Rule.Throw("This customer can't be deleted because it has associated orders.");

            return await base.Delete(model);
        }

        /// <summary>
        /// Search by criteria
        /// </summary>
        /// <param name="request">Filter, pagination, sorting parameters</param>
        /// <returns>Paged result (sorted)</returns>
        public PagedList<Customer> List(CustomerQuery request)
        {
            var query = base.List();

            // Build que query
            if (!string.IsNullOrWhiteSpace(request.Name))
                query = query.Where(i => i.Name.Contains(request.Name));

            if (!string.IsNullOrWhiteSpace(request.Email))
                query = query.Where(i => i.User.Email == request.Email);

            // Apply paging and sorting
            var result = query.ToPaged(request);

            return result;
        }
    }
}