text:
function err = psf2zcoeff(zcoeffs,psfTarget,pupilSizeMM,zpupilDiameterMM,...
    pupilPlaneSizeMM, thisWaveUM, nPixels)
% Error function for estimating Zernike Coeffs from a psf
%
% Syntax
%   This function is called as part of an fminsearch procedure.  See the
%   script s_opticsPSF2Zcoeffs for the main example
%
%  f = @(x) psf2zcoeff(x,psfTarget,pupilSizeMM,pupilPlaneSizeMM,thisWaveUM, nPixels);
%
% Description
%  Given a spread function (psfTarget), we would like to estimate the
%  Zernike coefficients.  This allows us to calculate the pupil function
%  and wavefront aberrations. This function computes the RMS error between
%  the psfTarget for a set of Zernike coefficients.  We use this function
%  as part of an fminsearch to do the estimation in s_opticsPSF2Zcoeffs
%
% Inputs:
%   zcoeffs - The Zernike coefficients.  There should be at least 5!
%        zcoeffs = wvfGet(wvf,'zcoeffs');
%   thisWaveNM -       wvfGet(wvf,'wave');
%   pupilPlaneSizeMM - wvfGet(wvf,'pupil plane size','mm',thisWaveNM);
%   thisWaveUM       - waveNM(ii)/1000;
%   nPixels          - nPixels = wvfGet(wvf,'spatial samples');
%   pupilSizeMM      - pupilSizeMM = wvfGet(wvf,'pupil size','mm');
%
% BW, Vistasoft Team, 2018
%
% See also
%   s_opticsPSF2Zcoeffs, wvfCreate, wvfSet

% Programming
% CONSIDER fminunc

pupilPos = (1:nPixels) - (floor(nPixels / 2) + 1);
pupilPos = pupilPos * (pupilPlaneSizeMM / nPixels);

% Do the meshgrid thing and flip y. Empirically the flip makes
% things work out right.
[xpos, ypos] = meshgrid(pupilPos);
ypos = -ypos;

% The Zernike polynomials are defined over the unit disk.  At
% measurement time, the pupil was mapped onto the unit disk, so we
% do the same normalization here to obtain the expansion over the
% disk.
%
% And by convention expanding gives us the wavefront aberrations in
% microns.
norm_radius = (sqrt(xpos.^2+ypos.^2))/(zpupilDiameterMM/2);
theta = atan2(ypos,xpos);
norm_radius_index = norm_radius <= 1;

% We keep the first entry 0 ('piston') because it has no impact on the PSF,
% according to a note in t_wvfZernike. Can I find a reference for that?
zcoeffs(1) = 0;

% Get Zernike coefficients and add in appropriate info to defocus
% Need to make sure the c vector is long enough to contain defocus
% term, because we handle that specially and it's easy just to make
% sure it is there.  This wastes a little time when we just compute
% diffraction, but that is the least of our worries.
if (length(zcoeffs) < 5),  zcoeffs(length(zcoeffs)+1:5) = 0; end

% We don't defocus for human chromatic aberration in ISET.  But we do this
% sort of thing in ISETBio.
% zcoeffs(5) = zcoeffs(5) + lcaMicrons + defocusCorrectionMicrons;

% This loop uses the function zerfun to compute the Zernike
% polynomial of each required order. That function normalizes a bit
% differently than the OSA standard, with a factor of 1/sqrt(pi)
% that is not part of the OSA definition.  We correct by
% multiplying by the same factor.
%
% Also, we speed this up by not bothering to compute for zcoeff entries
% that are 0.
wavefrontAberrationsUM = zeros(size(xpos));
for k = 1:length(zcoeffs)
    if (zcoeffs(k) ~= 0)
        osaIndex = k-1;
        [n,m] = wvfOSAIndexToZernikeNM(osaIndex);
        wavefrontAberrationsUM(norm_radius_index) =  ...
            wavefrontAberrationsUM(norm_radius_index) + ...
            zcoeffs(k)*sqrt(pi)*...
            zernfun(n,m,norm_radius(norm_radius_index),theta(norm_radius_index),'norm');
    end
end

% Here is the phase of the pupil function, with unit amplitude
% everywhere
pupilfuncphase = exp(-1i * 2 * pi * wavefrontAberrationsUM/thisWaveUM);

% Set values outside the pupil we're calculating for to 0 amplitude
pupilfuncphase(norm_radius > pupilSizeMM/zpupilDiameterMM)=0;

% Multiply phase by the pupil function amplitude function.
% In all of our calculations, we are assuming this (apodization) function
% is all 1s over the pupil
pupilfunc = pupilfuncphase;

amp = fftshift(fft2(ifftshift(pupilfunc)));
inten = (amp .* conj(amp));
psf = real(inten);

% Scale for unit area
psf = psf/sum(psf(:));

% RMSE
err = rms(psfTarget(:) - psf(:));

end


