text:
package com.github.gwtd3.api.scales;

import com.github.gwtd3.api.arrays.Array;

/**
 * {@link QuantitativeScale} with a discrete output range.
 *

 *
 * @author Anthony Schiochet
 *
 * @param <S>
 */
public abstract class DiscreteQuantitativeScale<S extends DiscreteQuantitativeScale<S>>
		extends QuantitativeScale<S> {

	protected DiscreteQuantitativeScale() {

	}

	/**
	 * Returns the extent of values in the input domain [x0, x1] for the
	 * corresponding value in the output range y, representing the inverse
	 * mapping from range to domain.
	 *

	 * This method is useful for interaction, say to determine the value in the
	 * input domain that corresponds to the pixel location under the mouse.
	 *

	 *
	 * @param y
	 *            the output value to be converted to a domain range
	 * @return the array of doubles
	 */
	public final native Array<Double> invertExtent(double y)/*-{
		return this.invertExtent(y);
	}-*/;

	/**
	 * Returns the extent of values in the input domain [x0, x1] for the
	 * corresponding value in the output range y, representing the inverse
	 * mapping from range to domain.
	 *

	 * This method is useful for interaction, say to determine the value in the
	 * input domain that corresponds to the pixel location under the mouse.
	 *

	 *
	 * @param y
	 *            the output value to be converted to a domain range
	 * @return the array of doubles
	 */
	public final native Array<Double> invertExtent(String y)/*-{
		return this.invertExtent(y);
	}-*/;

}

redpajama_set_name: RedPajamaGithub


text:
import React, {useState, useEffect, FunctionComponent} from 'react'
import {connect, ConnectedProps, useDispatch} from 'react-redux'

// Components
import FluxToolbarSearch from 'src/timeMachine/components/FluxToolbarSearch'
import {
  DapperScrollbars,
  EmptyState,
  ComponentSize,
} from '@influxdata/clockface'
import VariableItem from 'src/timeMachine/components/variableToolbar/VariableItem'

// Actions
import {hydrateVariables} from 'src/variables/actions/thunks'

// Utils
import {getAllVariables, sortVariablesByName} from 'src/variables/selectors'

// Types
import {AppState} from 'src/types'

interface OwnProps {
  onClickVariable: (variableName: string) => void
}

type ReduxProps = ConnectedProps<typeof connector>
type Props = OwnProps & ReduxProps

const VariableToolbar: FunctionComponent<Props> = ({
  variables,
  onClickVariable,
}) => {
  const dispatch = useDispatch()
  const [searchTerm, setSearchTerm] = useState('')
  const filteredVariables = variables.filter(v => v.name.includes(searchTerm))

  useEffect(() => {
    dispatch(hydrateVariables())
  }, [dispatch])

  let content: JSX.Element | JSX.Element[] = (
    <EmptyState size={ComponentSize.ExtraSmall}>
      <EmptyState.Text>No variables match your search</EmptyState.Text>
    </EmptyState>
  )

  if (Boolean(filteredVariables.length)) {
    content = filteredVariables.map(v => (
      <VariableItem
        variable={v}
        key={v.id}
        onClickVariable={onClickVariable}
        testID={v.name}
      />
    ))
  }

  return (
    <>
      <FluxToolbarSearch onSearch={setSearchTerm} resourceName="Variables" />
      <DapperScrollbars className="flux-toolbar--scroll-area">

{content}

      </DapperScrollbars>
    </>
  )
}

const mstp = (state: AppState) => {
  const variables = getAllVariables(state)

  return {variables: sortVariablesByName(variables)}
}

const connector = connect(mstp)

export default connector(VariableToolbar)


text:
provider_type=$1
box_version=$2
debug=false
export PACKER_LOG=1
set -e

function usage() {
  echo -e "USAGE: ${0} \ \n\taws_ami |\n\tdocker_csi_prototyper |\n\tdocker_csi_fuzz_net_app_proto |\n\tdocker_csi_transparent_browser |\n\tdocker_csi_sast |\n\tdocker_csi_www_checkip |\n\tkvm |\n\tvirtualbox |\n\tvmware\n>\n<box version || container tag to build (e.g. 2020.2.1 || latest)> <debug>"
  exit 1
}

function pack() {
  provider_type=$1
  packer_provider_template=$2
  debug=$3
  packer_secrets='packer_secrets.json'

  if $debug; then
    packer build \
      -debug \
      -only $provider_type \
      -var "box_version=${box_version}" \
      -var-file=$packer_secrets \
      $packer_provider_template
  else
    packer build \
      -only $provider_type \
      -var "box_version=${box_version}" \
      -var-file=$packer_secrets \
      $packer_provider_template
  fi
}

if [[ $# < 2 ]]; then
  usage
fi

if [[ $3 != '' ]]; then
  debug=true
fi

case $provider_type in
  "aws_ami")
    # Create Service Role for vmimport per instructions here:
    # https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html
    echo $debug
    pack amazon-ebs kali_rolling_aws_ami.json $debug
    ;;
  "docker_csi_prototyper")
    pack docker docker/kali_rolling_docker_csi_prototyper.json $debug
    ;;
  "docker_csi_fuzz_net_app_proto")
    pack docker docker/kali_rolling_docker_csi_fuzz_net_app_proto.json $debug
    ;;
  "docker_csi_transparent_browser")
    pack docker docker/kali_rolling_docker_csi_transparent_browser.json $debug
    ;;
  "docker_csi_sast")
    pack docker docker/kali_rolling_docker_csi_sast.json $debug
    ;;
  "docker_csi_www_checkip")
    pack docker docker/kali_rolling_docker_csi_www_checkip.json $debug
    ;;
  "kvm")
    rm kali_rolling_qemu_kvm_xen.box || true
    pack qemu kali_rolling_qemu_kvm_xen.json $debug
    vagrant box remove csi/kali_rolling --provider=qemu || true
    vagrant box add --box-version $box_version csi/kali_rolling
    ;;
  "virtualbox")
    rm kali_rolling_virtualbox.box || true
    pack virtualbox-iso kali_rolling_virtualbox.json $debug
    vagrant box remove csi/kali_rolling --provider=virtualbox || true
    vagrant box add --box-version $box_version csi/kali_rolling
    ;;
  "vmware")
    echo $debug
    rm kali_rolling_vmware.box || true
    pack vmware-iso kali_rolling_vmware.json $debug
    vagrant box remove csi/kali_rolling --provider=vmware_desktop || true
    vagrant box add --box-version $box_version csi/kali_rolling
    ;;
  *)
    usage
    exit 1
esac


text:
package org.opensingular.requirement.connector.sei31.ws;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Classe Java de ArrayOfUnidadeProcedimentoAberto complex type.
 *
 *
O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
 *
 *

 * <complexType name="ArrayOfUnidadeProcedimentoAberto">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="item" type="{Sei}UnidadeProcedimentoAberto" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfUnidadeProcedimentoAberto", propOrder = {
    "item"
})
public class ArrayOfUnidadeProcedimentoAberto {

    @XmlElement(nillable = true)
    protected List<UnidadeProcedimentoAberto> item;

    /**
     * Gets the value of the item property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the item property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getItem().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link UnidadeProcedimentoAberto }
     *
     *
     */
    public List<UnidadeProcedimentoAberto> getItem() {
        if (item == null) {
            item = new ArrayList<UnidadeProcedimentoAberto>();
        }
        return this.item;
    }

}


text:
//===============================================//
//  Файл:               Splash.cs
//  Назначение:         Сплеш-скрин программы
//  Разработчик:        InterWave Partnership
//===============================================//
//===============================================//
//  Подключение компонентов
//===============================================//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

//===============================================//
//  Создаем пространство имен
//===============================================//
namespace W2W_SDK{
    //===============================================//
    //  Класс Splash-скрина приложения
    //===============================================//
    public partial class Splash : Form{
        //===============================================//
        //  Конструктор класса
        //===============================================//
        public Splash(){
            InitializeComponent(); // Инициализировать компонент
        }

        //===============================================//
        //  Действие при загрузке формы
        //===============================================//
        private void Splash_Load(object sender, EventArgs e){
        }

        //===============================================//
        //  Действие при отображении формы
        //===============================================//
        private void Splash_Shown(object sender, EventArgs e){
            // Показываем Splash
            System.Threading.Thread.Sleep(5000); // Ждать 5 секунд
            this.Close(); // Закрыть форму
        }
    }
}


text:
namespace base {
class FilePath;
}

// SafeBrowsingStore provides a storage abstraction for the
// safe-browsing data used to build the bloom filter.  The items
// stored are:
//   The set of add and sub chunks seen.
//   List of SBAddPrefix (chunk_id and SBPrefix).
//   List of SBSubPrefix (chunk_id and the target SBAddPrefix).
//   List of SBAddFullHash (SBAddPrefix, time received and an SBFullHash).
//   List of SBSubFullHash (chunk_id, target SBAddPrefix, and an SBFullHash).
//
// The store is geared towards updating the data, not runtime access
// to the data (that is handled by SafeBrowsingDatabase).  Updates are
// handled similar to a SQL transaction cycle, with the new data being
// returned from FinishUpdate() (the COMMIT).  Data is not persistent
// until FinishUpdate() returns successfully.
//
// FinishUpdate() also handles dropping items who's chunk has been
// deleted, and netting out the add/sub lists (when a sub matches an
// add, both are dropped).

// GetAddChunkId(), GetAddPrefix() and GetFullHash() are exposed so
// that these items can be generically compared with each other by
// SBAddPrefixLess() and SBAddPrefixHashLess().

struct SBAddPrefix {
  int32 chunk_id;
  SBPrefix prefix;

  SBAddPrefix(int32 id, SBPrefix p) : chunk_id(id), prefix(p) {}
  SBAddPrefix() : chunk_id(), prefix() {}

  int32 GetAddChunkId() const { return chunk_id; }
  SBPrefix GetAddPrefix() const { return prefix; }
};

typedef std::deque<SBAddPrefix> SBAddPrefixes;

struct SBSubPrefix {
  int32 chunk_id;
  int32 add_chunk_id;
  SBPrefix add_prefix;

  SBSubPrefix(int32 id, int32 add_id, int prefix)
      : chunk_id(id), add_chunk_id(add_id), add_prefix(prefix) {}
  SBSubPrefix() : chunk_id(), add_chunk_id(), add_prefix() {}

  int32 GetAddChunkId() const { return add_chunk_id; }
  SBPrefix GetAddPrefix() const { return add_prefix; }
};

struct SBAddFullHash {
  int32 chunk_id;
  int32 received;
  SBFullHash full_hash;

  SBAddFullHash(int32 id, base::Time r, const SBFullHash& h)
      : chunk_id(id),
        received(static_cast<int32>(r.ToTimeT())),
        full_hash(h) {
  }

  // Provided for ReadAddHashes() implementations, which already have
  // an int32 for the time.
  SBAddFullHash(int32 id, int32 r, const SBFullHash& h)
      : chunk_id(id), received(r), full_hash(h) {}

  SBAddFullHash() : chunk_id(), received(), full_hash() {}

  int32 GetAddChunkId() const { return chunk_id; }
  SBPrefix GetAddPrefix() const { return full_hash.prefix; }
};

struct SBSubFullHash {
  int32 chunk_id;
  int32 add_chunk_id;
  SBFullHash full_hash;

  SBSubFullHash(int32 id, int32 add_id, const SBFullHash& h)
      : chunk_id(id), add_chunk_id(add_id), full_hash(h) {}
  SBSubFullHash() : chunk_id(), add_chunk_id(), full_hash() {}

  int32 GetAddChunkId() const { return add_chunk_id; }
  SBPrefix GetAddPrefix() const { return full_hash.prefix; }
};

// Determine less-than based on add chunk and prefix.
template <class T, class U>
bool SBAddPrefixLess(const T& a, const U& b) {
  if (a.GetAddChunkId() != b.GetAddChunkId())
    return a.GetAddChunkId() < b.GetAddChunkId();

  return a.GetAddPrefix() < b.GetAddPrefix();
}

