text:
require 'puppet/provider/f5'

Puppet::Type.type(:f5_vlan).provide(:f5_vlan, :parent => Puppet::Provider::F5) do
  @doc = 'Manage F5 VLANs.'

  confine :feature => :posix
  defaultfor :feature => :posix

  def self.wsdl
    'Networking.VLAN'
  end

  def wsdl
    self.class.wsdl
  end

  def self.instances
    instances = []
    get_list.each do |vlan|
      instances << new(name: vlan, ensure: :present)
    end
    instances
  end

  def self.prefetch(resources)
    vlans = instances
    resources.keys.each do |name|
      if provider = vlans.find { |vlan| vlan.name == name }
        resources[name].provider = provider

      end
    end
  end

  def destroy
    message = { vlans: { item: resource[:name] }}
    transport[wsdl].call(:delete_vlan, message: message)

    @property_hash[:ensure] = :absent
  end

  def create
    members = Array.new(1) { Array.new(resource[:members].length) }
    members[0] = resource[:members]
    message = {
      vlans:           { item: resource[:name] },
      vlan_ids:        { item: resource[:vlan_id] },
      members:         { item: members },
      failsafe_states: { item: resource[:failsafe_state] },
      timeouts:        { item: resource[:timeout] },
    }
    transport[wsdl].call(:create_v2, message: message)
  end

  def exists?
    @property_hash[:ensure] == :present
  end

  def failsafe_state
    message = { vlans: { item: self.name } }
    transport[wsdl].get(:get_failsafe_state, message)
  end

  def failsafe_state=(value)
    message = {
      vlans:  { item: self.name },
      states: { item: resource[:failsafe_state] },
    }
    transport[wsdl].call(:set_failsafe_state, message: message)
  end

  def members
    message = { vlans: { item: self.name }}
    response = transport[wsdl].get(:get_member, message)
    return response.is_a?(Array) ? response : Array.new(1) { response }
  end

  # Unfortunately you can't change the members.
  def members=(value)
    Puppet.debug('Cannot change this value, destroying and recreating.')
    destroy
    create
  end

  def timeout
    message = { vlans: { item: self.name } }
    transport[wsdl].get(:get_failsafe_timeout, message)
  end

  def timeout=(value)
    message = {
      vlans:    { item: self.name },
      timeouts: { item: resource[:timeouts] },
    }
    transport[wsdl].call(:set_failsafe_timeout, message: message)
  end

  def vlan_id
    message = { vlans: { item: self.name }}
    transport[wsdl].get(:get_vlan_id, message)
  end

  def vlan_id=(value)
    message = {
      vlans:    { item: self.name },
      vlan_ids: { item: resource[:vlan_id] },
    }
    transport[wsdl].call(:set_vlan_id, message: message)
  end

  # Obtain a list of static routes.
  def self.get_list
    response = transport[wsdl].get(:get_list)
    return Array(response)
  end
end


text:
package Lucene;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

import org.apache.lucene.document.Document;
import org.apache.lucene.queryparser.classic.ParseException;

public class Test {

	public static void main(String[] args) throws IOException, ParseException {
		LuceneSearchIndex obj = new LuceneSearchIndex();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		float matching_factor = 0.7f;
		System.out.println("Search for dish");
		while ((line = br.readLine()) != null) {
			line = line + "~" + matching_factor;
			ArrayList<String> list = find(line, obj, 5);
			System.out.println(list);
		}
	}

	public static ArrayList<String> find(String q, LuceneSearchIndex obj, int k)
			throws IOException, ParseException {
		ArrayList<Document> list = obj.search(q, k);
		ArrayList<String> matches = new ArrayList<String>();
		int i = 0;
		for (Document d : list) {
			matches.add(d.get("title"));
		}
		return matches;
	}
}

redpajama_set_name: RedPajamaGithub


text:
<Record>
<Term>Primary Progressive Aphasia</Term>
<SemanticType>Mental or Behavioral Dysfunction</SemanticType>
<ParentTerm>Aphasia</ParentTerm>
<ParentTerm>Dementia</ParentTerm>
<ClassificationPath>Nervous System Diseases/Neurologic Manifestations/Neurobehavioral Manifestations/Communication Disorders/Language Disorders/Speech Disorders/Aphasia/Aphasia, Primary Progressive</ClassificationPath>
<ClassificationPath>Mental Disorders/Delirium, Dementia, Amnestic, Cognitive Disorders/Dementia/Aphasia, Primary Progressive</ClassificationPath>
<ClassificationPath>Pathological Conditions, Signs and Symptoms/Signs and Symptoms/Neurologic Manifestations/Neurobehavioral Manifestations/Communication Disorders/Language Disorders/Speech Disorders/Aphasia/Aphasia, Primary Progressive</ClassificationPath>
<ClassificationPath>Nervous System Diseases/Central Nervous System Diseases/Brain Diseases/Dementia/Aphasia, Primary Progressive</ClassificationPath>
<BroaderTerm>Aphasia, Primary Progressive</BroaderTerm>
<BroaderTerm>Pathological Conditions, Signs and Symptoms</BroaderTerm>
<BroaderTerm>Delirium, Dementia, Amnestic, Cognitive Disorders</BroaderTerm>
<BroaderTerm>Speech Disorders</BroaderTerm>
<BroaderTerm>Dementia</BroaderTerm>
<BroaderTerm>Nervous System Diseases</BroaderTerm>
<BroaderTerm>Mental Disorders</BroaderTerm>
<BroaderTerm>Neurobehavioral Manifestations</BroaderTerm>
<BroaderTerm>Central Nervous System Diseases</BroaderTerm>
<BroaderTerm>Neurologic Manifestations</BroaderTerm>
<BroaderTerm>Aphasia</BroaderTerm>
<BroaderTerm>Signs and Symptoms</BroaderTerm>
<BroaderTerm>Language Disorders</BroaderTerm>
<BroaderTerm>Brain Diseases</BroaderTerm>
<BroaderTerm>Communication Disorders</BroaderTerm>
<ChildTerm>Primary Progressive Nonfluent Aphasia</ChildTerm>
<Synonym>Primary Progressive Aphasia</Synonym>
<Synonym>Mesulam Syndrome</Synonym>
<Synonym>Mesulam's Syndrome</Synonym>
<Synonym>Primary Progressive Aphasias</Synonym>
<Description>A progressive form of dementia characterized by the global loss of language abilities and initial preservation of other cognitive functions. Fluent and nonfluent subtypes have been described. Eventually a pattern of global cognitive dysfunction, similar to ALZHEIMER DISEASE, emerges. Pathologically, there are no Alzheimer or PICK DISEASE like changes, however, spongiform changes of cortical layers II and III are present in the TEMPORAL LOBE and FRONTAL LOBE. (From Brain 1998 Jan;121(Pt 1):115-26)</Description>
<Source>MeSH</Source>
</Record>


text:
/**
 */
package CIM.IEC61970.Informative.InfAssets;

import CIM.IEC61968.Assets.Asset;

import CIM.IEC61970.Informative.InfCommon.Role;

import CIM.IEC61970.Informative.InfERPSupport.ErpOrganisation;

/**
 *
 * A representation of the model object 'Org Asset Role'.
 *
 *
 *

 * The following features are supported:
 *

 *

 *
{@link CIM.IEC61970.Informative.InfAssets.OrgAssetRole#getErpOrganisation Erp Organisation}

 *
{@link CIM.IEC61970.Informative.InfAssets.OrgAssetRole#getAsset Asset}

 *
{@link CIM.IEC61970.Informative.InfAssets.OrgAssetRole#getPercentOwnership Percent Ownership}

 *

 *
 * @see CIM.IEC61970.Informative.InfAssets.InfAssetsPackage#getOrgAssetRole()
 * @model annotation="http://iec.ch/TC57/2009/CIM-schema-cim14 Documentation='The roles played between an Organisations and an Asset.'"
 *        annotation="http://langdale.com.au/2005/UML Profile\040documentation='The roles played between an Organisations and an Asset.'"
 *        annotation="http://www.eclipse.org/emf/2002/GenModel Documentation='The roles played between an Organisations and an Asset.' Profile\040documentation='The roles played between an Organisations and an Asset.'"
 * @generated
 */
public interface OrgAssetRole extends Role {
	/**
	 * Returns the value of the 'Erp Organisation' reference.
	 * It is bidirectional and its opposite is '{@link CIM.IEC61970.Informative.InfERPSupport.ErpOrganisation#getAssetRoles Asset Roles}'.
	 *
	 *

	 * If the meaning of the 'Erp Organisation' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Erp Organisation' reference.
	 * @see #setErpOrganisation(ErpOrganisation)
	 * @see CIM.IEC61970.Informative.InfAssets.InfAssetsPackage#getOrgAssetRole_ErpOrganisation()
	 * @see CIM.IEC61970.Informative.InfERPSupport.ErpOrganisation#getAssetRoles
	 * @model opposite="AssetRoles"
	 * @generated
	 */
	ErpOrganisation getErpOrganisation();

	/**
	 * Sets the value of the '{@link CIM.IEC61970.Informative.InfAssets.OrgAssetRole#getErpOrganisation Erp Organisation}' reference.
	 *
	 *
	 * @param value the new value of the 'Erp Organisation' reference.
	 * @see #getErpOrganisation()
	 * @generated
	 */
	void setErpOrganisation(ErpOrganisation value);

	/**
	 * Returns the value of the 'Asset' reference.
	 * It is bidirectional and its opposite is '{@link CIM.IEC61968.Assets.Asset#getErpOrganisationRoles Erp Organisation Roles}'.
	 *
	 *

	 * If the meaning of the 'Asset' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Asset' reference.
	 * @see #setAsset(Asset)
	 * @see CIM.IEC61970.Informative.InfAssets.InfAssetsPackage#getOrgAssetRole_Asset()
	 * @see CIM.IEC61968.Assets.Asset#getErpOrganisationRoles
	 * @model opposite="ErpOrganisationRoles"
	 * @generated
	 */
	Asset getAsset();