text:
{-# OPTIONS_GHC -Wall -fno-warn-orphans #-}
module Language.Haskell.Exts.Desugar.Pattern where

import qualified Prelude
import Language.Haskell.Exts hiding (name)
import Language.Haskell.Exts.Unique
import Language.Haskell.Exts.Desugar
import Language.Haskell.Exts.Desugar.Basic ()
import Prelude (($),(++),return,length,foldr,concat)
import Control.Applicative ((<$>))

instance Desugar Pat where
  -- no desugaring
  desugar (PVar name)            =
    PVar $$ name

  -- no desugaring
  desugar (PLit literal)         =
    PLit $$ literal

  -- no desugaring
  desugar (PApp qName pats)      =
    PApp $$ qName ** pats

  -- no desugaring
  desugar (PAsPat name pat)      =
    PAsPat $$ name ** pat

  -- no desugaring
  desugar (PNPlusK name integer) =
    PNPlusK $$ name ** integer

  -- no desugaring
  desugar (PViewPat eexp pat)    =
    PViewPat eexp $$ pat

  -- no desugaring
  desugar (PIrrPat pat)          =
    PIrrPat $$ pat

  -- no desugaring
  desugar (PBangPat pat)         =
    PBangPat $$ pat

  -- no desugaring
  desugar PWildCard              =
    return $ PWildCard

  -- no desugaring
  desugar (PRec qName patFields) =
    PRec $$ qName ** patFields

  -- no desugaring
  -- should be removed from HSE
  -- and replaced with literals
  desugar (PNeg (PLit (Int x)))       =
    desugar $ PLit (Int (-x))
  desugar (PNeg (PLit (Frac y)))      =
    desugar $ PLit (Frac (-y))
  desugar (PNeg _other)               =
    error $ "In Patterns, negation can only "
    ++      "be applied to numeric literals!"

  -- HSE
  desugar (PParen pat)                =
    desugar $ pat

  -- HSE
  desugar (PInfixApp pat1 qName pat2) =
    desugar $ PApp qName [pat1,pat2]

  -- HSE
  desugar (PTuple [])                 =
    desugar $ PApp (Special UnitCon) []
  desugar (PTuple [p])                =
    desugar $ p
  desugar (PTuple pats)               =
    desugar $ PApp (Special $ TupleCon Boxed $ length pats) pats

  -- HSE
  desugar (PList [])                  =
    desugar $ PApp (Special ListCon) []
  desugar (PList pats)                =
    desugar $ foldr (\p a -> PApp (Special Cons) [p,a]) (PList [])  pats

  -- not supported
  desugar (PatTypeSig   {}) = error "Not supported!"
  desugar (PExplTypeArg {}) = error "Not supported!"
  desugar (PQuasiQuote  {}) = error "Not supported!"
  desugar (PRPat        {}) = error "Not supported!"
  desugar (PXTag        {}) = error "Not supported!"
  desugar (PXETag       {}) = error "Not supported!"
  desugar (PXPcdata     {}) = error "Not supported!"
  desugar (PXPatTag     {}) = error "Not supported!"
  desugar (PXRPats      {}) = error "Not supported!"

instance Desugar PatField where
  desugar (PFieldPat qName p) =
    PFieldPat $$ qName ** p
  desugar (PFieldPun n)       =
    desugar $ PFieldPat (UnQual n) (PVar n)
  desugar PFieldWildcard      =
    error "PFieldWildcard is not supported!"

-- variables / name bound in a pattern
patVar :: Pat -> [Name]
patVar (PVar name)  = [name]
patVar (PLit _) = []
patVar (PatTypeSig _ pat _) = patVar pat
patVar (PApp _ pats) = concat (patVar <$> pats)
patVar (PAsPat name pat) = name : (patVar pat)
patVar (PParen pat) = patVar pat
patVar (PIrrPat pat) = patVar pat
patVar (PBangPat pat) = patVar pat
patVar (PNeg _) = []
patVar (PInfixApp pat1 _ pat2) = (patVar pat1) ++ (patVar pat2)
patVar (PTuple pats) =  concat $ patVar <$> pats
patVar (PList pats) = concat $ patVar <$> pats
patVar PWildCard  = []
patVar (PNPlusK _ _) = []
patVar (PViewPat _ pat) = patVar pat
patVar x = Prelude.error $ "Pattern " ++ (prettyPrint x) ++ " is not supported!"

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * this class provides helper methods for the simpleWorkflow behavior
 */
class SWHelper
{
	/**
	 * Returns the list of all statuses that can be reached from current status of the model
	 * passed as argument. The returned array is in the form suitable for dropDownList and listBox:
	 *

	 *    array(
	 *    	'statusId' => 'status label',
	 *    	'status Id2' => 'status label 2',
	 *    	etc ...
	 *    )
	 *

	 * Use the $options argument to speficy following options :
	 *

	 *
prompt : specifies the prompt text shown as the first list option. Its value is empty.
	 * Note, the prompt text will NOT be HTML-encoded

	 *
includeCurrent : boolean, if TRUE (default) the current model status is included in the list,
	 * otherwise current model status is not inserted in the returned array.

	 *
exclude : array, list of statuses that should not be inserted in the returned array

	 *

	 * Note that each status label is html encode by default.
	 * @param CModel $model the data model attaching a simpleWorkflow behavior
	 * @param array $options additional options
	 * @return array the list data that can be used in dropDownList and listBox
	 */
	public static function nextStatuslistData($model, $options=array())
	{
		return SWHelper::_createListData($model,$model->swGetNextStatus(),$options);
	}
	/**
	 * Returns the list of all statuses belonging to the workflow the model passed as argument
	 * is in.
	 * see {@link SWHelper::nextStatuslistData} for argument options
	 *
	 * @param CModel the data model attaching a simpleWorkflow behavior
	 * @param array additional options
	 * @return array the list data that can be used in dropDownList and listBox
	 */
	public static function allStatuslistData($model,$options=array())
	{
		return SWHelper::_createListData($model,$model->swGetAllStatus(),$options);
	}
	/**
	 * Create an array containing where keys are statusIds in the form workflowId/statusId
	 * and the value is the status label.
	 * Note that by default this method never inserts the status of the model passed as argument.
	 * see {@link SWHelper::nextStatuslistData} for argument options
	 *
	 * @param CModel the data model attaching a simpleWorkflow behavior
	 * @param array $statusList array of string where each value is the statusId
	 * @param array $options the list data that can be used in dropDownList and listBox
	 */
	public static function statusListData($model,$statusList,$options=array())
	{
		$nodeList = array();
		$w = $model->swGetWorkflowSource();
		foreach($statusList as $key =>  $statusId){
			$nodeList[] = $w->getNodeDefinition($statusId);
		}
		$options['includeCurrent'] = (isset($options['includeCurrent'])
			? $options['includeCurrent']
			: false
		);
		return SWHelper::_createListData($model,$nodeList,$options);
	}
	/**
	 * Returns an array where keys are status id and values are status labels.
	 *
	 * @param array $statusList SWNode list
	 * @param array $options (optional)
	 * @throws CException
	 */
	private static function _createListData($model,$statusList,$options=array())
	{
		$result=array();
		$exclude=null;
		$includeCurrent = true;

		$currentStatus = ($model->swHasStatus()
			? $model->swGetStatus()
			: null
		);
		if($currentStatus != null)
			$result[$currentStatus->toString()]=$currentStatus->getLabel();

		$encodeLabel = ( isset($options['encode'])
			? (bool) $options['encode']
			: true
		);

		// process options

		if(count($options)!=0){

			if(isset($options['prompt'])){
				$result[''] = $options['prompt'];
			}

			if(isset($options['exclude']))
			{
				if(is_string($options['exclude']))
					$exclude = array_map('trim',explode(",",$options['exclude']));
				elseif(is_array($options['exclude']))
					$exclude = $options['exclude'];
				else
					throw new CException('incorrect type for option "exclude" : array or string expected');

				foreach ($exclude as $key => $value) {
					$node = new SWNode($value, $model->swGetWorkflowId());
					$exclude[$key] = $node->toString();
				}
			}
			if(isset($options['includeCurrent']) )
				$includeCurrent =  (bool) $options['includeCurrent'];

			if($exclude != null && $currentStatus!= null && in_array($currentStatus->toString(), $exclude))
				$includeCurrent =  false;
		}

		if(count($statusList)!=0){
			foreach ( $statusList as $nodeObj ) {

				if(   $exclude == null ||
					( $exclude != null && !in_array($nodeObj->toString(), $exclude )) )
				{
					$result[$nodeObj->toString()]= ($encodeLabel
						? CHtml::encode($nodeObj->getLabel())
						: $nodeObj->getLabel()
					);
				}
			}
		}

		if($includeCurrent == false && $currentStatus !=null){
			unset($result[$currentStatus->toString()]);
		}
		return $result;
	}
}
?>


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>OverALL Web Site | Just another Web site</title>
<meta name="description" content="Just another Web site" />
<meta name="keywords" content="the, tags, web sites, clean, dark, useful, etc..." />
<link rel="stylesheet" type="text/css" media="all" href="style.css" />

Home

Pages

Page with Sidebar

Full Width Page

Bonus Layouts

Bonus Layout 1

Bonus Layout 2

Bonus Layout 3

Bonus Layout 4

Bonus Layout 5

Testimonials Page

Portfolio

1 Column

2 Columns

3 Columns

4 Columns

5 and More Columns

Video gallery

Blog

Gallery

Shortcodes

Buttons & Checklists

Column Layouts

Image Frames

Box Styles

Drop-Cap & Block Quotes

Typography

Testimonials

Other Styles

Contact

			1 Columns

			Portfolio page with 1 columns

			<form action="" id="searchform" method="get">

<input name="s" id="s" type="text" onblur="if ( this.value == '' ) this.value = this.defaultValue" onfocus="if ( this.value == this.defaultValue ) this.value = '';" value="Enter your search keywords..." />

			</form>

Lorem Ipsum

						Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

							Read more »

Lorem Ipsum

						Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

							Read more »

Lorem Ipsum

						Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

							Read more »

Lorem Ipsum

						Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

							Read more »

Lorem Ipsum

						Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

							Read more »

1

2

3

4

5

OverAll Pages

Home

Pages

Portfolio

Blog

Gallery

Shortcodes

Contact

More Link

Easy installation and upgrades

					We have gone to great lengths too make sure every bit of the WordPress generated code is in full compliance with the standards of the W3C This is important only a interoperability with today browser but also for forward compatibility with the tools the next generation. Your web site is a beautiful thing...

Recent Comments

admin on Spam protection

dilna on Spam protection

Codestar on Spam protection

feng on Spam protection

Popular Posts

Spam protection

Hello world!

Lorem Ipsum dummy!

It is a long established

Connect with the Community

					Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when a unknown printer took galley of type and make.

Contact Informations

28. Freelancer Street No:109/21, City Ankara / TURKEY

(+90) 312 444 0 444 & (+90) 312 443 0 443

info@codestarlive.com & helper@codestarlive.com

Over'ALL Support Service

Copyright (c) 2009 - 2010 OverAll Inc. - Premium a WebSite Theme for Your Website - All Rights Reserved


text:
package com.hazelcast.internal.locksupport;

public interface LockStoreInfo {

    int getBackupCount();

    int getAsyncBackupCount();
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OrchardCore.Modules;
using OrchardCore.ReCaptcha.ActionFilters.Detection;
using OrchardCore.ReCaptcha.Configuration;

namespace OrchardCore.ReCaptcha.Services
{
    public class ReCaptchaService
    {
        private readonly ReCaptchaClient _reCaptchaClient;
        private readonly ReCaptchaSettings _settings;
        private readonly IEnumerable<IDetectRobots> _robotDetectors;
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly ILogger _logger;
        private readonly IStringLocalizer S;

        public ReCaptchaService(ReCaptchaClient reCaptchaClient, IOptions<ReCaptchaSettings> optionsAccessor, IEnumerable<IDetectRobots> robotDetectors, IHttpContextAccessor httpContextAccessor, ILogger<ReCaptchaService> logger, IStringLocalizer<ReCaptchaService> stringLocalizer)
        {
            _reCaptchaClient = reCaptchaClient;
            _settings = optionsAccessor.Value;
            _robotDetectors = robotDetectors;
            _httpContextAccessor = httpContextAccessor;
            _logger = logger;
            S = stringLocalizer;
        }

        /// <summary>
        /// Flags the behavior as that of a robot
        /// </summary>
        public void MaybeThisIsARobot()
        {
            _robotDetectors.Invoke(i => i.FlagAsRobot(), _logger);
        }

        /// <summary>
        /// Determines if the request has been made by a robot
        /// </summary>
        /// <returns>Yes (true) or no (false)</returns>
        public bool IsThisARobot()
        {
            var result = _robotDetectors.Invoke(i => i.DetectRobot(), _logger);
            return result.Any(a => a.IsRobot);
        }

        /// <summary>
        /// Clears all robot markers, we are dealing with a human
        /// </summary>
        /// <returns></returns>
        public void ThisIsAHuman()
        {
            _robotDetectors.Invoke(i => i.IsNotARobot(), _logger);
        }

        /// <summary>
        /// Verifies the ReCaptcha response with the ReCaptcha webservice
        /// </summary>
        /// <param name="reCaptchaResponse"></param>
        /// <returns></returns>
        public async Task<bool> VerifyCaptchaResponseAsync(string reCaptchaResponse)
        {
            return !String.IsNullOrWhiteSpace(reCaptchaResponse) && await _reCaptchaClient.VerifyAsync(reCaptchaResponse, _settings.SecretKey);
        }

        /// <summary>
        /// Validates the captcha that is in the Form of the current request
        /// </summary>
        /// <param name="reportError">Lambda for reporting errors</param>
        public async Task<bool> ValidateCaptchaAsync(Action<string, string> reportError)
        {
            var reCaptchaResponse = _httpContextAccessor.HttpContext?.Request?.Form?[Constants.ReCaptchaServerResponseHeaderName].ToString();

            var isValid = !String.IsNullOrEmpty(reCaptchaResponse) && await VerifyCaptchaResponseAsync(reCaptchaResponse);

            if (!isValid)
            {
                reportError("ReCaptcha", S["Failed to validate captcha"]);
            }

            return isValid;
        }
    }
}


text:
package com.google.common.math;

import com.google.common.collect.ImmutableMap;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;

/**
 * Enumerates several algorithms providing equivalent functionality to {@link Quantiles}, for use in
 * {@link QuantilesBenchmark}. These algorithms each calculate either a single quantile or multiple
 * quantiles. All algorithms modify the dataset they are given (the cost of a copy to avoid this
 * will be constant across algorithms).
 *
 * @author Pete Gillin
 * @since 20.0
 */
enum QuantilesAlgorithm {

  /**
   * Sorts the dataset, and picks values from it. When computing multiple quantiles, we sort once
   * and pick multiple values.
   */
  SORTING {

    @Override
    double singleQuantile(int index, int scale, double[] dataset) {
      Arrays.sort(dataset);
      return singleQuantileFromSorted(index, scale, dataset);
    }

    @Override
    Map<Integer, Double> multipleQuantiles(
        Collection<Integer> indexes, int scale, double[] dataset) {
      Arrays.sort(dataset);
      ImmutableMap.Builder<Integer, Double> builder = ImmutableMap.builder();
      for (int index : indexes) {
        builder.put(index, singleQuantileFromSorted(index, scale, dataset));
      }
      return builder.build();
    }

    private double singleQuantileFromSorted(int index, int scale, double[] dataset) {
      long numerator = (long) index * (dataset.length - 1);
      int positionFloor = (int) LongMath.divide(numerator, scale, RoundingMode.DOWN);
      int remainder = (int) (numerator - positionFloor * scale);
      if (remainder == 0) {
        return dataset[positionFloor];
      } else {
        double positionFrac = (double) remainder / scale;
        return dataset[positionFloor]
            + positionFrac * (dataset[positionFloor + 1] - dataset[positionFloor]);
      }
    }
  },

  /**
   * Uses quickselect. When calculating multiple quantiles, each quickselect starts from scratch.
   */
  QUICKSELECT {

    @Override
    double singleQuantile(int index, int scale, double[] dataset) {
      long numerator = (long) index * (dataset.length - 1);
      int positionFloor = (int) LongMath.divide(numerator, scale, RoundingMode.DOWN);
      int remainder = (int) (numerator - positionFloor * scale);
      double percentileFloor = select(positionFloor, dataset);
      if (remainder == 0) {
        return percentileFloor;
      } else {
        double percentileCeiling = getMinValue(dataset, positionFloor + 1);
        double positionFrac = (double) remainder / scale;
        return percentileFloor + positionFrac * (percentileCeiling - percentileFloor);
      }
    }

    @Override
    Map<Integer, Double> multipleQuantiles(
        Collection<Integer> indexes, int scale, double[] dataset) {
      ImmutableMap.Builder<Integer, Double> builder = ImmutableMap.builder();
      for (int index : indexes) {
        builder.put(index, singleQuantile(index, scale, dataset));
      }
      return builder.build();
    }
  },

  /** Uses {@link Quantiles}. */
  TARGET {

    @Override
    double singleQuantile(int index, int scale, double[] dataset) {
      return Quantiles.scale(scale).index(index).computeInPlace(dataset);
    }

    @Override
    Map<Integer, Double> multipleQuantiles(
        Collection<Integer> indexes, int scale, double[] dataset) {
      return Quantiles.scale(scale).indexes(indexes).computeInPlace(dataset);
    }
  },
  ;

  /**
   * Calculates a single quantile. Equivalent to {@code
   * Quantiles.scale(scale).index(index).computeInPlace(dataset)}.
   */
  abstract double singleQuantile(int index, int scale, double[] dataset);

  /**
   * Calculates multiple quantiles. Equivalent to {@code
   * Quantiles.scale(scale).indexes(indexes).computeInPlace(dataset)}.
   */
  abstract Map<Integer, Double> multipleQuantiles(
      Collection<Integer> indexes, int scale, double[] dataset);

  static double getMinValue(double[] array, int from) {
    // This is basically a copy of com.google.math.Rank#getMinValue, with a small change in the
    // method signature: we always search to the end of the array.
    int min = from;
    for (int i = from + 1; i < array.length; i++) {
      if (array[min] > array[i]) {
        min = i;
      }
    }
    return array[min];
  }

  static double select(int k, double[] array) {
    // This is basically a copy of com.google.math.Rank#select, with a small change in the method
    // signature: we make k 0-based rather than 1-based; and we drop from and to, and always work on
    // the whole array.
    int from = 0;
    int to = array.length - 1;

    while (true) {
      if (to <= from + 1) {
        // Two or less elements left.
        if (to == from + 1 && array[to] < array[from]) {
          // Exactly two elements left.
          swap(array, from, to);
        }
        return array[k];
      } else {
        int midIndex = (from + to) >>> 1;
        // Choose the median of the elements at the from, to and mid indexes,
        // and rearrange so that array[from]<=array[from+1], and
        // array[to] => array[from + 1].

        swap(array, midIndex, from + 1);

        if (array[from] > array[to]) {
          swap(array, from, to);
        }
        if (array[from + 1] > array[to]) {
          swap(array, from + 1, to);
        }
        if (array[from] > array[from + 1]) {
          swap(array, from, from + 1);
        }

        // Perform a partition with the selected median.
        int low = from + 1, high = to; // Indexes for partitioning.
        double partition = array[from + 1]; // Choose partitioning element.
        while (true) {
          // Skip the elements smaller than the partition.
          do {
            low++;
          } while (array[low] < partition);

          // Skip the elements larger than the partition.
          do {
            high--;
          } while (array[high] > partition);
          if (high < low) {
            break; // Pointers crossed. Partitioning complete.
          }
          swap(array, low, high); // End of innermost loop.
        }
        array[from + 1] = array[high]; // Insert partitioning element.
        array[high] = partition;

        // Continue the partition that contains the kth element.
        if (high >= k) {
          to = high - 1;
        }
        if (high <= k) {
          from = low;
        }
      }
    }
  }

  private static void swap(double[] array, int i, int j) {
    // This is a copy of com.google.math.Rank#swap.
    double temp = array[i];
    array[i] = array[j];
    array[j] = temp;
  }
}


text:
Alien = class()
-- Alien class
-- 20/4/2012 -- xixgames.com
-- Ludum Dare #23
-- Tiny World
-- in this magic tiny world people need others like you!
ALIEN_DEAD = 0
ALIEN_LIVE = 1

function Alien:init()
    self.position = vec2(WIDTH,math.random(-6,6)+HEIGHT/2)
    self.state = ALIEN_LIVE
    self.speed = math.random(1,level+2)
    self.R = math.random(255)
    self.G = math.random(255)
    self.B = math.random(255)
end

function Alien:draw()
    if self.state == ALIEN_DEAD then return end
    -- check distance with the main tiny world house:
    if self.position:dist(tiny_world.houses[tiny_world.destiny].position)<55 then
        self.state = ALIEN_DEAD
        tiny_world.frame = 0
        tiny_world.state = WORLD_BREAK
        return
    end
    self.position.x = self.position.x - self.speed
    local d = math.sin((self.position.x-0.66)/33)
    if self.position.y <= tiny_world.houses[tiny_world.destiny].position.y then
        d = -d
    end
    self.position.y = self.position.y + d
    pushMatrix()
    pushStyle()

    -- Set up basic graphical style
    lineCapMode(ROUND)
    strokeWidth(8)
    stroke(self.R,self.G,self.B, 255)
    smooth()
    noFill()

    -- Transform to pos
    translate(self.position.x, self.position.y)
    rotate(90)
    -- Draw our triangle invader
    -- 60 pixels high, 40 pixels wide
    line( 0, 30, 20, -30 )
    line( 0, 30,-20, -30 )
    line( -20, -30, 20, -30 )

    popMatrix()

    popStyle()
end

function Alien:touched(touch)
    if self.state ~= ALIEN_DEAD and vec2(touch.x,touch.y):dist(self.position)<20 then
        self.state = ALIEN_DEAD
        sound(SOUND_EXPLODE, 14589)
        return true
    end
    return false
end


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

namespace System.Windows.Controls
{
    public delegate void ScrollChangedEventHandler(object sender, ScrollChangedEventArgs e);

    public class ScrollChangedEventArgs : RoutedEventArgs
    {
        public Point Offset { get; private set; }
        public Point OffsetChange { get; private set; }
        public Size Extent { get; private set; }
        public Point ExtentChange { get; private set; }
        public Size Viewport { get; private set; }
        public Point ViewportChange { get; private set; }

        public ScrollChangedEventArgs(RoutedEvent routedEvent, object originalSource, Point offset, Point offsetChange, Size extent, Point extentChange, Size viewport, Point viewportChange) :
            base(routedEvent, originalSource)
        {
            this.Offset = offset;
            this.OffsetChange = offsetChange;
            this.Extent = extent;
            this.ExtentChange = extentChange;
            this.Viewport = viewport;
            this.ViewportChange = viewportChange;
        }

        public override void InvokeEventHandler(Delegate handler, object target)
        {
            if (handler is ScrollChangedEventHandler)
            {
                ((ScrollChangedEventHandler)handler)(target, this);
            }
            else
            {
                base.InvokeEventHandler(handler, target);
            }
        }
    }
}


text:
import re
import sys
from OpenSSL import crypto
from pandaserver.taskbuffer import JobUtils

# get prefix for DQ2
def getDQ2Prefix(dq2SiteID):
    try:
        # prefix of DQ2 ID
        tmpDQ2IDPrefix = re.sub('_[A-Z,0-9]+DISK$','',dq2SiteID)
        # remove whitespace
        tmpDQ2IDPrefix = tmpDQ2IDPrefix.strip()
        # patchfor MWT2
        if tmpDQ2IDPrefix == 'MWT2_UC':
            tmpDQ2IDPrefix = 'MWT2'
        return tmpDQ2IDPrefix
    except Exception:
        return ''

# check if the file is cached
def isCachedFile(datasetName,siteSpec):
    # using CVMFS
    if siteSpec.iscvmfs is not True:
        return False
    # look for DBR
    if not datasetName.startswith('ddo'):
        return False
    # look for three digits
    if re.search('v\d{6}$',datasetName) is None:
        return False
    return True

# get the list of sites where dataset is available
def getSitesWithDataset(tmpDsName, siteMapper, replicaMap, cloudKey, prodSourceLabel, job_label, useHomeCloud=False,
                        getDQ2ID=False, useOnlineSite=False, includeT1=False):
    retList = []
    retDQ2Map = {}
    # no replica map
    if tmpDsName not in replicaMap:
        if getDQ2ID:
            return retDQ2Map
        return retList
    # use valid cloud
    if not siteMapper.checkCloud(cloudKey):
        if getDQ2ID:
            return retDQ2Map
        return retList
    # check sites in the cloud
    for tmpSiteName in siteMapper.getCloud(cloudKey)['sites']:
        tmpSiteSpec = siteMapper.getSite(tmpSiteName)
        scopeSiteSpec_input, scopeSiteSpec_output = select_scope(tmpSiteSpec, prodSourceLabel, job_label)
        # skip T1
        if not includeT1:
            # T1
            if tmpSiteName == siteMapper.getCloud(cloudKey)['source']:
                continue
            # hospital queue
            tmpSrcSpec = siteMapper.getSite(siteMapper.getCloud(cloudKey)['source'])
            scopeSrcSpec_input, scopeSrcSpec_output = select_scope(tmpSrcSpec, prodSourceLabel, job_label)
            if tmpSiteSpec.ddm_input.get(scopeSiteSpec_input) == tmpSrcSpec.ddm_input.get(scopeSrcSpec_input):
                continue
        # use home cloud
        if useHomeCloud:
            if siteMapper.getSite(tmpSiteName).cloud != cloudKey:
                continue
        # online
        if siteMapper.getSite(tmpSiteName).status != 'online':
            continue
        # check all associated DQ2 IDs
        tmpFoundFlag = False

        ddm_endpoints = []
        if scopeSiteSpec_input in tmpSiteSpec.ddm_input and tmpSiteSpec.ddm_input[scopeSiteSpec_input]:
            ddm_endpoints.append(tmpSiteSpec.ddm_input[scopeSiteSpec_input])
        if scopeSiteSpec_input in tmpSiteSpec.setokens_input and tmpSiteSpec.setokens_input[scopeSiteSpec_input].values():
            ddm_endpoints = ddm_endpoints + list(tmpSiteSpec.setokens_input[scopeSiteSpec_input].values())

        if not ddm_endpoints:
            # skip misconfigured sites
            continue

        for tmpSiteDQ2ID in ddm_endpoints:
            # prefix of DQ2 ID
            tmpDQ2IDPrefix = getDQ2Prefix(tmpSiteDQ2ID)
            # ignore empty
            if tmpDQ2IDPrefix == '':
                continue
            # loop over all replica DQ2 IDs
            for tmpDQ2ID in replicaMap[tmpDsName]:
                # use DATADISK or GROUPDISK
                if '_SCRATCHDISK'        in tmpDQ2ID or \
                       '_USERDISK'       in tmpDQ2ID or \
                       '_PRODDISK'       in tmpDQ2ID or \
                       '_LOCALGROUPDISK' in tmpDQ2ID or \
                       '_LOCALGROUPTAPE' in tmpDQ2ID or \
                       'TAPE'            in tmpDQ2ID or \
                       '_DAQ'            in tmpDQ2ID or \
                       '_TMPDISK'        in tmpDQ2ID or \
                       '_TZERO'          in tmpDQ2ID:
                    continue
                # check DQ2 prefix
                if tmpDQ2ID.startswith(tmpDQ2IDPrefix):
                    tmpFoundFlag = True
                    if not getDQ2ID:
                        break
                    # append map
                    if tmpSiteName not in retDQ2Map:
                        retDQ2Map[tmpSiteName] = []
                    if tmpDQ2ID not in retDQ2Map[tmpSiteName]:
                        retDQ2Map[tmpSiteName].append(tmpDQ2ID)
        # append
        if tmpFoundFlag:
            retList.append(tmpSiteName)
    # return map
    if getDQ2ID:
        return retDQ2Map
    # retrun
    return retList

# get the list of sites where dataset is available
def getEndpointsAtT1(tmpRepMap,siteMapper,cloudName):
    retList = []
    # get cloud SEs
    tmpCloud = siteMapper.getCloud(cloudName)
    cloudSEs = tmpCloud['tier1SE']
    # check T1 endpoints
    for tmpSePat in cloudSEs:
        # ignore empty
        if tmpSePat == '':
            continue
        # make regexp pattern
        if '*' in tmpSePat:
            tmpSePat = tmpSePat.replace('*','.*')
        tmpSePat = '^' + tmpSePat +'$'
        # loop over all sites
        for tmpSE in tmpRepMap:
            # check match
            if re.search(tmpSePat,tmpSE) is None:
                continue
            # append
            if tmpSE not in retList:
                retList.append(tmpSE)
    # return
    return retList

# check DDM response
def isDQ2ok(out):
    if out.find("DQ2 internal server exception") != -1 \
           or out.find("An error occurred on the central catalogs") != -1 \
           or out.find("MySQL server has gone away") != -1 \
           or out == '()':
        return False
    return True

# check if DBR
def isDBR(datasetName):
    if datasetName.startswith('ddo'):
        return True
    return False

# check invalid characters in dataset name
def checkInvalidCharacters(datasetName):
    if re.match("^[A-Za-z0-9][A-Za-z0-9\.\-\_/]{1,255}$",datasetName) is not None:
        return True
    return False

# get dataset type
def getDatasetType(dataset):
    datasetType = None
    try:
        datasetType = dataset.split('.')[4]
    except Exception:
        pass
    return datasetType

# check certificate
def checkCertificate(certName):
    try:
        cert = crypto.load_certificate(crypto.FILETYPE_PEM, open(certName).read())
        if cert.has_expired() is True:
            return False,"{0} expired".format(certName)
        else:
            return True,None
    except Exception:
        errtype,errvalue = sys.exc_info()[:2]
        return False,'{0}:{1}'.format(errtype.__name__,errvalue)

# get sites which share DDM endpoint
def getSitesShareDDM(siteMapper, siteName, prodSourceLabel, job_label, output_share=False):
    # output_share: False to get sites which use the output RSE as input, True to get sites which use
    #               the input RSEs as output

    # nonexistent site
    if not siteMapper.checkSite(siteName):
        return []
    # get siteSpec
    siteSpec = siteMapper.getSite(siteName)
    scope_site_input, scope_site_output = select_scope(siteSpec, prodSourceLabel, job_label)
    # loop over all sites
    retSites = []
    for tmpSiteName in siteMapper.siteSpecList:
        tmpSiteSpec = siteMapper.siteSpecList[tmpSiteName]
        scope_tmpSite_input, scope_tmpSite_output = select_scope(tmpSiteSpec, prodSourceLabel, job_label)
        # only same type
        if siteSpec.type != tmpSiteSpec.type:
            continue
        # only online sites
        if tmpSiteSpec.status != 'online':
            continue
        # same endpoint
        try:
            if not output_share and \
                siteSpec.ddm_output[scope_site_output] \
                    not in tmpSiteSpec.ddm_endpoints_input[scope_tmpSite_input].all:
                continue
            if output_share and \
                tmpSiteSpec.ddm_output[scope_site_output]\
                    not in siteSpec.ddm_endpoints_input[scope_tmpSite_input].all:
                continue
        except Exception:
            continue
        # skip itself
        if siteName == tmpSiteSpec.sitename:
            continue
        # append
        if tmpSiteSpec.sitename not in retSites:
            retSites.append(tmpSiteSpec.sitename)
    # return
    return retSites

 # check if destination is specified
def getDestinationSE(destinationDBlockToken):
    if destinationDBlockToken is not None:
        for tmpToken in destinationDBlockToken.split(','):
            tmpMatch = re.search('^dst:([^/]*)(/.*)*$',tmpToken)
            if tmpMatch is not None:
                return tmpMatch.group(1)
    return None

# check if job sets destination
def checkJobDestinationSE(tmpJob):
    for tmpFile in tmpJob.Files:
        if getDestinationSE(tmpFile.destinationDBlockToken) is not None:
            return tmpFile.destinationSE
    return None

 # check if destination is distributed
def getDistributedDestination(destinationDBlockToken):
    if destinationDBlockToken is not None:
        for tmpToken in destinationDBlockToken.split(','):
            tmpMatch = re.search('^ddd:([^/]*)(/.*)*$',tmpToken)
            if tmpMatch is not None:
                return tmpMatch.group(1)
    return None

# extract importand error string
def extractImportantError(out):
    retStr = ''
    try:
        strList = ['InvalidRSEExpression', 'Details:']
        for line in out.split('\n'):
            for tmpStr in strList:
                if tmpStr in line:
                    retStr += line
                    retStr += ' '
        retStr = retStr[:-1]
    except Exception:
        pass
    return retStr

# get activity for output
def getActivityForOut(prodSourceLabel):
    if prodSourceLabel in ['managed']:
        activity = "Production Output"
    elif prodSourceLabel in ['user','panda']:
        activity = "User Subscriptions"
    else:
        activity = "Functional Test"
    return activity

def select_scope(site_spec, prodsourcelabel, job_label):
    """
    Select the scopes of the activity for input and output. The scope was introduced for prod-analy queues
    where you might want to associate different RSEs depending on production or analysis.
    """
    scope_input = 'default'
    aux_scopes_input = site_spec.ddm_endpoints_input.keys()
    if (job_label == JobUtils.ANALY_PS or prodsourcelabel in JobUtils.analy_sources) and 'analysis' in aux_scopes_input:
        scope_input = 'analysis'

    scope_output = 'default'
    aux_scopes_output = site_spec.ddm_endpoints_output.keys()
    if (job_label == JobUtils.ANALY_PS or prodsourcelabel in JobUtils.analy_sources) and 'analysis' in aux_scopes_output:
        scope_output = 'analysis'

    return scope_input, scope_output


text:
package ru.job4j.array;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
 * Тестируем переворот массива.
 */
public class TurnTest {
    @Test
    public void whenTurnArrayWithEvenAmountOfElementsThenTurnedArray() {
//напишите здесь тест, проверяющий переворот массива с чётным числом элементов, например {2, 6, 1, 4}.
        Turn turn = new Turn();
        int[] array = {4, 1, 6, 2};
        int[] resultArray = {2, 6, 1, 4};
        int[] result = turn.back(array);
        assertThat(result, is(resultArray));
    }
    @Test
    public void whenTurnArrayWithOddAmountOfElementsThenTurnedArray() {
//напишите здесь тест, проверяющий переворот массива с нечётным числом элементов, например {1, 2, 3, 4, 5}.
        Turn turn = new Turn();
        int[] array = {1, 2, 3, 7, 5};
        int[] resultArray = {5, 7, 3, 2, 1};
        int[] result = turn.back(array);
        assertThat(result, is(resultArray));
    }
}


text:
<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'SimpleFavorites\\' => array($baseDir . '/app'),
);


text:
/* 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.
 */

package org.camunda.bpm.engine.impl.persistence.entity;

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

import org.camunda.bpm.engine.history.HistoricProcessInstance;
import org.camunda.bpm.engine.impl.HistoricProcessInstanceQueryImpl;
import org.camunda.bpm.engine.impl.Page;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.context.Context;
import org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.persistence.AbstractHistoricManager;

/**
 * @author Tom Baeyens
 */
public class HistoricProcessInstanceManager extends AbstractHistoricManager {

  public HistoricProcessInstanceEntity findHistoricProcessInstance(String processInstanceId) {
    if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
      return (HistoricProcessInstanceEntity) getDbSqlSession().selectById(HistoricProcessInstanceEntity.class, processInstanceId);
    }
    return null;
  }

  public HistoricProcessInstanceEventEntity findHistoricProcessInstanceEvent(String eventId) {
    if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
      return (HistoricProcessInstanceEventEntity) getDbSqlSession().selectById(HistoricProcessInstanceEventEntity.class, eventId);
    }
    return null;
  }

  @SuppressWarnings("unchecked")
  public void deleteHistoricProcessInstanceByProcessDefinitionId(String processDefinitionId) {
    if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
      List<String> historicProcessInstanceIds = getDbSqlSession()
        .selectList("selectHistoricProcessInstanceIdsByProcessDefinitionId", processDefinitionId);

      for (String historicProcessInstanceId: historicProcessInstanceIds) {
        deleteHistoricProcessInstanceById(historicProcessInstanceId);
      }
    }
  }

  public void deleteHistoricProcessInstanceById(String historicProcessInstanceId) {
    if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
      CommandContext commandContext = Context.getCommandContext();

      commandContext
        .getHistoricDetailManager()
        .deleteHistoricDetailsByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricVariableInstanceManager()
        .deleteHistoricVariableInstanceByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricActivityInstanceManager()
        .deleteHistoricActivityInstancesByProcessInstanceId(historicProcessInstanceId);

      commandContext
        .getHistoricTaskInstanceManager()
        .deleteHistoricTaskInstancesByProcessInstanceId(historicProcessInstanceId);

      commandContext.getDbSqlSession().delete("deleteHistoricProcessInstance", historicProcessInstanceId);

    }
  }

  public long findHistoricProcessInstanceCountByQueryCriteria(HistoricProcessInstanceQueryImpl historicProcessInstanceQuery) {
    if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
      return (Long) getDbSqlSession().selectOne("selectHistoricProcessInstanceCountByQueryCriteria", historicProcessInstanceQuery);
    }
    return 0;
  }

  @SuppressWarnings("unchecked")
  public List<HistoricProcessInstance> findHistoricProcessInstancesByQueryCriteria(HistoricProcessInstanceQueryImpl historicProcessInstanceQuery, Page page) {
    if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
      return getDbSqlSession().selectList("selectHistoricProcessInstancesByQueryCriteria", historicProcessInstanceQuery, page);
    }
    return Collections.EMPTY_LIST;
  }

  @SuppressWarnings("unchecked")
  public List<HistoricProcessInstance> findHistoricProcessInstancesByNativeQuery(Map<String, Object> parameterMap, int firstResult, int maxResults) {
    return getDbSqlSession().selectListWithRawParameter("selectHistoricProcessInstanceByNativeQuery", parameterMap, firstResult, maxResults);
  }

  public long findHistoricProcessInstanceCountByNativeQuery(Map<String, Object> parameterMap) {
    return (Long) getDbSqlSession().selectOne("selectHistoricProcessInstanceCountByNativeQuery", parameterMap);
  }
}


