text:
class RenameOrdersToQuotations < ActiveRecord::Migration[5.1]
  def change
  	rename_table(:orders, :quotations)
  	rename_column(:order_items, :order_id, :quotation_id)
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Google\AdsApi\AdWords\v201702\o;

/**
 * This file was generated from WSDL. DO NOT EDIT.
 */
class RelatedToQuerySearchParameter extends \Google\AdsApi\AdWords\v201702\o\SearchParameter
{

    /**
     * @var string[] $queries
     */
    protected $queries = null;

    /**
     * @param string $SearchParameterType
     * @param string[] $queries
     */
    public function __construct($SearchParameterType = null, array $queries = null)
    {
      parent::__construct($SearchParameterType);
      $this->queries = $queries;
    }

    /**
     * @return string[]
     */
    public function getQueries()
    {
      return $this->queries;
    }

    /**
     * @param string[] $queries
     * @return \Google\AdsApi\AdWords\v201702\o\RelatedToQuerySearchParameter
     */
    public function setQueries(array $queries)
    {
      $this->queries = $queries;
      return $this;
    }

}


text:
/**
 * @file		icomm.hpp
 * @brief		communication interface class
 * @author		Byunghun Hwang<bhhwang@nsynapse.com>
 * @date 		2015. 8. 2
 * @details		communication base interface class
 */

#ifndef _COSSB_INTERFACE_ICOMM_HPP_
#define _COSSB_INTERFACE_ICOMM_HPP_

namespace cossb {
namespace interface {

/**
 * @brief	communication read interface
 */
class icommread {
public:
	virtual ~icommread() {}

protected:
	virtual int read() const = 0;
};

/**
 * @brief	communication write interface
 */
class icommwrite {
public:
	virtual ~icommwrite() {}

protected:
	virtual int write(const char* data, int len) = 0;
};

/**
 * @vrief	communication interface
 */
class icomm : protected icommread, protected icommwrite {
public:
	virtual ~icomm() { }

};

#define DECLARE_INTERFACE_ICOMMREAD		int read() const;
#define DECLARE_INTERFACE_ICOMMWRITE	int write(const char* data, int len);

#define	DECLARE_INTERFACE_ICOMM \
	DECLARE_INTERFACE_ICOMMREAD \
	DECLARE_INTERFACE_ICOMMWRITE

} /* namespace interface */
} /* namespace cossb */

#endif /* _COSSB_INTERFACE_ICOMM_HPP_ */


text:
require 'active_support/concern'
require 'active_model/validations'

module RestforceModel::Actions
  extend ActiveSupport::Concern
  include ActiveModel::Validations

  def update_attributes(new_attributes)
    assign_attributes(new_attributes)
    run_callbacks :save do
      if valid?
        client.update!(self.class.mapped_model, attributes_for_update)
        RestforceModel.cache.delete([self.class, id])
        RestforceModel.cache.delete_matched("#{self.class}/query/*")
        true
      else
        false
      end
    end
  end

  def save
    run_callbacks :save do
      if valid?
        ActiveSupport::Notifications.instrument("salesforce.create", :model => self.class.to_s) do
          self.Id = client.create!(self.class.mapped_model, attributes_for_create)
          RestforceModel.cache.delete_matched("#{self.class}/query/*")
        end
        true
      else
        false
      end
    end
  end

  def destroy
    run_callbacks :destroy do
      ActiveSupport::Notifications.instrument("salesforce.destroy", :model => self.class.to_s) do
        client.destroy!(self.class.mapped_model, id)
        RestforceModel.cache.delete([self.class, id])
        RestforceModel.cache.delete_matched("#{self.class}/query/*")
      end
    end
  end

  def attributes_for_create
    attributes_for_create = attributes
                                .reject { |k, v| k.to_sym == :Id }
                                .select { |k, v| self.class.mapped_attributes.has_key?(k) && v.present? }
    attributes_for_create.each { |k, v| attributes_for_create[k] = self.class.to_soql(k, v) }
  end

  def attributes_for_update
    attributes_for_update = attributes.select { |k, v| changes.include?(k) || k.to_sym == :Id }
    attributes_for_update.each { |k, v| attributes_for_update[k] = self.class.to_soql(k, v) }
  end

  private :attributes_for_create
  private :attributes_for_update

  module ClassMethods

    def to_soql(field, value)
      type = self.mapped_attributes[field]
      unless type == :string
        converter = "RestforceModel::Converters::#{type.to_s.camelize}Converter".constantize rescue nil
        value = converter.to_soql(value) unless converter.nil?
      end
      value
    end

    def from_soql(field, value)
      type = self.mapped_attributes[field]
      unless type == :string
        converter = "RestforceModel::Converters::#{type.to_s.camelize}Converter".constantize rescue nil
        value = converter.from_soql(value) unless converter.nil?
      end
      value
    end

    # TODO add handling of passed in client
    def query(conditions = nil)
      ActiveSupport::Notifications.instrument("salesforce.query", :model => self.to_s, :conditions => conditions) do
        conditions = prepare_conditions(conditions)
        results = RestforceModel.cache.fetch([self, :query, conditions]) do
          items = client.query("SELECT #{fields_for_query} FROM #{mapped_model} #{conditions}")
          items.each { |item| RestforceModel.cache.write([self, item[:Id]], item) }
        end
        results.map { |r| new(r.symbolize_keys) }
      end
    end

    alias_method :where, :query

    def prepare_conditions(conditions)
      conditions.prepend("RecordType.DeveloperName = '#{mapped_record_type}' ") unless mapped_record_type.blank?
      conditions.prepend("WHERE ") unless conditions.blank?
    end

    def display_fields
      mapped_attributes.keys.reject { |a| a == :Id }
    end

    def fields_for_query
      query_fields = mapped_attributes.keys.dup
      mapped_parent_attributes.each do |parent, fields|
        fields.each_key do |field|
          query_fields.push("#{parent}.#{field}")
        end
      end
      query_fields.map(&:to_s).join(',')
    end

    def fields_for_create
      mapped_attributes.keys.reject { |f| [:Id].include?(f) }
    end

    # Retrieve an object by `Id` using Restforce.
    #
    # It uses `#mapped_model` class method and `#query_fields` as well as the passed in `Id` to retireve a record
    #
    # raises a `RestforceModel::Exception::RecordNotFound` if the query returns nil
    #
    def find(id, client = nil)
      client ||= self.client
      ActiveSupport::Notifications.instrument("salesforce.find", :model => self.to_s) do
        begin
          # fetch data from cache or Salesforce API
          data = RestforceModel.cache.fetch([self, id]) do
            client.query("SELECT #{fields_for_query} FROM #{mapped_model} WHERE Id = '#{id}'").first.symbolize_keys
          end
          # instantiate the object and pass in the exact same client it was retrieved with
          new(data.merge({RestforceModel.client_key => client}))
        rescue Exception => e
          # most likely the exception is due to calling symbolize_keys on nil
          # puts e.inspect

          raise RestforceModel::Error::RecordNotFound.new(e), "Record with Id: #{id} cannot be found. #{e.message}"
        end
      end
    end
  end