	/**
	 * Sets the value of the '{@link CIM.IEC61970.Informative.InfAssets.OrgAssetRole#getAsset Asset}' reference.
	 *
	 *
	 * @param value the new value of the 'Asset' reference.
	 * @see #getAsset()
	 * @generated
	 */
	void setAsset(Asset value);

	/**
	 * Returns the value of the 'Percent Ownership' attribute.
	 *
	 *

	 * If the meaning of the 'Percent Ownership' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Percent Ownership' attribute.
	 * @see #setPercentOwnership(float)
	 * @see CIM.IEC61970.Informative.InfAssets.InfAssetsPackage#getOrgAssetRole_PercentOwnership()
	 * @model required="true"
	 *        annotation="http://iec.ch/TC57/2009/CIM-schema-cim14 Documentation='If the role type is \"owner,\" this indicate the percentage of ownership.'"
	 *        annotation="http://www.eclipse.org/emf/2002/GenModel Documentation='If the role type is \"owner,\" this indicate the percentage of ownership.'"
	 * @generated
	 */
	float getPercentOwnership();

	/**
	 * Sets the value of the '{@link CIM.IEC61970.Informative.InfAssets.OrgAssetRole#getPercentOwnership Percent Ownership}' attribute.
	 *
	 *
	 * @param value the new value of the 'Percent Ownership' attribute.
	 * @see #getPercentOwnership()
	 * @generated
	 */
	void setPercentOwnership(float value);

} // OrgAssetRole


text:
<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "assignroledetail".
 *
 * @property integer $recid
 * @property integer $roleid
 * @property integer $departmentid
 */
class Assignroledetail extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'assignroledetail';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['roleid', 'departmentid','assignid'], 'integer']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'recid' => 'Recid',
            'roleid' => 'Roleid',
            'departmentid' => 'Departmentid',
            'assignid'=>'Assignid',
        ];
    }
}


text:
package com.thoughtworks.go.server.service;

import com.thoughtworks.go.config.materials.SubprocessExecutionContext;
import com.thoughtworks.go.util.SystemEnvironment;

import java.util.Map;
import java.util.UUID;

public class CheckConnectionSubprocessExecutionContext implements SubprocessExecutionContext {
    private SystemEnvironment systemEnvironment;

    public CheckConnectionSubprocessExecutionContext(SystemEnvironment systemEnvironment) {
        this.systemEnvironment = systemEnvironment;
    }

    public String getProcessNamespace(String fingerprint) {
        return UUID.randomUUID().toString();
    }

    @Override
    public Map<String, String> getDefaultEnvironmentVariables() {
        return systemEnvironment.getGitAllowedProtocols();
    }

    @Override
    public Boolean isGitShallowClone() {
        throw new UnsupportedOperationException(" This is an unexpected call. Perform this action only on the server.");
    }

    @Override
    public boolean isServer() {
        throw new UnsupportedOperationException("This is an unexpected call.");
    }
}


text:
class Player
    @@sports = "basketball"

  def initialize(name, height, team)
    @name = name
    @height = height
    @team = team
  end

  def self.sports
    p @@sports
  end

  def profile
    puts "Player name: #{@name}"
    puts "Height(cm): #{@height}"
    puts "Current team: #{@team}"
  end

end

Baller_A = Player.new("Curry",191,"GSW")
Baller_A.profile
Player.sports


text:
package io.cattle.platform.simple.allocator.dao;

import io.cattle.platform.allocator.service.AllocationCandidate;

import java.util.Iterator;
import java.util.List;

public interface SimpleAllocatorDao {

    Iterator<AllocationCandidate> iteratorHosts(List<String> hostUUIDs, List<Long> volumeIds, QueryOptions options);
}


text:
using gaxgrpc = Google.Api.Gax.Grpc;
using gcdv = Google.Cloud.Dataflow.V1Beta3;
using gpr = Google.Protobuf.Reflection;
using sys = System;
using scg = System.Collections.Generic;

namespace Microsoft.Extensions.DependencyInjection
{
    /// Static class to provide extension methods to configure API clients.
    public static partial class ServiceCollectionExtensions
    {
        ///
        /// Adds a singleton <see cref="gcdv::FlexTemplatesServiceClient"/> to <paramref name="services"/>.
        ///
        /// <param name="services">
        /// The service collection to add the client to. The services are used to configure the client when requested.
        /// </param>
        /// <param name="action">
        /// An optional action to invoke on the client builder. This is invoked before services from
        /// <paramref name="services"/> are used.
        /// </param>
        public static IServiceCollection AddFlexTemplatesServiceClient(this IServiceCollection services, sys::Action<gcdv::FlexTemplatesServiceClientBuilder> action = null) =>
            services.AddSingleton(provider =>
            {
                gcdv::FlexTemplatesServiceClientBuilder builder = new gcdv::FlexTemplatesServiceClientBuilder();
                action?.Invoke(builder);
                return builder.Build(provider);
            });

        /// Adds a singleton <see cref="gcdv::JobsV1Beta3Client"/> to <paramref name="services"/>.
        /// <param name="services">
        /// The service collection to add the client to. The services are used to configure the client when requested.
        /// </param>
        /// <param name="action">
        /// An optional action to invoke on the client builder. This is invoked before services from
        /// <paramref name="services"/> are used.
        /// </param>
        public static IServiceCollection AddJobsV1Beta3Client(this IServiceCollection services, sys::Action<gcdv::JobsV1Beta3ClientBuilder> action = null) =>
            services.AddSingleton(provider =>
            {
                gcdv::JobsV1Beta3ClientBuilder builder = new gcdv::JobsV1Beta3ClientBuilder();
                action?.Invoke(builder);
                return builder.Build(provider);
            });

        ///
        /// Adds a singleton <see cref="gcdv::MessagesV1Beta3Client"/> to <paramref name="services"/>.
        ///
        /// <param name="services">
        /// The service collection to add the client to. The services are used to configure the client when requested.
        /// </param>
        /// <param name="action">
        /// An optional action to invoke on the client builder. This is invoked before services from
        /// <paramref name="services"/> are used.
        /// </param>
        public static IServiceCollection AddMessagesV1Beta3Client(this IServiceCollection services, sys::Action<gcdv::MessagesV1Beta3ClientBuilder> action = null) =>
            services.AddSingleton(provider =>
            {
                gcdv::MessagesV1Beta3ClientBuilder builder = new gcdv::MessagesV1Beta3ClientBuilder();
                action?.Invoke(builder);
                return builder.Build(provider);
            });

        /// Adds a singleton <see cref="gcdv::MetricsV1Beta3Client"/> to <paramref name="services"/>.
        /// <param name="services">
        /// The service collection to add the client to. The services are used to configure the client when requested.
        /// </param>
        /// <param name="action">
        /// An optional action to invoke on the client builder. This is invoked before services from
        /// <paramref name="services"/> are used.
        /// </param>
        public static IServiceCollection AddMetricsV1Beta3Client(this IServiceCollection services, sys::Action<gcdv::MetricsV1Beta3ClientBuilder> action = null) =>
            services.AddSingleton(provider =>
            {
                gcdv::MetricsV1Beta3ClientBuilder builder = new gcdv::MetricsV1Beta3ClientBuilder();
                action?.Invoke(builder);
                return builder.Build(provider);
            });

        ///
        /// Adds a singleton <see cref="gcdv::SnapshotsV1Beta3Client"/> to <paramref name="services"/>.
        ///
        /// <param name="services">
        /// The service collection to add the client to. The services are used to configure the client when requested.
        /// </param>
        /// <param name="action">
        /// An optional action to invoke on the client builder. This is invoked before services from
        /// <paramref name="services"/> are used.
        /// </param>
        public static IServiceCollection AddSnapshotsV1Beta3Client(this IServiceCollection services, sys::Action<gcdv::SnapshotsV1Beta3ClientBuilder> action = null) =>
            services.AddSingleton(provider =>
            {
                gcdv::SnapshotsV1Beta3ClientBuilder builder = new gcdv::SnapshotsV1Beta3ClientBuilder();
                action?.Invoke(builder);
                return builder.Build(provider);
            });

        ///
        /// Adds a singleton <see cref="gcdv::TemplatesServiceClient"/> to <paramref name="services"/>.
        ///
        /// <param name="services">
        /// The service collection to add the client to. The services are used to configure the client when requested.
        /// </param>
        /// <param name="action">
        /// An optional action to invoke on the client builder. This is invoked before services from
        /// <paramref name="services"/> are used.
        /// </param>
        public static IServiceCollection AddTemplatesServiceClient(this IServiceCollection services, sys::Action<gcdv::TemplatesServiceClientBuilder> action = null) =>
            services.AddSingleton(provider =>
            {
                gcdv::TemplatesServiceClientBuilder builder = new gcdv::TemplatesServiceClientBuilder();
                action?.Invoke(builder);
                return builder.Build(provider);
            });
    }
}


text:
//// Copyright (c) Microsoft Corporation. All rights reserved

(function () {
    "use strict";

    var sampleTitle = "Custom Serial Device Access";

    var scenarios = [
        { url: "/html/scenario1_connectDisconnect.html", title: "Connect/Disconnect" },
        { url: "/html/Scenario2_configureDevice.html", title: "Configure Device" },
        { url: "/html/Scenario3_readWrite.html", title: "Read/Write" },
        { url: "/html/Scenario4_events.html", title: "Events" }
    ];

    WinJS.Namespace.define("SdkSample", {
        sampleTitle: sampleTitle,
        scenarios: new WinJS.Binding.List(scenarios)
    });
})();


text:
The docker log plugin uses the Docker Engine API to get logs on running
docker containers.

The docker plugin uses the [Official Docker Client][] to gather logs from the
[Engine API][].

