text:
WebOfData specification document.

The work started in this repo has now been superceded by the UDA specification. This repo is left as a historical note and also contains some ideas and concepts yet to be added to UDA.

redpajama_set_name: RedPajamaGithub


text:
package org.jf.smalidea.dexlib.instruction;

import org.jf.dexlib2.iface.instruction.formats.Instruction21lh;
import org.jf.smalidea.psi.impl.SmaliInstruction;

import javax.annotation.Nonnull;

public class SmalideaInstruction21lh extends SmalideaInstruction implements Instruction21lh {
    public SmalideaInstruction21lh(@Nonnull SmaliInstruction instruction) {
        super(instruction);
    }

    @Override public short getHatLiteral() {
        return (short)(getWideLiteral() >>> 48);
    }
}


text:
package org.pcap4j.packet;

import static org.pcap4j.util.ByteArrays.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.pcap4j.packet.factory.PacketFactories;
import org.pcap4j.packet.factory.PacketFactory;
import org.pcap4j.packet.namednumber.IpNumber;
import org.pcap4j.packet.namednumber.IpV6RoutingType;
import org.pcap4j.packet.namednumber.NotApplicable;
import org.pcap4j.util.ByteArrays;

/**
 * @author Kaito Yamada
 * @since pcap4j 0.9.10
 */
public final class IpV6ExtRoutingPacket extends AbstractPacket {

  /**
   *
   */
  private static final long serialVersionUID = -4408422883412551431L;

  private final IpV6ExtRoutingHeader header;
  private final Packet payload;

  /**
   * A static factory method.
   * This method validates the arguments by {@link ByteArrays#validateBounds(byte[], int, int)},
   * which may throw exceptions undocumented here.
   *
   * @param rawData rawData
   * @param offset offset
   * @param length length
   * @return a new IpV6ExtRoutingPacket object.
   * @throws IllegalRawDataException if parsing the raw data fails.
   */
  public static IpV6ExtRoutingPacket newPacket(
    byte[] rawData, int offset, int length
  ) throws IllegalRawDataException {
    ByteArrays.validateBounds(rawData, offset, length);
    return new IpV6ExtRoutingPacket(rawData, offset, length);
  }
  private IpV6ExtRoutingPacket(
    byte[] rawData, int offset, int length
  ) throws IllegalRawDataException {
    this.header = new IpV6ExtRoutingHeader(rawData, offset, length);

    int payloadLength = length - header.length();
    if (payloadLength > 0) {
      PacketFactory<Packet, IpNumber> factory
        = PacketFactories.getFactory(Packet.class, IpNumber.class);
      Class<? extends Packet> nextPacketClass = factory.getTargetClass(header.getNextHeader());
      Packet nextPacket;
      if (nextPacketClass.equals(factory.getTargetClass())) {
        nextPacket =
          PacketFactories.getFactory(Packet.class, NotApplicable.class)
            .newInstance(
               rawData,
               offset + header.length(),
               payloadLength,
               NotApplicable.UNKNOWN_IP_V6_EXTENSION
             );
        if (nextPacket instanceof IllegalPacket) {
          nextPacket = factory.newInstance(rawData, offset + header.length(), payloadLength);
        }
      }
      else {
        nextPacket
          = factory.newInstance(
              rawData,
              offset + header.length(),
              payloadLength, header.getNextHeader()
            );
      }

      this.payload = nextPacket;
    }
    else {
      this.payload = null;
    }
  }

  private IpV6ExtRoutingPacket(Builder builder) {
    if (
         builder == null
      || builder.nextHeader == null
      || builder.data == null
    ) {
      StringBuilder sb = new StringBuilder();
      sb.append("builder: ").append(builder)
        .append(" builder.nextHeader: ").append(builder.nextHeader)
        .append(" builder.data: ").append(builder.data);
      throw new NullPointerException(sb.toString());
    }

    this.payload = builder.payloadBuilder != null ? builder.payloadBuilder.build() : null;
    this.header = new IpV6ExtRoutingHeader(builder);
  }

  @Override
  public IpV6ExtRoutingHeader getHeader() {
    return header;
  }

  @Override
  public Packet getPayload() {
    return payload;
  }

  @Override
  public Builder getBuilder() {
    return new Builder(this);
  }

  /**
   * @author Kaito Yamada
   * @since pcap4j 0.9.10
   */
  public static final
  class Builder extends AbstractBuilder
  implements LengthBuilder<IpV6ExtRoutingPacket> {

    private IpNumber nextHeader;
    private byte hdrExtLen;
    private IpV6RoutingType routingType;
    private byte segmentsLeft;
    private IpV6RoutingData data;
    private Packet.Builder payloadBuilder;
    private boolean correctLengthAtBuild;

    /**
     *
     */
    public Builder() {}

    /**
     *
     * @param packet packet
     */
    public Builder(IpV6ExtRoutingPacket packet) {
      this.nextHeader = packet.header.nextHeader;
      this.hdrExtLen = packet.header.hdrExtLen;
      this.routingType = packet.header.routingType;
      this.segmentsLeft = packet.header.segmentsLeft;
      this.data = packet.header.data;
      this.payloadBuilder = packet.payload != null ? packet.payload.getBuilder() : null;
    }

    /**
     *
     * @param nextHeader nextHeader
     * @return this Builder object for method chaining.
     */
    public Builder nextHeader(IpNumber nextHeader) {
      this.nextHeader = nextHeader;
      return this;
    }

    /**
     *
     * @param hdrExtLen hdrExtLen
     * @return this Builder object for method chaining.
     */
    public Builder hdrExtLen(byte hdrExtLen) {
      this.hdrExtLen = hdrExtLen;
      return this;
    }

    /**
     *
     * @param routingType routingType
     * @return this Builder object for method chaining.
     */
    public Builder routingType(IpV6RoutingType routingType) {
      this.routingType = routingType;
      return this;
    }

    /**
     *
     * @param segmentsLeft segmentsLeft
     * @return this Builder object for method chaining.
     */
    public Builder segmentsLeft(byte segmentsLeft) {
      this.segmentsLeft = segmentsLeft;
      return this;
    }

    /**
     *
     * @param data data
     * @return this Builder object for method chaining.
     */
    public Builder data(IpV6RoutingData data) {
      this.data = data;
      return this;
    }

    @Override
    public Builder payloadBuilder(Packet.Builder payloadBuilder) {
      this.payloadBuilder = payloadBuilder;
      return this;
    }

    @Override
    public Packet.Builder getPayloadBuilder() {
      return payloadBuilder;
    }

    @Override
    public Builder correctLengthAtBuild(boolean correctLengthAtBuild) {
      this.correctLengthAtBuild = correctLengthAtBuild;
      return this;
    }

    @Override
    public IpV6ExtRoutingPacket build() {
      return new IpV6ExtRoutingPacket(this);
    }

  }

  /**
   * @author Kaito Yamada
   * @since pcap4j 0.9.10
   */
  public static final class IpV6ExtRoutingHeader extends AbstractHeader {

    /*
     *   0                              16                            31
     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     *  |  Next Header  |  Hdr Ext Len  |  Routing Type | Segments Left |
     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     *  |                                                               |
     *  .                                                               .
     *  .                       type-specific data                      .
     *  .                                                               .
     *  |                                                               |
     *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     *
     */

    /**
     *
     */
    private static final long serialVersionUID = -72622140516174483L;

    private static final int NEXT_HEADER_OFFSET
      = 0;
    private static final int NEXT_HEADER_SIZE
      = BYTE_SIZE_IN_BYTES;
    private static final int HDR_EXT_LEN_OFFSET
      = NEXT_HEADER_OFFSET + NEXT_HEADER_SIZE;
    private static final int HDR_EXT_LEN_SIZE
      = BYTE_SIZE_IN_BYTES;
    private static final int ROUTING_TYPE_OFFSET
      = HDR_EXT_LEN_OFFSET + HDR_EXT_LEN_SIZE;
    private static final int ROUTING_TYPE_SIZE
      = BYTE_SIZE_IN_BYTES;
    private static final int SEGMENTS_LEFT_OFFSET
      = ROUTING_TYPE_OFFSET + ROUTING_TYPE_SIZE;
    private static final int SEGMENTS_LEFT_SIZE
      = BYTE_SIZE_IN_BYTES;
    private static final int TYPE_SPECIFIC_DATA_OFFSET
      = SEGMENTS_LEFT_OFFSET + SEGMENTS_LEFT_SIZE;

    private final IpNumber nextHeader;
    private final byte hdrExtLen;
    private final IpV6RoutingType routingType;
    private final byte segmentsLeft;
    private final IpV6RoutingData data;

    private IpV6ExtRoutingHeader(
      byte[] rawData, int offset, int length
    ) throws IllegalRawDataException {
      if (length < 4) {
        StringBuilder sb = new StringBuilder(110);
        sb.append(
            "The data length of IPv6 routing header is must be more than 3. data: "
           )
          .append(ByteArrays.toHexString(rawData, " "))
          .append(", offset: ")
          .append(offset)
          .append(", length: ")
          .append(length);
        throw new IllegalRawDataException(sb.toString());
      }

      this.nextHeader
        = IpNumber
            .getInstance(ByteArrays.getByte(rawData, NEXT_HEADER_OFFSET + offset));
      this.hdrExtLen
        = ByteArrays.getByte(rawData, HDR_EXT_LEN_OFFSET + offset);

      int headerLength = (getHdrExtLenAsInt() + 1) * 8;
      if (length < headerLength) {
        StringBuilder sb = new StringBuilder(110);
        sb.append("The data is too short to build an IPv6 routing header(")
          .append(headerLength)
          .append(" bytes). data: ")
          .append(ByteArrays.toHexString(rawData, " "))
          .append(", offset: ")
          .append(offset)
          .append(", length: ")
          .append(length);
        throw new IllegalRawDataException(sb.toString());
      }

      this.routingType
        = IpV6RoutingType.getInstance(
            ByteArrays.getByte(rawData, ROUTING_TYPE_OFFSET + offset)
          );
      this.segmentsLeft
        = ByteArrays.getByte(rawData, SEGMENTS_LEFT_OFFSET + offset);
      this.data
        = PacketFactories
            .getFactory(IpV6RoutingData.class, IpV6RoutingType.class)
              .newInstance(
                 rawData,
                 TYPE_SPECIFIC_DATA_OFFSET + offset,
                 headerLength - 4,
                 routingType
               );
    }