// Determine less-than based on add chunk, prefix, and full hash.
// Prefix can compare differently than hash due to byte ordering,
// so it must take precedence.
template <class T, class U>
bool SBAddPrefixHashLess(const T& a, const U& b) {
  if (SBAddPrefixLess(a, b))
    return true;

  if (SBAddPrefixLess(b, a))
    return false;

  return memcmp(a.full_hash.full_hash, b.full_hash.full_hash,
                sizeof(a.full_hash.full_hash)) < 0;
}

// Process the lists for subs which knock out adds.  For any item in
// |sub_prefixes| which has a match in |add_prefixes|, knock out the
// matched items from all vectors.  Additionally remove items from
// deleted chunks.
//
// TODO(shess): Since the prefixes are uniformly-distributed hashes,
// there aren't many ways to organize the inputs for efficient
// processing.  For this reason, the vectors are sorted and processed
// in parallel.  At this time this code does the sorting internally,
// but it might make sense to make sorting an API requirement so that
// the storage can optimize for it.
void SBProcessSubs(SBAddPrefixes* add_prefixes,
                   std::vector<SBSubPrefix>* sub_prefixes,
                   std::vector<SBAddFullHash>* add_full_hashes,
                   std::vector<SBSubFullHash>* sub_full_hashes,
                   const base::hash_set<int32>& add_chunks_deleted,
                   const base::hash_set<int32>& sub_chunks_deleted);

// Records a histogram of the number of items in |prefix_misses| which
// are not in |add_prefixes|.
void SBCheckPrefixMisses(const SBAddPrefixes& add_prefixes,
                         const std::set<SBPrefix>& prefix_misses);

// TODO(shess): This uses int32 rather than int because it's writing
// specifically-sized items to files.  SBPrefix should likewise be
// explicitly sized.

// Abstract interface for storing data.
class SafeBrowsingStore {
 public:
  SafeBrowsingStore() {}
  virtual ~SafeBrowsingStore() {}

  // Sets up the information for later use, but does not necessarily
  // check whether the underlying file exists, or is valid.  If
  // |curruption_callback| is non-NULL it will be called if corruption
  // is detected, which could happen as part of any call other than
  // Delete().  The appropriate action is to use Delete() to clear the
  // store.
  virtual void Init(const base::FilePath& filename,
                    const base::Closure& corruption_callback) = 0;

  // Deletes the files which back the store, returning true if
  // successful.
  virtual bool Delete() = 0;

  // Get all Add prefixes out from the store.
  virtual bool GetAddPrefixes(SBAddPrefixes* add_prefixes) = 0;

  // Get all add full-length hashes.
  virtual bool GetAddFullHashes(
      std::vector<SBAddFullHash>* add_full_hashes) = 0;

  // Start an update.  None of the following methods should be called
  // unless this returns true.  If this returns true, the update
  // should be terminated by FinishUpdate() or CancelUpdate().
  virtual bool BeginUpdate() = 0;

  // Start a chunk of data.  None of the methods through FinishChunk()
  // should be called unless this returns true.
  // TODO(shess): Would it make sense for this to accept |chunk_id|?
  // Possibly not, because of possible confusion between sub_chunk_id
  // and add_chunk_id.
  virtual bool BeginChunk() = 0;

  virtual bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix) = 0;
  virtual bool WriteAddHash(int32 chunk_id,
                            base::Time receive_time,
                            const SBFullHash& full_hash) = 0;
  virtual bool WriteSubPrefix(int32 chunk_id,
                              int32 add_chunk_id, SBPrefix prefix) = 0;
  virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id,
                            const SBFullHash& full_hash) = 0;

  // Collect the chunk data and preferrably store it on disk to
  // release memory.  Shoul not modify the data in-place.
  virtual bool FinishChunk() = 0;

  // Track the chunks which have been seen.
  virtual void SetAddChunk(int32 chunk_id) = 0;
  virtual bool CheckAddChunk(int32 chunk_id) = 0;
  virtual void GetAddChunks(std::vector<int32>* out) = 0;
  virtual void SetSubChunk(int32 chunk_id) = 0;
  virtual bool CheckSubChunk(int32 chunk_id) = 0;
  virtual void GetSubChunks(std::vector<int32>* out) = 0;

  // Delete the indicated chunk_id.  The chunk will continue to be
  // visible until the end of the transaction.
  virtual void DeleteAddChunk(int32 chunk_id) = 0;
  virtual void DeleteSubChunk(int32 chunk_id) = 0;

  // May be called during update to verify that the storage is valid.
  // Return true if the store seems valid.  If corruption is detected,
  // calls the corruption callback and return false.
  // NOTE(shess): When storage was SQLite, there was no guarantee that
  // a structurally sound database actually contained valid data,
  // whereas SafeBrowsingStoreFile checksums the data.  For now, this
  // distinction doesn't matter.
  virtual bool CheckValidity() = 0;

  // Pass the collected chunks through SBPRocessSubs() and commit to
  // permanent storage.  The resulting add prefixes and hashes will be
  // stored in |add_prefixes_result| and |add_full_hashes_result|.
  // |pending_adds| is the set of full hashes which have been received
  // since the previous update, and is provided as a convenience
  // (could be written via WriteAddHash(), but that would flush the
  // chunk to disk).  |prefix_misses| is the set of prefixes where the
  // |GetHash()| request returned no full hashes, used for diagnostic
  // purposes.
  virtual bool FinishUpdate(
      const std::vector<SBAddFullHash>& pending_adds,
      const std::set<SBPrefix>& prefix_misses,
      SBAddPrefixes* add_prefixes_result,
      std::vector<SBAddFullHash>* add_full_hashes_result) = 0;

  // Cancel the update in process and remove any temporary disk
  // storage, leaving the original data unmodified.
  virtual bool CancelUpdate() = 0;

 private:
  DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStore);
};

#endif  // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_H_


text:
@interface AKNavigationController : UINavigationController<UITabBarControllerDelegate>

@property (nonatomic, readonly) AKNavigationBar * navigationBar;

+(BOOL)underStatusBar;
+(void)setUnderStatusBar:(BOOL)underStatusBar;

@end

@interface UIViewController (AKNavigationController)

@end


text:
namespace WestBlueGolfLeagueWeb.Models
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class matchOrderOnMatch : DbMigration
    {
        public override void Up()
        {
            AddColumn("match", "matchOrder", c => c.Int());
        }

        public override void Down()
        {
            DropColumn("match", "matchOrder");
        }
    }
}


text:
package com.goodworkalan.dispatch;

public class Ehlo extends Command {
    @Override
    public Interpreter execute(String code, String parameters, DispatchSession session, Response response) {
        return null;
    }
}


text:
#include "instrumenter.h"
#include "ir/module-utils.h"
#include "ir/names.h"
#include "support/name.h"
#include "wasm-type.h"

namespace wasm {

Instrumenter::Instrumenter(const InstrumenterConfig& config,
                           uint64_t moduleHash)
  : config(config), moduleHash(moduleHash) {}

void Instrumenter::run(Module* wasm) {
  this->wasm = wasm;

  size_t numFuncs = 0;
  ModuleUtils::iterDefinedFunctions(*wasm, [&](Function*) { ++numFuncs; });

  addGlobals(numFuncs);
  addSecondaryMemory(numFuncs);
  instrumentFuncs();
  addProfileExport(numFuncs);
}

void Instrumenter::addGlobals(size_t numFuncs) {
  if (config.storageKind != WasmSplitOptions::StorageKind::InGlobals) {
    // Don't need globals
    return;
  }
  // Create fresh global names (over-reserves, but that's ok)
  counterGlobal = Names::getValidGlobalName(*wasm, "monotonic_counter");
  functionGlobals.reserve(numFuncs);
  ModuleUtils::iterDefinedFunctions(*wasm, [&](Function* func) {
    functionGlobals.push_back(
      Names::getValidGlobalName(*wasm, func->name.toString() + "_timestamp"));
  });

  // Create and add new globals
  auto addGlobal = [&](Name name) {
    auto global = Builder::makeGlobal(
      name,
      Type::i32,
      Builder(*wasm).makeConst(Literal::makeZero(Type::i32)),
      Builder::Mutable);
    global->hasExplicitName = true;
    wasm->addGlobal(std::move(global));
  };
  addGlobal(counterGlobal);
  for (auto& name : functionGlobals) {
    addGlobal(name);
  }
}

void Instrumenter::addSecondaryMemory(size_t numFuncs) {
  if (config.storageKind != WasmSplitOptions::StorageKind::InSecondaryMemory) {
    // Don't need secondary memory
    return;
  }
  if (!wasm->features.hasMultiMemories()) {
    Fatal()
      << "error: --in-secondary-memory requires multi-memories to be enabled";
  }

  secondaryMemory =
    Names::getValidMemoryName(*wasm, config.secondaryMemoryName);
  // Create a memory with enough pages to write into
  size_t pages = (numFuncs + Memory::kPageSize - 1) / Memory::kPageSize;
  auto mem = Builder::makeMemory(secondaryMemory, pages, pages, true);
  mem->module = config.importNamespace;
  mem->base = config.secondaryMemoryName;
  wasm->addMemory(std::move(mem));
}

void Instrumenter::instrumentFuncs() {
  // Inject code at the beginning of each function to advance the monotonic
  // counter and set the function's timestamp if it hasn't already been set.
  Builder builder(*wasm);
  switch (config.storageKind) {
    case WasmSplitOptions::StorageKind::InGlobals: {
      // (if (i32.eqz (global.get $timestamp))
      //   (block
      //     (global.set $monotonic_counter
      //       (i32.add
      //         (global.get $monotonic_counter)
      //         (i32.const 1)
      //       )
      //     )
      //     (global.set $timestamp
      //       (global.get $monotonic_counter)
      //     )
      //   )
      // )
      auto globalIt = functionGlobals.begin();
      ModuleUtils::iterDefinedFunctions(*wasm, [&](Function* func) {
        func->body = builder.makeSequence(
          builder.makeIf(
            builder.makeUnary(EqZInt32,
                              builder.makeGlobalGet(*globalIt, Type::i32)),
            builder.makeSequence(
              builder.makeGlobalSet(
                counterGlobal,
                builder.makeBinary(
                  AddInt32,
                  builder.makeGlobalGet(counterGlobal, Type::i32),
                  builder.makeConst(Literal::makeOne(Type::i32)))),
              builder.makeGlobalSet(
                *globalIt, builder.makeGlobalGet(counterGlobal, Type::i32)))),
          func->body,
          func->body->type);
        ++globalIt;
      });
      break;
    }
    case WasmSplitOptions::StorageKind::InMemory:
    case WasmSplitOptions::StorageKind::InSecondaryMemory: {
      if (!wasm->features.hasAtomics()) {
        const char* command =
          config.storageKind == WasmSplitOptions::StorageKind::InMemory
            ? "in-memory"
            : "in-secondary-memory";
        Fatal() << "error: --" << command << " requires atomics to be enabled";
      }
      // (i32.atomic.store8 offset=funcidx (i32.const 0) (i32.const 1))
      Index funcIdx = 0;
      assert(!wasm->memories.empty());
      Name memoryName =
        config.storageKind == WasmSplitOptions::StorageKind::InMemory
          ? wasm->memories[0]->name
          : secondaryMemory;
      ModuleUtils::iterDefinedFunctions(*wasm, [&](Function* func) {
        func->body = builder.makeSequence(
          builder.makeAtomicStore(1,
                                  funcIdx,
                                  builder.makeConstPtr(0, Type::i32),
                                  builder.makeConst(uint32_t(1)),
                                  Type::i32,
                                  memoryName),
          func->body,
          func->body->type);
        ++funcIdx;
      });
      break;
    }
  }
}

// wasm-split profile format:
//
// The wasm-split profile is a binary format designed to be simple to produce
// and consume. It is comprised of:
//
//   1. An 8-byte module hash
//
//   2. A 4-byte timestamp for each defined function
//
// The module hash is meant to guard against bugs where the module that was
// instrumented and the module that is being split are different. The timestamps
// are non-zero for functions that were called during the instrumented run and 0
// otherwise. Functions with smaller non-zero timestamps were called earlier in
// the instrumented run than funtions with larger timestamps.

void Instrumenter::addProfileExport(size_t numFuncs) {
  // Create and export a function to dump the profile into a given memory
  // buffer. The function takes the available address and buffer size as
  // arguments and returns the total size of the profile. It only actually
  // writes the profile if the given space is sufficient to hold it.
  auto name = Names::getValidFunctionName(*wasm, config.profileExport);
  auto writeProfile = Builder::makeFunction(
    name, Signature({Type::i32, Type::i32}, Type::i32), {});
  writeProfile->hasExplicitName = true;
  writeProfile->setLocalName(0, "addr");
  writeProfile->setLocalName(1, "size");

  // Calculate the size of the profile:
  //   8 bytes module hash +
  //   4 bytes for the timestamp for each function
  const size_t profileSize = 8 + 4 * numFuncs;

  // Create the function body
  Builder builder(*wasm);
  auto getAddr = [&]() { return builder.makeLocalGet(0, Type::i32); };
  auto getSize = [&]() { return builder.makeLocalGet(1, Type::i32); };
  auto hashConst = [&]() { return builder.makeConst(int64_t(moduleHash)); };
  auto profileSizeConst = [&]() {
    return builder.makeConst(int32_t(profileSize));
  };

  // Also make sure there is a memory with enough pages to write into
  size_t pages = (profileSize + Memory::kPageSize - 1) / Memory::kPageSize;
  if (wasm->memories.empty()) {
    wasm->addMemory(Builder::makeMemory("0"));
    wasm->memories[0]->initial = pages;
    wasm->memories[0]->max = pages;
  } else if (wasm->memories[0]->initial < pages) {
    wasm->memories[0]->initial = pages;
    if (wasm->memories[0]->max < pages) {
      wasm->memories[0]->max = pages;
    }
  }

  // Write the hash followed by all the time stamps
  Expression* writeData = builder.makeStore(
    8, 0, 1, getAddr(), hashConst(), Type::i64, wasm->memories[0]->name);
  uint32_t offset = 8;

  switch (config.storageKind) {
    case WasmSplitOptions::StorageKind::InGlobals: {
      for (const auto& global : functionGlobals) {
        writeData = builder.blockify(
          writeData,
          builder.makeStore(4,
                            offset,
                            1,
                            getAddr(),
                            builder.makeGlobalGet(global, Type::i32),
                            Type::i32,
                            wasm->memories[0]->name));
        offset += 4;
      }
      break;
    }
    case WasmSplitOptions::StorageKind::InMemory:
    case WasmSplitOptions::StorageKind::InSecondaryMemory: {
      Index funcIdxVar =
        Builder::addVar(writeProfile.get(), "funcIdx", Type::i32);
      auto getFuncIdx = [&]() {
        return builder.makeLocalGet(funcIdxVar, Type::i32);
      };
      Name loadMemoryName =
        config.storageKind == WasmSplitOptions::StorageKind::InMemory
          ? wasm->memories[0]->name
          : secondaryMemory;
      // (block $outer
      //   (loop $l
      //     (br_if $outer (i32.eq (local.get $fucIdx) (i32.const numFuncs))
      //     (i32.store offset=8
      //       (i32.add
      //         (local.get $addr)
      //         (i32.mul (local.get $funcIdx) (i32.const 4))
      //       )
      //       (i32.atomic.load8_u (local.get $funcIdx))
      //     )
      //     (local.set $funcIdx
      //      (i32.add (local.get $fundIdx) (i32.const 1)
      //     )
      //     (br $l)
      //   )
      // )
      writeData = builder.blockify(
        writeData,
        builder.makeBlock(
          "outer",
          builder.makeLoop(
            "l",
            builder.blockify(
              builder.makeBreak(
                "outer",
                nullptr,
                builder.makeBinary(EqInt32,
                                   getFuncIdx(),
                                   builder.makeConst(uint32_t(numFuncs)))),
              builder.makeStore(
                4,
                offset,
                4,
                builder.makeBinary(
                  AddInt32,
                  getAddr(),
                  builder.makeBinary(
                    MulInt32, getFuncIdx(), builder.makeConst(uint32_t(4)))),
                builder.makeAtomicLoad(
                  1, 0, getFuncIdx(), Type::i32, loadMemoryName),
                Type::i32,
                wasm->memories[0]->name),
              builder.makeLocalSet(
                funcIdxVar,
                builder.makeBinary(
                  AddInt32, getFuncIdx(), builder.makeConst(uint32_t(1)))),
              builder.makeBreak("l")))));
      break;
    }
  }

  writeProfile->body = builder.makeSequence(
    builder.makeIf(builder.makeBinary(GeUInt32, getSize(), profileSizeConst()),
                   writeData),
    profileSizeConst());

  // Create an export for the function
  wasm->addFunction(std::move(writeProfile));
  wasm->addExport(
    Builder::makeExport(config.profileExport, name, ExternalKind::Function));

  // Export the memory if it is not already exported or imported.
  if (!wasm->memories[0]->imported()) {
    bool memoryExported = false;
    for (auto& ex : wasm->exports) {
      if (ex->kind == ExternalKind::Memory) {
        memoryExported = true;
        break;
      }
    }
    if (!memoryExported) {
      wasm->addExport(Builder::makeExport(
        "profile-memory",
        Names::getValidExportName(*wasm, wasm->memories[0]->name),
        ExternalKind::Memory));
    }
  }
}

} // namespace wasm