**Note:** This plugin works only for containers with the `local` or
`json-file` or `journald` logging driver.

[Official Docker Client]: https://github.com/moby/moby/tree/master/client
[Engine API]: https://docs.docker.com/engine/api/v1.24/

## Configuration

```toml @sample.conf
# Read logging output from the Docker engine
[[inputs.docker_log]]
  ## Docker Endpoint
  ##   To use TCP, set endpoint = "tcp://[ip]:[port]"
  ##   To use environment variables (ie, docker-machine), set endpoint = "ENV"
  # endpoint = "unix:///var/run/docker.sock"

  ## When true, container logs are read from the beginning; otherwise
  ## reading begins at the end of the log.
  # from_beginning = false

  ## Timeout for Docker API calls.
  # timeout = "5s"

  ## Containers to include and exclude. Globs accepted.
  ## Note that an empty array for both will include all containers
  # container_name_include = []
  # container_name_exclude = []

  ## Container states to include and exclude. Globs accepted.
  ## When empty only containers in the "running" state will be captured.
  # container_state_include = []
  # container_state_exclude = []

  ## docker labels to include and exclude as tags.  Globs accepted.
  ## Note that an empty array for both will include all labels as tags
  # docker_label_include = []
  # docker_label_exclude = []

  ## Set the source tag for the metrics to the container ID hostname, eg first 12 chars
  source_tag = false

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false
```

### Environment Configuration

When using the `"ENV"` endpoint, the connection is configured using the
[CLI Docker environment variables][env]

[env]: https://godoc.org/github.com/moby/moby/client#NewEnvClient

## source tag

Selecting the containers can be tricky if you have many containers with the same
name.  To alleviate this issue you can set the below value to `true`

```toml
source_tag = true
```

This will cause all data points to have the `source` tag be set to the first 12
characters of the container id. The first 12 characters is the common hostname
for containers that have no explicit hostname set, as defined by docker.

## Metrics

- docker_log
  - tags:
    - container_image
    - container_version
    - container_name
    - stream (stdout, stderr, or tty)
    - source
  - fields:
    - container_id
    - message

## Example Output

```shell
docker_log,container_image=telegraf,container_name=sharp_bell,container_version=alpine,stream=stderr container_id="371ee5d3e58726112f499be62cddef800138ca72bbba635ed2015fbf475b1023",message="2019-06-19T03:11:11Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:\"371ee5d3e587\", Flush Interval:10s" 1560913872000000000
docker_log,container_image=telegraf,container_name=sharp_bell,container_version=alpine,stream=stderr container_id="371ee5d3e58726112f499be62cddef800138ca72bbba635ed2015fbf475b1023",message="2019-06-19T03:11:11Z I! Tags enabled: host=371ee5d3e587" 1560913872000000000
docker_log,container_image=telegraf,container_name=sharp_bell,container_version=alpine,stream=stderr container_id="371ee5d3e58726112f499be62cddef800138ca72bbba635ed2015fbf475b1023",message="2019-06-19T03:11:11Z I! Loaded outputs: file" 1560913872000000000
docker_log,container_image=telegraf,container_name=sharp_bell,container_version=alpine,stream=stderr container_id="371ee5d3e58726112f499be62cddef800138ca72bbba635ed2015fbf475b1023",message="2019-06-19T03:11:11Z I! Loaded processors:" 1560913872000000000
docker_log,container_image=telegraf,container_name=sharp_bell,container_version=alpine,stream=stderr container_id="371ee5d3e58726112f499be62cddef800138ca72bbba635ed2015fbf475b1023",message="2019-06-19T03:11:11Z I! Loaded aggregators:" 1560913872000000000
docker_log,container_image=telegraf,container_name=sharp_bell,container_version=alpine,stream=stderr container_id="371ee5d3e58726112f499be62cddef800138ca72bbba635ed2015fbf475b1023",message="2019-06-19T03:11:11Z I! Loaded inputs: net" 1560913872000000000
docker_log,container_image=telegraf,container_name=sharp_bell,container_version=alpine,stream=stderr container_id="371ee5d3e58726112f499be62cddef800138ca72bbba635ed2015fbf475b1023",message="2019-06-19T03:11:11Z I! Using config file: /etc/telegraf/telegraf.conf" 1560913872000000000
docker_log,container_image=telegraf,container_name=sharp_bell,container_version=alpine,stream=stderr container_id="371ee5d3e58726112f499be62cddef800138ca72bbba635ed2015fbf475b1023",message="2019-06-19T03:11:11Z I! Starting Telegraf 1.10.4" 1560913872000000000
```


text:
require "spec_helper"

module Spree
  module Wombat
    describe AdjustmentSerializer do

      let(:adjustment) { create(:adjustment, order: create(:order)) }
      let(:serialized_adjustment) { AdjustmentSerializer.new(adjustment, root: false).to_json }

      it "serializes the value as float" do
        expect(JSON.parse(serialized_adjustment)["value"].class).to eql Float
      end

      it "serializes the label as name" do
        expect(JSON.parse(serialized_adjustment)["name"]).to eql adjustment.label
      end
    end
  end
end


text:
static void deleteShiftLeft( char *str )
{
  // Function shouldn't be called with a NULL string
  assert( str != NULL );
  // Function shouldn't be called to remove a null character
  assert( *str != '\0' );

  char *p = str;
  while( *p != '\0' ) {
    // Replace this character with the next one
    *p = *(p+1);
    // Advance the pointer
    p++;
  }
}

void processString( char *str )
{
  // Function shouldn't be called with a NULL string
  assert( str != NULL );
  // Function shouldn't be called to remove a null character
  assert( *str != '\0' );

  char *p = str;
  // Loop until we find the null character
  while( *p != '\0' ) {

    // Is *p uppercase?  Convert to lowercase
    if( ( *p >= 'A' ) && ( *p <= 'Z' ) ) {
      *p = (char)(( *p - 'A' ) + 'a');
    }

    // Is *p anything but a lowercase letter or a dash?
    // If so, remove it.
    if( ( ( *p < 'a' ) || ( *p > 'z' ) ) &&
	( *p != '-' ) &&
	( *p != '\'' ) ) {
      deleteShiftLeft( p );
    }
    else {
      p++;
    }
  }
}

// Take a string, and quickly produce an unsigned int "hash"
// number, in the range [0,n).
// The goal is for all of the words we input to hash
// to different values, fairly evenly spread across that range.
// In our function below, we do this by multiplying each
// character with a HASH_MULT constant, 31.
// For good performance, n and HASH_MULT should be co-prime.
unsigned int hashString( const char *str, const unsigned int n )
{
  unsigned int hash = 0;
  const char *p;

  assert( str != NULL );

  for( p = str; *p != '\0'; p++ ) {
    hash = (HASH_MULT * hash + (unsigned int)(*p));
  }

  return ( hash % n );
}


text:
package org.apache.ambari.server.api.services;

import java.util.List;
import java.util.Map;

import org.apache.ambari.server.api.query.render.Renderer;
import org.apache.ambari.server.api.resources.ResourceDefinition;
import org.apache.ambari.server.api.resources.ResourceInstance;
import org.apache.ambari.server.controller.spi.PageRequest;
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.SortRequest;
import org.apache.ambari.server.controller.spi.TemporalInfo;

/**
 * Provides information on the current request.
 */
public interface Request {

  /**
   * Enum of request types.
   */
  enum Type {
    GET,
    POST,
    PUT,
    DELETE,
    QUERY_POST
  }

  /**
   * Process the request.
   *
   * @return the result
   */
  Result process();

  /**
   * Obtain the resource definition which corresponds to the resource being operated on by the request.
   * The resource definition provides information about the resource type;
   *
   * @return the associated {@link ResourceDefinition}
   */
  ResourceInstance getResource();

  /**
   * Obtain the URI of this request.
   *
   * @return the request uri
   */
  String getURI();

  /**
   * Obtain the http request type.  Type is one of {@link Type}.
   *
   * @return the http request type
   */
  Type getRequestType();

  /**
   * Obtain the api version of the request.  The api version is specified in the request URI.
   *
   * @return the api version of the request
   */
  int getAPIVersion();

  /**
   * Obtain the query predicate that was built from the user provided predicate fields in the query string.
   * If multiple predicates are supplied, then they will be combined using the appropriate logical grouping
   * predicate such as 'AND'.
   *
   * @return the user defined predicate
   */
  Predicate getQueryPredicate();

  /**
   * Obtain the partial response fields and associated temporal information which were provided
   * in the query string of the request uri.
   *
   * @return map of partial response propertyId to temporal information
   */
  Map<String, TemporalInfo> getFields();

  /**
   * Obtain the request body data.
   */
  RequestBody getBody();

  /**
   * Obtain the http headers associated with the request.
   *
   * @return the http headers
   */
  Map<String, List<String>> getHttpHeaders();

  /**
   * Obtain the pagination request information.
   *
   * @return the page request
   */
  PageRequest getPageRequest();

  /**
   * Obtain information to order the results by.
   *
   * @return the order request
   */
  SortRequest getSortRequest();

  /**
   * Obtain the renderer for the request.
   *
   * @return renderer instance
   */
  Renderer getRenderer();

  /**
   * Returns the remote address for the request
   * @return the remote address for the request
   */
  String getRemoteAddress();

}


text:
var _ = require('underscore'),
    spawn = require('child_process').spawn,
    exec = require('child_process').exec,
    Game = require('../game/game.js').Game,
    asyncblock = require('asyncblock');

