text:
<?php
// Include required library files.
require_once('../includes/config.php');
require_once('../autoload.php');

// Create PayPal object.
$PayPalConfig = array(
					  'Sandbox' => $sandbox,
					  'DeveloperAccountEmail' => $developer_account_email,
					  'ApplicationID' => $application_id,
					  'DeviceID' => $device_id,
					  'IPAddress' => $_SERVER['REMOTE_ADDR'],
					  'APIUsername' => $api_username,
					  'APIPassword' => $api_password,
					  'APISignature' => $api_signature,
					  'APISubject' => $api_subject,
					  'PrintHeaders' => $print_headers,
					  'LogResults' => $log_results,
					  'LogPath' => $log_path,
					);

$PayPal = new angelleye\PayPal\Adaptive($PayPalConfig);

// Prepare request arrays
$SPOFields = array(
				'PayKey' => '', 							// Required.  The pay key that identifies the payment for which you want to set payment options.
				'ShippingAddressID' => '' 					// Sender's shipping address ID.
				);

$DisplayOptions = array(
				'EmailHeaderImageURL' => '', 			// The URL of the image that displays in the header of customer emails.  1,024 char max.  Image dimensions:  43 x 240
				'EmailMarketingImageURL' => '', 		// The URL of the image that displays in the customer emails.  1,024 char max.  Image dimensions:  80 x 530
				'HeaderImageURL' => '', 				// The URL of the image that displays in the header of a payment page.  1,024 char max.  Image dimensions:  750 x 90
				'BusinessName' => ''					// The business name to display.  128 char max.
				);

$InstitutionCustomer = array(
				'CountryCode' => '', 				// Required.  2 char code of the home country of the end user.
				'DisplayName' => '', 				// Required.  The full name of the consumer as known by the institution.  200 char max.
				'InstitutionCustomerEmail' => '', 	// The email address of the consumer.  127 char max.
				'FirstName' => '', 					// Required.  The first name of the consumer.  64 char max.
				'LastName' => '', 					// Required.  The last name of the consumer.  64 char max.
				'InstitutionCustomerID' => '', 		// Required.  The unique ID assigned to the consumer by the institution.  64 char max.
				'InstitutionID' => ''				// Required.  The unique ID assiend to the institution.  64 char max.
				);

$SenderOptions = array(
				'RequireShippingAddressSelection' => '' // Boolean.  If true, require the sender to select a shipping address during the embedded payment flow.  Default is false.
				);

// Begin loop to populate receiver options.
$ReceiverOptions = array();
$ReceiverOption = array(
		'Description' => '', 					// A description you want to associate with the payment.  1000 char max.
		'CustomID' => '' 						// An external reference number you want to associate with the payment.  1000 char max.
);

$InvoiceData = array(
		'TotalTax' => '', 							// Total tax associated with the payment.
		'TotalShipping' => '' 						// Total shipping associated with the payment.
);

$InvoiceItems = array();
$InvoiceItem = array(
		'Name' => '', 								// Name of item.
		'Identifier' => '', 						// External reference to item or item ID.
		'Price' => '', 								// Total of line item.
		'ItemPrice' => '',							// Price of an individual item.
		'ItemCount' => ''							// Item QTY
);
array_push($InvoiceItems,$InvoiceItem);

$ReceiverIdentifier = array(
		'Email' => '', 						// Receiver's email address.  127 char max.
		'PhoneCountryCode' => '', 			// Receiver's telephone number country code.
		'PhoneNumber' => '', 				// Receiver's telephone number.
		'PhoneExtension' => ''				// Receiver's telephone extension.
);

$ReceiverOption['InvoiceData'] = $InvoiceData;
$ReceiverOption['InvoiceItems'] = $InvoiceItems;
$ReceiverOption['ReceiverIdentifier'] = $ReceiverIdentifier;
array_push($ReceiverOptions,$ReceiverOption);
// End receiver options loop

$PayPalRequestData = array(
				'SPOFields' => $SPOFields,
				'DisplayOptions' => $DisplayOptions,
				'InstitutionCustomer' => $InstitutionCustomer,
				'SenderOptions' => $SenderOptions,
				'ReceiverOptions' => $ReceiverOptions
				);

// Pass data into class for processing with PayPal and load the response array into $PayPalResult
$PayPalResult = $PayPal->SetPaymentOptions($PayPalRequestData);

// Write the contents of the response array to the screen for demo purposes.
echo '<pre />';
print_r($PayPalResult);
?>


text:
package io.github.takzhanov.umbrella.hw15.app;

import io.github.takzhanov.umbrella.hw15.ms.Address;
import io.github.takzhanov.umbrella.hw15.ms.Addressee;
import io.github.takzhanov.umbrella.hw15.ms.Message;

public abstract class MsgToFrontend extends Message {
    public MsgToFrontend(Address from, Address to) {
        super(from, to);
    }

    @Override
    public void exec(Addressee addressee) {
        if (addressee instanceof FrontendService) {
            exec((FrontendService) addressee);
        } else {
            //todo error!
        }
    }

    public abstract void exec(FrontendService frontendService);
}

redpajama_set_name: RedPajamaGithub


text:
package com.google.dataflow.sample.retail.dataobjects;

import com.google.auto.value.AutoValue;
import javax.annotation.Nullable;
import org.apache.beam.sdk.annotations.Experimental;
import org.apache.beam.sdk.schemas.AutoValueSchema;
import org.apache.beam.sdk.schemas.annotations.DefaultSchema;
import org.apache.beam.sdk.schemas.annotations.SchemaFieldName;

/**
 * A Inventory event is linked to a purchase, either in-store or via the website / mobile
 * application, or a delivery.
 */
@Experimental
public class Stock {

  @AutoValue
  @DefaultSchema(AutoValueSchema.class)
  public abstract static class StockEvent {
    public abstract @Nullable Integer getCount();

    public abstract @Nullable Integer getSku();

    @SchemaFieldName("product_id")
    public abstract @Nullable Integer getProductId();

    @SchemaFieldName("store_id")
    public abstract @Nullable Integer getStoreId();

    public abstract @Nullable Integer getAisleId();

    public abstract @Nullable String getProduct_name();

    public abstract @Nullable Integer getDepartmentId();

    public abstract @Nullable Float getPrice();

    public abstract @Nullable String getRecipeId();

    public abstract @Nullable String getImage();

    public abstract @Nullable Long getTimestamp();

    public abstract Stock.StockEvent.Builder toBuilder();

    public static Stock.StockEvent.Builder builder() {

      return new AutoValue_Stock_StockEvent.Builder();
    }

    @AutoValue.Builder
    public abstract static class Builder {
      public abstract Builder setCount(Integer value);

      public abstract Builder setSku(Integer value);

      public abstract Builder setProductId(Integer value);

      public abstract Builder setStoreId(Integer value);

      public abstract Builder setAisleId(Integer value);

      public abstract Builder setProduct_name(String value);

      public abstract Builder setDepartmentId(Integer value);

      public abstract Builder setPrice(Float value);

      public abstract Builder setRecipeId(String value);

      public abstract Builder setImage(String value);

      public abstract Stock.StockEvent.Builder setTimestamp(Long value);

      public abstract StockEvent build();
    }
  }
}


text:
package Graph;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;

/**
 * Simple graph represented by adjacency list
 */
public class SimpleGraph {
    private int count;
    private LinkedList<Integer> adjList[];

    public SimpleGraph(int count){
        this.count = count;
        this.adjList = new LinkedList[count];
        for (int i = 0; i < count; i++) {
             adjList[i] = new LinkedList<Integer>();

        }
    }

    public int getCount(){
        return this.count;
    }

    public void addEdge(int source, int dest){
        if(source > count-1 || dest > count-1){
            System.out.println("Vertices does not exist.");
            return;
        }
        adjList[source].add(dest);
    }

    public LinkedList<Integer>[] getNodes(){
        return adjList;
    }

    public LinkedList<Integer> getNode(int i){
        return adjList[i];
    }

    public Iterator<Integer> getNeighbours(int vertex){
        return adjList[vertex].listIterator();
    }

    public Iterator<Integer> getNeighbours(LinkedList<Integer> node){
        return node.listIterator();
    }

