text:
namespace {
const size_t kDefaultNumElementTypesToReserve = 32;
}  // namespace

namespace cc {

// CharAllocator
////////////////////////////////////////////////////
// This class deals only with char* and void*. It does allocation and passing
// out raw pointers, as well as memory deallocation when being destroyed.
class ListContainerHelper::CharAllocator {
 public:
  // CharAllocator::InnerList
  /////////////////////////////////////////////
  // This class holds the raw memory chunk, as well as information about its
  // size and availability.
  struct InnerList {
    InnerList(size_t capacity, size_t element_size, size_t alignment)
        : data(static_cast<char*>(
              base::AlignedAlloc(capacity * element_size, alignment))),
          capacity(capacity),
          size(0),
          step(element_size) {}
    InnerList(InnerList&& other) = default;
    InnerList& operator=(InnerList&& other) = default;

    std::unique_ptr<char[], base::AlignedFreeDeleter> data;
    // The number of elements in total the memory can hold. The difference
    // between capacity and size is the how many more elements this list can
    // hold.
    size_t capacity;
    // The number of elements have been put into this list.
    size_t size;
    // The size of each element is in bytes. This is used to move from between
    // elements' memory locations.
    size_t step;

    void Erase(char* position) {
      // Confident that destructor is called by caller of this function. Since
      // CharAllocator does not handle construction after
      // allocation, it doesn't handle desctrution before deallocation.
      DCHECK_LE(position, LastElement());
      DCHECK_GE(position, Begin());
      char* start = position + step;
      std::copy(start, End(), position);

      --size;
      // Decrease capacity to avoid creating not full not last InnerList.
      --capacity;
    }

    void InsertBefore(size_t alignment, char** position, size_t count) {
      DCHECK_LE(*position, LastElement() + step);
      DCHECK_GE(*position, Begin());

      // Adjust the size and capacity
      size_t old_size = size;
      size += count;
      capacity = size;

      // Allocate the new data and update the iterator's pointer.
      std::unique_ptr<char[], base::AlignedFreeDeleter> new_data(
          static_cast<char*>(base::AlignedAlloc(size * step, alignment)));
      size_t position_offset = *position - Begin();
      *position = new_data.get() + position_offset;

      // Copy the data before the inserted segment
      memcpy(new_data.get(), data.get(), position_offset);
      // Copy the data after the inserted segment.
      memcpy(new_data.get() + position_offset + count * step,
             data.get() + position_offset, old_size * step - position_offset);
      data = std::move(new_data);
    }

    bool IsEmpty() const { return !size; }
    bool IsFull() { return capacity == size; }
    size_t NumElementsAvailable() const { return capacity - size; }

    void* AddElement() {
      DCHECK_LT(size, capacity);
      ++size;
      return LastElement();
    }

    void RemoveLast() {
      DCHECK(!IsEmpty());
      --size;
    }

    char* Begin() const { return data.get(); }
    char* End() const { return data.get() + size * step; }
    char* LastElement() const { return data.get() + (size - 1) * step; }
    char* ElementAt(size_t index) const { return data.get() + index * step; }
  };

  CharAllocator(size_t alignment, size_t element_size, size_t element_count)
      // base::AlignedAlloc does not accept alignment less than sizeof(void*).
      : alignment_(std::max(sizeof(void*), alignment)),
        element_size_(element_size),
        size_(0),
        last_list_index_(0),
        last_list_(nullptr) {
    // If this fails, then alignment of elements after the first could be wrong,
    // and we need to pad sizes to fix that.
    DCHECK_EQ(element_size % alignment, 0u);
    AllocateNewList(element_count > 0 ? element_count
                                      : kDefaultNumElementTypesToReserve);
    last_list_ = &storage_[last_list_index_];
  }

  CharAllocator(const CharAllocator&) = delete;
  ~CharAllocator() = default;

  CharAllocator& operator=(const CharAllocator&) = delete;

  void* Allocate() {
    if (last_list_->IsFull()) {
      // Only allocate a new list if there isn't a spare one still there from
      // previous usage.
      if (last_list_index_ + 1 >= storage_.size())
        AllocateNewList(last_list_->capacity * 2);

      ++last_list_index_;
      last_list_ = &storage_[last_list_index_];
    }

    ++size_;
    return last_list_->AddElement();
  }

  size_t alignment() const { return alignment_; }
  size_t element_size() const { return element_size_; }
  size_t list_count() const { return storage_.size(); }
  size_t size() const { return size_; }
  bool IsEmpty() const { return size() == 0; }

  size_t Capacity() const {
    size_t capacity_sum = 0;
    for (const auto& inner_list : storage_)
      capacity_sum += inner_list.capacity;
    return capacity_sum;
  }

  void Clear() {
    // Remove all except for the first InnerList.
    DCHECK(!storage_.empty());
    storage_.erase(storage_.begin() + 1, storage_.end());
    last_list_index_ = 0;
    last_list_ = &storage_[0];
    last_list_->size = 0;
    size_ = 0;
  }

  void RemoveLast() {
    DCHECK(!IsEmpty());
    last_list_->RemoveLast();
    if (last_list_->IsEmpty() && last_list_index_ > 0) {
      --last_list_index_;
      last_list_ = &storage_[last_list_index_];

      // If there are now two empty inner lists, free one of them.
      if (last_list_index_ + 2 < storage_.size())
        storage_.pop_back();
    }
    --size_;
  }

  void Erase(PositionInCharAllocator* position) {
    DCHECK_EQ(this, position->ptr_to_container);

    // Update |position| to point to the element after the erased element.
    InnerList& list = storage_[position->vector_index];
    char* item_iterator = position->item_iterator;
    if (item_iterator == list.LastElement())
      position->Increment();

    list.Erase(item_iterator);
    // TODO(weiliangc): Free the InnerList if it is empty.
    --size_;
  }

  void InsertBefore(ListContainerHelper::Iterator* position, size_t count) {
    if (!count)
      return;

    // If |position| is End(), then append |count| elements at the end. This
    // will happen to not invalidate any iterators or memory.
    if (!position->item_iterator) {
      // Set |position| to be the first inserted element.
      Allocate();
      position->vector_index = storage_.size() - 1;
      position->item_iterator = storage_[position->vector_index].LastElement();
      // Allocate the rest.
      for (size_t i = 1; i < count; ++i)
        Allocate();
    } else {
      storage_[position->vector_index].InsertBefore(
          alignment_, &position->item_iterator, count);
      size_ += count;
    }
  }

  const InnerList& InnerListById(size_t id) const {
    DCHECK_LT(id, storage_.size());
    return storage_[id];
  }

  size_t FirstInnerListId() const {
    // |size_| > 0 means that at least one vector in |storage_| will be
    // non-empty.
    DCHECK_GT(size_, 0u);
    size_t id = 0;
    while (storage_[id].size == 0)
      ++id;
    return id;
  }

  size_t LastInnerListId() const {
    // |size_| > 0 means that at least one vector in |storage_| will be
    // non-empty.
    DCHECK_GT(size_, 0u);
    size_t id = storage_.size() - 1;
    while (storage_[id].size == 0)
      --id;
    return id;
  }

  size_t NumAvailableElementsInLastList() const {
    return last_list_->NumElementsAvailable();
  }

 private:
  void AllocateNewList(size_t list_size) {
    storage_.emplace_back(list_size, element_size_, alignment_);
  }

  std::vector<InnerList> storage_;
  const size_t alignment_;
  const size_t element_size_;

  // The number of elements in the list.
  size_t size_;

  // The index of the last list to have had elements added to it, or the only
  // list if the container has not had elements added since being cleared.
  size_t last_list_index_;