    private IpV6ExtRoutingHeader(Builder builder) {
      if (builder.data.length() < 4) {
        StringBuilder sb = new StringBuilder(100);
        sb.append("data length must be more than 3. data: ")
          .append(builder.data);
        throw new IllegalArgumentException(sb.toString());
      }
      if (((builder.data.length() + 4) % 8) != 0) {
        StringBuilder sb = new StringBuilder(100);
        sb.append("(builder.data.length() + 8 ) % 8 must be 0. data: ")
          .append(builder.data);
        throw new IllegalArgumentException(sb.toString());
      }

      this.nextHeader = builder.nextHeader;
      this.routingType = builder.routingType;
      this.segmentsLeft = builder.segmentsLeft;
      this.data = builder.data;

      if (builder.correctLengthAtBuild) {
        this.hdrExtLen = (byte)((data.length() + 4) / 8 - 1);
      }
      else {
        this.hdrExtLen = builder.hdrExtLen;
      }
    }

    /**
     *
     * @return nextHeader
     */
    public IpNumber getNextHeader() { return nextHeader; }

    /**
     *
     * @return hdrExtLen
     */
    public byte getHdrExtLen() { return hdrExtLen; }

    /**
     *
     * @return hdrExtLen
     */
    public int getHdrExtLenAsInt() { return 0xFF & hdrExtLen; }

    /**
     *
     * @return routingType
     */
    public IpV6RoutingType getRoutingType() { return routingType; }

    /**
     *
     * @return segmentsLeft
     */
    public byte getSegmentsLeft() { return segmentsLeft; }

    /**
     *
     * @return segmentsLeft
     */
    public int getSegmentsLeftAsInt() { return segmentsLeft & 0xFF; }

    /**
     *
     * @return data
     */
    public IpV6RoutingData getData() { return data; }

    @Override
    protected List<byte[]> getRawFields() {
      List<byte[]> rawFields = new ArrayList<byte[]>();
      rawFields.add(ByteArrays.toByteArray(nextHeader.value()));
      rawFields.add(ByteArrays.toByteArray(hdrExtLen));
      rawFields.add(ByteArrays.toByteArray(routingType.value()));
      rawFields.add(ByteArrays.toByteArray(segmentsLeft));
      rawFields.add(data.getRawData());
      return rawFields;
    }

    @Override
    public int calcLength() { return data.length() + 4; }

    @Override
    protected String buildString() {
      StringBuilder sb = new StringBuilder();
      String ls = System.getProperty("line.separator");

      sb.append("[IPv6 Routing Header (")
        .append(length())
        .append(" bytes)]")
        .append(ls);
      sb.append("  Next Header: ")
        .append(nextHeader)
        .append(ls);
      sb.append("  Hdr Ext Len: ")
        .append(getHdrExtLenAsInt())
        .append(" (")
        .append((getHdrExtLenAsInt() + 1) * 8)
        .append(" [bytes])")
        .append(ls);
      sb.append("  Routing Type: ")
        .append(routingType)
        .append(ls);
      sb.append("  Segments Left: ")
        .append(getSegmentsLeftAsInt())
        .append(ls);
      sb.append("  type-specific data: ")
        .append(data)
        .append(ls);

      return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
      if (obj == this) { return true; }
      if (!this.getClass().isInstance(obj)) { return false; }

      IpV6ExtRoutingHeader other = (IpV6ExtRoutingHeader)obj;
      return
           nextHeader.equals(other.nextHeader)
        && data.equals(other.data)
        && routingType.equals(other.routingType)
        && segmentsLeft == other.segmentsLeft
        && hdrExtLen == other.hdrExtLen;
    }

    @Override
    protected int calcHashCode() {
      int result = 17;
      result = 31 * result + nextHeader.hashCode();
      result = 31 * result + hdrExtLen;
      result = 31 * result + routingType.hashCode();
      result = 31 * result + segmentsLeft;
      result = 31 * result + data.hashCode();
      return result;
    }

  }

  /**
   * The interface representing an IPv6 routing data.
   * If you use {@link org.pcap4j.packet.factory.PropertiesBasedPacketFactory PropertiesBasedPacketFactory},
   * Classes which imprement this interface must implement the following method:
   * {@code public static IpV6RoutingData newInstance(byte[] rawData, int offset, int length)
   * throws IllegalRawDataException}
   *
   * @author Kaito Yamada
   * @since pcap4j 0.9.11
   */
  public interface IpV6RoutingData extends Serializable {

    /**
     *
     * @return length
     */
    public int length();

    /**
     *
     * @return raw data
     */
    public byte[] getRawData();

  }

}


text:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class loginPage extends CI_Controller
{

    function __construct()
    {
      parent::__construct();
      parent::registerXajax();
    }

	function loginPage()
	{
	  $smarty = new TestSmarty();
	  $objResponse = new xajaxResponse();
	  $template = $smarty->fetch('login_form.tpl');
	  $objResponse->assign("loginXajax_content","innerHTML",$template);
	  $objResponse->script("loginFormAnimation()");
	  return $objResponse;
	}
}


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\ApiBundle\Application\Entity;

use Sylius\Component\Core\Model\AdminUserInterface;

class Foo
{
    /** @var int */
    private $id;

    /** @var string */
    private $name;

    /** @var AdminUserInterface */
    private $owner;

    /** @var FooSyliusResource */
    private $fooSyliusResource;

    public function getId(): int
    {
        return $this->id;
    }

    public function setId(int $id): void
    {
        $this->id = $id;
    }

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

    public function setName(string $name): void
    {
        $this->name = $name;
    }

    public function getOwner(): AdminUserInterface
    {
        return $this->owner;
    }

    public function setOwner(AdminUserInterface $owner): void
    {
        $this->owner = $owner;
    }

    public function getFooSyliusResource(): FooSyliusResource
    {
        return $this->fooSyliusResource;
    }

    public function setFooSyliusResource(FooSyliusResource $fooSyliusResource): void
    {
        $this->fooSyliusResource = $fooSyliusResource;
    }
}


text:
/* Commentary:
 *
 */

/* Change log:
 *
 */

#include "dtkAbstractProcess.h"
#include "dtkAbstractProcess_p.h"

// /////////////////////////////////////////////////////////////////
// dtkAbstractProcess implementation
// /////////////////////////////////////////////////////////////////

dtkAbstractProcess::dtkAbstractProcess(dtkAbstractProcess *parent) : dtkAbstractObject(*new dtkAbstractProcessPrivate(this), parent)
{

}

dtkAbstractProcess::dtkAbstractProcess(const dtkAbstractProcess& other) : dtkAbstractObject(*new dtkAbstractProcessPrivate(*other.d_func()), other)
{

}

dtkAbstractProcess::~dtkAbstractProcess(void)
{

}

//! Returns a new dtkAbstractProcess that is a copy of this.
/*!
 *  This method can be overloaded through the hierarchy enabling a
 *  deep copy of this. Note that, using covariance of returned type,
 *  the returned argument can be of the more derived type.
 *
 *  Example:
 *  \code
 *  class xyzProcess : public dtkAbstractProcess
 *  {
 *    ...
 *    xyzProcess *clone(void); // Covariant returned argument
 *    ...
 *  };
 *
 *  xyzProcess *xyzProcess::clone(void)
 *  {
 *     return new xyzProcess(*this);
 *  }
 *  \endcode
 */
dtkAbstractProcess *dtkAbstractProcess::clone(void)
{
    return new dtkAbstractProcess(*this);
}

dtkAbstractProcess& dtkAbstractProcess::operator=(const dtkAbstractProcess& other)
{
    this->copy(other);

    return (*this);
}

//! Enables to make a deep copy of the attributes through the class
//! hierarchy.
/*!
 *  This method is called by the assignement operator which delegates
 *  the copy process. When re-implementing this method into a derived
 *  class of dtkAbstractProcess, one must called first the copy method
 *  of the parent to ensure that all the attributes are really copied.
 *
 *  Nevertheless, some caution must be taken to avoid slicing problem
 *  as shown in the following example.
 *
 *  Example:
 *  \code
 *  class xyzProcess : public dtkAbstractProcess
 *  {
 *    ...
 *    void copy(const dtkAbstractObject& other);
 *    ...
 *  };
 *
 *  void xyzProcess::copy(const dtkAbstractObject& other)
 *  {
 *     // copy of the parent attributes
 *     dtkAbstractProcess::copy(other);
 *
 *     // copy of the xyzProcess attributes
 *     if (other.identifier() == this->identifier()) {
 *        // cast other into xyzProcess and do the copy
 *     } else {
 *        dtkWarn() << "other is not of same type than this, slicing is occuring.";
 *     }
 *  }
 *  \endcode
 */
void dtkAbstractProcess::copy(const dtkAbstractObject& other)
{
    dtkAbstractObject::copy(other);
}

QDebug operator<<(QDebug debug, const dtkAbstractProcess& process)
{
    debug.nospace() << process.identifier();

    return debug.space();
}

QDebug operator<<(QDebug debug, dtkAbstractProcess *process)
{
    debug.nospace() << process->identifier();

    return debug.space();
}

int dtkAbstractProcess::run(void)
{
    int retval = this->update();

    if (retval == 0)
        emit success();
    else
        emit failure();

    return retval;
}

void dtkAbstractProcess::cancel (void)
{
    onCanceled ();
    emit canceled();
}

int dtkAbstractProcess::update(void)
{
    //DTK_DEFAULT_IMPLEMENTATION;

    return DTK_FAILURE;
}

void dtkAbstractProcess::onCanceled (void)
{
    //DTK_DEFAULT_IMPLEMENTATION;
}

bool dtkAbstractProcess::read(const QString& file)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(file);

    return false;
}

bool dtkAbstractProcess::read(const QStringList& files)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(files);

    return false;
}

bool dtkAbstractProcess::write(const QString& file)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(file);

    return false;
}

bool dtkAbstractProcess::write(const QStringList& files)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(files);

    return false;
}

void dtkAbstractProcess::setParameter(int data)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
}