function AI(executionCommand, parameters, wholeExecutionCommand, workingDir, pauseCommand, unpauseCommand, index, addLog) {
    this.pauseCommand = pauseCommand;
    this.unpauseCommand = unpauseCommand;
    this.index = index;
    this.addLog = addLog;
    this.commands = [];
    this.ready = false;
    this.available = true;
    this.timeout = null;
    this.clearEventHandlers();

    this.process = spawn(executionCommand, parameters, { cwd: workingDir });

    var self = this;

    this.process.stdout.on('data', function (data) {
        self.addLog('AI' + self.index + '>>' + 'STDOUT: ' + data);
        self.onStdout(data);
    });

    this.process.stderr.on('data', function (data) {
        self.addLog('AI' + self.index + '>>' + 'STDERR: ' + data, self.index);
    });

    this.process.on('close', function (code) {
        self.addLog('AI' + self.index + '>>' + 'Child process exited with code ' + code);
        self.clearTimer();
        self.available = false;
        self.onExit();
    });

    this.process.on('error', function (error) {
        console.error(error);
        self.addLog('AI' + self.index + '>>' + 'Failed to run "' + wholeExecutionCommand + '"', self.index);
        self.available = false;
    });
}

AI.prototype.setTimer = function (timeLimit) {
    var self = this;
    self.clearTimer();
    self.timeout = setTimeout(function () {
        self.addLog('AI' + self.index + '>>' + 'Killing due to TLE');
        self.process.kill('SIGINT');
    }, timeLimit);
};

AI.prototype.clearTimer = function () {
    clearTimeout(this.timeout);
    this.timeout = null;
};

AI.prototype.pause = function (callback, self) {
    this.executeCommand(this.pauseCommand, callback, self);
};

AI.prototype.unpause = function (callback, self) {
    this.executeCommand(this.unpauseCommand, callback, self);
};

AI.prototype.executeCommand = function (command, callback, self) {
    asyncblock(function (flow) {
        if (command) {
            exec(command, flow.add());
            flow.wait();
        }
        if (callback) {
            callback.call(self || this);
        }
    });
};

AI.prototype.clearEventHandlers = function () {
    this.onStdout = function (data) { };
    this.onExit = function () { };
}

AI.prototype.write = function (message) {
    try {
        this.process.stdin.write(message);
    } catch (error) {
        // we'll receive a 'close' message soon
    }
};

function Runner(executionCommands, workingDirs, seed, pauseCommands, unpauseCommands) {
    this.executionCommands = executionCommands;
    var defaultArray = _.map(executionCommands, function () {
        return undefined;
    });
    this.workingDirs = workingDirs || defaultArray;
    this.seed = isNaN(seed) ? undefined : seed;
    this.pauseCommands = pauseCommands || defaultArray;
    this.unpauseCommands = unpauseCommands || defaultArray;
}

Runner.LOG_FOR_EVERYONE = -1;

Runner.prototype.runGame = function (done) {
    var self = this;

    this.done = done;
    var seed = this.seed || new Date().getTime();
    this.game = new Game(seed);
    this.game.initialize();

    this.gameResult = {
        log: [],
        winner: '',
        replay: {
            seed: seed,
            commands: [],
        },
    };

    this.ais = [];
    _(this.game.getNumPlayers()).times(function (i) {
        var commandAndParameters = this.executionCommands[i].split(' ');
        var command = _.first(commandAndParameters);
        var parameters = _.rest(commandAndParameters);
        this.ais.push(new AI(command, parameters, this.executionCommands[i], this.workingDirs[i], this.pauseCommands[i], this.unpauseCommands[i], i, function (message, aiIndex) {
            addLog.call(self, message, aiIndex);
        }));
    }, this);

    _.each(getAvailableAIs.call(this), function (ai) {
        ai.onStdout = function (data) {
            if (data.toString().trim().toLowerCase() == 'ready') {
                ai.ready = true;
                ai.clearTimer();
                onReadyForBeginning.call(self);
            }
        };
        ai.onExit = function () {
            onReadyForBeginning.call(self);
        }
        ai.setTimer(5000);
    });
};

function onReadyForBeginning() {
    if (isEveryoneReady.call(this)) {
        _.each(this.ais, function (ai) {
            ai.clearEventHandlers();
        }, this);

        pauseAIs.call(this, function () {
            beginTurn.call(this);
        });
    }
}

function isEveryoneReady() {
    return _.isEmpty(getUnreadyAIs.call(this));
}

function addLog(logMessage, aiIndex) {
    if (aiIndex === undefined) {
        aiIndex = Runner.LOG_FOR_EVERYONE;
    }
    this.gameResult.log.push({ target: aiIndex, message: logMessage.trim() });
}

function onReady() {
    if (isEveryoneReady.call(this)) {
        var commands = _.map(this.ais, function (ai) {
            return ai.commands;
        });
        this.game.processTurn(commands);
        addLog.call(this, 'Turn finished. Game status:');
        addLog.call(this, this.game.getStatus());

        if (this.game.isFinished()) {
            finish.call(this);
        } else {
            beginTurn.call(this);
        }
    } else {
        processNextAI.call(this);
    }
}

function beginTurn() {
    addLog.call(this, '');
    addLog.call(this, 'Turn ' + this.game.turn);

    var availableAIs = getAvailableAIs.call(this);
    if (_.isEmpty(availableAIs)) {
        onReady.call(this);
    } else {
        _.each(availableAIs, function (ai) {
            ai.ready = false;
            ai.commands = [];
        }, this);
        processNextAI.call(this);
    }
}

function finish() {
    addLog.call(this, '');
    addLog.call(this, 'Game finished');

    unpauseAIs.call(this, function () {
        _.each(getAvailableAIs.call(this), function (ai) {
            ai.clearEventHandlers();
            var terminationText = this.game.getTerminationText();
            if (terminationText) {
                ai.write(terminationText);
            }
            ai.setTimer(1000);
        }, this);

        this.gameResult.replay = this.game.getReplay();
        this.gameResult.winner = this.game.getWinner();
        addLog.call(this, 'Winner: ' + this.gameResult.winner);
        this.done();
    });
};

function getAvailableAIs() {
    return _.filter(this.ais, function (ai) {
        return ai.available;
    });
}

function getUnreadyAIs() {
    return _.filter(getAvailableAIs.call(this), function (ai) {
        return !ai.ready;
    });
}

function pauseAIs(callback) {
    pauseOrUnpauseAIs.call(this, AI.prototype.pause, callback);
}

function unpauseAIs(callback) {
    pauseOrUnpauseAIs.call(this, AI.prototype.unpause, callback);
}

function pauseOrUnpauseAIs(controllFunction, callback) {
    var self = this;
    asyncblock(function (flow) {
        _.each(self.ais, function (ai) {
            controllFunction.call(ai, flow.add());
        });
        _.each(self.ais, function (ai) {
            flow.wait();
        });
        callback.call(self);
    });
}

function processNextAI() {
    var ai = _.first(getUnreadyAIs.call(this));
    var self = this;

    var onReadyWithCurrentAI = function (currentAI) {
        currentAI.clearEventHandlers();
        currentAI.pause(function () {
            onReady.call(this);
        }, this);
    }
    ai.onStdout = function (data) {
        ai.commands = data.toString().trim().split(' ');
        ai.ready = true;
        ai.clearTimer();
        onReadyWithCurrentAI.call(self, ai);
    };
    ai.onExit = function () {
        onReadyWithCurrentAI.call(self, ai);
    };

    ai.unpause(function () {
        addLog.call(this, 'AI' + ai.index + '>>' + 'Writing to stdin, waiting for stdout');
        if (this.game.isInitialState()) {
            var initialInformation = this.game.getInitialInformation();
            ai.write(initialInformation);
            addLog.call(this, initialInformation);
        }
        var turnInformation = this.game.getTurnInformation(ai.index);
        ai.write(turnInformation);
        addLog.call(this, turnInformation);

        ai.setTimer(1000);
    }, this);
}

exports.Runner = Runner;


text:
// Copyright 2019 Google LLC

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

//     https://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using leaderboardapp.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace leaderboardapp.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    [Produces("application/json")]
    public class QAController : Controller
    {
        private IQuestionAnswerRepository _qaRepo;

        public QAController(IQuestionAnswerRepository qaRepo)
        {
            _qaRepo = qaRepo;
        }

        // GET api/qa
        [HttpGet]
        public async Task<ActionResult<IList<QuestionAnswerModel>>> Get()
        {
            var retVal = await _qaRepo.GetQuestionAnswerListAsync();

            return Ok(retVal);
        }
    }
}


text:
nagios_prefix = node['nagios']['prefix']
nagios_download_dir = node['nagios']['download_dir']
nagios_plugins_version = node['nagios']['plugins']['version']
nagios_plugins_download_url = node['nagios']['plugins']['download_url']
nrpe_version = node['nagios']['nrpe']['version']
nrpe_download_url = node['nagios']['nrpe']['download_url']
nrpe_allowed_hosts = node['nagios']['nrpe']['allowed_hosts']

package 'gcc' do
  action :install
end

user "nagios" do
  home "/opt/nagios"
  shell "/bin/bash"
  action :create
end

remote_file "#{nagios_download_dir}/nagios-plugins-#{nagios_plugins_version}.tar.gz" do
  source "#{nagios_plugins_download_url}"
  mode "0644"
  owner "root"
  group "root"
  action :create_if_missing
end

execute "untar nagios plugins tarball" do
  command "tar zxvf nagios-plugins-#{nagios_plugins_version}.tar.gz"
  cwd "#{nagios_download_dir}"
  creates "#{nagios_download_dir}/nagios-plugins-#{nagios_plugins_version}"
end

script "install nagios plugins" do
  interpreter "bash"
  cwd "#{nagios_download_dir}/nagios-plugins-#{nagios_plugins_version}"
  code <<-EOH
  ./configure --prefix=#{nagios_prefix}
  make
  make install
  EOH
  creates "#{nagios_prefix}/libexec/check_ping"
end

remote_file "#{nagios_download_dir}/nrpe-#{nrpe_version}.tar.gz" do
  source "#{nrpe_download_url}"
  mode "0644"
  owner "root"
  group "root"
  action :create_if_missing
end