  // This is equivalent to |storage_[last_list_index_]|.
  //
  // `last_list_` is not a raw_ptr<...> for performance reasons (based on
  // analysis of sampling profiler data and tab_search:top100:2020).
  RAW_PTR_EXCLUSION InnerList* last_list_;
};

// PositionInCharAllocator
//////////////////////////////////////////////////////
ListContainerHelper::PositionInCharAllocator::PositionInCharAllocator(
    const ListContainerHelper::PositionInCharAllocator& other) = default;

ListContainerHelper::PositionInCharAllocator&
ListContainerHelper::PositionInCharAllocator::operator=(
    const ListContainerHelper::PositionInCharAllocator& other) = default;

ListContainerHelper::PositionInCharAllocator::PositionInCharAllocator(
    ListContainerHelper::CharAllocator* container,
    size_t vector_ind,
    char* item_iter)
    : ptr_to_container(container),
      vector_index(vector_ind),
      item_iterator(item_iter) {}

bool ListContainerHelper::PositionInCharAllocator::operator==(
    const ListContainerHelper::PositionInCharAllocator& other) const {
  DCHECK_EQ(ptr_to_container, other.ptr_to_container);
  return vector_index == other.vector_index &&
         item_iterator == other.item_iterator;
}

bool ListContainerHelper::PositionInCharAllocator::operator!=(
    const ListContainerHelper::PositionInCharAllocator& other) const {
  return !(*this == other);
}

ListContainerHelper::PositionInCharAllocator
ListContainerHelper::PositionInCharAllocator::Increment() {
  const auto& list = ptr_to_container->InnerListById(vector_index);
  if (item_iterator == list.LastElement()) {
    ++vector_index;
    while (vector_index < ptr_to_container->list_count()) {
      if (ptr_to_container->InnerListById(vector_index).size != 0)
        break;
      ++vector_index;
    }
    if (vector_index < ptr_to_container->list_count())
      item_iterator = ptr_to_container->InnerListById(vector_index).Begin();
    else
      item_iterator = nullptr;
  } else {
    item_iterator += list.step;
  }
  return *this;
}

ListContainerHelper::PositionInCharAllocator
ListContainerHelper::PositionInCharAllocator::ReverseIncrement() {
  const auto& list = ptr_to_container->InnerListById(vector_index);
  if (item_iterator == list.Begin()) {
    --vector_index;
    // Since |vector_index| is unsigned, we compare < list_count() instead of
    // comparing >= 0, as the variable will wrap around when it goes out of
    // range (below 0).
    while (vector_index < ptr_to_container->list_count()) {
      if (ptr_to_container->InnerListById(vector_index).size != 0)
        break;
      --vector_index;
    }
    if (vector_index < ptr_to_container->list_count()) {
      item_iterator =
          ptr_to_container->InnerListById(vector_index).LastElement();
    } else {
      item_iterator = nullptr;
    }
  } else {
    item_iterator -= list.step;
  }
  return *this;
}

// ListContainerHelper
////////////////////////////////////////////
ListContainerHelper::ListContainerHelper(size_t alignment,
                                         size_t max_size_for_derived_class,
                                         size_t num_of_elements_to_reserve_for)
    : data_(std::make_unique<CharAllocator>(alignment,
                                            max_size_for_derived_class,
                                            num_of_elements_to_reserve_for)) {}

ListContainerHelper::~ListContainerHelper() = default;

void ListContainerHelper::RemoveLast() {
  data_->RemoveLast();
}

void ListContainerHelper::EraseAndInvalidateAllPointers(
    ListContainerHelper::Iterator* position) {
  data_->Erase(position);
}

void ListContainerHelper::InsertBeforeAndInvalidateAllPointers(
    ListContainerHelper::Iterator* position,
    size_t count) {
  data_->InsertBefore(position, count);
}

ListContainerHelper::ConstReverseIterator ListContainerHelper::crbegin() const {
  if (data_->IsEmpty())
    return crend();

  size_t id = data_->LastInnerListId();
  return ConstReverseIterator(data_.get(), id,
                              data_->InnerListById(id).LastElement(), 0);
}

ListContainerHelper::ConstReverseIterator ListContainerHelper::crend() const {
  return ConstReverseIterator(data_.get(), static_cast<size_t>(-1), nullptr,
                              size());
}

ListContainerHelper::ReverseIterator ListContainerHelper::rbegin() {
  if (data_->IsEmpty())
    return rend();

  size_t id = data_->LastInnerListId();
  return ReverseIterator(data_.get(), id,
                         data_->InnerListById(id).LastElement(), 0);
}

ListContainerHelper::ReverseIterator ListContainerHelper::rend() {
  return ReverseIterator(data_.get(), static_cast<size_t>(-1), nullptr, size());
}

ListContainerHelper::ConstIterator ListContainerHelper::cbegin() const {
  if (data_->IsEmpty())
    return cend();

  size_t id = data_->FirstInnerListId();
  return ConstIterator(data_.get(), id, data_->InnerListById(id).Begin(), 0);
}

ListContainerHelper::ConstIterator ListContainerHelper::cend() const {
  if (data_->IsEmpty())
    return ConstIterator(data_.get(), 0, nullptr, size());

  size_t id = data_->list_count();
  return ConstIterator(data_.get(), id, nullptr, size());
}

ListContainerHelper::Iterator ListContainerHelper::begin() {
  if (data_->IsEmpty())
    return end();

  size_t id = data_->FirstInnerListId();
  return Iterator(data_.get(), id, data_->InnerListById(id).Begin(), 0);
}

ListContainerHelper::Iterator ListContainerHelper::end() {
  if (data_->IsEmpty())
    return Iterator(data_.get(), 0, nullptr, size());

  size_t id = data_->list_count();
  return Iterator(data_.get(), id, nullptr, size());
}

ListContainerHelper::ConstIterator ListContainerHelper::IteratorAt(
    size_t index) const {
  DCHECK_LT(index, size());
  size_t original_index = index;
  size_t list_index;
  for (list_index = 0; list_index < data_->list_count(); ++list_index) {
    size_t current_size = data_->InnerListById(list_index).size;
    if (index < current_size)
      break;
    index -= current_size;
  }
  return ConstIterator(data_.get(), list_index,
                       data_->InnerListById(list_index).ElementAt(index),
                       original_index);
}

ListContainerHelper::Iterator ListContainerHelper::IteratorAt(size_t index) {
  DCHECK_LT(index, size());
  size_t original_index = index;
  size_t list_index;
  for (list_index = 0; list_index < data_->list_count(); ++list_index) {
    size_t current_size = data_->InnerListById(list_index).size;
    if (index < current_size)
      break;
    index -= current_size;
  }
  return Iterator(data_.get(), list_index,
                  data_->InnerListById(list_index).ElementAt(index),
                  original_index);
}

void* ListContainerHelper::Allocate(size_t alignment,
                                    size_t size_of_actual_element_in_bytes) {
  DCHECK_LE(alignment, data_->alignment());
  DCHECK_LE(size_of_actual_element_in_bytes, data_->element_size());
  return data_->Allocate();
}

size_t ListContainerHelper::size() const {
  return data_->size();
}

bool ListContainerHelper::empty() const {
  return data_->IsEmpty();
}

size_t ListContainerHelper::MaxSizeForDerivedClass() const {
  return data_->element_size();
}

size_t ListContainerHelper::GetCapacityInBytes() const {
  return data_->Capacity() * data_->element_size();
}

void ListContainerHelper::clear() {
  data_->Clear();
}

size_t ListContainerHelper::AvailableSizeWithoutAnotherAllocationForTesting()
    const {
  return data_->NumAvailableElementsInLastList();
}

// ListContainerHelper::Iterator
/////////////////////////////////////////////////
ListContainerHelper::Iterator::Iterator(CharAllocator* container,
                                        size_t vector_ind,
                                        char* item_iter,
                                        size_t index)
    : PositionInCharAllocator(container, vector_ind, item_iter),
      index_(index) {}

ListContainerHelper::Iterator::~Iterator() = default;

size_t ListContainerHelper::Iterator::index() const {
  return index_;
}

// ListContainerHelper::ConstIterator
/////////////////////////////////////////////////
ListContainerHelper::ConstIterator::ConstIterator(
    const ListContainerHelper::Iterator& other)
    : PositionInCharAllocator(other), index_(other.index()) {}

ListContainerHelper::ConstIterator::ConstIterator(CharAllocator* container,
                                                  size_t vector_ind,
                                                  char* item_iter,
                                                  size_t index)
    : PositionInCharAllocator(container, vector_ind, item_iter),
      index_(index) {}

ListContainerHelper::ConstIterator::~ConstIterator() = default;

size_t ListContainerHelper::ConstIterator::index() const {
  return index_;
}

// ListContainerHelper::ReverseIterator
/////////////////////////////////////////////////
ListContainerHelper::ReverseIterator::ReverseIterator(CharAllocator* container,
                                                      size_t vector_ind,
                                                      char* item_iter,
                                                      size_t index)
    : PositionInCharAllocator(container, vector_ind, item_iter),
      index_(index) {}

ListContainerHelper::ReverseIterator::~ReverseIterator() = default;

size_t ListContainerHelper::ReverseIterator::index() const {
  return index_;
}

// ListContainerHelper::ConstReverseIterator
/////////////////////////////////////////////////
ListContainerHelper::ConstReverseIterator::ConstReverseIterator(
    const ListContainerHelper::ReverseIterator& other)
    : PositionInCharAllocator(other), index_(other.index()) {}

ListContainerHelper::ConstReverseIterator::ConstReverseIterator(
    CharAllocator* container,
    size_t vector_ind,
    char* item_iter,
    size_t index)
    : PositionInCharAllocator(container, vector_ind, item_iter),
      index_(index) {}

ListContainerHelper::ConstReverseIterator::~ConstReverseIterator() = default;

size_t ListContainerHelper::ConstReverseIterator::index() const {
  return index_;
}

}  // namespace cc