text:
DIST=../dist
POM=../pom.xml

JAR=`find $DIST -name "jgroups-raft*.jar" | grep -v source`
SRC_JAR=`find $DIST -name "jgroups-raft*.jar" | grep source`

REPO=file:$HOME/.m2/jboss-repository
FLAGS="-Dpackaging=jar -DrepositoryId=jboss-releases-repository"

echo "Deploying $JAR to $REPO"
mvn deploy:deploy-file -Dfile=$JAR -Durl=$REPO -DpomFile=$POM $FLAGS

echo "Deploying $SRC_JAR to $REPO"
mvn deploy:deploy-file -Dfile=$SRC_JAR -Durl=$REPO -DpomFile=$POM -Dclassifier=sources $FLAGS


text:
package org.ovirt.engine.api.extensions.aaa;

import java.util.Collection;

import org.ovirt.engine.api.extensions.ExtKey;
import org.ovirt.engine.api.extensions.ExtMap;
import org.ovirt.engine.api.extensions.ExtUUID;

/**
 * Acct related constants.
 */
public class Acct {

    /**
     * Invoke keys.
     */
    public static class InvokeKeys {
        /** Authz name. */
        public static final ExtKey AUTHZ_NAME = new ExtKey("AAA_ACCT_AUTHZ_NAME", String.class, "27aea820-60c7-4390-9953-1f2a254e314b");
        /** Principal name. */
        public static final ExtKey PRINCIPAL_NAME = new ExtKey("AAA_ACCT_PRINCIPAL_NAME", String.class, "3dfc4089-d2ec-40ec-89a5-71188ab89a4c");
        /** Principal id.*/
        public static final ExtKey PRINCIPAL_ID = new ExtKey("AAA_ACCT_PRINCIPAL_ID", String.class, "c34f7381-5c15-4666-b8b5-39cca36eca78");
        /** Message. */
        public static final ExtKey MESSAGE = new ExtKey("AAA_ACCT_MESSAGE", String.class, "c0dec21f-c6c1-40dc-9e0d-40e99ae0c70d");
        /**
         * Report reason.
         * @see ReportReason
         */
        public static final ExtKey REASON = new ExtKey("AAA_ACCT_REASON", Integer.class, "33fd1b4a-e098-4054-a3d5-088646689538");
        /**
         * Principal record.
         * @see PrincipalRecord
         */
        public static final ExtKey PRINCIPAL_RECORD = new ExtKey("AAA_ACCT_PRINCIPAL_RECORD", ExtMap.class, "fc7eca10-a3af-4cc2-befc-1c857b859257");
        /**
         * Resource record.
         * @see ResourceRecord
         */
        public static final ExtKey RESOURCE_RECORD = new ExtKey("AAA_ACCT_RESOURCE_RECORD", ExtMap.class, "ca20ab53-0b49-42a5-976a-e45c6c833985");
        /**
         * Operation record.
         * @see OperationRecord
         */
        public static final ExtKey OPERATION_RECORD = new ExtKey("AAA_ACCT_OPERATION_RECORD", ExtMap.class, "e85b41ff-054b-4fc5-9833-bb2581ec848d");
        /**
         * Application specific record.
         * May be sent by other extensions.
         */
        public static final ExtKey APPLICATION_SPECIFIC_RECORD = new ExtKey("AAA_ACCT_APPLICATION_SPECIFIC_RECORD", ExtMap.class, "cac7d81b-8f76-4b3e-a486-3e9a1db4d1c3");
    }

    /**
     * Invoke commands.
     */
    public static class InvokeCommands {
        /** Report. */
        public static final ExtUUID REPORT = new ExtUUID("AAA_ACCT_REPORT", "8cf4fd74-5b8f-4cd3-9b56-31804f9f8b27");
    }

    /**
     * Report reason.
     */
    public static class ReportReason {
        /** Application startup. */
        public static final int STARTUP = 0;
        /** Application shutdown. */
        public static final int SHUTDOWN = 1;
        /**
         * Authz Principal record was not found.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_NOT_FOUND = 2;
        /**
         * Login failed by any reason but locked.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_LOGIN_FAILED = 3;
        /**
         * Login failed as account is locked.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_LOGIN_LOCKED = 4;
        /**
         * Login failed as no permission.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_LOGIN_NO_PERMISSION = 5;
        /**
         * Credentials based login.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_LOGIN_CREDENTIALS = 6;
        /**
         * Login on behalf of user.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_LOGIN_NO_CREDENTAILS = 7;
        /**
         * Negotiation based login.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_LOGIN_NEGOTIATE = 8;
        /**
         * Logout.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_LOGOUT = 9;
        /**
         * Session expired.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_SESSION_EXPIRED = 10;
        /**
         * Credentials changed, such as password changed.
         * Will have {@link PrincipalRecord}.
         */
        public static final int PRINCIPAL_CREDENTIALS_CHANGED = 11;
        /**
         * Access denied.
         */
        public static final int ACCESS_DENIED = 12;
        /**
         * Resource access.
         * Will have {@link ResourceRecord}.
         */
        public static final int RESOURCE_ACCESS = 13;
        /**
         * Privileged operation.
         * Will have {@link OperationRecord}.
         */
        public static final int PRIVILEDGED_OPERATION = 14;
        /**
         * Application specific.
         * Will have proprietary record.
         */
        public static final int APPLICATION_SPECIFIC = 15;
    }

    /**
     * Principal record.
     */
    public static class PrincipalRecord {
        /**
         * Raw user.
         * In case no #PRINCIPAL available, this happens if login fails.
         */
        public static final ExtKey USER = new ExtKey("AAA_ACCT_PRINCIPAL_RECORD_USER", String.class, "3e1a1639-0812-4bf6-9c86-d1435ed5d569");
        /**
         * Authz name.
         */
        public static final ExtKey AUTHZ_NAME = new ExtKey("AAA_ACCT_AUTHZ_NAME", String.class, "019133aa-4425-48b7-bfd6-7fff160dab70");
        /**
         * Principal.
         * Optional.
         */
        public static final ExtKey PRINCIPAL = new ExtKey("AAA_ACCT_PRINCIPAL_RECORD_PRINCIPAL", String.class, "def3d205-19ed-4e9b-bb78-a3532dab64ca");
        /**
         * Authorization's authorization record.
         * Optional.
         * @see Authn.AuthRecord
         */
        public static final ExtKey AUTH_RECORD = new ExtKey("AAA_ACCT_PRINCIPAL_RECORD_AUTH_RECORD", ExtMap.class, "dffa2cd7-9235-4c44-8871-884aaf143bd4");
        /**
         * Authorization's principal record.
         * Optional.
         * @see Authz.PrincipalRecord
         */
        public static final ExtKey PRINCIPAL_RECORD = new ExtKey("AAA_ACCT_PRINCIPAL_RECORD_PRINCIPAL_RECORD", ExtMap.class, "9f8aa88f-3b5d-47aa-bc60-e3cc507a2e65");
        /**
         * Login since.
         * Number of milliseconds since January 1, 1970, 00:00:00 GMT.
         * Optional.
         */
        public static final ExtKey LOGIN_SINCE = new ExtKey("AAA_ACCT_PRINCIPAL_RECORD_LOGIN_SINCE", Long.class, "669ca17e-1419-4091-86c2-d7e66b824fee");
        /**
         * Is principal is administrator.
         * Optional.
         */
        public static final ExtKey ADMINISTRATOR = new ExtKey("AAA_ACCT_PRINCIPAL_RECORD_ADMINISTRATOR", Boolean.class, "9928992c-64b1-47d3-870b-64f51fa1b8d6");
    }