text:
using System;

namespace FHSDK.API
{
    /// <summary>
    ///     Class represents cloud requests.
    /// </summary>
    public class FHCloudRequest : FHRequest
    {
        private readonly CloudProps _cloudProps;

        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="props">The cloud host info</param>
        public FHCloudRequest(CloudProps props)
        {
            RequestPath = "";
            _cloudProps = props;
        }

        /// <summary>
        ///     Get or set the request parameters
        /// </summary>
        public object RequestParams { private get; set; }

        /// <summary>
        ///     Get or set the path of the cloud request
        /// </summary>
        public string RequestPath { private get; set; }

        /// <summary>
        ///     Construct the remote uri based on the request type
        /// </summary>
        /// <returns></returns>
        protected override Uri GetUri()
        {
            var host = _cloudProps.GetCloudHost();
            var pathWithoutStartingSlash = RequestPath.StartsWith("/") ? RequestPath.Substring(1) : RequestPath;
            return new Uri(string.Format("{0}/{1}", host, pathWithoutStartingSlash));
        }

        /// <summary>
        ///     Construct the request data based on the request type
        /// </summary>
        /// <returns></returns>
        protected override object GetRequestParams()
        {
            return RequestParams;
        }
    }
}


text:
\relax
\providecommand\hyper@newdestlabel[2]{}
\@setckpt{/Chapters/1-Introduction}{
\setcounter{page}{1}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{part}{0}
\setcounter{chapter}{0}
\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{figure}{0}
\setcounter{table}{0}
\setcounter{parentequation}{0}
\setcounter{float@type}{4}
\setcounter{Item}{0}
\setcounter{Hfootnote}{0}
\setcounter{bookmark@seq@number}{1}
\setcounter{ContinuedFloat}{0}
\setcounter{KVtest}{0}
\setcounter{subfigure}{0}
\setcounter{subfigure@save}{0}
\setcounter{lofdepth}{1}
\setcounter{subtable}{0}
\setcounter{subtable@save}{0}
\setcounter{lotdepth}{1}
\setcounter{section@level}{0}
}


