text:
package org.oscm.billingservice.dao.model;

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

import java.math.BigDecimal;

import org.junit.Test;

import org.oscm.billingservice.dao.model.VatRateDetails;

/**
 * Test for the VAT rate details object.
 *
 * @author Mike Jäger
 *
 */
public class VatRateDetailsTest {

    @Test
    public void testGetEffectiveVatRateForCustomer_NullInput() {
        VatRateDetails vrd = createVRD(null, null, null);
        BigDecimal result = vrd.getEffectiveVatRateForCustomer();
        assertNull(result);
    }

    @Test
    public void testGetEffectiveVatRateForCustomer_OnlyDefault() {
        VatRateDetails vrd = createVRD(BigDecimal.valueOf(12), null, null);
        BigDecimal result = vrd.getEffectiveVatRateForCustomer();
        assertEquals(BigDecimal.valueOf(12), result);
    }

    @Test
    public void testGetEffectiveVatRateForCustomer_OnlyCountry() {
        VatRateDetails vrd = createVRD(null, BigDecimal.valueOf(13), null);
        BigDecimal result = vrd.getEffectiveVatRateForCustomer();
        assertEquals(BigDecimal.valueOf(13), result);
    }

    @Test
    public void testGetEffectiveVatRateForCustomer_OnlyCustomer() {
        VatRateDetails vrd = createVRD(null, null, BigDecimal.valueOf(14));
        BigDecimal result = vrd.getEffectiveVatRateForCustomer();
        assertEquals(BigDecimal.valueOf(14), result);
    }

    @Test
    public void testGetEffectiveVatRateForCustomer_DefAndCountry() {
        VatRateDetails vrd = createVRD(BigDecimal.valueOf(14),
                BigDecimal.valueOf(15), null);
        BigDecimal result = vrd.getEffectiveVatRateForCustomer();
        assertEquals(BigDecimal.valueOf(15), result);
    }

    @Test
    public void testGetEffectiveVatRateForCustomer_DefAndCust() {
        VatRateDetails vrd = createVRD(BigDecimal.valueOf(14), null,
                BigDecimal.valueOf(15));
        BigDecimal result = vrd.getEffectiveVatRateForCustomer();
        assertEquals(BigDecimal.valueOf(15), result);
    }

    @Test
    public void testGetEffectiveVatRateForCustomer_CountryAndCust() {
        VatRateDetails vrd = createVRD(null, BigDecimal.valueOf(14),
                BigDecimal.valueOf(15));
        BigDecimal result = vrd.getEffectiveVatRateForCustomer();
        assertEquals(BigDecimal.valueOf(15), result);
    }

    @Test
    public void testGetEffectiveVatRateForCustomer_AllSet() {
        VatRateDetails vrd = createVRD(BigDecimal.valueOf(13),
                BigDecimal.valueOf(14), BigDecimal.valueOf(15));
        BigDecimal result = vrd.getEffectiveVatRateForCustomer();
        assertEquals(BigDecimal.valueOf(15), result);
    }

    @Test
    public void testGetVatAmount_NullNetCosts() throws Exception {
        VatRateDetails vrd = createVRD(null, null, null);
        vrd.setTotalCosts(new BigDecimal(5));
        BigDecimal result = vrd.getVatAmount();
        assertEquals(new BigDecimal(5), result);
    }

    @Test
    public void testGetVatAmount_NullTotalCosts() throws Exception {
        VatRateDetails vrd = createVRD(null, null, null);
        vrd.setNetCosts(new BigDecimal(5));
        BigDecimal result = vrd.getVatAmount();
        assertEquals(new BigDecimal(0), result);
    }

    @Test
    public void testGetVatAmount_CheckDiff() throws Exception {
        VatRateDetails vrd = createVRD(null, null, null);
        vrd.setNetCosts(new BigDecimal(5));
        vrd.setTotalCosts(new BigDecimal(9));
        BigDecimal result = vrd.getVatAmount();
        assertEquals(new BigDecimal(4), result);
    }

    // ------------------------------------------------------------------------
    // internal methods

    /**
     * Creates a vat rate details object with the given settings.
     */
    private VatRateDetails createVRD(BigDecimal defaultVAT,
            BigDecimal countryVAT, BigDecimal customerVAT) {
        VatRateDetails result = new VatRateDetails();
        result.setDefaultVatRate(defaultVAT);
        result.setCountryVatRate(countryVAT);
        result.setCustomerVatRate(customerVAT);
        return result;
    }

}


text:
This package implements a tool and language for connecting to Cardano SL node
running locally and performing operations like inspecting the node's state and
sending commands to the node.

It is documented more fully in the file [docs/auxx.md] of the git repository.

redpajama_set_name: RedPajamaGithub


text:
casper.test.begin('m14_001 #337 off site', 1, function suite(test) {
casper.echo("Test environment: "+SERVER);
var USECASE='/item/2344942';
var ENTITY=SERVER+USECASE;
	casper.start(ENTITY, function() {
	test.assertTextExists('off site', 'page body contains "off site"');
    }).run(function() {
        test.done();
    });
});


text:
namespace OneSky.CSharp
{
    internal class PluginQuotation : IPluginQuotation
    {
        private const string PostQuotationsAddress = "https://plugin.api.onesky.io/1/projects/{project_id}/quotations";

        private const string PostQuotationsFromLocaleBody = "from_locale";

        private const string PostQuotationsToLocalesBody = "to_locales";

        private const string PostQuotationsItemsBody = "items";

        private const string PostQuotationsSpecializationBody = "specialization";

        private const string ProjectIdPlaceholder = "project_id";

        private OneSkyHelper oneSky;

        internal PluginQuotation(OneSkyHelper oneSky)
        {
            this.oneSky = oneSky;
        }

        public IOneSkyResponse PostQuotations(
            int projectId,
            string fromLocale,
            string toLocales,
            string items,
            string specialization = "general")
        {
            return
                this.oneSky.CreateRequest(PostQuotationsAddress)
                    .Placeholder(ProjectIdPlaceholder, projectId)
                    .Body(PostQuotationsFromLocaleBody, fromLocale)
                    .Body(PostQuotationsToLocalesBody, toLocales)
                    .Body(PostQuotationsItemsBody, items)
                    .Body(PostQuotationsSpecializationBody, specialization)
                    .Post();
        }
    }
}


text:
angular.module('os.administrative.models',
  [
    'os.administrative.models.user',
    'os.administrative.models.institute',
    'os.administrative.models.site',
    'os.administrative.models.dp',
    'os.administrative.models.order',
    'os.administrative.models.container',
    'os.administrative.models.role',
    'os.administrative.models.setting',
    'os.administrative.models.authdomain'
  ]
);