    public void print(){
        for (int i = 0; i < adjList.length; i++) {
            System.out.print(i + " -> ");
            LinkedList<Integer> neighbours = adjList[i];
            ListIterator<Integer> it = neighbours.listIterator();
            while(it.hasNext()){
                System.out.print(it.next() + " ");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        SimpleGraph g = new SimpleGraph(5);
        g.addEdge(0, 1);
        g.addEdge(0, 2);
        g.addEdge(1, 2);
        g.addEdge(2, 0);
        g.addEdge(2, 3);
        g.addEdge(3, 3);
        g.addEdge(3, 4);
        g.addEdge(4, 1);
        g.addEdge(4, 2);
        g.addEdge(4, 3);
        g.addEdge(4, 4);

        g.print();
    }

}


text:
package uk.jumpingmouse.spotify;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import java.util.List;

import uk.jumpingmouse.spotify.data.AppArtist;

/**
 * An adapter for the list items in the artist list.
 * @author Edmund Johnson
 */
public class ArtistAdapter extends ArrayAdapter<AppArtist> {

    private final Activity context;
    private final List<AppArtist> artistList;

    /**
     * Constructor which does not require a resource.
     * @param context the current context, used to inflate the layout file
     * @param artistList the list of artists to be displayed
     */
    public ArtistAdapter(Activity context, List<AppArtist> artistList) {
        // The second argument is used when the ArrayAdapter is populating a single TextView.
        // This adapter does not use the second argument, so it is set to 0.
        super(context, 0, artistList);
        this.context = context;
        this.artistList = artistList;
    }

    /**
     * Get the view for a list item at a specified position.
     * @param position the position in the list
     * @param itemView the recycled view
     * @param parent the parent ViewGroup that is used for inflation
     * @return the View for the list item at the specified position
     */
    @Override
    public View getView(final int position, View itemView, ViewGroup parent) {
        // Get the artist object from the list of artists
        final AppArtist artist = getItem(position);

        // If the recycled view is null, inflate the list item layout and assign it
        if (itemView == null) {
            itemView = LayoutInflater.from(getContext()).inflate(R.layout.artist_list_item, parent, false);
        }

        // Populate the image view with the artist image
        ImageView imgArtist = (ImageView) itemView.findViewById(R.id.imgArtist);
        Picasso.with(context).load(artist.getImageUrlSmall()).into(imgArtist);
        // Populate the text view with the artist name
        TextView txtArtist = (TextView) itemView.findViewById(R.id.txtArtist);
        txtArtist.setText(artist.getName());

        return itemView;
    }

    public List<AppArtist> getArtistList() {
        return artistList;
    }

    /**
     * Cache of the child item views.
     * Useful for newView/bindView approach, but not for getView approach.
     */
    /*
    public static class ViewHolder {
        public final ImageView imgArtist;
        public final TextView txtArtist;

        public ViewHolder(View view) {
            imgArtist = (ImageView) view.findViewById(R.id.imgArtist);
            txtArtist = (TextView) view.findViewById(R.id.txtArtist);
        }
    }
    */
}


text:
<?php

namespace sndsgd\http\data\decoder;

use \org\bovigo\vfs\vfsStream;

class JsonDecoderTest extends \PHPUnit\Framework\TestCase
{
    public function setup()
    {
        $this->root = vfsStream::setup("root");
    }

    /**
     * @dataProvider providerDecode
     */
    public function testDecode($json, $type, $length, $options, $expect)
    {
        vfsStream::newFile("test.json")->at($this->root)->setContent($json);
        $path = vfsStream::url("root/test.json");
        $decoder = new JsonDecoder($path, $type, $length, $options);
        $this->assertSame($expect, $decoder->decode());
    }

    public function providerDecode()
    {
        $ret = [];

        $json = '{"test":1}';
        $ret[] = [
            $json,
            "application/json",
            strlen($json),
            null,
            ["test" => 1],
        ];

        $json = '[1,2,"a"]';
        $ret[] = [
            $json,
            "application/json",
            strlen($json),
            null,
            [1, 2, "a"],
        ];

        return $ret;
    }

    /**
     * @expectedException \RuntimeException
     */
    public function testDecodeReadStreamException()
    {
        $path = vfsStream::url("root/test.json");
        (new JsonDecoder($path, "application/json", 1, null))->decode();
    }

    /**
     * @dataProvider providerDecodeException
     */
    public function testDecodeException(
        $json,
        $length,
        $options,
        $exception,
        $message
    )
    {
        $this->expectException($exception, $message);
        vfsStream::newFile("test.json")->at($this->root)->setContent($json);
        $path = vfsStream::url("root/test.json");
        (new JsonDecoder($path, "application/json", $length, $options))->decode();
    }

    public function providerDecodeException()
    {
        $ret = [];

        # invalid json syntax
        $json = '{"test:"value",}';
        $ret[] = [
            $json,
            strlen($json),
            null,
            "sndsgd\\http\\data\\DecodeException",
            "failed to decode JSON request data; Syntax error"
        ];

        # max depth exceeded
        $options = $this->getMockBuilder(DecoderOptions::class)
            ->setMethods(["getMaxNestingLevels"])
            ->getMock();
        $options->method("getMaxNestingLevels")->willReturn(3);

        $json = '{"a":{"b":{"c":{"d":5}}}}';
        $ret[] = [
            $json,
            strlen($json),
            $options,
            "sndsgd\\http\\data\\DecodeException",
            "failed to decode JSON request data; Maximum stack depth exceeded"
        ];

        return $ret;
    }
}


text:
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\ActiveForm;
use backend\models\Companies;
use kartik\select2\Select2;
/* @var $this yii\web\View */
/* @var $model backend\models\Branches */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'companies_company_id')->widget(Select2::classname(), [
	    		'data' => ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'),
	    		'language' => 'en',
	    		'options' => ['placeholder' => 'Select Company'],
	    		'pluginOptions' => [
	    				'allowClear' => true
	    		],
	    ]);
    ?>