void dtkAbstractProcess::setParameter(int data, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setParameter(int data, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

void dtkAbstractProcess::setParameter(int *data)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
}

void dtkAbstractProcess::setParameter(int *data, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setParameter(int *data, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

void dtkAbstractProcess::setParameter(qlonglong data)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
}

void dtkAbstractProcess::setParameter(qlonglong data, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setParameter(qlonglong data, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

void dtkAbstractProcess::setParameter(qlonglong *data)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
}

void dtkAbstractProcess::setParameter(qlonglong *data, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setParameter(qlonglong *data, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

void dtkAbstractProcess::setParameter(double  data)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
}

void dtkAbstractProcess::setParameter(double  data, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setParameter(double  data, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

void dtkAbstractProcess::setParameter(double *data, int count)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(count);
}

void dtkAbstractProcess::setParameter(double *data, int count, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(count);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setParameter(double *data, int count, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(count);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

void dtkAbstractProcess::setParameter(dtkAbstractObject  *data)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
}

void dtkAbstractProcess::setParameter(dtkAbstractObject  *data, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setParameter(dtkAbstractObject  *data, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

void dtkAbstractProcess::setInput(dtkAbstractData *data)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
}

void dtkAbstractProcess::setInput(dtkAbstractData *data, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setInput(dtkAbstractData *data, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

void dtkAbstractProcess::setData(void *data)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
}

void dtkAbstractProcess::setData(void *data, int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
}

void dtkAbstractProcess::setData(void *data, int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(data);
    Q_UNUSED(channel);
    Q_UNUSED(frame);
}

dtkAbstractData *dtkAbstractProcess::output(void)
{
    //DTK_DEFAULT_IMPLEMENTATION;

    return NULL;
}

dtkAbstractData *dtkAbstractProcess::output(int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(channel);

    return NULL;
}

dtkAbstractData *dtkAbstractProcess::output(int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(channel);
    Q_UNUSED(frame);

    return NULL;
}

void *dtkAbstractProcess::data(void)
{
    //DTK_DEFAULT_IMPLEMENTATION;

    return NULL;
}

void *dtkAbstractProcess::data(int channel)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(channel);

    return NULL;
}

void *dtkAbstractProcess::data(int channel, int frame)
{
    //DTK_DEFAULT_IMPLEMENTATION;
    Q_UNUSED(channel);
    Q_UNUSED(frame);

    return NULL;
}

int dtkAbstractProcess::channelCount(void)
{
    return 0;
}


text:
package org.apache.tapestry5.genericsresolverguava.internal;

import org.apache.tapestry5.beaneditor.ReorderProperties;

@ReorderProperties("third")
public class PropertyOrderBean
{
    private String first;

    private String second;

    private String third;

    public String getFirst()
    {
        return first;
    }

    public String getSecond()
    {
        return second;
    }

    public String getThird()
    {
        return third;
    }

    public void setFirst(String first)
    {
        this.first = first;
    }

    public void setSecond(String second)
    {
        this.second = second;
    }

    public void setThird(String third)
    {
        this.third = third;
    }
}


text:
import createDiv from '../common/cElement/createDiv';
import contains from '../common/contains';
import getElementById from '../common/getElementById';
import getText from '../common/getText';
import hasClass from '../common/hasClass';
import insertElement from '../common/insertElement';
import querySelectorArray from '../common/querySelectorArray';
import setInnerHtml from '../dom/setInnerHtml';

function doServerNode(topbannerStats, miniboxList) {
  const nodeName = getText(miniboxList.children[7]);
  const serverDiv = createDiv({
    className: 'tooltip-bottom',
    dataset: { tooltip: 'Server' },
    textContent: `Server: ${nodeName}`,
  });
  insertElement(topbannerStats, serverDiv);
}

function doOnlinePlayers(topbannerStats, miniboxList) {
  const playersOnline = miniboxList.children[3].innerHTML;
  const bannerPlayers = topbannerStats.children[0];
  setInnerHtml(`Online: ${playersOnline}`, bannerPlayers);
}

function statBoxesExist(topbannerStats, gameStats) {
  const miniboxList = gameStats.nextElementSibling.children[0];
  if (miniboxList.children.length === 8) {
    doServerNode(topbannerStats, miniboxList);
    doOnlinePlayers(topbannerStats, miniboxList);
    gameStats.parentNode.classList.add('fshInvisible');
  }
}

function validStatBoxes(topbannerStats, gameStats) {
  const hidden = topbannerStats
    && hasClass('topbanner-stats-hidden', topbannerStats);
  return !hidden && gameStats;
}

export default function injectServerNode() {
  const topbannerStats = getElementById('topbanner-stats');
  const gameStats = querySelectorArray('#pCR h3').find(contains('Game Stats'));
  if (validStatBoxes(topbannerStats, gameStats)) {
    statBoxesExist(topbannerStats, gameStats);
  }
}


text:
The first ever release of the JavaAppSuite.
Here are the provided applications completely developed in Java and is completely compatible with these variants of
Java:
- Oracle Java 7/8
- OpenJDK Java 7/8
The default applications that we aim to develop to this release is:
- Calculator
- Text Editor
- System Information
- Package Manager

## Contribute
Please contribute to the future suites of JavaApps by testing these app in JNode and reporting issues to the Ubiquitous issue reporter.

## Calculator
The Calculator aims to be a replacement for the default calculators installed. It aims to be a more simpler inteface, but does less advance calculation and is limited to 2 numbers at once.

## Text Editor
The Text Editor is a simple editor, that simply saves a TXT file to a specified location and loads it and allows the user to modify parts of it and create new TXT files.

## System Information
The System Information app will gather the reported java system properties and display it to the user.

## Package Manager
Package Manager app will allow installation of the provided JAR files (libraries can be put in the classpath) from our repository.


text:
class RenamePreviousTextFromTranslation < ActiveRecord::Migration
  def up
    rename_column :translations, :previous_text, :author
  end

  def down
    rename_column :translations, :author, :previous_text
  end
end


text:
module Braintree
  class UsBankAccountVerification
    include BaseModule
    include Braintree::Util::IdEquality

    module Status
      Failed = "failed"
      GatewayRejected = "gateway_rejected"
      ProcessorDeclined = "processor_declined"
      Verified = "verified"
      Pending = "pending"

      All = [Failed, GatewayRejected, ProcessorDeclined, Verified, Pending]
    end

    module VerificationMethod
      IndependentCheck = "independent_check"
      NetworkCheck = "network_check"
      TokenizedCheck = "tokenized_check"
      MicroTransfers = "micro_transfers"

      All = [IndependentCheck, NetworkCheck, TokenizedCheck, MicroTransfers]
    end

    attr_reader :id
    attr_reader :status
    attr_reader :verification_determined_at
    attr_reader :verification_method
    attr_reader :processor_response_code
    attr_reader :processor_response_text
    attr_reader :merchant_account_id
    attr_reader :gateway_rejection_reason
    attr_reader :us_bank_account
    attr_reader :created_at

    def initialize(attributes) # :nodoc:
      set_instance_variables_from_hash(attributes)
    end

    def inspect # :nodoc:
      attr_order = [
        :status,
        :processor_response_code,
        :processor_response_text,
        :merchant_account_id,
        :gateway_rejection_reason,
        :id,
        :us_bank_account,
        :verification_method,
        :verification_determined_at,
        :created_at
      ]

      formatted_attrs = attr_order.map do |attr|
        "#{attr}: #{send(attr).inspect}"
      end

      "#<#{self.class} #{formatted_attrs.join(", ")}>"
    end

    class << self
      protected :new
    end

    def self._new(*args) # :nodoc:
      self.new(*args)
    end

    def self.confirm_micro_transfer_amounts(*args)
      Configuration.gateway.us_bank_account_verification.confirm_micro_transfer_amounts(*args)
    end

    def self.find(*args)
      Configuration.gateway.us_bank_account_verification.find(*args)
    end

    def self.search(&block)
      Configuration.gateway.us_bank_account_verification.search(&block)
    end
  end
end


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=type.U505.html">

Redirecting to type.U505.html...


text:
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

require 'tmpdir'
require 'fileutils'

describe "ImageCrush" do

  before :each do
    remove_any_work_dirs
  end

  after :all do
    remove_any_work_dirs
  end

  describe 'exception conditions' do
    it 'should fail when the input file does not exist' do
      lambda{ImageCrush('/path/to/nowhere/fast')}.should raise_error(ImageCrush::InputFileNotFound)
    end

    it 'should fail when the crush tool is not available' do
      ImageCrush::Pngcrush.should_receive(:available?).and_return(false)
      lambda{ImageCrush(DICE_PATH)}.should raise_error(ImageCrush::CrushToolNotAvailable)
    end
  end

  describe 'individual files' do
    it 'should crush PNG files' do
      image_path = copy_file_to_tmpdir(DICE_PATH)
      should_reduce_size_of_image(image_path)
    end

    it 'should crush JPEG files' do
      image_path = copy_file_to_tmpdir(MMAN_PATH)
      should_reduce_size_of_image(image_path)
    end

    it 'should ignore other files' do
      path = copy_file_to_tmpdir(README_PATH)
      ImageCrush(path)
      File.exist?('/tmp/image_crush/README.txt').should == false
    end

    private

    def should_reduce_size_of_image(path)
      f = File.open(path)
      size_before = f.stat.size
      f.close
      ImageCrush(path)
      f = File.open(path)
      size_after = f.stat.size
      f.close
      size_after.should < size_before
    end
  end

  describe 'recursive crush' do
    before do
      create_work_dir
      FileUtils.cp_r Dir.glob(File.join(FIXTURES_ROOT, '**')), @work_dir
      @dice_path = File.join(@work_dir, File.basename(DICE_PATH))
      @ccby_path = File.join(@work_dir, 'subdir', File.basename(CCBY_PATH))
    end

    it 'should recursively crush all images in a directory' do
      f1 = File.open(@dice_path)
      size1_before = f1.stat.size
      f1.close
      f2 = File.open(@ccby_path)
      size2_before = f2.stat.size
      f2.close

      ImageCrush(@work_dir)

      f1 = File.open(@dice_path)
      size1_after = f1.stat.size
      f1.close
      f2 = File.open(@ccby_path)
      size2_after = f2.stat.size
      f2.close

      size1_after.should < size1_before
      size2_after.should < size2_before
    end
  end

end


text:
@interface NSObject (Associate1)
@property(nonatomic,copy)NSString *address;
@end


text:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="d1/d12/class_dependency_object">
<title>DependencyObject class Reference</title>
<para>Inheritance diagram for DependencyObject</para>
<para>
    <figure>
        <title>Inheritance graph</title>
        <mediaobject>
            <imageobject>
                <imagedata width="50%" align="center" valign="middle" scalefit="1" fileref="../../d6/d8a/class_dependency_object__inherit__graph.png"></imagedata>
            </imageobject>
        </mediaobject>
    </figure>
</para>
<para>Collaboration diagram for DependencyObject</para>
<para>
    <figure>
        <title>Collaboration graph</title>
        <mediaobject>
            <imageobject>
                <imagedata width="50%" align="center" valign="middle" scalefit="1" fileref="../../d4/db3/class_dependency_object__coll__graph.png"></imagedata>
            </imageobject>
        </mediaobject>
    </figure>
</para>
</section>


text:
package io.strimzi.operator.common.operator.resource;

import io.fabric8.kubernetes.api.model.rbac.RoleBinding;
import io.fabric8.kubernetes.api.model.rbac.RoleBindingBuilder;
import io.fabric8.kubernetes.api.model.rbac.RoleBindingList;
import io.fabric8.kubernetes.api.model.rbac.RoleRef;
import io.fabric8.kubernetes.api.model.rbac.RoleRefBuilder;
import io.fabric8.kubernetes.api.model.rbac.Subject;
import io.fabric8.kubernetes.api.model.rbac.SubjectBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.RbacAPIGroupDSL;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.vertx.core.Vertx;

import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class RoleBindingOperatorTest extends AbstractResourceOperatorTest<KubernetesClient, RoleBinding, RoleBindingList, Resource<RoleBinding>> {

    @Override
    protected Class<KubernetesClient> clientType() {
        return KubernetesClient.class;
    }

    @Override
    protected Class<? extends Resource> resourceType() {
        return Resource.class;
    }

    @Override
    protected RoleBinding resource() {
        Subject ks = new SubjectBuilder()
                .withKind("ServiceAccount")
                .withName("some-service-account")
                .withNamespace(NAMESPACE)
                .build();

        RoleRef roleRef = new RoleRefBuilder()
                .withName("some-role")
                .withApiGroup("rbac.authorization.k8s.io")
                .withKind("ClusterRole")
                .build();

        return new RoleBindingBuilder()
                .withNewMetadata()
                    .withName(RESOURCE_NAME)
                    .withNamespace(NAMESPACE)
                    .withLabels(singletonMap("foo", "bar"))
                .endMetadata()
                .withRoleRef(roleRef)
                .withSubjects(singletonList(ks))
                .build();
    }

    @Override
    protected RoleBinding modifiedResource() {
        RoleRef roleRef = new RoleRefBuilder()
                .withName("some-other-role")
                .withApiGroup("rbac.authorization.k8s.io")
                .withKind("ClusterRole")
                .build();

        return new RoleBindingBuilder(resource())
                .withRoleRef(roleRef)
                .build();
    }

    @Override
    protected void mocker(KubernetesClient mockClient, MixedOperation op) {
        RbacAPIGroupDSL mockRbac = mock(RbacAPIGroupDSL.class);
        when(mockClient.rbac()).thenReturn(mockRbac);
        when(mockClient.rbac().roleBindings()).thenReturn(op);
    }

    @Override
    protected AbstractResourceOperator<KubernetesClient, RoleBinding, RoleBindingList,
            Resource<RoleBinding>> createResourceOperations(Vertx vertx, KubernetesClient mockClient) {
        return new RoleBindingOperator(vertx, mockClient);
    }
}


text:
using NDomain.CQRS;
using NDomain.EventSourcing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NDomain.Configuration
{
    /// <summary>
    /// Configurator for the event sourcing persistence capabilities
    /// </summary>
    public class EventSourcingConfigurator : Configurator
    {
        readonly HashSet<Type> aggregateTypes;

        /// <summary>
        /// Gets or sets the IEventStoreDb to be used.
        /// Eg: Azure tables, SqlServer, RavenDb, etc.
        /// </summary>
        /// <remarks>
        /// Note that the IEventStoreDb only handles the persistence features, while the IEventStore is a higher level concept
        /// which handles deserialization and coordinates event storage and publishing between the IEventStoreDb and IEventStoreBus.
        /// </remarks>
        public IEventStoreDb EventStoreDb { get; set; }

        public EventSourcingConfigurator(ContextBuilder builder)
            : base(builder)
        {
            this.aggregateTypes = new HashSet<Type>();

            builder.Configuring += this.OnConfiguring;
        }

        /// <summary>
        /// Registers an aggregate type to be used with EventSourcing.
        /// This allows NDomain to generate serializer and deserializer functions for the aggregate events.
        /// </summary>
        /// <typeparam name="TAggregate">Type of the aggregate</typeparam>
        /// <returns>The current instance, to be used in a fluent manner</returns>
        public EventSourcingConfigurator BindAggregate<TAggregate>()
            where TAggregate : IAggregate
        {
            this.aggregateTypes.Add(typeof(TAggregate));

            return this;
        }

        /// <summary>
        /// Configures the local EventStore, which should be used only for test and learning purposes.
        /// </summary>
        /// <returns>The current instance, to be used in a fluent manner</returns>
        public EventSourcingConfigurator UseLocalEventStore()
        {
            this.EventStoreDb = new LocalEventStore();
            return this;
        }

        private void OnConfiguring(ContextBuilder builder)
        {
            var serializer = EventStoreSerializer.FromAggregateTypes(this.aggregateTypes);

            builder.EventStore = new Lazy<IEventStore>(
                () => new EventStore(this.EventStoreDb ?? new LocalEventStore(),
                                     new EventBus(builder.MessageBus.Value),
                                     serializer));
        }
    }
}


text:
- The framework allows rendering basic 2D / 3D graphics and accept all kinds of input (keyboard, mouse, joystick, touch devices)
- SGScript is right at the core to provide a solid, standalone scripting solution that is easy to use and can be deployed anywhere.
- It's good for creating:
 - games
 - visually rich interactive / UI applications
 - quick visual prototypes
 - other technically complicated creations
- Things not available (yet):
 - browser support
 - advanced automatic text rendering (like HTML, to be handled by an external library)
 - advanced 3D graphics (support is on the way)

## Example Usage

    function initialize()
    {
    	global Window = SS_CreateWindow( "SGS-SDL Game Framework", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1024, 576, SDL_WINDOW_OPENGLMAYBE );
    	Window.initRenderer( SS_RENDERER_DONTCARE, SS_RENDERER_VSYNC );
    }
    function update()
    {
    	SS_Clear( color(0.1,0.2,0.4) );
    	SS_Present();
    }
    function on_event( e )
    {
    	if( e.type == SDL_QUIT )
    		global sys_exit = true;
    }

## Getting Started

- On Windows, `make` can be used in the root directory to fully build the library.
- Creating a new application is as simple as copying the following items from `bin` to a new directory:
 - `core` directory
 - `fonts` directory
 - `FreeImage.dll`
 - `libfreetype-6.dll`
 - `SDL2.dll`
 - `sgscript.dll`
 - `sgs-sdl.dll`
 - `sgs-sdl-debug.exe`
 - `sgs-sdl-release.exe`
- `sgsxgmath.dll`
- `/bin/tests/empty-template.sgs` is a good starting template for `main.sgs`

## Design Goals

- Main goal is for the framework to be portable. To be able to just download the data and keep working on it anywhere.
- Another goal is substantial coverage. Supporting most common formats and features for sufficient compatibility.
- Third goal is simplicity. It should be easy to infinitely expand on the foundations while building applications for maximum code effectivity.

## Detailed Usage

- See [a Ludum Dare game example](http://www.ludumdare.com/compo/ludum-dare-29/?action=preview&uid=34947) for more info on how it can be used.
- HTML/text documentation is under `/docs`.

## Comparable tools

None that I could approve of. The extensibility/development speed combo is rather unique.

## Developer info

Developed by Arvīds Kokins, the developer of [SGScript](http://www.sgscript.org/).

These libraries are included in the software:

- [SDL2](https://www.libsdl.org/index.php)
- [FreeType](http://www.freetype.org/)
- [libpng](http://www.libpng.org/pub/png/libpng.html)
- [libjpeg](http://www.ijg.org/)
- [zlib](http://www.zlib.net/)


text:
// <copyright file="DefaultCounterManagerTests.cs" company="App Metrics Contributors">
// Copyright (c) App Metrics Contributors. All rights reserved.
// </copyright>

using App.Metrics.Counter;
using App.Metrics.Facts.Fixtures;
using FluentAssertions;
using Xunit;

namespace App.Metrics.Facts.Managers
{
    public class DefaultCounterManagerTests : IClassFixture<MetricCoreTestFixture>
    {
        private readonly string _context;
        private readonly MetricCoreTestFixture _fixture;
        private readonly IMeasureCounterMetrics _manager;

        public DefaultCounterManagerTests(MetricCoreTestFixture fixture)
        {
            _fixture = fixture;
            _manager = _fixture.Managers.Counter;
            _context = _fixture.Context;
        }

        [Fact]
        public void Can_decrement_counter()
        {
            var metricName = "test_decrement_counter";
            var options = new CounterOptions { Name = metricName };

            _manager.Decrement(options);

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(-1L);
        }

        [Fact]
        public void Can_decrement_counter_by_amount()
        {
            var metricName = "test_decrement_counter_by_amount";
            var options = new CounterOptions { Name = metricName };

            _manager.Decrement(options, 2L);

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(-2L);
        }

        [Fact]
        public void Can_decrement_counter_item()
        {
            var metricName = "test_decrement_counter_item";
            var options = new CounterOptions() { Name = metricName };

            _manager.Decrement(options, "item1");

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(-1L);
        }

        [Fact]
        public void Can_decrement_counter_item_by_amount()
        {
            var metricName = "test_decrement_counter_item_by_amount";
            var options = new CounterOptions { Name = metricName };

            _manager.Decrement(options, 3L, "item1");

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(-3L);
        }

        [Fact]
        public void Can_decrement_counter_metric_item()
        {
            var metricName = "test_decrement_counter_metric_item";
            var options = new CounterOptions { Name = metricName };

            _manager.Decrement(
                options,
                new MetricSetItem("item4", "value4"));

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(-1L);
        }

        [Fact]
        public void Can_decrement_counter_metric_item_by_amount()
        {
            var metricName = "test_decrement_counter_metric_item_by_amount";
            var options = new CounterOptions() { Name = metricName };

            _manager.Decrement(
                options,
                3L,
                new MetricSetItem("item3", "value3"));

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(-3L);
        }

        [Fact]
        public void Can_decrement_multidimensional_counter()
        {
            var metricName = "test_decrement_counter_multi";
            var options = new CounterOptions { Name = metricName };

            _manager.Decrement(options, _fixture.Tags[0]);
            _manager.Decrement(options, _fixture.Tags[1]);

            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Count.Should().Be(-1L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Count.Should().Be(-1L);
        }

        [Fact]
        public void Can_decrement_multidimensional_counter_by_amount()
        {
            var metricName = "test_decrement_counter_by_amount_multi";
            var options = new CounterOptions { Name = metricName };

            _manager.Decrement(options, _fixture.Tags[0], 2L);
            _manager.Decrement(options, _fixture.Tags[1], 3L);

            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Count.Should().Be(-2L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Count.Should().Be(-3L);
        }

        [Fact]
        public void Can_decrement_multidimensional_counter_item()
        {
            var metricName = "test_decrement_counter_item_multi";
            var options = new CounterOptions { Name = metricName };

            _manager.Decrement(options, _fixture.Tags[0], "item1");
            _manager.Decrement(options, _fixture.Tags[1], "item1");

            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Count.Should().Be(-1L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Items.Length.Should().Be(1);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Items[0].Item.Should().Be("item1");
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Count.Should().Be(-1L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Items.Length.Should().Be(1);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Items[0].Item.Should().Be("item1");
        }

        [Fact]
        public void Can_decrement_multidimensional_counter_item_by_amount()
        {
            var metricName = "test_decrement_counter_item_by_amount_multi";
            var options = new CounterOptions { Name = metricName };

            _manager.Decrement(options, _fixture.Tags[0], 3L, "item1");
            _manager.Decrement(options, _fixture.Tags[1], 5L, "item1");

            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Count.Should().Be(-3L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Count.Should().Be(-5L);
        }

        [Fact]
        public void Can_increment_counter()
        {
            var metricName = "test_increment_counter";
            var options = new CounterOptions() { Name = metricName };

            _manager.Increment(options);

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(1L);
        }

        [Fact]
        public void Can_increment_counter_by_amount()
        {
            var metricName = "test_increment_counter_by_amount";
            var options = new CounterOptions() { Name = metricName };

            _manager.Increment(options, 2L);

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(2L);
        }

        [Fact]
        public void Can_increment_counter_item()
        {
            var metricName = "test_increment_counter_item";
            var options = new CounterOptions { Name = metricName };

            _manager.Increment(options, "item1");

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(1L);
        }

        [Fact]
        public void Can_increment_counter_item_by_amount()
        {
            var metricName = "test_increment_counter_item_by_amount";
            var options = new CounterOptions { Name = metricName };

            _manager.Increment(options, 3L, "item1");

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(3L);
        }

        [Fact]
        public void Can_increment_counter_metric_item()
        {
            var metricName = "test_increment_counter_metric_item";
            var options = new CounterOptions() { Name = metricName };

            _manager.Increment(
                options,
                new MetricSetItem("item4", "value4"));

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(1L);
        }

        [Fact]
        public void Can_increment_counter_metric_item_by_amount()
        {
            var metricName = "test_increment_counter_metric_item_by_amount";
            var options = new CounterOptions() { Name = metricName };

            _manager.Increment(
                options,
                3L,
                new MetricSetItem("item3", "value3"));

            _fixture.Snapshot.GetCounterValue(_context, metricName).Count.Should().Be(3L);
        }

        [Fact]
        public void Can_increment_multidimensional_counter()
        {
            var metricName = "test_increment_counter_multi";
            var options = new CounterOptions() { Name = metricName };

            _manager.Increment(options, _fixture.Tags[0]);
            _manager.Increment(options, _fixture.Tags[1]);

            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Count.Should().Be(1L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Count.Should().Be(1L);
        }

        [Fact]
        public void Can_increment_multidimensional_counter_by_amount()
        {
            var metricName = "test_increment_counter_by_amount_multi";
            var options = new CounterOptions { Name = metricName };

            _manager.Increment(options, _fixture.Tags[0], 2L);
            _manager.Increment(options, _fixture.Tags[1], 3L);

            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Count.Should().Be(2L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Count.Should().Be(3L);
        }

        [Fact]
        public void Can_increment_multidimensional_counter_item()
        {
            var metricName = "test_increment_counter_item_multi";
            var options = new CounterOptions { Name = metricName };

            _manager.Increment(options, _fixture.Tags[0], "item1");
            _manager.Increment(options, _fixture.Tags[1], "item1");

            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Count.Should().Be(1L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Items.Length.Should().Be(1);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Items[0].Item.Should().Be("item1");
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Count.Should().Be(1L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Items.Length.Should().Be(1);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Items[0].Item.Should().Be("item1");
        }

        [Fact]
        public void Can_increment_multidimensional_counter_item_by_amount()
        {
            var metricName = "test_increment_counter_item_by_amount_multi";
            var options = new CounterOptions { Name = metricName };

            _manager.Increment(options, _fixture.Tags[0], 3L, "item1");
            _manager.Increment(options, _fixture.Tags[1], 5L, "item1");

            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Count.Should().Be(3L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Items.Length.Should().Be(1);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[0].AsMetricName(metricName)).Items[0].Item.Should().Be("item1");
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Count.Should().Be(5L);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Items.Length.Should().Be(1);
            _fixture.Snapshot.GetCounterValue(_context, _fixture.Tags[1].AsMetricName(metricName)).Items[0].Item.Should().Be("item1");
        }
    }
}


text:
using base::TimeDelta;

namespace {
const int kShortNudgeDelayDurationMS = 1;
}

namespace syncer {

EngineComponentsFactoryImpl::EngineComponentsFactoryImpl(
    const Switches& switches)
    : switches_(switches) {}

EngineComponentsFactoryImpl::~EngineComponentsFactoryImpl() {}

std::unique_ptr<SyncScheduler> EngineComponentsFactoryImpl::BuildScheduler(
    const std::string& name,
    SyncCycleContext* context,
    CancelationSignal* cancelation_signal) {
  std::unique_ptr<BackoffDelayProvider> delay(
      BackoffDelayProvider::FromDefaults());

  if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE) {
    delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride());
  }

  std::unique_ptr<SyncSchedulerImpl> scheduler =
      base::MakeUnique<SyncSchedulerImpl>(name, delay.release(), context,
                                          new Syncer(cancelation_signal));
  if (switches_.nudge_delay == NudgeDelay::SHORT_NUDGE_DELAY) {
    // Set the default nudge delay to 0 because the default is used as a floor
    // for override values, and we don't want the below override to be ignored.
    scheduler->SetDefaultNudgeDelay(TimeDelta::FromMilliseconds(0));
    // Only protocol types can have their delay customized.
    ModelTypeSet protocol_types = syncer::ProtocolTypes();
    std::map<ModelType, base::TimeDelta> nudge_delays;
    for (ModelTypeSet::Iterator it = protocol_types.First(); it.Good();
         it.Inc()) {
      nudge_delays[it.Get()] =
          TimeDelta::FromMilliseconds(kShortNudgeDelayDurationMS);
    }
    scheduler->OnReceivedCustomNudgeDelays(nudge_delays);
  }
  return std::move(scheduler);
}

std::unique_ptr<SyncCycleContext> EngineComponentsFactoryImpl::BuildContext(
    ServerConnectionManager* connection_manager,
    syncable::Directory* directory,
    ExtensionsActivity* extensions_activity,
    const std::vector<SyncEngineEventListener*>& listeners,
    DebugInfoGetter* debug_info_getter,
    ModelTypeRegistry* model_type_registry,
    const std::string& invalidation_client_id) {
  return std::unique_ptr<SyncCycleContext>(
      new SyncCycleContext(connection_manager, directory, extensions_activity,
                           listeners, debug_info_getter, model_type_registry,
                           switches_.encryption_method == ENCRYPTION_KEYSTORE,
                           switches_.pre_commit_updates_policy ==
                               FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE,
                           invalidation_client_id));
}

std::unique_ptr<syncable::DirectoryBackingStore>
EngineComponentsFactoryImpl::BuildDirectoryBackingStore(
    StorageOption storage,
    const std::string& dir_name,
    const base::FilePath& backing_filepath) {
  if (storage == STORAGE_ON_DISK) {
    return std::unique_ptr<syncable::DirectoryBackingStore>(
        new syncable::OnDiskDirectoryBackingStore(dir_name, backing_filepath));
  } else {
    NOTREACHED();
    return std::unique_ptr<syncable::DirectoryBackingStore>();
  }
}

EngineComponentsFactory::Switches EngineComponentsFactoryImpl::GetSwitches()
    const {
  return switches_;
}

}  // namespace syncer


text:
package org.jboss.weld.environment.se.test.implicit.discovery.none;

import javax.enterprise.context.Dependent;
import javax.inject.Inject;

@Dependent
public class Bong {

    private Bang bar;

    @Inject
    public Bong(Bang bar) {
        this.bar = bar;
    }

    public int ping() {
        return bar.getVal();
    }

}


text: ./configure CFLAGS="-O3 -Wall -pedantic -ansi -mno-cygwin"


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Linq;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem
{
    internal class LinkedFileUtilities : ForegroundThreadAffinitizedObject
    {
        private LinkedFileUtilities()
        {
        }

        private static LinkedFileUtilities s_singleton = new LinkedFileUtilities();

        /// <summary>
        /// Finds the current context hierarchy for the given document. If the document is in a
        /// Shared Code project, this returns that project's SharedItemContextHierarchy. If the
        /// document is linked into multiple projects, this returns the hierarchy in which it is
        /// currently open as indicated by the running document table. Otherwise, it returns the
        /// hierarchy of the document's project.
        /// </summary>
        public static IVsHierarchy GetContextHierarchy(IVisualStudioHostDocument document, IVsRunningDocumentTable4 runningDocumentTable)
        {
            return s_singleton.GetContextHierarchyInternal(document, runningDocumentTable);
        }

        private IVsHierarchy GetContextHierarchyInternal(IVisualStudioHostDocument document, IVsRunningDocumentTable4 runningDocumentTable)
        {
            AssertIsForeground();

            return GetSharedItemContextHierarchy(document) ?? GetContextHierarchyFromRunningDocumentTable(document, runningDocumentTable) ?? document.Project.Hierarchy;
        }

        /// <summary>
        /// If the document is open in the running document table, this returns the hierarchy in
        /// which it is currently open. Otherwise, it returns null.
        /// </summary>
        private IVsHierarchy GetContextHierarchyFromRunningDocumentTable(IVisualStudioHostDocument document, IVsRunningDocumentTable4 runningDocumentTable)
        {
            AssertIsForeground();

            uint docCookie;
            if (!runningDocumentTable.TryGetCookieForInitializedDocument(document.Key.Moniker, out docCookie))
            {
                return null;
            }

            IVsHierarchy hierarchy;
            uint itemid;
            runningDocumentTable.GetDocumentHierarchyItem(docCookie, out hierarchy, out itemid);

            return hierarchy;
        }

        /// <summary>
        /// If the document is in a Shared Code project, this returns that project's
        /// SharedItemContextHierarchy. Otherwise, it returns null.
        /// </summary>
        private IVsHierarchy GetSharedItemContextHierarchy(IVisualStudioHostDocument document)
        {
            AssertIsForeground();

            var hierarchy = document.Project.Hierarchy;
            var itemId = document.GetItemId();
            if (itemId == (uint)VSConstants.VSITEMID.Nil)
            {
                // the document is no longer part of the solution
                return null;
            }

            var sharedHierarchy = GetSharedHierarchyForItem(hierarchy, itemId);
            if (sharedHierarchy == null)
            {
                return null;
            }

            return GetSharedItemContextHierarchy(sharedHierarchy);
        }

        /// <summary>
        /// If the project is in a Shared Code project, this returns its
        /// SharedItemContextHierarchy. Otherwise, it returns null.
        /// </summary>
        private IVsHierarchy GetSharedItemContextHierarchy(IVsHierarchy hierarchy)
        {
            object contextHierarchy;
            if (hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID7.VSHPROPID_SharedItemContextHierarchy, out contextHierarchy) != VSConstants.S_OK)
            {
                return null;
            }

            return contextHierarchy as IVsHierarchy;
        }

        /// <summary>
        /// If the itemId represents a document from a Shared Code project, this returns the
        /// SharedProjectHierarchy to which it belongs. Otherwise, it returns null.
        /// </summary>
        public static IVsHierarchy GetSharedHierarchyForItem(IVsHierarchy headProjectHierarchy, uint itemId)
        {
            return s_singleton.GetSharedHierarchyForItemInternal(headProjectHierarchy, itemId);
        }

        private IVsHierarchy GetSharedHierarchyForItemInternal(IVsHierarchy headProjectHierarchy, uint itemId)
        {
            AssertIsForeground();

            object isShared;
            if (headProjectHierarchy.GetProperty(itemId, (int)__VSHPROPID7.VSHPROPID_IsSharedItem, out isShared) != VSConstants.S_OK || !(bool)isShared)
            {
                return null;
            }

            object sharedHierarchy;
            return headProjectHierarchy.GetProperty(itemId, (int)__VSHPROPID7.VSHPROPID_SharedProjectHierarchy, out sharedHierarchy) == VSConstants.S_OK
                ? sharedHierarchy as IVsHierarchy
                : null;
        }

        public static IVisualStudioHostProject GetContextHostProject(IVsHierarchy sharedHierarchy, IVisualStudioHostProjectContainer hostProjectContainer)
        {
            return s_singleton.GetContextHostProjectInternal(sharedHierarchy, hostProjectContainer);
        }

        private IVisualStudioHostProject GetContextHostProjectInternal(IVsHierarchy hierarchy, IVisualStudioHostProjectContainer hostProjectContainer)
        {
            hierarchy = GetSharedItemContextHierarchy(hierarchy) ?? hierarchy;
            var projectName = GetActiveIntellisenseProjectContextInternal(hierarchy);

            if (projectName != null)
            {
                return hostProjectContainer.GetProjects().FirstOrDefault(p => p.ProjectSystemName == projectName);
            }
            else
            {
                return hostProjectContainer.GetProjects().FirstOrDefault(p => p.Hierarchy == hierarchy);
            }
        }

        private string GetActiveIntellisenseProjectContextInternal(IVsHierarchy hierarchy)
        {
            AssertIsForeground();

            hierarchy = GetSharedItemContextHierarchy(hierarchy) ?? hierarchy;

            object intellisenseProjectName;
            return hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID8.VSHPROPID_ActiveIntellisenseProjectContext, out intellisenseProjectName) == VSConstants.S_OK
                ? intellisenseProjectName as string
                : null;
        }
    }
}


text:
using System.Web.Routing;
using Microsoft.AspNet.FriendlyUrls;

namespace OnTheRoad
{
    public static class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            RegisterParameterRoutes(routes);

            var settings = new FriendlyUrlSettings();
            settings.AutoRedirectMode = RedirectMode.Permanent;
            routes.EnableFriendlyUrls(settings);
        }

        private static void RegisterParameterRoutes(RouteCollection routes)
        {
            routes.MapPageRoute(
                "CategoriesRoute",
                "Categories/{categoryName}/",
                "~/Categories.aspx"
            );

            routes.MapPageRoute(
                "TripsRoute",
                "Trips/",
                "~/Trips/Default.aspx"
                );

            routes.MapPageRoute(
                "TripsAddRoute",
                "Trips/AddTrip/",
                "~/Trips/AddTrip.aspx"
                );

            routes.MapPageRoute(
                "TripsSearchRoute",
                "Trips/Search/{pattern}/",
                "~/Trips/Default.aspx"
                );

            routes.MapPageRoute(
                "TripDetailsRoute",
                "Trips/{tripId}/",
                "~/Trips/Default.aspx"
                );
        }
    }
}


text:
var actionHelper = require('../../../lib/template/helpers/action')
  , assert = require('assert')
  , helpers = {}
  , routeData = []
  , tests;

// name: Used for looping to check created action helpers
// data: Dummy data similar to what's created by the router
// expected: The expected outcome of the action helper
//   (name and action fields are the same as normal helpers)
//   (Some actions are actual functions(the ones that require args) but below
//      we use a dummy argument(1) when calling it)
routeData = [
    {
        name: 'tasksPath'
      , data: {params: {controller: 'tasks', action: 'index'}, parts: ['/tasks', {path: '.:format'}]}
      , expected: {name: 'tasksPath', action: '/tasks'}
    }, {
        name: 'addTaskPath'
      , data: {params: {controller: 'tasks', action: 'add'}}
      , expected: {name: 'addTaskPath', action: '/tasks/add'}
    }, {
        name: 'taskPath'
      , data: {params: {controller: 'tasks', action: 'show'}, path: '/tasks/:id(.:format)'}
      , expected: {name: 'taskPath', action: '/tasks/1'}
    }, {
        name: 'editTaskPath'
      , data: {params: {controller: 'tasks', action: 'edit'}, path: '/tasks/:id/edit(.:format)'}
      , expected: {name: 'editTaskPath', action: '/tasks/1/edit'}
    }
];

tests = {

  'test get with no helpers': function () {
    var expected = {}
      , actual = actionHelper.get();
    assert.deepEqual(expected, actual);
  }

, 'test creating action helpers': function () {
    for (var i = 0, len = routeData.length; i < len; i++) {
      var actual = actionHelper.create(routeData[i].data);

      // If action is a function(an action that takes an ID), execute the function
      if (typeof actual.action === 'function') {
        actual.action = actual.action('1')
      }

      assert.deepEqual(routeData[i].expected, actual);
    }
  }

, 'test getting with action helpers': function () {
    var actionHelpers = actionHelper.get()
      , expected
      , actual;

    // Check the retrieved helpers
    for (action in actionHelpers) {
      actual = actionHelpers[action]

      // Find the action helper from the sample data
      for (var i = 0, len = routeData.length; i < len; i++) {
        if (routeData[i].name == action) {
          expected = routeData[i].expected;
        }
      }

      assert.deepEqual(expected, actual);
    }
  }

, 'test adding the action helpers to a object': function () {
    var expected
      , actual;
    actionHelper.add(helpers)

    // Check each of the added helpers
    for (action in helpers) {
      actual = helpers[action]

      // Find the action helper from the sample data
      for (var i = 0, len = routeData.length; i < len; i++) {
        if (routeData[i].name == action) {
          expected = routeData[i].expected;
        }
      }

      assert.deepEqual(expected, actual);
    }
  }
};

module.exports = tests;


text:
<?xml version="1.0"?>
<config>
    <sections>
        <catalog>
            <groups>
                <layered_navigation>
                    <fields>
                        <category_filter_type translate="label">
                            Category Filter Type
                            <frontend_type>select</frontend_type>
                            <source_model>catalogfilter/system_config_source_category_filterType</source_model>
                            <sort_order>100</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </category_filter_type>
                        <alphabetic_sort translate="label">
                            Alphabetic Sort Filters
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>100</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </alphabetic_sort>
                    </fields>
                </layered_navigation>
            </groups>
        </catalog>
    </sections>
</config>


text:
@interface PodsDummy_Pods_MyChatUITests : NSObject
@end
@implementation PodsDummy_Pods_MyChatUITests
@end


text:
p:not(:root) { background-color: lime; }
div * { background-color: red; }


text:
/* eslint-disable no-param-reassign */
export default function dlv(obj, key, def, p) {
  p = 0;
  key = key.split ? key.split('.') : key;
  while (obj && p < key.length) obj = obj[key[p++]];
  return obj === undefined ? def : obj;
}


text:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <RelativeLayout
            android:id="@+id/video_relative_layout"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:layout_alignParentTop="true">

            <SurfaceView
                android:id="@+id/video_surface_view"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />

            <ProgressBar
                android:id="@+id/progress_bar"
                style="@android:style/Widget.ProgressBar.Small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true" />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/controls_relative_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/video_relative_layout"
            android:layout_marginTop="10dp">

            <ImageButton
                android:id="@+id/play_pause_image_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:tag="@string/pause"
                android:contentDescription="@null"
                android:src="@android:drawable/ic_media_pause" />
        </RelativeLayout>

        <TextView
            android:id="@+id/description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/controls_relative_layout"
            android:layout_centerHorizontal="true"
            android:layout_margin="@dimen/activity_horizontal_margin"
            android:gravity="center"
            android:text="@string/live_stream_description" />

    </RelativeLayout>

</ScrollView>


text:
/**
 * Created by touremamadou on 18/11/2015.
 */

if (!window.location.origin) {
    window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
}

// Production steps of ECMA-262, Edition 5, 15.4.4.14
// Référence : http://es5.github.io/#x15.4.4.14
if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function(searchElement, fromIndex) {

    var k;

    // 1. Soit O le résultat de l'appel à ToObject avec
    //    this en argument.
    if (this == null) {
      throw new TypeError('"this" vaut null ou n est pas défini');
    }

    var O = Object(this);

    // 2. Soit lenValue le résultat de l'appel de la
    //    méthode interne Get de O avec l'argument
    //    "length".
    // 3. Soit len le résultat de ToUint32(lenValue).
    var len = O.length >>> 0;

    // 4. Si len vaut 0, on renvoie -1.
    if (len === 0) {
      return -1;
    }

    // 5. Si l'argument fromIndex a été utilisé, soit
    //    n le résultat de ToInteger(fromIndex)
    //    0 sinon
    var n = +fromIndex || 0;

    if (Math.abs(n) === Infinity) {
      n = 0;
    }

    // 6. Si n >= len, on renvoie -1.
    if (n >= len) {
      return -1;
    }

    // 7. Si n >= 0, soit k égal à n.
    // 8. Sinon, si n<0, soit k égal à len - abs(n).
    //    Si k est inférieur à 0, on ramène k égal à 0.
    k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);

    // 9. On répète tant que k < len
    while (k < len) {
      // a. Soit Pk égal à ToString(k).
      //    Ceci est implicite pour l'opérande gauche de in
      // b. Soit kPresent le résultat de l'appel de la
      //    méthode interne HasProperty de O avec Pk en
      //    argument. Cette étape peut être combinée avec
      //    l'étape c
      // c. Si kPresent vaut true, alors
      //    i.  soit elementK le résultat de l'appel de la
      //        méthode interne Get de O avec ToString(k) en
      //        argument
      //   ii.  Soit same le résultat de l'application de
      //        l'algorithme d'égalité stricte entre
      //        searchElement et elementK.
      //  iii.  Si same vaut true, on renvoie k.
      if (k in O && O[k] === searchElement) {
        return k;
      }
      k++;
    }
    return -1;
  };
}

if(!Array.isArray) {
    Array.isArray = function(arg) {
        return Object.prototype.toString.call(arg) === '[object Array]';
    };
}


text:
package org.apache.archiva.rest.services;

import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
import org.apache.archiva.rest.api.services.RepositoriesService;
import org.assertj.core.api.Assertions;
import org.junit.Ignore;
import org.junit.Test;

import javax.ws.rs.InternalServerErrorException;
import java.io.File;

/**
 * @author Olivier Lamy
 */
public class CopyArtifactTest
    extends AbstractArchivaRestTest
{

    @Test
    public void copyToAnEmptyRepo()
        throws Exception
    {
        try
        {
            initSourceTargetRepo();

            // START SNIPPET: copy-artifact
            // configure the artifact you want to copy
            // if package ommited default will be jar
            ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest();
            artifactTransferRequest.setGroupId( "org.apache.karaf.features" );
            artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" );
            artifactTransferRequest.setVersion( "2.2.2" );
            artifactTransferRequest.setRepositoryId( SOURCE_REPO_ID );
            artifactTransferRequest.setTargetRepositoryId( TARGET_REPO_ID );
            // retrieve the service
            RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
            // copy the artifact
            Boolean res = repositoriesService.copyArtifact( artifactTransferRequest );
            // END SNIPPET: copy-artifact
            assertTrue( res );

            String targetRepoPath = getManagedRepositoriesService( authorizationHeader ).getManagedRepository(
                TARGET_REPO_ID ).getLocation();

            File artifact = new File( targetRepoPath,
                                      "/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar" );
            assertTrue( artifact.exists() );
            File pom = new File( targetRepoPath,
                                 "/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.pom" );

            assertTrue( "not exists " + pom.getPath(), pom.exists() );
            // TODO find a way to force metadata generation and test it !!
        }
        finally
        {
            cleanRepos();
        }
    }

    @Test( expected = InternalServerErrorException.class )
    public void copyNonExistingArtifact()
        throws Throwable
    {
        try
        {
            initSourceTargetRepo();

            ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest();
            artifactTransferRequest.setGroupId( "org.apache.karaf.features" );
            artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" );
            artifactTransferRequest.setVersion( "3.0.6552" );
            artifactTransferRequest.setRepositoryId( SOURCE_REPO_ID );
            artifactTransferRequest.setTargetRepositoryId( TARGET_REPO_ID );
            RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );

            repositoriesService.copyArtifact( artifactTransferRequest );
        }
        catch ( InternalServerErrorException e )
        {
            // FIXME this doesn't work anymore with cxf 3.x????
            //Assertions.assertThat( e.getResponse().getStatusInfo().getReasonPhrase() ) //
            //    .contains( "cannot find artifact" );

            // previous test with cxf 2.x
            //assertTrue( e.getMessage() + " do not contains ''",
            //            StringUtils.contains( e.getMessage(), "cannot find artifact" ) );
            throw e;
        }
        finally
        {
            cleanRepos();
        }

    }

    @Ignore
    public void copyToAnExistingRepo()
        throws Exception
    {
        initSourceTargetRepo();
        cleanRepos();
    }
}


text:
This is an AngularJS SPA (Single Page Application) for retrieving and graphing stored data that is available on Sparkfun Phant server data streams.
It also implements a simple (for now) front-end for IoT device provisioning and also a simple MQTT monitor.

PhantGraphs allows to create a simple Dashboard for showing graphs with data stored in Phant server data streams. The data that is shown
in the graphs can be configured, namely which fields from a data stream is shown.

PhantGraphs is built on AngularJS for a Single Page Application and Angular-chartJS for generating the graphs.

It can graph data from data.sparkfun.com streams and your also your own data streams hosted on your servers.

Example:
![Phant Dashboard](https://primalcortex.files.wordpress.com/2015/10/selection_242.png)

The graphs will auto update with the most recent data as it arrives to the streams, allowing for live updating of the graphs.

More info here -> https://primalcortex.wordpress.com/2015/10/15/sparkfun-phant-server-data-stream-graphing/

Please comments and feedback on the above link. Thanks!

# How to use it
Clone this repository and just put the app folder under the docroot of some web-server changing it's name to phantgraphs for example. Access it by **http://mywebserver/phantgraphs**.

**IMPORTANT**
The application for working needs the PG-RestServer application available here: https://github.com/fcgdam/PG-RestServer.git to be running.

Without this server running the application won't work.

After installing the PG-RestServer and starting it, on this aplication edit the file **restapi.js** under the folder **scripts** and change the REST API end point:

**Before**
angular.module('phantGraph')
    .constant('RESTENDPOINT_URI','http://localhost:3000/api/')

**After**
angular.module('phantGraph')
    .constant('RESTENDPOINT_URI',**'http://serveraddress.domain:3000/api/'**)

# MQTT
The application also allows to monitor MQTT messages for topics that have been subscrided. The MQTT broker must allow WebSockets connections and be reachable.

# IoT Device Provisioning
The application also permits some simple IoT device provisioning, namely registration, status monitoring and allows configuration data to be saved and fed to the IoT devices.

![Device Provisioning](https://primalcortex.files.wordpress.com/2015/10/selection_239.png)


text:
#include <ruby.h>
#include <wbxml.h> /* libwbxml2 */

VALUE mWBXML;		/* The WBXML module object */

VALUE
xml_to_wbxml(VALUE self, VALUE xml_source)
{
	WBXMLError	ret = WBXML_OK;
	WBXMLConvXML2WBXMLParams params;
	WB_UTINY*	xml = NULL;		/* Must be null terminated */
	WB_UTINY*	wbxml = NULL;
	WB_ULONG	wbxml_len = 0;
	VALUE		value;

	Check_SafeStr(xml_source);
	if (TYPE(xml_source) != T_STRING)
		rb_raise(rb_eTypeError, "parameter to xml_to_wbxml must be a string");
	xml = (WB_UTINY*)StringValuePtr(xml_source);

	params.wbxml_version = WBXML_VERSION_13;
	params.use_strtbl = TRUE;
	params.keep_ignorable_ws = FALSE;

	ret = wbxml_conv_xml2wbxml(xml, &wbxml, &wbxml_len, &params);
	if (ret != WBXML_OK)
		rb_raise(rb_eRuntimeError, (const char*)wbxml_errors_string(ret));

	value = rb_str_new((const char*)wbxml, wbxml_len);

	if (wbxml != NULL)
		wbxml_free(wbxml);
	return value;
}

VALUE
wbxml_to_xml(VALUE self, VALUE wbxml_source)
{
	WBXMLError	ret = WBXML_OK;
	WBXMLConvWBXML2XMLParams	params;
	WB_UTINY*	wbxml = NULL;
	WB_ULONG	wbxml_len = 0;
	WB_UTINY*	xml = NULL;		/* Must be null terminated */
	VALUE		value;

	Check_SafeStr(wbxml_source);
	if (TYPE(wbxml_source) != T_STRING)
		rb_raise(rb_eTypeError, "parameter to wbxml_to_xml must be a string");
	wbxml = (WB_UTINY*)StringValuePtr(wbxml_source);
	wbxml_len = RSTRING_LEN(wbxml_source);

	params.gen_type = WBXML_ENCODER_XML_GEN_INDENT;
	params.lang = WBXML_LANG_UNKNOWN;	/* Don't force the language */
	params.indent = 2;
	params.keep_ignorable_ws = FALSE;

	ret = wbxml_conv_wbxml2xml(wbxml, wbxml_len, &xml, &params);
	if (ret != WBXML_OK)
		rb_raise(rb_eRuntimeError, (const char*)wbxml_errors_string(ret));

	value = rb_str_new((const char*)xml, strlen(xml));

	if (xml != NULL)
		wbxml_free(xml);
	return value;
}

void
Init_wbxml()
{
	mWBXML = rb_define_module("WBXML");
	rb_define_singleton_method(mWBXML, "xml_to_wbxml", xml_to_wbxml, 1);
	rb_define_singleton_method(mWBXML, "wbxml_to_xml", wbxml_to_xml, 1);
}


text:
package cdc.impl.em;

import java.io.IOException;

import cdc.components.AbstractDataSource;
import cdc.components.AbstractJoinCondition;
import cdc.gui.wizards.WizardAction;
import cdc.gui.wizards.Workflow;
import cdc.impl.em.actions.ConfigureBlockingMethod;
import cdc.impl.em.actions.ConfigureSearchMethodAction;
import cdc.impl.em.actions.ConfigureSourcesAction;
import cdc.impl.em.actions.EMRunnerAction;
import cdc.utils.RJException;

public class EMWizardWorkflow implements Workflow {

	private WizardAction[] actions;
	private int currentStep = 0;

	public EMWizardWorkflow(AbstractDataSource sourceA, AbstractDataSource sourceB, AbstractJoinCondition cond) throws IOException, RJException {
		actions = new WizardAction[4];
		actions[0] = new ConfigureSourcesAction(sourceA, sourceB);
		actions[1] = new ConfigureSearchMethodAction();
		actions[2] = new ConfigureBlockingMethod(cond);
		actions[3] = new EMRunnerAction((ConfigureSourcesAction)actions[0], (ConfigureSearchMethodAction)actions[1],
				(ConfigureBlockingMethod)actions[2]);

	}

	public WizardAction[] getActions() {
		return actions;
	}

	public int getCurrentStep() {
		return currentStep;
	}

	public boolean isFirstStep() {
		return currentStep == 0;
	}

	public boolean isLastStep() {
		return currentStep == actions.length - 1;
	}

	public int nextStep() {
		if (currentStep == 1) {
			if (((ConfigureSourcesAction)actions[0]).needsBlocking() ||
					((ConfigureSearchMethodAction)actions[1]).needsBlocking()) {
				return ++currentStep;
			} else {
				return currentStep = actions.length - 1;
			}
		} else {
			if (currentStep + 1 < actions.length) currentStep++;
			return currentStep;
		}
	}

	public int previousStep() {
		if (currentStep == actions.length - 1) {
			if (((ConfigureSourcesAction)actions[0]).needsBlocking() ||
					((ConfigureSearchMethodAction)actions[1]).needsBlocking()) {
				return --currentStep;
			} else {
				return currentStep = 1;
			}
		} else {
			if (currentStep == 0) return -1;
			return --currentStep;
		}
	}

	public String[] getLabels() {
		return new String[] {"Sample data configuration", "Search method configuration", "Blocking method configuration", "EM method results"};

	}

}


text:
#define LOG_TAG "9patch"
#define LOG_NDEBUG 1

#include <androidfw/ResourceTypes.h>
#include <hwui/Canvas.h>
#include <hwui/Paint.h>
#include <utils/Log.h>

#include <ResourceCache.h>

#include "SkCanvas.h"
#include "SkRegion.h"
#include "GraphicsJNI.h"

#include "utils/NinePatch.h"

#include "JNIHelp.h"
#include "core_jni_helpers.h"

using namespace android;

/**
 * IMPORTANT NOTE: 9patch chunks can be manipuated either as an array of bytes
 * or as a Res_png_9patch instance. It is important to note that the size of the
 * array required to hold a 9patch chunk is greater than sizeof(Res_png_9patch).
 * The code below manipulates chunks as Res_png_9patch* types to draw and as
 * int8_t* to allocate and free the backing storage.
 */

class SkNinePatchGlue {
public:
    static jboolean isNinePatchChunk(JNIEnv* env, jobject, jbyteArray obj) {
        if (NULL == obj) {
            return JNI_FALSE;
        }
        if (env->GetArrayLength(obj) < (int)sizeof(Res_png_9patch)) {
            return JNI_FALSE;
        }
        const jbyte* array = env->GetByteArrayElements(obj, 0);
        if (array != NULL) {
            const Res_png_9patch* chunk = reinterpret_cast<const Res_png_9patch*>(array);
            int8_t wasDeserialized = chunk->wasDeserialized;
            env->ReleaseByteArrayElements(obj, const_cast<jbyte*>(array), JNI_ABORT);
            return (wasDeserialized != -1) ? JNI_TRUE : JNI_FALSE;
        }
        return JNI_FALSE;
    }

    static jlong validateNinePatchChunk(JNIEnv* env, jobject, jbyteArray obj) {
        size_t chunkSize = env->GetArrayLength(obj);
        if (chunkSize < (int) (sizeof(Res_png_9patch))) {
            jniThrowRuntimeException(env, "Array too small for chunk.");
            return NULL;
        }

        int8_t* storage = new int8_t[chunkSize];
        // This call copies the content of the jbyteArray
        env->GetByteArrayRegion(obj, 0, chunkSize, reinterpret_cast<jbyte*>(storage));
        // Deserialize in place, return the array we just allocated
        return reinterpret_cast<jlong>(Res_png_9patch::deserialize(storage));
    }

    static void finalize(JNIEnv* env, jobject, jlong patchHandle) {
        int8_t* patch = reinterpret_cast<int8_t*>(patchHandle);
        if (android::uirenderer::ResourceCache::hasInstance()) {
            Res_png_9patch* p = (Res_png_9patch*) patch;
            android::uirenderer::ResourceCache::getInstance().destructor(p);
        } else {
            delete[] patch;
        }
    }

    static jlong getTransparentRegion(JNIEnv* env, jobject, jobject jbitmap,
            jlong chunkHandle, jobject boundsRect) {
        Res_png_9patch* chunk = reinterpret_cast<Res_png_9patch*>(chunkHandle);
        SkASSERT(chunk);
        SkASSERT(boundsRect);

        SkBitmap bitmap;
        GraphicsJNI::getSkBitmap(env, jbitmap, &bitmap);
        SkRect bounds;
        GraphicsJNI::jrect_to_rect(env, boundsRect, &bounds);

        SkRegion* region = NULL;
        NinePatch::Draw(NULL, bounds, bitmap, *chunk, NULL, &region);

        return reinterpret_cast<jlong>(region);
    }

};

/////////////////////////////////////////////////////////////////////////////////////////

static const JNINativeMethod gNinePatchMethods[] = {
    { "isNinePatchChunk", "([B)Z", (void*) SkNinePatchGlue::isNinePatchChunk },
    { "validateNinePatchChunk", "([B)J",
            (void*) SkNinePatchGlue::validateNinePatchChunk },
    { "nativeFinalize", "(J)V", (void*) SkNinePatchGlue::finalize },
    { "nativeGetTransparentRegion", "(Landroid/graphics/Bitmap;JLandroid/graphics/Rect;)J",
            (void*) SkNinePatchGlue::getTransparentRegion }
};

int register_android_graphics_NinePatch(JNIEnv* env) {
    return android::RegisterMethodsOrDie(env,
            "android/graphics/NinePatch", gNinePatchMethods, NELEM(gNinePatchMethods));
}


text:
import React, { Component } from "react";
import PropTypes from "prop-types";
import TextField from "material-ui/TextField";

class NicknameEditor extends Component {
  static propTypes = {
    value: PropTypes.string.isRequired,
    onChange: PropTypes.func.isRequired,
    type: PropTypes.string.isRequired
  };

  render() {
    return (

Description

          A description can be thought of as a README for the {this.props.type}

        <TextField
          floatingLabelText="Description"
          multiLine={true}
          fullWidth={true}
          value={this.props.value}
          style={{
            marginTop: "-20px"
          }}
          onChange={this.props.onChange}
        />

    );
  }
}
export default NicknameEditor;


text:
import com.google.gson.Gson;

import java.sql.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import org.json.JSONObject;

import java.net.URI;
import java.net.URISyntaxException;

import static spark.Spark.*;
import spark.template.freemarker.FreeMarkerEngine;
import spark.ModelAndView;
import static spark.Spark.get;

import static javax.measure.unit.SI.KILOGRAM;
import javax.measure.quantity.Mass;
import org.jscience.physics.model.RelativisticModel;
import org.jscience.physics.amount.Amount;

import static javax.measure.unit.SI.KILOGRAM;
import javax.measure.quantity.Mass;
import org.jscience.physics.model.RelativisticModel;
import org.jscience.physics.amount.Amount;

import com.heroku.sdk.jdbc.DatabaseUrl;

public class Main {

  public static void main(String[] args) {

     Gson gson = new Gson();

    port(Integer.valueOf(System.getenv("PORT")));
    staticFileLocation("/public");

    get("/hello", (req, res) -> "Hello World");

    get("/db", (req, res) -> {
      Connection connection = null;
      Map<String, Object> attributes = new HashMap<>();
      try {
        connection = DatabaseUrl.extract().getConnection();

        Statement stmt = connection.createStatement();
        stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)");
        stmt.executeUpdate("INSERT INTO ticks VALUES (now())");
        ResultSet rs = stmt.executeQuery("SELECT tick FROM ticks");

        ArrayList<String> output = new ArrayList<String>();
        while (rs.next()) {
          output.add( "Read from DB: " + rs.getTimestamp("tick"));
        }

        attributes.put("results", output);
        return new ModelAndView(attributes, "db.ftl");
      } catch (Exception e) {
        attributes.put("message", "There was an error: " + e);
        return new ModelAndView(attributes, "error.ftl");
      } finally {
        if (connection != null) try{connection.close();} catch(SQLException e){}
      }
    }, new FreeMarkerEngine());

    get("/user_info", (req, res) ->
    {
      Connection connection = null;
      Map<String, Object> attributes = new HashMap<>();
      try{
      connection = DatabaseUrl.extract().getConnection();

      Statement stmt = connection.createStatement();

      stmt.executeUpdate("CREATE TABLE IF NOT EXISTS user_info (user_email varchar(100),  user_password  varchar(30),  user_name  varchar(30) )");

      ResultSet rs = stmt.executeQuery("SELECT user_email, user_password FROM user_info");
      ArrayList<String> output = new ArrayList<String>();

    while(rs.next())
    {

       output.add("read user " + "email: " + rs.getString("user_email") + "     password: " + rs.getString("user_password") );

     }
    attributes.put("results",output);
     return new ModelAndView(attributes, "user_info.ftl");
     } catch (Exception e) {
     attributes.put("message", "There was an error: " + e);
     return new ModelAndView(attributes, "error.ftl");
     } finally {
     if (connection != null) try{connection.close();} catch(SQLException e){}
    }}, new FreeMarkerEngine());

    post("/adduser",(req,res)->

      {

        Connection connection = null;
        Map<String, Object> attributes = new HashMap<>();
        try{
        connection = DatabaseUrl.extract().getConnection();

        JSONObject obj = new JSONObject(req.body());

        String email = obj.getString("signup-email");
        String password = obj.getString("signup-password");
       Statement stmt = connection.createStatement();
       stmt.executeUpdate("CREATE TABLE IF NOT EXISTS user_info (user_email varchar(100),  user_password  varchar(30),  user_name  varchar(30) )");
       stmt.executeUpdate("INSERT INTO user_info(user_email, user_password, user_name)" +
                "VALUES('" + email + "', '" + password + "', 'null')");
       return req.body();
       } catch (Exception e) {
         System.err.println("Exception: "+ e);
          return e.getMessage();
       } finally {
        if (connection != null) try{connection.close();} catch(SQLException e){}
      }});

/*
            get("/user", (req, res) -> {
              ArrayList<String> users = new ArrayList<String>();
              users.add("John Doe");
              users.add("Tony Doe");
              users.add("test one");

              Map<String, Object> attributes = new HashMap<>();
              attributes.put("users", users);

               return new ModelAndView(attributes, "user.ftl");
            }, new FreeMarkerEngine());
*/

            get("/api/timeline_info", (req, res) -> {
                    Map<String, Object> data = new HashMap<>();
                    data.put("Productname","Air Froce 1");
                    data.put("January", "100");
                    data.put("Febuary", "200");
                    data.put("March", "300");
                    return data;
                }, gson::toJson);

                get("/recommendation", (req, res) -> {
                  ArrayList<String> users = new ArrayList<String>();
                  users.add("John Doe");
                  users.add("Smith");
                  users.add("Daniel");
                  users.add("Mark");
                  users.add("Ellen");
                  users.add("Lily");
                  users.add("Julio");
                  users.add("Chela");
                  users.add("Bells");

                  ArrayList<String> images = new ArrayList<String>();
                  images.add("picture/image1.jpg");
                  images.add("picture/image2.jpg");
                  images.add("picture/image3.jpg");
                  images.add("picture/image4.jpg");
                  images.add("picture/image5.jpg");
                  images.add("picture/image6.jpg");
                  images.add("picture/image7.jpg");
                  images.add("picture/image8.jpg");
                  images.add("picture/image9.jpg");

                  Map<String, Object> attributes = new HashMap<>();
                  attributes.put("users", users);
                  attributes.put("images", images);

                   return new ModelAndView(attributes, "recommendation.ftl");
                  }, new FreeMarkerEngine());

                    get("/api/info", (req, res ) ->
                    {
                      Map<String, Object> data = new HashMap<>();
                      data.put("username","Smith");
                      String xml= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                                  "<customer>"+
                                  "<user_profile>" +
                                          "<ProductName>Air Froce 1</ProductName>"+
                                          "<January>100</January>"+
                                          "<Febuary>200</Febuary>"+
                                          "<March>300</March>"+
                                  "</user_profile>"+
                                  "<user_profile>" +
                                          "<ProductName>KOBE XI</ProductName>"+
                                          "<January>312</January>"+
                                          "<Febuary>1333</Febuary>"+
                                          "<March>433</March>"+
                                  "</user_profile>"+
                                  "<user_profile>" +
                                          "<ProductName>Lebron XIII</ProductName>"+
                                          "<January>4324</January>"+
                                          "<Febuary>41</Febuary>"+
                                          "<March>5454</March>"+
                                  "</user_profile>"+
                                  "</customer>";
                      res.type("text/xml");
                      return xml;
                    });

}
}