end


text:
if ($env:TEAMCITY_VERSION) {
	# When PowerShell is started through TeamCity's Command Runner, the standard
	# output will be wrapped at column 80 (a default). This has a negative impact
	# on service messages, as TeamCity quite naturally fails parsing a wrapped
	# message. The solution is to set a new, much wider output width. It will
	# only be set if TEAMCITY_VERSION exists, i.e., if started by TeamCity.
	$host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.Size(8192,50)
}

function TeamCity-TestSuiteStarted([string]$name) {
	TeamCity-WriteServiceMessage 'testSuiteStarted' @{ name=$name }
}

function TeamCity-TestSuiteFinished([string]$name) {
	TeamCity-WriteServiceMessage 'testSuiteFinished' @{ name=$name }
}

function TeamCity-TestStarted([string]$name) {
	TeamCity-WriteServiceMessage 'testStarted' @{ name=$name }
}

function TeamCity-TestFinished([string]$name) {
	TeamCity-WriteServiceMessage 'testFinished' @{ name=$name }
}

function TeamCity-TestIgnored([string]$name, [string]$message='') {
	TeamCity-WriteServiceMessage 'testIgnored' @{ name=$name; message=$message }
}

function TeamCity-TestOutput([string]$name, [string]$output) {
	TeamCity-WriteServiceMessage 'testStdOut' @{ name=$name; out=$output }
}

function TeamCity-TestError([string]$name, [string]$output) {
	TeamCity-WriteServiceMessage 'testStdErr' @{ name=$name; out=$output }
}

function TeamCity-TestFailed([string]$name, [string]$message, [string]$details='', [string]$type='', [string]$expected='', [string]$actual='') {
	$messageAttributes = @{ name=$name; message=$message; details=$details }

	if (![string]::IsNullOrEmpty($type)) {
		$messageAttributes.type = $type
	}

	if (![string]::IsNullOrEmpty($expected)) {
		$messageAttributes.expected=$expected
	}
	if (![string]::IsNullOrEmpty($actual)) {
		$messageAttributes.actual=$actual
	}

	TeamCity-WriteServiceMessage 'testFailed' $messageAttributes
}

# See http://confluence.jetbrains.net/display/TCD5/Manually+Configuring+Reporting+Coverage
function TeamCity-ConfigureDotNetCoverage([string]$key, [string]$value) {
    TeamCity-WriteServiceMessage 'dotNetCoverage' @{ $key=$value }
}

function TeamCity-ImportDotNetCoverageResult([string]$tool, [string]$path) {
	TeamCity-WriteServiceMessage 'importData' @{ type='dotNetCoverage'; tool=$tool; path=$path }
}

# See http://confluence.jetbrains.net/display/TCD5/FxCop_#FxCop_-UsingServiceMessages
function TeamCity-ImportFxCopResult([string]$path) {
	TeamCity-WriteServiceMessage 'importData' @{ type='FxCop'; path=$path }
}

function TeamCity-ImportNUnitReport([string]$path) {
	TeamCity-WriteServiceMessage 'importData' @{ type='nunit'; path=$path }
}

function TeamCity-ImportJSLintReport([string]$path) {
	TeamCity-WriteServiceMessage 'importData' @{ type='jslint'; path=$path }
}

function TeamCity-PublishArtifact([string]$path) {
	TeamCity-WriteServiceMessage 'publishArtifacts' $path
}

function TeamCity-ReportBuildStart([string]$message) {
	TeamCity-WriteServiceMessage 'progressStart' $message
}