text:
'use strict';
let expect = require('chai').expect;
let Servers = require('../index.js');
let cluster = require('cluster');

require('mocha-sinon');

if (cluster.isMaster) {
  describe('API "getWorkers"', () => {
    describe('Get workers number through the API - "getWorkers"', () => {
      it('Should not be "0", since we have multiple cluster tests', () => {
        expect(Servers.getWorkers().length).to.not.equal(0);
      });
    });
  });
}


text:
package gw.internal.xml.ws.typeprovider;

import gw.internal.xml.xsd.typeprovider.IWsdlTypeData;

public interface IWsdlSoapHeadersTypeData extends IWsdlTypeData {
}


text:
let expect = require('chai').expect;
import sinon from 'sinon';

let prompt = require('prompt');
import { readLine } from '../../src/lib/read-line';

describe('read-line', function() {

    const RESULT = 'felix',
        ERR_CODE = 'ERROR-CODE-4711';

    let promptStub;

    beforeEach(function() {
        promptStub = sinon.stub(prompt, 'get', function(msg, callback) {
            msg = msg.properties.string.description;
            if (msg === 'error') {
                callback(ERR_CODE, undefined);
            } else if (msg === 'invalid') {
                callback(false, 'invalid');
            } else {
                callback(false, {string: RESULT});
            }
        });
    });

    afterEach(function() {
        promptStub.restore();
    });

    it('calls the callback with the result of prompt.get as result parameter', function() {
        readLine('Enter your name: ', function(err, result) {
            expect(result).to.equal(RESULT);
        });

    });

    it('passes the error code to the callback function if prompt.get returns an error code', function() {
        readLine('error', function(err, result) {
            expect(err).to.equal(ERR_CODE);
            expect(result).to.be.undefined;
        });
    });

    it('passes the error code to the callback function if prompt.get returns an invalid result', function() {
        readLine('invalid', function(err, result) {
            expect(err).to.equal('invalid-argument');
            expect(result).to.be.undefined;

        })
    });

});