execute "untar nrpe tarball" do
  command "tar zxvf nrpe-#{nrpe_version}.tar.gz"
  cwd "#{nagios_download_dir}"
  creates "#{nagios_download_dir}/nrpe-#{nrpe_version}"
end

script "install nrpe" do
  interpreter "bash"
  cwd "#{nagios_download_dir}/nrpe-#{nrpe_version}"
  code <<-EOH
  ./configure --prefix=#{nagios_prefix}
  make all
  make install-plugin
  make install-daemon
  make install-daemon-config
  EOH
  creates "#{nagios_prefix}/etc"
end

template "/etc/init.d/nrpe" do
  source "init.d/nrpe.erb"
  mode "0744"
  owner "root"
  group "root"
  action :create
  variables(
    :nagios_prefix => nagios_prefix)
end

template "#{nagios_prefix}/etc/nrpe.cfg" do
  source "etc/nrpe.cfg.erb"
  mode "0644"
  owner "nagios"
  group "nagios"
  action :create
  variables(
    :allowed_hosts => nrpe_allowed_hosts)
end

service "nrpe" do
  action [ :enable, :start ]
end

# some how the above doesn't start nrpe. Here's a workaround.
execute "start nrpe" do
  command "/etc/init.d/nrpe start || /etc/init.d/nrpe restart"
end


text:
require 'rack'
require 'nanite/mapper'

module Nanite

  # This is a Rack app for nanite-admin.  You need to have an async capable
  # version of Thin installed for this to work.  See bin/nanite-admin for install
  # instructions.
  class Admin

    def initialize(agent)
      @agent = agent
    end

    AsyncResponse = [-1, {}, []].freeze

    def call(env)
      req = Rack::Request.new(env)
      if cmd = req.params['command']
        Nanite.request(cmd, req.params['payload'], :selector => req.params['type'], :timeout => 15) do |response|
          if response
            env['async.callback'].call [200, {'Content-Type' => 'text/html'}, [layout(ul(response))]]
          else
            env['async.callback'].call [500, {'Content-Type' => 'text/html'}, [layout("Request Timeout")]]
          end
        end
        AsyncResponse
      else
        [200, {'Content-Type' => 'text/html'}, layout]
      end
    end

    def services
      buf = "<select name='command'>"
      @agent.mapper.nanites.map{|k,v| v[:services]}.flatten.uniq.each do |srv|
        buf << "<option value='#{srv}'>#{srv}</option>"
      end
      buf << "</select>"
      buf
    end

    def ul(hash)
      buf = "
"
      hash.each do |k,v|
        buf << "
identity : #{k}
response : #{v.inspect}
"
      end
      buf << "
"
      buf
    end

    def layout(content="")
      %Q{
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
            <meta content='en' http-equiv='Content-Language' />
            <meta content='Engineyard' name='author' />
            <title>Nanite Control Tower</title>

Nanite Control Tower

              <form method="post" action="/">
                <input type="hidden" value="POST" name="_method"/>

                  Send
                  <select name="type">
                    <option value="least_loaded">the least loaded nanite</option>
                    <option value="random">a random nanite</option>
                    <option value="all">all nanites</option>
                    <option value="rr">a nanite chosen by round robin</option>
                  </select>

                  providing service
                  #{services}

                  the payload
                  <input type="text" class="text" name="payload" id="payload"/>

                  <input type="submit" class="submit" value="Go!" name="submit"/>
              </form>

nanite responses:

              #{content}

running nanites:

                #{@agent.mapper.nanites.map {|k,v| "
identity : #{k}
load : #{v[:status]}
services : #{v[:services].inspect}
" }.join}

      }
    end # layout
  end # class Admin
end # module Nanite


text:
class DCAtomicField;
class DCParameter;

////////////////////////////////////////////////////////////////////
//       Class : DCMolecularField
// Description : A single molecular field of a Distributed Class, as
//               read from a .dc file.  This represents a combination
//               of two or more related atomic fields, that will often
//               be treated as a unit.
////////////////////////////////////////////////////////////////////
class EXPCL_DIRECT DCMolecularField : public DCField {
public:
  DCMolecularField(const string &name, DCClass *dclass);

PUBLISHED:
  virtual DCMolecularField *as_molecular_field();
  virtual const DCMolecularField *as_molecular_field() const;

  int get_num_atomics() const;
  DCAtomicField *get_atomic(int n) const;

public:
  void add_atomic(DCAtomicField *atomic);

  virtual void output(ostream &out, bool brief) const;
  virtual void write(ostream &out, bool brief, int indent_level) const;
  virtual void generate_hash(HashGenerator &hashgen) const;

  virtual DCPackerInterface *get_nested_field(int n) const;

protected:
  virtual bool do_check_match(const DCPackerInterface *other) const;
  virtual bool do_check_match_molecular_field(const DCMolecularField *other) const;

private:
  // These members define the primary interface to the molecular field
  // definition as read from the file.
  typedef pvector<DCAtomicField *> Fields;
  Fields _fields;
  bool _got_keywords;

  DCParameter *get_next_pack_element();

  typedef pvector<DCPackerInterface *> NestedFields;
  NestedFields _nested_fields;
};

#endif


text:
'use strict';

module.exports = function(app) {
  app.task('default', function(cb) {
    console.log(app.name, '>', this.name);
    cb();
  });
};


text:
package org.gameontext.mediator;

import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.gameontext.mediator.models.Site;
import org.gameontext.signed.SignedClientRequestFilter;

/**
 * A wrapped/encapsulation of outbound REST requests to the map service.
 *

 * The URL for the map service and the API key are injected via CDI: {@code
 * <jndiEntry />} elements defined in server.xml maps the environment variables
 * to JNDI values.
 *

 *

 * CDI will create this (the {@code MapClient} as an application scoped bean.
 * This bean will be created when the application starts, and can be injected
 * into other CDI-managed beans for as long as the application is valid.
 *

 *
 * @see ApplicationScoped
 */
@ApplicationScoped
public class MapClient {

    /**
     * The map URL injected from JNDI via CDI.
     *
     * @see {@code mapUrl} in
     *      {@code /mediator-wlpcfg/servers/gameon-mediator/server.xml}
     */
    @Resource(lookup = "mapUrl")
    String mapLocation;

    /**
     * The map API key injected from JNDI via CDI.
     *
     * @see {@code mapApiKey} in
     *      {@code /mediator-wlpcfg/servers/gameon-mediator/server.xml}
     */
    @Resource(lookup = "mapApiKey")
    String querySecret;

    /**
     * The system id, that we use when making our map queries.
     *
     * @see {@code systemId} in
     *      {@code /mediator-wlpcfg/servers/gameon-mediator/server.xml}
     */
    @Resource(lookup = "systemId")
    String SYSTEM_ID;

    /**
     * The root target used to define the root path and common query parameters
     * for all outbound requests to the concierge service.
     *
     * @see WebTarget
     */
    private WebTarget queryRoot;

    /** Cache of retrieved room exits */
    private ConcurrentHashMap<String, SiteCache> roomCache = new ConcurrentHashMap<>();

    /**
     * The {@code @PostConstruct} annotation indicates that this method should
     * be called immediately after the {@code MapClient} is instantiated
     * with the default no-argument constructor.
     *
     * @see PostConstruct
     * @see ApplicationScoped
     */
    @PostConstruct
    public void initClient() {
        if ( mapLocation == null ) {
            Log.log(Level.SEVERE, this, "Map client can not be initialized, 'mapUrl' is not defined");
            throw new IllegalStateException("Unable to initialize MapClient");
        }

        if ( querySecret == null ) {
            Log.log(Level.SEVERE, this, "Map client can not be initialized, 'mapApiKey' is not defined");
            throw new IllegalStateException("Unable to initialize MapClient");
        }

        Client queryClient = ClientBuilder.newBuilder()
                                          .property("com.ibm.ws.jaxrs.client.ssl.config", "DefaultSSLSettings")
                                          .property("com.ibm.ws.jaxrs.client.disableCNCheck", true)
                                          .build();

        queryClient.register(JsonProvider.class);

        //add our shared secret so all our queries come from the system id
        queryClient.register(new SignedClientRequestFilter(SYSTEM_ID, querySecret));

        // create the jax-rs 2.0 client
        this.queryRoot = queryClient.target(mapLocation);

        Log.log(Level.FINER, this, "Map client initialized with url {0}, system-id {1}", mapLocation, SYSTEM_ID);
    }

    public boolean isHealthy() {
        return queryRoot != null;
    }

    public List<Site> getSystemRooms() {
        WebTarget target = this.queryRoot.queryParam("owner", SYSTEM_ID);
        return getSites(target);
    }

    public List<Site> getRoomsByOwner(String ownerId) {
        WebTarget target = this.queryRoot.queryParam("owner", ownerId);
        return getSites(target);
    }

    public List<Site> getRoomsByRoomName(String name) {
        WebTarget target = this.queryRoot.queryParam("name", name);
        return getSites(target);
    }

    public List<Site> getRoomsByOwnerAndRoomName(String ownerId,String roomName) {
        WebTarget target = this.queryRoot.queryParam("owner", ownerId).queryParam("name",roomName);
        return getSites(target);
    }

    /**
     * Construct an outbound {@code WebTarget} that builds on the root
     * {@code WebTarget#path(String)} to add the path segment required to
     * request the first room.
     *
     * @return The Site representing first room from the Map Service, or null if it could not be retrieved.
     * @see #getRoomList(WebTarget)
     */
    public Site getSite() {
        return getSite(Constants.FIRST_ROOM);
    }

