text:
<?php

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */

$installer->startSetup();

$installer->run("

-- DROP TABLE IF EXISTS {$this->getTable('poll')};
CREATE TABLE {$this->getTable('poll')} (
  `poll_id` int(10) unsigned NOT NULL auto_increment,
  `poll_title` varchar(255) NOT NULL default '',
  `votes_count` int(10) unsigned NOT NULL default '0',
  `store_id` smallint(6) NOT NULL default '0',
  `date_posted` datetime NOT NULL default '0000-00-00 00:00:00',
  `date_closed` datetime default NULL,
  `active` smallint(6) NOT NULL default '1',
  `closed` tinyint(1) NOT NULL default '0',
  `answers_display` smallint(6) default NULL,
  PRIMARY KEY  (`poll_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert  into {$this->getTable('poll')}(`poll_id`,`poll_title`,`votes_count`,`store_id`,`date_posted`,`date_closed`,`active`,`closed`,`answers_display`) values (1,'What is your favorite color',5,1, NOW(),NULL,1,0,NULL);

-- DROP TABLE IF EXISTS {$this->getTable('poll_answer')};
CREATE TABLE {$this->getTable('poll_answer')} (
  `answer_id` int(10) unsigned NOT NULL auto_increment,
  `poll_id` int(10) unsigned NOT NULL default '0',
  `answer_title` varchar(255) NOT NULL default '',
  `votes_count` int(10) unsigned NOT NULL default '0',
  `answer_order` smallint(6) NOT NULL default '0',
  PRIMARY KEY  (`answer_id`),
  KEY `FK_POLL_PARENT` (`poll_id`),
  CONSTRAINT `FK_POLL_PARENT` FOREIGN KEY (`poll_id`) REFERENCES {$this->getTable('poll')} (`poll_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert  into {$this->getTable('poll_answer')}(`answer_id`,`poll_id`,`answer_title`,`votes_count`,`answer_order`) values (1,1,'Green',4,0),(2,1,'Red',1,0),(3,1,'Black',0,0),(4,1,'Magenta',0,0);

-- DROP TABLE IF EXISTS {$this->getTable('poll_store')};
CREATE TABLE {$this->getTable('poll_store')} (
  `poll_id` int(10) unsigned NOT NULL default '0',
  `store_id` smallint(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`poll_id`,`store_id`),
  CONSTRAINT `FK_POLL_STORE` FOREIGN KEY (`poll_id`) REFERENCES {$this->getTable('poll')} (`poll_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO {$this->getTable('poll_store')} (`poll_id`,`store_id`) VALUES(1,1);
-- DROP TABLE IF EXISTS {$this->getTable('poll_vote')};
CREATE TABLE {$this->getTable('poll_vote')} (
  `vote_id` int(10) unsigned NOT NULL auto_increment,
  `poll_id` int(10) unsigned NOT NULL default '0',
  `poll_answer_id` int(10) unsigned NOT NULL default '0',
  `ip_address` bigint(20) default NULL,
  `customer_id` int(11) default NULL,
  `vote_time` timestamp NOT NULL,
  PRIMARY KEY  (`vote_id`),
  KEY `FK_POLL_ANSWER` (`poll_answer_id`),
  CONSTRAINT `FK_POLL_ANSWER` FOREIGN KEY (`poll_answer_id`) REFERENCES {$this->getTable('poll_answer')} (`answer_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    ");

$installer->endSetup();


text: from van.pg._cluster import Cluster, DatabaseManager

redpajama_set_name: RedPajamaGithub


text:
define([
	"dojo/_base/kernel",
	"dojo/_base/declare",
	"dojo/dom-construct",
	"../core/_Module"
], function(kernel, declare, domConstruct, _Module){
	kernel.deprecated('TitleBar is deprecated', 'Use Bar module instead', '1.3');

/*=====
	return declare(_Module, {
		// summary:
		//		Add title bar for grid.
		// tags:
		//		deprecated. Use Bar module instead.

		// label: String
		label: '',

		setLabel: function(){
			// summary:
			//		TODOC
		}
	});
=====*/

	return declare(_Module, {
		name: 'titleBar',

		constructor: function(){
			this.domNode = domConstruct.create('div', {
				'class': 'gridxTitleBar',
				innerHTML: this.arg('label')
			});
		},

		preload: function(){
			this.grid.vLayout.register(this, 'domNode', 'headerNode', -15);
		},

		destroy: function(){
			this.inherited(arguments);
			domConstruct.destroy(this.domNode);
		},

		label: '',

		setLabel: function(label){
			this.domNode.innerHTML = this.label = label;
		}
	});
});


text:
type T = { method: () => void };
type T = { method(): void };
declare class X { method(): void }
declare function f(): void;
var f: () => void;

declare class X {
  static deserialize(): mixed,
  static deserialize: () => mixed,
}

interface I {
  static(): number;
}


text:
#include "misc/MurmurHash.h"
#include "Lexer.h"

#include "atn/LexerPopModeAction.h"

using namespace antlr4;
using namespace antlr4::atn;
using namespace antlr4::misc;

const Ref<const LexerPopModeAction>& LexerPopModeAction::getInstance() {
  static const Ref<const LexerPopModeAction> instance(new LexerPopModeAction());
  return instance;
}

void LexerPopModeAction::execute(Lexer *lexer) const {
  lexer->popMode();
}

size_t LexerPopModeAction::hashCodeImpl() const {
  size_t hash = MurmurHash::initialize();
  hash = MurmurHash::update(hash, static_cast<size_t>(getActionType()));
  return MurmurHash::finish(hash, 1);
}

bool LexerPopModeAction::equals(const LexerAction &other) const {
  return this == std::addressof(other);
}

std::string LexerPopModeAction::toString() const {
  return "popMode";
}


text:
// -----------------------------------------------------------------------------------------
// <copyright file="AccessCondition.cs" company="Microsoft">
//    Copyright 2013 Microsoft Corporation
//
//    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
//      http://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.
// </copyright>
// -----------------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Storage
{
    using System;
    using System.Diagnostics.CodeAnalysis;

    ///
    /// Represents a set of access conditions to be used for operations against the storage services.
    ///
    public sealed class AccessCondition
    {
        ///
        /// Time for IfModifiedSince.
        ///
        private DateTimeOffset? ifModifiedSinceDateTime;

        ///
        /// Time for IfUnmodifiedSince.
        ///
        private DateTimeOffset? ifNotModifiedSinceDateTime;

        ///
        /// Gets or sets an ETag value for a condition specifying that the given ETag must match the ETag of the specified resource.
        ///
        /// <value>A string containing an ETag value, or <c>"*"</c> to match any ETag. If <c>null</c>, no condition exists.</value>
        public string IfMatchETag
        {
            get;
            set;
        }

        ///
        /// Gets or sets an ETag value for a condition specifying that the given ETag must not match the ETag of the specified resource.
        ///
        /// <value>A string containing an ETag value, or <c>"*"</c> to match any ETag. If <c>null</c>, no condition exists.</value>
        public string IfNoneMatchETag
        {
            get;
            set;
        }

        ///
        /// Gets or sets a <see cref="DateTimeOffset"/> value for a condition specifying a time since which a resource has been modified.
        ///
        /// <value>A <see cref="DateTimeOffset"/> value specified in UTC, or <c>null</c> if no condition exists.</value>
        public DateTimeOffset? IfModifiedSinceTime
        {
            get
            {
                return this.ifModifiedSinceDateTime;
            }

            set
            {
                this.ifModifiedSinceDateTime = value.HasValue ? value.Value.ToUniversalTime() : value;
            }
        }

        ///
        /// Gets or sets a <see cref="DateTimeOffset"/> value for a condition specifying a time since which a resource has not been modified.
        ///
        /// <value>A <see cref="DateTimeOffset"/> value specified in UTC, or <c>null</c> if no condition exists.</value>
        public DateTimeOffset? IfNotModifiedSinceTime
        {
            get
            {
                return this.ifNotModifiedSinceDateTime;
            }

            set
            {
                this.ifNotModifiedSinceDateTime = value.HasValue ? value.Value.ToUniversalTime() : value;
            }
        }

        ///
        /// Gets or sets a value for a condition that specifies the maximum size allowed for an append blob when a new block is committed. The append
        /// will succeed only if the size of the blob after the append operation is less than or equal to the specified size.
        ///
        /// <value>The maximum size in bytes, or <c>null</c> if no value is set.</value>
        /// <remarks>This condition only applies to append blobs.</remarks>
        public long? IfMaxSizeLessThanOrEqual
        {
            get;
            set;
        }

        ///
        /// Gets or sets a value for a condition specifying the byte offset to check for when committing a block to an append blob.
        /// The append will succeed only if the end position is equal to this number.
        ///
        /// <value>An append position number, or <c>null</c> if no value is set.</value>
        /// <remarks>This condition only applies to append blobs.</remarks>
        public long? IfAppendPositionEqual
        {
            get;
            set;
        }

        ///
        /// Gets or sets a value for a condition specifying that the current sequence number must be less than or equal to the specified value.
        ///
        /// <value>A sequence number, or <c>null</c> if no condition exists.</value>
        /// <remarks>This condition only applies to page blobs.</remarks>
        public long? IfSequenceNumberLessThanOrEqual
        {
            get;
            set;
        }

        ///
        /// Gets or sets a value for a condition specifying that the current sequence number must be less than the specified value.
        ///
        /// <value>A sequence number, or <c>null</c> if no condition exists.</value>
        /// <remarks>This condition only applies to page blobs.</remarks>
        public long? IfSequenceNumberLessThan
        {
            get;
            set;
        }

        ///
        /// Gets or sets a value for a condition specifying that the current sequence number must be equal to the specified value.
        ///
        /// <value>A sequence number, or <c>null</c> if no condition exists.</value>
        /// <remarks>This condition only applies to page blobs.</remarks>
        public long? IfSequenceNumberEqual
        {
            get;
            set;
        }

        ///
        /// Gets or sets a lease ID that must match the lease on a resource.
        ///
        /// <value>A string containing a lease ID, or <c>null</c> if no condition exists.</value>
        public string LeaseId
        {
            get;
            set;
        }

        ///
        /// Determines whether the access condition is one of the four conditional headers.
        ///
        /// <value><c>true</c> if the access condition is a conditional header; otherwise, <c>false</c>.</value>
        internal bool IsConditional
        {
            get
            {
                return !string.IsNullOrEmpty(this.IfMatchETag) ||
                    !string.IsNullOrEmpty(this.IfNoneMatchETag) ||
                    this.IfModifiedSinceTime.HasValue ||
                    this.IfNotModifiedSinceTime.HasValue;
            }
        }

        ///
        /// Constructs an empty access condition.
        ///
        /// <returns>An empty <see cref="AccessCondition"/> object.</returns>
        public static AccessCondition GenerateEmptyCondition()
        {
            return new AccessCondition();
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the resource does not exist.
        ///
        /// <returns>An <see cref="AccessCondition"/> object that represents a condition where a resource does not exist.</returns>
        /// <remarks>Setting this access condition modifies the request to include the HTTP If-None-Match conditional header.</remarks>
        public static AccessCondition GenerateIfNotExistsCondition()
        {
            return new AccessCondition { IfNoneMatchETag = "*" };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the resource exists.
        ///
        /// <returns>An <see cref="AccessCondition"/> object that represents a condition where a resource exists.</returns>
        /// <remarks>Setting this access condition modifies the request to include the HTTP If-Match conditional header.</remarks>
        public static AccessCondition GenerateIfExistsCondition()
        {
            return new AccessCondition { IfMatchETag = "*" };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the resource's ETag value
        /// matches the specified ETag value.
        ///
        /// <param name="etag">The ETag value to check against the resource's ETag.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the If-Match condition.</returns>
        public static AccessCondition GenerateIfMatchCondition(string etag)
        {
            return new AccessCondition { IfMatchETag = etag };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the resource has been
        /// modified since the specified time.
        ///
        /// <param name="modifiedTime">A <see cref="DateTimeOffset"/> value specifying the time since which the resource must have been modified.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the If-Modified-Since condition.</returns>
        public static AccessCondition GenerateIfModifiedSinceCondition(DateTimeOffset modifiedTime)
        {
            return new AccessCondition { IfModifiedSinceTime = modifiedTime };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the resource's ETag value
        /// does not match the specified ETag value.
        ///
        /// <param name="etag">The ETag value to check against the resource's ETag, or <c>"*"</c> to require that the resource does not exist.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the If-None-Match condition.</returns>
        /// <remarks>
        /// If <c>"*"</c> is specified for the <paramref name="etag"/> parameter, then this condition requires that the resource does not exist.
        /// </remarks>
        [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "etag", Justification = "Reviewed: etag can be used for identifier names.")]
        public static AccessCondition GenerateIfNoneMatchCondition(string etag)
        {
            return new AccessCondition { IfNoneMatchETag = etag };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the resource has not been
        /// modified since the specified time.
        ///
        /// <param name="modifiedTime">A <see cref="DateTimeOffset"/> value specifying the time since which the resource must not have been modified.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the If-Unmodified-Since condition.</returns>
        public static AccessCondition GenerateIfNotModifiedSinceCondition(DateTimeOffset modifiedTime)
        {
            return new AccessCondition { IfNotModifiedSinceTime = modifiedTime };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the size of the append blob after committing the block is less
        /// than or equal to the specified value.
        ///
        /// <param name="maxSize">An integer specifying the maximum allowed size of the blob, in bytes, when committing a new block.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the maximum allowed size.</returns>
        public static AccessCondition GenerateIfMaxSizeLessThanOrEqualCondition(long maxSize)
        {
            return new AccessCondition { IfMaxSizeLessThanOrEqual = maxSize };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the end position of the append blob is equal to the specified value.
        ///
        /// <param name="appendPosition">An integer specifying the offset to compare to the current end position of the blob.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the offset to compare.</returns>
        public static AccessCondition GenerateIfAppendPositionEqualCondition(long appendPosition)
        {
            return new AccessCondition { IfAppendPositionEqual = appendPosition };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if resource's current sequence
        /// number is less than or equal to the specified value.
        ///
        /// <param name="sequenceNumber">The value to compare to the current sequence number.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the If-Sequence-Number-LE condition.</returns>
        public static AccessCondition GenerateIfSequenceNumberLessThanOrEqualCondition(long sequenceNumber)
        {
            return new AccessCondition { IfSequenceNumberLessThanOrEqual = sequenceNumber };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if resource's current sequence
        /// number is less than the specified value.
        ///
        /// <param name="sequenceNumber">The value to compare to the current sequence number.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the If-Sequence-Number-LT condition.</returns>
        public static AccessCondition GenerateIfSequenceNumberLessThanCondition(long sequenceNumber)
        {
            return new AccessCondition { IfSequenceNumberLessThan = sequenceNumber };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if resource's current sequence
        /// number is equal to the specified value.
        ///
        /// <param name="sequenceNumber">The value to compare to the current sequence number.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the If-Sequence-Number-EQ condition.</returns>
        public static AccessCondition GenerateIfSequenceNumberEqualCondition(long sequenceNumber)
        {
            return new AccessCondition { IfSequenceNumberEqual = sequenceNumber };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the lease ID on the
        /// resource matches the specified lease ID.
        ///
        /// <param name="leaseId">The lease ID to compare to the lease ID of the resource.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the lease condition.</returns>
        public static AccessCondition GenerateLeaseCondition(string leaseId)
        {
            return new AccessCondition { LeaseId = leaseId };
        }

        ///
        /// Constructs an access condition such that an operation will be performed only if the resource's ETag value
        /// matches the specified ETag value and the lease ID on the resource matches the lease ID specified in
        /// the given access condition.
        ///
        /// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param>
        /// <param name="etag">The ETag value that must be matched.</param>
        /// <returns>An <see cref="AccessCondition"/> object that represents the If-Match and the lease conditions.</returns>
        internal static AccessCondition CloneConditionWithETag(AccessCondition accessCondition, string etag)
        {
            return new AccessCondition
            {
                IfMatchETag = etag,
                LeaseId = accessCondition != null ? accessCondition.LeaseId : null,
            };
        }
    }
}


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=constant.PTRACE_LISTEN.html">

Redirecting to constant.PTRACE_LISTEN.html...


text:
function [ API_Frame ] = makeTxFrame( apiFrameIdentifier, FrameID, DstAddr, OptionsByte, Data )
%makeFrame Summary of this function goes here
%   Detailed explanation goes here
API_Frame.apiFrameIdentifier = apiFrameIdentifier;
API_Frame.FrameID            = FrameID;
API_Frame.DstAddr            = DstAddr;
API_Frame.OptionsByte        = OptionsByte;
API_Frame.Data               = Data;

end


text:
package com.facebook.buck.cxx;

import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.FlavorDomain;

public class CxxPrebuiltLibraryBuilder
    extends AbstractCxxBuilder<PrebuiltCxxLibraryDescription.Arg> {

  public CxxPrebuiltLibraryBuilder(
      BuildTarget target,
      FlavorDomain<CxxPlatform> cxxPlatforms) {
    super(new PrebuiltCxxLibraryDescription(cxxPlatforms), target);
  }

  public CxxPrebuiltLibraryBuilder(BuildTarget target) {
    this(target, createDefaultPlatforms());
  }

}


text:
require "rspec/core"
require "rspec-do_action/version"

module Rspec
  module DoAction

    module InstanceMethods
      def do_action(*args)
        expect(action_proc).to_not be_nil, "need define action block"
        instance_exec *args, &action_proc
      end

      def invoke_do_action_once(example, force: false)
        return if !action_proc
        return if !force && skip_do_action?
        return if @do_action_once_invoked

        do_action(example)
        @do_action_once_invoked = true
      end

      def action_proc
        find_variable("@action_proc")
      end

      def skip_do_action?
        !!find_variable("@skip_do_action")
      end

      def find_variable(name)
        group = self.class.parent_groups.find { |group| group.instance_variable_defined?(name) }
        group.instance_variable_get(name) if group
      end
    end

    module ClassMethods
      def action(options = {}, &block)
        @skip_do_action = options[:skip]
        @action_proc = block
      end

      def do_action(options = {}, &block)
        @skip_do_action = false
        action(options, &block) if block
        before { |example| invoke_do_action_once(example, force: true) }
      end

      def skip_do_action
        @skip_do_action = true
      end
    end
  end
end

class RSpec::Core::Example
  def run_before_example_with_action(*args)
    run_before_example_without_action
    example_group_instance.send(:invoke_do_action_once, self, force: false)
  end

  if private_method_defined?(:run_before_example)
    alias_method :run_before_example_without_action, :run_before_example
    alias_method :run_before_example, :run_before_example_with_action
  else
    alias_method :run_before_example_without_action, :run_before_each
    alias_method :run_before_each, :run_before_example_with_action
  end
end

RSpec.configure do |config|
  config.include Rspec::DoAction::InstanceMethods
  config.extend Rspec::DoAction::ClassMethods
end


text:
import "reflect-metadata";
import {expect} from "chai";
import {Post} from "./entity/Post";
import {Connection} from "../../../src/connection/Connection";
import {createTestingConnections} from "../../utils/test-utils";

describe("sqljs driver > autosave", () => {
    let connections: Connection[];
    let saves = 0;
    const callback = (database: Uint8Array) => {
        saves++;
    };

    before(async () => connections = await createTestingConnections({
        entities: [Post],
        schemaCreate: true,
        enabledDrivers: ["sqljs"],
        driverSpecific: {
            autoSaveCallback: callback,
            autoSave: true
        }
    }));

    it("should call autoSaveCallback on insert, update and delete", () => Promise.all(connections.map(async connection => {
        let posts = [
            {
                title: "second post"
            },
            {
                title: "third post"
            }
        ];

        await connection.createQueryBuilder().insert().into(Post).values(posts).execute();
        await connection.createQueryBuilder().update(Post).set({title: "Many posts"}).execute();
        await connection.createQueryBuilder().delete().from(Post).where("title = ?", {title: "third post"}).execute();

        const repository = connection.getRepository(Post);
        let post = new Post();
        post.title = "A post";
        await repository.save(post);

        let savedPost = await repository.findOne({title: "A post"});

        expect(savedPost).not.to.be.undefined;

        if (savedPost) {
            savedPost.title = "A updated post";
            await repository.save(savedPost);
            await repository.remove(savedPost);
        }

        await connection.close();

        expect(saves).to.be.equal(7);
    })));
});

describe("sqljs driver > autosave off", () => {
    let connections: Connection[];
    let saves = 0;
    const callback = (database: Uint8Array) => {
        saves++;
    };

    before(async () => connections = await createTestingConnections({
        entities: [Post],
        schemaCreate: true,
        enabledDrivers: ["sqljs"],
        driverSpecific: {
            autoSaveCallback: callback,
            autoSave: false
        }
    }));

    it("should not call autoSaveCallback when autoSave is disabled", () => Promise.all(connections.map(async connection => {
        const repository = connection.getRepository(Post);
        let post = new Post();
        post.title = "A post";
        await repository.save(post);

        let savedPost = await repository.findOne({title: "A post"});

        expect(savedPost).not.to.be.undefined;

        if (savedPost) {
            savedPost.title = "A updated post";
            await repository.save(savedPost);
            await repository.remove(savedPost);
        }

        await connection.close();

        expect(saves).to.be.equal(0);
    })));
});


text:
package net.nightpool.bukkit.uhcplugin.game;

import net.nightpool.bukkit.uhcplugin.UHCPlugin;
import net.nightpool.bukkit.uhcplugin.config.SubConfig;
import net.nightpool.bukkit.uhcplugin.game.UHCRuleset.RulesetConfig;

import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;

@RulesetConfig(config = ScatterRules.ScatterRulesConfig.class, key = "scatter")
public class ScatterRules extends UHCRuleset implements Listener{

    public ScatterRules(UHCGame game, UHCPlugin p) {
        super(game, p);
    }

    @Override
    public void onStart(){
        if(!game.rulesets.containsKey(DefaultRules.class)){
            p.getLog().warning("Scatter ruleset enabled without Default ruleset. Doing nothing.");
            return;
        }
        DefaultRules default_rules = (DefaultRules) game.rulesets.get(DefaultRules.class);
        double mag = default_rules.currentBorder.getRadiusX()*0.5;
        double angle = Math.PI*2/game.players.size();
        double inc = angle;
        Location d;
        for(OfflinePlayer o : game.players){
            if(!o.isOnline())
                continue;
            Player p = o.getPlayer();
            d = default_rules.center.clone().add(Math.cos(angle)*mag, 0, Math.sin(angle)*mag);
            p.teleport(d.getWorld().getHighestBlockAt(d).getLocation(d));
            angle += inc;
        }
    }

    @Override
    public void onUnload() {}

    public static class ScatterRulesConfig extends SubConfig {
        public ScatterRulesConfig(ConfigurationSection fromSection) {
            fromConfig(fromSection);
        }
    }
}


text:
package org.apache.fineract.infrastructure.configuration.api;

import java.util.Collection;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;

import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.configuration.data.ExternalServicesPropertiesData;
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesPropertiesReadPlatformService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Path("/externalservice")
@Component
@Scope("singleton")
public class ExternalServicesConfigurationApiResource {

    private final PlatformSecurityContext context;
    private final ExternalServicesPropertiesReadPlatformService externalServicePropertiesReadPlatformService;
    private final ToApiJsonSerializer<ExternalServicesPropertiesData> toApiJsonSerializer;
    // private final ToApiJsonSerializer<S3CredentialsData>
    // s3ToApiJsonSerializer;
    private final ApiRequestParameterHelper apiRequestParameterHelper;
    private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;

    @Autowired
    public ExternalServicesConfigurationApiResource(final PlatformSecurityContext context,
            final ExternalServicesPropertiesReadPlatformService readPlatformService,
            final ToApiJsonSerializer<ExternalServicesPropertiesData> toApiJsonSerializer,
            final ApiRequestParameterHelper apiRequestParameterHelper,
            final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
        this.context = context;
        this.externalServicePropertiesReadPlatformService = readPlatformService;
        this.toApiJsonSerializer = toApiJsonSerializer;
        // this.s3ToApiJsonSerializer = s3ToApiJsonSerializer;
        this.apiRequestParameterHelper = apiRequestParameterHelper;
        this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
    }

    @GET
    @Path("{servicename}")
    @Consumes({ MediaType.APPLICATION_JSON })
    @Produces({ MediaType.APPLICATION_JSON })
    public String retrieveOne(@PathParam("servicename") final String serviceName, @Context final UriInfo uriInfo) {
        this.context.authenticatedUser().validateHasReadPermission(ExternalServiceConfigurationApiConstant.EXTERNAL_SERVICE_RESOURCE_NAME);
        final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
        final Collection<ExternalServicesPropertiesData> externalServiceNVPs = this.externalServicePropertiesReadPlatformService
                .retrieveOne(serviceName);
        return this.toApiJsonSerializer.serialize(settings, externalServiceNVPs,
                ExternalServiceConfigurationApiConstant.EXTERNAL_SERVICE_CONFIGURATION_DATA_PARAMETERS);
    }

    @PUT
    @Path("{servicename}")
    @Consumes({ MediaType.APPLICATION_JSON })
    @Produces({ MediaType.APPLICATION_JSON })
    public String updateExternalServiceProperties(@PathParam("servicename") final String serviceName, final String apiRequestBodyAsJson) {
        // ExternalServicesData external =
        // this.externalServiceReadPlatformService.getExternalServiceDetailsByServiceName(serviceName);
        final CommandWrapper commandRequest = new CommandWrapperBuilder().updateExternalServiceProperties(serviceName)
                .withJson(apiRequestBodyAsJson).build();
        final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
        return this.toApiJsonSerializer.serialize(result);

    }
}


text:
<?php

namespace Functional\Tests;

use ArrayIterator;
use Functional\Exceptions\InvalidArgumentException;

use function Functional\reject;

class RejectTest extends AbstractTestCase
{
    public function setUp(): void
    {
        parent::setUp();
        $this->list = ['value', 'wrong', 'value'];
        $this->listIterator = new ArrayIterator($this->list);
        $this->hash = ['k1' => 'value', 'k2' => 'wrong', 'k3' => 'value'];
        $this->hashIterator = new ArrayIterator($this->hash);
    }

    public function test(): void
    {
        $fn = function ($v, $k, $collection) {
            InvalidArgumentException::assertCollection($collection, __FUNCTION__, 3);
            return $v == 'wrong' && \strlen($k) > 0;
        };
        self::assertSame([0 => 'value', 2 => 'value'], reject($this->list, $fn));
        self::assertSame([0 => 'value', 2 => 'value'], reject($this->listIterator, $fn));
        self::assertSame(['k1' => 'value', 'k3' => 'value'], reject($this->hash, $fn));
        self::assertSame(['k1' => 'value', 'k3' => 'value'], reject($this->hashIterator, $fn));
    }

    public function testPassNonCallable(): void
    {
        $this->expectCallableArgumentError('Functional\reject', 2);
        reject($this->list, 'undefinedFunction');
    }

    public function testPassNoCallable(): void
    {
        self::assertSame([], reject($this->list));
        self::assertSame([], reject($this->listIterator));
        self::assertSame([], reject($this->hash));
        self::assertSame([], reject($this->hashIterator));
        self::assertSame([1 => false], reject([true, false, true]));
    }

    public function testPassNoCollection(): void
    {
        $this->expectArgumentError('Functional\reject() expects parameter 1 to be array or instance of Traversable');
        reject('invalidCollection', 'strlen');
    }

    public function testExceptionIsThrownInArray(): void
    {
        $this->expectException('DomainException');
        $this->expectExceptionMessage('Callback exception');
        reject($this->list, [$this, 'exception']);
    }

    public function testExceptionIsThrownInHash(): void
    {
        $this->expectException('DomainException');
        $this->expectExceptionMessage('Callback exception');
        reject($this->hash, [$this, 'exception']);
    }

    public function testExceptionIsThrownInIterator(): void
    {
        $this->expectException('DomainException');
        $this->expectExceptionMessage('Callback exception');
        reject($this->listIterator, [$this, 'exception']);
    }

    public function testExceptionIsThrownInHashIterator(): void
    {
        $this->expectException('DomainException');
        $this->expectExceptionMessage('Callback exception');
        reject($this->hashIterator, [$this, 'exception']);
    }
}


text:
<?php

namespace Yoast\WP\SEO\Integrations\Blocks;

use Yoast\WP\SEO\Integrations\Integration_Interface;

/**
 * Dynamic_Block class.
 */
abstract class Dynamic_Block implements Integration_Interface {

	/**
	 * The name of the block.
	 *
	 * @var string
	 */
	protected $block_name;

	/**
	 * The editor script for the block.
	 *
	 * @var string
	 */
	protected $script;

	/**
	 * {@inheritDoc}
	 */
	public static function get_conditionals() {
		return [];
	}

	/**
	 * {@inheritDoc}
	 */
	public function register_hooks() {
		\add_action( 'init', [ $this, 'register_block' ], 11 );
	}

	/**
	 * Registers the block.
	 *
	 * @return void
	 */
	public function register_block() {
		\register_block_type(
			'yoast-seo/' . $this->block_name,
			[
				'editor_script'   => $this->script,
				'render_callback' => [ $this, 'present' ],
				'attributes'      => [
					'className' => [
						'default' => '',
						'type'    => 'string',
					],
				],
			]
		);
	}

	/**
	 * Presents the block output. This is abstract because in the loop we need to be able to build the data for the
	 * presenter in the last moment.
	 *
	 * @param array $attributes The block attributes.
	 *
	 * @return string The block output.
	 */
	abstract public function present( $attributes );
}


text:
主数据表

配置区

    {{each dim.date as $cube i}}

        {{cubes[$cube.cubeId].name}}

        {{if $cube.children[0].relationTable === "0" || $cube.children[0].relationTable === "ownertable"}}

                选择被关联表:
                <select class="j-relation-table-select">
                    <option value="0">请选择</option>
                    <option value="ownertable"
                    {{if $cube.children[0].relationTable==="ownertable"}}
                    selected = "selected"{{/if}}>内置表</option>
                    {{each dateRelationTables as $dateRelationTable j}}
                    <option value={{$dateRelationTable.name}}>{{$dateRelationTable.comment}}</option>
                    {{/each}}
                </select>

                选择时间字段:
                <select>
                    <option value="0">请选择</option>
                    {{each cubes[$cube.cubeId].currDims as $dim}}
                    <option value={{$dim.name}}
                    {{if $dim.name === $cube.children[0].currDim}}selected="selected"
                    {{/if}}>{{$dim.comment}}
                    </option>
                    {{/each}}
                </select>
                粒度:
                <select class="j-owner-date-level-select">
                    <option value="0">请选择</option>
                    {{each defaultDate.level as $level}}
                    <option value={{$level.id}}
                    {{if $level.id === $cube.children[0].field}}selected="selected"
                    {{/if}}>{{$level.name}}
                    </option>
                    {{/each}}
                </select>
                时间格式:
                <select class="j-owner-date-type-select">
                    <option value="0">请选择</option>
                    {{each defaultDate.level as $level}}
                    {{if $level.id === $cube.children[0].field}}
                    {{each defaultDate.dateFormatOptions[$cube.children[0].field] as $format}}
                    <option value={{$format}}
                    {{if $format === $cube.children[0].format}}selected="selected"
                    {{/if}}>{{$format}}</option>
                    {{/each}}
                    {{/if}}
                    {{/each}}
                </select>

        {{else}}

                选择被关联表:

                <select class="j-relation-table-select">
                    <option value="0">请选择</option>
                    <option value="ownertable"
                    {{if $cube.children[0].relationTable==="ownertable"}}
                    selected = "selected"{{/if}}>内置表</option>
                    {{each dateRelationTables as $dateRelationTable j}}
                    <option value={{$dateRelationTable.id}}
                    {{if $dateRelationTable.id === $cube.children[0].relationTable}}
                    selected = "selected"
                    {{/if}}>{{$dateRelationTable.name}}</option>
                    {{/each}}
                </select>

                指定关联字段:
                <select>
                    <option value="0">请选择</option>
                    {{each cubes[$cube.cubeId].currDims as $dim}}
                    <option value={{$dim.id}}
                    {{if $dim.id === $cube.children[0].currDim}}selected="selected"
                    {{/if}}>{{$dim.name}}
                    </option>
                    {{/each}}
                </select>
                =

                <select>
                    <option value="0">请选择</option>
                    {{each dateRelationTables as $dateRelationTable}}
                    {{if $dateRelationTable.id === $cube.children[0].relationTable}}
                    {{each $dateRelationTable.fields as $field}}
                    <option value={{$field.id}}
                    {{if $field.id === $cube.children[0].field}}selected="selected"
                    {{/if}}>{{$field.name}}
                    </option>
                    {{/each}}
                    {{/if}}
                    {{/each}}
                </select>

                日期格式:

                    {{each dateRelationTables as $dateRelationTable}}
                    {{if $dateRelationTable.id === $cube.children[0].relationTable}}
                    {{each $dateRelationTable.fields as $field}}

                        {{$field.name}}
                        <select>
                            <option value="0">请选择</option>
                            {{each $dateRelationTable.dateFormatOptions[$field.id] as $format}}
                            <option value="{{$format}}" {{if $format === $cube.children[0].dateLevel[$field.id]}} selected="selected" {{/if}}>{{$format}}
                            </option>
                            {{/each}}
                        </select>

                    {{/each}}
                    {{/if}}
                    {{/each}}

        {{/if}}

   {{/each}}


text:
package com.ottogroup.bi.spqr.pipeline.component.emitter;

import com.ottogroup.bi.spqr.pipeline.component.MicroPipelineComponent;
import com.ottogroup.bi.spqr.pipeline.message.StreamingDataMessage;

/**
 * To be implemented by all {@link MicroPipelineComponent micro pipeline components} that export data
 * to any destination, eg. Kafka, ElasticSearch or file system
 * @author mnxfst
 * @since Dec 15, 2014
 */
public interface Emitter extends MicroPipelineComponent {

	/**
	 * Provides a new message to the operator
	 * @param message
	 */
	public boolean onMessage(final StreamingDataMessage message);

	/**
	 * Returns the total number of messages processed by this component
	 * @return
	 */
	public long getTotalNumOfMessages();

}


text: When you paste a text block into your code, IDEA helps you by autoindenting it to fit the new location.


text:
Repositext Validation
=====================

A command-line tool to validate repositext documents.

Installation (while in development)
-----------------------------------

* Install Ruby 2.0 using rbenv or rvm.
* Install the bundler gem: `gem install bundler`
* Clone the repository from github.com
* Switch into the repositext-validation directory: `cd repositext-validation`
* Install the required gems: `bundle install`

Concepts
--------

### Validator

A validator checks a File or a FileSet for certain qualities. There are two
types of Validators:

* Validator - validates single files, e.g., file encoding, syntax and contents.
* FileSetValidator - validates file sets, e.g., consistency between files, and
  presence of expected files.

### File and FileSet

Validators operate either on single files or file sets. E.g., a File can be
validated for UTF8 encoding, or a File Set can consist of an IDML import source
file and the resulting kramdown file. A File Set Validator would then validate
that both files are consistent.

### Profile

A Profile is used to define the validation run-list. A Profile determines:

* Which Files or FileSets are being validated.
* Which Validators are applied.
* How those validators are configured.

There are two types of Profiles:

* FileProfile - defines validation workflows for single Files.
* FileSetProfile - defines validation workflows for FileSets.

Given a FilePattern, repositext-validation tries to find a default Profile to
use for validation. The Profile used can be overridden via a command line param.
If FilePattern describes a ...

* single file, then a FileProfile will be applied.
* set of files, then a FileSetProfile will be applied.

### FilePattern

You can use file patterns to select which files you want to validate. You can
use all features of [Ruby's Dir.glob method](http://ruby-doc.org/core-2.0.0/Dir.html#method-c-glob).

When providing a relative file pattern, the current directory will be used as
base directory.

**IMPORTANT NOTE**: When using glob patterns, it is important that you surround
the pattern with quotes. Otherwise the shell will evaluate the pattern and you
will likely only validate a single file (the first one that matches the pattern).

Usage
-----

### The simplest way to use repositext-validation:

Validate all documents in the current directory:

    repositext-validation

### Command line options overview

You can use the following command line options to configure repositext-validation:

|Short| Long                       |Description|
|-----|----------------------------|-----------|
| -f  | --file_pattern PATTERN     | a file pattern that describes which files should be validated; optional, has reasonable defaults based on current directory. |
| -p  | --profile_override PROFILE | which profile to use; optional, has reasonable defaults based on scope and file_pattern. |
| -V  | --version                  | Print version and exit. Please note that this is an upper case 'V'. |
| -h  | --help                     | Show help and exit. |

### FilePattern command line option

#### Examples

Validate a single file:

    bundle exec repositext-validation -f ../docs/a_document.at

Validate all files in a directory:

    bundle exec repositext-validation -f '../docs/*'

Validate all AT files in a directory:

    bundle exec repositext-validation -f '../docs/*.at'

Recursively validate all json files starting at the top level directory:

    bundle exec repositext-validation -f '../docs/**/*.json'

Validate all AT and PT files in a directory:

    bundle exec repositext-validation -f '../docs/*.{at,md}'

#### File pattern reference

| Pattern | Example        | Description |
|---------|----------------|-------------|
| *       | docs/*         | Matches any file. Can be restricted by other values in the glob. * will match all files; c* will match all files beginning with c; *c will match all files ending with c; and *c* will match all files that have c in them (including at the beginning or end). Equivalent to / .* /x in regexp. Note, this will not match Unix-like hidden files (dotfiles). In order to include those in the match results, you must use something like "{*,.*}". |
| **      | docs/**/*      | Matches directories recursively. This will walk all sub-directories of the directory tree. |
| ?       | doc_?.at       | Matches any one character. Equivalent to /.{1}/ in regexp. |
| [set]   | doc_[ab].*     | Matches any one character in set. Behaves exactly like character sets in Regexp, including set negation ([^a-z]). |
| {p,q}   | *.{at,md}      | Matches either literal p or literal q. Matching literals may be more than one character in length. More than two literals may be specified. Equivalent to pattern alternation in regexp. |
| \       | question\?.txt | Escapes the next metacharacter. Note that this means you cannot use backslash in windows as part of a glob, i.e. Dir["c:\foo*"] will not work, use Dir["c:/foo*"] instead. |

See [Ruby Dir.glob documentation](http://ruby-doc.org/core-2.0.0/Dir.html#method-c-glob) for more info.

### Profile override command line option

When overriding the profile, just provide the name of the subclass without any
namespaces. Example: for `Repositext::Validation::FileProfile::TxtDefault` just
provide `TxtDefault`.

#### Example

Provide a profile override

    bundle exec repositext-validation -f ../docs/*.at -p CustomAtProfile

### Other command line options

#### Example

Get the version

    bundle exec repositext-validation -V

Get help

    bundle exec repositext-validation -h

### Custom Profiles

Repositext-validation comes with reasonable defaults for the common use cases.
If you want to customize a profile, follow these steps:

1. Determine the scope of the Profile: `File` or `FileSet`.
2. Duplicate one of the existing profiles in the scope you picked.
3. Change the name and customize the following methods:
      * `def self.can_handle_file_pattern?` - this class method
        returns `true` for any file patterns it can handle.
      * `def run` - this instance method invokes all validations that will be
        run for this profile.
4. When using the command-line tool, provide your custom profile as a profile
   override.

There is no need to register the new profile. It will be detected automatically
by the FileProfile or FileSetProfile class via the `inherited` callback.

### Custom Validations

Follow these steps to create a custom validation:

1. Determine the scope of the Validation: `File` or `FileSet`.
2. Duplicate one of the existing validations in the scope you picked.
3. Change the name and customize the following methods:
      * `def run` - this instance method invokes all validation helper methods
        and adds any errors or warnings to the profile's error collector.
4. Create a custom profile that will invoke the new custom validation.

Specs
-----

Run the entire spec suite:

    bundle exec rake

Run a single spec file:

    bundle exec ruby spec/file_validator/encoding_utf8_spec.rb


text: Place to hold literature to link to on the website.


text:
{{{
  "title": "Update Anti-Affinity Policy",
  "date": "11-20-2014",
  "author": "Bryan Friedman",
  "attachments": []
}}}

Updates the name of an anti-affinity policy in a given account. Calls to this operation must include a token acquired from the authentication endpoint. See the [Login API](../Authentication/login.md) for information on acquiring this token.

### When to Use It

Use this API operation when you want to change the name of an existing anti-affinity policy within a given account.

## URL

### Structure

    PUT https://api.ctl.io/v2/antiAffinityPolicies/{accountAlias}/{policyId}

### Example

    PUT https://api.ctl.io/v2/antiAffinityPolicies/ALIAS/80a7bf90b199454b859399bff54f4173

## Request

### URI Parameters

| Name | Type | Description | Req. |
| --- | --- | --- | --- |
| AccountAlias | string | Short code for a particular account | Yes |
| PolicyId | string | ID of the anti-affinity policy being updated. | Yes |

### Content Properties

| Name | Type | Description | Req. |
| --- | --- | --- | --- |
| name | string | Name of the anti-affinity policy. | Yes |

### Examples

#### JSON

    {
      "name":"Changed Name of Anti-Affinity Policy",
    }

## Response

### Entity Definition

| Name | Type | Description |
| --- | --- | --- |
| id | string | ID of the anti-affinity policy. |
| name | string | New name of the anti-affinity policy. |
| location | string | Data center location of the anti-affinity policy. |
| links | array | Collection of [entity links](../Getting Started/api-v20-links-framework.md) that point to resources related to this policy. |

### Examples

#### JSON

    {
      "id":"80a7bf90b199454b859399bff54f4173",
      "name":"My Anti-Affinity Policy",
      "location":"VA1",
      "links":[
        {
          "rel":"self",
          "href":"/v2/antiAffinityPolicies/alias/80a7bf90b199454b859399bff54f4173"
        },
        {
          "rel":"server",
          "href":"/v2/servers/alias/va1aliashypsc01",
          "id":"va1aliashypsc01",
          "name":"VA1ALIASHYPSC01"
        }
      ]
    }


text:
#ifndef BOOST_MPL_REVERSE_HPP_INCLUDED
#define BOOST_MPL_REVERSE_HPP_INCLUDED

// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.

// $Source: /cvsroot/boost/boost/boost/mpl/reverse.hpp,v $
// $Date: 2004/09/02 15:40:42 $
// $Revision: 1.5 $

#include <boost/mpl/copy.hpp>
#include <boost/mpl/aux_/na_spec.hpp>

namespace boost { namespace mpl {

template<
      typename BOOST_MPL_AUX_NA_PARAM(Sequence)
    , typename BOOST_MPL_AUX_NA_PARAM(Inserter)
    >
struct reverse
    : reverse_copy<
          Sequence
        , Inserter
        >
{
};

BOOST_MPL_AUX_NA_SPEC(1, reverse)

}}

#endif // BOOST_MPL_REVERSE_HPP_INCLUDED


text:
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';

import { RunnerNameSearchService } from './runner-name-search.service';
import { Runner } from './runner';

@Component({
    moduleId: module.id,
    selector: 'runner-name-search',
    templateUrl: 'runner-name-search.component.html',
    providers: [RunnerNameSearchService]
})

export class RunnerNameSearchComponent implements OnInit {
runners: Observable<Runner[]>;
private searchTerms = new Subject<string>();

constructor(
    private RunnerNameSearchService: RunnerNameSearchService,
    private router:Router){}

    search(term: string): void {
        this.searchTerms.next(term);
    }

    ngOnInit(): void {
        this.runners = this.searchTerms.debounceTime(300).distinctUntilChanged()
        .switchMap(term => term
                        ? this.RunnerNameSearchService.search(term)
                        : Observable.of<Runner[]>([])).catch(error => {
                        console.log(error);
                        return Observable.of<Runner[]>([]);
                        });
    }

        gotoDetail(runner: Runner): void {
            let link = ['/detail',runner.id];
            this.router.navigate(link);
        }
    }


text:
import Omi from 'omi/dist/omi'
import Hello from './hello'
import './index.css'
import './omi-weui.min.css'

if(module.hot) {
    module.hot.accept();
}

Omi.render(new Hello({ name:"Omi-WeUI" }),"body");


text:
package com.elmakers.mine.bukkit.configuration;

import java.util.Map;
import javax.annotation.Nullable;

import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.ConfigurationOptions;
import org.bukkit.configuration.ConfigurationSection;

public class TranslatingConfiguration extends TranslatingConfigurationSection implements Configuration {
    private static class Options extends ConfigurationOptions {
        protected Options(Configuration configuration) {
            super(configuration);
        }
    }

    private Options options;

    public TranslatingConfiguration() {
        super();
    }

    @Nullable
    @Override
    public ConfigurationSection getParent() {
        return null;
    }

    @Override
    public void addDefaults(Map<String, Object> map) {
    }

    @Override
    public void addDefaults(Configuration configuration) {
    }

    @Override
    public void setDefaults(Configuration configuration) {
    }

    @Nullable
    @Override
    public Configuration getDefaults() {
        return null;
    }

    @Override
    public ConfigurationOptions options() {
        if (options == null) {
            options = new Options(this);
        }

        return options;
    }
}


text:
$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "")
Write-Host -Object "Running $PSCommandPath" -ForegroundColor Cyan
. "$PSScriptRoot\constants.ps1"

Describe "$CommandName Unit Tests" -Tag 'UnitTests' {
    Context "Validate parameters" {
        [object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')}
        [object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'ExcludeDatabase', 'SinceCreation', 'SinceLastExecution', 'ExcludeEmptyQueryPlan', 'Force', 'EnableException'
        $knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters
        It "Should only contain our specific parameters" {
            (@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0
        }
    }
}

Describe "$commandname Integration Tests" -Tags "IntegrationTests" {

    Context "Gets Execution Plan" {
        $results = Get-DbaExecutionPlan -SqlInstance $script:instance2 | Where-Object {$_.statementtype -eq 'SELECT'} | Select-object -First 1
        It "Gets results" {
            $results | Should Not Be $null
        }
        It "Should be enabled" {
            $results.CardinalityEstimationModelVersion | Should Be 130
        }
    }
    Context "Gets Execution Plan when using -Database" {
        $results = Get-DbaExecutionPlan -SqlInstance $script:instance2 -Database Master | Select-object -First 1
        It "Gets results" {
            $results | Should Not Be $null
        }
        It "Should be enabled" {
            $results.CardinalityEstimationModelVersion | Should Be 130
        }
        It "Should be execution plan on Master" {
            $results.DatabaseName | Should Be 'Master'
        }
    }
    Context "Gets no Execution Plan when using -ExcludeDatabase" {
        $results = Get-DbaExecutionPlan -SqlInstance $script:instance2 -ExcludeDatabase Master | Select-object -First 1
        It "Gets results" {
            $results | Should Not Be $null
        }
        It "Should be enabled" {
            $results.CardinalityEstimationModelVersion | Should Be 130
        }
        It "Should be execution plan on Master" {
            $results.DatabaseName | Should Not Be 'Master'
        }
    }
    Context "Gets Execution Plan when using -SinceCreation" {
        $results = Get-DbaExecutionPlan -SqlInstance $script:instance2 -Database Master -SinceCreation '01-01-2000' | Select-object -First 1
        It "Gets results" {
            $results | Should Not Be $null
        }
        It "Should be enabled" {
            $results.CardinalityEstimationModelVersion | Should Be 130
        }
        It "Should be execution plan on Master" {
            $results.DatabaseName | Should Be 'Master'
        }
        It "Should have a creation date Greater than 01-01-2000" {
            $results.CreationTime | Should BeGreaterThan '01-01-2000'
        }
    }
    Context "Gets Execution Plan when using -SinceLastExecution" {
        $results = Get-DbaExecutionPlan -SqlInstance $script:instance2 -Database Master -SinceLastExecution '01-01-2000' | Select-object -First 1
        It "Gets results" {
            $results | Should Not Be $null
        }
        It "Should be enabled" {
            $results.CardinalityEstimationModelVersion | Should Be 130
        }
        It "Should be execution plan on Master" {
            $results.DatabaseName | Should Be 'Master'
        }
        It "Should have a execution time Greater than 01-01-2000" {
            $results.LastExecutionTime | Should BeGreaterThan '01-01-2000'
        }
    }
    Context "Gets Execution Plan when using -ExcludeDatabase" {
        $results = Get-DbaExecutionPlan -SqlInstance $script:instance2 -ExcludeEmptyQueryPlan
        It "Gets no results" {
            $results | Should Not Be $null
        }
    }
}


text:
require 'spec_helper'

describe Rubella::Output::Base, '.new' do

  it "creates a new Rubella::Output" do
    output = Rubella::Output::Base.new nil, nil

    expect(output).to be_kind_of(Rubella::Output::Base)
  end

  it "uses the given data" do
    output = Rubella::Output::Implementation.new Rubella::Storage.new([]), nil

    expect(output.data).to be_kind_of(Rubella::Storage)
    expect(output.data.data).to eq([])
  end

  it "uses the given field_size" do
    output = Rubella::Output::Base.new nil, 5

    expect(output.field_size).to eq(5)
  end

end

class Rubella::Output::Implementation < Rubella::Output::Base
  attr_reader :data
end


text:
var $ = require('jquery');

function parseUserJson(userJson) {
  return {
    loggedIn: true,
    fullName: userJson.firstName + ' ' + userJson.lastName
  };
};

function fetchCurrentUser(callback) {
  return $.ajax({
    type: 'GET',
    url: 'http://example.com/currentUser',
    done: function(userJson) {
      callback(parseUserJson(userJson));
    }
  });
};

module.exports = fetchCurrentUser;


text:
namespace SidWatch.Library.Configuration
{
    public class AWSConfig
    {
        public string Bucket { get; set; }
        public string AccessKey { get; set; }
        public string SecretKey { get; set; }
    }
}


text:
package tw.showang.recycleradapterbase.example.api;

import android.util.Log;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;

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

import tw.showang.recycleradapterbase.example.api.GitHubSearchRepoApi.SearchResult;
import tw.showang.recycleradapterbase.example.api.GitHubUserRepoApi.GetRepoResult;
import tw.showang.recycleradapterbase.example.api.base.ApiException;
import tw.showang.recycleradapterbase.example.api.base.ExampleApiBase;

public class GitHubSearchRepoApi extends ExampleApiBase<GitHubSearchRepoApi, SearchResult> {

	private int mPage;
	private String mKeyword;

	public GitHubSearchRepoApi keyword(String keyword, int page) {
		mKeyword = keyword;
		mPage = page;
		return this;
	}

	@Override
	public void getParameter(Map<String, String> parameterMap) {
		parameterMap.put("q", mKeyword);
		parameterMap.put("page", String.valueOf(mPage));
	}

	@Override
	protected SearchResult parseResult(Gson gson, String result) throws ApiException {
		Log.e("SearchRepoApi", result);
		return gson.fromJson(result, SearchResult.class);
	}

	@Override
	public int getHttpMethod() {
		return HttpMethod.GET;
	}

	@Override
	public String getUrl() {
		return getBaseUri() + "/search/repositories";
	}

	public class SearchResult {
		@SerializedName("total_count")
		public int totalCount;
		@SerializedName("items")
		public List<GetRepoResult> repoList;

	}
}


text:
package com.github.cmanou.scrimage.utils.dithering.filters

import com.github.cmanou.scrimage.utils.dithering.Utils
import com.github.cmanou.scrimage.utils.dithering.Utils.ErrorDiffusionValue
import com.github.cmanou.scrimage.utils.dithering.algorithms.GenericErrorDiffusion
import com.sksamuel.scrimage.filter.MarvinFilter

class SierraFilter(threshold: Int) extends MarvinFilter {
  val plugin = new GenericErrorDiffusion(threshold, List(
    ErrorDiffusionValue(1,0, 0.15625),
    ErrorDiffusionValue(2,0, 0.09375),
    ErrorDiffusionValue(-2,1, 0.0625),
    ErrorDiffusionValue(-1,1, 0.125),
    ErrorDiffusionValue(0,1, 0.15625),
    ErrorDiffusionValue(1,1, 0.125),
    ErrorDiffusionValue(2,1, 0.0625),
    ErrorDiffusionValue(-1,2, 0.0625),
    ErrorDiffusionValue(0,2, 0.09375),
    ErrorDiffusionValue(1,2, 0.0625)
  ))
}

object SierraFilter {
  def apply(): SierraFilter = apply(127)
  def apply(threshold: Int = 0): SierraFilter = new SierraFilter(threshold)
}


text:
/* $Id: fileaio-win.cpp $ */
/** @file
 * IPRT - File async I/O, native implementation for the Windows host platform.
 */

/*
 * Copyright (C) 2006-2015 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 *
 * The contents of this file may alternatively be used under the terms
 * of the Common Development and Distribution License Version 1.0
 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
 * VirtualBox OSE distribution, in which case the provisions of the
 * CDDL are applicable instead of those of the GPL.
 *
 * You may elect to license modified versions of this file under the
 * terms and conditions of either the GPL or the CDDL or both.
 */

/*******************************************************************************
*   Header Files                                                               *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_DIR

#include <iprt/asm.h>
#include <iprt/file.h>
#include <iprt/mem.h>
#include <iprt/assert.h>
#include <iprt/string.h>
#include <iprt/err.h>
#include <iprt/log.h>
#include "internal/fileaio.h"

#include <Windows.h>

/*******************************************************************************
*   Structures and Typedefs                                                    *
*******************************************************************************/

/**
 * Transfer direction.
 */
typedef enum TRANSFERDIRECTION
{
    TRANSFERDIRECTION_INVALID = 0,
    /** Read. */
    TRANSFERDIRECTION_READ,
    /** Write. */
    TRANSFERDIRECTION_WRITE,
    /** The usual 32-bit hack. */
    TRANSFERDIRECTION_32BIT_HACK = 0x7fffffff
} TRANSFERDIRECTION;

/**
 * Async I/O completion context state.
 */
typedef struct RTFILEAIOCTXINTERNAL
{
    /** handle to I/O completion port. */
    HANDLE            hIoCompletionPort;
    /** Current number of requests pending. */
    volatile int32_t  cRequests;
    /** Flag whether the thread was woken up. */
    volatile bool     fWokenUp;
    /** Flag whether the thread is currently waiting. */
    volatile bool     fWaiting;
    /** Flags given during creation. */
    uint32_t          fFlags;
    /** Magic value (RTFILEAIOCTX_MAGIC). */
    uint32_t          u32Magic;
} RTFILEAIOCTXINTERNAL;
/** Pointer to an internal context structure. */
typedef RTFILEAIOCTXINTERNAL *PRTFILEAIOCTXINTERNAL;

/**
 * Async I/O request state.
 */
typedef struct RTFILEAIOREQINTERNAL
{
    /** Overlapped structure. */
    OVERLAPPED            Overlapped;
    /** Current state the request is in. */
    RTFILEAIOREQSTATE     enmState;
    /** The file handle. */
    HANDLE                hFile;
    /** Kind of transfer Read/Write. */
    TRANSFERDIRECTION     enmTransferDirection;
    /** Number of bytes to transfer. */
    size_t                cbTransfer;
    /** Pointer to the buffer. */
    void                 *pvBuf;
    /** Opaque user data. */
    void                 *pvUser;
    /** Flag whether the request completed. */
    bool                  fCompleted;
    /** Number of bytes transferred successfully. */
    size_t                cbTransfered;
    /** Error code of the completed request. */
    int                   Rc;
    /** Completion context we are assigned to. */
    PRTFILEAIOCTXINTERNAL pCtxInt;
    /** Magic value  (RTFILEAIOREQ_MAGIC). */
    uint32_t              u32Magic;
} RTFILEAIOREQINTERNAL;
/** Pointer to an internal request structure. */
typedef RTFILEAIOREQINTERNAL *PRTFILEAIOREQINTERNAL;

/*******************************************************************************
*   Defined Constants And Macros                                               *
*******************************************************************************/
/** Id for the wakeup event. */
#define AIO_CONTEXT_WAKEUP_EVENT 1
/** Converts a pointer to an OVERLAPPED structure to a internal request. */
#define OVERLAPPED_2_RTFILEAIOREQINTERNAL(pOverlapped) ( (PRTFILEAIOREQINTERNAL)((uintptr_t)(pOverlapped) - RT_OFFSETOF(RTFILEAIOREQINTERNAL, Overlapped)) )

RTR3DECL(int) RTFileAioGetLimits(PRTFILEAIOLIMITS pAioLimits)
{
    int rcBSD = 0;
    AssertPtrReturn(pAioLimits, VERR_INVALID_POINTER);

    /* No limits known. */
    pAioLimits->cReqsOutstandingMax = RTFILEAIO_UNLIMITED_REQS;
    pAioLimits->cbBufferAlignment   = 0;

    return VINF_SUCCESS;
}

RTR3DECL(int) RTFileAioReqCreate(PRTFILEAIOREQ phReq)
{
    AssertPtrReturn(phReq, VERR_INVALID_POINTER);

    PRTFILEAIOREQINTERNAL pReqInt = (PRTFILEAIOREQINTERNAL)RTMemAllocZ(sizeof(RTFILEAIOREQINTERNAL));
    if (RT_UNLIKELY(!pReqInt))
        return VERR_NO_MEMORY;

    pReqInt->pCtxInt    = NULL;
    pReqInt->fCompleted = false;
    pReqInt->u32Magic   = RTFILEAIOREQ_MAGIC;
    RTFILEAIOREQ_SET_STATE(pReqInt, COMPLETED);

    *phReq = (RTFILEAIOREQ)pReqInt;

    return VINF_SUCCESS;
}

RTDECL(int) RTFileAioReqDestroy(RTFILEAIOREQ hReq)
{
    /*
     * Validate the handle and ignore nil.
     */
    if (hReq == NIL_RTFILEAIOREQ)
        return VINF_SUCCESS;
    PRTFILEAIOREQINTERNAL pReqInt = hReq;
    RTFILEAIOREQ_VALID_RETURN(pReqInt);
    RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReqInt, SUBMITTED, VERR_FILE_AIO_IN_PROGRESS);

    /*
     * Trash the magic and free it.
     */
    ASMAtomicUoWriteU32(&pReqInt->u32Magic, ~RTFILEAIOREQ_MAGIC);
    RTMemFree(pReqInt);
    return VINF_SUCCESS;
}

/**
 * Worker setting up the request.
 */
DECLINLINE(int) rtFileAioReqPrepareTransfer(RTFILEAIOREQ hReq, RTFILE hFile,
                                            TRANSFERDIRECTION enmTransferDirection,
                                            RTFOFF off, void *pvBuf, size_t cbTransfer,
                                            void *pvUser)
{
    /*
     * Validate the input.
     */
    PRTFILEAIOREQINTERNAL pReqInt = hReq;
    RTFILEAIOREQ_VALID_RETURN(pReqInt);
    RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReqInt, SUBMITTED, VERR_FILE_AIO_IN_PROGRESS);
    Assert(hFile != NIL_RTFILE);
    AssertPtr(pvBuf);
    Assert(off >= 0);
    Assert(cbTransfer > 0);

    pReqInt->enmTransferDirection  = enmTransferDirection;
    pReqInt->hFile                 = (HANDLE)RTFileToNative(hFile);
    pReqInt->Overlapped.Offset     = (DWORD)(off & 0xffffffff);
    pReqInt->Overlapped.OffsetHigh = (DWORD)(off >> 32);
    pReqInt->cbTransfer            = cbTransfer;
    pReqInt->pvBuf                 = pvBuf;
    pReqInt->pvUser                = pvUser;
    pReqInt->fCompleted            = false;

    return VINF_SUCCESS;
}

RTDECL(int) RTFileAioReqPrepareRead(RTFILEAIOREQ hReq, RTFILE hFile, RTFOFF off,
                                    void *pvBuf, size_t cbRead, void *pvUser)
{
    return rtFileAioReqPrepareTransfer(hReq, hFile, TRANSFERDIRECTION_READ,
                                       off, pvBuf, cbRead, pvUser);
}

RTDECL(int) RTFileAioReqPrepareWrite(RTFILEAIOREQ hReq, RTFILE hFile, RTFOFF off,
                                     void const *pvBuf, size_t cbWrite, void *pvUser)
{
    return rtFileAioReqPrepareTransfer(hReq, hFile, TRANSFERDIRECTION_WRITE,
                                       off, (void *)pvBuf, cbWrite, pvUser);
}

RTDECL(int) RTFileAioReqPrepareFlush(RTFILEAIOREQ hReq, RTFILE hFile, void *pvUser)
{
    PRTFILEAIOREQINTERNAL pReqInt = hReq;
    RTFILEAIOREQ_VALID_RETURN(pReqInt);
    RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReqInt, SUBMITTED, VERR_FILE_AIO_IN_PROGRESS);
    AssertReturn(hFile != NIL_RTFILE, VERR_INVALID_HANDLE);

    return VERR_NOT_SUPPORTED;
}

RTDECL(void *) RTFileAioReqGetUser(RTFILEAIOREQ hReq)
{
    PRTFILEAIOREQINTERNAL pReqInt = hReq;
    RTFILEAIOREQ_VALID_RETURN_RC(pReqInt, NULL);

    return pReqInt->pvUser;
}

RTDECL(int) RTFileAioReqCancel(RTFILEAIOREQ hReq)
{
    PRTFILEAIOREQINTERNAL pReqInt = hReq;
    RTFILEAIOREQ_VALID_RETURN(pReqInt);
    RTFILEAIOREQ_STATE_RETURN_RC(pReqInt, SUBMITTED, VERR_FILE_AIO_NOT_SUBMITTED);

    /**
     * @todo r=aeichner It is not possible to cancel specific
     * requests on Windows before Vista.
     * CancelIo cancels all requests for a file issued by the
     * calling thread and CancelIoEx which does what we need
     * is only available from Vista and up.
     * The solution is to return VERR_FILE_AIO_IN_PROGRESS
     * if the request didn't completed yet (checked above).
     * Shouldn't be a big issue because a request is normally
     * only canceled if it exceeds a timeout which is quite huge.
     */
    return VERR_FILE_AIO_COMPLETED;
}

RTDECL(int) RTFileAioReqGetRC(RTFILEAIOREQ hReq, size_t *pcbTransfered)
{
    int rc = VINF_SUCCESS;
    PRTFILEAIOREQINTERNAL pReqInt = hReq;
    RTFILEAIOREQ_VALID_RETURN(pReqInt);
    RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReqInt, SUBMITTED, VERR_FILE_AIO_IN_PROGRESS);
    RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReqInt, PREPARED, VERR_FILE_AIO_NOT_SUBMITTED);

    rc = pReqInt->Rc;
    if (pcbTransfered && RT_SUCCESS(rc))
        *pcbTransfered = pReqInt->cbTransfered;

    return rc;
}

RTDECL(int) RTFileAioCtxCreate(PRTFILEAIOCTX phAioCtx, uint32_t cAioReqsMax,
                               uint32_t fFlags)
{
    PRTFILEAIOCTXINTERNAL pCtxInt;
    AssertPtrReturn(phAioCtx, VERR_INVALID_POINTER);
    AssertReturn(!(fFlags & ~RTFILEAIOCTX_FLAGS_VALID_MASK), VERR_INVALID_PARAMETER);

    pCtxInt = (PRTFILEAIOCTXINTERNAL)RTMemAllocZ(sizeof(RTFILEAIOCTXINTERNAL));
    if (RT_UNLIKELY(!pCtxInt))
        return VERR_NO_MEMORY;

    pCtxInt->hIoCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE,
                                                        NULL,
                                                        0,
                                                        0);
    if (RT_UNLIKELY(!pCtxInt->hIoCompletionPort))
    {
        RTMemFree(pCtxInt);
        return VERR_NO_MEMORY;
    }

    pCtxInt->fFlags   = fFlags;
    pCtxInt->u32Magic = RTFILEAIOCTX_MAGIC;

    *phAioCtx = (RTFILEAIOCTX)pCtxInt;

    return VINF_SUCCESS;
}

RTDECL(int) RTFileAioCtxDestroy(RTFILEAIOCTX hAioCtx)
{
    /* Validate the handle and ignore nil. */
    if (hAioCtx == NIL_RTFILEAIOCTX)
        return VINF_SUCCESS;
    PRTFILEAIOCTXINTERNAL pCtxInt = hAioCtx;
    RTFILEAIOCTX_VALID_RETURN(pCtxInt);

    /* Cannot destroy a busy context. */
    if (RT_UNLIKELY(pCtxInt->cRequests))
        return VERR_FILE_AIO_BUSY;

    CloseHandle(pCtxInt->hIoCompletionPort);
    ASMAtomicUoWriteU32(&pCtxInt->u32Magic, RTFILEAIOCTX_MAGIC_DEAD);
    RTMemFree(pCtxInt);

    return VINF_SUCCESS;
}

RTDECL(int) RTFileAioCtxAssociateWithFile(RTFILEAIOCTX hAioCtx, RTFILE hFile)
{
    int rc = VINF_SUCCESS;
    PRTFILEAIOCTXINTERNAL pCtxInt = hAioCtx;
    RTFILEAIOCTX_VALID_RETURN(pCtxInt);

    HANDLE hTemp = CreateIoCompletionPort((HANDLE)RTFileToNative(hFile), pCtxInt->hIoCompletionPort, 0, 1);
    if (hTemp != pCtxInt->hIoCompletionPort)
        rc = RTErrConvertFromWin32(GetLastError());

    return rc;
}

RTDECL(uint32_t) RTFileAioCtxGetMaxReqCount(RTFILEAIOCTX hAioCtx)
{
    return RTFILEAIO_UNLIMITED_REQS;
}

RTDECL(int) RTFileAioCtxSubmit(RTFILEAIOCTX hAioCtx, PRTFILEAIOREQ pahReqs, size_t cReqs)
{
    /*
     * Parameter validation.
     */
    int rc = VINF_SUCCESS;
    PRTFILEAIOCTXINTERNAL pCtxInt = hAioCtx;
    RTFILEAIOCTX_VALID_RETURN(pCtxInt);
    AssertReturn(cReqs > 0,  VERR_INVALID_PARAMETER);
    Assert(cReqs <= INT32_MAX);
    AssertPtrReturn(pahReqs, VERR_INVALID_POINTER);
    size_t i;

    for (i = 0; i < cReqs; i++)
    {
        PRTFILEAIOREQINTERNAL pReqInt = pahReqs[i];
        BOOL fSucceeded;

        Assert(pReqInt->cbTransfer == (DWORD)pReqInt->cbTransfer);
        if (pReqInt->enmTransferDirection == TRANSFERDIRECTION_READ)
        {
            fSucceeded = ReadFile(pReqInt->hFile, pReqInt->pvBuf,
                                  (DWORD)pReqInt->cbTransfer, NULL,
                                  &pReqInt->Overlapped);
        }
        else if (pReqInt->enmTransferDirection == TRANSFERDIRECTION_WRITE)
        {
            fSucceeded = WriteFile(pReqInt->hFile, pReqInt->pvBuf,
                                   (DWORD)pReqInt->cbTransfer, NULL,
                                   &pReqInt->Overlapped);
        }
        else
        {
            fSucceeded = false;
            AssertMsgFailed(("Invalid transfer direction\n"));
        }

        if (RT_UNLIKELY(!fSucceeded && GetLastError() != ERROR_IO_PENDING))
        {
            RTFILEAIOREQ_SET_STATE(pReqInt, COMPLETED);
            rc = RTErrConvertFromWin32(GetLastError());
            pReqInt->Rc = rc;
            break;
        }
        RTFILEAIOREQ_SET_STATE(pReqInt, SUBMITTED);
    }

    ASMAtomicAddS32(&pCtxInt->cRequests, (int32_t)i);

    return rc;
}

RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL cMillies,
                             PRTFILEAIOREQ pahReqs, size_t cReqs, uint32_t *pcReqs)
{
    /*
     * Validate the parameters, making sure to always set pcReqs.
     */
    AssertPtrReturn(pcReqs, VERR_INVALID_POINTER);
    *pcReqs = 0; /* always set */
    PRTFILEAIOCTXINTERNAL pCtxInt = hAioCtx;
    RTFILEAIOCTX_VALID_RETURN(pCtxInt);
    AssertPtrReturn(pahReqs, VERR_INVALID_POINTER);
    AssertReturn(cReqs != 0, VERR_INVALID_PARAMETER);
    AssertReturn(cReqs >= cMinReqs, VERR_OUT_OF_RANGE);

    /*
     * Can't wait if there are no requests around.
     */
    if (   RT_UNLIKELY(ASMAtomicUoReadS32(&pCtxInt->cRequests) == 0)
        && !(pCtxInt->fFlags & RTFILEAIOCTX_FLAGS_WAIT_WITHOUT_PENDING_REQUESTS))
        return VERR_FILE_AIO_NO_REQUEST;

    /* Wait for at least one. */
    if (!cMinReqs)
        cMinReqs = 1;

    /*
     * Loop until we're woken up, hit an error (incl timeout), or
     * have collected the desired number of requests.
     */
    int rc = VINF_SUCCESS;
    int cRequestsCompleted = 0;
    while (   !pCtxInt->fWokenUp
           && cMinReqs > 0)
    {
        uint64_t     StartNanoTS = 0;
        DWORD        dwTimeout = cMillies == RT_INDEFINITE_WAIT ? INFINITE : cMillies;
        DWORD        cbTransfered;
        LPOVERLAPPED pOverlapped;
        ULONG_PTR    lCompletionKey;
        BOOL         fSucceeded;

        if (cMillies != RT_INDEFINITE_WAIT)
            StartNanoTS = RTTimeNanoTS();

        ASMAtomicXchgBool(&pCtxInt->fWaiting, true);
        fSucceeded = GetQueuedCompletionStatus(pCtxInt->hIoCompletionPort,
                                               &cbTransfered,
                                               &lCompletionKey,
                                               &pOverlapped,
                                               dwTimeout);
        ASMAtomicXchgBool(&pCtxInt->fWaiting, false);
        if (   !fSucceeded
            && !pOverlapped)
        {
            /* The call failed to dequeue a completion packet, includes VERR_TIMEOUT */
            rc = RTErrConvertFromWin32(GetLastError());
            break;
        }

        /* Check if we got woken up. */
        if (lCompletionKey == AIO_CONTEXT_WAKEUP_EVENT)
        {
            Assert(fSucceeded && !pOverlapped);
            break;
        }

        /* A request completed. */
        PRTFILEAIOREQINTERNAL pReqInt = OVERLAPPED_2_RTFILEAIOREQINTERNAL(pOverlapped);
        AssertPtr(pReqInt);
        Assert(pReqInt->u32Magic == RTFILEAIOREQ_MAGIC);

        /* Mark the request as finished. */
        RTFILEAIOREQ_SET_STATE(pReqInt, COMPLETED);

        pReqInt->cbTransfered = cbTransfered;
        if (fSucceeded)
            pReqInt->Rc = VINF_SUCCESS;
        else
        {
            DWORD errCode = GetLastError();
            pReqInt->Rc = RTErrConvertFromWin32(errCode);
            if (pReqInt->Rc == VERR_UNRESOLVED_ERROR)
                LogRel(("AIO/win: Request %#p returned rc=%Rrc (native %u\n)", pReqInt, pReqInt->Rc, errCode));
        }

        pahReqs[cRequestsCompleted++] = (RTFILEAIOREQ)pReqInt;

        /* Update counter. */
        cMinReqs--;

        if (cMillies != RT_INDEFINITE_WAIT)
        {
            /* Recalculate timeout. */
            uint64_t NanoTS = RTTimeNanoTS();
            uint64_t cMilliesElapsed = (NanoTS - StartNanoTS) / 1000000;
            if (cMilliesElapsed < cMillies)
                cMillies -= cMilliesElapsed;
            else
                cMillies = 0;
        }
    }

    /*
     * Update the context state and set the return value.
     */
    *pcReqs = cRequestsCompleted;
    ASMAtomicSubS32(&pCtxInt->cRequests, cRequestsCompleted);

    /*
     * Clear the wakeup flag and set rc.
     */
    bool fWokenUp = ASMAtomicXchgBool(&pCtxInt->fWokenUp, false);

    if (    fWokenUp
        &&  RT_SUCCESS(rc))
        rc = VERR_INTERRUPTED;

    return rc;
}

RTDECL(int) RTFileAioCtxWakeup(RTFILEAIOCTX hAioCtx)
{
    int rc = VINF_SUCCESS;
    PRTFILEAIOCTXINTERNAL pCtxInt = hAioCtx;
    RTFILEAIOCTX_VALID_RETURN(pCtxInt);

    bool fWokenUp = ASMAtomicXchgBool(&pCtxInt->fWokenUp, true);
    bool fWaiting = ASMAtomicReadBool(&pCtxInt->fWaiting);

    if (   !fWokenUp
        && fWaiting)
    {
        BOOL fSucceeded = PostQueuedCompletionStatus(pCtxInt->hIoCompletionPort,
                                                     0, AIO_CONTEXT_WAKEUP_EVENT,
                                                     NULL);

        if (!fSucceeded)
            rc = RTErrConvertFromWin32(GetLastError());
    }

    return rc;
}


text:
package me.chanjar.weixin.cp.tp.service.impl;

import com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.bean.WxCpTpProlongTryResult;
import me.chanjar.weixin.cp.tp.service.WxCpTpEditionService;
import me.chanjar.weixin.cp.tp.service.WxCpTpService;

import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Tp.PROLONG_TRY;

/**
 * 应用版本付费版本相关接口实现
 *
 * @author leigouqing  created on  2022年4月24日
 */
@RequiredArgsConstructor
public class WxCpTpEditionServiceImpl implements WxCpTpEditionService {

  /**
   * The Main service.
   */
  private final WxCpTpService mainService;

  /**
   * 延长试用期
   *

   * 文档地址
   *

   *

   *
一个应用可以多次延长试用,但是试用总天数不能超过60天

   *
仅限时试用或试用过期状态下的应用可以延长试用期

   *

   *
   * @param buyerCorpId 购买方corpId
   * @param prolongDays 延长天数
   * @param appId       仅旧套件需要填此参数
   * @return the order
   * @throws WxErrorException the wx error exception
   */
  @Override
  public WxCpTpProlongTryResult prolongTry(String buyerCorpId, Integer prolongDays, String appId) throws WxErrorException {
    String url = mainService.getWxCpTpConfigStorage().getApiUrl(PROLONG_TRY);
    JsonObject jsonObject = new JsonObject();
    jsonObject.addProperty("buyer_corpid", buyerCorpId);
    jsonObject.addProperty("prolong_days", prolongDays);
    jsonObject.addProperty("appid", appId);
    String result = mainService.post(url, jsonObject.toString());
    return WxCpTpProlongTryResult.fromJson(result);
  }
}


text:
package smc

//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
//
//http://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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// ReplicationJobRun is a nested struct in smc response
type ReplicationJobRun struct {
	ImageId   string `json:"ImageId" xml:"ImageId"`
	Type      string `json:"Type" xml:"Type"`
	StartTime string `json:"StartTime" xml:"StartTime"`
	EndTime   string `json:"EndTime" xml:"EndTime"`
}


text:
{% extends "layout.html" %}

{% block pageTitle %}
	GOV.UK prototyping kit
{% endblock %}

{% block content %}

{% import "pip23/macros/elements.html" as elements %}
{% for page in data %}
{% for question in page.currentWhereabouts %}

				<form action="/pip23/currentWhereabouts{% if edit %}?edit=true{% endif %}" method="post" class="form form-group-frequency">
					{{ elements.header(page,question) }}

					{% set seq = [
						{"id":"location1", "label":"Hospital", "value":"hospital",
						"target"             : "hospitalAddress",
						"whereAndWhen"       : true,
						"whereWhenId":"hospitalWhen", "whereWhenLabel":question.whereWhenStart,"whereWhenAnswer":answers.hospitalWhen,
						"whereWhenId2":"hospitalWhere1", "whereWhenLabel2":question.whereWhenAddress,"whereWhenAnswer2":answers.hospitalWhere1,
						"whereWhenId3": "hospitalWhere2", "whereWhenAnswer3":answers.hospitalWhere2,
						"whereWhenId4": "hospitalWhere3", "whereWhenAnswer4":answers.hospitalWhere3,
						"whereWhenId5":"hospitalWhere4", "whereWhenLabel5":question.whereWhenPostcode,"whereWhenAnswer5":answers.hospitalWhere4},

						{"id":"location2", "label":"A care or nursing home", "value":"a care or nursing home",
						"target"             : "careHomeAddress",
						"whereAndWhen"       : true,
						"whereWhenId":"careHomeWhen", "whereWhenLabel":question.whereWhenStart,"whereWhenAnswer":answers.careHomeWhen,
						"whereWhenId2":"careHomeWhere1", "whereWhenLabel2":question.whereWhenAddress,"whereWhenAnswer2":answers.careHomeWhere1,
						"whereWhenId3": "careHomeWhere2", "whereWhenAnswer3":answers.careHomeWhere2,
						"whereWhenId4": "careHomeWhere3", "whereWhenAnswer4":answers.careHomeWhere3,
						"whereWhenId5":"careHomeWhere4", "whereWhenLabel5":question.whereWhenPostcode,"whereWhenAnswer5":answers.careHomeWhere4},

						{"id":"location3", "label":"Sheltered housing", "value":"sheltered housing",
						"target"             : "shelteredAddress",
						"whereAndWhen"       : true,
						"whereWhenId":"shelteredWhen", "whereWhenLabel":question.whereWhenStart,"whereWhenAnswer":answers.shelteredWhen,
						"whereWhenId2":"shelteredWhere1", "whereWhenLabel2":question.whereWhenAddress,"whereWhenAnswer2":answers.shelteredWhere1,
						"whereWhenId3": "shelteredWhere2", "whereWhenAnswer3":answers.shelteredWhere2,
						"whereWhenId4": "shelteredWhere3", "whereWhenAnswer4":answers.shelteredWhere3,
						"whereWhenId5":"shelteredWhere4", "whereWhenLabel5":question.whereWhenPostcode,"whereWhenAnswer5":answers.shelteredWhere4},

						{"id":"location4", "label":"A residential college", "value":"a residential college",
						"target"             : "collegeAddress",
						"whereAndWhen"       : true,
						"whereWhenId":"collegeWhen", "whereWhenLabel":question.whereWhenStart,"whereWhenAnswer":answers.collegeWhen,
						"whereWhenId2":"collegeWhere1", "whereWhenLabel2":question.whereWhenAddress,"whereWhenAnswer2":answers.collegeWhere1,
						"whereWhenId3": "collegeWhere2", "whereWhenAnswer3":answers.collegeWhere2,
						"whereWhenId4": "collegeWhere3", "whereWhenAnswer4":answers.collegeWhere3,
						"whereWhenId5":"collegeWhere4", "whereWhenLabel5":question.whereWhenPostcode,"whereWhenAnswer5":answers.collegeWhere4},

						{"id":"location5", "label":"A hostel", "value":"a hostel",
						"target"             : "hostelAddress",
						"whereAndWhen"       : true,
						"whereWhenId":"hostelWhen", "whereWhenLabel":question.whereWhenStart,"whereWhenAnswer":answers.hostelWhen,
						"whereWhenId2":"hostelWhere1", "whereWhenLabel2":question.whereWhenAddress,"whereWhenAnswer2":answers.hostelWhere1,
						"whereWhenId3": "hostelWhere2", "whereWhenAnswer3":answers.hostelWhere2,
						"whereWhenId4": "hostelWhere3", "whereWhenAnswer4":answers.hostelWhere3,
						"whereWhenId5":"hostelWhere4", "whereWhenLabel5":question.whereWhenPostcode,"whereWhenAnswer5":answers.hostelWhere4},

						{"id":"location6", "label":"A hospice", "value":"a hospice",
						"target"             : "hospiceAddress",
						"whereAndWhen"       : true,
						"whereWhenId":"hospiceWhen", "whereWhenLabel":question.whereWhenStart,"whereWhenAnswer":answers.hospiceWhen,
						"whereWhenId2":"hospiceWhere1", "whereWhenLabel2":question.whereWhenAddress,"whereWhenAnswer2":answers.hospiceWhere1,
						"whereWhenId3": "hospiceWhere2", "whereWhenAnswer3":answers.hospiceWhere2,
						"whereWhenId4": "hospiceWhere3", "whereWhenAnswer4":answers.hospiceWhere3,
						"whereWhenId5":"hospiceWhere4", "whereWhenLabel5":question.whereWhenPostcode,"whereWhenAnswer5":answers.hospiceWhere4},

						{"id":"location7", "label":"You're not staying in any of these", "value":"You are not currently staying in any of these", "hidePanel":"details"}
					] %}
					{{ elements.checkbox('optionsLiving',"radio",question.question,'',seq,answers,answers.optionsLiving,"check-uncheck") }}

					{{ elements.submit(page,question,false,false,false) }}

        </form>

			{{ elements.helpline(page) }}

{% endfor %}
{% endfor %}
{% endblock %}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: 20765 -->
<!-- Reviewed: no -->
<sect3 id="zend.controller.actionhelpers.actionstack">
    <title>ActionStack</title>

    <para>
        Der <emphasis>ActionStack</emphasis> Helfer erlaubt das Verschieben von Anfragen zum <link
            linkend="zend.controller.plugins.standard.actionstack">ActionStack</link> Front
        Controller Plugin, welches effektiv hilft um eine Queue von Aktionen zu erstellen die wärend
        der Anfrage ausgeführt wird. Der Helfer erlaubt das hinzufügen von Aktionen entweder durch
        Spezifikation von neuen Anfrage Objekten oder Aktion - Controller - Modul Sets.
    </para>

    <note>
        <title>Der Aufruf des ActionStack Helpers inizialisiert das ActionStack Plugin</title>

        <para>
            Der Aufruf des <emphasis>ActionStack</emphasis> Helpers registriert das
            <emphasis>ActionStack</emphasis> Plugin implizit -- was bedeutet dass das
            <emphasis>ActionStack</emphasis> Plugin nicht explizit registriert werden muß um dessen
            Funktionalität zu verwenden.
        </para>
    </note>

    <example id="zend.controller.actionhelpers.actionstack.simple">
        <title>
            Eine Aufgabe hinzufügen indem Aktion, Controller und Modulnamen verwendet werden
        </title>

        <para>
            Oft ist es am einfachsten, einfach die Aktion, den Controller und das Modul (und
            optionale Anfrage Parameter) zu spezifizieren, wie wenn
            <methodname>Zend_Controller_Action::_forward()</methodname> aufgerufen werden würde:
        </para>

        <programlisting language="php"><![CDATA[
class FooController extends Zend_Controller_Action
{
    public function barAction()
    {
        // Dem Stack zwei Aktionen hinzufügen
        // Und /foo/baz/bar/baz aufrufen
        // (FooController::bazAction() mit der Anfrage var bar == baz)
        $this->_helper->actionStack('baz',
                                    'foo',
                                    'default',
                                    array('bar' => 'baz'));

        // Aufruf für /bar/bat hinzufügen
        // (BarController::batAction())
        $this->_helper->actionStack('bat', 'bar');
    }
}
]]></programlisting>
    </example>

    <example id="zend.controller.actionhelpers.actionstack.simple2">
        <title>Eine Aufgabe hinzufügen durch Verwendung eines Anfrage Objektes</title>

        <para>
            Machmal macht die <acronym>OOP</acronym> Natur eines Anfrage Objektes mehr Sinn; solch
            ein Objekt kann dem <emphasis>ActionStack</emphasis> Helfer genauso übergeben werden.
        </para>

        <programlisting language="php"><![CDATA[
class FooController extends Zend_Controller_Action
{
    public function barAction()
    {
        // Dem Stack zwei Aktionen hinzufügen
        // Aufruf zu /foo/baz/bar/baz hinzufügen
        // (FooController::bazAction() mit der Anfrage var bar == baz)
        $request = clone $this->getRequest();
        // Controller oder Modul nicht setzen, verwende aktuelle Werte
        $request->setActionName('baz')
                ->setParams(array('bar' => 'baz'));
        $this->_helper->actionStack($request);

        // Aufruf zu /bar/bat hinzufügen
        // (BarController::batAction())
        $request = clone $this->getRequest();
        // Modul nicht setzen, verwende aktuelle Werte
        $request->setActionName('bat')
                ->setControllerName('bar');
        $this->_helper->actionStack($request);
    }
}
]]></programlisting>
    </example>
</sect3>


text:
// Copyright (c) 2012 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 15.4.4.22-9-c-ii-23
description: >
    Array.prototype.reduceRight - number primitive can be used as
    accumulator
---*/

        var accessed = false;
        function callbackfn(prevVal, curVal, idx, obj) {
            accessed = true;
            return prevVal === 12;
        }

        var obj = { 0: 11, length: 1 };

assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 12), true, 'Array.prototype.reduceRight.call(obj, callbackfn, 12)');
assert(accessed, 'accessed !== true');


text:
namespace pathos {

	class SSAO : public PostProcess {

		struct UBO_SSAO_Random {
			// For Vogel disk. w component is not used.
			vector4 randomRotations[SSAO_NUM_ROTATION_NOISE];
		};

	public:
		virtual void initializeResources(RenderCommandList& cmdList) override;
		virtual void releaseResources(RenderCommandList& cmdList) override;
		virtual void renderPostProcess(RenderCommandList& cmdList, PlaneGeometry* fullscreenQuad) override;

	private:
		GLuint fboBlur = 0;
		GLuint fboBlur2 = 0;

		UniformBuffer ubo;
		UniformBuffer uboRandom;

		UBO_SSAO_Random randomData;
		bool bRandomDataValid = false;

	};

}


text:
"""VRML97-specific customisations and support

Includes a full VRML97 parser and lineariser
for SimpleParse 2.0.x
"""


text:
package vn.tale.rxmvvm_sample.ui.users;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Observable;
import rx.Subscription;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
import rx.subscriptions.CompositeSubscription;
import vn.tale.rxmvvm.lce.LoadingSuccessError;
import vn.tale.rxmvvm.lce.component.VisibleGoneDataView;
import vn.tale.rxmvvm.lce.component.VisibleGoneView;
import vn.tale.rxmvvm_sample.R;
import vn.tale.rxmvvm_sample.adapter.UsersAdapter;
import vn.tale.rxmvvm_sample.api.GitHubService;
import vn.tale.rxmvvm_sample.model.User;
import vn.tale.rxmvvm_sample.model.UserModel;

import static com.artemzin.rxui.RxUi.ui;

/**
 * Created by Giang Nguyen on 6/12/16.
 */
public class UsersFragment extends Fragment implements UsersMVVM.View {

  @BindView(R.id.rvList)
  RecyclerView rvList;
  @BindView(R.id.vProgress)
  ProgressBar vProgress;
  @BindView(R.id.tvError)
  TextView tvError;

  private final UsersAdapter adapter;
  private CompositeSubscription subscription;
  public UsersViewModel viewModel;
  private Func1<Observable<Void>, Subscription> onLoading;
  private Func1<Observable<List<User>>, Subscription> onSuccess;
  private Func1<Observable<String>, Subscription> onError;

  public UsersFragment() {
    adapter = new UsersAdapter();
  }

  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_users, container, false);
    ButterKnife.bind(this, view);
    return view;
  }

  @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    setupLce();
    final UserModel userModel = new UserModel(GitHubService.Factory.create());
    viewModel = new UsersViewModel(userModel, Schedulers.io());
    final UsersBinding usersBinding = new UsersBinding(viewModel);
    rvList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
    rvList.setAdapter(adapter);
    subscription = new CompositeSubscription();
    subscription.add(usersBinding.bind(this));
    viewModel.loadUsers();
  }

  private void setupLce() {
    final VisibleGoneView loadingView = new VisibleGoneView(vProgress);
    final VisibleGoneDataView<List<User>> contentView = new VisibleGoneDataView<List<User>>(rvList) {
      @Override public void setData(List<User> users) {
        adapter.setUsers(users);
        adapter.notifyDataSetChanged();
      }
    };
    final VisibleGoneDataView<String> errorView = new VisibleGoneDataView<String>(tvError) {
      @Override public void setData(String s) {
        tvError.setText(s);
      }
    };
    final LoadingSuccessError<List<User>, String> lse = LoadingSuccessError.Factory.create(loadingView, contentView, errorView);
    onLoading = ui(lse.onLoading());
    onSuccess = ui(lse.onSuccess());
    onError = ui(lse.onError());
  }

  @Override public void onDestroyView() {
    super.onDestroyView();
    if (subscription != null) {
      subscription.unsubscribe();
    }
  }

  @OnClick(R.id.tvError) public void reload() {
    viewModel.loadUsers();
  }

  @Override public Func1<Observable<Void>, Subscription> onLoading() {
    return onLoading;
  }

  @Override
  public Func1<Observable<List<User>>, Subscription> onLoadUsersSuccess() {
    return onSuccess;
  }

  @Override
  public Func1<Observable<String>, Subscription> onLoadUsersError() {
    return onError;
  }
}