text:
class Answer < ActiveRecord::Base
  belongs_to :user
  belongs_to :question
  has_many :comments, as: :commentable
  has_many :votes, as: :voteable

  validates :content, presence:true

end


text:
package io.agrest;

/**
 * Defines the names of standard update stages that can be used to insert custom processors into the update pipeline.
 * Stages ordinals are meaningful and correspond to the order of their execution by Agrest.
 *
 * @since 2.7
 */
public enum UpdateStage {

    // Stages ordinals determine stage execution order. DO NOT REORDER WITHOUT A REASON!

    START,

    PARSE_REQUEST,

    CREATE_ENTITY,

    APPLY_SERVER_PARAMS,

    /**
     * A stage when client changes are converted to {@link io.agrest.runtime.processor.update.ChangeOperation} objects.
     *
     * @since 4.8
     */
    MAP_CHANGES,

    /**
     * A stage when authorization rules are applied to the {@link io.agrest.runtime.processor.update.ChangeOperation}
     * objects. If at least one rule is not satisfied, the update chain is failed with "403 Forbidden" status.
     *
     * @since 4.8
     */
    AUTHORIZE_CHANGES,

    MERGE_CHANGES,

    COMMIT,

    FILL_RESPONSE,

    /**
     * A stage when the read filters are applied to the result object tree
     *
     * @since 4.8
     */
    FILTER_RESULT,

    /**
     * A stage when the result is encoded, or encoders are installed, depending on pipeline implementation
     *
     * @since 4.8
     */
    ENCODE
}


text:
import { Component, OnInit, Input, ViewChild ,Output ,EventEmitter} from '@angular/core';
import { ModalDirective } from 'ngx-bootstrap/modal';
@Component({
	selector: 'data-modal',
	templateUrl: 'dataModal.html'
})

export class DataModalComponent implements OnInit {

	@Input() title: string;

	@Input() isShowFooter:boolean=true;

	@ViewChild('lgModal') lgModal: ModalDirective;

 	@Output() onModalSave = new EventEmitter();

	ngOnInit() {

	}

	show(){
		this.lgModal.show();
	}

	close(){
		this.lgModal.hide();
	}

	modalSave(){
		this.onModalSave.emit();
	}

}


text:
package dsmoq.maintenance.data.localuser

import org.scalatra.servlet.FileItem

/**
 * ローカルユーザー追加のパラメータを表すクラス
 */
case class CreateParameter(
  userName: Option[String],
  fullName: Option[String],
  password: Option[String],
  organization: Option[String],
  title: Option[String],
  mailAddress: Option[String],
  description: Option[String]
) {
}

object CreateParameter {