    /**
     * Construct an outbound {@code WebTarget} that builds on the root
     * {@code WebTarget#path(String)} to add the path segment required to
     * request the Site for a given room ({roomId}).
     *
     * @param roomId
     *            The specific room to find the site for
     *
     * @return The Site returned from the map service. This
     *         may be null if the site could not be retrieved.
     *
     * @see #getRoomList(WebTarget)
     * @see WebTarget#resolveTemplate(String, Object)
     */
    public Site getSite(String roomId) {
        SiteCache sc = roomCache.get(roomId);
        if ( sc == null ) {
            sc = new SiteCache();
        }

        long now = System.nanoTime();
        if ( sc.site == null || sc.refresh(now) ) {
            WebTarget target = this.queryRoot.path(roomId);
            Site ns = getSite(roomId, target);
            if ( ns != null ) {
                sc.update(ns);
                roomCache.put(roomId, sc);
                return ns;
            }
        }

        return sc.site;
    }

    /**
     * Construct an outbound {@code WebTarget} that builds on the root
     * {@code WebTarget#path(String)} to add the path segment required to
     * request the deletion of a given room ({roomId}
     * ).
     *
     * @param roomId
     *            The specific room to delete
     * @param secret
     * @param userid
     *
     * @return The list of available endpoints returned from the concierge. This
     *         may be null if the list could not be retrieved.
     *
     * @see #getRoomList(WebTarget)
     * @see WebTarget#resolveTemplate(String, Object)
     */
    public boolean deleteSite(String roomId, String userid, String secret) {
        Log.log(Level.FINER, this, "Asked to delete room id {0} for user {1} with secret(first2chars) {2}",roomId,userid,secret.substring(0,2));

        Client client = ClientBuilder.newClient().register(JsonProvider.class);

        // use the player's shared secret for this operation, not ours
        SignedClientRequestFilter apikey = new SignedClientRequestFilter(userid, secret);
        client.register(apikey);

        WebTarget target = client.target(mapLocation).path(roomId);

        Log.log(Level.FINER, this, "making request to {0} for room", target.getUri().toString());
        Response r = null;
        try {
            r = target.request().delete(); //
            if (r.getStatus() == 204) {
                Log.log(Level.FINER, this, "delete reported success (204)", target.getUri().toString());
                return true;
            }
            Log.log(Level.FINER, this, "delete failed reason:{0} entity:{1}", r.getStatusInfo().getReasonPhrase(),r.readEntity(String.class));

            //delete failed.
            return false;
        } catch (ResponseProcessingException rpe) {
            Response response = rpe.getResponse();
            Log.log(Level.SEVERE, this, "Exception deleting room uri: {0} resp code: {1} ",
                    target.getUri().toString(),
                    response.getStatusInfo().getStatusCode() + " " + response.getStatusInfo().getReasonPhrase());
            Log.log(Level.SEVERE, this, "Exception deleting room ", rpe);
        } catch (ProcessingException e) {
            Log.log(Level.SEVERE, this, "Exception deleting room ", e);
        } catch (WebApplicationException ex) {
            Log.log(Level.SEVERE, this, "Exception deleting room ", ex);
        }
        // Sadly, badness happened while trying to do the delete
        return false;
    }

    /**
     *
     * @param target
     *            {@code WebTarget} that includes the required parameters to
     *            retrieve information about available or specified exits. All
     *            of the REST requests that find or work with exits return the
     *            same result structure
     * @return A populated {@code List<Site>}. Never null
     */
    protected List<Site> getSites(WebTarget target) {
        Log.log(Level.FINER, this, "making request to {0} for room", target.getUri().toString());
        Response r = null;
        try {
            r = target.request(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).get();
            int statusCode = r.getStatusInfo().getStatusCode();
            if (statusCode == Response.Status.OK.getStatusCode() ) {
                List<Site> list = r.readEntity(new GenericType<List<Site>>() {
                });
                if (list == null) {
                    Log.log(Level.FINER, this, "Could not find rooms in the repsonse from uri: {0}",
                            target.getUri().toString());
                    return Collections.emptyList();
                }
                return list;
            } else if (statusCode == Response.Status.NO_CONTENT.getStatusCode()) {
                // If there was no content returned but there is no error, then we don't want to return a null
                return Collections.emptyList();
            }

            // The return code indicates something went wrong, but it wasn't bad enough to cause an exception
            return Collections.emptyList();
        } catch (ResponseProcessingException rpe) {
            Response response = rpe.getResponse();
            Log.log(Level.FINER, this, "Exception fetching room list uri: {0} resp code: {1} ",
                    target.getUri().toString(),
                    response.getStatusInfo().getStatusCode() + " " + response.getStatusInfo().getReasonPhrase());
            Log.log(Level.FINEST, this, "Exception fetching room list", rpe);
        } catch (ProcessingException e) {
            Log.log(Level.FINEST, this, "Exception fetching room list (" + target.getUri().toString() + ")", e);
        } catch (WebApplicationException ex) {
            Log.log(Level.FINEST, this, "Exception fetching room list (" + target.getUri().toString() + ")", ex);
        }

        // Sadly, badness happened while trying to get the endpoints
        return Collections.emptyList();
    }

    /**
     * Invoke the provided {@code WebTarget}, and resolve/parse the result into
     * a {@code Site} that the caller can use to create a new
     * connection to the target room.
     *
     * @param target
     *            {@code WebTarget} that includes the required parameters to
     *            retrieve information about available or specified exits. All
     *            of the REST requests that find or work with exits return the
     *            same result structure
     * @return A populated {@code Site}, or null if the request
     *         failed.
     */
    protected Site getSite(String roomId, WebTarget target) {
        Log.log(Level.FINER, this, "making request to {0} for room", target.getUri().toString());
        Response r = null;
        try {
            r = target.request(MediaType.APPLICATION_JSON).get(); // .accept(MediaType.APPLICATION_JSON).get();
            if (r.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
                Site site = r.readEntity(Site.class);
                return site;
            }
            if ( r.getStatus() == 404 ) {
                // The room doesn't exist anymore.
                roomCache.remove(roomId);
            }

            return null;
        } catch (ResponseProcessingException rpe) {
            Response response = rpe.getResponse();
            Log.log(Level.FINER, this, "Exception fetching room list uri: {0} resp code: {1} ",
                    target.getUri().toString(),
                    response.getStatusInfo().getStatusCode() + " " + response.getStatusInfo().getReasonPhrase());
            Log.log(Level.FINEST, this, "Exception fetching room list", rpe);
        } catch (ProcessingException e) {
            Log.log(Level.FINEST, this, "Exception fetching room list (" + target.getUri().toString() + ")", e);
        } catch (WebApplicationException ex) {
            Log.log(Level.FINEST, this, "Exception fetching room list (" + target.getUri().toString() + ")", ex);
        }
        // Sadly, badness happened while trying to get the endpoints
        return null;
    }

    /**
     * TODO: Contents of this cache can be maintained via push
     * when room events start arriving: that could change our timing,
     * or how/when the entries expire such that we re-lookup.
     *
     */
    static class SiteCache {
        /** Last check of the assigned exits for the room */
        long lastCheck = 0;

        /** Cached site */
        Site site = null;

        public boolean refresh(long now) {
            return ( now - lastCheck > TimeUnit.SECONDS.toNanos(5) );
        }

        public void update(Site ns) {
            lastCheck = System.nanoTime();
            site = ns;
        }
    }
}


text:
package com.graphhopper.util;

import org.junit.jupiter.api.Test;

import java.io.File;

import static org.junit.jupiter.api.Assertions.assertTrue;

public class UnzipperTest {

    @Test
    public void testUnzip() throws Exception {
        String to = "./target/tmp/test";
        Helper.removeDir(new File(to));
        new Unzipper().unzip("./src/test/resources/com/graphhopper/util/test.zip", to, false);
        assertTrue(new File("./target/tmp/test/file2 bäh").exists());
        assertTrue(new File("./target/tmp/test/folder1").isDirectory());
        assertTrue(new File("./target/tmp/test/folder1/folder 3").isDirectory());
        Helper.removeDir(new File(to));
    }

}


text:
namespace ChessMoveValidator.Core.Models
{
    using ChessMoveValidator.Core.Enums;
    using ChessMoveValidator.Core.Interfaces.Models;

    ///
    /// Represents a chess piece.
    ///
    public abstract class Piece : IPiece
    {
        ///
        /// Initializes a new instance of the <see cref="Piece" /> class.
        ///
        /// <param name="color">The color.</param>
        protected Piece(PieceColor color)
        {
            this.ZobristHashKeys = new ZobristHashKeyCollection();

            this.Color = color;
        }

        ///
        /// Gets the key.
        ///
        /// <value>The key.</value>
        /// <remarks>Should return a Zobrist hash key.</remarks>
        public ulong Key
        {
            get
            {
                return this.GetKey(this.CurrentSquare);
            }
        }

        ///
        /// Gets the color.
        ///
        /// <value>The color.</value>
        public PieceColor Color { get; private set; }

        ///
        /// Gets or sets the current square.
        ///
        /// <value>The current square.</value>
        public int CurrentSquare { get; set; }

        ///
        /// Gets or sets the pin status.
        ///
        /// <value>The pin status.</value>
        public PinStatus PinStatus { get; set; }

        ///
        /// Gets the zobrist hash keys for the specified piece.
        ///
        /// <value>The zobrist hash keys.</value>
        public ZobristHashKeyCollection ZobristHashKeys { get; private set; }

        ///
        /// Gets the Zobrist hash key for this piece at the specified square.
        ///
        /// <param name="square">The square index.</param>
        /// <returns>A unique hash key.</returns>
        public ulong GetKey(int square)
        {
            return this.Color == PieceColor.White
                       ? this.ZobristHashKeys.White[square]
                       : this.ZobristHashKeys.Black[square];
        }
    }
}


text:
Syntax
======

One of the most critical diffrences about APL from most languages is its syntax.

APL reads from right to left because it eliminates parenthesis.

dyadic (infix) and monadic (prefix) are distinct functions.

[insert stages of monodic and dyadic in a real world program]