text:
package com.amazonaws.services.guardduty.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetMembersResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * A list of members.
     *

     */
    private java.util.List<Member> members;
    /**
     *

     * A list of objects containing the unprocessed account and a result string explaining why it was unprocessed.
     *

     */
    private java.util.List<UnprocessedAccount> unprocessedAccounts;

    /**
     *

     * A list of members.
     *

     *
     * @return A list of members.
     */

    public java.util.List<Member> getMembers() {
        return members;
    }

    /**
     *

     * A list of members.
     *

     *
     * @param members
     *        A list of members.
     */

    public void setMembers(java.util.Collection<Member> members) {
        if (members == null) {
            this.members = null;
            return;
        }

        this.members = new java.util.ArrayList<Member>(members);
    }

    /**
     *

     * A list of members.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setMembers(java.util.Collection)} or {@link #withMembers(java.util.Collection)} if you want to override
     * the existing values.
     *

     *
     * @param members
     *        A list of members.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetMembersResult withMembers(Member... members) {
        if (this.members == null) {
            setMembers(new java.util.ArrayList<Member>(members.length));
        }
        for (Member ele : members) {
            this.members.add(ele);
        }
        return this;
    }

    /**
     *

     * A list of members.
     *

     *
     * @param members
     *        A list of members.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetMembersResult withMembers(java.util.Collection<Member> members) {
        setMembers(members);
        return this;
    }

    /**
     *

     * A list of objects containing the unprocessed account and a result string explaining why it was unprocessed.
     *

     *
     * @return A list of objects containing the unprocessed account and a result string explaining why it was
     *         unprocessed.
     */

    public java.util.List<UnprocessedAccount> getUnprocessedAccounts() {
        return unprocessedAccounts;
    }

    /**
     *

     * A list of objects containing the unprocessed account and a result string explaining why it was unprocessed.
     *

     *
     * @param unprocessedAccounts
     *        A list of objects containing the unprocessed account and a result string explaining why it was
     *        unprocessed.
     */

    public void setUnprocessedAccounts(java.util.Collection<UnprocessedAccount> unprocessedAccounts) {
        if (unprocessedAccounts == null) {
            this.unprocessedAccounts = null;
            return;
        }

        this.unprocessedAccounts = new java.util.ArrayList<UnprocessedAccount>(unprocessedAccounts);
    }

    /**
     *

     * A list of objects containing the unprocessed account and a result string explaining why it was unprocessed.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setUnprocessedAccounts(java.util.Collection)} or {@link #withUnprocessedAccounts(java.util.Collection)}
     * if you want to override the existing values.
     *

     *
     * @param unprocessedAccounts
     *        A list of objects containing the unprocessed account and a result string explaining why it was
     *        unprocessed.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetMembersResult withUnprocessedAccounts(UnprocessedAccount... unprocessedAccounts) {
        if (this.unprocessedAccounts == null) {
            setUnprocessedAccounts(new java.util.ArrayList<UnprocessedAccount>(unprocessedAccounts.length));
        }
        for (UnprocessedAccount ele : unprocessedAccounts) {
            this.unprocessedAccounts.add(ele);
        }
        return this;
    }

    /**
     *

     * A list of objects containing the unprocessed account and a result string explaining why it was unprocessed.
     *

     *
     * @param unprocessedAccounts
     *        A list of objects containing the unprocessed account and a result string explaining why it was
     *        unprocessed.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetMembersResult withUnprocessedAccounts(java.util.Collection<UnprocessedAccount> unprocessedAccounts) {
        setUnprocessedAccounts(unprocessedAccounts);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getMembers() != null)
            sb.append("Members: ").append(getMembers()).append(",");
        if (getUnprocessedAccounts() != null)
            sb.append("UnprocessedAccounts: ").append(getUnprocessedAccounts());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof GetMembersResult == false)
            return false;
        GetMembersResult other = (GetMembersResult) obj;
        if (other.getMembers() == null ^ this.getMembers() == null)
            return false;
        if (other.getMembers() != null && other.getMembers().equals(this.getMembers()) == false)
            return false;
        if (other.getUnprocessedAccounts() == null ^ this.getUnprocessedAccounts() == null)
            return false;
        if (other.getUnprocessedAccounts() != null && other.getUnprocessedAccounts().equals(this.getUnprocessedAccounts()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getMembers() == null) ? 0 : getMembers().hashCode());
        hashCode = prime * hashCode + ((getUnprocessedAccounts() == null) ? 0 : getUnprocessedAccounts().hashCode());
        return hashCode;
    }

    @Override
    public GetMembersResult clone() {
        try {
            return (GetMembersResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
Model: {{selected | json}}

<input [(ngModel)]="selected"
       [typeahead]="states"
       [typeaheadScrollable]="true"
       [typeaheadOptionsInScrollableView]="5"
       class="form-control">


text:
from flask_wtf import FlaskForm
from flask_babel import gettext
import wtforms
from wtforms import StringField, BooleanField, TextAreaField, PasswordField, DateField, SelectField, HiddenField
from wtforms.validators import DataRequired, Length, Required
from wtforms.fields.html5 import EmailField
from flask_wtf.file import FileField, FileRequired, FileAllowed
from werkzeug.utils import secure_filename
from flask_admin.form.fields import TimeField
from flask_admin.form import widgets, DatePickerWidget
#from .fieldwidgets import DatePickerWidget
from .models import User

class LoginForm(FlaskForm):
    email = EmailField('email', validators=[DataRequired(), wtforms.validators.Email("Please enter your email address.")])
    password = PasswordField('password', validators=[DataRequired()])
    remember_me = BooleanField('remember_me', default=False)

class SignUpForm(FlaskForm):
    name = StringField('name', validators=[DataRequired()])
    email = EmailField('email', validators=[DataRequired(), wtforms.validators.Email("Please enter your email address.")])
    password = PasswordField('password', validators=[DataRequired()])
    address = StringField('address', validators=[DataRequired()])
    city = StringField('city', validators=[DataRequired()])
    state = StringField('state', validators=[DataRequired()])
    zipcode = StringField('zipcode', validators=[DataRequired()])
    remember_me = BooleanField('remember_me', default=False)

    #def validate_email(form, field):
    #    if field.data < 13:
    #        raise ValidationError("We're sorry, you must be 13 or older to register")

class EditForm(FlaskForm):
    nickname = StringField('nickname', validators=[DataRequired()])
    about_me = TextAreaField('about_me', validators=[Length(min=0, max=140)])
    photo = FileField('photo', validators=[FileAllowed(['jpg', 'png'], 'Images only!')])
    avatar_url = HiddenField('avatar_url')

    def __init__(self, original_nickname, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)
        self.original_nickname = original_nickname

    def validate(self):
        if not FlaskForm.validate(self):
            return False
        if self.nickname.data == self.original_nickname:
            return True
        if self.nickname.data != User.make_valid_nickname(self.nickname.data):
            self.nickname.errors.append(gettext(
                'This nickname has invalid characters. '
                'Please use letters, numbers, dots and underscores only.'))
            return False
        user = User.query.filter_by(nickname=self.nickname.data).first()
        if user is not None:
            self.nickname.errors.append(gettext(
                'This nickname is already in use. '
                'Please choose another one.'))
            return False
        return True

class PostForm(FlaskForm):
    destination = StringField('destination', validators=[DataRequired("Please tell us where you are going.")])
    trip_date = DateField('TripDate', validators=[Required()], format = '%m/%d/%Y')
    trip_time = TimeField('TripTime', validators=[Required()])
    needRide = SelectField('needRide', validators=[Required()], choices=[('Need a ride','Need a ride'), ('Offering a ride','Offering a ride')],coerce=unicode, option_widget=None)
    seats = SelectField('seats', validators=[Required()], choices=[(1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5')], coerce=int, option_widget=None)
    body = TextAreaField('body', validators=[DataRequired("Please tell us something about your trip."), Length(max=140)])

class SearchForm(FlaskForm):
    search = StringField('search', validators=[DataRequired()])


text:
<?php

use Hubzero\Content\Migration\Base;

// No direct access
defined('_HZEXEC_') or die();

/**
 * Migration script for adding entry for Search - Groups plugin
 **/
class Migration20170831000000PlgSearchGroups extends Base
{
	/**
	 * Up
	 **/
	public function up()
	{
		$this->addPluginEntry('search', 'groups');
	}

	/**
	 * Down
	 **/
	public function down()
	{
		$this->deletePluginEntry('search', 'groups');
	}
}


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/retail/v2/common.proto

package com.google.cloud.retail.v2;

public interface LocalInventoryOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.LocalInventory)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * The place ID for the current set of inventory information.
   *

   *
   * string place_id = 1;
   *
   * @return The placeId.
   */
  java.lang.String getPlaceId();
  /**
   *
   *
   *

   * The place ID for the current set of inventory information.
   *

   *
   * string place_id = 1;
   *
   * @return The bytes for placeId.
   */
  com.google.protobuf.ByteString getPlaceIdBytes();

  /**
   *
   *
   *

   * Product price and cost information.
   * Google Merchant Center property
   * [price](https://support.google.com/merchants/answer/6324371).
   *

   *
   * .google.cloud.retail.v2.PriceInfo price_info = 2;
   *
   * @return Whether the priceInfo field is set.
   */
  boolean hasPriceInfo();
  /**
   *
   *
   *

   * Product price and cost information.
   * Google Merchant Center property
   * [price](https://support.google.com/merchants/answer/6324371).
   *

   *
   * .google.cloud.retail.v2.PriceInfo price_info = 2;
   *
   * @return The priceInfo.
   */
  com.google.cloud.retail.v2.PriceInfo getPriceInfo();
  /**
   *
   *
   *

   * Product price and cost information.
   * Google Merchant Center property
   * [price](https://support.google.com/merchants/answer/6324371).
   *

   *
   * .google.cloud.retail.v2.PriceInfo price_info = 2;
   */
  com.google.cloud.retail.v2.PriceInfoOrBuilder getPriceInfoOrBuilder();

  /**
   *
   *
   *

   * Additional local inventory attributes, for example, store name, promotion
   * tags, etc.
   * This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
   * error is returned:
   * * At most 30 attributes are allowed.
   * * The key must be a UTF-8 encoded string with a length limit of 32
   *   characters.
   * * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
   *   key0LikeThis or KEY_1_LIKE_THIS.
   * * The attribute values must be of the same type (text or number).
   * * Only 1 value is allowed for each attribute.
   * * For text values, the length limit is 256 UTF-8 characters.
   * * The attribute does not support search. The `searchable` field should be
   *   unset or set to false.
   * * The max summed total bytes of custom attribute keys and values per
   *   product is 5MiB.
   *

   *
   * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 3;
   */
  int getAttributesCount();
  /**
   *
   *
   *

   * Additional local inventory attributes, for example, store name, promotion
   * tags, etc.
   * This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
   * error is returned:
   * * At most 30 attributes are allowed.
   * * The key must be a UTF-8 encoded string with a length limit of 32
   *   characters.
   * * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
   *   key0LikeThis or KEY_1_LIKE_THIS.
   * * The attribute values must be of the same type (text or number).
   * * Only 1 value is allowed for each attribute.
   * * For text values, the length limit is 256 UTF-8 characters.
   * * The attribute does not support search. The `searchable` field should be
   *   unset or set to false.
   * * The max summed total bytes of custom attribute keys and values per
   *   product is 5MiB.
   *

   *
   * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 3;
   */
  boolean containsAttributes(java.lang.String key);
  /** Use {@link #getAttributesMap()} instead. */
  @java.lang.Deprecated
  java.util.Map<java.lang.String, com.google.cloud.retail.v2.CustomAttribute> getAttributes();
  /**
   *
   *
   *

   * Additional local inventory attributes, for example, store name, promotion
   * tags, etc.
   * This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
   * error is returned:
   * * At most 30 attributes are allowed.
   * * The key must be a UTF-8 encoded string with a length limit of 32
   *   characters.
   * * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
   *   key0LikeThis or KEY_1_LIKE_THIS.
   * * The attribute values must be of the same type (text or number).
   * * Only 1 value is allowed for each attribute.
   * * For text values, the length limit is 256 UTF-8 characters.
   * * The attribute does not support search. The `searchable` field should be
   *   unset or set to false.
   * * The max summed total bytes of custom attribute keys and values per
   *   product is 5MiB.
   *

   *
   * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 3;
   */
  java.util.Map<java.lang.String, com.google.cloud.retail.v2.CustomAttribute> getAttributesMap();
  /**
   *
   *
   *

   * Additional local inventory attributes, for example, store name, promotion
   * tags, etc.
   * This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
   * error is returned:
   * * At most 30 attributes are allowed.
   * * The key must be a UTF-8 encoded string with a length limit of 32
   *   characters.
   * * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
   *   key0LikeThis or KEY_1_LIKE_THIS.
   * * The attribute values must be of the same type (text or number).
   * * Only 1 value is allowed for each attribute.
   * * For text values, the length limit is 256 UTF-8 characters.
   * * The attribute does not support search. The `searchable` field should be
   *   unset or set to false.
   * * The max summed total bytes of custom attribute keys and values per
   *   product is 5MiB.
   *

   *
   * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 3;
   */

  /* nullable */
  com.google.cloud.retail.v2.CustomAttribute getAttributesOrDefault(
      java.lang.String key,
      /* nullable */
      com.google.cloud.retail.v2.CustomAttribute defaultValue);
  /**
   *
   *
   *

   * Additional local inventory attributes, for example, store name, promotion
   * tags, etc.
   * This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
   * error is returned:
   * * At most 30 attributes are allowed.
   * * The key must be a UTF-8 encoded string with a length limit of 32
   *   characters.
   * * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
   *   key0LikeThis or KEY_1_LIKE_THIS.
   * * The attribute values must be of the same type (text or number).
   * * Only 1 value is allowed for each attribute.
   * * For text values, the length limit is 256 UTF-8 characters.
   * * The attribute does not support search. The `searchable` field should be
   *   unset or set to false.
   * * The max summed total bytes of custom attribute keys and values per
   *   product is 5MiB.
   *

   *
   * map<string, .google.cloud.retail.v2.CustomAttribute> attributes = 3;
   */
  com.google.cloud.retail.v2.CustomAttribute getAttributesOrThrow(java.lang.String key);

  /**
   *
   *
   *

   * Input only. Supported fulfillment types. Valid fulfillment type values
   * include commonly used types (such as pickup in store and same day
   * delivery), and custom types. Customers have to map custom types to their
   * display names before rendering UI.
   * Supported values:
   * * "pickup-in-store"
   * * "ship-to-store"
   * * "same-day-delivery"
   * * "next-day-delivery"
   * * "custom-type-1"
   * * "custom-type-2"
   * * "custom-type-3"
   * * "custom-type-4"
   * * "custom-type-5"
   * If this field is set to an invalid value other than these, an
   * INVALID_ARGUMENT error is returned.
   * All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
   * returned.
   *

   *
   * repeated string fulfillment_types = 4 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return A list containing the fulfillmentTypes.
   */
  java.util.List<java.lang.String> getFulfillmentTypesList();
  /**
   *
   *
   *

   * Input only. Supported fulfillment types. Valid fulfillment type values
   * include commonly used types (such as pickup in store and same day
   * delivery), and custom types. Customers have to map custom types to their
   * display names before rendering UI.
   * Supported values:
   * * "pickup-in-store"
   * * "ship-to-store"
   * * "same-day-delivery"
   * * "next-day-delivery"
   * * "custom-type-1"
   * * "custom-type-2"
   * * "custom-type-3"
   * * "custom-type-4"
   * * "custom-type-5"
   * If this field is set to an invalid value other than these, an
   * INVALID_ARGUMENT error is returned.
   * All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
   * returned.
   *

   *
   * repeated string fulfillment_types = 4 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return The count of fulfillmentTypes.
   */
  int getFulfillmentTypesCount();
  /**
   *
   *
   *

   * Input only. Supported fulfillment types. Valid fulfillment type values
   * include commonly used types (such as pickup in store and same day
   * delivery), and custom types. Customers have to map custom types to their
   * display names before rendering UI.
   * Supported values:
   * * "pickup-in-store"
   * * "ship-to-store"
   * * "same-day-delivery"
   * * "next-day-delivery"
   * * "custom-type-1"
   * * "custom-type-2"
   * * "custom-type-3"
   * * "custom-type-4"
   * * "custom-type-5"
   * If this field is set to an invalid value other than these, an
   * INVALID_ARGUMENT error is returned.
   * All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
   * returned.
   *

   *
   * repeated string fulfillment_types = 4 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @param index The index of the element to return.
   * @return The fulfillmentTypes at the given index.
   */
  java.lang.String getFulfillmentTypes(int index);
  /**
   *
   *
   *

   * Input only. Supported fulfillment types. Valid fulfillment type values
   * include commonly used types (such as pickup in store and same day
   * delivery), and custom types. Customers have to map custom types to their
   * display names before rendering UI.
   * Supported values:
   * * "pickup-in-store"
   * * "ship-to-store"
   * * "same-day-delivery"
   * * "next-day-delivery"
   * * "custom-type-1"
   * * "custom-type-2"
   * * "custom-type-3"
   * * "custom-type-4"
   * * "custom-type-5"
   * If this field is set to an invalid value other than these, an
   * INVALID_ARGUMENT error is returned.
   * All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
   * returned.
   *

   *
   * repeated string fulfillment_types = 4 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @param index The index of the value to return.
   * @return The bytes of the fulfillmentTypes at the given index.
   */
  com.google.protobuf.ByteString getFulfillmentTypesBytes(int index);
}