  /**
   * マップ値からパラメータを作成する。
   *
   * @param map マップ値
   * @return パラメータ
   */
  def fromMap(map: Map[String, String]): CreateParameter = {
    CreateParameter(
      userName = map.get("userName"),
      fullName = map.get("fullName"),
      password = map.get("password"),
      organization = map.get("organization"),
      title = map.get("title"),
      mailAddress = map.get("mailAddress"),
      description = map.get("description")
    )
  }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AdminIgniter Dasbor</title>
    <link rel="icon" href="<?php echo asset_url()?>favicon.ico" type="image/x-icon" />
    <link href="<?php echo asset_url() ?>bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="<?php echo asset_url() ?>font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="<?php echo asset_url() ?>css/animate.css" rel="stylesheet">
    <link href="<?php echo asset_url() ?>css/style.css" rel="stylesheet">

                                <img alt="image" class="img-circle" src="<?php echo asset_url() ?>img/a6.jpg" />

                                  <?php echo $session['name']?>
                                  <?php echo ucwords($session['group'])?>

Profile

<a href="<?php echo backend_url()?>user/logout">Logout

                            AI+

                    <?php $this->load->view($menu) ?>

                    <img src="<?php echo asset_url()?>img/logo-coffee.png">
                    AdminIgniter

                        <a href="<?php echo backend_url()?>user/logout">
                             Log out

                <?php $this->load->view($page.'_view') ?>

                    Copyright AdminIgniter © <?php echo date('Y')?>


text:
<?php namespace Forhad\UIKits;

/**
 * Class BaseUIKit
 *
 * Provides a foundation that other UIKits can build upon, as well as
 * common methods that are ready for use.
 */
abstract class BaseUIKit {

    /**
     * Bucket for methods to control their current state between method calls.
     * @var array
     */
    protected $states = [];

    protected $name = '';

    /**
     * Attached to nav items that are considered active.
     * @var string
     */
    protected $active_class = 'active';

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

    public function name()
    {
        return $this->name;
    }

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

    //--------------------------------------------------------------------
    // Grids
    //--------------------------------------------------------------------

    /**
     * Creates a row wrapper of HTML. We would have simple returned the
     * the class for it, but some frameworks use a completely different
     * approach to rows and columns than the reference Bootstrap and Foundation.
     *
     * @param array $options
     * @return mixed
     */
    abstract public function row($options=[], \Closure $c);

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

    /**
     * Creates the CSS for a column in a grid.
     *
     * The attribute array is made up of key/value pairs with the
     * key being the size, and the value being the number of columns/offset
     * in a 12-column grid.
     *
     * Note that we currently DO NOT support offset columns.
     *
     * Valid sizes - 's', 'm', 'l', 'xl', 's-offset', 'm-offset', 'l-offset', 'xl-offset'
     *
     * Please note that that sizes are different than in Bootstrap. For example, for a 'xs'
     * column size in Bootstrap, you would use 's' here. 'sm' = 'm', etc.
     *
     * @param array $attributes
     * @return mixed
     */
    abstract public function column($options=[], \Closure $c);

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

    //--------------------------------------------------------------------
    // Navigation
    //--------------------------------------------------------------------

    /**
     * Generates the container code for a navbar, typically used along the
     * top of a page.
     *
     * @param array    $options
     * @param callable $c
     * @return string
     */
    abstract public function navbar($options=[], \Closure $c);

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

    /**
     * Builds the HTML for the Title portion of the navbar. This typically
     * includes the code for the hamburger menu on small resolutions.
     *
     * @param        $title
     * @param string $url
     * @return string
     */
    abstract public function navbarTitle($title, $url='#');

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

    /**
     * Creates a UL meant to pull to the right within the navbar.
     *
     * Available options:
     *      'class'     - An additional class to add
     *
     * @param array    $options
     * @param callable $c
     * @return string
     */
    abstract public function navbarRight($options=[], \Closure $c);

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

    /**
     * Creates a single list item for use within a nav section.
     *
     * @param       $title
     * @param       $url
     * @param array $options
     * @return string
     */
    abstract public function navItem($title, $url, $options=[], $isActive=false);

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

    /**
     * Builds the shell of a Dropdown button for use within a nav area.
     *
     * @param          $title
     * @param array    $options
     * @param callable $c
     */
    abstract public function navDropdown($title,$options=[], \Closure $c);

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

    /**
     * Creates a divider for use within a nav list.
     *
     * @return string
     */
    abstract public function navDivider();

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

    /**
     * Creates a list of nav items to function as breadcrumbs for a site.
     *
     * @param array    $options
     * @param callable $c
     * @return mixed
     */
    abstract public function breadcrumb($options=[], \Closure $c);

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

    //--------------------------------------------------------------------
    // Buttons
    //--------------------------------------------------------------------

    /**
     * Creates a simple button.
     *
     * $style can be 'default', 'primary', 'success', 'info', 'warning', 'danger'
     * $size can be 'default', 'small', 'xsmall', 'large'
     *
     * @param       $title
     * @param string $style
     * @param array $options
     * @return mixed
     */
    abstract public function button($title, $style='default', $size='default', $options=[]);

    /**
     * Creates a simple link styled as a button.
     *
     * $style can be 'default', 'primary', 'success', 'info', 'warning', 'danger'
     * $size can be 'default', 'small', 'xsmall', 'large'
     *
     * @param       $title
     * @param string $url
     * @param string $style
     * @param array $options
     * @return mixed
     */
    abstract public function buttonLink($title, $url='#', $style='default', $size='default', $options=[]);

    /**
     * Creates button groups wrapping HTML.
     *
     * @param          $options
     * @param callable $c
     * @return mixed
     */
    abstract public function buttonGroup($options, \Closure $c);

    /**
     * Creates the button bar wrapping HTML.
     *
     * @param          $options
     * @param callable $c
     * @return mixed
     */
    abstract public function buttonBar($options, \Closure $c);

    /**
     * Creates a button that also has a dropdown menu. Also called Split Buttons
     * by some frameworks.
     *
     * @param        $title
     * @param string $style
     * @param string $size
     * @param array  $options
     * @param callable $c
     * @return mixed
     */
    abstract public function buttonDropdown($title, $style='default', $size='default', $options=[], \Closure $c);

    //--------------------------------------------------------------------
    // Notices
    //--------------------------------------------------------------------

    /**
     * Creates an 'alert-box' style of notice grid.
     *
     * $style can be 'default', 'primary', 'success', 'info', 'warning', 'danger'
     *
     * @param $content
     * @param string $style
     * @param bool $closable
     * @return mixed
     */
    abstract public function notice($content, $style='success', $closable=true);

	//--------------------------------------------------------------------
	// Forms
	//--------------------------------------------------------------------

	/**
	 * Creates the wrapping code around a form input. Will generate the
	 * label for you, but you will still need to supply the input itself
	 * since those are fairly standard HTML.
	 *
	 * @param $label_text
	 * @param array $options
	 * @param callable $c
	 *
	 * @return mixed
	 */
	abstract public function inputWrap($label_text, $options=[], \Closure $c);

    //--------------------------------------------------------------------
    // Utility Methods
    //--------------------------------------------------------------------

    /**
     * Helper method to run a Closure and collect the output of it.
     *
     * @param callable $c
     * @return string
     */
    protected function runClosure(\Closure $c)
    {
        if (! is_callable($c)) return '';

        ob_start();
        $c();
        $output = ob_get_contents();
        ob_end_clean();

        return $output;
    }

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

    /**
     * Provides a single method call to get the $classes, $id, and $attributes
     * from the options array.
     *
     * @param        $options
     * @param string $initial_classes
     * @param bool   $fullClassString
     * @return array
     */
    protected function parseStandardOptions($options, $initial_classes='', $fullClassString=false)
    {
        return [
            $this->buildClassString($initial_classes, $options, $fullClassString),
            $this->buildIdFromOptions($options),
            $this->buildAttributesFromOptions($options)
        ];
    }

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

    /**
     * Sets the element that is to be considered the active item. This is
     * based on the navItem's $title so it must match, though it is NOT
     * case sensitive.
     *
     * @param $title
     * @return mixed
     */
    public function setActiveNavItem($title)
    {
        $this->states['activeNavItem'] = strtolower($title);
    }

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

    /**
     * Combines an initial classes string with a 'class' item that
     * might be available within the options array.
     *
     * If 'buildEntireString' is TRUE will return the string with the 'class=""' portion.
     * Otherwise, just returns the raw classes.
     *
     * @param string $initial
     * @param array $options
     * @return array
     */
    protected function buildClassString($initial, $options, $buildEntireString=false)
    {
        $classes = explode(' ', $initial);

        if (isset($options['class']))
        {
            $classes = array_merge($classes, explode(' ', $options['class']));
        }

        if (isset($this->states['activeNavItem']) && isset($this->states['activeNavTitle']) &&
            $this->states['activeNavItem'] == strtolower($this->states['activeNavTitle']))
        {
            $classes[] = $this->active_class;
        }

        $classes = implode(' ', $classes);

        // Substitute the active class for a placeholder.
        $classes = str_replace('{active}', $this->active_class, $classes);

        return $buildEntireString ? "class='{$classes}'" : $classes;
    }
    //--------------------------------------------------------------------

    /**
     * Checks the options array for an ID and returns the entire string.
     *
     * Example Return:
     *      id='MyID'
     *
     * @param $options
     * @return string
     */
    protected function buildIdFromOptions($options)
    {
        return isset($options['id']) ? "id='{$options['id']}'" : ' ';
    }

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

    /**
     * Parses out attributes from the options array. The attributes array
     * should all contain no key names, only values, so:
     *
     * 'attributes' => [
     *      'style="width:100%",
     *      'required'
     * ]
     *
     * @param $options
     * @return string
     */
    protected function buildAttributesFromOptions($options)
    {
        if (isset($options['attributes']) && ! is_array($options['attributes']))
        {
            $options['attributes'] = [ $options['attributes'] ];
        }

        return isset($options['attributes']) ? implode($options['attributes']) : '';
    }

    //--------------------------------------------------------------------
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Getting Started — Editor 0.1.0 documentation</title>

    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />

    <link rel="stylesheet" href="./_static/custom.css" type="text/css" />