    /**
     * Resource record.
     */
    public static class ResourceRecord {
        /** Resource being accessed. */
        public static final ExtKey NAME = new ExtKey("AAA_ACCT_RESOURCE_RECORD_NAME", String.class, "588f3259-3f15-4d9b-b533-a9b99ae77eb8");
        /** Resource access. */
        public static final ExtKey ACCESS = new ExtKey("AAA_ACCT_RESOURCE_RECORD_ACCESS", String.class, "f01262b1-846b-4d54-814a-f81efba58155");
    }

    /**
     * Operation record.
     */
    public static class OperationRecord {
        /** Operation name. */
        public static final ExtKey NAME = new ExtKey("AAA_ACCT_OPERATION_RECORD_NAME", String.class, "47d9102d-6c70-46f8-a2ec-1e4e728c213b");
        /**
         * Parameters.
         * Collection of {@link ExtMap}.
         */
        public static final ExtKey PARAMETERS = new ExtKey("AAA_ACCT_OPERATION_RECORD_PARAMETERS", Collection/*<ExtMap>*/.class, "e752f6c5-2806-44e2-a80d-3f283aa8b54d");
    }
}


text:
@interface PLRuntimeHelper : NSObject

+ (NSString *)classStringForClass:(Class)klass;
+ (NSString *)modelStringForClass:(Class)klass;

@end

#pragma clang assume_nonnull end


text:
require "chargify_sandbox/version"
require 'sinatra/base'
require 'capybara_discoball'
require 'chargify_api_ares'

module ChargifySandbox
  class FakeApi < Sinatra::Base
    get '/subscriptions.json' do
      render :json, 'subscriptions'
    end

    get '/subscriptions/:id' do
      render :json, 'subscription'
    end

    post '/subscriptions.json' do
      render :json, 'subscription'
    end

    put '/subscriptions/:id.json' do
      render :json, 'updated_subscription'
    end

    delete '/subscriptions/:id' do
      render :json, 'cancelled_subscription'
    end

    get '/customers.json' do
      render :json, 'customers'
    end

    get '/customers/lookup.json' do
      render :json, 'customer'
    end

    get '/customers/:id.json' do
      render :json, 'customer'
    end

    post '/customers.json' do
      render :json, 'customer'
    end

    put '/customers/:id.json' do
      render :json, 'customer'
    end

    delete '/customers/:id.json' do
      render :json, 'customer'
    end

    get '/customers/:id/subscriptions.json' do
      render :json , 'subscriptions'
    end

    post '/subscriptions/:id/payments.json' do
      render :json, 'payments'
    end

    private

    def render(type, filename)
      content_type(type)
      fixture(filename, type)
    end

    def fixture(filename, type)
      gem_dir = File.dirname(File.expand_path(__FILE__))
      fixtures_path = File.join(gem_dir, "fixtures", "#{filename}.#{type}")
      File.open(fixtures_path).read
    end
  end

  def self.boot
    Capybara::Discoball::Runner.new(FakeApi) do |server|
      Chargify.configure do |c|
        c.site = server.url
        c.format = :json
      end
    end.boot
  end
end


text:
"""This module contains the general information for StorageVirtualDriveCreatorUsingVirtualDriveGroup ManagedObject."""

from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta

class StorageVirtualDriveCreatorUsingVirtualDriveGroupConsts:
    ACCESS_POLICY_ = ""
    ACCESS_POLICY_BLOCKED = "blocked"
    ACCESS_POLICY_DEFAULT = "default"
    ACCESS_POLICY_HIDDEN = "hidden"
    ACCESS_POLICY_READ_ONLY = "read-only"
    ACCESS_POLICY_READ_WRITE = "read-write"
    ADMIN_STATE_TRIGGER = "trigger"
    ADMIN_STATE_TRIGGERED = "triggered"
    CACHE_POLICY_ = ""
    CACHE_POLICY_CACHED_IO = "cached-io"
    CACHE_POLICY_DEFAULT = "default"
    CACHE_POLICY_DIRECT_IO = "direct-io"
    DISK_CACHE_POLICY_ = ""
    DISK_CACHE_POLICY_DEFAULT = "default"
    DISK_CACHE_POLICY_DISABLED = "disabled"
    DISK_CACHE_POLICY_ENABLED = "enabled"
    DISK_CACHE_POLICY_UNCHANGED = "unchanged"
    READ_POLICY_ = ""
    READ_POLICY_ALWAYS_READ_AHEAD = "always-read-ahead"
    READ_POLICY_DEFAULT = "default"
    READ_POLICY_NO_READ_AHEAD = "no-read-ahead"
    SHARED_VIRTUAL_DRIVE_ID_ = ""
    STRIP_SIZE_ = ""
    STRIP_SIZE_1024K = "1024k"
    STRIP_SIZE_128K = "128k"
    STRIP_SIZE_16K = "16k"
    STRIP_SIZE_256K = "256k"
    STRIP_SIZE_32K = "32k"
    STRIP_SIZE_512K = "512k"
    STRIP_SIZE_64K = "64k"
    STRIP_SIZE_8K = "8k"
    STRIP_SIZE_DEFAULT = "default"
    WRITE_POLICY_ = ""
    WRITE_POLICY_ALWAYS_WRITE_BACK = "Always Write Back"
    WRITE_POLICY_WRITE_BACK_GOOD_BBU = "Write Back Good BBU"
    WRITE_POLICY_WRITE_THROUGH = "Write Through"
    _WRITE_POLICY_ALWAYS_WRITE_BACK = "always-write-back"
    WRITE_POLICY_DEFAULT = "default"
    _WRITE_POLICY_WRITE_BACK_GOOD_BBU = "write-back-good-bbu"
    _WRITE_POLICY_WRITE_THROUGH = "write-through"

