text:
package org.apache.ignite.internal.processors.platform.client;

import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.binary.BinaryReaderExImpl;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
import org.apache.ignite.internal.binary.streams.BinaryHeapInputStream;
import org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream;
import org.apache.ignite.internal.binary.streams.BinaryInputStream;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.processors.odbc.ClientListenerMessageParser;
import org.apache.ignite.internal.processors.odbc.ClientListenerRequest;
import org.apache.ignite.internal.processors.odbc.ClientListenerResponse;
import org.apache.ignite.internal.processors.platform.client.binary.ClientBinaryTypeGetRequest;
import org.apache.ignite.internal.processors.platform.client.binary.ClientBinaryTypeNameGetRequest;
import org.apache.ignite.internal.processors.platform.client.binary.ClientBinaryTypeNamePutRequest;
import org.apache.ignite.internal.processors.platform.client.binary.ClientBinaryTypePutRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheClearKeyRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheClearKeysRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheClearRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheContainsKeyRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheContainsKeysRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheCreateWithConfigurationRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheCreateWithNameRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheDestroyRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetAllRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetAndPutIfAbsentRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetAndPutRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetAndRemoveRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetAndReplaceRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetConfigurationRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetNamesRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetOrCreateWithConfigurationRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetOrCreateWithNameRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetSizeRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheLocalPeekRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheNodePartitionsRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCachePutAllRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCachePutIfAbsentRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCachePutRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheQueryNextPageRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheRemoveAllRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheRemoveIfEqualsRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheRemoveKeyRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheRemoveKeysRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheReplaceIfEqualsRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheReplaceRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheScanQueryRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheSqlFieldsQueryRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheSqlQueryRequest;

/**
 * Thin client message parser.
 */
public class ClientMessageParser implements ClientListenerMessageParser {
    /* General-purpose operations. */
    /** */
    private static final short OP_RESOURCE_CLOSE = 0;

    /* Cache operations */
    /** */
    private static final short OP_CACHE_GET = 1000;

    /** */
    private static final short OP_CACHE_PUT = 1001;

    /** */
    private static final short OP_CACHE_PUT_IF_ABSENT = 1002;

    /** */
    private static final short OP_CACHE_GET_ALL = 1003;

    /** */
    private static final short OP_CACHE_PUT_ALL = 1004;

    /** */
    private static final short OP_CACHE_GET_AND_PUT = 1005;

    /** */
    private static final short OP_CACHE_GET_AND_REPLACE = 1006;

    /** */
    private static final short OP_CACHE_GET_AND_REMOVE = 1007;

    /** */
    private static final short OP_CACHE_GET_AND_PUT_IF_ABSENT = 1008;

    /** */
    private static final short OP_CACHE_REPLACE = 1009;

    /** */
    private static final short OP_CACHE_REPLACE_IF_EQUALS = 1010;

    /** */
    private static final short OP_CACHE_CONTAINS_KEY = 1011;

    /** */
    private static final short OP_CACHE_CONTAINS_KEYS = 1012;

    /** */
    private static final short OP_CACHE_CLEAR = 1013;

    /** */
    private static final short OP_CACHE_CLEAR_KEY = 1014;

    /** */
    private static final short OP_CACHE_CLEAR_KEYS = 1015;

    /** */
    private static final short OP_CACHE_REMOVE_KEY = 1016;

    /** */
    private static final short OP_CACHE_REMOVE_IF_EQUALS = 1017;

    /** */
    private static final short OP_CACHE_REMOVE_KEYS = 1018;

    /** */
    private static final short OP_CACHE_REMOVE_ALL = 1019;

    /** */
    private static final short OP_CACHE_GET_SIZE = 1020;

    /** */
    private static final short OP_CACHE_LOCAL_PEEK = 1021;

    /* Cache create / destroy, configuration. */
    /** */
    private static final short OP_CACHE_GET_NAMES = 1050;

    /** */
    private static final short OP_CACHE_CREATE_WITH_NAME = 1051;

    /** */
    private static final short OP_CACHE_GET_OR_CREATE_WITH_NAME = 1052;

    /** */
    private static final short OP_CACHE_CREATE_WITH_CONFIGURATION = 1053;

    /** */
    private static final short OP_CACHE_GET_OR_CREATE_WITH_CONFIGURATION = 1054;

    /** */
    private static final short OP_CACHE_GET_CONFIGURATION = 1055;

    /** */
    private static final short OP_CACHE_DESTROY = 1056;

    /* Cache service info. */

    /** */
    private static final short OP_CACHE_NODE_PARTITIONS = 1100;

    /* Query operations. */
    /** */
    private static final short OP_QUERY_SCAN = 2000;

    /** */
    private static final short OP_QUERY_SCAN_CURSOR_GET_PAGE = 2001;

    /** */
    private static final short OP_QUERY_SQL = 2002;

    /** */
    private static final short OP_QUERY_SQL_CURSOR_GET_PAGE = 2003;

    /** */
    private static final short OP_QUERY_SQL_FIELDS = 2004;

    /** */
    private static final short OP_QUERY_SQL_FIELDS_CURSOR_GET_PAGE = 2005;

    /* Binary metadata operations. */
    /** */
    private static final short OP_BINARY_TYPE_NAME_GET = 3000;

    /** */
    private static final short OP_BINARY_TYPE_NAME_PUT = 3001;

    /** */
    private static final short OP_BINARY_TYPE_GET = 3002;

    /** */
    private static final short OP_BINARY_TYPE_PUT = 3003;

    /** Marshaller. */
    private final GridBinaryMarshaller marsh;

    /**
     * Ctor.
     *
     * @param ctx Kernal context.
     */
    ClientMessageParser(GridKernalContext ctx) {
        assert ctx != null;

        CacheObjectBinaryProcessorImpl cacheObjProc = (CacheObjectBinaryProcessorImpl)ctx.cacheObjects();
        marsh = cacheObjProc.marshaller();
    }

    /** {@inheritDoc} */
    @Override public ClientListenerRequest decode(byte[] msg) {
        assert msg != null;

        BinaryInputStream inStream = new BinaryHeapInputStream(msg);

        // skipHdrCheck must be true (we have 103 op code).
        BinaryRawReaderEx reader = new BinaryReaderExImpl(marsh.context(), inStream,
                null, null, true, true);

        return decode(reader);
    }

    /**
     * Decodes the request.
     *
     * @param reader Reader.
     * @return Request.
     */
    public ClientListenerRequest decode(BinaryRawReaderEx reader) {
        short opCode = reader.readShort();

        switch (opCode) {
            case OP_CACHE_GET:
                return new ClientCacheGetRequest(reader);

            case OP_BINARY_TYPE_NAME_GET:
                return new ClientBinaryTypeNameGetRequest(reader);

            case OP_BINARY_TYPE_GET:
                return new ClientBinaryTypeGetRequest(reader);

            case OP_CACHE_PUT:
                return new ClientCachePutRequest(reader);

            case OP_BINARY_TYPE_NAME_PUT:
                return new ClientBinaryTypeNamePutRequest(reader);

            case OP_BINARY_TYPE_PUT:
                return new ClientBinaryTypePutRequest(reader);

            case OP_QUERY_SCAN:
                return new ClientCacheScanQueryRequest(reader);

            case OP_QUERY_SCAN_CURSOR_GET_PAGE:
                return new ClientCacheQueryNextPageRequest(reader);

            case OP_RESOURCE_CLOSE:
                return new ClientResourceCloseRequest(reader);

            case OP_CACHE_CONTAINS_KEY:
                return new ClientCacheContainsKeyRequest(reader);

            case OP_CACHE_CONTAINS_KEYS:
                return new ClientCacheContainsKeysRequest(reader);

            case OP_CACHE_GET_ALL:
                return new ClientCacheGetAllRequest(reader);

            case OP_CACHE_GET_AND_PUT:
                return new ClientCacheGetAndPutRequest(reader);

            case OP_CACHE_GET_AND_REPLACE:
                return new ClientCacheGetAndReplaceRequest(reader);

            case OP_CACHE_GET_AND_REMOVE:
                return new ClientCacheGetAndRemoveRequest(reader);

            case OP_CACHE_PUT_IF_ABSENT:
                return new ClientCachePutIfAbsentRequest(reader);

            case OP_CACHE_GET_AND_PUT_IF_ABSENT:
                return new ClientCacheGetAndPutIfAbsentRequest(reader);

            case OP_CACHE_REPLACE:
                return new ClientCacheReplaceRequest(reader);

            case OP_CACHE_REPLACE_IF_EQUALS:
                return new ClientCacheReplaceIfEqualsRequest(reader);

            case OP_CACHE_PUT_ALL:
                return new ClientCachePutAllRequest(reader);

            case OP_CACHE_CLEAR:
                return new ClientCacheClearRequest(reader);

            case OP_CACHE_CLEAR_KEY:
                return new ClientCacheClearKeyRequest(reader);

            case OP_CACHE_CLEAR_KEYS:
                return new ClientCacheClearKeysRequest(reader);

            case OP_CACHE_REMOVE_KEY:
                return new ClientCacheRemoveKeyRequest(reader);

            case OP_CACHE_REMOVE_IF_EQUALS:
                return new ClientCacheRemoveIfEqualsRequest(reader);

            case OP_CACHE_GET_SIZE:
                return new ClientCacheGetSizeRequest(reader);

            case OP_CACHE_REMOVE_KEYS:
                return new ClientCacheRemoveKeysRequest(reader);

            case OP_CACHE_LOCAL_PEEK:
                return new ClientCacheLocalPeekRequest(reader);

            case OP_CACHE_REMOVE_ALL:
                return new ClientCacheRemoveAllRequest(reader);

            case OP_CACHE_CREATE_WITH_NAME:
                return new ClientCacheCreateWithNameRequest(reader);

            case OP_CACHE_GET_OR_CREATE_WITH_NAME:
                return new ClientCacheGetOrCreateWithNameRequest(reader);

            case OP_CACHE_DESTROY:
                return new ClientCacheDestroyRequest(reader);

            case OP_CACHE_NODE_PARTITIONS:
                return new ClientCacheNodePartitionsRequest(reader);

            case OP_CACHE_GET_NAMES:
                return new ClientCacheGetNamesRequest(reader);

            case OP_CACHE_GET_CONFIGURATION:
                return new ClientCacheGetConfigurationRequest(reader);

            case OP_CACHE_CREATE_WITH_CONFIGURATION:
                return new ClientCacheCreateWithConfigurationRequest(reader);

            case OP_CACHE_GET_OR_CREATE_WITH_CONFIGURATION:
                return new ClientCacheGetOrCreateWithConfigurationRequest(reader);

            case OP_QUERY_SQL:
                return new ClientCacheSqlQueryRequest(reader);

            case OP_QUERY_SQL_CURSOR_GET_PAGE:
                return new ClientCacheQueryNextPageRequest(reader);

            case OP_QUERY_SQL_FIELDS:
                return new ClientCacheSqlFieldsQueryRequest(reader);

            case OP_QUERY_SQL_FIELDS_CURSOR_GET_PAGE:
                return new ClientCacheQueryNextPageRequest(reader);
        }

        return new ClientRawRequest(reader.readLong(), ClientStatus.INVALID_OP_CODE,
            "Invalid request op code: " + opCode);
    }