text:
describe Geometry::Point do
  describe '.initialize' do
    it 'should create a point when given co-ordinates' do
      expect{
        Geometry::Point.new(2,3)
      }.not_to raise_exception
    end

    it 'should be readable' do
      point = Geometry::Point.new(5,8)
      expect(point.abscissa).to eq(5)
      expect(point.ordinate).to eq(8)
    end

    it 'should not be writable' do
      point = Geometry::Point.new(0,0)
      expect{
        point.ordinate = 4
        point.abscissa = 5
      }.to raise_error(NoMethodError)
    end
  end

  describe '#equality (==)' do
    it 'should be unequal when  their attributes are unequal' do
      point1 = Geometry::Point.new(5,2)
      point2 = Geometry::Point.new(5,1)
      expect(point1 == point2).to be_falsey
    end

    it 'should be equal when  their attributes are equal' do
      point1 = Geometry::Point.new(5,2)
      expect(point1 == point1).to be_truthy
    end

    it 'should return true for two points when checked for Symmetric property of equality' do
      point1 = Geometry::Point.new(2,2)
      point2 = Geometry::Point.new(2,2)
      expect(point1 == point2 && point2 == point1).to be_truthy
    end

    it 'should return true for three points when checked for transitive property of equality' do
      point1 = Geometry::Point.new(2,2)
      point2 = Geometry::Point.new(2,2)
      point3 = Geometry::Point.new(2,2)
      expect((point1 == point2 && point2 == point3) && point1 == point3).to be_truthy
    end

    it 'should not be equal to any object of different type' do
      point1 = Geometry::Point.new(2,2)
      point2 = Object.new
      expect(point1 == point2).to be_falsey
    end

    it 'should not be equal to nil' do
      point1 = Geometry::Point.new(2,2)
      point2 = nil
      expect(point1 == point2).to be_falsey
    end
  end

  describe '#distance' do
    it 'should return square root of 2 when given (0,0) and (1,1)' do
      point1 = Geometry::Point.new(0,0)
      point2 = Geometry::Point.new(1,1)
      expect(point1.distance(point2)).to eq(Math.sqrt(2))
    end

    it 'should return 10 when given (4,6) and (10,14)' do
      point1 = Geometry::Point.new(4,6)
      point2 = Geometry::Point.new(10,14)
      expect(point1.distance(point2)).to eq(10)
    end

    it 'should return same value when the order of points reversed' do
      point1 = Geometry::Point.new(4,6)
      point2 = Geometry::Point.new(10,14)
      expect(point1.distance(point2)).to eq(point2.distance(point1))
    end

    it 'should return square root of 10.09 when given (1.5, 2) and (3, 4.8)' do
      point1 = Geometry::Point.new(1.5, 2)
      point2 = Geometry::Point.new(3, 4.8)
      expect(point1.distance(point2)).to eq(Math.sqrt(10.09))
    end
  end
end


text:
<?php

namespace Docker\API\Normalizer;

use Joli\Jane\Reference\Reference;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer;

class EndpointSettingsNormalizer extends SerializerAwareNormalizer implements DenormalizerInterface, NormalizerInterface
{
    public function supportsDenormalization($data, $type, $format = null)
    {
        if ($type !== 'Docker\\API\\Model\\EndpointSettings') {
            return false;
        }

        return true;
    }

    public function supportsNormalization($data, $format = null)
    {
        if ($data instanceof \Docker\API\Model\EndpointSettings) {
            return true;
        }

        return false;
    }

    public function denormalize($data, $class, $format = null, array $context = [])
    {
        if (empty($data)) {
            return null;
        }
        if (isset($data->{'$ref'})) {
            return new Reference($data->{'$ref'}, $context['rootSchema'] ?: null);
        }
        $object = new \Docker\API\Model\EndpointSettings();
        if (!isset($context['rootSchema'])) {
            $context['rootSchema'] = $object;
        }
        if (property_exists($data, 'IPAMConfig')) {
            $object->setIPAMConfig($this->serializer->deserialize($data->{'IPAMConfig'}, 'Docker\\API\\Model\\EndpointIPAMConfig', 'raw', $context));
        }
        if (property_exists($data, 'Links')) {
            $values = [];
            foreach ($data->{'Links'} as $value) {
                $values[] = $value;
            }
            $object->setLinks($values);
        }
        if (property_exists($data, 'Aliases')) {
            $values_1 = [];
            foreach ($data->{'Aliases'} as $value_1) {
                $values_1[] = $value_1;
            }
            $object->setAliases($values_1);
        }
        if (property_exists($data, 'NetworkID')) {
            $object->setNetworkID($data->{'NetworkID'});
        }
        if (property_exists($data, 'EndpointID')) {
            $object->setEndpointID($data->{'EndpointID'});
        }
        if (property_exists($data, 'Gateway')) {
            $object->setGateway($data->{'Gateway'});
        }
        if (property_exists($data, 'IPAddress')) {
            $object->setIPAddress($data->{'IPAddress'});
        }
        if (property_exists($data, 'IPPrefixLen')) {
            $object->setIPPrefixLen($data->{'IPPrefixLen'});
        }
        if (property_exists($data, 'IPv6Gateway')) {
            $object->setIPv6Gateway($data->{'IPv6Gateway'});
        }
        if (property_exists($data, 'GlobalIPv6Address')) {
            $object->setGlobalIPv6Address($data->{'GlobalIPv6Address'});
        }
        if (property_exists($data, 'GlobalIPv6PrefixLen')) {
            $object->setGlobalIPv6PrefixLen($data->{'GlobalIPv6PrefixLen'});
        }
        if (property_exists($data, 'MacAddress')) {
            $object->setMacAddress($data->{'MacAddress'});
        }

        return $object;
    }