class StorageVirtualDriveCreatorUsingVirtualDriveGroup(ManagedObject):
    """This is StorageVirtualDriveCreatorUsingVirtualDriveGroup class."""

    consts = StorageVirtualDriveCreatorUsingVirtualDriveGroupConsts()
    naming_props = set([])

    mo_meta = {
        "classic": MoMeta("StorageVirtualDriveCreatorUsingVirtualDriveGroup", "storageVirtualDriveCreatorUsingVirtualDriveGroup", "virtual-drive-carve", VersionMeta.Version201a, "InputOutput", 0x3fff, [], ["admin"], [u'storageController'], [u'storageVirtualDriveWithDriveGroupSpace'], ["Get", "Set"]),
        "modular": MoMeta("StorageVirtualDriveCreatorUsingVirtualDriveGroup", "storageVirtualDriveCreatorUsingVirtualDriveGroup", "virtual-drive-carve", VersionMeta.Version2013e, "InputOutput", 0x3fff, [], ["admin"], [u'storageController'], [u'storageVirtualDriveWithDriveGroupSpace'], ["Get", "Set"])
    }

    prop_meta = {

        "classic": {
            "access_policy": MoPropertyMeta("access_policy", "accessPolicy", "string", VersionMeta.Version204c, MoPropertyMeta.READ_WRITE, 0x2, None, None, None, ["", "blocked", "default", "hidden", "read-only", "read-write"], []),
            "admin_state": MoPropertyMeta("admin_state", "adminState", "string", VersionMeta.Version201a, MoPropertyMeta.READ_WRITE, 0x4, None, None, None, ["trigger", "triggered"], []),
            "cache_policy": MoPropertyMeta("cache_policy", "cachePolicy", "string", VersionMeta.Version204c, MoPropertyMeta.READ_WRITE, 0x8, None, None, None, ["", "cached-io", "default", "direct-io"], []),
            "disk_cache_policy": MoPropertyMeta("disk_cache_policy", "diskCachePolicy", "string", VersionMeta.Version204c, MoPropertyMeta.READ_WRITE, 0x10, None, None, None, ["", "default", "disabled", "enabled", "unchanged"], []),
            "dn": MoPropertyMeta("dn", "dn", "string", VersionMeta.Version201a, MoPropertyMeta.READ_WRITE, 0x20, 0, 255, None, [], []),
            "read_policy": MoPropertyMeta("read_policy", "readPolicy", "string", VersionMeta.Version204c, MoPropertyMeta.READ_WRITE, 0x40, None, None, None, ["", "always-read-ahead", "default", "no-read-ahead"], []),
            "rn": MoPropertyMeta("rn", "rn", "string", VersionMeta.Version201a, MoPropertyMeta.READ_WRITE, 0x80, 0, 255, None, [], []),
            "shared_virtual_drive_id": MoPropertyMeta("shared_virtual_drive_id", "sharedVirtualDriveId", "string", VersionMeta.Version201a, MoPropertyMeta.READ_WRITE, 0x100, None, None, None, [""], ["0-4294967295"]),
            "size": MoPropertyMeta("size", "size", "string", VersionMeta.Version201a, MoPropertyMeta.READ_WRITE, 0x200, 1, 510, r"""(\d+\s?([MGT]B)?)""", [], []),
            "status": MoPropertyMeta("status", "status", "string", VersionMeta.Version201a, MoPropertyMeta.READ_WRITE, 0x400, None, None, None, ["", "created", "deleted", "modified", "removed"], []),
            "strip_size": MoPropertyMeta("strip_size", "stripSize", "string", VersionMeta.Version204c, MoPropertyMeta.READ_WRITE, 0x800, None, None, None, ["", "1024k", "128k", "16k", "256k", "32k", "512k", "64k", "8k", "default"], []),
            "virtual_drive_name": MoPropertyMeta("virtual_drive_name", "virtualDriveName", "string", VersionMeta.Version201a, MoPropertyMeta.READ_WRITE, 0x1000, 0, 15, None, [], []),
            "write_policy": MoPropertyMeta("write_policy", "writePolicy", "string", VersionMeta.Version201a, MoPropertyMeta.READ_WRITE, 0x2000, None, None, None, ["", "Always Write Back", "Write Back Good BBU", "Write Through", "always-write-back", "default", "write-back-good-bbu", "write-through"], []),
            "created_virtual_drive_dn": MoPropertyMeta("created_virtual_drive_dn", "createdVirtualDriveDn", "string", VersionMeta.Version201a, MoPropertyMeta.READ_ONLY, None, 0, 510, None, [], []),
            "description": MoPropertyMeta("description", "description", "string", VersionMeta.Version201a, MoPropertyMeta.READ_ONLY, None, 0, 510, None, [], []),
            "oper_status": MoPropertyMeta("oper_status", "operStatus", "string", VersionMeta.Version201a, MoPropertyMeta.READ_ONLY, None, 0, 510, None, [], []),
        },

        "modular": {
            "access_policy": MoPropertyMeta("access_policy", "accessPolicy", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x2, None, None, None, ["", "blocked", "default", "hidden", "read-only", "read-write"], []),
            "admin_state": MoPropertyMeta("admin_state", "adminState", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x4, None, None, None, ["trigger", "triggered"], []),
            "cache_policy": MoPropertyMeta("cache_policy", "cachePolicy", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x8, None, None, None, ["", "cached-io", "default", "direct-io"], []),
            "disk_cache_policy": MoPropertyMeta("disk_cache_policy", "diskCachePolicy", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x10, None, None, None, ["", "default", "disabled", "enabled", "unchanged"], []),
            "dn": MoPropertyMeta("dn", "dn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x20, 0, 255, None, [], []),
            "read_policy": MoPropertyMeta("read_policy", "readPolicy", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x40, None, None, None, ["", "always-read-ahead", "default", "no-read-ahead"], []),
            "rn": MoPropertyMeta("rn", "rn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x80, 0, 255, None, [], []),
            "shared_virtual_drive_id": MoPropertyMeta("shared_virtual_drive_id", "sharedVirtualDriveId", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x100, 0, 510, None, [], ["0-4294967295"]),
            "size": MoPropertyMeta("size", "size", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x200, 1, 510, r"""(\d+\s?([MGT]B)?)""", [], []),
            "status": MoPropertyMeta("status", "status", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x400, None, None, None, ["", "created", "deleted", "modified", "removed"], []),
            "strip_size": MoPropertyMeta("strip_size", "stripSize", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x800, 0, 510, None, ["1024k", "128k", "256k", "512k", "64k", "default"], []),
            "virtual_drive_name": MoPropertyMeta("virtual_drive_name", "virtualDriveName", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x1000, 0, 15, None, [], []),
            "write_policy": MoPropertyMeta("write_policy", "writePolicy", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x2000, None, None, None, ["", "Always Write Back", "Write Back Good BBU", "Write Through", "default"], []),
            "created_virtual_drive_dn": MoPropertyMeta("created_virtual_drive_dn", "createdVirtualDriveDn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_ONLY, None, 0, 510, None, [], []),
            "description": MoPropertyMeta("description", "description", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_ONLY, None, 0, 510, None, [], []),
            "oper_status": MoPropertyMeta("oper_status", "operStatus", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_ONLY, None, 0, 510, None, [], []),
        },

    }

    prop_map = {

        "classic": {
            "accessPolicy": "access_policy",
            "adminState": "admin_state",
            "cachePolicy": "cache_policy",
            "diskCachePolicy": "disk_cache_policy",
            "dn": "dn",
            "readPolicy": "read_policy",
            "rn": "rn",
            "sharedVirtualDriveId": "shared_virtual_drive_id",
            "size": "size",
            "status": "status",
            "stripSize": "strip_size",
            "virtualDriveName": "virtual_drive_name",
            "writePolicy": "write_policy",
            "createdVirtualDriveDn": "created_virtual_drive_dn",
            "description": "description",
            "operStatus": "oper_status",
        },

        "modular": {
            "accessPolicy": "access_policy",
            "adminState": "admin_state",
            "cachePolicy": "cache_policy",
            "diskCachePolicy": "disk_cache_policy",
            "dn": "dn",
            "readPolicy": "read_policy",
            "rn": "rn",
            "sharedVirtualDriveId": "shared_virtual_drive_id",
            "size": "size",
            "status": "status",
            "stripSize": "strip_size",
            "virtualDriveName": "virtual_drive_name",
            "writePolicy": "write_policy",
            "createdVirtualDriveDn": "created_virtual_drive_dn",
            "description": "description",
            "operStatus": "oper_status",
        },

    }

    def __init__(self, parent_mo_or_dn, **kwargs):
        self._dirty_mask = 0
        self.access_policy = None
        self.admin_state = None
        self.cache_policy = None
        self.disk_cache_policy = None
        self.read_policy = None
        self.shared_virtual_drive_id = None
        self.size = None
        self.status = None
        self.strip_size = None
        self.virtual_drive_name = None
        self.write_policy = None
        self.created_virtual_drive_dn = None
        self.description = None
        self.oper_status = None

        ManagedObject.__init__(self, "StorageVirtualDriveCreatorUsingVirtualDriveGroup", parent_mo_or_dn, **kwargs)


text:
package swoop.pipeline;

import swoop.path.Path;
import swoop.path.Verb.Category;
import fj.F;
import fj.data.List;

public class HandlerRegistry {

    private List<HandlerEntry> entries = List.nil();

    public void defineEntry(PathMatcher pathMatcher, Handler handler) {
        entries = entries.cons(new HandlerEntry(pathMatcher, handler));
    }

    public List<HandlerEntry> entriesFor(final Path requestedPath) {
        List<HandlerEntry> list = entries.filter(entriesMatching(requestedPath));
        return list.reverse();
    }

    protected F<HandlerEntry, Boolean> entriesMatching(final Path requestedPath) {
        return new F<HandlerEntry,Boolean>() {
            @Override
            public Boolean f(HandlerEntry entry) {
                return entry.matches(requestedPath);
            }
        };
    }

    public boolean hasEntryFor(final Category category, final String path) {
        return entries.exists(entriesBelongingTo(category, path));
    }

    protected F<HandlerEntry, Boolean> entriesBelongingTo(final Category category, final String path) {
        return new F<HandlerEntry,Boolean>() {
            @Override
            public Boolean f(HandlerEntry entry) {
                return entry.satisfiedBy(category, path);
            }
        };
    }
}


text:
  <title>foreignObject can be transformed</title>

The word "TEST " should appear twice below, the same size each time.

  <svg xmlns="http://www.w3.org/2000/svg" width="400" height="120" class="test">
   <rect x="0" y="0" width="60" height="12" transform="scale(10)"/>
   <foreignObject x="0" y="0" width="60" height="10" transform="scale(10)">

 TEST

   </foreignObject>
  </svg>

TEST


text:
/**
 * Created by kumar on 14/01/2016.
 */
var oRingTone, oRingbackTone;

function startRingTone() {
    try { ringtone.play(); }
    catch (e) { }
}

function stopRingTone() {
    try { ringtone.pause(); }
    catch (e) { }
}

function startRingbackTone() {
    try { ringbacktone.play(); }
    catch (e) { }
}

function stopRingbackTone() {
    try { ringbacktone.pause(); }
    catch (e) { }
}

var readyCallBack = function(e){
    createSipStack();
};
var errorCallBack = function(e){
    console.log("error while initialising the sipml5 stack");
}
SIPml.init(readyCallBack, errorCallBack);

var sipStack;

function eventsListener(e){
    if (e.type == 'started'){
        //successfully started the stack.

    }else if (e.type == 'i_new_call'){

    }else if (e.type == 'i_ao_request'){
        if (e.session == callSession) {
            var iSipResponseCode = e.getSipResponseCode();
            if (iSipResponseCode == 180 || iSipResponseCode == 183) {
                //startRingbackTone();
                startRingTone()
            }
        }
    }else if (e.type == 'connected'){
        stopRingbackTone();
        stopRingTone()
    }else if (e.type == 'connecting'){
        //startRingTone()
        startRingbackTone()
    }

}

function createSipStack(){
    sipStack = new SIPml.Stack({
        realm: 'bwas2.inferencecommunications.com',
        impi: '0370103192',
        impu: 'sip:0370103192@bwas2.inferencecommunications.com',
        password: 'inference',
        display_name: 'kumar',
        websocket_proxy_url: 'ws://10.203.1.236:10061',
        outbound_proxy_url: 'udp://10.216.235.37:5060',
        enable_rtcweb_breaker: true,
        events_listener: {events:'*', listener: eventsListener},
        ice_servers: []
    })
}
sipStack.start();
var callSession;

function makeCall(){
    callSession = sipStack.newSession('call-audiovideo', {
        video_local: document.getElementById('video_local'),
        audio_remote: document.getElementById('audio_remote'),
        events_listener: { events: '*', listener: eventsListener}
    });
    callSession.call('sip:0370103241@bwas2.inferencecommunications.com')
//                callSession.call('sip:0370103193@bwas2.inferencecommunications.com')
//        callSession.call('sip:0370103241@10.216.235.113:5188')
}

function sipSendDTMF(c) {
    if (callSession && c) {
        if (callSession.dtmf(c) == 0) {
            try { document.getElementById("dtmfTone").play(); } catch (e) { }
        }
    }
}
function sipHangUp() {
    if (callSession) {
        callSession.hangup({ events_listener: { events: '*', listener: eventsListener } });
    }
}


text:
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('angulartics2')) :
    typeof define === 'function' && define.amd ? define('angulartics2/routerlessmodule', ['exports', '@angular/core', 'angulartics2'], factory) :
    (factory((global.angulartics2 = global.angulartics2 || {}, global.angulartics2.routerlessmodule = {}),global.ng.core,global.angulartics2));
}(this, (function (exports,core,angulartics2) { 'use strict';

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var Angulartics2RouterlessModule = /** @class */ (function () {
        function Angulartics2RouterlessModule() {
        }
        /**
         * @param {?=} settings
         * @return {?}
         */
        Angulartics2RouterlessModule.forRoot = /**
         * @param {?=} settings
         * @return {?}
         */
            function (settings) {
                if (settings === void 0) {
                    settings = {};
                }
                return {
                    ngModule: Angulartics2RouterlessModule,
                    providers: [
                        { provide: angulartics2.ANGULARTICS2_TOKEN, useValue: { settings: settings } },
                        angulartics2.RouterlessTracking,
                        angulartics2.Angulartics2,
                    ],
                };
            };
        Angulartics2RouterlessModule.decorators = [
            { type: core.NgModule, args: [{
                        imports: [angulartics2.Angulartics2OnModule],
                    },] }
        ];
        return Angulartics2RouterlessModule;
    }());

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */

    exports.Angulartics2RouterlessModule = Angulartics2RouterlessModule;

    Object.defineProperty(exports, '__esModule', { value: true });

})));

//# sourceMappingURL=angulartics2-routerlessmodule.umd.js.map


text:
@interface CASpringAnimation : CABasicAnimation
- (float)damping;
- (double)durationForEpsilon:(double)arg1;
- (float)mass;
- (void)setDamping:(float)arg1;
- (void)setMass:(float)arg1;
- (void)setStiffness:(float)arg1;
- (void)setVelocity:(float)arg1;
- (float)stiffness;
- (float)velocity;
@end
#else
#import "RBBSpringAnimation.h"
#define kSpringAnimationClassName RBBSpringAnimation
#endif

@interface LMAlertView : UIView <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UIColor *tintColor;
@property (nonatomic, strong, readonly) UIView *contentView;
@property (nonatomic) BOOL keepTopAlignment;
@property (unsafe_unretained) id<UIAlertViewDelegate> delegate;

@property(nonatomic) NSInteger cancelButtonIndex;
@property(nonatomic, readonly) NSInteger firstOtherButtonIndex;
@property(nonatomic, copy) NSString *message;
@property(nonatomic, readonly) NSInteger numberOfButtons;
@property(nonatomic, copy) NSString *title;
@property(nonatomic, readonly, getter=isVisible) BOOL visible;
@property(nonatomic) BOOL buttonsShouldStack;
@property(nonatomic) BOOL autoRotate;

- (id)initWithSize:(CGSize)size;
- (id)initWithViewController:(UIViewController *)viewController;
- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;

- (void)setSize:(CGSize)size animated:(BOOL)animated;
- (void)setSize:(CGSize)size;
- (CGSize)size;

- (void)show;
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;
- (NSInteger)addButtonWithTitle:(NSString *)title;
- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;

- (LMModalItemTableViewCell *)buttonCellForIndex:(NSInteger)buttonIndex;

@end


text:
/*************************************************************************************************/
/*!
 * \file
 * \brief Connectable master BLE baseband porting implementation file.
 */
/*************************************************************************************************/

#include "bb_api.h"
#include "pal_bb.h"
#include "bb_ble_int.h"
#include <string.h>

/**************************************************************************************************
  Global Variables
**************************************************************************************************/

extern BbBleDataPktStats_t  bbConnStats;    /*!< Connection packet statistics. */

/*************************************************************************************************/
/*!
 *  \brief      Tx completion for connected master operation.
 *
 *  \param      status      Transmission status
 *
 *  \return     None.
 *
 *  Setup for next action in the operation or complete the operation.
 */