    <link rel="top" title="Editor 0.1.0 documentation" href="index.html"/>
        <link rel="next" title="Editor API" href="editor-api.html"/>
        <link rel="prev" title="Editor Documentation" href="index.html"/>

             Editor

                0.1

  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Getting Started

Using the Editor

MetaModling

Developing a Module

Installation

Editor API

        Editor

Docs »

Getting Started

             View page source

Getting Started¶

Using the Editor¶

Describe how to use the editor here.

Note

This editor is under development.

MetaModling¶

Describe what metamodeling is here.

Developing a Module¶

Describe here how to make a module for the editor.

Installation¶

Download the analysis tool from the CBSAT repo:

Github

To build and install the editor, from a terminal:
make

Congratulations!  The set-up of the editor is complete!

        Next

         Previous

        © Copyright 2015, finger563.

  Built with Sphinx using a theme provided by Read the Docs.


text:
cd `dirname $0`/..

source_name=$1
if [ -z "${source_name}" ] ; then
  echo "USAGE: $0 source_name [client_args]"
  exit 1
fi

shift

script_dir=./bin
source $script_dir/setup.inc
source $script_dir/setup-client.inc

cli_overrides=

# DEFAULT VALUES
client_type=default
jvm_gc_log=${logs_dir}/client-gc.log

# JVM ARGUMENTS
jvm_direct_memory_size=40g
jvm_direct_memory="-XX:MaxDirectMemorySize=${jvm_direct_memory_size}"
jvm_min_heap_size="1024m"
jvm_min_heap="-Xms${jvm_min_heap_size}"
jvm_max_heap_size="1024m"
jvm_max_heap="-Xmx${jvm_max_heap_size}"

jvm_gc_options="-XX:NewSize=512m -XX:MaxNewSize=512m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:SurvivorRatio=6 -XX:MaxTenuringThreshold=7"
jvm_gc_log_option="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution "
if [ ! -z "${jvm_gc_log}" ] ; then
  jvm_gc_log_option="${jvm_gc_log_option} -Xloggc:${jvm_gc_log}"
fi

jvm_arg_line="-d64 ${jvm_direct_memory} ${jvm_min_heap} ${jvm_max_heap} ${jvm_gc_options} ${jvm_gc_log_option} -ea"

log4j_file_option="-l ${conf_dir}/client_log4j.properties"
config_file_option="-p ${conf_dir}/client_${source_name}.properties"

java_arg_line="${config_file_option} ${log4j_file_option}"

if [ ! -z "$cli_overrides" ] ; then
   cli_overrides="-c '$cli_overrides'"
fi

case "${source_name}" in
  "person" ) main_class=com.linkedin.databus.client.example.PersonClientMain ;;
esac

cmdline="java -cp ${cp} ${jvm_arg_line} ${main_class} ${java_arg_line} $cli_overrides $*"
echo $cmdline
$cmdline 2>&1 > ${client_out_file} &
echo $! > ${client_pid_file}


text:
require 'rails_helper'

module UnsPerson
  RSpec.describe Basic, type: :model do
    pending "add some examples to (or delete) #{__FILE__}"
  end
end


text:
import {readFile} from 'fs-extra';
import eol from './eol';

/**
 * Asynchronously reads the entire contents of a file.
 *
 * @param {String} path file path.
 * @return {String} the content of the file.
 */
export default async function read(path) {
	return eol(await readFile(path, 'utf8'));
}


text:
/**
 * @file    Special Purpose Strings Library: stringbase.hpp
 * @author  Daniel Evers
 * @brief   Core string class functionality
 * @license MIT
 */

#ifndef SPSL_STRINGBASE_HPP_
#define SPSL_STRINGBASE_HPP_

#include <iostream> // for ostream support

#include "spsl/stringcore.hpp"

namespace spsl
{

/**
 * This class extends the core string implementation to provide all methods specified for
 * @c std::basic_string, especially the insert, erase and replace methods.
 *
 * The methods are mostly implemented in the underlying StorageType to address for implementation
 * specific needs.
 */
template <typename StorageType>
class StringBase : public StringCore<StorageType>
{
public:
    /// alias for the typing impaired :)
    using this_type = StringBase<StorageType>;

    // inherit all typedefs from the base class
    using base_type = StringCore<StorageType>;
    using storage_type = StorageType;
    using char_type = typename base_type::char_type;
    using size_type = typename base_type::size_type;
    using difference_type = typename base_type::difference_type;
    using traits_type = typename base_type::traits_type;
    using value_type = typename base_type::value_type;
    using reference = typename base_type::reference;
    using const_reference = typename base_type::const_reference;
    using pointer = typename base_type::pointer;
    using const_pointer = typename base_type::const_pointer;
    using allocator_type = typename base_type::allocator_type;

    using iterator = typename base_type::iterator;
    using const_iterator = typename base_type::const_iterator;
    using const_reverse_iterator = typename base_type::const_reverse_iterator;
    using reverse_iterator = typename base_type::reverse_iterator;

    // "inherit" everything else as well
    using base_type::assign;
    using base_type::c_str;
    using base_type::data;
    using base_type::npos;
    using base_type::nul;
    using base_type::operator[];
    using base_type::append;
    using base_type::at;
    using base_type::back;
    using base_type::begin;
    using base_type::capacity;
    using base_type::cbegin;
    using base_type::cend;
    using base_type::clear;
    using base_type::copy;
    using base_type::crbegin;
    using base_type::crend;
    using base_type::empty;
    using base_type::end;
    using base_type::front;
    using base_type::length;
    using base_type::max_size;
    using base_type::pop_back;
    using base_type::push_back;
    using base_type::rbegin;
    using base_type::rend;
    using base_type::reserve;
    using base_type::resize;
    using base_type::shrink_to_fit;
    using base_type::size;
    using base_type::substr;
    using base_type::swap;
    using base_type::operator+=;
    using base_type::compare;
    using base_type::find;
    using base_type::rfind;

    /* ************************************ CONSTRUCTORS ************************************ */

    StringBase() : base_type() {}
    StringBase(const char_type* s) : base_type(s) {}
    StringBase(const char_type* s, size_type n) : base_type(s, n) {}
    StringBase(size_type numRepeat, char_type ch) : base_type(numRepeat, ch) {}
    StringBase(std::initializer_list<char_type> init) : base_type(init) {}
    template <class InputIt, typename = checkInputIter<InputIt>>
    StringBase(InputIt first, InputIt last) : base_type(first, last)
    {
    }

    // default destructor, move and copy
    ~StringBase() = default;
    StringBase(const this_type&) = default;
    StringBase(this_type&& rhs) noexcept : StringBase() { this->swap(rhs); }

    /// construct from another storage instance
    explicit StringBase(const storage_type& storage) : base_type(storage) {}

    /// construct from another string-like container (may even be a vector...)
    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    explicit StringBase(const StringClass& s) : base_type(s)
    {
    }

    /* ********************************** ASSIGNMENT OPERATORS ********************************** */

    this_type& operator=(const char_type* s)
    {
        assign(s);
        return *this;
    }
    this_type& operator=(char_type c)
    {
        assign(&c, 1);
        return *this;
    }
    this_type& operator=(std::initializer_list<char_type> init)
    {
        assign(init.begin(), init.size());
        return *this;
    }

    // default copy & move
    this_type& operator=(const this_type&) = default;
    this_type& operator=(this_type&& rhs) noexcept
    {
        this->swap(rhs);
        return *this;
    }

    /// allow assignment from another string-like container (may even be a vector...)
    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    this_type& operator=(const StringClass& s)
    {
        assign(s.data(), s.size());
        return *this;
    }

    /* **************************** COMPARISON OPERATORS **************************** */

    // note: While we can implement these as non-members (which shall be preferred according to
    //       Effective C++), having member functions allows us to hand them down to sub-classes.

    using base_type::operator==;
    using base_type::operator!=;
    using base_type::operator<;
    using base_type::operator<=;
    using base_type::operator>;
    using base_type::operator>=;

    // StringBase, const char_type* --> inherited from StringCore

    // StringBase, StringBase
    bool operator==(const this_type& rhs) const { return compare(rhs) == 0; }
    bool operator!=(const this_type& rhs) const { return compare(rhs) != 0; }
    bool operator<(const this_type& rhs) const { return compare(rhs) < 0; }
    bool operator<=(const this_type& rhs) const { return compare(rhs) <= 0; }
    bool operator>(const this_type& rhs) const { return compare(rhs) > 0; }
    bool operator>=(const this_type& rhs) const { return compare(rhs) >= 0; }

    // StringBase, other string class --> inherited from StringCore

    /* ********************************** INSERT FUNCTIONS ********************************** */

    // repeated character
    this_type& insert(size_type index, size_type count, char_type ch)
    {
        m_storage.insert(index, count, ch);
        return *this;
    }
    // C-string
    this_type& insert(size_type index, const char_type* s)
    {
        return insert(index, s, traits_type::length(s));
    }
    // C-string + length
    this_type& insert(size_type index, const char_type* s, size_type count)
    {
        m_storage.insert(index, s, s + count);
        return *this;
    }
    // another string-like class
    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    this_type& insert(size_type index, const StringClass& s)
    {
        return insert(index, s.data(), s.size());
    }
    // another string-like class with index and count
    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    this_type& insert(size_type index, const StringClass& s, size_type index_str,
                      size_type count = npos)
    {
        return insert(index, s.data() + index_str, std::min(s.size() - index_str, count));
    }

    // iterator variants
    iterator insert(const_iterator pos, char_type ch) { return insert(pos, 1, ch); }
    iterator insert(const_iterator pos, size_type count, char_type ch)
    {
        const auto offset = static_cast<size_t>(pos - begin());
        m_storage.insert(offset, count, ch);
        return begin() + offset;
    }
    template <class InputIt, typename = checkInputIter<InputIt>>
    iterator insert(const_iterator pos, InputIt first, InputIt last)
    {
        const auto offset = static_cast<size_t>(pos - begin());
        m_storage.insert(offset, first, last);
        return begin() + offset;
    }
    iterator insert(const_iterator pos, std::initializer_list<char_type> ilist)
    {
        return insert(pos, ilist.begin(), ilist.end());
    }