text:
"""
==============
Marching Cubes
==============

Marching cubes is an algorithm to extract a 2D surface mesh from a 3D volume.
This can be conceptualized as a 3D generalization of isolines on topographical
or weather maps. It works by iterating across the volume, looking for regions
which cross the level of interest. If such regions are found, triangulations
are generated and added to an output mesh. The final result is a set of
vertices and a set of triangular faces.

The algorithm requires a data volume and an isosurface value. For example, in
CT imaging Hounsfield units of +700 to +3000 represent bone. So, one potential
input would be a reconstructed CT set of data and the value +700, to extract
a mesh for regions of bone or bone-like density.

This implementation also works correctly on anisotropic datasets, where the
voxel spacing is not equal for every spatial dimension, through use of the
`spacing` kwarg.

"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Poly3DCollection

from skimage import measure
from skimage.draw import ellipsoid

# Generate a level set about zero of two identical ellipsoids in 3D
ellip_base = ellipsoid(6, 10, 16, levelset=True)
ellip_double = np.concatenate((ellip_base[:-1, ...],
                               ellip_base[2:, ...]), axis=0)

# Use marching cubes to obtain the surface mesh of these ellipsoids
verts, faces = measure.marching_cubes(ellip_double, 0)

# Display resulting triangular mesh using Matplotlib. This can also be done
# with mayavi (see skimage.measure.marching_cubes docstring).
fig = plt.figure(figsize=(10, 12))
ax = fig.add_subplot(111, projection='3d')

# Fancy indexing: `verts[faces]` to generate a collection of triangles
mesh = Poly3DCollection(verts[faces])
ax.add_collection3d(mesh)

ax.set_xlabel("x-axis: a = 6 per ellipsoid")
ax.set_ylabel("y-axis: b = 10")
ax.set_zlabel("z-axis: c = 16")

ax.set_xlim(0, 24)  # a = 6 (times two for 2nd ellipsoid)
ax.set_ylim(0, 20)  # b = 10
ax.set_zlim(0, 32)  # c = 16

plt.show()

redpajama_set_name: RedPajamaGithub


text:
//----------------------------------------------//
// Gamelogic Grids                              //
// http://www.gamelogic.co.za                   //
// Copyright (c) 2013 Gamelogic (Pty) Ltd       //
//----------------------------------------------//

using System;
using System.Linq;
using System.Collections.Generic;

namespace Gamelogic.Grids
{

	public partial struct FlatTriPoint :
		ISupportsVertices<PointyHexPoint>,
		ISupportsEdges<PointyRhombPoint>,
		IVertex<PointyHexPoint>
	{
		#region Constants
		public const int SpliceCount = 2;

		//I want it private, but the other part of the class needs it
		public readonly static IEnumerable<PointyHexPoint>[] VertexDirections =
		{
			new PointList<PointyHexPoint>
			{
				new PointyHexPoint(0, 1), //N
				new PointyHexPoint(0, 0), //SW
				new PointyHexPoint(1, 0), //SE
			},

			new PointList<PointyHexPoint>
			{
				new PointyHexPoint(1, 1), //NE
				new PointyHexPoint(0, 1), //NW
				new PointyHexPoint(1, 0), //S
			},
		};

		public readonly static PointList<PointyRhombPoint>[] EdgeDirections =
		{
			new PointList<PointyRhombPoint>
			{
				new PointyRhombPoint(0, 1, 0), //NE
				new PointyRhombPoint(-1, 1, 2), //NW
				new PointyRhombPoint(0, 0, 1), //S
			},

			new PointList<PointyRhombPoint>
			{
				new PointyRhombPoint(0, 1, 0), //SW
				new PointyRhombPoint(0, 1, 2), //SE
				new PointyRhombPoint(0, 1, 1), //N
			}
		};

		public readonly static PointList<PointyHexPoint>[] VertexFaceDirections =
		{
			new PointList<PointyHexPoint>
			{
				new PointyHexPoint(0, -1),
				new PointyHexPoint(-1, 0),
				new PointyHexPoint(-1, -1),
			},

			new PointList<PointyHexPoint>
			{
				new PointyHexPoint(0, 0),
				new PointyHexPoint(0, -1),
				new PointyHexPoint(-1, 0),
			},
		};
		#endregion

		#region Properties
		/**
			This is a redundant coordinate that is useful for certain algorithms and calculation.
			The coordinates of a triangle satsify this identity: X + Y + Z + I = 0.
		*/
		public int Z
		{
			get
			{
				return (BasePoint.Z - I);
			}
		}
		#endregion

		#region Magnitude
		public int DistanceFrom(FlatTriPoint other)
		{
			throw new NotImplementedException();
		}
		#endregion

		#region Colorings
		public int GetColor4()
		{
			return basePoint.GetColor2_4() + 4 * I;
		}

		public int GetColor2()
		{
			return I;
		}
		#endregion

		#region Vertices and Edges
		public PointyHexPoint PointFromVertexAnchor()
		{
			return new PointyHexPoint(X, Y);
		}

		public PointyHexPoint GetVertexAnchor()
		{
			return new PointyHexPoint(X, Y);
		}

		public IEnumerable<PointyHexPoint> GetVertices()
		{
			var vertexAnchor = GetVertexAnchor();

			return
				from vertexDirection in VertexDirections[I]
				select vertexAnchor.MoveBy(vertexDirection);
		}

		public IEnumerable<PointyRhombPoint> GetEdges()
		{
			var edgeAnchor = GetEdgeAnchor();

			return
				from edgeDirection in EdgeDirections[I]
				select edgeAnchor.MoveBy(edgeDirection);

		}

		public PointyRhombPoint GetEdgeAnchor()
		{
			return new PointyRhombPoint(X, Y, 0);
		}

		public PointyHexPoint GetVertexFaceAnchor()
		{
			return GetVertexAnchor();
		}

		public IEnumerable<PointyHexPoint> GetVertexFaces()
		{
			var vertexFaceAnchor = GetVertexFaceAnchor();
			return VertexFaceDirections[I].Select(x => x + vertexFaceAnchor);
		}
		#endregion
	}
}


text:
import * as React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import _ from 'lodash';
import { getUnhandledProps, prefix, defaultProps, refType } from '../utils';

export interface InputSearchProps {
  classPrefix?: string;
  value?: string;
  className?: string;
  children?: React.ReactNode;
  style?: React.CSSProperties;
  inputRef?: React.RefObject<any>;
  componentClass: React.ElementType;
  onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
}

class InputSearch extends React.Component<InputSearchProps> {
  static propTypes = {
    classPrefix: PropTypes.string,
    value: PropTypes.string,
    className: PropTypes.string,
    children: PropTypes.node,
    style: PropTypes.object,
    inputRef: refType,
    componentClass: PropTypes.elementType,
    onChange: PropTypes.func
  };

  handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    this.props.onChange?.(_.get(event, 'target.value'), event);
  };

  render() {
    const {
      value,
      componentClass: Component,
      children,
      className,
      classPrefix,
      inputRef,
      style,
      ...rest
    } = this.props;
    const addPrefix = prefix(classPrefix);
    const unhandled = getUnhandledProps(InputSearch, rest);

    return (
      <div className={classNames(classPrefix, className)} style={style}>
        <Component
          {...unhandled}
          ref={inputRef}
          className={addPrefix('input')}
          value={value}
          onChange={this.handleChange}
        />
        {children}
      </div>
    );
  }
}

const enhance = defaultProps<InputSearchProps>({
  classPrefix: 'picker-search',
  componentClass: 'input'
});

export default enhance(InputSearch);


text:
using System;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.ResourceManager.Resources.Models;

namespace Azure.ResourceManager.Resources
{
    internal partial class TenantsRestOperations
    {
        private Uri endpoint;
        private ClientDiagnostics _clientDiagnostics;
        private HttpPipeline _pipeline;

        /// <summary> Initializes a new instance of TenantsRestOperations. </summary>
        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
        /// <param name="endpoint"> server parameter. </param>
        public TenantsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null)
        {
            endpoint ??= new Uri("https://management.azure.com");

            this.endpoint = endpoint;
            _clientDiagnostics = clientDiagnostics;
            _pipeline = pipeline;
        }

        internal Core.HttpMessage CreateListRequest()
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;
            request.Method = RequestMethod.Get;
            var uri = new RawRequestUriBuilder();
            uri.Reset(endpoint);
            uri.AppendPath("/tenants", false);
            uri.AppendQuery("api-version", "2019-11-01", true);
            request.Uri = uri;
            return message;
        }

        /// <summary> Gets the tenants for your account. </summary>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        public async Task<Response<TenantListResult>> ListAsync(CancellationToken cancellationToken = default)
        {
            using var message = CreateListRequest();
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        TenantListResult value = default;
                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
                        if (document.RootElement.ValueKind == JsonValueKind.Null)
                        {
                            value = null;
                        }
                        else
                        {
                            value = TenantListResult.DeserializeTenantListResult(document.RootElement);
                        }
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }

        /// <summary> Gets the tenants for your account. </summary>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        public Response<TenantListResult> List(CancellationToken cancellationToken = default)
        {
            using var message = CreateListRequest();
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        TenantListResult value = default;
                        using var document = JsonDocument.Parse(message.Response.ContentStream);
                        if (document.RootElement.ValueKind == JsonValueKind.Null)
                        {
                            value = null;
                        }
                        else
                        {
                            value = TenantListResult.DeserializeTenantListResult(document.RootElement);
                        }
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }

        internal Core.HttpMessage CreateListNextPageRequest(string nextLink)
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;
            request.Method = RequestMethod.Get;
            var uri = new RawRequestUriBuilder();
            uri.Reset(endpoint);
            uri.AppendRawNextLink(nextLink, false);
            request.Uri = uri;
            return message;
        }

        /// <summary> Gets the tenants for your account. </summary>
        /// <param name="nextLink"> The URL to the next page of results. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        public async Task<Response<TenantListResult>> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default)
        {
            if (nextLink == null)
            {
                throw new ArgumentNullException(nameof(nextLink));
            }

            using var message = CreateListNextPageRequest(nextLink);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        TenantListResult value = default;
                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
                        if (document.RootElement.ValueKind == JsonValueKind.Null)
                        {
                            value = null;
                        }
                        else
                        {
                            value = TenantListResult.DeserializeTenantListResult(document.RootElement);
                        }
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }

        /// <summary> Gets the tenants for your account. </summary>
        /// <param name="nextLink"> The URL to the next page of results. </param>
        /// <param name="cancellationToken"> The cancellation token to use. </param>
        public Response<TenantListResult> ListNextPage(string nextLink, CancellationToken cancellationToken = default)
        {
            if (nextLink == null)
            {
                throw new ArgumentNullException(nameof(nextLink));
            }

            using var message = CreateListNextPageRequest(nextLink);
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
                case 200:
                    {
                        TenantListResult value = default;
                        using var document = JsonDocument.Parse(message.Response.ContentStream);
                        if (document.RootElement.ValueKind == JsonValueKind.Null)
                        {
                            value = null;
                        }
                        else
                        {
                            value = TenantListResult.DeserializeTenantListResult(document.RootElement);
                        }
                        return Response.FromValue(value, message.Response);
                    }
                default:
                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }
    }
}


text:
var webpack = require('karma-webpack');
var webpackConfig = require('./webpack/webpack.test.babel');
webpackConfig.module.loaders = [
  {
    test: /\.(js|jsx)$/, exclude: /(node_modules)/,
    loader: 'babel-loader'
  }
];
webpackConfig.module.postLoaders = [{
  test: /\.(js|jsx)$/, exclude: /(node_modules|tests)/,
  loader: 'istanbul-instrumenter'
}];

module.exports = function (config) {
  config.set({
    frameworks: [ 'jasmine' ],
    files: [
      './node_modules/phantomjs-polyfill/bind-polyfill.js',
      'tests/**/*.spec.js'
    ],
    plugins: [
      webpack,
      'karma-jasmine',
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-phantomjs-launcher',
      'karma-coverage',
      'karma-spec-reporter'
    ],
    browsers: [ 'PhantomJS' ],
    preprocessors: {
      'tests/**/*.spec.js': ['webpack'],
      'src/**/*.js': ['webpack']
    },
    reporters: [ 'spec', 'coverage' ],
    coverageReporter: {
      dir: 'build/reports/coverage',
      reporters: [
        { type: 'html', subdir: 'report-html' },
        { type: 'lcov', subdir: 'report-lcov' },
        { type: 'cobertura', subdir: '.', file: 'cobertura.txt' }
      ]
    },
    webpack: webpackConfig,
    webpackMiddleware: { noInfo: true }
  });
};


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>additional</title>
<meta name="date" content="2016-05-25">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package additional

Class Summary

Class
Description

AllUsers

Broker

class Broker, karash in ast ke, request ha ra be datacenter motanazerash az
 nazare mantaghe goghraphiayi pas dahad.

Datacenter

DatacentersTopology

Dataitem

DataitemInfo

DataitemsMap

Distribution

GeographicalZone

Link

ReplicationManager

ReplicationMap

Request

SimPareto

This class allows for the simulation of random variables
 which are Pareto-distributed.

StdRandom

The StdRandom class provides static methods for generating random
 number from various discrete and continuous distributions, including
 Bernoulli, uniform, Gaussian, exponential, pareto, Poisson, and Cauchy.

User

Workload

Enum Summary

Enum
Description

DatacentersTopology.State

RequestType

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes


text:
package com.qifun.sbtHaxe

import HaxeConfigurations._
import HaxeKeys._
import sbt.Keys._
import sbt._

/**
 * A Plugin used to compile Haxe sources to Python sources.
 */
object HaxePythonPlugin extends AutoPlugin {

  override final def requires = BaseHaxePlugin

  override final lazy val projectSettings: Seq[Setting[_]] = {
    sbt.addArtifact(artifact in packageBin in HaxePython, packageBin in HaxePython) ++
      inConfig(Python)(SbtHaxe.baseHaxeSettings) ++
      inConfig(TestPython)(SbtHaxe.baseHaxeSettings) ++
      inConfig(HaxePython)(SbtHaxe.baseHaxeSettings) ++
      inConfig(HaxePython)(SbtHaxe.extendSettings) ++
      inConfig(TestHaxePython)(SbtHaxe.baseHaxeSettings) ++
      inConfig(TestHaxePython)(SbtHaxe.extendTestSettings) ++
      SbtHaxe.injectSettings(HaxePython, Python) ++
      SbtHaxe.injectSettings(TestHaxePython, TestPython) ++
      Seq(
        haxeXmls in Compile ++= (haxeXml in Python).value,
        haxeXmls in Test ++= (haxeXml in TestPython).value,
        haxePlatformName in Python := "python",
        haxePlatformName in TestPython := "python",
        haxeOutputPath in Python := Some(file((target in haxe in Python).value.getPath + ".py")),
        haxeOutputPath in TestPython := Some(file((target in haxe in Python).value.getPath + ".py")),
        doxRegex in Compile := SbtHaxe.buildDoxRegex((sourceDirectories in HaxePython).value),
        doxRegex in Test := SbtHaxe.buildDoxRegex((sourceDirectories in TestHaxePython).value),
        ivyConfigurations += Haxe,
        ivyConfigurations += TestHaxe,
        ivyConfigurations += HaxePython,
        ivyConfigurations += TestHaxePython)
  }
}


text:
This is a package of all llvm tools. Multiple packages are based on repackaging the binaries from this one including:

  - clang++ 3.9.0
  - clang-tidy 3.9.0
  - clang-format 3.9.0

### Details of package

This package inherits from `scripts/llvm/base/common.sh`, which is a base configuration and not an actual package itself.

Therefore to see the intricacies of how this package is built look in `scripts/llvm/base/common.sh`.

The `scripts/llvm/base/common.sh` is used by both llvm 3.8.1 and llvm 3.9.0 packages (and future ones). It reduces duplication of package code and makes it easier to update the builds in one place to benefit all versions.

The `scripts/llvm/3.9.0/script.sh` therefore sources `scripts/llvm/base/common.sh` and then overrides just the functions that need to be customized. At the time of writing this is only the `setup_release` function. It is customized in order to provide version specific md5 values which can ensure that upstream packages do not change without us noticing.

### Details of builds

 - Done on Sept 22, 2016 by @springmeyer
 - OS X build done on OS X 10.11
 - Linux build done on ubuntu precise

The order and method of building was generally:

```sh
VERSION=3.9.0
./mason build llvm ${VERSION}
./mason publish llvm ${VERSION}
./mason build clang++ ${VERSION}
./mason publish clang++ ${VERSION}
./mason build clang-tidy ${VERSION}
./mason publish clang-tidy ${VERSION}
./mason build clang-format ${VERSION}
./mason publish clang-format ${VERSION}
./mason build lldb ${VERSION}
./mason publish lldb ${VERSION}
./mason build llvm-cov ${VERSION}
./mason publish llvm-cov ${VERSION}
```

#### OSX details

On macOS we use the apple system clang++ to compile and link against the apple system libc++.

```sh
$ clang++ -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
```

Therefore the llvm package was built like:

```sh
./mason build llvm 3.9.0
```

#### Linux details

On linux we use precise in order to ensure that binaries can be run on ubuntu precise and newer platforms.

We still want to compile clang++ in c++11 mode so we compile clang++ using a mason provided clang++.

To support c++11 we'd normally need to upgrade libstdc++ which would make it problematic for the resulting binary to be portable to linux systems without that upgraded libstdc++. So we avoid this issue by instead linking clang++ to libc++, which itself will travel inside the clang++ package.

To accomplish this (c++11 build of clang++ and linking to libc++ instead of an upgraded libstdc++) we did:

```sh
./mason install clang++ 3.9.0
CLANG_39_PREFIX=$(./mason prefix clang++ 3.9.0)
export CXX=${CLANG_39_PREFIX}/bin/clang++-3.9
export CC=${CLANG_39_PREFIX}/bin/clang-3.9
./mason build llvm 3.9.0
```

The reason `LD_LIBRARY_PATH` is set before the build is so that libc++.so can be found during linking. Once linked clang++ automatically uses the right @rpath on macOS and linux to find its own libc++.so at runtime.

TODO:

 - Modify the llvm 3.9.0 build scripts to build libc++ and libc++abi first.
 - Then we should be able to point LD_LIBRARY_PATH at llvm 3.9.0's libc++.so to avoid potential ABI mismatch with the version provided by 3.8.0
 - LD_LIBRARY_PATH would be pointed at the theoretical location of llvm 3.9.0's libc++, and that location would exist and become valid before llvm 3.9.0's clang++ is linked.

### Testing of these new tools

Once these packages were built I needed to test that they could be used to build and publish other mason packages. And I needed to be able to test that these packages worked for downstream users.

To accomplish this I branched mason and changed the `MASON_PLATFORM_ID` to enable publishing new binaries with llvm 3.9.0 tools without overwriting existing binaries.

```
diff --git a/mason.sh b/mason.sh
index 800216d..ccc1fcb 100644
--- a/mason.sh
+++ b/mason.sh
@@ -259,7 +259,7 @@ MASON_SLUG=${MASON_NAME}-${MASON_VERSION}
 if [[ ${MASON_HEADER_ONLY} == true ]]; then
     MASON_PLATFORM_ID=headers
 else
-    MASON_PLATFORM_ID=${MASON_PLATFORM}-${MASON_PLATFORM_VERSION}
+    MASON_PLATFORM_ID=${MASON_PLATFORM}-${MASON_PLATFORM_VERSION}-llvm390
 fi
 MASON_PREFIX=${MASON_ROOT}/${MASON_PLATFORM_ID}/${MASON_NAME}/${MASON_VERSION}
 MASON_BINARIES=${MASON_PLATFORM_ID}/${MASON_NAME}/${MASON_VERSION}.tar.gz
```

But changing the `MASON_PLATFORM_ID` also means that you loose access to all existing binaries for building packages. To ensure I could still bootstrap the builds I seeded this new `MASON_PLATFORM_ID` with key build tools, including the previously built llvm tools being discussed here.

```
CUSTOM_PATH="llvm390"
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/llvm/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/llvm/
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/clang++/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/clang++/
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/cmake/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/cmake/
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/ccache/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/ccache/
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/ninja/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/ninja/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/llvm/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/llvm/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/clang++/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/clang++/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/cmake/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/cmake/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/ccache/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/ccache/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/ninja/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/ninja/
```


text:
package io.netty.handler.ipfilter;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.internal.ObjectUtil;

import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.List;

/**
 *

 * This class allows one to filter new {@link Channel}s based on the
 * {@link IpFilterRule}s passed to its constructor. If no rules are provided, all connections
 * will be accepted.
 *

 *
 *

 * If you would like to explicitly take action on rejected {@link Channel}s, you should override
 * {@link AbstractRemoteAddressFilter#channelRejected(ChannelHandlerContext, SocketAddress)}.
 *

 *
 *
 Consider using {@link IpSubnetFilter} for better performance while not as
 * general purpose as this filter.

 */
@Sharable
public class RuleBasedIpFilter extends AbstractRemoteAddressFilter<InetSocketAddress> {

    private final boolean acceptIfNotFound;
    private final List<IpFilterRule> rules;

    /**
     *
 Create new Instance of {@link RuleBasedIpFilter} and filter incoming connections
     * based on their IP address and {@code rules} applied.

     *
     *
 {@code acceptIfNotFound} is set to {@code true}.

     *
     * @param rules An array of {@link IpFilterRule} containing all rules.
     */
    public RuleBasedIpFilter(IpFilterRule... rules) {
        this(true, rules);
    }

    /**
     * Create new Instance of {@link RuleBasedIpFilter} and filter incoming connections
     * based on their IP address and {@code rules} applied.
     *
     * @param acceptIfNotFound If {@code true} then accept connection from IP Address if it
     *                         doesn't match any rule.
     * @param rules            An array of {@link IpFilterRule} containing all rules.
     */
    public RuleBasedIpFilter(boolean acceptIfNotFound, IpFilterRule... rules) {
        ObjectUtil.checkNotNull(rules, "rules");

        this.acceptIfNotFound = acceptIfNotFound;
        this.rules = new ArrayList<IpFilterRule>(rules.length);

        for (IpFilterRule rule : rules) {
            if (rule != null) {
                this.rules.add(rule);
            }
        }
    }

    @Override
    protected boolean accept(ChannelHandlerContext ctx, InetSocketAddress remoteAddress) throws Exception {
        for (IpFilterRule rule : rules) {
            if (rule.matches(remoteAddress)) {
                return rule.ruleType() == IpFilterRuleType.ACCEPT;
            }
        }

        return acceptIfNotFound;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Douglas JD</title>
    <description>"Start with small"</description>
    <link>http://localhost:4000/</link>
    <atom:link href="http://localhost:4000/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Wed, 18 Oct 2017 12:14:30 +0800</pubDate>
    <lastBuildDate>Wed, 18 Oct 2017 12:14:30 +0800</lastBuildDate>
    <generator>Jekyll v3.6.0</generator>

      <item>
        <title>Another Demo blog</title>
        <description>
Lorem ipsum dolor sit amet, vivamus quis, urna ligula, aliquet wisi fermentum pellentesque. Vestibulum euismod erat urna vestibulum, per cras tempus bibendum vestibulum, cras a, mus et. Ultrices adipiscing dolor, pellentesque neque nunc eros, sit etiam quam a. Mattis magna sem sed faucibus, luctus nec egestas mauris et in est, quam libero, facilisis metus tempor dolor aenean, cursus eget venenatis faucibus lectus ante. Et ac qui et scelerisque ac, nulla in, rhoncus a imperdiet, dui ac eu euismod sed sit libero. Felis mauris quis magna felis inceptos, non magna praesent velit enim tellus et. Sed ultricies per ac ipsum pellentesque nascetur, scelerisque habitant eget cras, leo est donec. Repellat viverra pulvinar in, eros sed ipsum est, quis turpis ridiculus porttitor lectus est et, est dapibus arcu non mauris tellus. Consequat neque est donec omnis ut odio, semper a faucibus mus purus.

Tortor a velit elementum, tortor condimentum lectus turpis faucibus, amet praesent id wisi, amet phasellus, scelerisque venenatis a sed massa vitae ac. Sed ridiculus, nec sed nulla. Ut volutpat mauris vestibulum sit risus, viverra at montes nec, luctus hendrerit lectus ipsum, mollis eleifend, ipsum dictumst turpis fringilla. Magna sunt at sed, bibendum risus ut dolorem ut nam sed, non et, integer eros non justo, nulla sed erat diam magna. Sed nulla massa pellentesque. Sed augue fames ut at amet, ultrices ante litora maecenas, quam nullam tristique aenean volutpat rutrum eget, suspendisse vestibulum vel, et massa commodo ante dolor.

</description>
        <pubDate>Thu, 01 Jan 2015 13:08:00 +0800</pubDate>
        <link>http://localhost:4000/2015/01/01/another-demo-blog.html</link>
        <guid isPermaLink="true">http://localhost:4000/2015/01/01/another-demo-blog.html</guid>

        <category>machine-learning</category>

        <category>python</category>

        <category>numpy</category>

        <category>scikit-learn</category>

      </item>

      <item>
        <title>A Demo blog</title>
        <description>
Lorem ipsum dolor sit amet, vivamus quis, urna ligula, aliquet wisi fermentum pellentesque. Vestibulum euismod erat urna vestibulum, per cras tempus bibendum vestibulum, cras a, mus et. Ultrices adipiscing dolor, pellentesque neque nunc eros, sit etiam quam a.

Lorem ipsum dolor sit amet, vivamus quis, urna ligula, aliquet wisi fermentum pellentesque. Vestibulum euismod erat urna vestibulum, per cras tempus bibendum vestibulum, cras a, mus et. Ultrices adipiscing dolor, pellentesque neque nunc eros, sit etiam quam a. Mattis magna sem sed faucibus, luctus nec egestas mauris et in est, quam libero, facilisis metus tempor dolor aenean, cursus eget venenatis faucibus lectus ante. Et ac qui et scelerisque ac, nulla in, rhoncus a imperdiet, dui ac eu euismod sed sit libero. Felis mauris quis magna felis inceptos, non magna praesent velit enim tellus et. Sed ultricies per ac ipsum pellentesque nascetur, scelerisque habitant eget cras, leo est donec. Repellat viverra pulvinar in, eros sed ipsum est, quis turpis ridiculus porttitor lectus est et, est dapibus arcu non mauris tellus. Consequat neque est donec omnis ut odio, semper a faucibus mus purus.

Tortor a velit elementum, tortor condimentum lectus turpis faucibus, amet praesent id wisi, amet phasellus, scelerisque venenatis a sed massa vitae ac. Sed ridiculus, nec sed nulla. Ut volutpat mauris vestibulum sit risus, viverra at montes nec, luctus hendrerit lectus ipsum, mollis eleifend, ipsum dictumst turpis fringilla. Magna sunt at sed, bibendum risus ut dolorem ut nam sed, non et, integer eros non justo, nulla sed erat diam magna. Sed nulla massa pellentesque. Sed augue fames ut at amet, ultrices ante litora maecenas, quam nullam tristique aenean volutpat rutrum eget, suspendisse vestibulum vel, et massa commodo ante dolor.

</description>
        <pubDate>Tue, 30 Dec 2014 13:06:00 +0800</pubDate>
        <link>http://localhost:4000/2014/12/30/a-demo-blog.html</link>
        <guid isPermaLink="true">http://localhost:4000/2014/12/30/a-demo-blog.html</guid>

        <category>machine-learning</category>

        <category>python</category>

        <category>numpy</category>

        <category>scikit-learn</category>

      </item>

  </channel>
</rss>


text:
package EjercicionsTema04;

import java.util.Scanner;

/**
 * Lee un numero entero y un caracter del terminal introducidos por el usuario.
 * Repite el caracter tantas veces como se le indico.
 *
 * @author Velik Georgiev Chelebiev
 */
public class _02_RepetirCaracter {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        // Leemos el caracter que deseamos repetir
        System.out.print("Caracter: ");
        char caracter = scan.nextLine().charAt(0);

        // Leemos un numero entero que indicara las veces que se debe de
        // repetir el caracter.
        System.out.print("Repetir: ");
        int repetir = Integer.parseInt(scan.nextLine());

        // Imprimimos el caracter tantas veces como se indico en la
        // pantalla del usuario.
        System.out.println(repetirCaracter(caracter, repetir));
    }

    /**
     * Repite un caracter una serie de veces (indicada).
     *
     * @param caracter El caracter a repetir
     * @param repetir Cuantas veces se tiene que repetir el caracter
     * @return Una cadena con el caracter repatido las veces indicadas
     */
    public static String repetirCaracter(char caracter, int repetir) {
        StringBuilder resultado = new StringBuilder(repetir);

        for(int i = 0; i < repetir; i++) {
            resultado.append(caracter);
        }

        return resultado.toString();
    }
}


text:
 /*-----------------------------------------------------------------------------
  VAL - The Automatic Plan Validator for PDDL2.2

  $Date: 2009-02-05 10:50:11 $
  $Revision: 1.2 $

  Maria Fox and Derek Long - PDDL2.2 and VAL
  Stephen Cresswell - PDDL2.2 Parser
  Richard Howey - Continuous Effects, derived predicates, timed initial literals and LaTeX report in VAL

  maria.fox@cis.strath.ac.uk
  derek.long@cis.strath.ac.uk
  stephen.cresswell@cis.strath.ac.uk
  richard.howey@cis.strath.ac.uk

  By releasing this code we imply no warranty as to its reliability
  and its use is entirely at your own risk.

  Strathclyde Planning Group
  http://planning.cis.strath.ac.uk
 ----------------------------------------------------------------------------*/

#ifndef __DYNATRANSLATOR
#define __DYNATRANSLATOR

#include "WriteController.h"
#include "ptree.h"
#include <sstream>
#include <vector>
#include "VisitController.h"

using std::stringstream;
using std::vector;

namespace VAL {

class State;
class Environment;

class duration_expression {
private:
	string nm;
	const var_symbol_list * actargs;
	var_symbol_list vars;
	const expression * exp;

public:
	duration_expression(const string & op,const var_symbol_list * aargs,const var_symbol_list & vs,const expression * e) :
	 nm(op), actargs(aargs), vars(vs), exp(e)
	{};

	string createAll(State &);
	bool bindAll(Environment &,State &,const expression *);
	bool nextBinding(Environment &,State &,const expression *);
	void recordOne(stringstream &,State &,Environment &);
};

class PredWriter : public VisitController {
private:
	ostream & out;
public:
	PredWriter(ostream & o) : out(o) {};

	virtual void visit_durative_action(const durative_action * d);
};

class DYNATranslator : public WriteController {
private:
	const analysis * anlss;
	const domain * dom;
	time_spec filter;

	vector<duration_expression> duration_expressions;
	bool inInitial;
	bool showType;
	bool firstCall;

public:
	virtual ~DYNATranslator() {};
	DYNATranslator(const analysis * a) :
		anlss(a), dom(a->the_domain), filter(E_AT_START),
		inInitial(false), showType(true), firstCall(true)
	{};

	string yieldDurations();

	virtual void write_symbol(ostream & o,const symbol *);
	virtual void write_const_symbol(ostream & o,const const_symbol *);
	virtual void write_var_symbol(ostream & o,const var_symbol *);
	virtual void write_pddl_typed_symbol(ostream & o,const pddl_typed_symbol *);
	virtual void write_plus_expression(ostream & o,const plus_expression *);
	virtual void write_minus_expression(ostream & o,const minus_expression *);
	virtual void write_mul_expression(ostream & o,const mul_expression *);
	virtual void write_div_expression(ostream & o,const div_expression *);
	virtual void write_uminus_expression(ostream & o,const uminus_expression *);
	virtual void write_int_expression(ostream & o,const int_expression *);
	virtual void write_float_expression(ostream & o,const float_expression *);
	virtual void write_special_val_expr(ostream & o,const special_val_expr *);
	virtual void write_func_term(ostream & o,const func_term *);
	virtual void write_assignment(ostream & o,const assignment *);
	virtual void write_goal_list(ostream & o,const goal_list *);
	virtual void write_simple_goal(ostream & o,const simple_goal *);
	virtual void write_qfied_goal(ostream & o,const qfied_goal *);
	virtual void write_conj_goal(ostream & o,const conj_goal *);
	virtual void write_disj_goal(ostream & o,const disj_goal *);
	virtual void write_timed_goal(ostream & o,const timed_goal *);
	virtual void write_imply_goal(ostream & o,const imply_goal *);
	virtual void write_neg_goal(ostream & o,const neg_goal *);
	virtual void write_comparison(ostream & o,const comparison *);
	virtual void write_proposition(ostream & o,const proposition *);
	//virtual void write_pred_decl_list(ostream & o,const pred_decl_list *);
	//virtual void write_func_decl_list(ostream & o,const func_decl_list *);
	virtual void write_pred_decl(ostream & o,const pred_decl *);
	virtual void write_func_decl(ostream & o,const func_decl *);
	virtual void write_simple_effect(ostream & o,const simple_effect *);
	virtual void write_forall_effect(ostream & o,const forall_effect *);
	virtual void write_cond_effect(ostream & o,const cond_effect *);
	virtual void write_timed_effect(ostream & o,const timed_effect *);
	virtual void write_effect_lists(ostream & o,const effect_lists *);
	//virtual void write_operator_list(ostream & o,const operator_list *);
	virtual void write_operator_(ostream & o,const operator_ *);
	virtual void write_action(ostream & o,const action *);
	virtual void write_event(ostream & o,const event *);
	virtual void write_process(ostream & o,const process *);
	virtual void write_durative_action(ostream & o,const durative_action *);
	virtual void write_domain(ostream & o,const domain *);
	virtual void write_metric_spec(ostream & o,const metric_spec *);
	virtual void write_length_spec(ostream & o,const length_spec *);
	virtual void write_problem(ostream & o,const problem *);
	virtual void write_plan_step(ostream & o,const plan_step *);
};

};

#endif


text:
<?php

namespace Rhubarb\Stem\Aggregates;

require_once __DIR__ . "/Aggregate.php";

use Rhubarb\Stem\Models\Model;

class Sum extends Aggregate
{
    private $sum = 0;

    public function calculateByIteration(Model $model, $groupKey = "")
    {
        $column = $this->aggregatedColumnName;

        if (!isset($this->groups[$groupKey])){
            $this->groups[$groupKey] = 0;
        }

        $this->groups[$groupKey] += $model[$column];
    }

    protected function createAlias()
    {
        return "SumOf" . str_replace(".", "", $this->getAliasDerivedColumn());
    }
}


text:
using Zenject;
using UniRx;
using System;
using Service.Events;
using UnityEngine;
using System.Collections.Generic;

namespace Service.Scene{
    public class Commands : CommandsBase {

        ISceneService _sceneService;

        [Inject]
        void Initialize(
            [Inject] ISceneService sceneService
        ){
            _sceneService = sceneService;

            this.OnEvent<LoadSceneCommand>().Subscribe(e => LoadSceneCommandHandler(e)).AddTo(this);
            this.OnEvent<UnloadSceneCommand>().Subscribe(e => UnloadSceneCommandHandler(e)).AddTo(this);
            this.OnEvent<SetActiveSceneCommand>().Subscribe(e => SetActiveSceneCommandHandler(e)).AddTo(this);
            this.OnEvent<GetActiveSceneIDCommand>().Subscribe(e => GetActiveSceneIDCommandHandler(e)).AddTo(this);
            this.OnEvent<ActivateSceneCommand>().Subscribe(e => ActivateSceneCommandHandler(e)).AddTo(this);
            this.OnEvent<DeactivateSceneCommand>().Subscribe(e => DeactivateSceneCommandHandler(e)).AddTo(this);
            this.OnEvent<GetSceneRootObjectsCommand>().Subscribe(e => GetSceneRootObjectsCommandHandler(e)).AddTo(this);
        }

        /// <summary>
        /// Load scene command.
        /// </summary>
        public class LoadSceneCommand{
            public string sceneID;
            public bool additive = true;
            public bool asynchron = true;
            public bool makeActive = true;
        }
        protected void LoadSceneCommandHandler(LoadSceneCommand cmd){
            //Do not load scene if scene is already loaded and cmd.doNotLoadIfSceneAlreadyExists is set to true (default)
            //if(cmd.doNotLoadIfSceneAlreadyExists && _sceneService.IsSceneLoaded(cmd.sceneID)) return;

            if(cmd.asynchron) _sceneService.LoadAsync(cmd.sceneID, cmd.additive, cmd.makeActive);
            else _sceneService.Load(cmd.sceneID, cmd.additive, cmd.makeActive);
        }

        /// <summary>
        /// Unload scene command.
        /// </summary>
        public class UnloadSceneCommand{
            public string sceneID;
        }
        protected void UnloadSceneCommandHandler(UnloadSceneCommand cmd){
            _sceneService.Unload(cmd.sceneID);
        }

        /// <summary>
        /// Set active scene command.
        /// </summary>
        public class SetActiveSceneCommand{
            public string sceneID;
        }
        protected void SetActiveSceneCommandHandler(SetActiveSceneCommand cmd)
        {
            _sceneService.SetActiveScene(cmd.sceneID);
        }

        /// <summary>
        /// Get active scene identifier command.
        /// </summary>
        public class GetActiveSceneIDCommand{
            public string result;
        }
        protected void GetActiveSceneIDCommandHandler( GetActiveSceneIDCommand cmd){
            cmd.result = _sceneService.GetActiveSceneID();
        }

        /// <summary>
        /// Activate scene command.
        /// </summary>
        public class ActivateSceneCommand{
            public string sceneID;
        }
        protected void ActivateSceneCommandHandler( ActivateSceneCommand cmd){
            _sceneService.ActivateScene(cmd.sceneID);
        }

        /// <summary>
        /// Deactivate scene command.
        /// </summary>
        public class DeactivateSceneCommand{
            public string sceneID;
        }
        protected void DeactivateSceneCommandHandler( DeactivateSceneCommand cmd){
            _sceneService.DeactivateScene(cmd.sceneID);
        }

        /// <summary>
        /// Gets all root objects for the scene. result.Count will be 0 if scene is currently not loaded.
        /// </summary>
        public class GetSceneRootObjectsCommand {
            public string sceneID;
            public List<GameObject> result;
        }
        protected void GetSceneRootObjectsCommandHandler( GetSceneRootObjectsCommand cmd) {
            cmd.result = _sceneService.GetSceneRootObjects(cmd.sceneID);
        }
    }

    public class CommandsInstaller : Installer<CommandsInstaller>{
        public override void InstallBindings()
        {
            Commands cmds = Container.Instantiate<Commands>();
            // commented out due to zenject update (26.06.18)
            //            Container.BindAllInterfaces<Commands>().FromInstance(cmds);
        }
    }
}


text:
"use strict";

const cli = require("../fixtures/cli");
const assert = require("../fixtures/assert");
const expect = require("chai").expect;
const version = require("../../package").version;

describe("simplifyify --help", () => {
  it("should show help if called without any args", (done) => {
    cli.run("", (err, stdout) => {
      expect(err).to.be.an.instanceOf(Error);
      expect(stdout).to.match(/^Usage: simplifyify \[options\] <source-files\.\.\.\>/);
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });

  it("should exit with a nonzero if called without any args", (done) => {
    cli.run("", (err) => {
      expect(err).to.be.an.instanceOf(Error);
      expect(err.code).to.equal(1);
      done();
    });
  });

  it("should show help if called with --help", (done) => {
    cli.run("--help", (err, stdout) => {
      expect(stdout).to.match(/^Usage: simplifyify \[options\] <source-files\.\.\.\>/);
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });

  it("should exit with zero if called with --help", (done) => {
    cli.run("--help", (err) => {
      expect(err).to.equal(null);
      done();
    });
  });

  it("should show help if called with -h", (done) => {
    cli.run("--help", (err, stdout) => {
      expect(stdout).to.match(/^Usage: simplifyify \[options\] <source-files\.\.\.\>/);
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });

  it("should exit with zero if called with -h", (done) => {
    cli.run("--help", (err) => {
      expect(err).to.equal(null);
      done();
    });
  });
});

describe("simplifyify --version", () => {
  it("should output the version number if called --version", (done) => {
    cli.run("--version", (err, stdout) => {
      if (err) {
        return done(err);
      }

      expect(stdout).to.equal(version);
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });

  it("should output the version number if called -V", (done) => {
    cli.run("-V", (err, stdout) => {
      if (err) {
        return done(err);
      }

      expect(stdout).to.equal(version);
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });
});

describe("failure tests", () => {
  it("should error if called with an unknown option", (done) => {
    cli.run("-z", (err, stdout, stderr) => {
      expect(err).to.be.an.instanceOf(Error);
      expect(stderr).to.contain("unknown option");
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });

  it("should error if the entry file does not exist", (done) => {
    cli.run("some/file/that/does/not/exist.js --outfile dist/", (err, stdout, stderr) => {
      expect(err).to.be.an.instanceOf(Error);
      expect(stderr).to.equal("No matching entry files were found");
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });

  it("should error if the entry file glob does not match any files", (done) => {
    cli.run('"lib/**/*-foo-bar.js" --outfile dist/', (err, stdout, stderr) => {
      expect(err).to.be.an.instanceOf(Error);
      expect(stderr).to.equal("No matching entry files were found");
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });

  it("should error if all matching files are excluded", (done) => {
    cli.run('"lib/**/*.js" --exclude **/*.js --outfile dist/', (err, stdout, stderr) => {
      expect(err).to.be.an.instanceOf(Error);
      expect(stderr).to.equal("No matching entry files were found");
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });

  it("should error if the --standalone param is not given", (done) => {
    cli.run("lib/index.js --outfile dist/ --standalone", (err, stdout, stderr) => {
      expect(err).to.be.an.instanceOf(Error);
      expect(stderr).to.contain("argument missing");
      assert.directoryIsEmpty("es5/dist");
      done();
    });
  });
});


text:
package co.emitter.gdax.client;

import co.emitter.gdax.models.*;

import java.io.IOException;
import java.util.Collection;

/**
 * Created by jeremy on 7/3/16.
 */
public interface GDAXClient {
    Collection<Product> getProducts() throws IOException;

    OrderBook getOrderBookForProductId(String id) throws IOException;
    OrderBook getOrderBookForProduct(Product product) throws IOException;

    Ticker getTickerForProduct(Product product) throws IOException;
    Ticker getTickerForProductId(String id) throws IOException;

    Collection<Trade> getTradesForProductId(String id) throws IOException;
    Collection<Trade> getTradesForProduct(Product product) throws IOException;

    Collection<HistoricRate> getHistoricRatesForProduct(Product product) throws IOException;
    Collection<HistoricRate> getHistoricRatesForProductId(String id) throws IOException;

    Stats getStatsForProduct(Product product) throws IOException;
    Stats getStatsForProductId(String id) throws IOException;
}


text:
package net.gregbeaty.flipview;

import android.content.Context;
import android.content.res.TypedArray;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;

import java.util.ArrayList;
import java.util.List;

public class FlipView extends FrameLayout {
    public static final int SCROLL_STATE_DRAGGING = RecyclerView.SCROLL_STATE_DRAGGING;
    public static final int SCROLL_STATE_SETTLING = RecyclerView.SCROLL_STATE_SETTLING;
    public static final int SCROLL_STATE_IDLE = RecyclerView.SCROLL_STATE_IDLE;
    public static final int DISTANCE_PER_POSITION = FlipLayoutManager.DISTANCE_PER_POSITION;
    public static final int HORIZONTAL = FlipLayoutManager.HORIZONTAL;
    public static final int VERTICAL = FlipLayoutManager.VERTICAL;
    public static final int NO_POSITION = RecyclerView.NO_POSITION;

    private RecyclerView recyclerView;
    private final List<OnPositionChangeListener> onPositionChangeListeners = new ArrayList<>();
    private final List<OnScrollListener> onScrollListeners = new ArrayList<>();
    private FlipLayoutManager layoutManager;

    public FlipView(@NonNull Context context) {
        this(context, null);
    }

    public FlipView(Context context, AttributeSet attrs) {
        this(context, attrs, -1);
    }

    public FlipView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        init(context, attrs, defStyleAttr);
    }

    private void init(Context context, AttributeSet attrs, int defStyleAttr) {
        TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FlipView, defStyleAttr, 0);
        int orientation = a.getInteger(R.styleable.FlipView_android_orientation, VERTICAL);
        a.recycle();

        LayoutInflater inflate = LayoutInflater.from(context);
        View view = inflate.inflate(R.layout.flip_view, this, true);
        recyclerView = view.findViewById(R.id.flip_view_recycler_view);

        recyclerView.setHasFixedSize(true);
        recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                FlipView.this.onScrollStateChanged(newState);

                for (OnScrollListener listener : onScrollListeners) {
                    listener.onScrollStateChanged(FlipView.this, newState);
                }
            }

            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);

                FlipView.this.onScrolled(dx, dy);

                for (OnScrollListener listener : onScrollListeners) {
                    listener.onScrolled(FlipView.this, dx, dy);
                }
            }
        });

        layoutManager = new FlipLayoutManager(recyclerView, orientation);
        layoutManager.setOnPositionListener(new FlipLayoutManager.OnPositionChangeListener() {
            @Override
            public void onPositionChange(FlipLayoutManager flipLayoutManager, int position) {
                for (OnPositionChangeListener listener : onPositionChangeListeners) {
                    listener.onPositionChange(FlipView.this, position);
                }
            }
        });

        recyclerView.setLayoutManager(layoutManager);
    }

    public RecyclerView.Adapter getAdapter() {
        return recyclerView.getAdapter();
    }

    public void setAdapter(RecyclerView.Adapter adapter) {
        recyclerView.setAdapter(adapter);
    }

    public int getScrollState() {
        return recyclerView.getScrollState();
    }

    public int getAngle() {
        return layoutManager.getAngle();
    }

    public int getScrollDistance() {
        return layoutManager.getScrollDistance();
    }

    public int getPosition() {
        return layoutManager.getCurrentPosition();
    }

    public void addOnPositionChangeListener(OnPositionChangeListener listener) {
        if (listener != null) {
            onPositionChangeListeners.add(listener);
        }
    }

    public void removeOnPositionChangeListener(OnPositionChangeListener listener) {
        if (listener != null) {
            onPositionChangeListeners.remove(listener);
        }
    }

    public void clearOnPositionChangeListeners() {
        onPositionChangeListeners.clear();
    }

    public void addOnScrollListener(OnScrollListener listener) {
        if (listener != null) {
            onScrollListeners.add(listener);
        }
    }

    public void removeOnScrollListener(OnScrollListener listener) {
        if (listener != null) {
            onScrollListeners.remove(listener);
        }
    }

    public void clearOnScrollListener() {
        onScrollListeners.clear();
    }

    protected void onScrollStateChanged(int newState) {
    }

    protected void onScrolled(int dx, int dy) {
    }

    public void smoothScrollToPosition(int position) {
        recyclerView.smoothScrollToPosition(position);
    }

    public void smoothScrollBy(int scrollX, int scrollY) {
        recyclerView.smoothScrollBy(scrollX, scrollY);
    }

    @Override
    public void scrollBy(int x, int y) {
        recyclerView.scrollBy(x, y);
    }

    @Override
    public void scrollTo(int x, int y) {
        recyclerView.scrollTo(x, y);
    }

    public void scrollToPosition(int position) {
        recyclerView.scrollToPosition(position);
    }

    public interface OnScrollListener {
        void onScrolled(FlipView flipView, int dx, int dy);

        void onScrollStateChanged(FlipView flipView, int newState);
    }

    public interface OnPositionChangeListener {
        void onPositionChange(FlipView flipView, int position);
    }
}


text:
<?php

/**
 * This code was generated by
 * \ / _    _  _|   _  _
 * | (_)\/(_)(_|\/| |(/_  v1.0.0
 * /       /
 */

namespace Twilio\Rest\Api\V2010\Account\Call;

use Twilio\Options;
use Twilio\Values;

abstract class RecordingOptions {
    /**
     * @param string $recordingStatusCallbackEvent The recording status changes
     *                                             that should generate a callback
     * @param string $recordingStatusCallback The callback URL on each selected
     *                                        recording event
     * @param string $recordingStatusCallbackMethod The HTTP method we should use
     *                                              when calling the
     *                                              recording_status_callback URL
     * @param string $trim Whether to trim the silence in the recording
     * @param string $recordingChannels The number of channels that the output
     *                                  recording will be configured with
     * @return CreateRecordingOptions Options builder
     */
    public static function create($recordingStatusCallbackEvent = Values::NONE, $recordingStatusCallback = Values::NONE, $recordingStatusCallbackMethod = Values::NONE, $trim = Values::NONE, $recordingChannels = Values::NONE) {
        return new CreateRecordingOptions($recordingStatusCallbackEvent, $recordingStatusCallback, $recordingStatusCallbackMethod, $trim, $recordingChannels);
    }

    /**
     * @param string $pauseBehavior Whether to record or not during the pause
     *                              period.
     * @return UpdateRecordingOptions Options builder
     */
    public static function update($pauseBehavior = Values::NONE) {
        return new UpdateRecordingOptions($pauseBehavior);
    }

    /**
     * @param string $dateCreatedBefore The `YYYY-MM-DD` value of the resources to
     *                                  read
     * @param string $dateCreated The `YYYY-MM-DD` value of the resources to read
     * @param string $dateCreatedAfter The `YYYY-MM-DD` value of the resources to
     *                                 read
     * @return ReadRecordingOptions Options builder
     */
    public static function read($dateCreatedBefore = Values::NONE, $dateCreated = Values::NONE, $dateCreatedAfter = Values::NONE) {
        return new ReadRecordingOptions($dateCreatedBefore, $dateCreated, $dateCreatedAfter);
    }
}

class CreateRecordingOptions extends Options {
    /**
     * @param string $recordingStatusCallbackEvent The recording status changes
     *                                             that should generate a callback
     * @param string $recordingStatusCallback The callback URL on each selected
     *                                        recording event
     * @param string $recordingStatusCallbackMethod The HTTP method we should use
     *                                              when calling the
     *                                              recording_status_callback URL
     * @param string $trim Whether to trim the silence in the recording
     * @param string $recordingChannels The number of channels that the output
     *                                  recording will be configured with
     */
    public function __construct($recordingStatusCallbackEvent = Values::NONE, $recordingStatusCallback = Values::NONE, $recordingStatusCallbackMethod = Values::NONE, $trim = Values::NONE, $recordingChannels = Values::NONE) {
        $this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent;
        $this->options['recordingStatusCallback'] = $recordingStatusCallback;
        $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod;
        $this->options['trim'] = $trim;
        $this->options['recordingChannels'] = $recordingChannels;
    }

    /**
     * The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space.
     *
     * @param string $recordingStatusCallbackEvent The recording status changes
     *                                             that should generate a callback
     * @return $this Fluent Builder
     */
    public function setRecordingStatusCallbackEvent($recordingStatusCallbackEvent) {
        $this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent;
        return $this;
    }

    /**
     * The URL we call using the `recording_status_callback_method` on each recording event specified in  `recording_status_callback_event`. For more information, see [RecordingStatusCallback parameters](https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback).
     *
     * @param string $recordingStatusCallback The callback URL on each selected
     *                                        recording event
     * @return $this Fluent Builder
     */
    public function setRecordingStatusCallback($recordingStatusCallback) {
        $this->options['recordingStatusCallback'] = $recordingStatusCallback;
        return $this;
    }

    /**
     * The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET`, `POST` and the default is `POST`.
     *
     * @param string $recordingStatusCallbackMethod The HTTP method we should use
     *                                              when calling the
     *                                              recording_status_callback URL
     * @return $this Fluent Builder
     */
    public function setRecordingStatusCallbackMethod($recordingStatusCallbackMethod) {
        $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod;
        return $this;
    }

    /**
     * Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not.
     *
     * @param string $trim Whether to trim the silence in the recording
     * @return $this Fluent Builder
     */
    public function setTrim($trim) {
        $this->options['trim'] = $trim;
        return $this;
    }

    /**
     * The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels.
     *
     * @param string $recordingChannels The number of channels that the output
     *                                  recording will be configured with
     * @return $this Fluent Builder
     */
    public function setRecordingChannels($recordingChannels) {
        $this->options['recordingChannels'] = $recordingChannels;
        return $this;
    }

    /**
     * Provide a friendly representation
     *
     * @return string Machine friendly representation
     */
    public function __toString() {
        $options = array();
        foreach ($this->options as $key => $value) {
            if ($value != Values::NONE) {
                $options[] = "$key=$value";
            }
        }
        return '[Twilio.Api.V2010.CreateRecordingOptions ' . implode(' ', $options) . ']';
    }
}

class UpdateRecordingOptions extends Options {
    /**
     * @param string $pauseBehavior Whether to record or not during the pause
     *                              period.
     */
    public function __construct($pauseBehavior = Values::NONE) {
        $this->options['pauseBehavior'] = $pauseBehavior;
    }

    /**
     * Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`.
     *
     * @param string $pauseBehavior Whether to record or not during the pause
     *                              period.
     * @return $this Fluent Builder
     */
    public function setPauseBehavior($pauseBehavior) {
        $this->options['pauseBehavior'] = $pauseBehavior;
        return $this;
    }

    /**
     * Provide a friendly representation
     *
     * @return string Machine friendly representation
     */
    public function __toString() {
        $options = array();
        foreach ($this->options as $key => $value) {
            if ($value != Values::NONE) {
                $options[] = "$key=$value";
            }
        }
        return '[Twilio.Api.V2010.UpdateRecordingOptions ' . implode(' ', $options) . ']';
    }
}

class ReadRecordingOptions extends Options {
    /**
     * @param string $dateCreatedBefore The `YYYY-MM-DD` value of the resources to
     *                                  read
     * @param string $dateCreated The `YYYY-MM-DD` value of the resources to read
     * @param string $dateCreatedAfter The `YYYY-MM-DD` value of the resources to
     *                                 read
     */
    public function __construct($dateCreatedBefore = Values::NONE, $dateCreated = Values::NONE, $dateCreatedAfter = Values::NONE) {
        $this->options['dateCreatedBefore'] = $dateCreatedBefore;
        $this->options['dateCreated'] = $dateCreated;
        $this->options['dateCreatedAfter'] = $dateCreatedAfter;
    }

    /**
     * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality, such as `<=YYYY-MM-DD` for recordings generated at or before midnight on a date, and `>=YYYY-MM-DD` for recordings generated at or after midnight on a date.
     *
     * @param string $dateCreatedBefore The `YYYY-MM-DD` value of the resources to
     *                                  read
     * @return $this Fluent Builder
     */
    public function setDateCreatedBefore($dateCreatedBefore) {
        $this->options['dateCreatedBefore'] = $dateCreatedBefore;
        return $this;
    }

    /**
     * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality, such as `<=YYYY-MM-DD` for recordings generated at or before midnight on a date, and `>=YYYY-MM-DD` for recordings generated at or after midnight on a date.
     *
     * @param string $dateCreated The `YYYY-MM-DD` value of the resources to read
     * @return $this Fluent Builder
     */
    public function setDateCreated($dateCreated) {
        $this->options['dateCreated'] = $dateCreated;
        return $this;
    }

    /**
     * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality, such as `<=YYYY-MM-DD` for recordings generated at or before midnight on a date, and `>=YYYY-MM-DD` for recordings generated at or after midnight on a date.
     *
     * @param string $dateCreatedAfter The `YYYY-MM-DD` value of the resources to
     *                                 read
     * @return $this Fluent Builder
     */
    public function setDateCreatedAfter($dateCreatedAfter) {
        $this->options['dateCreatedAfter'] = $dateCreatedAfter;
        return $this;
    }

    /**
     * Provide a friendly representation
     *
     * @return string Machine friendly representation
     */
    public function __toString() {
        $options = array();
        foreach ($this->options as $key => $value) {
            if ($value != Values::NONE) {
                $options[] = "$key=$value";
            }
        }
        return '[Twilio.Api.V2010.ReadRecordingOptions ' . implode(' ', $options) . ']';
    }
}


text:
package io.transwarp.objectstore;

import org.apache.hadoop.conf.Configuration;

public class Constant {
    private static Configuration configuration = new Configuration();

    // 加载配置
    static {
        try {
            configuration.addResource("setup.xml");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    // 配置中常量
    String HBASE_TABLE_NAME;
    String HDFS_LARGE_FILE_DIR;
    String REGION_NUM;
    String MODE;
    String KERBEROS_WITH_KEYTAB_USER;
    String KERBEROS_KEYTAB;
    String KERBEROS_WITH_PASSWD_USER;
    String KERBEROS_PASSWD;
    String UPLOAD_DIR;
    String DOWNLOAD_DIR;
    String FLUSH_SIZE;
    String THREAD_POOL_SIZE;
    String THREAD_NUM;

    /**
     * 构造函数
     */
    public Constant() {
        this.HBASE_TABLE_NAME = configuration.get("hbase_table_name");
        this.HDFS_LARGE_FILE_DIR = configuration.get("hdfs_large_file_dir");
        this.REGION_NUM = configuration.get("region_num");
        this.MODE = configuration.get("mode");
        this.KERBEROS_WITH_KEYTAB_USER = configuration.get("kerberos_with_keytab_user");
        this.KERBEROS_KEYTAB = configuration.get("kerberos_keytab");
        this.KERBEROS_WITH_PASSWD_USER = configuration.get("kerberos_with_passwd_user");
        this.KERBEROS_PASSWD = configuration.get("kerberos_passwd");
        this.UPLOAD_DIR = configuration.get("upload_dir");
        this.DOWNLOAD_DIR = configuration.get("download_dir");
        this.FLUSH_SIZE = configuration.get("flush_size");
        this.THREAD_POOL_SIZE = configuration.get("thread_pool_size");
        this.THREAD_NUM = configuration.get("thread_num");
    }
}


text:
package org.apache.river.phoenix.dl;

import net.jini.security.AccessPermission;

/**
 * Represents permissions that can be used to express the access control
 * policy for the activator, the remote object handling object activation,
 * if that remote object is exported with {@link
 * net.jini.jeri.BasicJeriExporter}. This class can be passed to {@link
 * net.jini.jeri.BasicInvocationDispatcher}, and then used in security
 * policy permission grants.
 *
 *
This permission class can be used for server-side access control of
 * remote object activation initiated by the client-side {@link
 * net.jini.activation.arg.ActivationID#activate ActivationID.activate} method.
 * The server-side method name for this operation is activate.
 *
 *
An instance contains a name (also referred to as a "target name") but no
 * actions list; you either have the named permission or you don't. The
 * convention is that the target name is the fully qualified name of the
 * remote method being invoked. Wildcard matches are supported using the
 * syntax specified by {@link AccessPermission}.
 *
 *

 *

 *
The possible target names for the activator are:

 *

 * Permission Target Name
 * What the Permission Allows
 * Risks of Allowing this Permission
 *

 *

 * activate
 * invoking the activator's activate method
 * The caller can activate an object and obtain the proxy for it if it
 * knows the activation identifier.
 *

 *

 * net.jini.security.proxytrust.ProxyTrust.getProxyVerifier
 * invoking
 * {@link net.jini.security.proxytrust.ProxyTrust#getProxyVerifier
 * ProxyTrust.getProxyVerifier}
 * The caller can verify trust in activation identifiers.
 *

 *

 *
 * @author Sun Microsystems, Inc.
 * @since 2.0
 **/
public final class ActivatorPermission extends AccessPermission {
    private static final long serialVersionUID = 1133348041678833146L;

    /**
     * Creates an instance with the specified name.
     *
     * @param name the target name
     */
    public ActivatorPermission(String name) {
	super(name);
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Channels;

namespace WcfService
{
    public class UnderstoodHeadersServiceHostFactory : ServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            UnderstoodHeadersServiceHost serviceHost = new UnderstoodHeadersServiceHost(serviceType, baseAddresses);
            return serviceHost;
        }
    }

    public class UnderstoodHeadersServiceHost : TestServiceHostBase<IUnderstoodHeaders>
    {
        protected override string Address { get { return "UnderstoodHeaders"; } }

        protected override Binding GetBinding()
        {
            return new BasicHttpBinding();
        }

        public UnderstoodHeadersServiceHost(Type serviceType, params Uri[] baseAddresses)
            : base(serviceType, baseAddresses)
        {
        }
    }
}


text:
package com.lothrazar.cyclic.block.placer;

import com.lothrazar.cyclic.block.TileBlockEntityCyclic;
import com.lothrazar.cyclic.registry.TileRegistry;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;

public class TilePlacer extends TileBlockEntityCyclic implements MenuProvider {

  static enum Fields {
    REDSTONE, TIMER;
  }

  static final int MAX = 64000;
  public static final int TIMER_FULL = 500;
  ItemStackHandler inventory = new ItemStackHandler(1);
  private LazyOptional<IItemHandler> inventoryCap = LazyOptional.of(() -> inventory);

  public TilePlacer(BlockPos pos, BlockState state) {
    super(TileRegistry.PLACER.get(), pos, state);
  }

  public static void serverTick(Level level, BlockPos blockPos, BlockState blockState, TilePlacer e) {
    e.tick();
  }

  public static <E extends BlockEntity> void clientTick(Level level, BlockPos blockPos, BlockState blockState, TilePlacer e) {
    e.tick();
  }

  public void tick() {
    if (this.requiresRedstone() && !this.isPowered()) {
      setLitProperty(false);
      return;
    }
    //    Integer cost = POWERCONF.get();
    //    if (energy.getEnergyStored() < cost && (cost > 0)) {
    //      return;
    //    }
    setLitProperty(true);
    ItemStack stack = inventory.getStackInSlot(0);
    if (stack.isEmpty() || Block.byItem(stack.getItem()) == Blocks.AIR) {
      return;
    }
    Direction dir = this.getBlockState().getValue(BlockStateProperties.FACING);
    BlockPos offset = worldPosition.relative(dir);
    BlockState state = Block.byItem(stack.getItem()).defaultBlockState();
    if (level.isEmptyBlock(offset) &&
        level.setBlockAndUpdate(offset, state)) {
      stack.shrink(1);
    }
  }

  @Override
  public Component getDisplayName() {
    return new TextComponent(getType().getRegistryName().getPath());
  }

  @Override
  public AbstractContainerMenu createMenu(int i, Inventory playerInventory, Player playerEntity) {
    return new ContainerPlacer(i, level, worldPosition, playerInventory, playerEntity);
  }

  @Override
  public void invalidateCaps() {
    inventoryCap.invalidate();
    super.invalidateCaps();
  }

  @Override
  public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
    if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
      return inventoryCap.cast();
    }
    return super.getCapability(cap, side);
  }

  @Override
  public void load(CompoundTag tag) {
    inventory.deserializeNBT(tag.getCompound(NBTINV));
    super.load(tag);
  }

  @Override
  public void saveAdditional(CompoundTag tag) {
    tag.put(NBTINV, inventory.serializeNBT());
    super.saveAdditional(tag);
  }

  @Override
  public void setField(int field, int value) {
    switch (Fields.values()[field]) {
      case REDSTONE:
        this.needsRedstone = value % 2;
      break;
      case TIMER:
        timer = value;
      break;
    }
  }

  @Override
  public int getField(int field) {
    switch (Fields.values()[field]) {
      case REDSTONE:
        return this.needsRedstone;
      case TIMER:
        return timer;
    }
    return 0;
  }
}


text:
#pragma once

#include "common.h"
#include "mraa.h"
#include "types.h"

typedef struct {
    mraa_result_t (*gpio_init_pre) (int pin);
    mraa_result_t (*gpio_init_post) (mraa_gpio_context dev);

    mraa_result_t (*gpio_close_pre) (mraa_gpio_context dev);

    mraa_result_t (*gpio_mode_replace) (mraa_gpio_context dev, gpio_mode_t mode);
    mraa_result_t (*gpio_mode_pre) (mraa_gpio_context dev, gpio_mode_t mode);
    mraa_result_t (*gpio_mode_post) (mraa_gpio_context dev, gpio_mode_t mode);

    mraa_result_t (*gpio_dir_replace) (mraa_gpio_context dev, gpio_dir_t dir);
    mraa_result_t (*gpio_dir_pre) (mraa_gpio_context dev, gpio_dir_t dir);
    mraa_result_t (*gpio_dir_post) (mraa_gpio_context dev, gpio_dir_t dir);

    mraa_result_t (*gpio_write_pre) (mraa_gpio_context dev, int value);
    mraa_result_t (*gpio_write_post) (mraa_gpio_context dev, int value);
    mraa_result_t (*gpio_mmap_setup) (mraa_gpio_context dev, mraa_boolean_t en);

    mraa_result_t (*i2c_init_pre) (unsigned int bus);
    mraa_result_t (*i2c_init_post) (mraa_i2c_context dev);
    mraa_result_t (*i2c_set_frequency_replace) (mraa_i2c_context dev, mraa_i2c_mode_t mode);

    mraa_result_t (*aio_get_valid_fp) (mraa_aio_context dev);
    mraa_result_t (*aio_init_pre) (unsigned int aio);
    mraa_result_t (*aio_init_post) (mraa_aio_context dev);

    mraa_result_t (*pwm_init_pre) (int pin);
    mraa_result_t (*pwm_init_post) (mraa_pwm_context pwm);
    mraa_result_t (*pwm_period_replace) (mraa_pwm_context dev, int period);

    mraa_result_t (*spi_init_pre) (int bus);
    mraa_result_t (*spi_init_post) (mraa_spi_context spi);

    mraa_result_t (*uart_init_pre) (int index);
    mraa_result_t (*uart_init_post) (mraa_uart_context uart);
} mraa_adv_func_t;