    public function normalize($object, $format = null, array $context = [])
    {
        $data = new \stdClass();
        if (null !== $object->getIPAMConfig()) {
            $data->{'IPAMConfig'} = $this->serializer->serialize($object->getIPAMConfig(), 'raw', $context);
        }
        if (null !== $object->getLinks()) {
            $values = [];
            foreach ($object->getLinks() as $value) {
                $values[] = $value;
            }
            $data->{'Links'} = $values;
        }
        if (null !== $object->getAliases()) {
            $values_1 = [];
            foreach ($object->getAliases() as $value_1) {
                $values_1[] = $value_1;
            }
            $data->{'Aliases'} = $values_1;
        }
        if (null !== $object->getNetworkID()) {
            $data->{'NetworkID'} = $object->getNetworkID();
        }
        if (null !== $object->getEndpointID()) {
            $data->{'EndpointID'} = $object->getEndpointID();
        }
        if (null !== $object->getGateway()) {
            $data->{'Gateway'} = $object->getGateway();
        }
        if (null !== $object->getIPAddress()) {
            $data->{'IPAddress'} = $object->getIPAddress();
        }
        if (null !== $object->getIPPrefixLen()) {
            $data->{'IPPrefixLen'} = $object->getIPPrefixLen();
        }
        if (null !== $object->getIPv6Gateway()) {
            $data->{'IPv6Gateway'} = $object->getIPv6Gateway();
        }
        if (null !== $object->getGlobalIPv6Address()) {
            $data->{'GlobalIPv6Address'} = $object->getGlobalIPv6Address();
        }
        if (null !== $object->getGlobalIPv6PrefixLen()) {
            $data->{'GlobalIPv6PrefixLen'} = $object->getGlobalIPv6PrefixLen();
        }
        if (null !== $object->getMacAddress()) {
            $data->{'MacAddress'} = $object->getMacAddress();
        }

        return $data;
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">

<input type="color" id="input" value="#ffffff">


text:
title: Lucy Castor Finds Her Sparkle
written_by: Natasha Lowe
available: 'February 20th, 2018'
isbn: '9781534401969'
binding: Hardcover
link_to_buy_page:
image_path: 'https://images.booksense.com/images/969/401/9781534401969.jpg'
link:
---


text:
Partial file: partial1.html
<%include src="partial2.html" %>
<%include src="nested/partial3.html" %>


text:
using namespace std;
using namespace ngraph;

extern "C" GCPU_BACKEND_API void ngraph_register_gcpu_backend()
{
    runtime::BackendManager::register_backend("GCPU", [](const std::string& config) {
        return std::make_shared<runtime::gcpu::GCPUBackend>();
    });
}

runtime::gcpu::GCPUBackend::GCPUBackend() {}

runtime::gcpu::GCPUBackend::GCPUBackend(const vector<string>& unsupported_op_name_list)
    : m_unsupported_op_name_list{unsupported_op_name_list.begin(), unsupported_op_name_list.end()}
{
}

shared_ptr<runtime::Tensor> runtime::gcpu::GCPUBackend::create_tensor()
{
    return make_shared<runtime::HostTensor>();
}

shared_ptr<runtime::Tensor> runtime::gcpu::GCPUBackend::create_tensor(const element::Type& type,
                                                                      const Shape& shape)
{
    return make_shared<runtime::HostTensor>(type, shape);
}

shared_ptr<runtime::Tensor> runtime::gcpu::GCPUBackend::create_tensor(const element::Type& type,
                                                                      const Shape& shape,
                                                                      void* memory_pointer)
{
    return make_shared<runtime::HostTensor>(type, shape, memory_pointer);
}

shared_ptr<runtime::Executable>
    runtime::gcpu::GCPUBackend::compile(shared_ptr<Function> function,
                                        bool enable_performance_collection)
{
    return make_shared<GCPUExecutable>(function, enable_performance_collection);
}

bool runtime::gcpu::GCPUBackend::is_supported(const Node& node) const
{
    return m_unsupported_op_name_list.find(node.description()) == m_unsupported_op_name_list.end();
}


text:
enum Roles { Admin = 1, Professional = 2, Client = 10};
export class MessageTypes {
    success: string = "success";
    warning: string = "warning";
    error: string = "error";
}

export const Constants = Object.freeze({
    Roles: Roles,
    DateFormat: "MMMM dd",
    TimeFormat: "hh:mm a",
    DateYearFormat: "MMMM dd, yyyy",
    DateTimeFormat: "MMMM dd, hh:mm a",
    DefaultCurriculumCategory: "Not Categorized",
    MessageTypes: new MessageTypes()
})


text:
using System;

namespace P03_SalesDatabase.Data.Models
{
    public class Sale
    {
        public int SaleId { get; set; }
        public DateTime Date { get; set; }

        public int ProductId { get; set; }
        public Product Product { get; set; }

        public int CutomerId { get; set; }
        public Customer Customer { get; set; }

        public int StoreId { get; set; }
        public Store Store { get; set; }
    }
}


text:
import { DEFAULT_URL } from './constants';
import { ensureDateString } from './formatDate';

export interface IFixerError {
  readonly type: string;
  readonly info: string;
}

export interface IFixerRates {
  readonly [currency: string]: number;
}

export interface IFixerResponse {
  readonly base: string;
  readonly date: string;
  readonly rates: IFixerRates;
  readonly timestamp: number;
  readonly error?: IFixerError;
}

export interface IFixerSymbols {
  readonly [symbol: string]: string;
}

export interface IFixerSymbolResponse {
  readonly symbols: IFixerSymbols;
  readonly error?: IFixerError;
}

export interface IFixerConvertRequestOptions {
  readonly from: string;
  readonly to: string;
  readonly amount: number;
  readonly date?: string;
}

export interface IFixerConvertResponse {
  readonly success: boolean;
  readonly query: {
    readonly from: string;
    readonly to: string;
    readonly amount: number;
  };
  readonly date: string;
  readonly result: number;
}

export interface IFixerTimeseriesResponse {
  readonly success: boolean;
  readonly start_date: string;
  readonly end_date: string;
  readonly base: string;
  readonly rates: Record<string, Record<string, number>>;
}

export interface IRawParams {
  [key: string]: any;
}
export interface IRequestOptions {
  base?: string;
  symbols?: string[];
  access_key: string;
}

export interface IBasicOptions {
  baseUrl: string;
  accessKey?: string;
}

export abstract class Fixer {
  protected basicOptions: IBasicOptions;

  constructor(opts: Partial<IBasicOptions> = {}) {
    this.basicOptions = {
      baseUrl: opts.baseUrl || DEFAULT_URL,
      accessKey: opts.accessKey
    };
  }

  set({ baseUrl, accessKey }: Partial<IBasicOptions> = {}): Fixer {
    this.basicOptions.baseUrl = baseUrl || this.basicOptions.baseUrl;
    this.basicOptions.accessKey = accessKey || this.basicOptions.accessKey;
    return this;
  }

  async forDate(date: Date | string, opts: Partial<IRequestOptions> = {}): Promise<IFixerResponse> {
    return this.request<IFixerResponse>(`/${ensureDateString(date)}`, opts);
  }

  async latest(opts: Partial<IRequestOptions> = {}): Promise<IFixerResponse> {
    return this.request<IFixerResponse>('/latest', opts);
  }

  async symbols(opts: Partial<IRequestOptions> = {}): Promise<IFixerSymbolResponse> {
    return this.request<IFixerSymbolResponse>('/symbols', opts);
  }

  async convert(
    from: string,
    to: string,
    amount: number,
    date?: Date | string
  ): Promise<IFixerConvertResponse> {
    return this.request<IFixerConvertResponse>('/convert', {
      from,
      to,
      amount,
      date
    });
  }

  async timeseries(
    startDate: Date | string,
    endDate: Date | string,
    opts: Partial<IRequestOptions> = {}
  ) {
    const start = ensureDateString(startDate);
    const end = ensureDateString(endDate);
    return this.request<IFixerTimeseriesResponse>('/timeseries', {
      start_date: start,
      end_date: end,
      ...opts
    });
  }

  protected abstract request<Result>(url: string, opts: IRawParams): Promise<Result>;
}


text:
import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import withStyles from 'isomorphic-style-loader/withStyles';
import s from './Box.css'; // eslint-disable-line css-modules/no-unused-class

class Box extends React.Component {
  static propTypes = {
    children: PropTypes.node,
    onClick: PropTypes.func,
    column: PropTypes.bool,
    className: PropTypes.string,
    pad: PropTypes.bool,
    tag: PropTypes.string,
    align: PropTypes.bool,
    containerClassName: PropTypes.string,
    justify: PropTypes.bool,
    wrap: PropTypes.bool,
    flex: PropTypes.bool,
    between: PropTypes.bool,
    padding: PropTypes.string,
    fill: PropTypes.bool,
  };

  static defaultProps = {
    children: null,
    onClick: null,
    column: false,
    className: null,
    pad: false,
    tag: 'div',
    align: false,
    containerClassName: null,
    justify: false,
    wrap: false,
    flex: false,
    between: false,
    padding: null,
    fill: null,
  };

  render() {
    const {
      tag,
      column,
      children,
      onClick,
      pad,
      className,
      containerClassName,
      align,
      justify,
      wrap,
      flex,
      between,
      padding,
      fill,
    } = this.props;

    /* eslint-disable jsx-a11y/no-static-element-interactions */
    const Component = tag;

    return (
      <Component
        className={cn(
          s.root,
          className || null,
          containerClassName || null,
          column ? s.column : null,
          onClick ? s.clickable : null,
          pad ? s.pad : null,
          align ? s.align : null,
          justify ? s.justify : null,
          wrap ? s.wrap : null,
          flex ? s.flex : null,
          between ? s.between : null,
          fill ? s.fill : null,
          {
            [s[padding]]: padding,
          },
        )}
        onClick={onClick}
      >
        {children}
      </Component>
    );
  }
}

export default withStyles(s)(Box);


text:
/**
 * All rights reserved. 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.jivesoftware.smackx.bytestreams.ibb;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.Random;
import java.util.concurrent.SynchronousQueue;

import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smack.test.SmackTestCase;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamListener;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamRequest;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamSession;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;

/**
 * Test for In-Band Bytestreams with real XMPP servers.
 *
 * @author Henning Staib
 */
public class InBandBytestreamTest extends SmackTestCase {

    /* the amount of data transmitted in each test */
    int dataSize = 1024000;

    public InBandBytestreamTest(String arg0) {
        super(arg0);
    }

    /**
     * Target should respond with not-acceptable error if no listeners for incoming In-Band
     * Bytestream requests are registered.
     *
     * @throws XMPPException should not happen
     */
    public void testRespondWithErrorOnInBandBytestreamRequest() throws XMPPException {
        Connection targetConnection = getConnection(0);

        Connection initiatorConnection = getConnection(1);

        Open open = new Open("sessionID", 1024);
        open.setFrom(initiatorConnection.getUser());
        open.setTo(targetConnection.getUser());

        PacketCollector collector = initiatorConnection.createPacketCollector(new PacketIDFilter(
                        open.getPacketID()));
        initiatorConnection.sendPacket(open);
        Packet result = collector.nextResult();

        assertNotNull(result.getError());
        assertEquals(XMPPError.Condition.no_acceptable.toString(), result.getError().getCondition());

    }

    /**
     * An In-Band Bytestream should be successfully established using IQ stanzas.
     *
     * @throws Exception should not happen
     */
    public void testInBandBytestreamWithIQStanzas() throws Exception {

        Connection initiatorConnection = getConnection(0);
        Connection targetConnection = getConnection(1);

        // test data
        Random rand = new Random();
        final byte[] data = new byte[dataSize];
        rand.nextBytes(data);
        final SynchronousQueue<byte[]> queue = new SynchronousQueue<byte[]>();

        InBandBytestreamManager targetByteStreamManager = InBandBytestreamManager.getByteStreamManager(targetConnection);

        InBandBytestreamListener incomingByteStreamListener = new InBandBytestreamListener() {

            public void incomingBytestreamRequest(InBandBytestreamRequest request) {
                InputStream inputStream;
                try {
                    inputStream = request.accept().getInputStream();
                    byte[] receivedData = new byte[dataSize];
                    int totalRead = 0;
                    while (totalRead < dataSize) {
                        int read = inputStream.read(receivedData, totalRead, dataSize - totalRead);
                        totalRead += read;
                    }
                    queue.put(receivedData);
                }
                catch (Exception e) {
                    fail(e.getMessage());
                }
            }

        };
        targetByteStreamManager.addIncomingBytestreamListener(incomingByteStreamListener);

        InBandBytestreamManager initiatorByteStreamManager = InBandBytestreamManager.getByteStreamManager(initiatorConnection);

        OutputStream outputStream = initiatorByteStreamManager.establishSession(
                        targetConnection.getUser()).getOutputStream();

        // verify stream
        outputStream.write(data);
        outputStream.flush();
        outputStream.close();

        assertEquals("received data not equal to sent data", data, queue.take());

    }

    /**
     * An In-Band Bytestream should be successfully established using message stanzas.
     *
     * @throws Exception should not happen
     */
    public void testInBandBytestreamWithMessageStanzas() throws Exception {

        Connection initiatorConnection = getConnection(0);
        Connection targetConnection = getConnection(1);

        // test data
        Random rand = new Random();
        final byte[] data = new byte[dataSize];
        rand.nextBytes(data);
        final SynchronousQueue<byte[]> queue = new SynchronousQueue<byte[]>();

        InBandBytestreamManager targetByteStreamManager = InBandBytestreamManager.getByteStreamManager(targetConnection);

        InBandBytestreamListener incomingByteStreamListener = new InBandBytestreamListener() {

            public void incomingBytestreamRequest(InBandBytestreamRequest request) {
                InputStream inputStream;
                try {
                    inputStream = request.accept().getInputStream();
                    byte[] receivedData = new byte[dataSize];
                    int totalRead = 0;
                    while (totalRead < dataSize) {
                        int read = inputStream.read(receivedData, totalRead, dataSize - totalRead);
                        totalRead += read;
                    }
                    queue.put(receivedData);
                }
                catch (Exception e) {
                    fail(e.getMessage());
                }
            }

        };
        targetByteStreamManager.addIncomingBytestreamListener(incomingByteStreamListener);

        InBandBytestreamManager initiatorByteStreamManager = InBandBytestreamManager.getByteStreamManager(initiatorConnection);
        initiatorByteStreamManager.setStanza(StanzaType.MESSAGE);

        OutputStream outputStream = initiatorByteStreamManager.establishSession(
                        targetConnection.getUser()).getOutputStream();

        // verify stream
        outputStream.write(data);
        outputStream.flush();
        outputStream.close();

        assertEquals("received data not equal to sent data", data, queue.take());

    }

    /**
     * An In-Band Bytestream should be successfully established using IQ stanzas. The established
     * session should transfer data bidirectional.
     *
     * @throws Exception should not happen
     */
    public void testBiDirectionalInBandBytestream() throws Exception {

        Connection initiatorConnection = getConnection(0);

        Connection targetConnection = getConnection(1);

        // test data
        Random rand = new Random();
        final byte[] data = new byte[dataSize];
        rand.nextBytes(data);

        final SynchronousQueue<byte[]> queue = new SynchronousQueue<byte[]>();

        InBandBytestreamManager targetByteStreamManager = InBandBytestreamManager.getByteStreamManager(targetConnection);

        InBandBytestreamListener incomingByteStreamListener = new InBandBytestreamListener() {

            public void incomingBytestreamRequest(InBandBytestreamRequest request) {
                try {
                    InBandBytestreamSession session = request.accept();
                    OutputStream outputStream = session.getOutputStream();
                    outputStream.write(data);
                    outputStream.flush();
                    InputStream inputStream = session.getInputStream();
                    byte[] receivedData = new byte[dataSize];
                    int totalRead = 0;
                    while (totalRead < dataSize) {
                        int read = inputStream.read(receivedData, totalRead, dataSize - totalRead);
                        totalRead += read;
                    }
                    queue.put(receivedData);
                }
                catch (Exception e) {
                    fail(e.getMessage());
                }
            }

        };
        targetByteStreamManager.addIncomingBytestreamListener(incomingByteStreamListener);

        InBandBytestreamManager initiatorByteStreamManager = InBandBytestreamManager.getByteStreamManager(initiatorConnection);

        InBandBytestreamSession session = initiatorByteStreamManager.establishSession(targetConnection.getUser());

        // verify stream
        byte[] receivedData = new byte[dataSize];
        InputStream inputStream = session.getInputStream();
        int totalRead = 0;
        while (totalRead < dataSize) {
            int read = inputStream.read(receivedData, totalRead, dataSize - totalRead);
            totalRead += read;
        }

        assertEquals("sent data not equal to received data", data, receivedData);

        OutputStream outputStream = session.getOutputStream();

        outputStream.write(data);
        outputStream.flush();
        outputStream.close();

        assertEquals("received data not equal to sent data", data, queue.take());

    }

    @Override
    protected int getMaxConnections() {
        return 2;
    }

}


text:
import {AmpAdUIHandler} from './amp-ad-ui';
import {AmpAdXOriginIframeHandler} from './amp-ad-xorigin-iframe-handler';
import {LayoutPriority} from '../../../src/layout';
import {adConfig} from '../../../ads/_config';
import {clamp} from '../../../src/utils/math';
import {
  computedStyle,
  setStyle,
} from '../../../src/style';
import {dev, user} from '../../../src/log';
import {getAdCid} from '../../../src/ad-cid';
import {getAdContainer, isAdPositionAllowed}
  from '../../../src/ad-helper';
import {
  getAmpAdRenderOutsideViewport,
  incrementLoadingAds,
  is3pThrottled,
} from './concurrent-load';
import {getIframe} from '../../../src/3p-frame';
import {
  googleLifecycleReporterFactory,
} from '../../../ads/google/a4a/google-data-reporter';
import {isLayoutSizeDefined} from '../../../src/layout';
import {moveLayoutRect} from '../../../src/layout-rect';
import {preloadBootstrap} from '../../../src/3p-frame';
import {toWin} from '../../../src/types';

/** @const {string} Tag name for 3P AD implementation. */
export const TAG_3P_IMPL = 'amp-ad-3p-impl';

/** @const {number} */
const MIN_FULL_WIDTH_HEIGHT = 100;

/** @const {number} */
const MAX_FULL_WIDTH_HEIGHT = 500;

export class AmpAd3PImpl extends AMP.BaseElement {

  /**
   * @param {!AmpElement} element
   */
  constructor(element) {
    super(element);

    /** @private {?Element} */
    this.iframe_ = null;

    /** {?Object} */
    this.config = null;

    /** {?AmpAdUIHandler} */
    this.uiHandler = null;

    /** @private {?AmpAdXOriginIframeHandler} */
    this.xOriginIframeHandler_ = null;

    /** @private {?Element} */
    this.placeholder_ = null;

    /** @private {?Element} */
    this.fallback_ = null;

    /** @private {boolean} */
    this.isInFixedContainer_ = false;

    /**
     * The (relative) layout box of the ad iframe to the amp-ad tag.
     * @private {?../../../src/layout-rect.LayoutRectDef}
     */
    this.iframeLayoutBox_ = null;

    /**
     * Call to stop listening to viewport changes.
     * @private {?function()}
     */
    this.unlistenViewportChanges_ = null;

    /** @private {IntersectionObserver} */
    this.intersectionObserver_ = null;

    /** @private {?string|undefined} */
    this.container_ = undefined;

    /** @private {?Promise} */
    this.layoutPromise_ = null;

    /** @type {!../../../ads/google/a4a/performance.BaseLifecycleReporter} */
    this.lifecycleReporter = googleLifecycleReporterFactory(this);

    /** @private {string|undefined} */
    this.type_ = undefined;

    /**
     * For full-width responsive ads: whether the element has already been
     * aligned to the edges of the viewport.
     * @private {boolean}
     */
    this.isFullWidthAligned_ = false;

    /**
     * Whether full-width responsive was requested for this ad.
     * @private {boolean}
     */
    this.isFullWidthRequested_ = false;
  }

  /** @override */
  getLayoutPriority() {
    // Loads ads after other content,
    const isPWA = !this.element.getAmpDoc().isSingleDoc();
    // give the ad higher priority if it is inside a PWA
    return isPWA ? LayoutPriority.METADATA : LayoutPriority.ADS;
  }

  renderOutsideViewport() {
    if (is3pThrottled(this.win)) {
      return false;
    }
    // Otherwise the ad is good to go.
    const elementCheck = getAmpAdRenderOutsideViewport(this.element);
    return elementCheck !== null ?
      elementCheck : super.renderOutsideViewport();
  }

  /** @override */
  isLayoutSupported(layout) {
    return isLayoutSizeDefined(layout);
  }

  /**
   * @return {!../../../src/service/resource.Resource}
   * @visibileForTesting
   */
  getResource() {
    return this.element.getResources().getResourceForElement(this.element);
  }

  /** @override */
  buildCallback() {
    this.type_ = this.element.getAttribute('type');
    const upgradeDelayMs = Math.round(this.getResource().getUpgradeDelayMs());
    dev().info(TAG_3P_IMPL, `upgradeDelay ${this.type_}: ${upgradeDelayMs}`);
    this.emitLifecycleEvent('upgradeDelay', {
      'forced_delta': upgradeDelayMs,
    });

    this.placeholder_ = this.getPlaceholder();
    this.fallback_ = this.getFallback();

    this.config = adConfig[this.type_];
    user().assert(
        this.config, `Type "${this.type_}" is not supported in amp-ad`);

    this.uiHandler = new AmpAdUIHandler(this);

    this.isFullWidthRequested_ = this.shouldRequestFullWidth_();

    if (this.isFullWidthRequested_) {
      return this.attemptFullWidthSizeChange_();
    }
  }

  /**
   * @return {boolean}
   * @private
   */
  shouldRequestFullWidth_() {
    const hasFullWidth = this.element.hasAttribute('data-full-width');
    if (!hasFullWidth) {
      return false;
    }
    user().assert(this.element.getAttribute('width') == '100vw',
        'Ad units with data-full-width must have width="100vw".');
    user().assert(!!this.config.fullWidthHeightRatio,
        'Ad network does not support full width ads.');
    dev().info(TAG_3P_IMPL,
        '#${this.getResource().getId()} Full width requested');
    return true;
  }

  /**
   * Prefetches and preconnects URLs related to the ad.
   * @param {boolean=} opt_onLayout
   * @override
   */
  preconnectCallback(opt_onLayout) {
    // We always need the bootstrap.
    preloadBootstrap(
        this.win, this.preconnect, this.type_, this.config.remoteHTMLDisabled);
    if (typeof this.config.prefetch == 'string') {
      this.preconnect.preload(this.config.prefetch, 'script');
    } else if (this.config.prefetch) {
      this.config.prefetch.forEach(p => {
        this.preconnect.preload(p, 'script');
      });
    }
    if (typeof this.config.preconnect == 'string') {
      this.preconnect.url(this.config.preconnect, opt_onLayout);
    } else if (this.config.preconnect) {
      this.config.preconnect.forEach(p => {
        this.preconnect.url(p, opt_onLayout);
      });
    }
    // If fully qualified src for ad script is specified we preconnect to it.
    const src = this.element.getAttribute('src');
    if (src) {
      // We only preconnect to the src because we cannot know whether the URL
      // will have caching headers set.
      this.preconnect.url(src);
    }
  }

  /**
   * @override
   */
  onLayoutMeasure() {
    this.isInFixedContainer_ = !isAdPositionAllowed(this.element, this.win);
    /** detect ad containers, add the list to element as a new attribute */
    if (this.container_ === undefined) {
      this.container_ = getAdContainer(this.element);
    }
    // We remeasured this tag, let's also remeasure the iframe. Should be
    // free now and it might have changed.
    this.measureIframeLayoutBox_();
    if (this.xOriginIframeHandler_) {
      this.xOriginIframeHandler_.onLayoutMeasure();
    }

    if (this.isFullWidthRequested_ && !this.isFullWidthAligned_) {
      this.isFullWidthAligned_ = true;
      const layoutBox = this.getLayoutBox();

      // Nudge into the correct horizontal position by changing side margin.
      this.getVsync().run({
        measure: state => {
          state.direction =
              computedStyle(this.win, this.element)['direction'];
        },
        mutate: state => {
          if (state.direction == 'rtl') {
            setStyle(this.element, 'marginRight', layoutBox.left, 'px');
          } else {
            setStyle(this.element, 'marginLeft', -layoutBox.left, 'px');
          }
        },
      }, {direction: ''});
    }
  }

  /**
   * Measure the layout box of the iframe if we rendered it already.
   * @private
   */
  measureIframeLayoutBox_() {
    if (this.xOriginIframeHandler_ && this.xOriginIframeHandler_.iframe) {
      const iframeBox =
          this.getViewport().getLayoutRect(this.xOriginIframeHandler_.iframe);
      const box = this.getLayoutBox();
      // Cache the iframe's relative position to the amp-ad. This is
      // necessary for fixed-position containers which "move" with the
      // viewport.
      this.iframeLayoutBox_ = moveLayoutRect(iframeBox, -box.left, -box.top);
    }
  }

  /**
   * @override
   */
  getIntersectionElementLayoutBox() {
    if (!this.xOriginIframeHandler_ || !this.xOriginIframeHandler_.iframe) {
      return super.getIntersectionElementLayoutBox();
    }
    const box = this.getLayoutBox();
    if (!this.iframeLayoutBox_) {
      this.measureIframeLayoutBox_();
    }

    const iframe = /** @type {!../../../src/layout-rect.LayoutRectDef} */(
      dev().assert(this.iframeLayoutBox_));
    return moveLayoutRect(iframe, box.left, box.top);
  }

  /** @override */
  layoutCallback() {
    if (this.layoutPromise_) {
      return this.layoutPromise_;
    }
    this.emitLifecycleEvent('preAdThrottle');
    user().assert(!this.isInFixedContainer_,
        '<amp-ad> is not allowed to be placed in elements with ' +
        'position:fixed: %s', this.element);
    this.layoutPromise_ = getAdCid(this).then(cid => {
      const opt_context = {
        clientId: cid || null,
        container: this.container_,
      };

      // In this path, the request and render start events are entangled,
      // because both happen inside a cross-domain iframe.  Separating them
      // here, though, allows us to measure the impact of ad throttling via
      // incrementLoadingAds().
      this.emitLifecycleEvent('adRequestStart');
      const iframe = getIframe(toWin(this.element.ownerDocument.defaultView),
          this.element, this.type_, opt_context,
          this.config.remoteHTMLDisabled);
      this.xOriginIframeHandler_ = new AmpAdXOriginIframeHandler(
          this);
      return this.xOriginIframeHandler_.init(iframe);
    });
    incrementLoadingAds(this.win, this.layoutPromise_);
    return this.layoutPromise_;
  }

  /** @override  */
  viewportCallback(inViewport) {
    if (this.xOriginIframeHandler_) {
      this.xOriginIframeHandler_.viewportCallback(inViewport);
    }
  }

  /** @override  */
  unlayoutCallback() {
    this.layoutPromise_ = null;
    this.uiHandler.applyUnlayoutUI();
    if (this.xOriginIframeHandler_) {
      this.xOriginIframeHandler_.freeXOriginIframe();
      this.xOriginIframeHandler_ = null;
    }
    this.emitLifecycleEvent('adSlotCleared');
    return true;
  }

  /** @override */
  createPlaceholderCallback() {
    return this.uiHandler.createPlaceholder();
  }

  /**
   * Send a lifecycle event notification.  Currently, this is active only for
   * Google network ad tags (type=adsense or type=doubleclick) and pings are
   * done via direct image tags.  In the future, this will become an event
   * notification to amp-analytics, and providers will be able to configure
   * their own destinations and mechanisms for notifications.
   *
   * @param {string} eventName  Name of the event to send.
   * @param {!Object<string, string|number>=} opt_extraVariables  Additional
   *   variables to make available for substitution on the event notification.
   */
  emitLifecycleEvent(eventName, opt_extraVariables) {
    if (opt_extraVariables) {
      this.lifecycleReporter.setPingParameters(opt_extraVariables);
    }
    this.lifecycleReporter.sendPing(eventName);
  }

  /**
  * Calculates and attempts to set the appropriate height & width for a
  * responsive full width ad unit.
  * @return {!Promise}
  * @private
  */
  attemptFullWidthSizeChange_() {
    const viewportSize = this.getViewport().getSize();
    const maxHeight = Math.min(MAX_FULL_WIDTH_HEIGHT, viewportSize.height);
    const ratio = this.config.fullWidthHeightRatio;
    const idealHeight = Math.round(viewportSize.width / ratio);
    const height = clamp(idealHeight, MIN_FULL_WIDTH_HEIGHT, maxHeight);
    const width = viewportSize.width;
    // Attempt to resize to the correct height. The width should already be
    // 100vw, but is fixed here so that future resizes of the viewport don't
    // affect it.

    return this.attemptChangeSize(height, width).then(
        () => {
          dev().info(TAG_3P_IMPL, `Size change accepted: ${width}x${height}`);
        },
        () => {
          dev().info(TAG_3P_IMPL, `Size change rejected: ${width}x${height}`);
        }
    );
  }
}


text:
<component name="libraryTable">
  <library name="adapters-1.0-rc2">
    <CLASSES>
      <root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.databinding/adapters/1.0-rc2/jars/classes.jar!/" />
      <root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.databinding/adapters/1.0-rc2/res" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>


text:
import { useCallback } from 'react';
import { message, Button, Form, Input } from 'antd';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';

import { type ForgottenPasswordPayload, useForgottenPassword, isApiError } from 'api';

import { useForgottenPasswordRules } from '../../validations';
import { AUTH_ROUTES } from '../../routes';

const ForgottenPassword = () => {
  const { t } = useTranslation();

  const navigate = useNavigate();

  const rules = useForgottenPasswordRules();

  const { mutate: forgottenPassword, isLoading: forgottenPasswordIsLoading } =
    useForgottenPassword();

  const handleSubmit = useCallback(
    (payload: ForgottenPasswordPayload) =>
      forgottenPassword(payload, {
        onSuccess: () => {
          message.success(t('forgottenPassword.success'));
          navigate(AUTH_ROUTES.login.to);
        },
        onError: (error) => {
          if (isApiError(error)) {
            message.error(error.message);
          }
        },
      }),
    [t, navigate, forgottenPassword]
  );

  return (
    <Form<ForgottenPasswordPayload> onFinish={handleSubmit} layout="vertical" scrollToFirstError>
      <Form.Item
        label={t('forgottenPassword.email.label')}
        name="email"
        rules={rules.email}
        validateFirst
      >
        <Input autoFocus placeholder={t('forgottenPassword.email.placeholder')} />
      </Form.Item>
      <Button block type="primary" htmlType="submit" loading={forgottenPasswordIsLoading}>
        {t('forgottenPassword.submit')}
      </Button>
    </Form>
  );
};

export default ForgottenPassword;


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

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>DeVille's robber frog factsheet on ARKive - Pristimantis devillei</title>
        <link rel="canonical" href="http://www.arkive.org/devilles-robber-frog/pristimantis-devillei/" />
		<link rel="stylesheet" type="text/css" media="screen,print" href="/rcss/factsheet.css" />
		<link rel="icon" href="/favicon.ico" type="image/x-icon" />
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

DeVille's robber frog (Pristimantis devillei)

Synonyms:
Eleutherodactylus devillei

Kingdom	Animalia

Phylum	Chordata

Class	Amphibia

Order	Anura

Family	Strabomantidae

Genus	Pristimantis (1)

DeVille's robber frog is classified as Endangered (EN) on the IUCN Red List (1).

Information on DeVille's robber frog (Pristimantis devillei) is currently being researched and written and will appear here shortly.

This information is awaiting authentication by a species expert, and will be updated as soon as possible. If you are able to help please contact:
arkive@wildscreen.org.uk

IUCN Red List (February, 2011)
http://www.iucnredlist.org


text:
/*A company has name, address, phone number, fax number, web site and manager. The manager has first name, last name, age and a phone number. Write a program that reads the information about a company and its manager and prints them on the console.*/

using System;

class InformationAboutCompanyAndManager
{
    static void Main()
    {
        Console.Write("Please, Enter an information about a company and its manager\nCompany name: ");
        string companyName = Console.ReadLine();
        Console.Write("Company adress: ");
        string companyAdress = Console.ReadLine();
        Console.Write("Company Phone Number: ");
        ulong companyPhone = ulong.Parse(Console.ReadLine());
        Console.Write("Company Fax Number: ");
        ulong companyFax = ulong.Parse(Console.ReadLine());
        Console.Write("Company Web Site: ");
        string companySite = Console.ReadLine();
        Console.Write("Please, Enter a manager`s information:\nFirst name: ");
        string firstName = Console.ReadLine();
        Console.Write("Last name: ");
        string lastName = Console.ReadLine();
        Console.Write("Age: ");
        byte age = byte.Parse(Console.ReadLine());
        Console.Write("Phone Number: ");
        ulong phone = ulong.Parse(Console.ReadLine());
        Console.WriteLine("Information for {0}\nAdress: {1}\nPhone number: {2:+359 ### ### ## ##}\nFax number: {3:+359 ### ### ## ##}\nWeb site: {4}\nManager`s name: {5} {6}\nManager`s age: {7}\nManager`s phone {8:+359 #### ### ###}", companyName, companyAdress, companyPhone, companyFax, companySite, firstName, lastName, age, phone);
    }
}


text:
package mods.alice.championglove.utility;

import java.util.UUID;

import com.mojang.authlib.GameProfile;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.DamageSource;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayer;

public class EntityManipulator
{
	static final GameProfile fakeProfile = new GameProfile(new UUID(0L, 0L), "CG-DUMMY");
	static final double pi2 = Math.PI / 180;
	//static final Field combatTracker;

	//static
	//{
	//	combatTracker = Reflecter.getField(EntityLiving.class, "field_94063_bt");
	//}

	public static void knockBack(EntityPlayer player, Entity entity)
	{
		if(player != null)
		{
			float sprintFactor = player.isSprinting() ? 3 : 1.5F;
			float criticalFactor = (player.fallDistance >= 1) ? 1.2F : 0.7F;
			entity.addVelocity(-Math.sin(player.rotationYaw * pi2) * sprintFactor, criticalFactor, Math.cos(player.rotationYaw * pi2) * sprintFactor);
		}
		else
		{
			entity.addVelocity(-Math.sin(entity.rotationYaw * pi2) * 1.5, 0.7, Math.cos(entity.rotationYaw * pi2) * 1.5);
		}
	}

	/**
	 * Terminate a mob. Do death animate.
	 * @param entity Mob to kill.
	 * @param player If set, knock back motion will be performed.
	 */
	public static void instantKill(Entity entity, EntityPlayer player, boolean _knockBack)
	{
		DamageSource damageSource;
		if((player == null) || player.capabilities.isCreativeMode)
		{
			damageSource = DamageSource.outOfWorld;
		}
		else
		{
			damageSource = DamageSource.causePlayerDamage(new FakePlayer((WorldServer)player.worldObj, fakeProfile));
		}

		// Make be noting dropitem when killing in creative mode.
		entity.attackEntityFrom(damageSource, 0);

		if(entity instanceof EntityLivingBase)
		{
			EntityLivingBase living = (EntityLivingBase)entity;

			living.setHealth(0);
			if(living.getHealth() > 0)
			{
				EntityDataManager man = entity.getDataManager();
				try
				{
					man.set(EntityLivingBase.HEALTH, 0F);
				}
				catch(Exception e)
				{
				}
			}

			if((player != null) && !player.capabilities.isCreativeMode)
			{
				living.onDeath(damageSource);
			}
		}

		if(_knockBack)
		{
			knockBack(player, entity);
		}

		if(!entity.worldObj.isRemote)
		{
			entity.worldObj.setEntityState(entity, (byte)3);
		}
	}
}


text:
See the [release](https://github.com/rancher/k3s/releases/latest) page for pre-built releases.

The clone will be much faster on this repo if you do
```bash
git clone --depth 1 https://github.com/rancher/k3s.git
```

This repo includes all of Kubernetes history so `--depth 1` will avoid most of that.

The k3s build process requires some autogenerated code and remote artifacts that are not checked in to version control.
To prepare these resources for your build environment, run:.
```bash
mkdir -p build/data && ./scripts/download && go generate
```

To build the full release binary, you may now run `make`, which will create `./dist/artifacts/k3s`.

To build the binaries using without running linting (ie; if you have uncommitted changes):
```bash
SKIP_VALIDATE=true make
```

If you make any changes to go.mod and want to update the vendored modules, you should run the following before runnining `make`:
```bash
go mod vendor && go mod tidy
```

Kubernetes Source
-----------------

The source code for Kubernetes is in `vendor/` and the location from which that is copied
is in `./go.mod`.  Go to the referenced repo/tag and you'll find all the patches applied
to upstream Kubernetes.


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Zian "Zane" Liu</title>
    <meta name="description" content="Zian "Zane" Liu - Bioengineer, synthetic biologist, regulatory consultant, STEM outreach organizer, political junkie, menswear enthusiast, fountain pen user, coffee addict, and more..." />

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

    <link rel="shortcut icon" href="/assets/images/favicon.ico" >

    <link rel="stylesheet" type="text/css" href="/assets/css/screen.css" />
    <link rel="stylesheet" type="text/css"
          href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />
    <link rel="stylesheet" type="text/css" href="/assets/css/syntax.css" />

    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/default.min.css">

        <link rel="canonical" href="/" />
    <meta name="referrer" content="origin" />
    <link rel="next" href="/page2/" />

    <meta property="og:site_name" content="Zian "Zane" Liu" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Zian "Zane" Liu" />
    <meta property="og:description" content="Bioengineer, synthetic biologist, regulatory consultant, STEM outreach organizer, political junkie, menswear enthusiast, fountain pen user, coffee addict, and more..." />
    <meta property="og:url" content="/" />
    <meta property="og:image" content="/assets/images/cover1.jpg" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:title" content="Zian "Zane" Liu" />
    <meta name="twitter:description" content="Bioengineer, synthetic biologist, regulatory consultant, STEM outreach organizer, political junkie, menswear enthusiast, fountain pen user, coffee addict, and more..." />
    <meta name="twitter:url" content="/" />
    <meta name="twitter:image:src" content="/assets/images/cover1.jpg" />

    <meta name="generator" content="Jekyll 3.0.0" />
    <link rel="alternate" type="application/rss+xml" title="Zian "Zane" Liu" href="/feed.xml" />

Menu

        Close

Home

About Zian

Resume

Projects

Leadership

Menswear Advice

Interests

Contact Me

Follow @chairmanzian

            Menu

Style

                How to dress like me, more or less.

            « Newer Posts

     Page 2 of 5

        Older Posts »

Reconsider the Three-Button Suit

Harvey Specter from Suits, in a three-button suit Once upon a time, not too long ago, men were expected to wear three-button suits – it's just... »

            Zian Liu

                on

                       Style

            <time class="post-date" datetime="2017-07-12">12 Jul 2017</time>

Why I Got Into Suits

If you walk through Berkeley, you will probably see more people in hoodies and sweatpants rather than jackets and ties. So, as a menswear enthusiast based... »

            Zian Liu

                on

                       Style

            <time class="post-date" datetime="2017-06-26">26 Jun 2017</time>

What Color Tie Should I Wear?

Picking a tie can be difficult – they come in so many different colors, not to say different shades within the same color. Even between two... »

            Zian Liu

                on

                       Style

            <time class="post-date" datetime="2017-03-14">14 Mar 2017</time>

Is There Such a Thing As Too Much Blue?

I love the color blue - it's probably my favorite - and I wear it a lot. I own three solid navy suits and three solid... »

            Zian Liu

                on

                       Style

            <time class="post-date" datetime="2016-11-21">21 Nov 2016</time>

The Tieless Suit

Presidents Xi of China and Obama of the United States met yesterday at the Sunnylands Estate in California. The dress code of the event was "no... »

            Zian Liu

                on

                       Style

            <time class="post-date" datetime="2016-08-09">09 Aug 2016</time>

            « Newer Posts

     Page 2 of 5

        Older Posts »

Zian "Zane" Liu © 2018

Proudly published with Jekyll using Jasper


text:
#include "../toe/toe.hpp"

using namespace hls;

/** @defgroup echo_server_application Echo Server Application
 *
 */
void echo_server_application(stream<ap_uint<16> >& listenPort, stream<bool>& listenPortStatus,
								// This is disabled for the time being, because it adds complexity/potential issues
								//stream<ap_uint<16> >& closePort,
								stream<appNotification>& notifications, stream<appReadRequest>& readRequest,
								stream<ap_uint<16> >& rxMetaData, stream<axiWord>& rxData,
								stream<ipTuple>& openConnection, stream<openStatus>& openConStatus,
								stream<ap_uint<16> >& closeConnection,
								stream<ap_uint<16> >& txMetaData, stream<axiWord>& txData,
								stream<ap_int<17> >& txStatus);


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.sinav1"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="21" />
 	<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/icon_120"
        android:label="@string/app_name"
        android:theme="@style/sinaweiboActionBar"
        android:name="com.example.sinav1.application.SinaApplication"
        >
         <!-- 必须注册在微博授权,分享微博时候用到 -->
        <activity
            android:name="com.sina.weibo.sdk.component.WeiboSdkBrowser"
            android:configChanges="keyboardHidden|orientation"
            android:exported="false"
            android:windowSoftInputMode="adjustResize" >
        </activity>

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/sinaweiboActionBar">

        </activity>
        <activity
            android:name="com.example.sinav1.WelcomeActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Light.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
package com.prodyna.pmu.cpa.web.shared.rest;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.prodyna.pmu.cpa.web.shared.domain.PortableSpeaker;

/**
 * Interface and JAX-RS definition for the {@code Speaker} CRUD REST service.
 *
 * @author pmueller@prodyna.com
 */
@Path("speaker")
public interface SpeakerRestService extends RestService<PortableSpeaker> {

	/**
	 * Returns a list of all available object.
	 *

	 * Note that the implementation is free to limit the number of object returned by this service method.
	 *
	 * @return a list of objects, possibly empty.
	 */
	@GET @Produces(MediaType.APPLICATION_JSON)
	public List<PortableSpeaker> list();

	/**
	 * Returns the object with the specified object identifier.
	 *
	 * @param objectId The identifier of the object to return.
	 * @return the corresponding object.
	 */
	@GET @Path("{objectId}") @Produces(MediaType.APPLICATION_JSON)
	public PortableSpeaker read(@PathParam("objectId") String objectId);

	/**
	 * Inserts a new object.
	 *
	 * @param object The object to store.
	 * @return the stored object.
	 */
	@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
	public PortableSpeaker create(PortableSpeaker object);

	/**
	 * Updates an existing object identified by the specified identifier.
	 *
	 * @param objectId The identifier of the object to update.
	 * @param object The object with which to update.
	 * @return the updated object.
	 */
	@PUT @Path("{objectId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
	public PortableSpeaker update(@PathParam("objectId") String objectId, PortableSpeaker object);

	/**
	 * Deletes the object with the specified identifier.
	 *
	 * @param objectId The identifier of the object to delete.
	 * @return the deleted object.
	 */
	@DELETE @Path("{objectId}") @Produces(MediaType.APPLICATION_JSON)
	public PortableSpeaker delete(@PathParam("objectId") String objectId);
}


text:
package Net::Amazon::Validate::ItemSearch::ca::BrowseNode;

use 5.006;
use strict;
use warnings;

sub new {
    my ($class , %options) = @_;
    my $self = {
        '_default' => 'Books',
        %options,
    };

    push @{$self->{_options}}, 'Books';
    push @{$self->{_options}}, 'Classical';
    push @{$self->{_options}}, 'DVD';
    push @{$self->{_options}}, 'ForeignBooks';
    push @{$self->{_options}}, 'Music';
    push @{$self->{_options}}, 'Software';
    push @{$self->{_options}}, 'SoftwareVideoGames';
    push @{$self->{_options}}, 'VHS';
    push @{$self->{_options}}, 'Video';
    push @{$self->{_options}}, 'VideoGames';

    bless $self, $class;
}

sub user_or_default {
    my ($self, $user) = @_;
    if (defined $user && length($user) > 0) {
        return $self->find_match($user);
    }
    return $self->default();
}

sub default {
    my ($self) = @_;
    return $self->{_default};
}

sub find_match {
    my ($self, $value) = @_;
    for (@{$self->{_options}}) {
        return $_ if lc($_) eq lc($value);
    }
    die "$value is not a valid value for ca::BrowseNode!\n";
}

1;

__END__

=head1 NAME

Net::Amazon::Validate::ItemSearch::ca::BrowseNode;

=head1 DESCRIPTION

The default value is Books, unless mode is specified.

The list of available values are:

    Books
    Classical
    DVD
    ForeignBooks
    Music
    Software
    SoftwareVideoGames
    VHS
    Video
    VideoGames

=cut


text:
layout: post
published: false
title: Its Good to be Back
subtitle: Thank you Mozilla
---
## A New Post

Firefox quantum is the new default.


text:
#pragma once

#include "math/vector_types.h"

#include "materials/bsdfs/bsdf_lobe.h"

namespace Lantern {

struct SurfaceInteraction;
class UniformSampler;
class Texture;

class BSDF {
public:
	BSDF(BSDFLobe::Type supportedLobes, Texture *albedoTexture)
		: SupportedLobes(supportedLobes),
		  m_albedoTexture(albedoTexture) {
	}
	virtual ~BSDF() = default;

public:
	BSDFLobe::Type SupportedLobes;

protected:
	Texture *m_albedoTexture;

public:
	virtual float3 Eval(SurfaceInteraction &interaction) const = 0;
	virtual void Sample(SurfaceInteraction &interaction, UniformSampler *sampler) const = 0;
	virtual float Pdf(SurfaceInteraction &interaction) const = 0;
};

} // End of namespace Lantern


text:
package flate

import (
	"encoding/binary"
	"fmt"
	"math/bits"
)

type fastEnc interface {
	Encode(dst *tokens, src []byte)
	Reset()
}

func newFastEnc(level int) fastEnc {
	switch level {
	case 1:
		return &fastEncL1{fastGen: fastGen{cur: maxStoreBlockSize}}
	case 2:
		return &fastEncL2{fastGen: fastGen{cur: maxStoreBlockSize}}
	case 3:
		return &fastEncL3{fastGen: fastGen{cur: maxStoreBlockSize}}
	case 4:
		return &fastEncL4{fastGen: fastGen{cur: maxStoreBlockSize}}
	case 5:
		return &fastEncL5{fastGen: fastGen{cur: maxStoreBlockSize}}
	case 6:
		return &fastEncL6{fastGen: fastGen{cur: maxStoreBlockSize}}
	default:
		panic("invalid level specified")
	}
}

const (
	tableBits       = 15             // Bits used in the table
	tableSize       = 1 << tableBits // Size of the table
	tableShift      = 32 - tableBits // Right-shift to get the tableBits most significant bits of a uint32.
	baseMatchOffset = 1              // The smallest match offset
	baseMatchLength = 3              // The smallest match length per the RFC section 3.2.5
	maxMatchOffset  = 1 << 15        // The largest match offset

	bTableBits   = 17                                               // Bits used in the big tables
	bTableSize   = 1 << bTableBits                                  // Size of the table
	allocHistory = maxStoreBlockSize * 5                            // Size to preallocate for history.
	bufferReset  = (1 << 31) - allocHistory - maxStoreBlockSize - 1 // Reset the buffer offset when reaching this.
)

const (
	prime3bytes = 506832829
	prime4bytes = 2654435761
	prime5bytes = 889523592379
	prime6bytes = 227718039650203
	prime7bytes = 58295818150454627
	prime8bytes = 0xcf1bbcdcb7a56463
)

func load32(b []byte, i int) uint32 {
	// Help the compiler eliminate bounds checks on the read so it can be done in a single read.
	b = b[i:]
	b = b[:4]
	return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
}

func load64(b []byte, i int) uint64 {
	return binary.LittleEndian.Uint64(b[i:])
}

func load3232(b []byte, i int32) uint32 {
	return binary.LittleEndian.Uint32(b[i:])
}

func load6432(b []byte, i int32) uint64 {
	return binary.LittleEndian.Uint64(b[i:])
}

func hash(u uint32) uint32 {
	return (u * 0x1e35a7bd) >> tableShift
}

type tableEntry struct {
	offset int32
}

// fastGen maintains the table for matches,
// and the previous byte block for level 2.
// This is the generic implementation.
type fastGen struct {
	hist []byte
	cur  int32
}

func (e *fastGen) addBlock(src []byte) int32 {
	// check if we have space already
	if len(e.hist)+len(src) > cap(e.hist) {
		if cap(e.hist) == 0 {
			e.hist = make([]byte, 0, allocHistory)
		} else {
			if cap(e.hist) < maxMatchOffset*2 {
				panic("unexpected buffer size")
			}
			// Move down
			offset := int32(len(e.hist)) - maxMatchOffset
			copy(e.hist[0:maxMatchOffset], e.hist[offset:])
			e.cur += offset
			e.hist = e.hist[:maxMatchOffset]
		}
	}
	s := int32(len(e.hist))
	e.hist = append(e.hist, src...)
	return s
}

// hash4 returns the hash of u to fit in a hash table with h bits.
// Preferably h should be a constant and should always be <32.
func hash4u(u uint32, h uint8) uint32 {
	return (u * prime4bytes) >> ((32 - h) & reg8SizeMask32)
}

type tableEntryPrev struct {
	Cur  tableEntry
	Prev tableEntry
}

// hash4x64 returns the hash of the lowest 4 bytes of u to fit in a hash table with h bits.
// Preferably h should be a constant and should always be <32.
func hash4x64(u uint64, h uint8) uint32 {
	return (uint32(u) * prime4bytes) >> ((32 - h) & reg8SizeMask32)
}

// hash7 returns the hash of the lowest 7 bytes of u to fit in a hash table with h bits.
// Preferably h should be a constant and should always be <64.
func hash7(u uint64, h uint8) uint32 {
	return uint32(((u << (64 - 56)) * prime7bytes) >> ((64 - h) & reg8SizeMask64))
}

// hash8 returns the hash of u to fit in a hash table with h bits.
// Preferably h should be a constant and should always be <64.
func hash8(u uint64, h uint8) uint32 {
	return uint32((u * prime8bytes) >> ((64 - h) & reg8SizeMask64))
}

// hash6 returns the hash of the lowest 6 bytes of u to fit in a hash table with h bits.
// Preferably h should be a constant and should always be <64.
func hash6(u uint64, h uint8) uint32 {
	return uint32(((u << (64 - 48)) * prime6bytes) >> ((64 - h) & reg8SizeMask64))
}

// matchlen will return the match length between offsets and t in src.
// The maximum length returned is maxMatchLength - 4.
// It is assumed that s > t, that t >=0 and s < len(src).
func (e *fastGen) matchlen(s, t int32, src []byte) int32 {
	if debugDecode {
		if t >= s {
			panic(fmt.Sprint("t >=s:", t, s))
		}
		if int(s) >= len(src) {
			panic(fmt.Sprint("s >= len(src):", s, len(src)))
		}
		if t < 0 {
			panic(fmt.Sprint("t < 0:", t))
		}
		if s-t > maxMatchOffset {
			panic(fmt.Sprint(s, "-", t, "(", s-t, ") > maxMatchLength (", maxMatchOffset, ")"))
		}
	}
	s1 := int(s) + maxMatchLength - 4
	if s1 > len(src) {
		s1 = len(src)
	}

	// Extend the match to be as long as possible.
	return int32(matchLen(src[s:s1], src[t:]))
}

// matchlenLong will return the match length between offsets and t in src.
// It is assumed that s > t, that t >=0 and s < len(src).
func (e *fastGen) matchlenLong(s, t int32, src []byte) int32 {
	if debugDeflate {
		if t >= s {
			panic(fmt.Sprint("t >=s:", t, s))
		}
		if int(s) >= len(src) {
			panic(fmt.Sprint("s >= len(src):", s, len(src)))
		}
		if t < 0 {
			panic(fmt.Sprint("t < 0:", t))
		}
		if s-t > maxMatchOffset {
			panic(fmt.Sprint(s, "-", t, "(", s-t, ") > maxMatchLength (", maxMatchOffset, ")"))
		}
	}
	// Extend the match to be as long as possible.
	return int32(matchLen(src[s:], src[t:]))
}

// Reset the encoding table.
func (e *fastGen) Reset() {
	if cap(e.hist) < allocHistory {
		e.hist = make([]byte, 0, allocHistory)
	}
	// We offset current position so everything will be out of reach.
	// If we are above the buffer reset it will be cleared anyway since len(hist) == 0.
	if e.cur <= bufferReset {
		e.cur += maxMatchOffset + int32(len(e.hist))
	}
	e.hist = e.hist[:0]
}

// matchLen returns the maximum length.
// 'a' must be the shortest of the two.
func matchLen(a, b []byte) int {
	var checked int

	for len(a) >= 8 {
		if diff := binary.LittleEndian.Uint64(a) ^ binary.LittleEndian.Uint64(b); diff != 0 {
			return checked + (bits.TrailingZeros64(diff) >> 3)
		}
		checked += 8
		a = a[8:]
		b = b[8:]
	}
	b = b[:len(a)]
	for i := range a {
		if a[i] != b[i] {
			return i + checked
		}
	}
	return len(a) + checked
}