    /* ********************************** ERASE FUNCTIONS ********************************** */

    this_type& erase(size_type index = 0, size_type count = npos)
    {
        if (index > size())
            throw std::out_of_range("index > size()");

        m_storage.erase(index, std::min(count, size() - index));
        return *this;
    }
    iterator erase(const_iterator position)
    {
        if (position < cbegin() || position > cend())
            throw std::out_of_range("invalid iterator in erase()");

        auto pos = static_cast<size_type>(position - cbegin());
        m_storage.erase(pos, 1);
        return begin() + pos;
    }
    iterator erase(const_iterator first, const_iterator last)
    {
        if (first < cbegin() || last > cend() || first > last)
            throw std::out_of_range("invalid iterator(s) in erase()");

        auto pos = static_cast<size_type>(first - cbegin());
        auto cnt = static_cast<size_type>(last - first);
        m_storage.erase(pos, cnt);
        return begin() + pos;
    }

    /* ********************************** REPLACE FUNCTIONS ********************************** */

    // the first 3 methods wrap the actual implementation in the storage class,
    // the others are just wrappers for these 3

    this_type& replace(size_type pos, size_type count, const char_type* cstr, size_type count2)
    {
        if (pos > size())
            throw std::out_of_range("replace: pos > size()");
        if (pos + count > size())
            throw std::out_of_range("replace: pos + count > size()");

        // forward to the storage implementation...
        m_storage.replace(pos, count, cstr, count2);
        return *this;
    }
    this_type& replace(size_type pos, size_type count, size_type count2, char_type ch)
    {
        if (pos > size())
            throw std::out_of_range("replace: pos > size()");
        if (pos + count > size())
            throw std::out_of_range("replace: pos + count > size()");

        // forward to the storage implementation...
        m_storage.replace(pos, count, count2, ch);
        return *this;
    }
    template <class InputIt, typename = checkInputIter<InputIt>>
    this_type& replace(const_iterator first, const_iterator last, InputIt first2, InputIt last2)
    {
        auto pos = static_cast<size_type>(first - data());
        auto count = static_cast<size_type>(last - first);
        if (pos > size())
            throw std::out_of_range("replace: pos > size()");
        if (pos + count > size())
            throw std::out_of_range("replace: pos + count > size()");

        // forward to the storage implementation...
        m_storage.replace(pos, count, first2, last2);
        return *this;
    }

    this_type& replace(const_iterator first, const_iterator last, const char_type* cstr,
                       size_type count2)
    {
        return replace(static_cast<size_type>(first - data()), static_cast<size_type>(last - first),
                       cstr, count2);
    }
    this_type& replace(size_type pos, size_type count, const char_type* cstr)
    {
        return replace(pos, count, cstr, traits_type::length(cstr));
    }
    this_type& replace(const_iterator first, const_iterator last, const char_type* cstr)
    {
        return replace(static_cast<size_type>(first - data()), static_cast<size_type>(last - first),
                       cstr, traits_type::length(cstr));
    }
    this_type& replace(const_iterator first, const_iterator last, size_type count2, char_type ch)
    {
        return replace(static_cast<size_type>(first - data()), static_cast<size_type>(last - first),
                       count2, ch);
    }
    this_type& replace(const_iterator first, const_iterator last,
                       std::initializer_list<char_type> ilist)
    {
        return replace(static_cast<size_type>(first - data()), static_cast<size_type>(last - first),
                       ilist.begin(), ilist.size());
    }

    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    this_type& replace(size_type pos, size_type count, const StringClass& s)
    {
        return replace(pos, count, s.data(), s.size());
    }

    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    this_type& replace(const_iterator first, const_iterator last, const StringClass& s)
    {
        return replace(static_cast<size_type>(first - data()), static_cast<size_type>(last - first),
                       s.data(), s.size());
    }

    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    this_type& replace(size_type pos, size_type count, const StringClass& s, size_type pos2,
                       size_type count2 = npos)
    {
        return replace(pos, count, s.data() + pos2, std::min(count2, s.size() - pos2));
    }

    /* ********************************** FIND FUNCTIONS ********************************** */

    // Note: The standard plays ping-pong with "noexcept". We'll simply declare them all "noexcept"
    //       and don't raise any exceptions. I.e. there's no bounds checking...

    // FIND_FIRST_OF

    size_type find_first_of(const char_type* s, size_type pos, size_type count) const noexcept
    {
        for (size_type index = pos; index < size(); ++index)
        {
            for (size_type ind2 = 0; ind2 < count; ++ind2)
            {
                if (traits_type::eq(m_storage[index], s[ind2]))
                    return index;
            }
        }
        return npos;
    }

    size_type find_first_of(char_type ch, size_type pos = 0) const noexcept
    {
        return find(ch, pos);
    }

    size_type find_first_of(const char_type* s, size_type pos = 0) const noexcept
    {
        return find_first_of(s, pos, traits_type::length(s));
    }
    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    size_type find_first_of(const StringClass& s, size_type pos = 0) const noexcept
    {
        return find_first_of(s.data(), pos, s.size());
    }

    // FIND_FIRST_NOT_OF

    size_type find_first_not_of(const char_type* s, size_type pos, size_type count) const noexcept
    {
        for (size_type index = pos; index < size(); ++index)
        {
            bool found = false;
            for (size_type ind2 = 0; ind2 < count && !found; ++ind2)
            {
                if (traits_type::eq(m_storage[index], s[ind2]))
                    found = true;
            }
            if (!found)
                return index;
        }
        return npos;
    }
    size_type find_first_not_of(char_type ch, size_type pos = 0) const noexcept
    {
        for (size_type index = pos; index < size(); ++index)
        {
            if (!traits_type::eq(m_storage[index], ch))
                return index;
        }
        return npos;
    }

    size_type find_first_not_of(const char_type* s, size_type pos = 0) const noexcept
    {
        return find_first_not_of(s, pos, traits_type::length(s));
    }
    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    size_type find_first_not_of(const StringClass& s, size_type pos = 0) const noexcept
    {
        return find_first_not_of(s.data(), pos, s.size());
    }

    // FIND_LAST_OF

    size_type find_last_of(const char_type* s, size_type pos, size_type count) const noexcept
    {
        if (size())
        {
            // handle npos
            pos = std::min(pos, size() - 1);

            const char_type* d = data();
            for (const char_type* ptr = d + pos; ptr >= d; --ptr)
            {
                for (size_type ind2 = 0; ind2 < count; ++ind2)
                {
                    if (traits_type::eq(*ptr, s[ind2]))
                        return static_cast<size_type>(ptr - d);
                }
            }
        }
        return npos;
    }
    size_type find_last_of(char_type ch, size_type pos = npos) const noexcept
    {
        return rfind(ch, pos);
    }

    size_type find_last_of(const char_type* s, size_type pos = npos) const noexcept
    {
        return find_last_of(s, pos, traits_type::length(s));
    }
    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    size_type find_last_of(const StringClass& s, size_type pos = npos) const noexcept
    {
        return find_last_of(s.data(), pos, s.size());
    }

    // FIND_LAST_NOT_OF

    size_type find_last_not_of(const char_type* s, size_type pos, size_type count) const noexcept
    {
        if (size())
        {
            // handle npos
            pos = std::min(pos, size() - 1);

            const char_type* d = data();
            for (const char_type* ptr = d + pos; ptr >= d; --ptr)
            {
                bool found = false;
                for (size_type ind2 = 0; ind2 < count && !found; ++ind2)
                {
                    if (traits_type::eq(*ptr, s[ind2]))
                        found = true;
                }
                if (!found)
                    return static_cast<size_type>(ptr - d);
            }
        }
        return npos;
    }
    size_type find_last_not_of(char_type ch, size_type pos = npos) const noexcept
    {
        if (size())
        {
            // handle npos
            pos = std::min(pos, size() - 1);

            const char_type* d = data();
            for (const char_type* ptr = d + pos; ptr >= d; --ptr)
            {
                if (!traits_type::eq(*ptr, ch))
                    return static_cast<size_type>(ptr - d);
            }
        }
        return npos;
    }

    size_type find_last_not_of(const char_type* s, size_type pos = npos) const noexcept
    {
        return find_last_not_of(s, pos, traits_type::length(s));
    }
    template <typename StringClass, typename std::enable_if<is_compatible_string<
                                      char_type, size_type, StringClass>::value>::type* = nullptr>
    size_type find_last_not_of(const StringClass& s, size_type pos = npos) const noexcept
    {
        return find_last_not_of(s.data(), pos, s.size());
    }

    // output stream operator
    template <typename CharTraits>
    friend std::basic_ostream<char_type, CharTraits>& operator<<(
      std::basic_ostream<char_type, CharTraits>& os, const this_type& str)
    {
        os.write(str.data(), static_cast<std::streamsize>(str.size()));
        return os;
    }

protected:
    using base_type::m_storage;
};

// swap implementation
template <typename StorageType>
inline void swap(spsl::StringBase<StorageType>& lhs, spsl::StringBase<StorageType>& rhs)
{
    lhs.swap(rhs);
}

} // namespace spsl

namespace std
{

// partial specialization of std::hash
template <typename StorageType>
struct hash<spsl::StringBase<StorageType>>
{
    using argument_type = spsl::StringBase<StorageType>;

    hash() = default;
    hash(const hash&) = default;
    hash(hash&&) noexcept {}
    hash& operator=(const hash&) = default;
    hash& operator=(hash&&) noexcept { return *this; }
    ~hash() = default;

    size_t operator()(const argument_type& s) const
    {
        using char_type = typename spsl::StringBase<StorageType>::char_type;
        return spsl::hash::hash_impl(s.data(), s.size() * sizeof(char_type));
    }
};
} // namespace std

#endif /* SPSL_STRINGBASE_HPP_ */


text:
package com.digitalBorderlands.cityHall.exceptions;

/**
 * City Hall has returned an unexpected, invalid response.  For example, a 500 Internal Server Error.
 *
 * @author Alex
 *
 */
public class InvalidResponseException extends CityHallException {
	private static final long serialVersionUID = 1L;

	public InvalidResponseException(String message) {
		super(message);
	}
}