/*************************************************************************************************/
static void bbMstConnTxCompCback(uint8_t status)
{
  BB_ISR_START();

  WSF_ASSERT(BbGetCurrentBod());

  BbOpDesc_t * const pCur = BbGetCurrentBod();
  BbBleMstConnEvent_t * const pConn = &pCur->prot.pBle->op.mstConn;

  WSF_ASSERT(pCur);

  pConn->txDataCback(pCur, status);

  if (bbBleCb.pRxDataBuf &&
      (status == BB_STATUS_SUCCESS))
  {
    BB_ISR_MARK(bbConnStats.rxSetupUsec);

    bbBleSetIfs();     /* TODO set only if Tx may follow in CE */
    PalBbBleRxTifsData(bbBleCb.pRxDataBuf, bbBleCb.rxDataLen);
  }
  else
  {
    /* Cancel TIFS timer if active. */
    switch (status)
    {
      case BB_STATUS_SUCCESS:
        PalBbBleCancelTifs();
        break;
      case BB_STATUS_FAILED:
      default:
        /* Free Rx data buffer before BOD end. */
        if (bbBleCb.pRxDataBuf != NULL)        /* buffer should always exist, but still check */
        {
          uint8_t *pBuf = bbBleCb.pRxDataBuf;
          bbBleCb.pRxDataBuf = NULL;
          pConn->rxDataCback(pCur, pBuf, BB_STATUS_CANCELED);
        }
        break;
    }

    BbTerminateBod();
  }

  /* Update statistics. */
  switch (status)
  {
    case BB_STATUS_SUCCESS:
      BB_INC_STAT(bbConnStats.txData);
      break;
    case BB_STATUS_FAILED:
    default:
      BB_INC_STAT(bbConnStats.errData);
      break;
  }

  BB_ISR_MARK(bbConnStats.txIsrUsec);
}

/*************************************************************************************************/
/*!
 *  \brief      Rx completion for connected master operation.
 *
 *  \param      status          Reception status.
 *  \param      rssi            RSSI value.
 *  \param      crc             CRC value.
 *  \param      timestamp       Start of packet timestamp.
 *  \param      rxPhyOptions    Rx PHY options.
 *
 *  \return     None.
 *
 *  Setup for next action in the operation or complete the operation.
 */
/*************************************************************************************************/
static void bbMstConnRxCompCback(uint8_t status, int8_t rssi, uint32_t crc, uint32_t timestamp, uint8_t rxPhyOptions)
{
  BB_ISR_START();

  WSF_ASSERT(BbGetCurrentBod());

  BbOpDesc_t * const pCur = BbGetCurrentBod();
  BbBleMstConnEvent_t * const pConn = &pCur->prot.pBle->op.mstConn;

  pConn->rssi = rssi;
  pConn->rxPhyOptions = rxPhyOptions;

  if (bbBleCb.evtState == 0)
  {
    bbBleCb.evtState = 1;
  }

  WSF_ASSERT(bbBleCb.pRxDataBuf);
  uint8_t *pBuf = bbBleCb.pRxDataBuf;
  bbBleCb.pRxDataBuf = NULL;

  /* Set Tx buffer or BOD cancel expected to be called during this routine. */
  pConn->rxDataCback(pCur, pBuf, status);

  if (BbGetBodTerminateFlag())
  {
    WSF_ASSERT(!bbBleCb.pRxDataBuf);

    /* Cancel TIFS timer if active. */
    switch (status)
    {
      case BB_STATUS_SUCCESS:
      case BB_STATUS_CRC_FAILED:
        PalBbBleCancelTifs();
        break;
      default:
        break;
    }

    BbTerminateBod();               /* auto terminated on missed; just end */
  }

  /* Update statistics. */
  switch (status)
  {
    case BB_STATUS_SUCCESS:
      BB_INC_STAT(bbConnStats.rxData);
      break;
    case BB_STATUS_RX_TIMEOUT:
      BB_INC_STAT(bbConnStats.rxDataTimeout);
      break;
    case BB_STATUS_CRC_FAILED:
      BB_INC_STAT(bbConnStats.rxDataCrc);
      break;
    case BB_STATUS_FAILED:
    default:
      BB_INC_STAT(bbConnStats.errData);
      break;
  }

  BB_ISR_MARK(bbConnStats.rxIsrUsec);
}

/*************************************************************************************************/
/*!
 *  \brief      Execute connectable master BOD.
 *
 *  \param      pBod    Pointer to the BOD to execute.
 *  \param      pBle    BLE operation parameters.
 *
 *  \return     None.
 */
/*************************************************************************************************/
static void bbMstExecuteConnOp(BbOpDesc_t *pBod, BbBleData_t *pBle)
{
  PalBbBleSetChannelParam(&pBle->chan);

  WSF_ASSERT(pBle->op.mstConn.txDataCback);
  WSF_ASSERT(pBle->op.mstConn.rxDataCback);

  bbBleCb.bbParam.txCback = bbMstConnTxCompCback;
  bbBleCb.bbParam.rxCback = bbMstConnRxCompCback;
  bbBleCb.bbParam.due = pBod->due;
  bbBleCb.bbParam.dueOffsetUsec = pBod->dueOffsetUsec;
  bbBleCb.bbParam.rxTimeoutUsec = 2 * LL_MAX_TIFS_DEVIATION;

  PalBbBleSetDataParams(&bbBleCb.bbParam);

  bbBleCb.evtState = 0;

  pBle->op.mstConn.execCback(pBod);
}

/*************************************************************************************************/
/*!
 *  \brief      Cancel connectable master BOD.
 *
 *  \param      pBod    Pointer to the BOD to cancel.
 *  \param      pBle    BLE operation parameters.
 *
 *  \return     None.
 */
/*************************************************************************************************/
static void bbMstCancelConnOp(BbOpDesc_t *pBod, BbBleData_t *pBle)
{
  WSF_ASSERT(pBod);
  WSF_ASSERT(pBle);
  WSF_ASSERT(pBle->op.mstConn.rxDataCback);

  PalBbBleCancelData();

  if (bbBleCb.pRxDataBuf)
  {
    uint8_t *pBuf = bbBleCb.pRxDataBuf;
    bbBleCb.pRxDataBuf = NULL;

    /* Buffer free expected to be called during this routine. */
    pBle->op.mstConn.rxDataCback(pBod, pBuf, BB_STATUS_CANCELED);
  }

  pBle->op.mstConn.cancelCback(pBod);
}

/*************************************************************************************************/
/*!
 *  \brief      Initialize for connectable master operations.
 *
 *  \return     None.
 *
 *  Update the operation table with connectable master operations routines.
 */
/*************************************************************************************************/
void BbBleConnMasterInit(void)
{
  bbBleRegisterOp(BB_BLE_OP_MST_CONN_EVENT, bbMstExecuteConnOp, bbMstCancelConnOp);

  memset(&bbConnStats, 0, sizeof(bbConnStats));
}


text:
#ifndef _PRDIC_SHMTRIG_H_
#define _PRDIC_SHMTRIG_H_

struct _prdic_shmtrig {
    unsigned int currval;
    double lTrs;
    double hTrs;
    struct _prdic_procchain link;
};

/* Function prototypes */
void _prdic_shmtrig_init(struct _prdic_shmtrig *, unsigned int, double, double);

#endif /* _PRDIC_SHMTRIG_H_ */


text:
var x = {}
console.log(Object.getPrototypeOf(x), x.__proto__);
x = Object.create(null);
console.log(Object.getPrototypeOf(x), x.__proto__);


text:
package org.ssascaling.clustering;

import java.util.HashMap;
import java.util.Map;

import org.ssascaling.objective.correlation.Spearmans;

import net.sf.javaml.core.Instance;
import net.sf.javaml.distance.AbstractCorrelation;

public class SpearmanDistance extends AbstractCorrelation {

	private Map<Instance, Map<Instance, Double>> map = new HashMap<Instance, Map<Instance, Double>>();
	private Spearmans spear = new Spearmans();
	public SpearmanDistance(){
	}

	@Override
	public double measure(Instance x, Instance y) {

		//System.out.print("x= " + x.hashCode() +" y= " + y.hashCode()+"\n");
		//System.out.print("x= " + x.get(0) +" y= " + y.get(0)+"\n");
		//if (x.classValue() == null){

		//}

		if (!map.containsKey(x)) {
			map.put(x,  new HashMap<Instance, Double>());
		}

		if (!map.containsKey(y)) {
			map.put(y,  new HashMap<Instance, Double>());
		}

		if (!map.get(x).containsKey(y)) {
			double[] xValue = new double[x.size()];
			double[] yValue = new double[y.size()];
			for (int i = 0; i <  x.noAttributes();i++){
				xValue[i] = x.get(i);
			    yValue[i] = y.get(i);
			}
			double value = 1 - spear.doCorrelation(xValue, yValue);

			map.get(x).put(y, value);
			map.get(y).put(x, value);
		}

		return map.get(x).get(y);
		//System.out.print("x= " + x.classValue() +" y= " + y.classValue()+"\n");
		//return (x.classValue().equals(y.classValue()))? 0 : map.get(x.classValue()).get(y.classValue());
	}

}


text:
// Main bootstrap.less entry point
@import "../../bootstrap/less/bootstrap.less";

// The Paginator less for MopaBootstrapBundle
@import "paginator.less";

// Collection support for MopaBootstrapBundle
@import "collections.less";

// include the responsive after all of your stuff!
// @import "../../bootstrap/less/responsive.less";


text:
<!DOCTYPE html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Responsive Admin Template</title>

<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/style-responsive.css" rel="stylesheet">

 Error - 404

 Page Not Found

 The page your looking for is not here

			  <input type="text" name="form1Name" id="form1Name" class="form-control">

		  <button type="button" class="btn btn-primary">Search</button>


text:
namespace BattleNetShop.Data.Xml
{
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.IO;

    using System.Xml;

    using BattleNetShop.Model;
    using BattleNetShop.ReportsModel;

    public class XmlData : IXmlData
    {
        public void GenerateAllLocationsReport(IEnumerable<LocationReport> locationReports)
        {
            XmlDocument report = new XmlDocument();
            XmlDeclaration xmlDeclaration = report.CreateXmlDeclaration("1.0", "UTF-8", null);
            XmlElement root = report.CreateElement("sales");
            report.AppendChild(root);
            report.InsertBefore(xmlDeclaration, root);

            foreach (LocationReport locationReport in locationReports)
            {
                XmlElement sale = report.CreateElement("location");
                sale.SetAttribute("name", locationReport.LocationName);
                root.AppendChild(sale);
                foreach (LocationReportEntry entry in locationReport.Entries)
                {
                    XmlElement summary = report.CreateElement("summary");
                    summary.SetAttribute("date", entry.Date.ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture));
                    summary.SetAttribute("total-sum", entry.TotalSum.ToString());
                    sale.AppendChild(summary);
                }
            }

            if (!Directory.Exists(XmlSettings.Default.ReportDestinationFolderLocation))
            {
                Directory.CreateDirectory(XmlSettings.Default.ReportDestinationFolderLocation);
            }

            report.Save(XmlSettings.Default.ReportDestinationFolderLocation + XmlSettings.Default.ReportDestionationFileName);
        }

        public IEnumerable<VendorExpense> GetAllVendorExpenses()
        {
            var allVendorExpenses = new List<VendorExpense>();

            XmlDocument doc = new XmlDocument();
            doc.Load(XmlSettings.Default.InitialXmlFileLocation);

            XmlNodeList vendorNodesList = doc.SelectNodes("/expenses-by-month/vendor");

            foreach (XmlNode vendorNode in vendorNodesList)
            {
                string vendorName = vendorNode.Attributes.GetNamedItem("name").Value;
                if (string.IsNullOrEmpty(vendorName))
                {
                    throw new ArgumentNullException("Vendor name cannot be empty!");
                }
                XmlNodeList vendorExpenses = vendorNode.SelectNodes("expenses");
                foreach (XmlNode expense in vendorExpenses)
                {
                    VendorExpense vendorExpense = new VendorExpense();
                    vendorExpense.VendorName = vendorName;

                    decimal parsedAmmount = 0;
                    if (!decimal.TryParse(expense.InnerText, NumberStyles.Any, CultureInfo.InvariantCulture,
                        out parsedAmmount))
                    {
                        throw new FormatException("Unable to parse expenses ammount in" + XmlSettings.Default.InitialXmlFileLocation + "! Parse string: " + expense.InnerText);
                    }

                    vendorExpense.Ammount = parsedAmmount;

                    DateTime parsedDate = new DateTime();
                    if (!DateTime.TryParseExact(expense.Attributes.GetNamedItem("month").Value, "MMM-yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None,
                        out parsedDate))
                    {
                        throw new FormatException("Unable to parse date from expenses entry in" + XmlSettings.Default.InitialXmlFileLocation + "! Parse string: " + expense.Attributes.GetNamedItem("month").Value);
                    }

                    vendorExpense.Date = parsedDate;
                    allVendorExpenses.Add(vendorExpense);
                }
            }

            return allVendorExpenses;
        }
    }
}