text:
//
// Copyright (c) 2004-2018 Jaroslaw Kowalski <jaak@jkowalski.net>, Kim Christensen, Julian Verdurmen
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
//   this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution.
//
// * Neither the name of Jaroslaw Kowalski nor the names of its
//   contributors may be used to endorse or promote products derived from this
//   software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//

namespace NLog.UnitTests.MessageTemplates
{
    using System;
    using NLog.MessageTemplates;
    using Xunit;
    using Xunit.Extensions;

    public class ParserTests
    {
        [Theory]
        [InlineData("")]
        [InlineData("Hello {0}")]
        [InlineData("I like my {car}")]
        [InlineData("But when Im drunk I need a {cool} bike")]
        [InlineData("I have {0} {1} {2} parameters")]
        [InlineData("{0} on front")]
        [InlineData(" {0} on front")]
        [InlineData("end {1}")]
        [InlineData("end {1} ")]
        [InlineData("{name} is my name")]
        [InlineData(" {name} is my name")]
        [InlineData("{multiple}{parameters}")]
        [InlineData("I have {{text}} and {{0}}")]
        [InlineData("{{text}}{{0}}")]
        [InlineData(" {{text}}{{0}} ")]
        [InlineData(" {0} ")]
        [InlineData(" {1} ")]
        [InlineData(" {2} ")]
        [InlineData(" {3} {4} {9} {8} {5} {6} {7}")]
        [InlineData(" {{ ")]
        [InlineData("{{ ")]
        [InlineData(" {{")]
        [InlineData(" }} ")]
        [InlineData("}} ")]
        [InlineData(" }}")]
        [InlineData("{0:000}")]
        [InlineData("{aaa:000}")]
        [InlineData(" {@serialize} ")]
        [InlineData(" {$stringify} ")]
        [InlineData(" {alignment,-10} ")]
        [InlineData(" {alignment,10} ")]
        [InlineData(" {0,10} ")]
        [InlineData(" {0,-10} ")]
        [InlineData(" {0,-10:test} ")]
        [InlineData("{{{0:d}}}")]
        [InlineData("{{{0:0{{}")]
        public void ParseAndPrint(string input)
        {
            var template = TemplateParser.Parse(input);

            Assert.Equal(input, template.Rebuild());
        }

        [Theory]
        [InlineData("{0}", 0, null)]
        [InlineData("{001}", 1, null)]
        [InlineData("{9}", 9, null)]
        [InlineData("{1 }", 1, null)]
        [InlineData("{1} {2}", 1, null)]
        [InlineData("{@3} {$4}", 3, null)]
        [InlineData("{3,6}", 3, null)]
        [InlineData("{5:R}", 5, "R")]
        [InlineData("{0:0}", 0, "0")]
        public void ParsePositional(string input, int index, string format)
        {
            var template = TemplateParser.Parse(input);

            Assert.True(template.IsPositional);
            Assert.Equal(format, template.Holes[0].Format);
            Assert.Equal(index, template.Holes[0].Index);
        }

        [Theory]
        [InlineData("{ 0}")]
        [InlineData("{-1}")]
        [InlineData("{1.2}")]
        [InlineData("{42r}")]
        [InlineData("{6} {x}")]
        [InlineData("{a} {x}")]
        public void ParseNominal(string input)
        {
            var template = TemplateParser.Parse(input);

            Assert.False(template.IsPositional);
        }

        [Theory]
        [InlineData("{hello}", "hello")]
        [InlineData("{@hello}", "hello")]
        [InlineData("{$hello}", "hello")]
        [InlineData("{#hello}", "#hello")]
        [InlineData("{  spaces  ,-3}", "  spaces  ")]
        [InlineData("{special!:G})", "special!")]
        [InlineData("{noescape_in_name}}}", "noescape_in_name")]
        [InlineData("{noescape_in_name{{}", "noescape_in_name{{")]
        [InlineData("{0}", "0")]
        [InlineData("{18 }", "18 ")]
        public void ParseName(string input, string name)
        {
            var template = TemplateParser.Parse(input);

            Assert.Equal(name, template.Holes[0].Name);
        }

        [Theory]
        [InlineData("{aaa}", "")]
        [InlineData("{@a}", "@")]
        [InlineData("{@A}", "@")]
        [InlineData("{@8}", "@")]
        [InlineData("{@aaa}", "@")]
        [InlineData("{$a}", "$")]
        [InlineData("{$A}", "$")]
        [InlineData("{$9}", "$")]
        [InlineData("{$aaa}", "$")]
        public void ParseHoleType(string input, string holeType)
        {
            var template = TemplateParser.Parse(input);

            Assert.Single(template.Holes);
            CaptureType captureType = CaptureType.Normal;
            if (holeType == "@")
                captureType = CaptureType.Serialize;
            else if (holeType == "$")
                captureType = CaptureType.Stringify;
            Assert.Equal(captureType, template.Holes[0].CaptureType);
        }

        [Theory]
        [InlineData(" {0,-10:nl-nl} ", -10, "nl-nl")]
        [InlineData(" {0,-10} ", -10, null)]
        [InlineData("{0,  36  }", 36, null)]
        [InlineData("{0,-36  :x}", -36, "x")]
        [InlineData(" {0:nl-nl} ", 0, "nl-nl")]
        [InlineData(" {0} ", 0, null)]
        public void ParseFormatAndAlignment_numeric(string input, int aligment, string format)
        {
            var templates = TemplateParser.Parse(input);
            var hole = templates.Holes[0];

            Assert.Equal("0", hole.Name);
            Assert.Equal(0, hole.Index);
            Assert.Equal(aligment, hole.Alignment);
            Assert.Equal(format, hole.Format);
        }

        [Theory]
        [InlineData(" {car,-10:nl-nl} ", -10, "nl-nl")]
        [InlineData(" {car,-10} ", -10, null)]
        [InlineData(" {car:nl-nl} ", 0, "nl-nl")]
        [InlineData(" {car} ", 0, null)]
        public void ParseFormatAndAlignment_text(string input, int aligment, string format)
        {
            var template = TemplateParser.Parse(input);
            var hole = template.Holes[0];

            Assert.False(template.IsPositional);
            Assert.Equal("car", hole.Name);
            Assert.Equal(aligment, hole.Alignment);
            Assert.Equal(format, hole.Format);
        }

        [Theory]
        [InlineData("Hello {0")]
        [InlineData("Hello 0}")]
        [InlineData("Hello {a:")]
        [InlineData("Hello {a")]
        [InlineData("Hello {a,")]
        [InlineData("Hello {a,1")]
        [InlineData("{")]
        [InlineData("}")]
        [InlineData("}}}")]
        [InlineData("}}}{")]
        [InlineData("{}}{")]
        [InlineData("{a,-3.5}")]
        [InlineData("{a,2x}")]
        [InlineData("{a,--2}")]
        [InlineData("{a,-2")]
        [InlineData("{a,-2 :N0")]
        [InlineData("{a,-2.0")]
        [InlineData("{a,:N0}")]
        [InlineData("{a,}")]
        [InlineData("{a,{}")]
        [InlineData("{a:{}")]
        [InlineData("{a,d{e}")]
        [InlineData("{a:d{e}")]
        public void ThrowsTemplateParserException(string input)
        {
            Assert.Throws<TemplateParserException>(() => TemplateParser.Parse(input));
        }

        [Theory]
        [InlineData(null)]
        public void ThrowsArgumentNullException(string input)
        {
            Assert.Throws<ArgumentNullException>(() => TemplateParser.Parse(input));
        }
    }
}