    /** {@inheritDoc} */
    @Override public byte[] encode(ClientListenerResponse resp) {
        assert resp != null;

        BinaryHeapOutputStream outStream = new BinaryHeapOutputStream(32);

        BinaryRawWriterEx writer = marsh.writer(outStream);

        ((ClientResponse)resp).encode(writer);

        return outStream.arrayCopy();
    }
}


text: require "google/cloud/dialogflow/cx" unless defined? Google::Cloud::Dialogflow::CX::VERSION

redpajama_set_name: RedPajamaGithub


text:
[![Gem Version](http://badge.fury.io/rb/itamae-plugin-recipe-anyenv.svg)](http://badge.fury.io/rb/itamae-plugin-recipe-anyenv)
# Itamae::Plugin::Recipe::Anyenv

Itamae plugin to install anyenv

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'itamae-plugin-recipe-anyenv'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install itamae-plugin-recipe-anyenv

## Usage
### System wide
System wide anyenv installation

install directory is `ANYENV_ROOT` enviroment

`export ANYENV_ROOT=~/.anyenv`

or prease use the direnv

#### Recipe

```ruby
# your recipe
include_recipe "anyenv::system"
```

#### Node

Use this with `itamae -y node.yml`

```yml
anyenv:
  install_versions:
    rbenv:
      - 2.2.2
    exenv:
      - 1.0.5
```

#### .bashrc

Recommend to append this to .bashrc in your server.

```bash
export ANYENV_ROOT="/usr/local/anyenv"
export PATH="${ANYENV_ROOT}/.anyenv/bin:$PATH"
if which anyenv > /dev/null; then eval "$(anyenv init -)"; fi
```

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
The namespace PoC.misc.sync offers different clock-domain-crossing (CDC) synchronizer
circuits. All synchronizers are based on the basic 2 flip-flop synchonizer called
[`sync_Bits`][sync_Bits]. PoC has two platform specific implementations for Altera
and Xilinx, which are choosen, if the appropriate `MY_DEVICE` is configured in
[`my_config.vhdl`][my_config].

## Package(s)

The package [`sync`][sync.pkg] holds all component declarations for this namespace.

```VHDL
library PoC;
use     PoC.sync.all;
```

## Entities

#### Basic 2 Flip-Flop Synchronizer

The basic 2 flip-flop synchronizer is called [`sync_Bits`][sync_Bits]. It's possible
to configure the bit count of indivital bits. If a vector shall be synchronized,
use one of the special synchronizers like `sync_Vector`. The vendor specific
implementations are named [`sync_Bits_Altera`][sync_Bits_Altera] and
[`sync_Bits_Xilinx`][sync_Bits_Xilinx] respectivily.

A second variant of the 2-FF synchronizer is called [`sync_Reset`][sync_Reset].
It's for `Reset`-signals, implementing asynchronous assertion and synchronous
deassertion. The vendor specific implementations are named [`sync_Reset_Altera`][sync_Reset_Altera]
and [`sync_Reset_Xilinx`][sync_Reset_Xilinx] respectivily.

#### Special Synchronizers

Based on the 2-FF synchronizer, several "high-level" synchronizers are build.

 -  [`sync_Strobe`][sync_Strobe] synchronizer `Strobe`-signals across clock-domain-boundaries. A busy
    signal indicates the synchronization status and can be used as a internal
    gate-signal to disallow new incoming strobes. A `Strobe`-signal is only for
    one clock period active.
 -  [`sync_Command`][sync_Command] like sync_Strobe, it synchronizes a one clock period active
    signal across the clock-domain-boundary, but the input has multiple bits.
    After the multi bit strobe (Command) was transfered, the output goes to its
    idle value.
 -  [`sync_Vector`][sync_Vector] synchronizes a complete vector across the clock-domain-boundary.
    A changed detection on the input vector causes a register to latch the current
    state. The changed event is transfered to the new clock-domain and triggers a
    register to store the latched content, but in the new clock domain.

See [`PoC.fifo.ic_got`][fifo] for a cross-clock capable FIFO.

 [my_config]:			../../common/my_config.vhdl.template
 [sync.pkg]:			sync.pkg.vhdl
 [sync_Bits]:			sync_Bits.vhdl
 [sync_Bits_Altera]:	sync_Bits_Altera.vhdl
 [sync_Bits_Xilinx]:	sync_Bits_Xilinx.vhdl
 [sync_Reset]:			sync_Reset.vhdl
 [sync_Reset_Altera]:	sync_Reset_Altera.vhdl
 [sync_Reset_Xilinx]:	sync_Reset_Xilinx.vhdl
 [sync_Strobe]:			sync_Strobe.vhdl
 [sync_Command]:		sync_Command.vhdl
 [sync_Vector]:			sync_Vector.vhdl

 [fifo]:				../../fifo


text:
'''

'''
from __future__ import absolute_import
import logging

# logging
log_level = logging.INFO
log_level = logging.DEBUG

# edwinServer odbc configuration
metadb_url_odbc = "DSN=my_edwin_database;UID=username_abc;PWD=pwd_123"

# script run mode for alarm_send.py
alarm_send_in_daemon_mode = False

# email account for alarm_send.py
use_mailx_settings = False
smtp_host = "smtp.gmail.com"
smtp_port = 465
smtp_over_ssl = True
mail_user = "SENDER@gmail.com"
mail_pwd = "MYPASSWD"

# edwin web url
# This url will be embedded in notification email.
# Be noted that host should not be localhost, 127.0.0.1 , 0.0.0.0
web_url = "http://10.100.10.1:5000"


text:
<!DOCTYPE>

    <title>Chat Application!</title>

    <link rel="stylesheet"
      href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
      integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
      crossorigin="anonymous">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://use.fontawesome.com/c2f12d37fe.css" media="all" rel="stylesheet">

    <link rel="stylesheet" href="app.css">

Online

          <form>

                <input type="text" id="msg" name="message" autocomplete="off"
                placeholder="Type a message..." class="form-control">

            <button type="submit" class="btn btn-default"></button>

          </form>


text:
'use strict';

const declarationValueIndex = require('../../utils/declarationValueIndex');
const isStandardSyntaxFunction = require('../../utils/isStandardSyntaxFunction');
const matchesStringOrRegExp = require('../../utils/matchesStringOrRegExp');
const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
const valueParser = require('postcss-value-parser');
const vendor = require('../../utils/vendor');
const { isRegExp, isString } = require('../../utils/validateTypes');

const ruleName = 'function-disallowed-list';

const messages = ruleMessages(ruleName, {
	rejected: (name) => `Unexpected function "${name}"`,
});

const meta = {
	url: 'https://stylelint.io/user-guide/rules/function-disallowed-list',
};

/** @type {import('stylelint').Rule<string | RegExp | Array<string | RegExp>>} */
const rule = (primary) => {
	return (root, result) => {
		const validOptions = validateOptions(result, ruleName, {
			actual: primary,
			possible: [isString, isRegExp],
		});

		if (!validOptions) {
			return;
		}

		root.walkDecls((decl) => {
			valueParser(decl.value).walk((node) => {
				if (node.type !== 'function') {
					return;
				}

				if (!isStandardSyntaxFunction(node)) {
					return;
				}

				if (!matchesStringOrRegExp(vendor.unprefixed(node.value), primary)) {
					return;
				}

				const index = declarationValueIndex(decl) + node.sourceIndex;
				const endIndex = index + node.value.length;

				report({
					message: messages.rejected,
					messageArgs: [node.value],
					node: decl,
					index,
					endIndex,
					result,
					ruleName,
				});
			});
		});
	};
};

rule.primaryOptionArray = true;

rule.ruleName = ruleName;
rule.messages = messages;
rule.meta = meta;
module.exports = rule;


text:
function util.TranslateToPlayerModel( model )

	if model == "models/player/urban.mbl" then
		return "models/player/urban.mdl"
	end

	if model == "models/killingfloor/haroldlott.mdl" then
		return "models/player/haroldlott.mdl"
	end

	model = string.Replace( model, "models/humans/", "models/" )
	model = string.Replace( model, "models/", "models/" )

	/*if !string.find( model, "models/player/" ) then
		model = string.Replace( model, "models/", "models/player/" )
	end*/

	return model

end


text:
module RecentlyPs4Games
end

require 'pry'
require 'open-uri'
require 'nokogiri'
require 'watir-webdriver'
require 'phantomjs'

require_relative "recently_ps4_games/cli.rb"
require_relative "recently_ps4_games/game.rb"
require_relative "recently_ps4_games/scraper.rb"
require_relative "recently_ps4_games/version.rb"


text:
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Blog\ModelBundle\EventListner;

use Blog\CoreBundle\Services\BundleResolver;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;

/**
 * Description of DinamicRelationSuscriber
 *
 * @author Вадим
 */
class DynamicRelationSubscriber implements EventSubscriber
{

    const COMMENT_ENTITY_PATH = "Blog\ModelBundle\Entity\Post";

    private $resolveClass;
    private $bundleResolver;

    public function __construct( $resolveClass, BundleResolver $bundleResolver )
    {
        $this->resolveClass = $resolveClass;
        $this->bundleResolver = $bundleResolver;
    }

    public function getSubscribedEvents()
    {
        return array(
            Events::loadClassMetadata,
        );
    }

    public function loadClassMetadata( LoadClassMetadataEventArgs $args )
    {
        /** @var $metadata ClassMetadata */
        $metadata = $args->getClassMetadata();

        if( !$this->bundleResolver->bundleIsset('comment') || $metadata->getName() != self::COMMENT_ENTITY_PATH )
            return;

        $metadata->mapOneToMany( array(
            'targetEntity' => $this->resolveClass,
            'fieldName'    => 'comments',
            'mappedBy' => "comment_object",
            'cascade' => array('remove')

        ));
    }

}


text:
import VueSlider from '../vue-slider'

export interface Styles {
  [key: string]: any
}

export type Direction = 'ltr' | 'rtl' | 'ttb' | 'btt'
export type Position = 'top' | 'right' | 'bottom' | 'left'

export type Value = number | string

// data
export interface DataObject {
  [value: string]: string
}

// Mark
export interface MarkOption {
  label: Value
  style?: Styles
  activeStyle?: Styles
  labelStyle?: Styles
  labelActiveStyle?: Styles
}
export interface Mark extends MarkOption {
  active?: boolean
  pos: number
  value: Value
}
export interface Marks {
  [key: string]: string | MarkOption
}
export type MarksFunction = (value: Value) => boolean | MarkOption
export type MarksProp = boolean | Marks | Value[] | MarksFunction

// Tooltip
export interface TooltipStyle {
  tooltipStyle?: Styles
  tooltipFocusStyle?: Styles
  tooltipDisabledStyle?: Styles
}
export type TooltipProp = 'none' | 'always' | 'focus' | 'hover' | 'active'
export type TooltipFormatterFunc = (val: Value) => string
export type TooltipFormatter = string | TooltipFormatterFunc

// Dot
export interface DotStyle {
  style?: Styles
  focusStyle?: Styles
  disabledStyle?: Styles
}
export interface DotOption extends DotStyle, TooltipStyle {
  disabled: boolean
  tooltip?: TooltipProp
  min?: Value
  max?: Value
}
export interface Dot extends DotOption {
  pos: number
  index: number
  value: Value
  focus: boolean
}

// Process
export type ProcessOption = Array<[number, number, Styles?]>
export type ProcessFunc = (dotsPos: number[]) => ProcessOption
export type ProcessProp = boolean | ProcessFunc
export interface Process {
  start: number
  end: number
  index: number
  style?: Styles
}

export default VueSlider


text:
package in.srain.cube.cache;

import in.srain.cube.request.JsonData;

public abstract class QueryJsonHandler implements QueryHandler<JsonData> {

    @Override
    public JsonData processRawDataFromCache(JsonData rawData) {
        return rawData;
    }
}


text:
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Specify Vip" %}{% endblock %}

{% block page_header %}
  {% include "horizon/common/_page_header.html" with title=_("Specify Vip") %}
{% endblock page_header %}

{% block main %}
  {% include 'horizon/common/_workflow.html' %}
{% endblock %}


text:
class UserInvitation < Invitation
  belongs_to :account
  validates_presence_of :account

  after_create :set_token, :detect_user

  validates_presence_of :user

  private

    def detect_user
      user = User.find_by_email(self.email)
      if user
        self.account.promote(user) unless user.has_role('staff', self.account)
        send_notification_email
        self.redeem!
      else
        send_invitation_email
      end
    end

    def send_invitation_email
      Circulation.deliver_user_invitation(self.account, self)
    end

    def send_notification_email
      Circulation.deliver_account_access_notification(self.account, self)
    end

end


text:
<html>
<script>window.location = '/speaking/slides/Constraint-Validation/Grand-Rapids'</script>
</html>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GitClientVS.UI.Converters;

namespace GitClientVS.UI.Controls
{
    /// <summary>
    /// Interaction logic for ProgressBar.xaml
    /// </summary>
    public partial class ProgressBar : UserControl
    {
        public double? OverrideWidth
        {
            get { return (double?)GetValue(OverrideWidthProperty); }
            set { SetValue(OverrideWidthProperty, value); }
        }

        // Using a DependencyProperty as the backing store for OverrideWidth.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty OverrideWidthProperty =
            DependencyProperty.Register("OverrideWidth", typeof(double?), typeof(ProgressBar), new PropertyMetadata(null));

        public double? OverrideHeight
        {
            get { return (double?)GetValue(OverrideHeightProperty); }
            set { SetValue(OverrideHeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for OverrideHeight.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty OverrideHeightProperty =
            DependencyProperty.Register("OverrideHeight", typeof(double?), typeof(ProgressBar), new PropertyMetadata(null));

        public UIElement ProgressContent
        {
            get { return (UIElement)GetValue(ProgressContentProperty); }
            set { SetValue(ProgressContentProperty, value); }
        }

        // Using a DependencyProperty as the backing store for ProgressContent.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ProgressContentProperty =
            DependencyProperty.Register("ProgressContent", typeof(UIElement), typeof(ProgressBar), new PropertyMetadata(null, OnProgressContentChanged));

        private static void OnProgressContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var obj = d as ProgressBar;
            obj?.RefreshVisibility();
        }

        public ProgressBar()
        {
            InitializeComponent();
            this.IsVisibleChanged += ProgressBar_IsVisibleChanged;
            this.Loaded += ProgressBar_Loaded;
        }

        private void ProgressBar_Loaded(object sender, RoutedEventArgs e)
        {
            if (OverrideHeight != null)
                ProgressRing.Height = OverrideHeight.Value;
            if (OverrideWidth != null)
                ProgressRing.Width = OverrideWidth.Value;
        }

        private void ProgressBar_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            RefreshVisibility();
        }

        private void RefreshVisibility()
        {
            if (ProgressContent != null)
            {
                ProgressContent.Visibility = this.Visibility == Visibility.Visible
                    ? Visibility.Collapsed
                    : Visibility.Visible;
            }
        }
    }
}


text:
title: Finding numbers for which the sum of the squares of the digits is a square
localeTitle: البحث عن الأرقام التي يكون مجموع مربعات الأرقام فيها مربعًا
---
## المشكلة 171: البحث عن الأرقام التي يكون مجموع مربعات الأرقام فيها مربعًا

هذا هو كعب. [ساعد مجتمعنا على توسيعه](https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/coding-interview-prep/project-euler/problem-171-finding-numbers-for-which-the-sum-of-the-squares-of-the-digits-is-a-square/index.md) .

[سيساعدك دليل النمط السريع هذا على ضمان قبول طلب السحب](https://github.com/freecodecamp/guides/blob/master/README.md) .


text:
(function () {
  'use strict';

  angular
    .module('core')
    .factory('menuService', menuService);

  function menuService () {
    var shouldRender;
    var service = {
      addMenu: addMenu,
      addMenuItem: addMenuItem,
      addSubMenuItem: addSubMenuItem,
      defaultRoles: ['user', 'admin'],
      getMenu: getMenu,
      menus: {},
      removeMenu: removeMenu,
      removeMenuItem: removeMenuItem,
      removeSubMenuItem: removeSubMenuItem,
      validateMenuExistence: validateMenuExistence
    };

    init();

    return service;

    // Add new menu object by menu id
    function addMenu (menuId, options) {
      options = options || {};

      // Create the new menu
      service.menus[menuId] = {
        roles: options.roles || service.defaultRoles,
        items: options.items || [],
        shouldRender: shouldRender
      };

      // Return the menu object
      return service.menus[menuId];
    }

    // Add menu item object
    function addMenuItem (menuId, options) {
      // Validate that the menu exists
      service.validateMenuExistence(menuId);

      options = options || {};

      // Push new menu item
      service.menus[menuId].items.push({
        title: options.title || '',
        state: options.state || '',
        type: options.type || 'item',
        class: options.class,
        roles: ((options.roles === null || typeof options.roles === 'undefined') ? service.defaultRoles : options.roles),
        position: options.position || 0,
        items: [],
        shouldRender: shouldRender
      });

      // Add submenu items
      if (options.items) {
        options.items.forEach(function (subMenuItem) {
          service.addSubMenuItem(menuId, options.state, subMenuItem);
        });
      }

      // Return the menu object
      return service.menus[menuId];
    }

    // Add submenu item object
    function addSubMenuItem (menuId, parentItemState, options) {
      options = options || {};

      // Validate that the menu exists
      service.validateMenuExistence(menuId);

      // Search for menu item
      service.menus[menuId].items.filter(function (item) {
        return item.state === parentItemState;
      }).forEach(function (item) {
        item.items.push({
          title: options.title || '',
          state: options.state || '',
          params: options.params || {},
          roles: ((options.roles === null || typeof options.roles === 'undefined') ? item.roles : options.roles),
          position: options.position || 0,
          shouldRender: shouldRender
        });
      });

      // Return the menu object
      return service.menus[menuId];
    }

    // Get the menu object by menu id
    function getMenu (menuId) {
      // Validate that the menu exists
      service.validateMenuExistence(menuId);

      // Return the menu object
      return service.menus[menuId];
    }

    function init () {
      // A private function for rendering decision
      shouldRender = function (user) {
        if (this.roles.indexOf('*') !== -1) {
          return true;
        }

        if (!user) {
          return false;
        }

        var matchingRoles = user.roles.filter(function (userRole) {
          return this.roles.indexOf(userRole) !== -1;
        }, this);

        return matchingRoles.length > 0;
      };

      // Adding the topbar menu
      addMenu('topbar', {
        roles: ['*']
      });
    }

    // Remove existing menu object by menu id
    function removeMenu (menuId) {
      // Validate that the menu exists
      service.validateMenuExistence(menuId);

      delete service.menus[menuId];
    }

    // Remove existing menu object by menu id
    function removeMenuItem (menuId, menuItemState) {
      // Validate that the menu exists
      service.validateMenuExistence(menuId);

      // Filter out menu items that do not match the current menu item state.
      service.menus[menuId].items = service.menus[menuId].items.filter(function (item) {
        return item.state !== menuItemState;
      });

      // Return the menu object
      return service.menus[menuId];
    }

    // Remove existing menu object by menu id
    function removeSubMenuItem (menuId, subMenuItemState) {
      // Validate that the menu exists
      service.validateMenuExistence(menuId);

      // Filter out sub-menu items that do not match the current subMenuItemState
      service.menus[menuId].items.forEach(function (parentMenuItem) {
        parentMenuItem.items = parentMenuItem.items.filter(function (subMenuItem) {
          return subMenuItem.state !== subMenuItemState;
        });
      });

      // Return the menu object
      return service.menus[menuId];
    }

    // Validate menu existence
    function validateMenuExistence (menuId) {
      if (!(menuId && menuId.length)) {
        throw new Error('MenuId was not provided');
      }
      if (!service.menus[menuId]) {
        throw new Error('Menu does not exist');
      }
      return true;
    }
  }
}());


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\SocialServiceManagerSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin ([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field ($model, 'id') ?>

    <?= $form->field ($model, 'user_id') ?>

    <?= $form->field ($model, 'faculty_id') ?>

        <?= Html::submitButton ('Search', ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton ('Reset', ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end (); ?>


text:
using System.Collections.Generic;
using System.Runtime.Serialization;

using Microsoft.Graph;

using Newtonsoft.Json;

// **NOTE** This file was generated by a tool and any changes will be overwritten.

namespace Microsoft.OneDrive.Sdk
{
    /// <summary>
    /// The type File.
    /// </summary>
    [DataContract]
    [JsonConverter(typeof(DerivedTypeConverter))]
    public partial class File
    {

        /// <summary>
        /// Gets or sets hashes.
        /// </summary>
        [DataMember(Name = "hashes", EmitDefaultValue = false, IsRequired = false)]
        public Hashes Hashes { get; set; }

        /// <summary>
        /// Gets or sets mimeType.
        /// </summary>
        [DataMember(Name = "mimeType", EmitDefaultValue = false, IsRequired = false)]
        public string MimeType { get; set; }

        /// <summary>
        /// Gets or sets additional data.
        /// </summary>
        [JsonExtensionData(ReadData = true)]
        public IDictionary<string, object> AdditionalData { get; set; }

    }
}


text:
[![Latest Stable Version](https://poser.pugx.org/3rdpartyeve/phealng/v/stable.png)](https://packagist.org/packages/3rdpartyeve/phealng)
[![Total Downloads](https://poser.pugx.org/3rdpartyeve/phealng/downloads.png)](https://packagist.org/packages/3rdpartyeve/phealng)

Copyright (C) 2012, 2013, 2014 by Peter Petermann
All rights reserved.

PhealNG is a refactoring of Pheal to meet more modern PHP development standards, for example to support namespaces
and PSR-0 classloading.

## LICENSE
Pheal is licensed under a MIT style license, see LICENSE.txt
for further information

## FEATURES
- does not need to change when EVE API changes

## REQUIREMENTS
- PHP 5.4+

## INSTALLATION

### composer
PhealNG will be available as package 3rdpartyeve/phealng through packagist on composer http://getcomposer.org, if you
don't know composer yet, now is a good time to read up on it.

You can also download it from github, but life is so much easier with composer!

## PhealNG Usage

### Prequesites

#### composer.json
In your project root create a file named composer.json, containing
the following json data:

```json
{
    "require": {
        "3rdpartyeve/phealng": "1.0.*"
    }
}
```
_Note:_ replace 1.0.* by what ever version you want to use, you can use dev-master
but it will likely be unstable.

_Hint:_ PhealNG follows semantic versioning http://semver.org

_Hint:_ [![Latest Stable Version](https://poser.pugx.org/3rdpartyeve/phealng/v/stable.png)](https://packagist.org/packages/3rdpartyeve/phealng)

#### composer
Composer is a tool intended to manage dependencies in PHP applications.
If you haven't installed composer yet, checkout the composer installation here:
http://getcomposer.org/doc/00-intro.md#installation-nix

#### run composer
Now in your projects root, run the following command, which will
download PhealNG for you and update the vendor/autoload.php
```bash
$ php composer.phar install
```

### the most basic PhealNG Script
this is a very basic example, which should be able to run on its own
(with only pheal as dependency) obviously, if you use a framework, some
of the steps might look different, for example if you use symfony2,
you might already have composer working and already have the autoloading
required.

PhealNG basically builds the request by the scope and the method called,
in this example the scope used is "server" and the API page requested is
ServerStatus.xml.aspx

For more information on the API Pages available, refer to
http://wiki.eve-id.net/APIv2_Page_Index

```php
<?php
require_once 'vendor/autoload.php';

//import namespace
use Pheal\Pheal;

// create pheal object with default values
// so far this will not use caching, and since no key is supplied
// only allow access to the public parts of the EVE API
$pheal = new Pheal();

// requests /server/ServerStatus.xml.aspx
$response = $pheal->serverScope->ServerStatus();

echo sprintf(
  "Hello Visitor! The EVE Online Server is: %s!, current amount of online players: %s",
  $response->serverOpen ? "open" : "closed",
  $response->onlinePlayers
);
```

### a bit more complex script
most API Pages require an API key with a certain set of rights available,
in this example we will request char/CharacterSheet.xml.aspx, which requires
a characterID passed as parameter, aswell as an API Key that contains the
AccessMask 8.

```php
<?php
require_once 'vendor/autoload.php';

//import namespace
use Pheal\Pheal;
use Pheal\Core\Config;

// the information required by this example, usually, your application would
// prompt your user for this, and/or use its database to read those information
// information like the characterID can be obtained through the EVE API,
// please check the documentation at http://wiki.eve-id.net/APIv2_Page_Index for more information
$keyID = 123456;
$vCode = "AbcDEFghYXZadfADFasdFASDFasdfQWERGHADAQerqEFADSFASDfqQER";
$characterID = 1234567;

// Pheal configuration
// Pheal may be configured through variables at the \Pheal\Cache\FileStorage Singleton object
// this allows to use different fetchers, caches, archives etc.

// setup file cache - CCP wants you to respect their cache timers, meaning
// some of the API Pages will return the same data for a specific while, or worse
// an error. If you use one of the availabe caching implementations,
// pheal will do the caching transparently for you.
// in this example we use the file cache, and configure it so it will write the cache files
// to /tmp/phealcache
Config::getInstance()->cache = new \Pheal\Cache\FileStorage('/tmp/phealcache/');

// The EVE API blocks applications which cause too many errors. Requesting a page
// that the API key does not allow to request is one of those possible errors.
// Pheal can be configured so pheal will request the AccessMask of a specific key
// and block requests to API Pages not covered by that key.
Config::getInstance()->access = new \Pheal\Access\StaticCheck();

// create pheal object with default values
// so far this will not use caching, and since no key is supplied
// only allow access to the public parts of the EVE API
//
// in this example, instead of using the scopenameScope getter,
// we set the scope directly in the constructor
$pheal = new Pheal($keyID, $vCode, "char");

try {
    // parameters for the request, like a characterID can be added
    // by handing the method an array of those parameters as argument
    $response = $pheal->CharacterSheet(array("characterID" => $characterID));

    echo sprintf(
        "Hello Visitor, Character %s was created at %s is of the %s race and belongs to the corporation %s",
        $response->name,
        $response->DoB,
        $response->race,
        $response->corporationName
    );

// there is a variety of things that can go wrong, like the EVE API not responding,
// the key being invalid, the key not having the rights to call the method
// or the characterID beeing wrong - just to name a few. So it is basically
// a good idea to catch Exceptions. Usually you would want to log that the
// exception happend and then decide how to inform the user about it.
// In this example we simply catch all PhealExceptions and display their message
} catch (\Pheal\Exceptions\PhealException $e) {
    echo sprintf(
        "an exception was caught! Type: %s Message: %s",
        get_class($e),
        $e->getMessage()
    );
}
```

### Configuration Options
In the previous example there is already two configuration options introduced,
however there are quite a few more. For more information it is worth reading the
contents of the vendor/3rdpartyeve/phealng/lib/Pheal/Core/Config.php file.

### Caching
CCP wants you to respect their cache timers, meaning some of the API Pages will return
the same data for a specific while, or worse an error. If you use one of the available
caching implementations, pheal will do the caching transparently for you.
Pheal offers this implementations out of the box:
- NullStorage (no caching!)
- FileStorage
- ForcedFileStorage
- HashedNameFileStorage
- MemcacheStorage
- RedisStorage
- PdoStorage (database caching)

Please refer to the api docs of the classes for more information.

#### PdoStorage (database caching)
In order to cache the request in the database you have to create the table first.

for a MySQL DB you can use this snippet as an example:

```mysql
CREATE TABLE `phealng-cache` (
    `userId` INT(10) UNSIGNED NOT NULL,
    `scope` VARCHAR(50) NOT NULL,
    `name` VARCHAR(100) NOT NULL,
    `args` VARCHAR(250) NOT NULL,
    `xml` LONGTEXT NOT NULL,
    PRIMARY KEY (`userId`, `scope`, `name`, `args`)
)
COMMENT='Caching for PhealNG'
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
```

## Problems / Bugs
if you find any problems with PhealNG, please use githubs issue tracker at https://github.com/3rdpartyeve/phealng/issues

## TODO
- more documentation

## LINKS
- [Github](http://github.com/3rdpartyeve/phealng)
- [devedge](http://devedge.eu/project/pheal/)

## CONTACT
- Peter Petermann <ppetermann80@googlemail.com>

## Contributors
- Daniel Hoffend (Wollari)

## ACKNOWLEDGEMENTS
- PhealNG is based on the now deprecated [Pheal](http://github.com/ppetermann/pheal)
- PhealNG is written in [PHP](http://php.net)
- Pheal is based on [EAAL](http://github.com/3rdpartyeve/eaal)
- Pheal is build for use of the [EVE Online](http://eveonline.com) API


text:
package org.develnext.jphp.ext.mongo.bind;

import com.mongodb.client.model.CountOptions;
import com.mongodb.client.model.IndexOptions;
import java.util.concurrent.TimeUnit;
import php.runtime.Memory;
import php.runtime.common.HintType;
import php.runtime.env.Environment;
import php.runtime.env.TraceInfo;
import php.runtime.ext.core.classes.time.WrapTimer;
import php.runtime.memory.ArrayMemory;
import php.runtime.memory.support.MemoryOperation;
import php.runtime.reflection.ParameterEntity;

public class CountOptionsMemoryOperation extends MemoryOperation<CountOptions> {

    @Override
    public Class<?>[] getOperationClasses() {
        return new Class[] { CountOptions.class };
    }

    @Override
    public CountOptions convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
        if (arg.isNull()) return null;

        ArrayMemory arr = arg.toValue(ArrayMemory.class);
        CountOptions options = new CountOptions();

        if (arr.containsKey("skip")) options.skip(arg.valueOfIndex("skip").toInteger());
        if (arr.containsKey("limit")) options.limit(arg.valueOfIndex("limit").toInteger());
        if (arr.containsKey("maxTime")) {
            options.maxTime(WrapTimer.parsePeriod(arg.valueOfIndex("maxTime").toString()), TimeUnit.MILLISECONDS);
        }

        return options;
    }

    @Override
    public Memory unconvert(Environment env, TraceInfo trace, CountOptions arg) throws Throwable {
        if (arg == null) return Memory.NULL;

        ArrayMemory options = ArrayMemory.createHashed(12);

        options.put("skip", arg.getSkip());
        options.put("limit", arg.getLimit());
        options.put("maxTime", arg.getMaxTime(TimeUnit.MILLISECONDS));

        return options;
    }

    @Override
    public void applyTypeHinting(ParameterEntity parameter) {
        parameter.setType(HintType.ARRAY);
    }
}


text:
freifunk-red-andy
=================

This theme is a modified version of the Red-Andy theme at http://projects.andriylesyuk.com/projects/red-andy

To install this theme change into your redmine themes directory and clone this repository, for example:

    cd /usr/share/redmine/public/themes/
    git clone https://github.com/rubo77/freifunk-red-andy.git

Changes from originating Red-Andy theme:
----
https://github.com/rubo77/freifunk-red-andy/commit/35e3e0b4b986be777eb033427c3ef97b80a10dca


text:
package com.learnback.work.lightweb;

import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import org.xlightweb.IFutureResponse;
import org.xlightweb.IHttpResponse;
import org.xlightweb.IHttpResponseHandler;
import org.xlightweb.InvokeOn;

/**
 *
 * @Description: TODO(自定义响应处理器)
 * @Author Wu.Zhang
 * @Date 2015年11月16日
 * @Version 1.0.0
 */
@InvokeOn(InvokeOn.HEADER_RECEIVED)
public class MyResponseHandler implements IHttpResponseHandler, IFutureResponse {

	private IHttpResponse response;
	private CountDownLatch latch = new CountDownLatch(1);

	@Override
	public void onResponse(IHttpResponse response) throws IOException {
		// TODO Auto-generated method stub
		this.response = response;
		latch.countDown();
	}

	@Override
	public void onException(IOException ioe) throws IOException {
		// TODO Auto-generated method stub
		System.out.println(ioe.getMessage());
	}

	@Override
	public IHttpResponse getResponse() throws IOException,
			InterruptedException, SocketTimeoutException {
		// TODO Auto-generated method stub
		return getResponse(Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
	}

	@Override
	public IHttpResponse getResponse(long timeout, TimeUnit unit)
			throws IOException, InterruptedException, SocketTimeoutException {
		// TODO Auto-generated method stub
		latch.await(timeout, unit);
		return response;
	}

	@Override
	public IHttpResponse get() throws InterruptedException, ExecutionException {
		// TODO Auto-generated method stub
		try {
			return getResponse();
		} catch (SocketTimeoutException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return response;
	}

	@Override
	public IHttpResponse get(long timeout, TimeUnit unit)
			throws InterruptedException, ExecutionException, TimeoutException {
		// TODO Auto-generated method stub
		try {
			return getResponse(timeout, unit);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return response;
	}

	@Override
	public boolean isDone() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean cancel(boolean mayInterruptIfRunning) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isCancelled() {
		// TODO Auto-generated method stub
		return false;
	}

}


text:
package cucumber.runtime.converters;

import com.thoughtworks.xstream.converters.ConverterLookup;
import com.thoughtworks.xstream.converters.SingleValueConverter;
import gherkin.I18n;
import org.junit.Test;

import java.math.BigDecimal;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class ConvertersTest {
    @Test
    public void shouldTransformToTheRightType() {
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        LocalizedXStreams transformers = new LocalizedXStreams(classLoader);

        ConverterLookup en = transformers.get(new I18n("en")).getConverterLookup();
        assertTrue((Boolean) ((SingleValueConverter) en.lookupConverterForType(Boolean.class)).fromString("true"));
        assertTrue((Boolean) ((SingleValueConverter) en.lookupConverterForType(Boolean.TYPE)).fromString("true"));
        assertEquals(3000.15f, (Float) ((SingleValueConverter) en.lookupConverterForType(Float.class)).fromString("3000.15"), 0.000001);
        assertEquals(3000.15f, (Float) ((SingleValueConverter) en.lookupConverterForType(Float.TYPE)).fromString("3000.15"), 0.000001);
        assertEquals(new BigDecimal("3000.15"), ((SingleValueConverter) en.lookupConverterForType(BigDecimal.class)).fromString("3000.15"));

        ConverterLookup no = transformers.get(new I18n("no")).getConverterLookup();
        assertEquals(3000.15f, (Float) ((SingleValueConverter) no.lookupConverterForType(Float.TYPE)).fromString("3000,15"), 0.000001);
    }
}


text:
require 'spec_helper'

describe Mongo::Operation::Write::Command::Delete do
  include_context 'operation'

  let(:deletes) { [{:q => { :foo => 1 }, :limit => 1}] }
  let(:spec) do
    { :deletes       => deletes,
      :db_name       => db_name,
      :coll_name     => coll_name,
      :write_concern => write_concern,
      :ordered       => true
    }
  end

  let(:op) { described_class.new(spec) }

  describe '#initialize' do

    context 'spec' do

      it 'sets the spec' do
        expect(op.spec).to eq(spec)
      end
    end
  end

  describe '#==' do

    context 'spec' do

      context 'when two ops have the same specs' do
        let(:other) { described_class.new(spec) }

        it 'returns true' do
          expect(op).to eq(other)
        end
      end

      context 'when two ops have different specs' do
        let(:other_deletes) { [{:q => { :bar => 1 }, :limit => 1}] }
        let(:other_spec) do
          { :deletes       => other_deletes,
            :db_name       => db_name,
            :coll_name     => coll_name,
            :write_concern => write_concern.options,
            :ordered       => true
          }
        end
        let(:other) { described_class.new(other_spec) }

        it 'returns false' do
          expect(op).not_to eq(other)
        end
      end
    end
  end

  describe '#execute' do

    context 'server' do

      context 'message' do
        let(:expected_selector) do
          { :deletes       => deletes,
            :delete        => coll_name,
            :writeConcern => write_concern.options,
            :ordered       => true
          }
        end

        it 'creates a query wire protocol message with correct specs' do
          allow_any_instance_of(Mongo::ServerSelector::Primary).to receive(:server) do
            primary_server
          end

          expect(Mongo::Protocol::Query).to receive(:new) do |db, coll, sel, options|
            expect(db).to eq(db_name)
            expect(coll).to eq(Mongo::Database::COMMAND)
            expect(sel).to eq(expected_selector)
          end
          op.execute(primary_context)
        end
      end
    end
  end
end


text:
<?php

namespace Google\AdsApi\AdManager\v202202;

/**
 * This file was generated from WSDL. DO NOT EDIT.
 */
class AudienceSegmentType
{
    const FIRST_PARTY = 'FIRST_PARTY';
    const SHARED = 'SHARED';
    const THIRD_PARTY = 'THIRD_PARTY';
    const UNKNOWN = 'UNKNOWN';

}


text:
package uk.nhs.kch.rassyeyanie.common.testing.unit;

import org.junit.Test;

import ca.uhn.hl7v2.model.v24.segment.MSH;
import ca.uhn.hl7v2.model.v24.segment.PID;
import ca.uhn.hl7v2.model.v24.segment.PV1;

public class AbstractO01Test extends AbstractHl7Test {

	public AbstractO01Test(String actualSourcePath, String expectedPath) {
		super(actualSourcePath, expectedPath);
	}

	@Test
	public void test_message_to_message_msh() throws Exception {
		segment_tester(MSH.class);

	}

	@Test
	public void test_message_to_message_pid() throws Exception {
		segment_tester(PID.class);
	}

	@Test
	public void test_message_to_message_pv1() throws Exception {
		segment_tester(PV1.class);
	}

}


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

<TITLE>
HSSFConditionalFormattingRule (POI API Documentation)
</TITLE>

<META NAME="date" CONTENT="2009-12-14">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.poi.hssf.usermodel

Class HSSFConditionalFormattingRule

java.lang.Object
  org.apache.poi.hssf.usermodel.HSSFConditionalFormattingRule

public final class HSSFConditionalFormattingRule
extends java.lang.Object

High level representation of Conditional Formatting Rule.
 It allows to specify formula based conditions for the Conditional Formatting
 and the formatting settings such as font, border and pattern.

Author:

Dmitriy Kumshayev

Method Summary

 HSSFBorderFormatting
createBorderFormatting()

          create a new border formatting structure if it does not exist,
 otherwise just return existing object.

 HSSFFontFormatting
createFontFormatting()

          create a new font formatting structure if it does not exist,
 otherwise just return existing object.

 HSSFPatternFormatting
createPatternFormatting()

          create a new pattern formatting structure if it does not exist,
 otherwise just return existing object.

 HSSFBorderFormatting
getBorderFormatting()

 byte
getComparisonOperation()

 byte
getConditionType()

 HSSFFontFormatting
getFontFormatting()

 java.lang.String
getFormula1()

 java.lang.String
getFormula2()

 HSSFPatternFormatting
getPatternFormatting()

Methods inherited from class java.lang.Object

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

Method Detail

getFontFormatting

public HSSFFontFormatting getFontFormatting()

Returns:
- font formatting object  if defined,  null otherwise

createFontFormatting

public HSSFFontFormatting createFontFormatting()

create a new font formatting structure if it does not exist,
 otherwise just return existing object.

Returns:
- font formatting object, never returns null.

getBorderFormatting

public HSSFBorderFormatting getBorderFormatting()

Returns:
- border formatting object  if defined,  null otherwise

createBorderFormatting

public HSSFBorderFormatting createBorderFormatting()

create a new border formatting structure if it does not exist,
 otherwise just return existing object.

Returns:
- border formatting object, never returns null.

getPatternFormatting

public HSSFPatternFormatting getPatternFormatting()

Returns:
- pattern formatting object  if defined, null otherwise

createPatternFormatting

public HSSFPatternFormatting createPatternFormatting()

create a new pattern formatting structure if it does not exist,
 otherwise just return existing object.

Returns:
- pattern formatting object, never returns null.

getConditionType

public byte getConditionType()

Returns:
-  the conditiontype for the cfrule

getComparisonOperation

public byte getComparisonOperation()

Returns:
- the comparisionoperatation for the cfrule

getFormula1

public java.lang.String getFormula1()

getFormula2

public java.lang.String getFormula2()

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

                Copyright 2009 The Apache Software Foundation or
        its licensors, as applicable.


text:
class ActionString
  def initialize(string)
    @string = string
  end

  def used?
    @used || false
  end

  def to_s
    @used = true
    @string
  end

  def inspect
    @string
  end

  def respond_to?(m)
    @string.respond_to?(m)
  end

  def method_missing(m, *args)
    if respond_to?(m)
      @used = true
      @string.send(m)
    else
      super
    end
  end
end


text:
package com.google.cloud.healthcare;

import com.google.common.base.CharMatcher;
import org.dcm4che3.data.Attributes;
import org.dcm4che3.data.Tag;
import org.dcm4che3.util.TagUtils;

public class StringUtil {

  public static String trim(String value) {
    return CharMatcher.is('/').trimFrom(value);
  }

  public static String joinPath(String serviceUrlPrefix, String path) {
    return StringUtil.trim(serviceUrlPrefix) + "/" + StringUtil.trim(path);
  }

  public static String getTagValueAsStringOrException(Attributes attrs, int tag)
      throws IllegalArgumentException {
    String val = attrs.getString(tag, null);
    if (val == null) {
      throw new IllegalArgumentException("Invalid value for tag " + TagUtils.toHexString(tag));
    }
    return val;
  }
}


text:
@interface BWStyledTextField : NSTextField
{

}

- (BOOL)hasGradient;
- (void)setHasGradient:(BOOL)flag;
- (NSColor *)startingColor;
- (void)setStartingColor:(NSColor *)color;
- (NSColor *)endingColor;
- (void)setEndingColor:(NSColor *)color;

- (NSColor *)solidColor;
- (void)setSolidColor:(NSColor *)color;

- (BOOL)hasShadow;
- (void)setHasShadow:(BOOL)flag;
- (BOOL)shadowIsBelow;
- (void)setShadowIsBelow:(BOOL)flag;
- (NSColor *)shadowColor;
- (void)setShadowColor:(NSColor *)color;

@end


text:
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using MasterCard.SDK.Services.PartnerWallet.Domain.SwitchAPI;

namespace MasterCard.SDK.Services.PartnerWallet
{
    public class GetConnectionsService : Connector
    {
        private readonly Environments.Environment environment;

        private const string SANDBOX_URL = "https://sandbox.api.mastercard.com/masterpass/partner/v6/connectedmerchants?Format=XML";
        private const string PRODUCTION_URL = "https://api.mastercard.com/masterpass/partner/v6/connectedmerchants?Format=XML";
        private const string MTF_URL = "https://api.mastercard.com/mtf/masterpass/partner/v6/connectedmerchants?Format=XML";

        public GetConnectionsService(Environments.Environment environment, string consumerKey, AsymmetricAlgorithm privateKey)
            : base(consumerKey, privateKey)
        {
            this.environment = environment;
        }

        public ConnectionList GetConnectionList(ConnectedMerchantsRequest request)
        {
            string response = "";
            Dictionary<string, string> responseMap = doRequest(getURL(), "POST", Serializer<ConnectedMerchantsRequest>.Serialize(request).InnerXml);
            responseMap.TryGetValue(MESSAGE, out response);
            return Serializer<ConnectionList>.Deserialize(response);
        }

        private String getURL()
        {
            if (this.environment == Environments.Environment.PRODUCTION)
            {
                return PRODUCTION_URL;
            }
            else if (this.environment == Environments.Environment.MTF)
            {
                return MTF_URL;
            }
            else
            {
                return SANDBOX_URL;
            }
        }
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package co.com.codesoftware.persistence.entities.simple;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author nicolas
 */
@Entity
@Table(name = "in_tprpr")
public class PrecioProdSimpleEntity implements Serializable {

    @Id
    @Column(name = "prpr_prpr")
    private Integer id;
    @Column(name = "prpr_dska")
    private Integer idDska;
    @Column(name = "prpr_precio")
    private BigDecimal precio;
    @Column(name = "prpr_premsiva")
    private BigDecimal precioConIva;
    @Column(name = "prpr_tius_crea")
    private Integer idTius;
    @Column(name = "prpr_tius_update")
    private Integer idTiusUpd;
    @Column(name = "prpr_estado")
    private String estado;
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "prpr_fecha")
    private Date fecha;
    @Column(name = "prpr_sede")
    private Integer idSede;
    @Column(name = "prpr_preu")
    private BigDecimal precioUnidad;
    @Column(name = "prpr_prec")
    private BigDecimal precioCentena;
    @Column(name = "prpr_prem")
    private BigDecimal precioMillar;

    public Integer getId() {
        return id;
    }

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

    public Integer getIdDska() {
        return idDska;
    }

    public void setIdDska(Integer idDska) {
        this.idDska = idDska;
    }

    public BigDecimal getPrecio() {
        return precio;
    }

    public void setPrecio(BigDecimal precio) {
        this.precio = precio;
    }

    public BigDecimal getPrecioConIva() {
        return precioConIva;
    }

    public void setPrecioConIva(BigDecimal precioConIva) {
        this.precioConIva = precioConIva;
    }

    public Integer getIdTius() {
        return idTius;
    }

    public void setIdTius(Integer idTius) {
        this.idTius = idTius;
    }

    public Integer getIdTiusUpd() {
        return idTiusUpd;
    }

    public void setIdTiusUpd(Integer idTiusUpd) {
        this.idTiusUpd = idTiusUpd;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Integer getIdSede() {
        return idSede;
    }

    public void setIdSede(Integer idSede) {
        this.idSede = idSede;
    }

    public BigDecimal getPrecioUnidad() {
        return precioUnidad;
    }

    public void setPrecioUnidad(BigDecimal precioUnidad) {
        this.precioUnidad = precioUnidad;
    }

    public BigDecimal getPrecioCentena() {
        return precioCentena;
    }

    public void setPrecioCentena(BigDecimal precioCentena) {
        this.precioCentena = precioCentena;
    }

    public BigDecimal getPrecioMillar() {
        return precioMillar;
    }

    public void setPrecioMillar(BigDecimal precioMillar) {
        this.precioMillar = precioMillar;
    }

}


text:
#!/bin/sh

#
# Copyright 2020 metaeffekt GmbH.
#
# 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.
#

echo "Executing centos-extractor.sh"

# create folder structure in analysis folder (assuming sufficient permissions)
mkdir -p /analysis/package-meta
mkdir -p /analysis/package-files
mkdir -p /analysis/filesystem

# generate list of all files (excluding the analysis folders; excluding symlinks)
find / ! -path "/analysis/*" ! -path "/container-extractors/*" -type f | sort > /analysis/filesystem/files.txt
find / ! -path "/analysis/*" ! -path "/container-extractors/*" -type d | sort > /analysis/filesystem/folders.txt
find / ! -path "/analysis/*" ! -path "/container-extractors/*" -type l | sort > /analysis/filesystem/links.txt

# analyse symbolic links
rm -f /analysis/filesystem/symlinks.txt
touch /analysis/filesystem/symlinks.txt
filelist=`cat /analysis/filesystem/links.txt`
for file in $filelist
do
  echo "$file --> `readlink $file`" >> /analysis/filesystem/symlinks.txt
done

# examine distributions metadata
uname -a > /analysis/uname.txt
cat /etc/issue > /analysis/issue.txt
cat /etc/centos-release > /analysis/release.txt || true
cat /etc/redhat-release > /analysis/release.txt || true

# list packages
rpm -qa --qf '| %{NAME} | %{VERSION} | %{LICENSE} |\n' | sort > /analysis/packages_rpm.txt

# list packages names (no version included)
rpm -qa --qf '%{NAME}\n' | sort > /analysis/packages_rpm-name-only.txt

# query package metadata and covered files
packagenames=`cat /analysis/packages_rpm-name-only.txt`
for package in $packagenames
do
  rpm -qi $package > /analysis/package-meta/${package}_rpm.txt
  rpm -q --filesbypkg ${package} | sed 's/[^/]*//' | sort > /analysis/package-files/${package}_files.txt
done

# copy resources in /usr/share/doc
mkdir -p /analysis/usr-share-doc/
cp --no-preserve=mode -rf /usr/share/doc/* /analysis/usr-share-doc/ || true

# copy resources in /usr/share/licenses
mkdir -p /analysis/usr-share-licenses/
cp --no-preserve=mode -rf /usr/share/licenses/* /analysis/usr-share-licenses/ || true

# if docker is installed dump the image list
command -v docker && docker images > /analysis/docker-images.txt || true

# adapt ownership of extracted files to match folder creator user and group
chown `stat -c '%u' /analysis`:`stat -c '%g' /analysis` -R /analysis


text:
package com.lambdaworks.redis.output;

import java.nio.ByteBuffer;

import com.lambdaworks.redis.LettuceStrings;
import com.lambdaworks.redis.ScanCursor;
import com.lambdaworks.redis.codec.RedisCodec;

/**
 * Cursor handling output.
 *
 * @param <K> Key type.
 * @param <V> Value type.
 * @param <T> Cursor type.
 * @author Mark Paluch
 */
public abstract class ScanOutput<K, V, T extends ScanCursor> extends CommandOutput<K, V, T> {

    public ScanOutput(RedisCodec<K, V> codec, T cursor) {
        super(codec, cursor);
    }

    @Override
    public void set(ByteBuffer bytes) {

        if (output.getCursor() == null) {
            output.setCursor(decodeAscii(bytes));
            if (LettuceStrings.isNotEmpty(output.getCursor()) && "0".equals(output.getCursor())) {
                output.setFinished(true);
            }
            return;
        }

        setOutput(bytes);

    }

    protected abstract void setOutput(ByteBuffer bytes);
}


text:
package squash.booking.lambdas.core;

import com.amazonaws.services.lambda.runtime.LambdaLogger;

import java.util.List;

/**
 * Interface for all classes managing web pages.
 *
 *
All modifications to the website's web pages should be
 *    performed by a class implementing this interface.
 *
 * @author robinsteel19@outlook.com (Robin Steel)
 */
public interface IPageManager {

  /**
   * Initialises the manager with a CloudwatchLogs logger.
   *
   * @throws Exception when initialisation fails.
   */
  void initialise(IBookingManager bookingsManager, ILifecycleManager lifecycleManager,
      LambdaLogger logger) throws Exception;

  /**
   * Refreshes a bookings web page and cached JSON data for a specified date.
   *
   *
This has a parameter for requesting a guid-suffixed duplicate of the page also be created.
   *    This is a workaround for S3's only-eventual-consistency, to ensure someone creating or
   *    deleting a booking will always be shown a booking page with their change immediately visible.
   *    The cached JSON data does not have a guid suffix - we assume the javascript client for this
   *    is capable of handling eventual-consistency issues itself.
   *
   * @param date the date to refresh in YYYY-MM-DD format.
   * @param validDates the dates for which bookings can be made, in YYYY-MM-DD format.
   * @param apiGatewayBaseUrl the base Url of our apigateway Api, e.g. https://dhfmlwxdgr.execute-api.eu-west-1.amazonaws.com/SquashApi.
   * @param createDuplicate whether to create a duplicate of the page in S3 with a GUID suffix.
   * @param bookings the bookings for the specified date.
   * @param revvingSuffix the suffix to use for the linked css file, used for cache rev-ing.
   *
   * @return The guid embedded in the refreshed page, and used as a suffix when a duplicate is created.
   * @throws Exception when the method fails.
   */
  String refreshPage(String date, List<String> validDates, String apiGatewayBaseUrl,
      Boolean createDuplicate, List<Booking> bookings, String revvingSuffix) throws Exception;

  /**
   * Refreshes bookings web pages for all currently-bookable dates.
   *
   *
Refreshes all booking pages for dates that are currently bookable:
   *

   *
Updates all web pages for currently-bookable dates.

   *
Does not create guid-suffixed duplicates of these pages.

   *
Updates the index web page to redirect to the current day's booking page.

   *
Deletes the booking page for the previous day - if there is one.

   *

   *
   * @param validDates the dates for which bookings can be made, in YYYY-MM-DD format.
   * @param apiGatewayBaseUrl the base Url of our apigateway Api
   * @param revvingSuffix the suffix to use for the linked css file, used for cache rev-ing.
   *
   * @throws Exception when refreshing all pages fails.
   */
  void refreshAllPages(List<String> validDates, String apiGatewayBaseUrl, String revvingSuffix)
      throws Exception;

  /**
   * Uploads famous players JSON data.
   *
   *
This uploads a single json file with names of the most recent mens and womens world finalists.
   *    This is used to provide two names to use as placeholders on the court reservation form, which
   *    will be chosen randomly from this file for each view of the form.
   *
   * @throws Exception when the method fails.
   */
  void uploadFamousPlayers() throws Exception;
}


text:
'''Tests for table_evaluator'''

from table_evaluator import TableEvaluator
import mysite.settings as settings
import helpers.api_util as api_util
from helpers_test import createTable, stdoutIO, TableFileHelper, \
    TEST_DIR, augmentPythonPath, runProcess
import os
import column as cl
import numpy as np
from os.path import join
import shutil
import unittest

# Constants
COLUMN = "DUMMY"
COLUMN1 = "DUMMY1"
COLUMN2 = "A"
COLUMN3 = "DUMMY3"
COLUMN4 = "DUMMY4"
COLUMNB = "B"
COLUMNC = "C"
COLUMN_VALID_FORMULA = "VALID_FORMULA"
COLUMN_INVALID_FORMULA = "INVALID_FORMULA"
COLUMN_USING_EXPORT = "E"
TABLE_NAME = "DUMMY_TABLE"
LIST = [2.0, 3.0]
LIST2 = [3.0]
TABLE = 'DUMMY'
VALID_FORMULA = "np.sin(A) + B"
VALID_FORMULA_WITH_USER_FUNCTION = "np.sin(A) + timesTwo(B)"
SECOND_VALID_FORMULA = "np.cos(C)"
INVALID_FORMULA = "np.cun(A)" # Invalid function
COLUMN1_CELLS = ["one", "two", "three"]
COLUMN2_CELLS = [10.0, 20.0, 30.0]
COLUMNB_CELLS = [100.0, 200.0, 300.0]
COLUMNC_CELLS = [1000.0, 2000.0, 3000.0]
IMPORT_PATHS = ["", "scisheets.core"]
FUNCTION_NAME = "myFunction"
FILE1 = "table_evaluator_test_1.scish"
FILE2 = "table_evaluator_test_2.scish"

IGNORE_TEST = False

# Ensure current directory is in the path
augmentPythonPath([__file__, 'helpers/program_generator.py'])

#############################
# Tests
#############################
# pylint: disable=W0212
# pylint: disable=C0111
# pylint: disable=R0904
class TestTableEvaluator(unittest.TestCase):

  def setUp(self):
    """
    Creates the following structure:
    DUMMY_TABLE
      row:
        DUMMY1:
        A:
        B:
        C:
        VALID_FORMULA:
    """
    self.table = createTable(TABLE_NAME)
    self._addColumn(COLUMN1, cells=COLUMN1_CELLS)
    self.column_a = self._addColumn(COLUMN2, cells=COLUMN2_CELLS)
    self.column_b = self._addColumn(COLUMNB, cells=COLUMNB_CELLS)
    self.column_c = self._addColumn(COLUMNC, cells=COLUMNC_CELLS)
    self.column_valid_formula = self._addColumn(COLUMN_VALID_FORMULA,
                                                formula=VALID_FORMULA)
    api_util.writeObjectToFile(self.table)
    self.evaluator = TableEvaluator(self.table)

  def _addColumn(self, name, cells=None, formula=None):
    column = cl.Column(name)
    if formula is not None:
      column.setFormula(formula)
    if cells is not None:
      column.addCells(cells)
    self.table.addColumn(column)
    return column

  def testConstructor(self):
    if IGNORE_TEST:
      return
    evaluator = TableEvaluator(self.table)
    self.assertEqual(evaluator._table.getName(is_global_name=False),
        TABLE_NAME)

  def testEvaluate(self):
    if IGNORE_TEST:
      return
    error = self.evaluator.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(error)
    # pylint: disable=E1101
    formula_result = (
                       np.sin(np.array(self.column_a.getCells()))
                       + np.array(self.column_b.getCells())
                     )
    is_equal = np.equal(formula_result,
                 np.array(self.column_valid_formula.getCells())).all()
    self.assertTrue(is_equal)

  def testEvaluateError(self):
    if IGNORE_TEST:
      return
    column_invalid_formula = cl.Column(COLUMN_INVALID_FORMULA)
    column_invalid_formula.setFormula(INVALID_FORMULA)
    self.table.addColumn(column_invalid_formula)
    evaluator = TableEvaluator(self.table)
    error = evaluator.evaluate(user_directory=TEST_DIR)
    self.assertIsNotNone(error)

  def testEvaluateTwoFormulas(self):
    if IGNORE_TEST:
      return
    self.column_a.setFormula(SECOND_VALID_FORMULA)  # Make A a formula column
    evaluator = TableEvaluator(self.table)
    error = evaluator.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(error)

  def testEvaluateWithNoneValues(self):
    if IGNORE_TEST:
      return
    table = self.table
    row = table.getRow()
    table.addRow(row, 0.1)  # Add a new row after
    error = self.evaluator.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(error)
    new_row = table.getRow()
    new_row['A'] = 1
    new_row['B'] = 1
    table.updateRow(new_row, 1)
    error = self.evaluator.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(error)

  def testEvaluateWithUserFunction(self):
    if IGNORE_TEST:
      return
    self.column_valid_formula.setFormula(VALID_FORMULA_WITH_USER_FUNCTION)
    errors = self.evaluator.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(errors)

  def testEvaluateFormulaWithRowAddition(self):
    if IGNORE_TEST:
      return
    # Tests a formula that should increase the number of rows.
    num_rows = self.table.numRows()
    formula = "range(%d)" % (num_rows + 1)
    self.column_valid_formula.setFormula(formula)
    self.table.evaluate(user_directory=TEST_DIR)
    self.assertEqual(self.table.numRows(), num_rows + 1)

  def testEvaluateFormulaWithLargeRowAddition(self):
    if IGNORE_TEST:
      return
    # Tests a formula that should increase the number of rows.
    num_rows = 1000
    formula = "range(%d)" % num_rows
    self.column_valid_formula.setFormula(formula)
    self.table.evaluate(user_directory=TEST_DIR)
    self.assertEqual(self.table.numRows(), num_rows)

  def testEvaluateRowInsert(self):
    if IGNORE_TEST:
      return
    row_index = 1
    new_row = self.table.getRow()
    self.table.insertRow(new_row, index=row_index)
    error = self.table.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(error)
    new_row['A'] = 0.5
    new_row['B'] = 0.6
    self.table.updateRow(new_row, index=row_index)
    error = self.table.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(error)  # Formula should work

  def testEvalWithMixedTypes(self):
    if IGNORE_TEST:
      return
    self.column_b.setFormula("range(len(A))")
    self.column_valid_formula.setFormula("np.sin(np.array(B, dtype=float))")
    self.table.evaluate(user_directory=TEST_DIR)
    for val in self.column_valid_formula.getCells():
      self.assertIsNotNone(val)

  def _createExport(self, function_name, no_outputs=2):
    # Two formula columns
    self.column_a.setFormula(SECOND_VALID_FORMULA)  # Make A a formula column
    self.table.evaluate(user_directory=TEST_DIR)
    if no_outputs == 2:
      outputs=[COLUMN_VALID_FORMULA, COLUMN2]
    else:
      outputs=[COLUMN_VALID_FORMULA]
    self.table.export(function_name=function_name,
                      inputs=[COLUMNC, COLUMNB],
                      outputs=outputs,
                      user_directory=TEST_DIR)

  def testExport(self):
    if IGNORE_TEST:
      return
    # Two formula columns
    self._createExport(FUNCTION_NAME)
    file_name = "%s.py" % FUNCTION_NAME
    file_path = join(TEST_DIR, file_name)
    test_file_name = "test_%s.py" % FUNCTION_NAME
    test_file_path = join(TEST_DIR, test_file_name)
    try:
      with stdoutIO():
        execfile(file_path)
      success = True
    except IOError:
      success = False
    self.assertTrue(success)
    # Run the program and its test. Will get an exception if these fail.
    commands = """
        cd %s
        python manage.py test scisheets.core.test_dir.%s
        """ % (settings.BASE_DIR, FUNCTION_NAME)
    out = runProcess(commands)
    test_commands = """
        cd %s;
        python manage.py test scisheets.core.test_dir.test_%s
        """ % (settings.BASE_DIR, FUNCTION_NAME)
    test_out = runProcess(test_commands)

  def testUsingExport(self):
    if IGNORE_TEST:
      return
    self._createExport(FUNCTION_NAME, no_outputs=1)
    # Create a column that uses this function
    formula = "%s(%s, %s)" % (FUNCTION_NAME, COLUMNC, COLUMNB)
    column_using_export = self._addColumn(COLUMN_USING_EXPORT,
                                          formula=formula)
    error = self.evaluator.evaluate(user_directory=TEST_DIR)
    self.assertEqual(column_using_export.getCells(),
                     self.column_valid_formula.getCells())

  def testRunningSheetWithExport(self):
    if IGNORE_TEST:
     return
    """
    Imports two sheets. The first is the Michaelis-Menten sheet. The second
    is a sheet with S, V, V_MAX, K_M. This test:
     1. Exports the first sheet
     2. Changes the V_MAX formula in the second sheet to use the export
     3. Evaluates the second sheet
    """
    def isEqualColumns(table1, table2, colnm):
      """
      Checks that the tables have the same value for the column name
      :param Table table1:
      :param Table table2:
      :param str colnm:
      """
      value1 = table1.columnFromName(colnm).getCells()[0]
      value2 = table2.columnFromName(colnm).getCells()[0]
      self.assertEqual(value1, value2)

    function_name = "MM"
    # Read the tables
    table1 = api_util.readObjectFromFile(join(TEST_DIR, FILE1))
    table2 = api_util.readObjectFromFile(join(TEST_DIR, FILE1))
    # Set V_MAX in the second table to a dummy value
    column_v_max_second = table2.columnFromName("V_MAX")
    column_v_max_second.setFormula("range(10)")
    evaluator = TableEvaluator(table2)
    evaluator.evaluate(user_directory=TEST_DIR)
    # Use the exported first table for the values of V_MAX, K_M
    table1.export(function_name=function_name,
                      inputs=["S", "V"],
                      outputs=["V_MAX", "K_M"],
                      user_directory=TEST_DIR)
    formula = "V_MAX, K_M = %s(S, V)" % function_name
    column_v_max_second.setFormula(formula)
    evaluator = TableEvaluator(table2)
    evaluator.evaluate(user_directory=TEST_DIR)
    isEqualColumns(table1, table2, "V_MAX")
    isEqualColumns(table1, table2, "K_M")

  @staticmethod
  def _countNonNone(aList):
    return len([x for x in aList if (x is not None)
        and (not np.isnan(x))])  # pylint: disable=E1101

  def _testFormulaVariations(self, formula1, formula2, len1, len2):
    # Checks compound formulas of different combinations.
    # Input: formula1 - valid python expression
    #        formula2 - valid python statement for column A or ""
    #        len1 - length of the array created by formula1
    #        len2 - length of the array created by formula2
    if len(formula2) == 0:
      formula = formula1
      self.column_valid_formula.setFormula(formula)
      error = self.evaluator.evaluate(user_directory=TEST_DIR)
      if error is not None:
        import pdb; pdb.set_trace()
      self.assertIsNone(error)
      self.assertEqual(
          TestTableEvaluator._countNonNone(
          self.column_valid_formula.getCells()), len1)
    else:
      formula = "%s; %s" % (formula1, formula2)
      self.column_valid_formula.setFormula(formula)
      self.assertIsNone(self.evaluator.evaluate(user_directory=TEST_DIR))
      self.assertEqual(
          TestTableEvaluator._countNonNone(
          self.column_valid_formula.getCells()), len1)
      self.assertEqual(
          TestTableEvaluator._countNonNone(self.column_a.getCells()),
          len2)

  def testFormulaVariations(self):
    if IGNORE_TEST:
      return
    size = 10
    list_expr = "[n for n in range(%d)]" % size
    scalar_expr = "np.sin(3.1)"
    list_stmt = "A = np.array([n for n in range(%d)])" % size
    list_stmt1 = "VALID_FORMULA = np.array([n for n in range(%d)])" % size
    scalar_stmt = "A = np.sin(3.1)"
    scalar_stmt1 = "VALID_FORMUAL = np.sin(3.1)"
    self._testFormulaVariations(list_expr, "", size, 0)
    self._testFormulaVariations(scalar_expr, "", 1, 0)
    self._testFormulaVariations(list_stmt, scalar_stmt, 1, 1)
    self._testFormulaVariations(scalar_stmt1, scalar_stmt, 1, 1)
    self._testFormulaVariations(list_stmt1, list_stmt, size, size)

  def testDefinedFunctionInFormula(self):
    if IGNORE_TEST:
      return
    formula = '''
def is_prime(n):
    limit = int(mt.sqrt(n)) + 1
    for m in range(2, limit):
      if n % m == 0:
        return False
    return True
def find_primes(n):
  result = []
  for m in range(2, n):
    if is_prime(m):
      result.append(m)
  return result
DUMMY1 = find_primes(100)
'''
    self.column_valid_formula.setFormula(formula)
    errors = self.evaluator.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(errors)

  def testTableNamespaceHasColumnsInSubtables(self):
    """
    Tests that a name in a subtable is in the namespace
    and can be evaluated.

    DUMMY_TABLE
      row
      DUMMY1
      A
      B
      C
      VALID_FORMULA
      Subtable
        row
        SubtableColumn1
        SubtableColumn2
    """
    if IGNORE_TEST:
      return
    column_name1 = "SubtableColumn1"
    column_name2 = "SubtableColumn2"
    colnms = [column_name1, column_name2]
    subtable = createTable("Subtable", column_name=colnms)
    self.table.addChild(subtable)
    column2 = subtable.columnFromName(column_name2)
    formula = "SubtableColumn1*10"
    column2.setFormula(formula)
    errors = self.evaluator.evaluate(user_directory=TEST_DIR)
    self.assertIsNone(errors)

if __name__ == '__main__':
  unittest.main()


text: window.LOADER_TEST = "loader2a";


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  <filter>
    <filter-name>characterEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>characterEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.css</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.gif</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.jpg</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.js</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.css</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.gif</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.jpg</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.png</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.js</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>/login</welcome-file>
  </welcome-file-list>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <listener>
    <listener-class>
			org.springframework.web.context.request.RequestContextListener
		</listener-class>
  </listener>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:../spring-servlet.xml</param-value>
  </context-param>
  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>
				org.apache.cxf.transport.servlet.CXFServlet
			</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/cxf/*</url-pattern>
  </servlet-mapping>

  <!--

    <servlet>
        <servlet-name>AxisServlet</servlet-name>
        <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>
     -->
</web-app>


text:
@interface QUEViewController : UIViewController

@end


text:
package org.artifactory.schedule;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
 * Date: 11/6/12
 * Time: 11:24 AM
 *
 * @author freds
 */
public class DummyExecutorService implements ExecutorService {
    final CachedThreadPoolTaskExecutor taskExecutor;

    public DummyExecutorService(CachedThreadPoolTaskExecutor taskExecutor) {
        this.taskExecutor = taskExecutor;
    }

    @Override
    public <T> Future<T> submit(Callable<T> task) {
        return this.taskExecutor.submit(task);
    }

    @Override
    public void shutdown() {
        throw new UnsupportedOperationException();
    }

    @Override
    public List<Runnable> shutdownNow() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean isShutdown() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean isTerminated() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
        throw new UnsupportedOperationException();
    }

    @Override
    public <T> Future<T> submit(Runnable task, T result) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Future<?> submit(Runnable task) {
        throw new UnsupportedOperationException();
    }

    @Override
    public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
        throw new UnsupportedOperationException();
    }

    @Override
    public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
            throws InterruptedException {
        throw new UnsupportedOperationException();
    }

    @Override
    public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
        throw new UnsupportedOperationException();
    }

    @Override
    public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
            throws InterruptedException, ExecutionException, TimeoutException {
        throw new UnsupportedOperationException();
    }

    @Override
    public void execute(Runnable command) {
        throw new UnsupportedOperationException();
    }
}


text:
<?php
$bookstoreName = $_POST['bookstore'];
$dbName		   = $_POST['dbname'];
$i			   = 0;
$isbns		   = Array();
while (($isbn = $_POST["isbn{$i}"]) != ''){
	array_push($isbns, $isbn);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php echo "<title>{$bookstoreName} Bookstore by The Bookstore Genie</title>"; ?>
<link rel = "stylesheet" type = "text/css" href = "style/main.css" />

		<map name = "nav_map">
		  <area shape = "rect" coords = "0,0,57,16" href = "index.html">
		  <area shape = "rect" coords = "57,0,144,16" href = "about.html">
		</map>

<?php
		for ($j = 0; $j < count($isbns); $j++){
			//echo "Name" . $j . $_GET["name" . $j];
			//echo count($source_arr);
			echo "";
				echo "";
		}
		echo "

Click here to go back and enter in more books

";
		echo"
 ";
		//echo mysql_num_rows($result);
		//$row = mysql_fetch_array($result, MYSQL_ASSOC);
		//echo $sql . $result;
	}

?>


text:
from openstack import resource

class Policy(resource.Resource):
    resource_key = 'policy'
    resources_key = 'policies'
    base_path = '/policies'

    # Capabilities
    allow_list = True
    allow_fetch = True
    allow_create = True
    allow_delete = True
    allow_commit = True

    commit_method = 'PATCH'

    _query_mapping = resource.QueryParameters(
        'name', 'type', 'sort', 'global_project')

    # Properties
    #: The name of the policy.
    name = resource.Body('name')
    #: The type name of the policy.
    type = resource.Body('type')
    #: The ID of the project this policy belongs to.
    project_id = resource.Body('project')
    # The domain ID of the policy.
    domain_id = resource.Body('domain')
    #: The ID of the user who created this policy.
    user_id = resource.Body('user')
    #: The timestamp when the policy is created.
    created_at = resource.Body('created_at')
    #: The timestamp when the policy was last updated.
    updated_at = resource.Body('updated_at')
    #: The specification of the policy.
    spec = resource.Body('spec', type=dict)
    #: A dictionary containing runtime data of the policy.
    data = resource.Body('data', type=dict)

class PolicyValidate(Policy):
    base_path = '/policies/validate'

    # Capabilities
    allow_list = False
    allow_fetch = False
    allow_create = True
    allow_delete = False
    allow_commit = False

    commit_method = 'PUT'