text:
using NUnit.Framework;
using RefactoringEssentials.CSharp.Diagnostics;

namespace RefactoringEssentials.Tests.CSharp.Diagnostics
{
    [TestFixture]
    [Ignore("TODO: Issue not ported yet")]
    public class ParameterCanBeDeclaredWithBaseTypeTests : CSharpDiagnosticTestBase
    {
        [Test]
        public void BasicTest()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class A
{
	public virtual void Foo() {}
}
class B : A
{
	public virtual void Bar() {}
}
class C
{
	void F(B b)
	{
		b.Foo();
	}
}", @"
class A
{
	public virtual void Foo() {}
}
class B : A
{
	public virtual void Bar() {}
}
class C
{
	void F(A b)
	{
		b.Foo();
	}
}");
        }

        [Test]
        public void IgnoresUnusedParameters()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class A
{
	void F(A a1)
	{
	}
}");
        }

        [Test]
        public void IgnoresDirectionalParameters()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
interface IA
{
}
class A : IA
{
	void F(out A a1)
	{
		object.Equals(a1, null);
	}
}");
        }

        [Test]
        public void IgnoresOverrides()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
interface IA
{
	void Foo();
}
class B : IA
{
	public virtual void Foo() {}
	public virtual void Bar() {}
}
class TestBase
{
	public void F(B b) {
		b.Foo();
		b.Bar();
	}
}
class TestClass : TestBase
{
	public override void F(B b)
	{
		b.Foo();
	}
}");
        }

        [Test]
        public void IgnoresOverridables()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
interface IA
{
	void Foo();
}
class B : IA
{
	public virtual void Foo() {}
	public virtual void Bar() {}
}
class TestClass
{
	public virtual void F(B b)
	{
		b.Foo();
	}
}");
        }

        [Test]
        public void HandlesNeededProperties()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
interface IA
{
	void Foo(string s);
}
class B : IA
{
	public virtual void Foo(string s) {}
	public string Property { get; }
}
class TestClass
{
	public void F(B b)
	{
		b.Foo(b.Property);
	}
}");
        }

        [Test]
        public void InterfaceTest()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
interface IA
{
	void Foo();
}
class B : IA
{
	public virtual void Foo() {}
	public virtual void Bar() {}
}
class C
{
	void F(B b)
	{
		b.Foo();
	}
}", @"
interface IA
{
	void Foo();
}
class B : IA
{
	public virtual void Foo() {}
	public virtual void Bar() {}
}
class C
{
	void F(IA b)
	{
		b.Foo();
	}
}");
        }

        [Test]
        public void RespectsExpectedTypeInIfStatement()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class C
{
	void F (bool b, bool c)
	{
		if (b && c)
			return;
	}
}");
        }

        [Test]
        public void MultipleInterfaceTest()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
interface IA1
{
	void Foo();
}
interface IA2
{
	void Bar();
}
class B : IA1, IA2
{
	public virtual void Foo() {}
	public virtual void Bar() {}
}
class C : B {}
class Test
{
	void F(C c)
	{
		c.Foo();
		c.Bar();
	}
}", @"
interface IA1
{
	void Foo();
}
interface IA2
{
	void Bar();
}
class B : IA1, IA2
{
	public virtual void Foo() {}
	public virtual void Bar() {}
}
class C : B {}
class Test
{
	void F(B c)
	{
		c.Foo();
		c.Bar();
	}
}");
        }

        string baseInput = @"
interface IA
{
	void Foo();
}
interface IB : IA
{
	void Bar();
}
interface IC : IA
{
	new void Foo();
	void Baz();
}
class D : IB
{
	public void Foo() {}
	public void Bar() {}
}
class E : D, IC
{
	public void Baz() {}
	void IC.Foo() {}
}";

        [Ignore("TODO")]
        [Test]
        public void FindsTopInterface()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(baseInput + @"
class Test
{
	void F(E e)
	{
		e.Foo();
	}
}", baseInput + @"
class Test
{
	void F(IA e)
	{
		e.Foo();
	}
}");
        }

        [Test]
        public void DoesNotChangeOverload()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(baseInput + @"
class Test
{
	void F(IB b)
	{
		Bar (b);
	}

	void Bar (IA a)
	{
	}

	void Bar (IB b)
	{
	}
}");
        }

        [Test]
        public void AssignmentToExplicitlyTypedVariable()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(baseInput + @"
class Test
{
	void F(IB b)
	{
		IB b2;
		b2 = b;
		object.Equals(b, b2);
	}
}");
        }

        [Test]
        public void GenericMethod()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(baseInput + @"
class Test
{
	void F(IB b)
	{
		Generic (b);
	}

	void Generic<T> (T arg) where T : IA
	{
	}
}");
        }

        [Test]
        public void VariableDeclarationWithTypeInference()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(baseInput + @"
class Test
{
	void Foo (IB b)
	{
		var b2 = b;
		Foo (b2);
	}

	void Foo (IA a)
	{
	}
}");
        }

        [Test]
        public void RespectsOutgoingCallsTypeRestrictions()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(baseInput + @"
class Test
{
	void F(E e)
	{
		e.Foo();
		DemandType(e);
	}

	void DemandType(D d)
	{
	}
}", baseInput + @"
class Test
{
	void F(D e)
	{
		e.Foo();
		DemandType(e);
	}

	void DemandType(D d)
	{
	}
}");
        }

        [Test]
        public void AccountsForNonInvocationMethodGroupUsageInMethodCall()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
delegate void FooDelegate (string s);
interface IBase
{
	void Bar();
}
interface IDerived : IBase
{
	void Foo(string s);
}
class TestClass
{
	public void Bar (IDerived derived)
	{
		derived.Bar();
		Baz (derived.Foo);
	}

	void Baz (FooDelegate fd)
	{
	}
}");
        }

        [Test]
        public void AccountsForNonInvocationMethodGroupUsageInVariableDeclaration()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
delegate void FooDelegate (string s);
interface IBase
{
	void Bar();
}
interface IDerived : IBase
{
	void Foo(string s);
}
class TestClass
{
	public void Bar (IDerived derived)
	{
		derived.Bar();
		FooDelegate d = derived.Foo;
	}
}");
        }

        [Test]
        public void AccountsForNonInvocationMethodGroupUsageInAssignmentExpression()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
delegate void FooDelegate (string s);
interface IBase
{
	void Bar();
}
interface IDerived : IBase
{
	void Foo(string s);
}
class TestClass
{
	public void Bar (IDerived derived)
	{
		derived.Bar();
		FooDelegate d;
		d = derived.Foo;
	}
}");
        }

        [Ignore("TODO")]
        [Test]
        public void AccountsForIndexers()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class TestClass
{
	void Write(string[] s)
	{
		object.Equals(s, s);
		var element = s[1];
	}
}", 1, @"
class TestClass
{
	void Write(System.Collections.Generic.IList<string> s)
	{
		object.Equals(s, s);
		var element = s[1];
	}
}", 1, 1);
        }

        [Test]
        public void AccountsForArrays()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class TestClass
{
	void Write(string[] s)
	{
		var i = s.Length;
		SetValue (out s[1]);
	}

	void SetValue (out string s)
	{
	}
}");
        }

        [Test]
        public void LimitsParamsParametersToArrays()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class TestClass
{
	void Write(params string[] s)
	{
		System.Console.WriteLine (s);
	}
}");
        }

        [Test]
        public void DoesNotSuggestProgramEntryPointChanges()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class TestClass
{
	public static void Main (string[] args)
	{
		if (args.Length > 2) {
		}
	}
}");
        }

        [Test]
        public void IgnoresImplicitInterfaceImplementations()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
interface IHasFoo
{
	void Foo (string s);
}
class TestClass : IHasFoo
{
	public void Foo(string s)
	{
		object o = s;
	}
}");
        }

        [Test]
        public void IgnoresEnumParameters()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
enum ApplicableValues
{
	None,
	Some
}
class TestClass
{
	public void Foo(ApplicableValues av)
	{
		object o = av;
	}
}");
        }

        [Test]
        public void CallToOverriddenMember()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class TestBase
{
	public virtual void Foo()
	{
	}
}
class Test : TestBase
{
	void F (Test t)
	{
		t.Foo();
	}

	public override void Foo()
	{
	}
}", @"
class TestBase
{
	public virtual void Foo()
	{
	}
}
class Test : TestBase
{
	void F (TestBase t)
	{
		t.Foo();
	}

	public override void Foo()
	{
	}
}");
        }

        [Test]
        public void CallToShadowingMember()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class TestBase
{
	public virtual void Foo()
	{
	}
}
class Test : TestBase
{
	void F (Test t)
	{
		t.Foo();
	}

	public new void Foo()
	{
	}
}");
        }

        [Test]
        public void CallToShadowingMember2()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class TestBaseBase
{
	public virtual void Foo()
	{
	}
}
class TestBase : TestBaseBase
{
	protected virtual new void Foo()
	{
	}
}
class Test : TestBase
{
	void F (Test t)
	{
		t.Foo();
	}

	public override void Foo()
	{
	}
}", @"
class TestBaseBase
{
	public virtual void Foo()
	{
	}
}
class TestBase : TestBaseBase
{
	protected virtual new void Foo()
	{
	}
}
class Test : TestBase
{
	void F (TestBase t)
	{
		t.Foo();
	}

	public override void Foo()
	{
	}
}");
        }

        [Test]
        public void CallToShadowingMemberWithBaseInterface()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
interface IFoo
{
	void Foo();
}
class TestBaseBase : IFoo
{
	public virtual void Foo()
	{
	}
}
class TestBase : TestBaseBase
{
	protected virtual new void Foo()
	{
	}
}
class Test : TestBase
{
	void F (Test t)
	{
		t.Foo();
	}

	protected override void Foo()
	{
	}
}", @"
interface IFoo
{
	void Foo();
}
class TestBaseBase : IFoo
{
	public virtual void Foo()
	{
	}
}
class TestBase : TestBaseBase
{
	protected virtual new void Foo()
	{
	}
}
class Test : TestBase
{
	void F (TestBase t)
	{
		t.Foo();
	}

	protected override void Foo()
	{
	}
}");
        }

        /// <summary>
        /// Bug 9617 - Incorrect "parameter can be demoted to base class" warning for arrays
        /// </summary>
        [Test]
        public void TestBug9617()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"class Test
{
	object Foo (object[] arr)
	{
	    return arr [0];
	}
}", 1, @"class Test
{
	object Foo (System.Collections.IList arr)
	{
	    return arr [0];
	}
}");
        }

        [Test]
        public void TestBug9617Case2()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"class Test
{
	int Foo (int[] arr)
	{
	    return arr [0];
	}
}", 1, @"class Test
{
	int Foo (System.Collections.Generic.IList<int> arr)
	{
	    return arr [0];
	}
}");
        }

        [Test]
        public void DoNotDemoteStringComparisonToReferenceComparison_WithinLambda()
        {
            Test<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"using System; using System.Linq; using System.Collections.Generic;
class Test
{
	IEnumerable<User> users;
	User GetUser (String id)
	{
		return users.Where(u => u.Name == id).SingleOrDefault();
	}
}
class User {
	public string Name;
}
", 0);
        }

        [Test]
        public void TestMicrosoftSuppressMessage()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
class A
{
	public virtual void Foo() {}
}
class B : A
{
	public virtual void Bar() {}
}
class C
{
	[System.Diagnostics.CodeAnalysis.SuppressMessage(""Microsoft.Design"", ""CA1011:ConsiderPassingBaseTypesAsParameters"")]
	void F(B b)
	{
		b.Foo();
	}
}");
        }

        [Test]
        public void TestDisableAll()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"// ReSharper disable All