function TeamCity-ReportBuildProgress([string]$message) {
	TeamCity-WriteServiceMessage 'progressMessage' $message
}

function TeamCity-ReportBuildFinish([string]$message) {
	TeamCity-WriteServiceMessage 'progressFinish' $message
}

function TeamCity-ReportBuildStatus([string]$status, [string]$text='') {
	TeamCity-WriteServiceMessage 'buildStatus' @{ status=$status; text=$text }
}

function TeamCity-SetBuildNumber([string]$buildNumber) {
	TeamCity-WriteServiceMessage 'buildNumber' $buildNumber
}

function TeamCity-SetBuildStatistic([string]$key, [string]$value) {
	TeamCity-WriteServiceMessage 'buildStatisticValue' @{ key=$key; value=$value }
}

function TeamCity-CreateInfoDocument([string]$buildNumber='', [boolean]$status=$true, [string[]]$statusText=$null, [System.Collections.IDictionary]$statistics=$null) {
	$doc=New-Object xml;
	$buildEl=$doc.CreateElement('build');

	if (![string]::IsNullOrEmpty($buildNumber)) {
		$buildEl.SetAttribute('number', $buildNumber);
	}

	$buildEl=$doc.AppendChild($buildEl);

	$statusEl=$doc.CreateElement('statusInfo');
	if ($status) {
		$statusEl.SetAttribute('status', 'SUCCESS');
	} else {
		$statusEl.SetAttribute('status', 'FAILURE');
	}

	if ($statusText -ne $null) {
		foreach ($text in $statusText) {
			$textEl=$doc.CreateElement('text');
			$textEl.SetAttribute('action', 'append');
			$textEl.set_InnerText($text);
			$textEl=$statusEl.AppendChild($textEl);
		}
	}

	$statusEl=$buildEl.AppendChild($statusEl);

	if ($statistics -ne $null) {
		foreach ($key in $statistics.Keys) {
			$val=$statistics.$key
			if ($val -eq $null) {
				$val=''
			}

			$statEl=$doc.CreateElement('statisticsValue');
			$statEl.SetAttribute('key', $key);
			$statEl.SetAttribute('value', $val.ToString());
			$statEl=$buildEl.AppendChild($statEl);
		}
	}

	return $doc;
}

function TeamCity-WriteInfoDocument([xml]$doc) {
	$dir=(Split-Path $buildFile)
	$path=(Join-Path $dir 'teamcity-info.xml')

	$doc.Save($path);
}

function TeamCity-WriteServiceMessage([string]$messageName, $messageAttributesHashOrSingleValue) {
	function escape([string]$value) {
		([char[]] $value |
				%{ switch ($_)
						{
								"|" { "||" }
								"'" { "|'" }
								"`n" { "|n" }
								"`r" { "|r" }
								"[" { "|[" }
								"]" { "|]" }
								([char] 0x0085) { "|x" }
								([char] 0x2028) { "|l" }
								([char] 0x2029) { "|p" }
								default { $_ }
						}
				} ) -join ''
		}

	if ($messageAttributesHashOrSingleValue -is [hashtable]) {
		$messageAttributesString = ($messageAttributesHashOrSingleValue.GetEnumerator() |
			%{ "{0}='{1}'" -f $_.Key, (escape $_.Value) }) -join ' '
	} else {
		$messageAttributesString = ("'{0}'" -f (escape $messageAttributesHashOrSingleValue))
	}

	Write-Output "##teamcity[$messageName $messageAttributesString]"
}