text:
{-# LANGUAGE FlexibleInstances #-}
module Network.Minio.Data.ByteString
  (
    stripBS
  , UriEncodable(..)
  ) where

import qualified Data.ByteString as B
import qualified Data.ByteString.Builder as BB
import qualified Data.ByteString.Char8 as BC8
import qualified Data.ByteString.Lazy as LB
import           Data.Char (isSpace, toUpper, isAsciiUpper, isAsciiLower, isDigit)
import qualified Data.Text as T
import           Numeric (showHex)

import           Lib.Prelude

stripBS :: ByteString -> ByteString
stripBS = BC8.dropWhile isSpace . fst . BC8.spanEnd isSpace

class UriEncodable s where
  uriEncode :: Bool -> s -> ByteString

instance UriEncodable [Char] where
  uriEncode encodeSlash payload =
    LB.toStrict $ BB.toLazyByteString $ mconcat $
    map (`uriEncodeChar` encodeSlash) payload

instance UriEncodable ByteString where
  -- assumes that uriEncode is passed ASCII encoded strings.
  uriEncode encodeSlash bs =
    uriEncode encodeSlash $ BC8.unpack bs

instance UriEncodable Text where
  uriEncode encodeSlash txt =
    uriEncode encodeSlash $ T.unpack txt

-- | URI encode a char according to AWS S3 signing rules - see
-- UriEncode() at
-- https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html
uriEncodeChar :: Char -> Bool -> BB.Builder
uriEncodeChar '/' True = BB.byteString "%2F"
uriEncodeChar '/' False = BB.char7 '/'
uriEncodeChar ch _
  | isAsciiUpper ch
    || isAsciiLower ch
    || isDigit ch
    || (ch == '_')
    || (ch == '-')
    || (ch == '.')
    || (ch == '~') = BB.char7 ch
  | otherwise = mconcat $ map f $ B.unpack $ encodeUtf8 $ T.singleton ch
  where
    f :: Word8 -> BB.Builder
    f n = BB.char7 '%' <> BB.string7 hexStr
      where
        hexStr = map toUpper $ showHex q $ showHex r ""
        (q, r) = divMod (fromIntegral n) (16::Word8)


text:
'use strict';

/**
 * @summary The properties of a file on a compute node.
  *
 */
class FileProperties {
  /**
   * Create a FileProperties.
   * @member {date} [creationTime] The file creation time. The creation time is
   * not returned for files on Linux compute nodes.
   * @member {date} lastModified The time at which the file was last modified.
   * @member {number} contentLength The length of the file.
   * @member {string} [contentType] The content type of the file.
   * @member {string} [fileMode] The file mode attribute in octal format. The
   * file mode is returned only for files on Linux compute nodes.
   */
  constructor() {
  }

  /**
   * Defines the metadata of FileProperties
   *
   * @returns {object} metadata of FileProperties
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'FileProperties',
      type: {
        name: 'Composite',
        className: 'FileProperties',
        modelProperties: {
          creationTime: {
            required: false,
            serializedName: 'creationTime',
            type: {
              name: 'DateTime'
            }
          },
          lastModified: {
            required: true,
            serializedName: 'lastModified',
            type: {
              name: 'DateTime'
            }
          },
          contentLength: {
            required: true,
            serializedName: 'contentLength',
            type: {
              name: 'Number'
            }
          },
          contentType: {
            required: false,
            serializedName: 'contentType',
            type: {
              name: 'String'
            }
          },
          fileMode: {
            required: false,
            serializedName: 'fileMode',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = FileProperties;


text:
begin
  pit_admin.merge_message_group(
    p_pmg_name => 'CODE_GEN',
    p_pmg_description => 'Parameter für den Code-Generator');

  pit_admin.merge_message(
    p_pms_name => 'INVALID_ANCHOR_NAMES',
    p_pms_text => q'^the following replacement anchors dont adhere to the naming conventions: #1#^',
    p_pms_description => q'^Tow name schemes for replacement anchors are allowed: numeric (#1#, #2# etc.) or according to Oracle naming convention, e.g. as a column name. Assure that all replacement anchor names comply with these conventions.^',
    p_pms_pse_id => 20,
    p_pms_pmg_name => 'CODE_GEN',
    p_pms_pml_name => 'AMERICAN',
    p_error_number => null);

  pit_admin.merge_message(
    p_pms_name => 'MISSING_ANCHORS',
    p_pms_text => q'^The following replacement anchors are missing: #1#^',
    p_pms_description => q'^If configured that way, CodeGenerator expects a replacement char for any replacement anchor. For the given anchors, this wasn't true..^',
    p_pms_pse_id => 20,
    p_pms_pmg_name => 'CODE_GEN',
    p_pms_pml_name => 'AMERICAN',
    p_error_number => null);

  pit_admin.merge_message(
    p_pms_name => 'NO_TEMPLATE',
    p_pms_text => q'^No template found.^',
    p_pms_description => q'^A template that was referenced in the SQL query couldn't be found.^',
    p_pms_pse_id => 30,
    p_pms_pmg_name => 'CODE_GEN',
    p_pms_pml_name => 'AMERICAN',
    p_error_number => null);

  pit_admin.merge_message(
    p_pms_name => 'LOG_CONVERSION',
    p_pms_text => q'^#1#^',
    p_pms_description => q'^Placeholder-Template to pass any log information^',
    p_pms_pse_id => 70,
    p_pms_pmg_name => 'CODE_GEN',
    p_pms_pml_name => 'AMERICAN',
    p_error_number => null);

  pit_admin.merge_message(
    p_pms_name => 'INVALID_PARAMETER_COMBI',
    p_pms_text => q'^indents are allowed only when a delimiter is present.^',
    p_pms_description => q'^Indents are useful only if a delimiter is present. To cirucmvent this, you may define a blank as a delimiter and deduct this from the indent.^',
    p_pms_pse_id => 30,
    p_pms_pmg_name => 'CODE_GEN',
    p_pms_pml_name => 'AMERICAN',
    p_error_number => null);

  pit_admin.create_message_package;
end;
/


text:
/**
 * @fileoverview Tests for listenermap.js.
 * Most of this class functionality is already tested by
 * GoogEventTarget tests. This test file only provides tests
 * for features that are not direct duplicates of tests in
 * GoogEventTarget.
 */

goog.module('goog.events.ListenerMapTest');
goog.setTestOnly();

const EventId = goog.require('goog.events.EventId');
const GoogEventTarget = goog.require('goog.events.EventTarget');
const ListenerMap = goog.require('goog.events.ListenerMap');
const dispose = goog.require('goog.dispose');
const events = goog.require('goog.events');
const testSuite = goog.require('goog.testing.testSuite');

let et;
let map;

const handler1 = () => {};
const handler2 = () => {};
const handler3 = () => {};
const CLICK_EVENT_ID = new EventId(events.getUniqueId('click'));

testSuite({
  setUp() {
    et = new GoogEventTarget();
    map = new ListenerMap(et);
  },

  tearDown() {
    dispose(et);
  },

  testGetTypeCount() {
    assertEquals(0, map.getTypeCount());

    map.add('click', handler1, false);
    assertEquals(1, map.getTypeCount());
    map.remove('click', handler1);
    assertEquals(0, map.getTypeCount());

    map.add(CLICK_EVENT_ID, handler1, false);
    assertEquals(1, map.getTypeCount());
    map.remove(CLICK_EVENT_ID, handler1);
    assertEquals(0, map.getTypeCount());

    map.add('click', handler1, false, true);
    assertEquals(1, map.getTypeCount());
    map.remove('click', handler1, true);
    assertEquals(0, map.getTypeCount());

    map.add(CLICK_EVENT_ID, handler1, false, true);
    assertEquals(1, map.getTypeCount());
    map.remove(CLICK_EVENT_ID, handler1, true);
    assertEquals(0, map.getTypeCount());

    map.add('click', handler1, false);
    map.add('click', handler1, false, true);
    assertEquals(1, map.getTypeCount());
    map.remove('click', handler1);
    assertEquals(1, map.getTypeCount());
    map.remove('click', handler1, true);
    assertEquals(0, map.getTypeCount());

    map.add(CLICK_EVENT_ID, handler1, false);
    map.add(CLICK_EVENT_ID, handler1, false, true);
    assertEquals(1, map.getTypeCount());
    map.remove(CLICK_EVENT_ID, handler1);
    assertEquals(1, map.getTypeCount());
    map.remove(CLICK_EVENT_ID, handler1, true);
    assertEquals(0, map.getTypeCount());

    map.add('click', handler1, false);
    map.add('touchstart', handler2, false);
    map.add(CLICK_EVENT_ID, handler3, false);
    assertEquals(3, map.getTypeCount());
    map.remove(CLICK_EVENT_ID, handler3);
    assertEquals(2, map.getTypeCount());
    map.remove('touchstart', handler2);
    assertEquals(1, map.getTypeCount());
    map.remove('click', handler1);
    assertEquals(0, map.getTypeCount());
  },

  testGetListenerCount() {
    assertEquals(0, map.getListenerCount());

    map.add('click', handler1, false);
    assertEquals(1, map.getListenerCount());
    map.remove('click', handler1);
    assertEquals(0, map.getListenerCount());

    map.add(CLICK_EVENT_ID, handler1, false);
    assertEquals(1, map.getListenerCount());
    map.remove(CLICK_EVENT_ID, handler1);
    assertEquals(0, map.getListenerCount());

    map.add('click', handler1, false, true);
    assertEquals(1, map.getListenerCount());
    map.remove('click', handler1, true);
    assertEquals(0, map.getListenerCount());

    map.add(CLICK_EVENT_ID, handler1, false, true);
    assertEquals(1, map.getListenerCount());
    map.remove(CLICK_EVENT_ID, handler1, true);
    assertEquals(0, map.getListenerCount());

    map.add('click', handler1, false);
    map.add('click', handler1, false, true);
    assertEquals(2, map.getListenerCount());
    map.remove('click', handler1);
    map.remove('click', handler1, true);
    assertEquals(0, map.getListenerCount());

    map.add(CLICK_EVENT_ID, handler1, false);
    map.add(CLICK_EVENT_ID, handler1, false, true);
    assertEquals(2, map.getListenerCount());
    map.remove(CLICK_EVENT_ID, handler1);
    map.remove(CLICK_EVENT_ID, handler1, true);
    assertEquals(0, map.getListenerCount());

    map.add('click', handler1, false);
    map.add('touchstart', handler2, false);
    map.add(CLICK_EVENT_ID, handler3, false);
    assertEquals(3, map.getListenerCount());
    map.remove(CLICK_EVENT_ID, handler3);
    map.remove('touchstart', handler2);
    map.remove('click', handler1);
    assertEquals(0, map.getListenerCount());
  },

  testListenerSourceIsSetCorrectly() {
    map.add('click', handler1, false);
    let listener = map.getListener('click', handler1);
    assertEquals(et, listener.src);

    map.add(CLICK_EVENT_ID, handler2, false);
    listener = map.getListener(CLICK_EVENT_ID, handler2);
    assertEquals(et, listener.src);
  },
});


text:
<?php
include "common.php";
$pattern = "/\\?(.*$)/i";

try
{
	$dbh = new PDO('mysql:host='.$host.';dbname='.$dbname.';charset=utf8', $username, $password);
} catch(PDOException $e)
{
	http_response_code(401);
	trigger_error($e->getMessage());
	die("Database error!");
}

if(empty($_GET['name']) || empty($_GET['swfurl']))
{
	http_response_code(401);
	die();
}
else
{
	if( !preg_match($pattern, $_GET['swfurl'], $matches) )
	{
		trigger_error("Validation error, swfurl did not match pattern.");
		http_response_code(401);
		die("Validation error");
	}
}

try
{
	$sth = $dbh->prepare("SELECT idhash FROM :table WHERE username = :username");
	$sth->execute( array( 'table' => $usertablename, 'username' => $_GET['name'] ) );
	$res = $sth->fetch();
} catch(PDOException $e)
{
	trigger_error($e->getMessage());
	http_response_code(401);
	die("Query error");
}

$row = $res;

if ($matches[1] == $row['idhash'])
{
	http_response_code(200);
	die();
} else {
	http_response_code(402);
	die();
}
?>