class A
{
	public virtual void Foo() {}
}
class B : A
{
	public virtual void Bar() {}
}
class C
{
	void F(B b)
	{
		b.Foo();
	}
}");
        }

        /// <summary>
        /// Bug 14099 - Do not suggest demoting Exception to _Exception
        /// </summary>
        [Test]
        public void TestBug14099()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"
using System;

public class Test
{
	public void Foo (Exception ex)
	{
		System.Console.WriteLine (ex.HelpLink);
	}
}
");
        }

        [Test]
        public void TestPreferGenerics()
        {
            Analyze<ParameterCanBeDeclaredWithBaseTypeAnalyzer>(@"using System.Collections.Generic;

class Test
{
	int Foo (ICollection<object> arr)
	{
		return arr.Count;
	}
}");
        }

    }
}


text:
FactoryGirl.define do
  factory :user do
    provider "MyString"
    uid "MyString"
    name "UserName"
    email "user@test.com"
    oauth_token "MyString"
    oauth_expires_at "2015-01-11 16:09:03"
    password "allo1234"

    # Teams
    factory :team_member do
      email "team_member@test.com"
      after(:create) do |user|
        team = create(:team)
        create_list(:memberships, 1, team: team, user: user)
      end
    end

    factory :team_manager do
      email "team_manager@test.com"
      after(:create) do |user|
        team = create(:team)
        create_list(:memberships, 1, team: team, user: user)
        create_list(:managerships, 1, team: team, user: user)
      end
    end

    factory :team_owner do
      email "team_owner@test.com"
      after(:create) do |user|
        # team factory creates memberships for its owner
        create(:team, owner: user)
      end
    end

    #Projects
    factory :project_member do
      email "project_member@test.com"
      after(:create) do |user|
        project = create(:project)
        create_list(:user_projects, 1, project: project, user: user)
      end
    end

    factory :project_owner do
      email "project_owner@test.com"
      after(:create) do |user|
        create(:project, owner: user)
      end
    end

    #Boards
    factory :board_owner do
      email "board_owner@test.com"
      after(:create) do |user|
        create(:board, owner: user)
      end
    end

  end
end


text:
// snippet-sourcedescription:[CrossRegionReplication.java demonstrates how to set and get cross-region replication rules.]
// snippet-service:[s3]
// snippet-keyword:[Java]
// snippet-sourcesyntax:[java]
// snippet-keyword:[Amazon S3]
// snippet-keyword:[Code Sample]
// snippet-keyword:[PUT Bucket replication]
// snippet-keyword:[GET Bucket replication]
// snippet-sourcetype:[full-example]
// snippet-sourcedate:[2019-01-28]
// snippet-sourceauthor:[AWS]
// snippet-start:[s3.java.cross_region_replication.complete]

import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.identitymanagement.AmazonIdentityManagement;
import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClientBuilder;
import com.amazonaws.services.identitymanagement.model.CreateRoleRequest;
import com.amazonaws.services.identitymanagement.model.PutRolePolicyRequest;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.BucketReplicationConfiguration;
import com.amazonaws.services.s3.model.BucketVersioningConfiguration;
import com.amazonaws.services.s3.model.CreateBucketRequest;
import com.amazonaws.services.s3.model.DeleteMarkerReplication;
import com.amazonaws.services.s3.model.DeleteMarkerReplicationStatus;
import com.amazonaws.services.s3.model.ReplicationDestinationConfig;
import com.amazonaws.services.s3.model.ReplicationRule;
import com.amazonaws.services.s3.model.ReplicationRuleStatus;
import com.amazonaws.services.s3.model.SetBucketVersioningConfigurationRequest;
import com.amazonaws.services.s3.model.StorageClass;
import com.amazonaws.services.s3.model.replication.ReplicationFilter;
import com.amazonaws.services.s3.model.replication.ReplicationFilterPredicate;
import com.amazonaws.services.s3.model.replication.ReplicationPrefixPredicate;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CrossRegionReplication {

    public static void main(String[] args) throws IOException {
        Regions clientRegion = Regions.DEFAULT_REGION;
        String accountId = "*** Account ID ***";
        String roleName = "*** Role name ***";
        String sourceBucketName = "*** Source bucket name ***";
        String destBucketName = "*** Destination bucket name ***";
        String prefix = "Tax/";

        String roleARN = String.format("arn:aws:iam::%s:%s", accountId, roleName);
        String destinationBucketARN = "arn:aws:s3:::" + destBucketName;

        AmazonS3 s3Client = AmazonS3Client.builder()
            .withCredentials(new ProfileCredentialsProvider())
            .withRegion(clientRegion)
            .build();

        createBucket(s3Client, clientRegion, sourceBucketName);
        createBucket(s3Client, clientRegion, destBucketName);
        assignRole(roleName, clientRegion, sourceBucketName, destBucketName);

        try {

            // Create the replication rule.
            List<ReplicationFilterPredicate> andOperands = new ArrayList<ReplicationFilterPredicate>();
            andOperands.add(new ReplicationPrefixPredicate(prefix));

            Map<String, ReplicationRule> replicationRules = new HashMap<String, ReplicationRule>();
            replicationRules.put("ReplicationRule1",
                new ReplicationRule()
                    .withPriority(0)
                    .withStatus(ReplicationRuleStatus.Enabled)
                    .withDeleteMarkerReplication(new DeleteMarkerReplication().withStatus(DeleteMarkerReplicationStatus.DISABLED))
                    .withFilter(new ReplicationFilter().withPredicate(new ReplicationPrefixPredicate(prefix)))
                    .withDestinationConfig(new ReplicationDestinationConfig()
                        .withBucketARN(destinationBucketARN)
                        .withStorageClass(StorageClass.Standard)));

            // Save the replication rule to the source bucket.
            s3Client.setBucketReplicationConfiguration(sourceBucketName,
                new BucketReplicationConfiguration()
                    .withRoleARN(roleARN)
                    .withRules(replicationRules));

            // Retrieve the replication configuration and verify that the configuration
            // matches the rule we just set.
            BucketReplicationConfiguration replicationConfig = s3Client.getBucketReplicationConfiguration(sourceBucketName);
            ReplicationRule rule = replicationConfig.getRule("ReplicationRule1");
            System.out.println("Retrieved destination bucket ARN: " + rule.getDestinationConfig().getBucketARN());
            System.out.println("Retrieved priority: " + rule.getPriority());
            System.out.println("Retrieved source-bucket replication rule status: " + rule.getStatus());
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it, so it returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // Amazon S3 couldn't be contacted for a response, or the client
            // couldn't parse the response from Amazon S3.
            e.printStackTrace();
        }
    }

    private static void createBucket(AmazonS3 s3Client, Regions region, String bucketName) {
        CreateBucketRequest request = new CreateBucketRequest(bucketName, region.getName());
        s3Client.createBucket(request);
        BucketVersioningConfiguration configuration = new BucketVersioningConfiguration().withStatus(BucketVersioningConfiguration.ENABLED);

        SetBucketVersioningConfigurationRequest enableVersioningRequest = new SetBucketVersioningConfigurationRequest(bucketName, configuration);
        s3Client.setBucketVersioningConfiguration(enableVersioningRequest);

    }

    private static void assignRole(String roleName, Regions region, String sourceBucket, String destinationBucket) {
        AmazonIdentityManagement iamClient = AmazonIdentityManagementClientBuilder.standard()
            .withRegion(region)
            .withCredentials(new ProfileCredentialsProvider())
            .build();
        StringBuilder trustPolicy = new StringBuilder();
        trustPolicy.append("{\\r\\n   ");
        trustPolicy.append("\\\"Version\\\":\\\"2012-10-17\\\",\\r\\n   ");
        trustPolicy.append("\\\"Statement\\\":[\\r\\n      {\\r\\n         ");
        trustPolicy.append("\\\"Effect\\\":\\\"Allow\\\",\\r\\n         \\\"Principal\\\":{\\r\\n            ");
        trustPolicy.append("\\\"Service\\\":\\\"s3.amazonaws.com\\\"\\r\\n         },\\r\\n         ");
        trustPolicy.append("\\\"Action\\\":\\\"sts:AssumeRole\\\"\\r\\n      }\\r\\n   ]\\r\\n}");

        CreateRoleRequest createRoleRequest = new CreateRoleRequest()
            .withRoleName(roleName)
            .withAssumeRolePolicyDocument(trustPolicy.toString());

        iamClient.createRole(createRoleRequest);

        StringBuilder permissionPolicy = new StringBuilder();
        permissionPolicy.append("{\\r\\n   \\\"Version\\\":\\\"2012-10-17\\\",\\r\\n   \\\"Statement\\\":[\\r\\n      {\\r\\n         ");
        permissionPolicy.append("\\\"Effect\\\":\\\"Allow\\\",\\r\\n         \\\"Action\\\":[\\r\\n             ");
        permissionPolicy.append("\\\"s3:GetObjectVersionForReplication\\\",\\r\\n            ");
        permissionPolicy.append("\\\"s3:GetObjectVersionAcl\\\"\\r\\n         ],\\r\\n         \\\"Resource\\\":[\\r\\n            ");
        permissionPolicy.append("\\\"arn:aws:s3:::");
        permissionPolicy.append(sourceBucket);
        permissionPolicy.append("/*\\\"\\r\\n         ]\\r\\n      },\\r\\n      {\\r\\n         ");
        permissionPolicy.append("\\\"Effect\\\":\\\"Allow\\\",\\r\\n         \\\"Action\\\":[\\r\\n            ");
        permissionPolicy.append("\\\"s3:ListBucket\\\",\\r\\n            \\\"s3:GetReplicationConfiguration\\\"\\r\\n         ");
        permissionPolicy.append("],\\r\\n         \\\"Resource\\\":[\\r\\n            \\\"arn:aws:s3:::");
        permissionPolicy.append(sourceBucket);
        permissionPolicy.append("\\r\\n         ");
        permissionPolicy.append("]\\r\\n      },\\r\\n      {\\r\\n         \\\"Effect\\\":\\\"Allow\\\",\\r\\n         ");
        permissionPolicy.append("\\\"Action\\\":[\\r\\n            \\\"s3:ReplicateObject\\\",\\r\\n            ");
        permissionPolicy.append("\\\"s3:ReplicateDelete\\\",\\r\\n            \\\"s3:ReplicateTags\\\",\\r\\n            ");
        permissionPolicy.append("\\\"s3:GetObjectVersionTagging\\\"\\r\\n\\r\\n         ],\\r\\n         ");
        permissionPolicy.append("\\\"Resource\\\":\\\"arn:aws:s3:::");
        permissionPolicy.append(destinationBucket);
        permissionPolicy.append("/*\\\"\\r\\n      }\\r\\n   ]\\r\\n}");

        PutRolePolicyRequest putRolePolicyRequest = new PutRolePolicyRequest()
            .withRoleName(roleName)
            .withPolicyDocument(permissionPolicy.toString())
            .withPolicyName("crrRolePolicy");

        iamClient.putRolePolicy(putRolePolicyRequest);

    }
}

// snippet-end:[s3.java.cross_region_replication.complete]


text:
First install home brew.

- [homebrew](http://brew.sh/)

## Update homebrew and install PCRE, lualib and redis

```
brew update
brew install pcre lualib redis
```

## Download and install OpenResty

Check for the latest version of OpenResty (adjust url to latest stable version number).
OpenResty includes nginx

```
curl -O http://openresty.org/download/ngx_openresty-1.7.10.2.tar.gz

tar xzvf ngx_openresty-*.tar.gz
cd ngx_openresty-*/
./configure --with-cc-opt="-I /usr/local/Cellar/pcre/8.37/include -I /usr/local/Cellar/luajit/2.0.4/include" --with-ld-opt="-L /usr/local/Cellar/pcre/8.37/lib -L /usr/local/Cellar/luajit/2.0.4/lib" --with-luajit
make
make install
```

## Add nginx to your path

Unfortunately OpenResty nginx is not automatically added to you PATH, so we need to add it manually.

```
vim ~/.bash_profile
export PATH="${PATH}:/usr/local/openresty/nginx/sbin"
```

## Start the beast

```
cd phonebloks-website
./scripts/start
```