text:
"""Tests for image.extract_glimpse()."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import numpy as np

from tensorflow.python.framework import constant_op
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import image_ops
from tensorflow.python.platform import test

class ExtractGlimpseTest(test.TestCase):

  def _VerifyValues(self, tensor_in_sizes, glimpse_sizes, offsets,
                    expected_rows, expected_cols):
    """Verifies the output values of the glimpse extraction kernel.

    Args:
      tensor_in_sizes: Input tensor dimensions in [input_rows, input_cols].
      glimpse_sizes: Dimensions of the glimpse in [glimpse_rows, glimpse_cols].
      offsets: Relative location of the center of the glimpse in the input
        image expressed as [row_offset, col_offset].
      expected_rows: A list containing the expected row numbers (None for
         out of bound entries that are expected to be replaced by uniform
         random entries in [0,1) ).
      expected_cols: Same as expected_rows, but for column numbers.
    """

    rows = tensor_in_sizes[0]
    cols = tensor_in_sizes[1]
    # Row Tensor with entries by row.
    # [[ 1 1 1 ... ]
    #  [ 2 2 2 ... ]
    #  [ 3 3 3 ... ]
    #  [ ...
    # ]
    t_rows = array_ops.tile(
        [[1.0 * r] for r in range(1, rows + 1)], [1, cols], name='tile_rows')

    # Shuffle to switch to a convention of (batch_size, height, width, depth).
    t_rows_4d = array_ops.transpose(
        array_ops.expand_dims(array_ops.expand_dims(t_rows, 0), 3),
        [0, 2, 1, 3])

    # Column Tensor with entries by column.
    # [[ 1 2 3 4 ... ]
    #  [ 1 2 3 4 ... ]
    #  [ 1 2 3 4 ... ]
    #  [ ...         ]
    # ]
    t_cols = array_ops.tile(
        [[1.0 * r for r in range(1, cols + 1)]], [rows, 1], name='tile_cols')

    # Shuffle to switch to a convention of (batch_size, height, width, depth).
    t_cols_4d = array_ops.transpose(
        array_ops.expand_dims(array_ops.expand_dims(t_cols, 0), 3),
        [0, 2, 1, 3])

    # extract_glimpses from Row and Column Tensor, respectively.
    # Switch order for glimpse_sizes and offsets to switch from (row, col)
    # convention to tensorflows (height, width) convention.
    t1 = constant_op.constant([glimpse_sizes[1], glimpse_sizes[0]], shape=[2])
    t2 = constant_op.constant([offsets[1], offsets[0]], shape=[1, 2])
    glimpse_rows = (array_ops.transpose(
        image_ops.extract_glimpse(t_rows_4d, t1, t2), [0, 2, 1, 3]))
    glimpse_cols = (array_ops.transpose(
        image_ops.extract_glimpse(t_cols_4d, t1, t2), [0, 2, 1, 3]))

    # Evaluate the TensorFlow Graph.
    with self.cached_session() as sess:
      value_rows, value_cols = sess.run([glimpse_rows, glimpse_cols])

    # Check dimensions of returned glimpse.
    self.assertEqual(value_rows.shape[1], glimpse_sizes[0])
    self.assertEqual(value_rows.shape[2], glimpse_sizes[1])
    self.assertEqual(value_cols.shape[1], glimpse_sizes[0])
    self.assertEqual(value_cols.shape[2], glimpse_sizes[1])

    # Check entries.
    min_random_val = 0
    max_random_val = max(rows, cols)
    for i in range(glimpse_sizes[0]):
      for j in range(glimpse_sizes[1]):
        if expected_rows[i] is None or expected_cols[j] is None:
          self.assertGreaterEqual(value_rows[0][i][j][0], min_random_val)
          self.assertLessEqual(value_rows[0][i][j][0], max_random_val)
          self.assertGreaterEqual(value_cols[0][i][j][0], min_random_val)
          self.assertLessEqual(value_cols[0][i][j][0], max_random_val)
        else:
          self.assertEqual(value_rows[0][i][j][0], expected_rows[i])
          self.assertEqual(value_cols[0][i][j][0], expected_cols[j])

  def testCenterGlimpse(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[3, 5],
        offsets=[0.0, 0.0],
        expected_rows=[20, 21, 22],
        expected_cols=[29, 30, 31, 32, 33])

  def testEmptyTensor(self):
    empty_image = np.zeros((0, 4, 3, 0))
    offsets = np.zeros((0, 2))
    with self.cached_session():
      result = image_ops.extract_glimpse(empty_image, [1, 1], offsets)
      self.assertAllEqual(
          np.zeros(
              (0, 1, 1, 0), dtype=np.float32), result.eval())

  def testLargeCenterGlimpse(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[41, 61],
        offsets=[0.0, 0.0],
        expected_rows=list(range(1, 42)),
        expected_cols=list(range(1, 62)))

  def testTooLargeCenterGlimpse(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[43, 63],
        offsets=[0.0, 0.0],
        expected_rows=[None] + list(range(1, 42)) + [None],
        expected_cols=[None] + list(range(1, 62)) + [None])

  def testGlimpseFullOverlap(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[3, 5],
        offsets=[0.1, 0.3],
        expected_rows=[22, 23, 24],
        expected_cols=[38, 39, 40, 41, 42])

  def testGlimpseFullOverlap2(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[11, 3],
        offsets=[-0.7, -0.7],
        expected_rows=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
        expected_cols=[8, 9, 10])

  def testGlimpseBeforeLeftMargin(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[11, 5],
        offsets=[-0.7, -0.9],
        expected_rows=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
        expected_cols=[1, 2, 3, 4, 5])

  def testGlimpseLowerRightCorner(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[7, 5],
        offsets=[1.0, 1.0],
        expected_rows=[38, 39, 40, 41, None, None, None],
        expected_cols=[59, 60, 61, None, None])

  def testGlimpseNoOverlap(self):
    self._VerifyValues(
        tensor_in_sizes=[20, 30],
        glimpse_sizes=[3, 3],
        offsets=[-2.0, 2.0],
        expected_rows=[None, None, None],
        expected_cols=[None, None, None])

  def testGlimpseOnLeftMargin(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[11, 7],
        offsets=[-0.7, -1.0],
        expected_rows=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
        expected_cols=[None, None, None, 1, 2, 3, 4])

  def testGlimpseUpperMargin(self):
    self._VerifyValues(
        tensor_in_sizes=[41, 61],
        glimpse_sizes=[7, 5],
        offsets=[-1, 0.9],
        expected_rows=[None, None, None, 1, 2, 3, 4],
        expected_cols=[56, 57, 58, 59, 60])

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


text:
werckercli.commands package
===========================

Submodules
----------

werckercli.commands.build module
--------------------------------

.. automodule:: werckercli.commands.build
    :members:
    :undoc-members:
    :show-inheritance:

werckercli.commands.clearsettings module
----------------------------------------

.. automodule:: werckercli.commands.clearsettings
    :members:
    :undoc-members:
    :show-inheritance:

werckercli.commands.create module
---------------------------------

.. automodule:: werckercli.commands.create
    :members:
    :undoc-members:
    :show-inheritance:

werckercli.commands.login module
--------------------------------

.. automodule:: werckercli.commands.login
    :members:
    :undoc-members:
    :show-inheritance:

werckercli.commands.project module
----------------------------------

.. automodule:: werckercli.commands.project
    :members:
    :undoc-members:
    :show-inheritance:

werckercli.commands.services module
-----------------------------------

.. automodule:: werckercli.commands.services
    :members:
    :undoc-members:
    :show-inheritance:

werckercli.commands.target module
---------------------------------

.. automodule:: werckercli.commands.target
    :members:
    :undoc-members:
    :show-inheritance:

werckercli.commands.update module
---------------------------------

.. automodule:: werckercli.commands.update
    :members:
    :undoc-members:
    :show-inheritance:

werckercli.commands.validate module
-----------------------------------

.. automodule:: werckercli.commands.validate
    :members:
    :undoc-members:
    :show-inheritance:

Module contents
---------------

.. automodule:: werckercli.commands
    :members:
    :undoc-members:
    :show-inheritance:


text:
@import url(common.css);
@import url(layout.css);
@import url(table.css);


text:
gem "tumblr-rb"
require 'tumblr'

module Caboodle
  class Tumblr < Caboodle::Kit
    description "Includes a tumblr.com account"

    helpers do
      def semantic_date post
        date = Date.parse(post.date)
        a = []
        a << "slug-#{post.slug}"
        a << "y#{date.year}"
        a << "m#{date.month}"
        a << "d#{date.day}"
        a.join(" ")
      end
    end

    required [:tumblr_email, :tumblr_password, :tumblr_sitename]

    menu "Tumblr" do
      tumblr = ::Tumblr::Reader.new(@tumblr_email,@tumblr_password)
      req = tumblr.read(@tumblr_sitename, {:num=>10}).perform_sleepily
      posts = ::Tumblr::Reader.get_posts(req)
      haml :tumblr, :locals => { :posts => posts }
    end

    get "/tumblr/page/:page" do
      tumblr = ::Tumblr::Reader.new(@tumblr_email,@tumblr_password)
      posts = tumblr.get_posts()
      haml :tumblr, :locals => { :posts => posts }
    end

    add_sass ["tumblr"]
  end
end


text:
(() => {
    'use strict';

    const mod = angular.module('td.scroll', []);

    mod.run(['$document', ($document) => {

        function getRTLHorizontalScrollType() {
            const body = $document.find('body');
            const tmpElem = angular.element('
A
');
            body.append(tmpElem);
            let type = 'default';
            if (tmpElem[0].scrollLeft > 0) {
                type = 'reverse';
            } else {
                tmpElem[0].scrollLeft = 1;
                if (tmpElem[0].scrollLeft === 0) {
                    type = 'negative';
                }
            }
            tmpElem.remove();
            return type;
        }

        function getDirection(element, value) {
            if (value === undefined) {
                if (window.getComputedStyle) {
                    return window.getComputedStyle(element, null).direction;
                } else if (element.currentStyle) {
                    return element.currentStyle.direction;
                }
            } else {
                element.style.direction = value;
            }
        };

        function getScrollType(element) {

            const scrollTypes = {
                default: {
                    get: () => element.scrollLeft,
                    set: v => element.scrollLeft = v
                },
                reverse: {
                    get: () => element.scrollWidth - element.clientWidth - element.scrollLeft,
                    set: v => element.scrollLeft = element.scrollWidth - element.clientWidth - v
                },
                negative: {
                    get: () => -element.scrollLeft,
                    set: v => element.scrollLeft = -v
                }
            };

            if (getDirection(element) === 'rtl') {
                return scrollTypes[rtlHorizontalScrollType];
            } else {
                return scrollTypes.default;
            }
        }

        const rtlHorizontalScrollType = getRTLHorizontalScrollType();

        angular.element.prototype.scrollLeft = function(value) {
            const e = this[0];
            if (value !== undefined) {
                // set:
                for (let i = 0; i < this.length; ++i) {
                    getScrollType(this[i]).set(value);
                }
            } else {
                // get:
                return getScrollType(this[0]).get();
            }
        };

        angular.element.prototype.direction = function(value) {
            return getDirection(this[0], value);
        };

    }]);

})();


text:
angular.module('overview.controller', [
  'lodash.service',
  'stats.service'
])

.controller('OverviewCtrl', [
  '$scope', '_', 'StatsService', 'numberFormatFilter',
  function($scope, _, StatsService, numberFormatFilter) {
    console.log(StatsService.getAggregatedResults());

    var startDate = moment().subtract(1, 'weeks');
    var endDate = moment();

    $scope.formviews = numberFormatFilter(StatsService.getViewsDeviceDistributionBetween(startDate, endDate).total);
    $scope.infolist = [{
      name: 'Responses',
      value: numberFormatFilter(StatsService.getSubmissionsDeviceDistributionBetween(startDate, endDate).total),
      color: 'red',
      icon: 'ion-reply'
    }, {
      name: 'Conversion Rate',
      value: numberFormatFilter(StatsService.getTotalConversionRate(startDate, endDate)) + '%',
      color: 'orange',
      icon: 'ion-ios-pulse-strong'
    }, {
      name: 'Average Time',
      value: StatsService.getTotalAverageTime(startDate, endDate).toString().toHHMMSS(),
      color: 'blue',
      icon: 'ion-android-time'
    }];
  }
])


text:
package de.nedelosk.modularmachines.common.utils;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

public class ItemUtil {

	public static boolean isIdenticalItem(ItemStack lhs, ItemStack rhs) {
		if (lhs == null || rhs == null) {
			return false;
		}
		if (lhs.getItem() != rhs.getItem()) {
			return false;
		}
		if (lhs.getItemDamage() != OreDictionary.WILDCARD_VALUE) {
			if (lhs.getItemDamage() != rhs.getItemDamage()) {
				return false;
			}
		}
		return ItemStack.areItemStackTagsEqual(lhs, rhs);
	}

	public static boolean isCraftingEquivalent(ItemStack base, ItemStack comparison) {
		if (base == null || comparison == null) {
			return false;
		}

		if (base.getItem() != comparison.getItem()) {
			return false;
		}

		if (base.getItemDamage() != OreDictionary.WILDCARD_VALUE) {
			if (base.getItemDamage() != comparison.getItemDamage()) {
				return false;
			}
		}

		if (!base.hasTagCompound() || base.getTagCompound().hasNoTags()) {
			return true;
		} else {
			return ItemStack.areItemStackTagsEqual(base, comparison);
		}
	}
}


text:
title: PdfViewer get the clicked position on the page
description: PdfViewer get the clicked position on the page
type: how-to
page_title: PdfViewer get the clicked position on the page
slug: pdfviewer-get-clicked-position
position: 0
tags:  pdf, position, page
res_type: kb
---

|Product Version|Product|Author|
|----|----|----|
|2020.2.512.40|RadPdfViewer|[Dimitar Karamfilov](https://www.telerik.com/blogs/author/dimitar-karamfilov)|

## Description

This article shows how you can get the position when the user clicks on a specific page. The position relates to the upper left corner of the page.

## Solution

Use the following code to calculate the position:

````C#
public RadForm1()
{
    InitializeComponent();
    radPdfViewer1.MouseDown += RadPdfViewer1_MouseDown;
}

private void RadPdfViewer1_MouseDown(object sender, MouseEventArgs e)
{
    var element = radPdfViewer1.ElementTree.GetElementAtPoint(((MouseEventArgs)e).Location) as RadFixedPageElement;

    if (element != null)
    {

        var mouseLocation = ((MouseEventArgs)e).Location;
        var tt = element.TotalTransform;
        tt.Invert();

        var pointInDoc = tt.TransformPoint(mouseLocation);

        currentPageIndex = radPdfViewer1.Document.Pages.IndexOf(element.Page);
        var zoom = radPdfViewer1.PdfViewerElement.ScaleFactor;

        Console.WriteLine("PageNo: {0} X:{1} Y:{2}", currentPageIndex, pointInDoc.X / zoom, pointInDoc.Y / zoom);
    }
}

````
````VB.NET
Public Sub New()
	InitializeComponent()
	AddHandler radPdfViewer1.MouseDown, AddressOf RadPdfViewer1_MouseDown
End Sub

Private Sub RadPdfViewer1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
	Dim element = TryCast(radPdfViewer1.ElementTree.GetElementAtPoint(CType(e, MouseEventArgs).Location), RadFixedPageElement)

	If element IsNot Nothing Then

		Dim mouseLocation = CType(e, MouseEventArgs).Location
		Dim tt = element.TotalTransform
		tt.Invert()

		Dim pointInDoc = tt.TransformPoint(mouseLocation)

		currentPageIndex = radPdfViewer1.Document.Pages.IndexOf(element.Page)
		Dim zoom = radPdfViewer1.PdfViewerElement.ScaleFactor

		Console.WriteLine("PageNo: {0} X:{1} Y:{2}", currentPageIndex, pointInDoc.X / zoom, pointInDoc.Y / zoom)
	End If
End Sub

````


text:
{- |
Module      :  Data.DRS.Structure
Copyright   :  (c) Harm Brouwer and Noortje Venhuizen
License     :  Apache-2.0

Maintainer  :  me@hbrouwer.eu, n.j.venhuizen@rug.nl
Stability   :  provisional
Portability :  portable

Structural operations on DRSs
-}

module Data.DRS.Structure
(
  isLambdaDRS
, isMergeDRS
, isResolvedDRS
, isSubDRS
) where

import Data.DRS.DataType

---------------------------------------------------------------------------
-- * Exported
---------------------------------------------------------------------------

---------------------------------------------------------------------------
-- | Returns whether a 'DRS' is entirely a 'LambdaDRS' (at its top-level).
---------------------------------------------------------------------------
isLambdaDRS :: DRS -> Bool
isLambdaDRS (LambdaDRS _) = True
isLambdaDRS (Merge d1 d2) = isLambdaDRS d1 && isLambdaDRS d2
isLambdaDRS (DRS _ _)     = False

---------------------------------------------------------------------------
-- | Returns whether a 'DRS' is entirely a 'Merge' (at its top-level).
---------------------------------------------------------------------------
isMergeDRS :: DRS -> Bool
isMergeDRS (LambdaDRS _) = False
isMergeDRS (Merge _ _)   = True
isMergeDRS (DRS _ _)     = False

---------------------------------------------------------------------------
-- | Returns whether a 'DRS' is resolved (containing no unresolved merges
-- or lambdas)
---------------------------------------------------------------------------
isResolvedDRS :: DRS -> Bool
isResolvedDRS (LambdaDRS _) = False
isResolvedDRS (Merge _ _)   = False
isResolvedDRS (DRS u c)     = all isResolvedRef u && all isResolvedCon c
  where isResolvedRef :: DRSRef -> Bool
        isResolvedRef (LambdaDRSRef _) = False
        isResolvedRef (DRSRef _)       = True
        isResolvedCon :: DRSCon -> Bool
        isResolvedCon (Rel _ d)    = all isResolvedRef d
        isResolvedCon (Neg d1)     = isResolvedDRS d1
        isResolvedCon (Imp d1 d2)  = isResolvedDRS d1 && isResolvedDRS d2
        isResolvedCon (Or d1 d2)   = isResolvedDRS d1 && isResolvedDRS d2
        isResolvedCon (Prop r d1)  = isResolvedRef r  && isResolvedDRS d1
        isResolvedCon (Diamond d1) = isResolvedDRS d1
        isResolvedCon (Box d1)     = isResolvedDRS d1

---------------------------------------------------------------------------
-- | Returns whether DRS @d1@ is a direct or indirect sub-DRS of DRS @d2@
---------------------------------------------------------------------------
isSubDRS :: DRS -> DRS -> Bool
isSubDRS _  (LambdaDRS _) = False
isSubDRS d1 (Merge d2 d3) = isSubDRS d1 d2 || isSubDRS d1 d3
isSubDRS d1 d2@(DRS _ c)  = d1 == d2 || any subDRS c
  where subDRS :: DRSCon -> Bool
        subDRS (Rel _ _)    = False
        subDRS (Neg d3)     = isSubDRS d1 d3
        subDRS (Imp d3 d4)  = isSubDRS d1 d3 || isSubDRS d1 d4
        subDRS (Or d3 d4)   = isSubDRS d1 d3 || isSubDRS d1 d4
        subDRS (Prop _ d3)  = isSubDRS d1 d3
        subDRS (Diamond d3) = isSubDRS d1 d3
        subDRS (Box d3)     = isSubDRS d1 d3


text:
package io.netty.handler.codec.dns;

/**
 * A DNS response message.
 */
public interface DnsResponse extends DnsMessage {

    /**
     * Returns {@code true} if responding server is authoritative for the domain
     * name in the query message.
     */
    boolean isAuthoritativeAnswer();

    /**
     * Set to {@code true} if responding server is authoritative for the domain
     * name in the query message.
     *
     * @param authoritativeAnswer flag for authoritative answer
     */
    DnsResponse setAuthoritativeAnswer(boolean authoritativeAnswer);

    /**
     * Returns {@code true} if response has been truncated, usually if it is
     * over 512 bytes.
     */
    boolean isTruncated();

    /**
     * Set to {@code true} if response has been truncated (usually happens for
     * responses over 512 bytes).
     *
     * @param truncated flag for truncation
     */
    DnsResponse setTruncated(boolean truncated);

    /**
     * Returns {@code true} if DNS server can handle recursive queries.
     */
    boolean isRecursionAvailable();

    /**
     * Set to {@code true} if DNS server can handle recursive queries.
     *
     * @param recursionAvailable flag for recursion availability
     */
    DnsResponse setRecursionAvailable(boolean recursionAvailable);

    /**
     * Returns the 4 bit return code.
     */
    DnsResponseCode code();

    /**
     * Sets the response code for this message.
     *
     * @param code the response code
     */
    DnsResponse setCode(DnsResponseCode code);

    @Override
    DnsResponse setId(int id);

    @Override
    DnsResponse setOpCode(DnsOpCode opCode);

    @Override
    DnsResponse setRecursionDesired(boolean recursionDesired);

    @Override
    DnsResponse setZ(int z);

    @Override
    DnsResponse setRecord(DnsSection section, DnsRecord record);

    @Override
    DnsResponse addRecord(DnsSection section, DnsRecord record);

    @Override
    DnsResponse addRecord(DnsSection section, int index, DnsRecord record);

    @Override
    DnsResponse clear(DnsSection section);

    @Override
    DnsResponse clear();

    @Override
    DnsResponse touch();

    @Override
    DnsResponse touch(Object hint);

    @Override
    DnsResponse retain();

    @Override
    DnsResponse retain(int increment);
}


text:
using System;

namespace CS.Validation
{
    /// <summary>
    /// 参数异常
    /// </summary>
    public class ParameterException:Exception
    {
        public ParameterException(string msg) : base(msg)
        {
        }
    }
}


text:
import argparse
import sys
import serial

# Data processing imports
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import seaborn as sns
font = {'family' : 'normal',
        'weight' : 'bold'}

import matplotlib
matplotlib.rc('font', **font)

def main(delays_file):

    delays = np.load(delays_file)

    delays *= 1e6;

    plt.plot(delays)
    axes = plt.gca();
    axes.set_xlim([0,len(delays)])
    plt.ylabel('Vrijeme kašnjenja (${\mu}s$)', fontsize=20)
    plt.xlabel('Uzorci', fontsize=20)
    plt.show()

    plt.figure(0)
    n, bins, patches = plt.hist(delays, 50, normed=True,
        histtype='step');

    y = mlab.normpdf(bins,
        np.mean(delays),
        np.std(delays))

    plt.show()
    plt.figure(1)
    plt.plot(bins, y)
    plt.xlabel('Vrijeme kašnjenja (${\mu}s$)', fontsize=20)
    plt.ylabel('Funkcija gustoće vjerojatnosti', fontsize=20)
    plt.show();

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('--delays_file', type=str, default='novo.npy')

    ARGS, other = parser.parse_known_args()

    main(ARGS.delays_file);


text:
## 0-src
In biology, a species (abbreviated sp., with the plural form species abbreviated spp.) is one of the basic units of biological classification and a taxonomic rank. A species is often defined as the largest group of organisms capable of interbreeding and producing fertile offspring. While in many cases this definition is adequate, the difficulty of defining species is known as the species problem. Differing measures are often used, such as similarity of DNA, morphology, or ecological niche. Presence of specific locally adapted traits may further subdivide species into "infraspecific taxa" such as subspecies (and in botany other taxa are used, such as varieties, subvarieties, and formae).

* [0-src](#module_0-src)
    * [~Species](#module_0-src..Species)
        * _instance_
            * [.name](#module_0-src..Species+name) : string
            * [.species](#module_0-src..Species+species) : Species
        * _static_
            * [.merge(one, two)](#module_0-src..Species.merge) ⇒ Species

### 0-src~Species
**Kind**: inner class of [0-src](#module_0-src)

* [~Species](#module_0-src..Species)
    * _instance_
        * [.name](#module_0-src..Species+name) : string
        * [.species](#module_0-src..Species+species) : Species
    * _static_
        * [.merge(one, two)](#module_0-src..Species.merge) ⇒ Species

#### species.name : string
the species name

**Kind**: instance property of [Species](#module_0-src..Species)

#### species.species : Species
**Kind**: instance property of [Species](#module_0-src..Species)

#### Species.merge(one, two) ⇒ Species
merge two species into a new one

**Kind**: static method of [Species](#module_0-src..Species)

| Param | Type | Description |
| --- | --- | --- |
| one | Species | first |
| two | Species | second |


text:
module.exports = function (bt) {

    bt.match('pager', function (ctx) {

        ctx.setContent([
            ctx.getParam('nextPage') && {
                elem: 'link',
                number: ctx.getParam('nextPage'),
                text: '← Назад в прошлое',
                prefix: ctx.getParam('pathPrefix')
            },
            ctx.getParam('prevPage') && {
                elem: 'link',
                number: ctx.getParam('prevPage'),
                text: 'Вперёд в настоящее →',
                prefix: ctx.getParam('pathPrefix')
            }
        ]);
    });

    bt.match('pager__link', function (ctx) {

        var prefix = ctx.getParam('prefix');
        var pageNumber = ctx.getParam('number');
        var pagePath = prefix + 'page/' + pageNumber + '/';

        var href = pageNumber === 1 ? prefix : pagePath;

        ctx.setTag('a');
        ctx.setAttr('href', href);
        ctx.setContent(ctx.getParam('text'));
    });

};


text:
using System;
using System.Diagnostics;
using System.IO;

namespace Nitrate
{
	public enum ProcessOutput
	{
		None,
		Error,
		Standard,
		All,
		Window
	}

	public class Shell
	{
		public static void Write(string message, bool newLine = true, ConsoleColor color = ConsoleColor.Gray)
		{
			Console.ForegroundColor = color;
			Console.Write(message);
			if (newLine) Console.WriteLine();
			Console.ResetColor();
		}

		public static void Error(string message, bool newLine = true)
		{
			Write(message, newLine, ConsoleColor.Red);
		}

		public static void Success(string message, bool newLine = true)
		{
			Write(message, newLine, ConsoleColor.Green);
		}

		public static void Info(string message, bool newLine = true)
		{
			Write(message, newLine, ConsoleColor.Cyan);
		}

		public static void Warn(string message, bool newLine = true)
		{
			Write(message, newLine, ConsoleColor.Yellow);
		}

		public static void Lf()
		{
			Console.WriteLine();
		}

		public static int Run(string app, string command, ProcessOutput output = ProcessOutput.None, string workingDirectory = "")
		{
			var p = new Process();
			p.StartInfo = new ProcessStartInfo()
			{
				CreateNoWindow = output != ProcessOutput.Window,
				UseShellExecute = output == ProcessOutput.Window,
				RedirectStandardOutput = (output == ProcessOutput.Standard || output == ProcessOutput.All),
				RedirectStandardError = (output == ProcessOutput.Error || output == ProcessOutput.All),
				FileName = app,
				Arguments = command
			};
			if (!String.IsNullOrWhiteSpace(workingDirectory)) p.StartInfo.WorkingDirectory = workingDirectory;

			p.Start();

			if (output == ProcessOutput.Standard || output == ProcessOutput.All)
			{
				p.OutputDataReceived += (sender, args) => Shell.Write(args.Data);
				p.BeginOutputReadLine();
			}

			if (output == ProcessOutput.Error || output == ProcessOutput.All)
			{
				p.ErrorDataReceived += (sender, args) => Shell.Error(args.Data);
				p.BeginErrorReadLine();
			}
			p.WaitForExit();
			var exitCode = p.ExitCode;
			p.Close();
			return exitCode;
		}

		public static bool IsAvailable(String fileName)
		{
			string path = Environment.GetEnvironmentVariable("path");
			string[] folders = path.Split(';');

			foreach (var folder in folders)
			{
				if (File.Exists(Path.Combine(folder, fileName)))
				{
					return true;
				}
			}

			return false;
		}
	}
}