    <?= $form->field($model, 'branch_name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'branch_address')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'branch_status')->dropDownList([ 'active' => 'Active', 'inactive' => 'Inactive', ], ['prompt' => '']) ?>

        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

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


text:
"""
Supertype of balls for which elements satisfy `norm(x) < radius(ball)` (open ball)
or `norm(x) <= radius(ball)` (closed ball).
"""
abstract type Ball{T,C} <: Domain{T} end

"A ball in a fixed N-dimensional Euclidean space."
const EuclideanBall{N,T,C} = Ball{SVector{N,T},C}

"A ball with vector elements of variable length."
const VectorBall{T,C} = Ball{Vector{T},C}

iscompatiblepair(x::AbstractVector, d::VectorBall) = length(x) == dimension(d)

const ClosedBall{T} = Ball{T,:closed}
const OpenBall{T} = Ball{T,:open}

isclosedset(::ClosedBall) = true
isclosedset(::OpenBall) = false
isopenset(d::Ball) = !isclosedset(d)

# Convenience constructors for the abstract type
Ball() = UnitBall()
Ball{T}() where {T} = UnitBall{T}()
Ball{T,C}() where {T,C} = UnitBall{T,C}()
Ball(radius::Number) = GenericBall(radius)
Ball{T}(radius::Number) where {T} = GenericBall{T}(radius)
Ball{T,C}(radius::Number) where {T,C} = GenericBall{T,C}(radius)
Ball(radius::Number, center) = GenericBall(radius, center)
Ball{T}(radius::Number, center) where {T} = GenericBall{T}(radius, center)
Ball{T,C}(radius::Number, center) where {T,C} = GenericBall{T,C}(radius, center)

indomain(x, d::OpenBall) = norm(x-center(d)) < radius(d)
indomain(x, d::ClosedBall) = norm(x-center(d)) <= radius(d)
approx_indomain(x, d::OpenBall, tolerance) = norm(x-center(d)) < radius(d)+tolerance
approx_indomain(x, d::ClosedBall, tolerance) = norm(x-center(d)) <= radius(d)+tolerance

# A closed ball always contains at least its center point.
isempty(d::ClosedBall) = false
isempty(d::OpenBall) = radius(d) == 0

==(d1::Ball, d2::Ball) = isclosedset(d1)==isclosedset(d2) &&
    radius(d1)==radius(d2) && center(d1)==center(d2)
hash(d::Ball, h::UInt) = hashrec("Ball", isclosedset(d), radius(d), center(d), h)

function issubset(d1::Ball, d2::Ball)
    if dimension(d1) == dimension(d2)
        if center(d1) == center(d2)
            if radius(d1) < radius(d2)
                true
            elseif radius(d1) == radius(d2)
                isclosedset(d2) || isopenset(d1)
            else
                false
            end
        else
            dist = norm(center(d1)-center(d2))
            if dist + radius(d1) < radius(d2)
                true
            else
                false
            end
        end
    else
        false
    end
end

normal(d::Ball, x) = normal(boundary(d), x)

distance_to(d::Ball, x) = x ∈ d ? zero(prectype(d)) : norm(x-center(d))-radius(d)

# We choose the center of the ball here. Concrete types should implement 'center'
point_in_domain(d::Ball) = center(d)

"The unit ball."
abstract type UnitBall{T,C} <: Ball{T,C} end

radius(::UnitBall) = 1
center(d::UnitBall{T}) where {T<:StaticTypes} = zero(T)

UnitBall(n::Int) = DynamicUnitBall(n)
UnitBall(::Val{N} = Val(3)) where {N} = EuclideanUnitBall{N}()

UnitBall{T}(n::Int) where {T <: StaticTypes} = StaticUnitBall{T}(n)
UnitBall{T}(::Val{N}) where {N,T} = StaticUnitBall{T}(Val(N))
UnitBall{T}() where {T <: StaticTypes} = StaticUnitBall{T}()
UnitBall{T}(n::Int) where {T} = DynamicUnitBall{T}(n)

UnitBall{T,C}(n::Int) where {T <: StaticTypes,C} = StaticUnitBall{T,C}(n)
UnitBall{T,C}(::Val{N}) where {N,T,C} = StaticUnitBall{T,C}(Val(N))
UnitBall{T,C}() where {T <: StaticTypes,C} = StaticUnitBall{T,C}()
UnitBall{T,C}(n::Int) where {T,C} = DynamicUnitBall{T,C}(n)

const ClosedUnitBall{T} = UnitBall{T,:closed}
const OpenUnitBall{T} = UnitBall{T,:open}

indomain(x, d::OpenUnitBall) = norm(x) < 1
indomain(x, d::ClosedUnitBall) = norm(x) <= 1
approx_indomain(x, d::OpenUnitBall, tolerance) = norm(x) < 1+tolerance
approx_indomain(x, d::ClosedUnitBall, tolerance) = norm(x) <= 1+tolerance

==(d1::UnitBall, d2::UnitBall) = isclosedset(d1)==isclosedset(d2) &&
    dimension(d1) == dimension(d2)

issubset(d1::UnitBall, d2::UnitBall) =
    dimension(d1) == dimension(d2) && (isclosedset(d2) || isopenset(d1))

convert(::Type{SublevelSet}, d::UnitBall{T,C}) where {T,C} =
    SublevelSet{T,C}(norm, radius(d))
convert(::Type{SublevelSet{T}}, d::UnitBall{S,C}) where {T,S,C} =
    SublevelSet{T,C}(norm, radius(d))

"The unit ball with fixed dimension(s) specified by the element type."
struct StaticUnitBall{T,C} <: UnitBall{T,C}
end

StaticUnitBall() = StaticUnitBall{Float64}()
StaticUnitBall(::Val{N}) where {N} = StaticUnitBall{SVector{N,Float64}}()

StaticUnitBall{T}() where {T} = StaticUnitBall{T,:closed}()

StaticUnitBall{T}(n::Int) where {T} =
    (@assert n == euclideandimension(T); StaticUnitBall{T}())
StaticUnitBall{T}(::Val{N}) where {N,T} =
    (@assert N == euclideandimension(T); StaticUnitBall{T}())

StaticUnitBall{T,C}(n::Int) where {T,C} =
    (@assert n == euclideandimension(T); StaticUnitBall{T,C}())
StaticUnitBall{T,C}(::Val{N}) where {N,T,C} =
    (@assert N == euclideandimension(T); StaticUnitBall{T,C}())

"The unit ball in a fixed N-dimensional space."
const EuclideanUnitBall{N,T,C} = StaticUnitBall{SVector{N,T},C}

EuclideanUnitBall{N}() where {N} = EuclideanUnitBall{N,Float64}()

similardomain(d::StaticUnitBall{S,C}, ::Type{T}) where {S,C,T<:StaticTypes} =
    StaticUnitBall{T,C}()
similardomain(d::StaticUnitBall{S,C}, ::Type{T}) where {S,C,T} =
    DynamicUnitBall{T,C}(dimension(d))

const UnitDisk{T} = UnitBall{SVector{2,T},:closed}
UnitDisk() = UnitDisk{Float64}()

## A StaticUnitBall{<:Number} equals the interval [-1,1]  (open or closed)
convert(::Type{Interval}, d::StaticUnitBall{T,:closed}) where {T <: Number} =
    ChebyshevInterval{T}()
convert(::Type{Interval}, d::StaticUnitBall{T,:open}) where {T <: Number} =
    OpenInterval{T}(-1, 1)

canonicaldomain(::Equal, d::StaticUnitBall{T}) where {T<:Number} = convert(Interval, d)

"The unit ball with variable dimension stored in a data field."
struct DynamicUnitBall{T,C} <: UnitBall{T,C}
    dimension   ::  Int

    DynamicUnitBall{T,C}(n::Int) where {T,C} = new(n)
    DynamicUnitBall{T,C}(n::Int) where {T<:StaticTypes,C} =
        (@assert n == euclideandimension(T); new(n))
end

DynamicUnitBall(n::Int) = DynamicUnitBall{Vector{Float64}}(n)
DynamicUnitBall{T}(n::Int) where {T} = DynamicUnitBall{T,:closed}(n)

dimension(d::DynamicUnitBall) = d.dimension

center(d::DynamicUnitBall{T}) where {T} = zeros(eltype(T), dimension(d))

"The unit ball with vector elements of a given dimension."
const VectorUnitBall{T,C} = DynamicUnitBall{Vector{T},C}

VectorUnitBall(n::Int = 3) = VectorUnitBall{Float64}(n)
VectorUnitDisk() = VectorUnitBall(2)

similardomain(d::DynamicUnitBall{S,C}, ::Type{T}) where {S,C,T} =
    DynamicUnitBall{T,C}(dimension(d))
similardomain(d::DynamicUnitBall{S,C}, ::Type{T}) where {S,C,T<:StaticTypes} =
    StaticUnitBall{T,C}()

"A `GenericBall` is a ball with a given radius and center."
struct GenericBall{T,C,S} <: Ball{T,C}
    radius  ::  S
    center  ::  T
end

GenericBall() = GenericBall(1.0)
GenericBall(radius::S) where {S<:Number} = GenericBall(radius, zero(SVector{3,float(S)}))
GenericBall(radius::S, center::T) where {S<:Number,U,T<:Vector{U}} =
    GenericBall{Vector{promote_type(S,U)}}(radius, center)
GenericBall(radius::S, center::T) where {S<:Number,N,U,T<:SVector{N,U}} =
    GenericBall{SVector{N,promote_type(S,U)}}(radius, center)
GenericBall(radius::S, center::T) where {S<:Number,T<:AbstractVector} =
    GenericBall{Vector{promote_type(S,eltype(T))}}(radius, center)
GenericBall(radius::S, center::T) where {S<:Number,T<:Number} =
    GenericBall{promote_type(S,T)}(radius, center)
GenericBall{T}(radius) where {T} = GenericBall{T,:closed}(radius)
GenericBall{T}(radius, center) where {T} = GenericBall{T,:closed}(radius, center)
GenericBall{T,C}(radius) where {T,C} = GenericBall{T,C}(radius, zero(T))
GenericBall{T,C}(radius, center) where {T,C} = GenericBall{T,C,eltype(T)}(radius, center)

radius(d::GenericBall) = d.radius
center(d::GenericBall) = d.center

dimension(d::GenericBall) = length(d.center)

canonicaldomain(d::GenericBall{T,C}) where {T,C} = UnitBall{T,C}(dimension(d))
mapfrom_canonical(d::GenericBall) = AffineMap(radius(d), center(d))

boundingbox(d::GenericBall) =
    map_boundingbox(boundingbox(canonicaldomain(d)), mapfrom_canonical(d))

# Preserve the `Ball` type under affine maps which preserve shape
map_domain(m::GenericAffineMap{T,S}, d::Ball{U,C}) where {T<:AbstractVector,S<:Number,U<:AbstractVector,C} =
    Ball{U,C}(m.A * radius(d), m.A * center(d) + m.b)
map_domain(m::AffineMap{T}, d::Ball{U,C}) where {T<:Number,U<:Number,C} =
    Ball{promote_type(U,T),C}(m.A * radius(d), m.A * center(d) + m.b)
map_domain(m::GenericLinearMap{T,S}, d::Ball{U,C}) where {S<:Number,T<:AbstractVector,U<:AbstractVector,C} =
    Ball{promote_type(T,U),C}(m.A * radius(d), m.A * center(d))
map_domain(m::LinearMap{T}, d::Ball{U,C}) where {T<:Number,U<:Number,C} =
    Ball{promote_type(T,U),C}(m.A * radius(d), m.A * center(d))
map_domain(m::LinearMap{T}, d::Ball{U,C}) where {T<:Number,U,C} =
    Ball{U,C}(m.A * radius(d), m.A * center(d))
map_domain(m::Translation{T}, d::Ball{S,C}) where {T<:AbstractVector,S<:AbstractVector,C} =
    Ball{S,C}(radius(d), center(d) + m.b)
map_domain(m::Translation{T}, d::Ball{S,C}) where {T<:Number,S<:Number,C} =
    Ball{S,C}(radius(d), center(d) + m.b)

show(io::IO, d::EuclideanUnitBall{3,Float64,:closed}) = print(io, "UnitBall()")
show(io::IO, d::EuclideanUnitBall{N,Float64,:closed}) where {N} = print(io, "UnitBall(Val($(N)))")
show(io::IO, d::EuclideanUnitBall{3,Float64,:open}) = print(io, "UnitBall()  (open)")
show(io::IO, d::EuclideanUnitBall{N,Float64,:open}) where {N} = print(io, "UnitBall(Val($(N)))  (open)")
Display.object_parentheses(d::EuclideanUnitBall{N,Float64,:open}) where {N} = true
show(io::IO, d::EuclideanUnitBall{2,Float64,:closed}) = print(io, "UnitDisk()")
show(io::IO, d::UnitDisk{T}) where {T} = print(io, "UnitDisk{$(T)}()")
show(io::IO, d::UnitBall{T}) where {T<:Number} = print(io, "UnitBall{$(T)}()")
show(io::IO, d::UnitBall{T,:open}) where {T<:Number} = print(io, "UnitBall{$(T)}()  (open)")
Display.object_parentheses(d::UnitBall{T,:open}) where {T<:Number} = true
show(io::IO, d::VectorUnitBall{Float64,:closed}) = print(io, "UnitBall($(dimension(d)))")
show(io::IO, d::VectorUnitBall{Float64,:open}) = print(io, "UnitBall($(dimension(d)))  (open)")
show(io::IO, d::Ball) = print(io, "Ball($(radius(d)), $(center(d)))")

# The type hierarchy of spheres parallels that of Ball above:
# abstract Sphere
# |-> abstract UnitSphere: radius is 1
#     |-> StaticUnitSphere: dimension is part of type
#     |-> DynamicUnitSphere: dimension is specified by int field
# |-> GenericSphere: stores center and radius. Here, the dimension can be
#     obtained from the center, so there is only one type.
# There are aliases for SVector{N,T} and Vector{T}.

"Supertype of spherical domains for which elements satisfy `norm(x) == radius(sphere)`."
abstract type Sphere{T} <: Domain{T} end

indomain(x, d::Sphere) = norm(x-center(d)) == radius(d)
approx_indomain(x, d::Sphere, tolerance) =
    radius(d)-tolerance <= norm(x-center(d)) <= radius(d)+tolerance

# Convenience constructors for the abstract type
Sphere() = UnitSphere()
Sphere{T}() where {T} = UnitSphere{T}()
Sphere(radius::Number) = GenericSphere(radius)
Sphere{T}(radius::Number) where {T} = GenericSphere{T}(radius)
Sphere(radius::Number, center) = GenericSphere(radius, center)
Sphere{T}(radius::Number, center) where {T} = GenericSphere{T}(radius, center)

isempty(::Sphere) = false

isclosedset(::Sphere) = true
isopenset(::Sphere) = false

normal(d::Sphere, x) = (x-center(d))/norm(x-center(d))

distance_to(d::Sphere, x) = abs(norm(x-center(d))-radius(d))

point_in_domain(d::Sphere) = center(d) + unitvector(d, 1)

==(d1::Sphere, d2::Sphere) = radius(d1)==radius(d2) && center(d1)==center(d2)

"A hypersphere in a fixed N-dimensional Euclidean space."
const EuclideanSphere{N,T} = Sphere{SVector{N,T}}

"A sphere with vector elements of variable length."
const VectorSphere{T} = Sphere{Vector{T}}

"The unit sphere."
abstract type UnitSphere{T} <: Sphere{T} end

radius(::UnitSphere) = 1
center(d::UnitSphere{T}) where {T<:StaticTypes} = zero(T)

normal(d::UnitSphere, x) = x/norm(x)

indomain(x, d::UnitSphere) = norm(x) == 1
approx_indomain(x, d::UnitSphere, tolerance) =
    1-tolerance <= norm(x) <= 1+tolerance

UnitSphere(n::Int) = DynamicUnitSphere(n)
UnitSphere(::Val{N} = Val(3)) where {N} = EuclideanUnitSphere{N}()

UnitSphere{T}(n::Int) where {T <: StaticTypes} = StaticUnitSphere{T}(n)
UnitSphere{T}(::Val{N}) where {N,T} = StaticUnitSphere{T}(Val(N))
UnitSphere{T}() where {T <: StaticTypes} = StaticUnitSphere{T}()
UnitSphere{T}(n::Int) where {T} = DynamicUnitSphere{T}(n)

==(d1::UnitSphere, d2::UnitSphere) = dimension(d1)==dimension(d2)

issubset1(d1::UnitSphere, d2::UnitBall) =
    dimension(d1) == dimension(d2) && isclosedset(d2)

convert(::Type{LevelSet}, d::UnitSphere{T}) where {T} = LevelSet{T}(norm, radius(d))
convert(::Type{LevelSet{T}}, d::UnitSphere) where {T} = LevelSet{T}(norm, radius(d))

"The unit sphere with fixed dimension(s) specified by the element type."
struct StaticUnitSphere{T} <: UnitSphere{T}
end

StaticUnitSphere() = StaticUnitSphere{Float64}()
StaticUnitSphere(::Val{N}) where {N} = StaticUnitSphere{SVector{N,Float64}}()

StaticUnitSphere{T}(n::Int) where {T} =
    (@assert n == euclideandimension(T); StaticUnitSphere{T}())
StaticUnitSphere{T}(::Val{N}) where {N,T} =
    (@assert N == euclideandimension(T); StaticUnitSphere{T}())

similardomain(d::StaticUnitSphere, ::Type{T}) where {T<:StaticTypes} =
    StaticUnitSphere{T}()
similardomain(d::StaticUnitSphere, ::Type{T}) where {T} =
    DynamicUnitSphere{T}(dimension(d))

"The unit sphere in a fixed N-dimensional Euclidean space."
const EuclideanUnitSphere{N,T} = StaticUnitSphere{SVector{N,T}}

EuclideanUnitSphere{N}() where {N} = EuclideanUnitSphere{N,Float64}()

"The unit circle in 2D."
const UnitCircle{T} = UnitSphere{SVector{2,T}}
UnitCircle() = UnitCircle{Float64}()

"The unit sphere with variable dimension."
struct DynamicUnitSphere{T} <: UnitSphere{T}
    dimension   ::  Int

    DynamicUnitSphere{T}(n::Int) where {T} = new(n)
    DynamicUnitSphere{T}(n::Int) where {T<:StaticTypes} =
        (@assert n == euclideandimension(T); new(n))
end

DynamicUnitSphere(n::Int) = DynamicUnitSphere{Vector{Float64}}(n)

dimension(d::DynamicUnitSphere) = d.dimension

center(d::DynamicUnitSphere{T}) where {T} = zeros(eltype(T), dimension(d))

"The unit sphere with vector elements of a given dimension."
const VectorUnitSphere{T} = DynamicUnitSphere{Vector{T}}

VectorUnitSphere(n::Int = 3) = VectorUnitSphere{Float64}(n)
VectorUnitCircle() = VectorUnitSphere(2)

similardomain(d::DynamicUnitSphere, ::Type{T}) where {T} =
    DynamicUnitSphere{T}(d.dimension)
similardomain(d::DynamicUnitSphere, ::Type{T}) where {T <: StaticTypes} =
    StaticUnitSphere{T}()

"A `GenericSphere` is a sphere with a given radius and center."
struct GenericSphere{T,S} <: Sphere{T}
    radius  ::  S
    center  ::  T
end

GenericSphere() = GenericSphere(1.0)
GenericSphere(radius::S) where {S<:Number} =
    GenericSphere(radius, zero(SVector{3,float(S)}))
GenericSphere(radius::S, center::T) where {S<:Number,U,T<:Vector{U}} =
    GenericSphere{Vector{promote_type(S,U)}}(radius, center)
GenericSphere(radius::S, center::T) where {S<:Number,N,U,T<:SVector{N,U}} =
    GenericSphere{SVector{N,promote_type(S,U)}}(radius, center)
GenericSphere(radius::S, center::T) where {S<:Number,T<:AbstractVector} =
    GenericSphere{Vector{promote_type(S,eltype(T))}}(radius, center)
GenericSphere{T}(radius) where {T} = GenericSphere{T}(radius, zero(T))
GenericSphere{T}(radius, center) where {T} =
    GenericSphere{T,eltype(T)}(radius, center)

radius(d::GenericSphere) = d.radius
center(d::GenericSphere) = d.center

dimension(d::GenericSphere) = length(d.center)

canonicaldomain(d::GenericSphere{T}) where {T} = UnitSphere{T}(dimension(d))
mapfrom_canonical(d::GenericSphere) = AffineMap(radius(d), center(d))

boundingbox(d::GenericSphere) =
    map_boundingbox(boundingbox(canonicaldomain(d)), mapfrom_canonical(d))

# Preserve the `Sphere` type under affine maps which preserve shape
map_domain(m::GenericAffineMap{T,S}, d::Sphere{U}) where {T<:AbstractVector,S<:Number,U<:AbstractVector} =
    Sphere{U}(m.A * radius(d), m.A * center(d) + m.b)
map_domain(m::AffineMap{T}, d::Sphere{U}) where {T<:Number,U<:Number} =
    Sphere{promote_type(U,T)}(m.A * radius(d), m.A * center(d) + m.b)
map_domain(m::GenericLinearMap{T,S}, d::Sphere{U}) where {S<:Number,T<:AbstractVector,U<:AbstractVector} =
    Sphere{promote_type(T,U)}(m.A * radius(d), m.A * center(d))
map_domain(m::LinearMap{T}, d::Sphere{U}) where {T<:Number,U<:Number} =
    Sphere{promote_type(T,U)}(m.A * radius(d), m.A * center(d))
map_domain(m::LinearMap{T}, d::Sphere{U}) where {T<:Number,U} =
    Sphere{U}(m.A * radius(d), m.A * center(d))
map_domain(m::Translation{T}, d::Sphere{S}) where {T<:AbstractVector,S<:AbstractVector} =
    Sphere{S}(radius(d), center(d) + m.b)
map_domain(m::Translation{T}, d::Sphere{S}) where {T<:Number,S<:Number} =
    Sphere{S}(radius(d), center(d) + m.b)

show(io::IO, d::EuclideanUnitSphere{3,Float64}) = print(io, "UnitSphere()")
show(io::IO, d::EuclideanUnitSphere{N,Float64}) where {N} = print(io, "UnitSphere(Val($(N)))")
show(io::IO, d::EuclideanUnitSphere{2,Float64}) = print(io, "UnitCircle()")
show(io::IO, d::UnitCircle{T}) where {T} = print(io, "UnitCircle{$(T)}()")
show(io::IO, d::VectorUnitSphere{Float64}) = print(io, "UnitSphere($(dimension(d)))")
show(io::IO, d::UnitSphere{T}) where {T<:Number} = print(io, "UnitSphere{$(T)}()")
show(io::IO, d::Sphere) = print(io, "Sphere($(radius(d)), $(center(d)))")

boundary(d::UnitBall{T}) where {T} = UnitSphere{T}(dimension(d))
boundary(d::Ball{T}) where {T} = Sphere{T}(radius(d), center(d))

interior(d::StaticUnitBall{T}) where {T} = StaticUnitBall{T,:open}()
interior(d::DynamicUnitBall{T}) where {T} = DynamicUnitBall{T,:open}(dimension(d))
interior(d::Ball{T}) where {T} = Ball{T,:open}(radius(d), center(d))

closure(d::StaticUnitBall{T}) where {T} = StaticUnitBall{T,:closed}()
closure(d::DynamicUnitBall{T}) where {T} = DynamicUnitBall{T,:closed}(dimension(d))
closure(d::Ball{T}) where {T} = Ball{T,:closed}(radius(d), center(d))

boundingbox(d::UnitBall{T}) where {T<:Number} = ChebyshevInterval{T}()
boundingbox(d::UnitBall{SVector{N,T}}) where {N,T} =
    ChebyshevProductDomain{N,T}()
boundingbox(d::UnitBall{T}) where {T} =
    Rectangle{T}(-ones(eltype(T), dimension(d)), ones(eltype(T), dimension(d)))

boundingbox(d::UnitSphere{T}) where {T<:Number} = ChebyshevInterval{T}()
boundingbox(d::UnitSphere{SVector{N,T}}) where {N,T} =
    ChebyshevProductDomain{N,T}()
boundingbox(d::UnitSphere{T}) where {T} =
    Rectangle{T}(-ones(eltype(T), dimension(d)), ones(eltype(T), dimension(d)))

################
# Applications
################

"Create a cylinder with given radius and length."
cylinder(::Type{T} = Float64) where {T} = UnitDisk{T}() × UnitInterval{T}()
cylinder(radius, length) = cylinder(promote(radius, length)...)
cylinder(radius::T, length::T) where {T} = (radius .* UnitDisk{T}()) × (0..length)

"Create an ellipse curve with semi-axes lengths `a` and `b` respectively."
ellipse(a::Number, b::Number) = ellipse(promote(a,b)...)
ellipse(a::T, b::T) where {T <: Number} = LinearMap(a, b).(UnitCircle{T}())

"Create an ellipse-shaped domain with semi-axes lengths `a` and `b` respectively."
ellipse_shape(a::Number, b::Number) = ellipse_shape(promote(a,b)...)
ellipse_shape(a::T, b::T) where {T <: Number} = LinearMap(a, b).(UnitDisk{T}())

"""
The map `[cos(2πt), sin(2πt)]` from `[0,1]` to the unit circle in `ℝ^2`.
"""
struct UnitCircleMap{T} <: Map{T} end

UnitCircleMap() = UnitCircleMap{Float64}()

mapsize(m::UnitCircleMap) = (2,)

applymap(m::UnitCircleMap{T}, t) where {T} = SVector(cos(2*T(pi)*t), sin(2*T(pi)*t))

function jacobian(m::UnitCircleMap{T}, t) where {T}
    a = 2*T(pi)
    SVector(-a*sin(a*t), a*cos(a*t))
end

# we know that the differential volume is 2*pi
diffvolume(m::UnitCircleMap{T}) where {T} = ConstantMap{T}(2*T(pi))

"""
`AngleMap` is a left inverse of `UnitCircleMap`. A 2D vector `x` is projected onto
the intersection point with the unit circle of the line connecting `x` to the
origin. The angle of this point, scaled to the interval `[0,1)`, is the result.
"""
struct AngleMap{T} <: Map{SVector{2,T}}
end

AngleMap() = AngleMap{Float64}()

function applymap(m::AngleMap{T}, x) where {T}
    twopi = 2*convert(T, pi)
    θ = atan(x[2],x[1])
    if θ < 0
        # atan2 returns an angle in (-π,π], convert to [0,2π) using periodicity.
        θ += twopi
    end
    # And divide by 2π to scale to [0,1)
    θ / twopi
end

mapsize(m::AngleMap) = (1,2)

function jacobian(m::AngleMap{T}, t) where {T}
    x = t[1]; y = t[2]
    twopi = 2*convert(T, pi)
    v = SVector(one(T) / (1+(y/x)^2) * (-y/x^2) * 1/twopi,
            one(T) / (1+(y/x)^2) * one(T)/x * 1/twopi)
    transpose(v)
end

leftinverse(m::UnitCircleMap{T}) where {T} = AngleMap{T}()
leftinverse(m::UnitCircleMap, x) = leftinverse(m)(x)
rightinverse(m::AngleMap{T}) where {T} = UnitCircleMap{T}()
rightinverse(m::AngleMap, x) = rightinverse(m)(x)

canonicaldomain(::Parameterization, d::UnitCircle{T}) where {T} = UnitInterval{T}()
mapfrom_canonical(::Parameterization, d::UnitCircle{T}) where {T} = UnitCircleMap{T}()

## The complex plane

const ComplexUnitCircle{T} = StaticUnitSphere{Complex{T}}
const ComplexUnitDisk{T,C} = StaticUnitBall{Complex{T},C}

ComplexUnitCircle() = ComplexUnitCircle{Float64}()
ComplexUnitDisk() = ComplexUnitDisk{Float64}()
ComplexUnitDisk{T}() where {T} = ComplexUnitDisk{T,:closed}()

show(io::IO, d::ComplexUnitCircle{Float64}) = print(io, "ComplexUnitCircle()")
show(io::IO, d::ComplexUnitDisk{Float64,:closed}) = print(io, "ComplexUnitDisk()")
show(io::IO, d::ComplexUnitDisk{Float64,:open}) = print(io, "ComplexUnitDisk()  (open)")
show(io::IO, d::ComplexUnitDisk{T,:closed}) where {T} = print(io, "ComplexUnitDisk{$(T)}()")
show(io::IO, d::ComplexUnitDisk{T,:open}) where {T} = print(io, "ComplexUnitDisk{$(T)}()  (open)")

canonicaldomain(::Parameterization, d::ComplexUnitCircle{T}) where {T} =
    UnitInterval{T}()
mapfrom_canonical(::Parameterization, d::ComplexUnitCircle{T}) where {T} =
    VectorToComplex{T}() ∘ UnitCircleMap{T}()


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2019 The Android Open Source Project

  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.
   -->

<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="installation_failed" msgid="863287960437940689">"ការដំឡើងមិនបានសម្រេចទេ។"</string>
    <string name="installation_cancelled" msgid="475402237100444685">"បានបោះបង់ការដំឡើង។"</string>
    <string name="installing_module" msgid="5968445461040787716">"កំពុងដំឡើងម៉ូឌុល៖"</string>
    <string name="progress" msgid="8366783942222789124">"ការវិវឌ្ឍ៖"</string>
    <string name="retry" msgid="1065327189183624288">"ព្យាយាមម្ដងទៀត"</string>
    <string name="ok" msgid="4702104660890557116">"យល់ព្រម"</string>
</resources>


text:
<?php
/**
 * PHP Implementation for ShipEngine API
 *
 * This file is subject to the terms and conditions defined in
 * file 'LICENSE.txt', which is found in the root folder of
 * this source code package.
 *
 * @author    John Hall
 */

namespace jsamhall\ShipEngine\Api;

use jsamhall\ShipEngine;

class RequestFactory
{
    /**
     * The base URL for the ShipEngine API
     *
     * @var string
     */
    private $apiUrl = "https://api.shipengine.com/v1/";

    /**
     * ShipEngine API Key
     *
     * @var string
     */
    protected $apiKey;

    /**
     * RequestFactory constructor.
     *
     * @param string $apiKey
     */
    public function __construct($apiKey)
    {
        $this->apiKey = $apiKey;
    }

    /**
     * Build a Request to the validateAddress API endpoint
     *
     * @link https://shipengine-docs.readme.io/reference#AddressValidation_ValidateAddresses
     *
     * @param array $addresses Array of addresses to validate
     * @return Request
     */
    public function validateAddresses(array $addresses)
    {
        $url = $this->buildUrl("addresses/validate");

        return $this->initRequest($url, [
            CURLOPT_POST       => true,
            CURLOPT_POSTFIELDS => json_encode($addresses)
        ]);
    }

    /**
     * Build a Request to the listCarriers API endpoint
     *
     * @link https://shipengine-docs.readme.io/reference#Carriers_List
     *
     * @return Request
     */
    public function listCarriers()
    {
        $url = $this->buildUrl("carriers");

        return $this->initRequest($url, [
            CURLOPT_HTTPGET => true
        ]);
    }

    /**
     * Build a Request to the getCarrier API endpoint
     *
     * @link https://shipengine-docs.readme.io/reference#Carriers_Get
     *
     * @param string $carrierId The CarrierId as found in the ShipEngine Account
     * @return Request
     */
    public function getCarrier(string $carrierId)
    {
        $endpoint = sprintf("carriers/%s", $carrierId);
        $url = $this->buildUrl($endpoint);

        return $this->initRequest($url, [
            CURLOPT_HTTPGET => true
        ]);
    }

    /**
     * Build a Request to the Carriers "ListServices" API endpoint
     *
     * @link https://shipengine-docs.readme.io/reference#Carriers_ListServices
     *
     * @param string $carrierId
     * @return Request
     */
    public function listCarrierServices(string $carrierId)
    {
        $endpoint = sprintf("carriers/%s/services", $carrierId);
        $url = $this->buildUrl($endpoint);

        return $this->initRequest($url, [
            CURLOPT_HTTPGET => true
        ]);
    }

    /**
     * Build a Request to the Carriers "ListPackages" API endpoint
     *
     * @link https://shipengine-docs.readme.io/reference#Carriers_ListPackages
     *
     * @param string $carrierId
     * @return Request
     */
    public function listCarrierPackageTypes(string $carrierId)
    {
        $endpoint = sprintf("carriers/%s/packages", $carrierId);
        $url = $this->buildUrl($endpoint);

        return $this->initRequest($url, [
            CURLOPT_HTTPGET => true
        ]);
    }

    /**
     * Build a Request to the Carriers "GetOptions" API endpoint
     *
     * @link https://shipengine-docs.readme.io/reference#Carriers_GetOptions
     *
     * @param string $carrierId
     * @return Request
     */
    public function getCarrierOptions(string $carrierId)
    {
        $endpoint = sprintf("carriers/%s/options", $carrierId);
        $url = $this->buildUrl($endpoint);

        return $this->initRequest($url, [
            CURLOPT_HTTPGET => true
        ]);
    }

    /**
     * Build a Request to the Rating "RateShipment" API endpoint
     *
     * @link https://shipengine-docs.readme.io/reference#Rates_RateShipment
     *
     * @param ShipEngine\Rating\Shipment $shipment
     * @param ShipEngine\Rating\Options $options
     * @return Request
     */
    public function getShipmentRates(ShipEngine\Rating\Shipment $shipment, ShipEngine\Rating\Options $options)
    {
        $url = $this->buildUrl('rates');

        return $this->initRequest($url, [
            CURLOPT_POST       => true,
            CURLOPT_POSTFIELDS => json_encode([
                'shipment'     => $shipment->toArray(),
                'rate_options' => $options->toArray()
            ])
        ]);
    }

    /**
     * Build a Request to the Labels "PurchaseLabel" Endpoint
     *
     * @link https://shipengine-docs.readme.io/reference#Labels_PurchaseLabel
     *
     * @param ShipEngine\Labels\Shipment $shipment
     * @param bool $testMode
     * @return Request
     */
    public function createLabel(
        ShipEngine\Labels\Shipment $shipment,
                                   $testMode = false
    ) {
        $url = $this->buildUrl('labels');

        return $this->initRequest($url, [
            CURLOPT_POST       => true,
            CURLOPT_POSTFIELDS => json_encode([
                'shipment'   => $shipment->toArray(),
                'test_label' => $testMode
            ])
        ]);
    }

    public function voidLabel(string $labelId)
    {
        $endpoint = sprintf("labels/%s/void", $labelId);
        $url = $this->buildUrl($endpoint);

        return $this->initRequest($url, [
            CURLOPT_PUT      => true
        ]);
    }

    /**
     * Initializes a cURL handle for a request to the ShipEngine API
     *
     * @param string $url Request URL or endpoint (e.g., /addresses/validate)
     * @param array $params Request Parameters
     * @return Request
     */
    private function initRequest(string $url, array $params = [])
    {
        $params = $params + [
                CURLOPT_URL            => $url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_HTTPHEADER     => [
                    "Content-Type: application/json",
                    "api-key: " . $this->apiKey
                ]
            ];

        return new Request($params);
    }

    /**
     * Builds a URL to the provided ShipEngine API endpoint
     *
     * @param string $endpoint
     * @return string The URL
     */
    private function buildUrl(string $endpoint)
    {
        return $this->apiUrl . $endpoint;
    }
}


text:
<!DOCTYPE html>

    <title>IndexDB Test: IDBCursor_update_exist</title>
    <link rel="author" title="Intel" href="http://www.intel.com" />
    <link rel="help" href="http://www.w3.org/TR/2011/WD-IndexedDB-20111206/#widl-IDBCursor-update-IDBRequest-any-value" />
    <meta name="flags" content="" />
    <meta name="assert" content="Check if IDBCursor has update() method" />


text:
package org.vitrivr.cineast.core.data.query.containers;

import com.fasterxml.jackson.databind.JsonNode;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.vitrivr.cineast.core.data.providers.primitive.PrimitiveTypeProvider;
import org.vitrivr.cineast.core.db.BooleanExpression;
import org.vitrivr.cineast.core.db.RelationalOperator;
import org.vitrivr.cineast.core.util.web.DataURLParser;

public class BooleanQueryTermContainer extends AbstractQueryTermContainer {

  private static final String ATTRIBUTE_FIELD_NAME = "attribute";
  private static final String OPERATOR_FIELD_NAME = "operator";
  private static final String VALUES_FIELD_NAME = "values";

  private static final Logger LOGGER = LogManager.getLogger();

  private ArrayList<BooleanExpression> expressions = new ArrayList<>();

  public BooleanQueryTermContainer(Collection<BooleanExpression> expressions) {
    this.expressions.addAll(expressions);
  }

  public BooleanQueryTermContainer(String data) {
    this(DataURLParser.dataURLtoJsonNode(data).orElseThrow(() -> new IllegalArgumentException("Failed to parse the provided Boolean expression data.")));
  }

  public BooleanQueryTermContainer(JsonNode json) {
    if (!json.isArray()) {
      throw new IllegalArgumentException("Boolean expression data is not a list");
    }

    Iterator<JsonNode> iter = json.elements();
    while (iter.hasNext()) {
      JsonNode element = iter.next();

      if (!element.has(ATTRIBUTE_FIELD_NAME)) {
        LOGGER.error(
            "No '{}' field present in Boolean expression '{}', skipping",
            ATTRIBUTE_FIELD_NAME,
            element.toString());
        continue;
      }

      if (!element.has(OPERATOR_FIELD_NAME)) {
        LOGGER.error(
            "No '{}' field present in Boolean expression '{}', skipping",
            OPERATOR_FIELD_NAME,
            element.toString());
        continue;
      }

      String attribute = element.get(ATTRIBUTE_FIELD_NAME).asText();
      RelationalOperator operator =
          RelationalOperator.valueOf(element.get(OPERATOR_FIELD_NAME).asText());
      List<PrimitiveTypeProvider> values = new ArrayList<>();

      if (element.has(VALUES_FIELD_NAME)) {
        if (element.get(VALUES_FIELD_NAME).isArray()) {
          Iterator<JsonNode> elementIter = element.get(VALUES_FIELD_NAME).elements();
          while (elementIter.hasNext()) {
            values.add(PrimitiveTypeProvider.fromJSON(elementIter.next()));
          }
        } else {
          values.add(PrimitiveTypeProvider.fromJSON(element.get(VALUES_FIELD_NAME)));
        }
      }

      this.expressions.add(new BooleanExpression(attribute, operator, values));

    }
  }

  @Override
  public List<BooleanExpression> getBooleanExpressions() {
    return this.expressions;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    if (!super.equals(o)) {
      return false;
    }
    BooleanQueryTermContainer that = (BooleanQueryTermContainer) o;
    return Objects.equals(expressions, that.expressions);
  }

  @Override
  public int hashCode() {
    return Objects.hash(super.hashCode(), expressions);
  }
}


text:
package com.lee.java.inherit;

/**
 * Inherit Inner Class
 * <p/>
 * Created by LiYang on 2016/11/28.
 */
public class InheritInnerClass extends InheritOuterClass.Inner {

    public InheritInnerClass(InheritOuterClass outerClass) {
        outerClass.super();
    }

}


text:
'use strict';

angular.module('Authentication')

.controller('LoginController',
    ['$scope', '$rootScope', '$location', '$state', '$http', 'ENV', 'AuthenticationService',
    function ($scope, $rootScope, $location, $state, $http, ENV, AuthenticationService) {
        $rootScope.usuario = null;
        $scope.avatar = "";

        // reset login status
        AuthenticationService.ClearCredentials();

        $scope.login = function () {
            $scope.dataLoading = true;
            AuthenticationService.Login($scope.usuario, $scope.senha, function(data, success) {
                if(success) {
                    AuthenticationService.SetCredentials(data);
                    if (data.grupos.includes('desenvolvedores')) {
                        $state.go('desenvolvimento.evolucao');
                    } else if (data.grupos.includes('equipe-suporte')) {
                        $state.go('suporte.evolucao');
                    } else if (data.grupos.includes('comercial')) {
                        $state.go('comercial.oportunidades');
                    } else if (data.grupos.includes('continuous-delivery')) {
                        $state.go('integracao-continua.builds');
                    } else if (data.grupos.includes('administrativo')) {
                        $state.go('financeiro.evolucao');
                    } else {
                        $state.go('desenvolvimento.evolucao');
                    }
                } else {
                    $scope.error = "Usuário ou Senha Inválidos";
                    $scope.dataLoading = false;
                }
            });
        };

        $scope.buscarAvatar = function() {
            if($scope.usuario != null) {
                $http.get(ENV.API_ENDPOINT + '/getAvatar', {
                    params: {
                        usuario: $scope.usuario
                    }
                }).then(
                    function (response) {
                        $scope.avatar = response.data.avatar;
                    },
                    function (response) {
                        console.log("ERRO ao buscar avatar", response);
                    }
                );
            } else {
                $scope.avatar = "";
            }
        }
    }]);


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

<title>Debugging with GDB: Guile Modules</title>

<meta name="description" content="Debugging with GDB: Guile Modules">
<meta name="keywords" content="Debugging with GDB: Guile Modules">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Guile.html#Guile" rel="up" title="Guile">
<link href="Guile-Printing-Module.html#Guile-Printing-Module" rel="next" title="Guile Printing Module">
<link href="Guile-Auto_002dloading.html#Guile-Auto_002dloading" rel="prev" title="Guile Auto-loading">

Previous: Guile Auto-loading, Up: Guile   [Contents][Index]

23.3.5 Guile Modules

GDB comes with several modules to assist writing Guile code.

• Guile Printing Module:	  	Building and registering pretty-printers

• Guile Types Module:	  	Utilities for working with types


text:
class TIES::Teachers < TIES::Base
  attr_accessor :total_pages, :total_count
  def initialize(ties)
    @ties = ties
  end
  def get(page = 1, options = {})
    result = @ties.send_request('Staff/Teachers/%i' % page, options)
    return [] unless result
    self.total_pages = result['TotalPages']
    self.total_count = result['TotalCount']
    return result['Return']
  end
end


text:
package com.orionplatform.data.data_structures.stack;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Stack;
import java.util.stream.IntStream;
import com.orionplatform.core.object.CloningService;
import com.orionplatform.data.data_structures.DataStructure;
import com.orionplatform.data.data_structures.DataStructureRules;
import com.orionplatform.data.data_structures.DataStructureService;
import com.orionplatform.data.data_structures.SingleArgumentDataStructure;
import com.orionplatform.data.data_structures.list.OrionList;
import com.orionplatform.data.data_structures.list.type.OrionUnmodifiableArrayList;

@SuppressWarnings("serial")
public class OrionStack<T> extends Stack<T> implements OrionList<T>
{
    public OrionStack()
    {
        super();
    }

    public OrionStack(Enumeration<T> enumeration)
    {
        this(enumeration.asIterator());
    }

    public OrionStack(Iterator<T> iterator)
    {
        this(DataStructureService.getIteratorAsList(iterator));
    }

    public OrionStack(Collection<T> elements)
    {
        super();
        DataStructureRules.isNotEmpty(elements);
        List<T> temp = new ArrayList<T>(elements);
        IntStream.range(0, elements.size()).forEach(i -> push(temp.get(i)));
    }

    public OrionStack(SingleArgumentDataStructure<T> elements)
    {
        super();
        DataStructureRules.isNotEmpty((DataStructure)elements);
        List<T> temp = elements.getAsList();
        IntStream.range(0, elements.getSize()).forEach(i -> push(temp.get(i)));
    }

    public static synchronized <T> OrionStack<T> of()
    {
        return new OrionStack<T>();
    }

    public static synchronized <T> OrionStack<T> of(Collection<T> elements)
    {
        return new OrionStack<T>(elements);
    }

    public static synchronized <T> OrionStack<T> of(Enumeration<T> enumeration)
    {
        return new OrionStack<T>(enumeration);
    }

    public static synchronized <T> OrionStack<T> of(Iterator<T> iterator)
    {
        return new OrionStack<T>(iterator);
    }

    public static synchronized <T> OrionStack<T> of(SingleArgumentDataStructure<T> elements)
    {
        return new OrionStack<T>(elements);
    }

    public int getElementIndexDistanceFromFirstElement(T element)
    {
        return search(element);
    }

    @Override
    public OrionStack<T>[] split(int numberOfSubstructures)
    {
        return splitStackIntoSubstacks(numberOfSubstructures);
    }

    @Override
    public OrionStack<T>[] splitGET(int numberOfSubstructures)
    {
        return getCopy().split(numberOfSubstructures);
    }

    @SuppressWarnings("unchecked")
    public OrionStack<T>[] splitStackIntoSubstacks(int numberOfSubstacks)
    {
        DataStructureRules.isNotEmpty(getSize());
        OrionList<T>[] sublists = ((OrionList<T>)this).split(numberOfSubstacks);
        OrionStack<T>[] substacks = new OrionStack[numberOfSubstacks];
        IntStream.range(0, sublists.length).forEach(i -> substacks[i] = OrionStack.<T>of(sublists[i]));
        return substacks;
    }

    @Override
    public OrionList<T> getSublistAsOrionList(int startIndex, int endIndex)
    {
        return ((OrionList<T>)this).getSublistAsOrionList(startIndex, endIndex);
    }

    public OrionList<T> getSubstackAsOrionList(int startIndex, int endIndex)
    {
        return getSublistAsOrionList(startIndex, endIndex);
    }

    @Override
    public OrionList<T> getSublistInclusiveAsOrionList(int startIndex, int endIndex)
    {
        return ((OrionList<T>)this).getSublistInclusiveAsOrionList(startIndex, endIndex);
    }

    public OrionList<T> getSubstackInclusiveAsOrionList(int startIndex, int endIndex)
    {
        return getSublistInclusiveAsOrionList(startIndex, endIndex);
    }

    @Override
    public void reduceCapacityToMatchSize()
    {
        trimToSize();
    }

    @Override
    public OrionList<T> getAsUnmodifiableOrionList()
    {
        return OrionUnmodifiableArrayList.<T>of(getAsUnmodifiableList());
    }

    @Override
    public synchronized int hashCode()
    {
        return super.hashCode();
    }

    @Override
    public synchronized boolean equals(Object object)
    {
        return super.equals(object);
    }

    @SuppressWarnings("unchecked")
    @Override
    public synchronized OrionStack<T> clone()
    {
        return (OrionStack<T>)CloningService.clone(this);
    }

    @SuppressWarnings("unchecked")
    public OrionStack<T> cloneIgnoreUnserialisableException()
    {
        return (OrionStack<T>)CloningService.cloneIgnoreUnserialisableException(this);
    }

    @Override
    public OrionStack<T> getCopy()
    {
        return this.clone();
    }

    @Override
    public OrionStack<T> getCopyIgnoreUnserialisableException()
    {
        return this.cloneIgnoreUnserialisableException();
    }
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const beautylog = require("beautylog");
exports.beautylog = beautylog;
const tsclass = require("tsclass");
exports.tsclass = tsclass;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnRzLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9idHMucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHVDQUFzQztBQUlwQyw4QkFBUztBQUhYLG1DQUFrQztBQUloQywwQkFBTyJ9


text:
package org.locationtech.geowave.core.store.query.filter.expression.text;

import java.util.List;
import java.util.Map;
import java.util.Set;
import org.locationtech.geowave.core.index.persist.Persistable;
import org.locationtech.geowave.core.index.persist.PersistenceUtils;
import org.locationtech.geowave.core.store.api.DataTypeAdapter;

/**
 * An expression that concatenates two text expressions into a single text expression.
 */
public class Concat implements TextExpression {

  private TextExpression expression1;
  private TextExpression expression2;

  public Concat() {}

  public Concat(final TextExpression expr1, final TextExpression expr2) {
    expression1 = expr1;
    expression2 = expr2;
  }

  public TextExpression getExpression1() {
    return expression1;
  }

  public TextExpression getExpression2() {
    return expression2;
  }

  @Override
  public void addReferencedFields(final Set<String> fields) {
    expression1.addReferencedFields(fields);
    expression2.addReferencedFields(fields);
  }

  @Override
  public boolean isLiteral() {
    return expression1.isLiteral() && expression2.isLiteral();
  }

  @Override
  public String evaluateValue(final Map<String, Object> fieldValues) {
    final String value1 = expression1.evaluateValue(fieldValues);
    final String value2 = expression2.evaluateValue(fieldValues);
    if (value1 == null) {
      return value2;
    }
    if (value2 == null) {
      return value1;
    }
    return value1.concat(value2);
  }

  @Override
  public <T> String evaluateValue(final DataTypeAdapter<T> adapter, final T entry) {
    final String value1 = expression1.evaluateValue(adapter, entry);
    final String value2 = expression2.evaluateValue(adapter, entry);
    if (value1 == null) {
      return value2;
    }
    if (value2 == null) {
      return value1;
    }
    return value1.concat(value2);
  }

  @Override
  public String toString() {
    final StringBuilder sb = new StringBuilder("concat(");
    sb.append(expression1.toString());
    sb.append(",");
    sb.append(expression2.toString());
    sb.append(")");
    return sb.toString();
  }

  @Override
  public byte[] toBinary() {
    return PersistenceUtils.toBinary(new Persistable[] {expression1, expression2});
  }

  @Override
  public void fromBinary(final byte[] bytes) {
    final List<Persistable> expressions = PersistenceUtils.fromBinaryAsList(bytes);
    expression1 = (TextExpression) expressions.get(0);
    expression2 = (TextExpression) expressions.get(1);
  }

}


text:
module FontLeague
  module Rails
    VERSION = "1.0.0"
  end
end


text:
<?php
if (isset($league) && !empty($league)) {
    foreach ($league as $league_row) {
        ?>

                    <a href="#" data-toggle="modal" data-target="#league1post" data-title="<?php echo $league_row['name'] ?>" data-image="<?php echo DEFAULT_LEAGUE_IMAGE_PATH . $league_row['league_image'] ?>" data-user="<?php echo $league_row['created_user'] ?>" data-uimage="<?php echo DEFAULT_PROFILE_IMAGE_PATH . $league_row['user_image'] ?>">
                        <img src="<?php echo DEFAULT_LEAGUE_IMAGE_PATH . $league_row['league_image'] ?>" class="img-responsive center-block">

                        <img src="<?php echo DEFAULT_LEAGUE_IMAGE_PATH . $league_row['league_logo'] ?>" class="img-responsive center-block league_logo">

<?php echo $league_row['total_user'] ?>/<?php echo $league_row['user_limit'] ?> users

<?php echo $league_row['name'] ?>

<?php echo $league_row['introduction'] ?>

<a href="javascript:;" class="requirements" data-requirement="<?php echo $league_row['requirements'] ?>"><?php echo lang('Requirement') ?>

<?php echo lang('Achieve'); ?>

<a href="league/apply/<?php echo $league_row['id'] ?>"><?php echo lang('Apply'); ?>

Achieve

                                    <img src="<?php echo DEFAULT_IMAGE_PATH; ?>challenge-prfl.jpg" class="img-responsive center-block ">

                                        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.

                                    <img src="<?php echo DEFAULT_IMAGE_PATH; ?>grp_pln_img4.jpg">

<img src="<?php echo DEFAULT_IMAGE_PATH; ?>coin_icon.png">
 10

                                                <img src="<?php echo DEFAULT_IMAGE_PATH; ?>like_img.png">
20 Likes

<img src="<?php echo DEFAULT_IMAGE_PATH; ?>comment_icon.png">
 Comments

 Comment Here

                                        <textarea class="form-control" rows="3" id="textArea"></textarea>

                                                        <img src="<?php echo DEFAULT_IMAGE_PATH; ?>likeimg.jpg" class="img-responsive">

John Doe Interesting

Like

Reply

- 10 October at 22:18

World Wide Web warned on Saturday that the freedom of the internet is under threat by governments

                                                        <img src="<?php echo DEFAULT_IMAGE_PATH; ?>likeimg.jpg" class="img-responsive">

John Doe Interesting

Like

Reply

- 10 October at 22:18

World Wide Web warned on Saturday that the freedom of the internet is under threat by governments

        <?php
    }
}
?>


text:
<?xml version="1.0"?>
<package format="2">
  <name>kuka_experimental</name>
  <version>0.1.0</version>
  <description>Experimental packages for KUKA manipulators within ROS-Industrial.</description>
  <maintainer email="sedwards@swri.org">Shaun Edwards</maintainer>
  <maintainer email="g.a.vanderhoorn@tudelft.nl">G.A. vd. Hoorn (TU Delft Robotics Institute)</maintainer>
  <author email="sedwards@swri.org">Shaun Edwards</author>
  <license>BSD</license>

  <url type="website">http://ros.org/wiki/kuka_experimental</url>
  <url type="bugtracker">https://github.com/ros-industrial/kuka_experimental/issues</url>
  <url type="repository">https://github.com/ros-industrial/kuka_experimental</url>

  <buildtool_depend>catkin</buildtool_depend>

  <exec_depend>kuka_kr120_support</exec_depend>
  <exec_depend>kuka_kr16_support</exec_depend>
  <exec_depend>kuka_kr210_support</exec_depend>
  <exec_depend>kuka_lbr_iiwa_support</exec_depend>
  <exec_depend>kuka_resources</exec_depend>
  <exec_depend>kuka_rsi_hw_interface</exec_depend>
  <exec_depend>kuka_rsi_simulator</exec_depend>

  <export>
    <metapackage/>
  </export>
</package>


text:
/*
 * Clarify.PCL
 *
 * This file was automatically generated by APIMATIC BETA v2.0 on 10/06/2014
 */
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Clarify.PCL;

namespace Clarify.PCL.Models
{
    public class Link3Model : INotifyPropertyChanged
    {
        // These fields hold the values for the public properties.
        private string self;
        private string curies;
        private string parent;
        private string clarifyBundle;

        /// <summary>
        /// TODO: Write general description for this method
        /// </summary>
        [JsonProperty("self")]
        public string Self
        {
            get
            {
                return this.self;
            }
            set
            {
                this.self = value;
                onPropertyChanged("Self");
            }
        }

        /// <summary>
        /// TODO: Write general description for this method
        /// </summary>
        [JsonProperty("curies")]
        public string Curies
        {
            get
            {
                return this.curies;
            }
            set
            {
                this.curies = value;
                onPropertyChanged("Curies");
            }
        }

        /// <summary>
        /// TODO: Write general description for this method
        /// </summary>
        [JsonProperty("parent")]
        public string Parent
        {
            get
            {
                return this.parent;
            }
            set
            {
                this.parent = value;
                onPropertyChanged("Parent");
            }
        }

        /// <summary>
        /// TODO: Write general description for this method
        /// </summary>
        [JsonProperty("clarify:bundle")]
        public string ClarifyBundle
        {
            get
            {
                return this.clarifyBundle;
            }
            set
            {
                this.clarifyBundle = value;
                onPropertyChanged("ClarifyBundle");
            }
        }

        /// <summary>
        /// Property changed event for observer pattern
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Raises event when a property is changed
        /// </summary>
        /// <param name="propertyName">Name of the changed property</param>
        protected void onPropertyChanged(String propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}


text:
function mpcu = mpcu_parseJD(logfile)
% Parse a Siemens MPCU log file
%
% USAGE: mpcu = mpcu_parse(logfile)
%
% ARGS:
% logfile = filename of log file to parse
%
% RETURNS:
% mpcu = results structure
% .mode = physio mode (eg 'ecg')
% .waveform = sampled physio waveform (AU)
% .t = time vector (seconds)
% .dt = sampling dwell time (seconds)
% .trigger_idx = indices of on rhythm triggers
% .trigger = times of on-rhythm triggers
%
% VERSION : 2.0
%
% AUTHORS : Mike Tyszka, Ph.D. and Julien Dubois, Ph.D.
% PLACE   : Caltech
% DATES   : 06/30/2010 JMT From Siemens documentation
%           03/10/2011 JMT Update for function use
%           05/06/2011 JMT Correct preamble handling for ecg
%           05/08/2013 JMT Further generalization of ECG preamble
%                          New trigger handling with calibration
%           02/04/2016 JD  changed preamble handling
%
% The MIT License (MIT)
%
% Copyright (c) 2016 Mike Tyszka
%
%   Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
%   documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
%   rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
%   permit persons to whom the Software is furnished to do so, subject to the following conditions:
%
%   The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
%   Software.
%
%   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
%   WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
%   COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
%   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

% Catch no arguments
if nargin < 1
  fprintf('USAGE: [d,t] = mpcu_parse(logname)\n');
  return
end

% Determine mode from file extension
[~, ~, mode] = fileparts(logfile);
mode(1) = [];

% Open selected file
fd = fopen(logfile,'r');
if fd < 0
  fprintf('Problem opening log file to read\n');
  return
end
% get first line
l=fgetl(fd);
lorig=l;
% close file
fclose(fd);

% find 5002 & 6002 (beginning/end logging message)
while 1
    startMsg=strfind(l,'5002 ');
    endMsg=strfind(l,' 6002 ');
    if isempty(startMsg) || isempty(endMsg),
        break
    end
    endMsg=endMsg+6;
    l = [l(1:startMsg(1)-1) l(endMsg(1):end)];
end

% read data stream
data = textscan(l, '%d');
data=data{1};

% chop final point (5003)
data(end) = [];

switch mode
    case 'ecg'
        % chop first 5
        data(1:5)=[];
    otherwise
        % chop first 4
        data(1:4)=[];
end

% Find MPCU detected on- and off-rhythm trigger marks
trigger_on_idx = find(data == 5000);
trigger_off_idx = find(data == 6000);

% Remove trigger marks from waveform
data(trigger_on_idx) = [];
data(trigger_off_idx) = [];

% Adjust mark indices to account for removal
trigger_on_idx = trigger_on_idx - (1:length(trigger_on_idx))';
trigger_off_idx = trigger_off_idx - (1:length(trigger_off_idx))';

% Sampling intervals (dwell times) for each channel in seconds
% Rates determined empirically against known timings
switch mode
    case {'ecg'}
        foundat=strfind(lorig,'ECG_SAMPLE_INTERVAL = ');
        if ~isempty(foundat),
            thisl=lorig((foundat+22):end);
            dt=textscan(thisl,'%d',1);
            mpcu.dt=double(dt{1})*1e-6;
        else
            mpcu.dt = 1.25e-3;
        end
  case {'ext'}
      foundat=strfind(lorig,'EXT_SAMPLE_INTERVAL = ');
      if ~isempty(foundat),
            thisl=lorig((foundat+22):end);
            dt=textscan(thisl,'%d',1);
            mpcu.dt=double(dt{1})*1e-6;
      else
          mpcu.dt = 5e-3;
      end
  case 'puls'
      foundat=strfind(lorig,'PULS_SAMPLE_INTERVAL = ');
      if ~isempty(foundat),
            thisl=lorig((foundat+23):end);
            dt=textscan(thisl,'%d',1);
            mpcu.dt=double(dt{1})*1e-6;
      else
          mpcu.dt = 20e-3;
      end
  case 'resp'
      foundat=strfind(lorig,'RESP_SAMPLE_INTERVAL = ');
      if ~isempty(foundat),
          thisl=lorig((foundat+23):end);
          dt=textscan(thisl,'%d',1);
          mpcu.dt=double(dt{1})*1e-6;
      else
          mpcu.dt = 20e-3;
      end
  otherwise
      mpcu.dt = 1;
end

fprintf('%s: Sampling period is %.6fs\n',mode,mpcu.dt);

% Time vector in seconds
mpcu.n = length(data);
mpcu.t = ((1:mpcu.n) - 1)' * mpcu.dt;

% Calibrate triggers in seconds after first sample
mpcu.trigger_on_idx  = trigger_on_idx;
mpcu.trigger_on      = trigger_on_idx * mpcu.dt;
mpcu.trigger_off_idx  = trigger_off_idx;
mpcu.trigger_off      = trigger_off_idx * mpcu.dt;

% Calculate median on-rhythm trigger interval (in seconds) and rate (Hz)
mpcu.trigger_interval = median(diff(mpcu.trigger_on));

% Save waveform
mpcu.mode = mode;
mpcu.data = data;


text:
package mixr.ui;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
import mixr.MixR;
import mixr.components.MixRDriver;
import mixr.components.Reasoner;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerUtils;
import org.openide.explorer.view.ListView;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.util.Lookup;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.NbBundle.Messages;
import org.openide.util.lookup.Lookups;
import org.openide.windows.TopComponent;

/**
 * Top component which displays something.
 */
@ConvertAsProperties(dtd = "-//mixr.ui//ReasonersList//EN",
autostore = false)
@TopComponent.Description(preferredID = "ReasonersListTopComponent",
//iconBase="SET/PATH/TO/ICON/HERE",
persistenceType = TopComponent.PERSISTENCE_ALWAYS)
@TopComponent.Registration(mode = "navigator", openAtStartup = true)
@ActionID(category = "Window", id = "mixr.ui.ReasonersListTopComponent")
@ActionReference(path = "Menu/Window/MixR", position = 2000)
@TopComponent.OpenActionRegistration(displayName = "#CTL_ReasonersListAction",
preferredID = "ReasonersListTopComponent")
@Messages({
    "CTL_ReasonersListAction=MixR Drivers",
    "CTL_ReasonersListTopComponent=MixR Drivers",
    "HINT_ReasonersListTopComponent=This is a list of all MixR drivers (reasoners, presenters, etc.)."
})
public final class ReasonersListTopComponent extends TopComponent implements ExplorerManager.Provider {

    // <editor-fold defaultstate="collapsed" desc="Fields">
    private ExplorerManager em;
    private Lookup lookup;
    // </editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Constructor">
    public ReasonersListTopComponent() {
        initComponents();
        setName(Bundle.CTL_ReasonersListTopComponent());
        setToolTipText(Bundle.HINT_ReasonersListTopComponent());

        this.em = new ExplorerManager();
        ActionMap map = this.getActionMap();
        InputMap keys = this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        this.lookup = ExplorerUtils.createLookup(this.em, map);
        this.associateLookup(this.lookup);

        Children children = new ComponentsRootNode();
        Node root = new AbstractNode(children);
        this.em.setRootContext(root);
        this.em.getRootContext().setDisplayName("MixRReasonersList");

        // The list of reasoners does not need to display icons.
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Generated Code">
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        reasonersList = new ListView();

        setLayout(new java.awt.BorderLayout());
        add(reasonersList, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane reasonersList;
    // End of variables declaration//GEN-END:variables
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Overrides">
    @Override
    public void componentOpened() {
        // TODO add custom code on component opening
    }

    @Override
    public void componentClosed() {
        // TODO add custom code on component closing
    }

    @Override
    public ExplorerManager getExplorerManager() {
        return em;
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Property Handling">
    void writeProperties(java.util.Properties p) {
        // better to version settings since initial version as advocated at
        // http://wiki.apidesign.org/wiki/PropertyFiles
        p.setProperty("version", "1.0");
        // TODO store your settings
    }

    void readProperties(java.util.Properties p) {
        String version = p.getProperty("version");
        // TODO read your settings according to their version
    }
    //</editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Explorer Nodes">
    private static class ReasonersNode extends ComponentNode {

        public ReasonersNode(Reasoner reasoner) {
            super(reasoner);
        }
    }

    private static class ComponentNode extends AbstractNode implements Comparable<ComponentNode> {

        private MixRDriver component;

        public MixRDriver getComponent() {
            return component;
        }

        @Messages({
            "ComponentNode_component_null=The component must not be null."
        })
        public ComponentNode(MixRDriver component) {
            super(Children.LEAF, Lookups.singleton(component));
            if (component == null) {
                throw new IllegalArgumentException(Bundle.ComponentNode_component_null());
            }
            this.component = component;
            setName(component.toString());
            setDisplayName(component.getName());
        }

        @Override
        public int compareTo(ComponentNode o) {
            return getComponent().getName().compareToIgnoreCase(o.getComponent().getName());
        }
    }

    private static class ComponentsRootNode extends Children.Array {

        private Lookup.Result<MixRDriver> reasonersLookupResult;

        public ComponentsRootNode() {
            MixR mixr = Lookup.getDefault().lookup(MixR.class);
            reasonersLookupResult = mixr.getLookup().lookupResult(MixRDriver.class);
            reasonersLookupResult.addLookupListener(new LookupListener() {
                @Override
                public void resultChanged(LookupEvent ev) {
                    updateReasonersList();
                }
            });
        }

        @Override
        protected Collection<Node> initCollection() {
            Collection<? extends MixRDriver> allReasoners = reasonersLookupResult.allInstances();

            ArrayList<Node> reasonerNodes = new ArrayList<>();
            if (allReasoners != null) {
                for (MixRDriver reasoner : allReasoners) {
                    if (reasoner instanceof Reasoner) {
                        Reasoner r = (Reasoner) reasoner;
                        reasonerNodes.add(new ReasonersNode(r));
                    } else {
                        reasonerNodes.add(new ComponentNode(reasoner));
                    }
                }
            }
            Collections.sort(reasonerNodes, new Comparator<Node>() {
                @Override
                public int compare(Node o1, Node o2) {
                    return ((ComponentNode) o1).compareTo((ComponentNode) o2);
                }
            });
            return reasonerNodes;
        }

        private void updateReasonersList() {
            remove(getNodes());
            add(initCollection().toArray(new ReasonersNode[0]));
        }
    }
    // </editor-fold>
}


text:
class Archive < ActiveRecord::Migration[5.1]
  def change
    add_column :bookmarks, :archived, :boolean

    add_index(:bookmarks, :archived)
  end
end


text:
layout: ja/programja
color: fill-midnight
color: dark-nav
---
{% case page.room %}
{% when 'a' %}
{% assign room = 'Auditorium A' %}
{% when 'b' %}
{% assign room = 'Auditorium C' %}
{% else %}
{% assign room = page.room %}
{% endcase %}

{% if page.tags contains 'turn1' %}
{% assign time = 'Friday 10:30am' %}
{% elsif page.tags contains 'turn2' %}
{% assign time = 'Friday 11:00am' %}
{% elsif page.tags contains 'turn3' %}
{% assign time = 'Friday 12:00am' %}
{% elsif page.tags contains 'turn4' %}
{% assign time = 'Friday 12:30pm' %}
{% elsif page.tags contains 'turn5' %}
{% assign time = 'Friday 2:10pm' %}
{% elsif page.tags contains 'turn6' %}
{% assign time = 'Friday 2:40pm' %}
{% elsif page.tags contains 'turn7' %}
{% assign time = 'Friday 3:10pm' %}
{% elsif page.tags contains 'turn8' %}
{% assign time = 'Friday 4:10pm' %}
{% elsif page.tags contains 'turn9' %}
{% assign time = 'Friday 4:40pm' %}
{% elsif page.tags contains 'turn10' %}
{% assign time = 'Friday 5:10pm' %}
{% elsif page.tags contains 'turn11' %}
{% assign time = 'Saturday 9:30pm' %}
{% elsif page.tags contains 'turn12' %}
{% assign time = 'Saturday 10:00am' %}
{% elsif page.tags contains 'turn13' %}
{% assign time = 'Saturday 10:30am' %}
{% elsif page.tags contains 'turn14' %}
{% assign time = 'Saturday 11:30am' %}
{% elsif page.tags contains 'turn15' %}
{% assign time = 'Saturday 12:00am' %}
{% elsif page.tags contains 'turn16' %}
{% assign time = 'Saturday 12:30pm' %}
{% elsif page.tags contains 'turn17' %}
{% assign time = 'Saturday 2:00pm' %}
{% elsif page.tags contains 'turn18' %}
{% assign time = 'Saturday 2:30pm' %}
{% elsif page.tags contains 'turn19' %}
{% assign time = 'Saturday 3:00pm' %}
{% elsif page.tags contains 'turn20' %}
{% assign time = 'Saturday 4:00pm' %}
{% elsif page.tags contains 'turn21' %}
{% assign time = 'Saturday 4:30pm' %}
{% elsif page.tags contains 'turn22' %}
{% assign time = 'Sunday 9:30am' %}
{% elsif page.tags contains 'turn23' %}
{% assign time = 'Sunday 11:15am' %}
{% elsif page.tags contains 'turn24' %}
{% assign time = 'Sunday 1:30pm' %}
{% elsif page.tags contains 'turn25' %}
{% assign time = 'Sunday 3:15pm' %}
{% elsif page.time contains 'friday' %}
{% assign time = 'Friday Lightning talk' %}
{% elsif page.time contains 'sunday' %}
{% assign time = 'Sunday Lightning talk' %}
{% endif %}

{% if page.tags contains 'turn22' %}
{% assign length = '75min' %}
{% elsif page.tags contains 'turn23' %}
{% assign length = '75min' %}
{% elsif page.tags contains 'turn24' %}
{% assign length = '75min' %}
{% elsif page.tags contains 'turn25' %}
{% assign length = '75min' %}
{% else %}
{% assign length = '30min' %}
{% endif %}

{{page.title}}

        {{time}}, {{room}}
        {% unless page.category == 'lightningja' %}

           Theme:

          • {{page.theme}}

          Audience:

          • {{page.audience}}

        {% endunless %}

{{page.name}}
               {{ length }}

            {% if page.twitter %}

              {{page.twitter}}
            {% endif %}
            {% if page.osm %}

              {{page.osm}}
            {% endif %}

            {% if page.role %}{{page.role}}{% endif %}
            {% if page.organization %}{{page.organization}}{% endif %}

        {% if page.youtube_recording %}

          {% if page.youtube_time %}{% assign youtube_second = page.youtube_time[0] | times:60 | plus:page.youtube_time[1] %}{% endif %}

        {% endif %}
        {% if page.slides %}

            スライドを新しいタブで開く

        {% endif %}

          {{content}}

      {% if page.category == 'lightningja' %}
        Back to lightning talks

      {% else %}
        Back to program
      {% endif %}


text:
package org.wregen.spells;

import java.util.ArrayList;

import org.wregen.spells.entity.Spell;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

/**
 * AlphabeticListFragment
 */
public class AlphabeticListFragment extends Fragment {
    private ListView mListview;
    private SpellAdapter mAdapter;
    private Database mDb;

    /**
     * Returns a new instance of this fragment for the given section number.
     */
    public static AlphabeticListFragment newInstance(int sectionNumber) {
        AlphabeticListFragment fragment = new AlphabeticListFragment();
        return fragment;
    }

    public AlphabeticListFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRetainInstance(true);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_alphabeticallist, container, false);
        mDb = new Database(getActivity());
        final ArrayList<Spell> data = mDb.getAllSpells();
        mAdapter = new SpellAdapter(getActivity(), data);
        mListview = (ListView)rootView.findViewById(R.id.spellList);
        mListview.setAdapter(mAdapter);
        mListview.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> listView, View view, int position, long id) {
                FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
                FragmentTransaction transaction = fragmentManager.beginTransaction();

                transaction.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);

                transaction.replace(R.id.container, ViewPagerFragment.newInstance(position, data));

                transaction.addToBackStack(null);
                transaction.commit();
            }

        });

        return rootView;
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
//        ((Main)activity).onSectionAttached(
//                getArguments().getInt(ARG_SECTION_NUMBER));

    }

}


text:
package io.bootique.metrics.health.check;

import io.bootique.metrics.health.HealthCheckStatus;
import org.junit.jupiter.api.Test;

import java.util.function.Supplier;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

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

public class ValueRangeCheckTest {

    @Test
    public void testCheck() {

        Supplier<Integer> supplier = mock(Supplier.class);
        when(supplier.get()).thenReturn(-1, 0, 5, 6, 9, 12);

        ValueRange<Integer> range = ValueRange.create(0, 5, 8, 10);

        ValueRangeCheck<Integer> check = new ValueRangeCheck<>(range, supplier);

        assertEquals(HealthCheckStatus.UNKNOWN, check.check().getStatus());
        assertEquals(HealthCheckStatus.OK, check.check().getStatus());
        assertEquals(HealthCheckStatus.WARNING, check.check().getStatus());
        assertEquals(HealthCheckStatus.WARNING, check.check().getStatus());
        assertEquals(HealthCheckStatus.CRITICAL, check.check().getStatus());
        assertEquals(HealthCheckStatus.CRITICAL, check.check().getStatus());
    }
}