text:
int expectedEqualsComputed(char *label, byteBuffer expected, byteBuffer computed) {
    int retval = 0;
    if(expected == NULL) {
        printf("%s >>> Computed Results = \"%s\"\n", label, bytesToHexString(computed));
        retval = 1;
    } else if(!bytesAreEqual(expected, computed)) {
        diag(label);
        printByteBuffer(expected, "Expected: ");
        printByteBuffer(computed, "  Result: ");
    } else {
        retval = 1;
    }
    return retval;
}

char *digestName(CCDigestAlgorithm digestSelector) {
    switch(digestSelector) {
        default: return "None";
        case  kCCDigestMD2: return "MD2";
        case  kCCDigestMD4: return "MD4";
        case  kCCDigestMD5: return "MD5";
        case  kCCDigestRMD128: return "RMD128";
        case  kCCDigestRMD160: return "RMD160";
        case  kCCDigestRMD256: return "RMD256";
        case  kCCDigestRMD320: return "RMD320";
        case  kCCDigestSHA1: return "SHA1";
        case  kCCDigestSHA224: return "SHA224";
        case  kCCDigestSHA256: return "SHA256";
        case  kCCDigestSHA384: return "SHA384";
        case  kCCDigestSHA512: return "SHA512";
        case  kCCDigestSkein128: return "Skein128";
        case  kCCDigestSkein160: return "Skein160";
        case  kCCDigestSkein224: return "Skein224";
        case  kCCDigestSkein256: return "Skein256";
        case  kCCDigestSkein384: return "Skein384";
        case  kCCDigestSkein512: return "Skein512";
    }
}

CCHmacAlgorithm digestID2HMacID(CCDigestAlgorithm digestSelector) {
    CCHmacAlgorithm hmacAlg;
    switch(digestSelector) {
        case kCCDigestMD5: hmacAlg = kCCHmacAlgMD5; break;
        case kCCDigestSHA1: hmacAlg = kCCHmacAlgSHA1; break;
        case kCCDigestSHA224: hmacAlg = kCCHmacAlgSHA224; break;
        case kCCDigestSHA256: hmacAlg = kCCHmacAlgSHA256; break;
        case kCCDigestSHA384: hmacAlg = kCCHmacAlgSHA384; break;
        case kCCDigestSHA512: hmacAlg = kCCHmacAlgSHA512; break;
        default: return HMAC_UNIMP;
    }
    return hmacAlg;
}

CCPseudoRandomAlgorithm digestID2PRF(CCDigestAlgorithm digestSelector) {
    switch(digestSelector) {
        case 0: return 0;
        case kCCDigestSHA1: return kCCPRFHmacAlgSHA1;
        case kCCDigestSHA224: return kCCPRFHmacAlgSHA224;
        case kCCDigestSHA256: return kCCPRFHmacAlgSHA256;
        case kCCDigestSHA384: return kCCPRFHmacAlgSHA384;
        case kCCDigestSHA512: return kCCPRFHmacAlgSHA512;
        default:
            diag("Unrecognized PRF translation for %s", digestName(digestSelector));
            return 0;
    }
}


text:
ul.pt-list { margin: 5px 0 0; padding: 0; list-style-type: none; }
ul.pt-list li { margin: 0 0 5px; padding-left: 24px; background: url(../images/bullet.gif) no-repeat 9px 6px; }
ul.pt-list li.last { margin-bottom: 0; }
ul.pt-list li span { cursor: pointer; }

ul.pt-list li.input { padding: 0 28px 0 0; background: none; }
ul.pt-list li.input input { padding-left: 22px; width: 100%; background: #fff url(../images/bullet.gif) no-repeat; }

ul.pt-list.ee1 { margin-right: 8px; }
ul.pt-list.ee1 li.input input { background-position: 8px 6px; }

ul.pt-list.ee2 li.input input { background-position: 8px 9px; }
ul.pt-list.ee2 li.input input:focus { padding-left: 21px; background-position: 7px 8px; }

.matrix ul.pt-list { margin: 0; }

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>{% block title %}Default title{% end %}</title>
    <meta name="description" content="{% block description %}IceProd: a grid middleware for submitting and tracking sets of jobs.{% end %}">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/static/favicon.ico">
    <link rel="icon" href="/static/favicon.png">
    <link rel="stylesheet" href="/static/base.css" media="all" type="text/css" />
    <link rel="stylesheet" href="/static/chosen.min.css" media="all" type="text/css" />
    {% block head_scripts %}{% end %}

Datasets

                {% if current_user %}

Profile

                {% end %}

                    {% if (not current_user) %} Login
                    {% else %} Logout
                    {% end %}

{% block sidebar %}{% end %}

{% block page_title %}{{ section }}{% end %}

                {% block body %}The Body{% end %}

        {% block footer %}IceProd {{ version }}{% end %}

    {% block body_scripts %}{% end %}


text:
package org.batfish.datamodel;

import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Objects.requireNonNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public final class Flow implements Comparable<Flow>, Serializable {
  public static class Builder {
    private int _dscp;
    private Ip _dstIp;
    @Nullable private Integer _dstPort;
    private int _ecn;
    private int _fragmentOffset;
    private @Nullable Integer _icmpCode;
    private @Nullable Integer _icmpType;
    private @Nullable String _ingressInterface;
    // Nullable because no sensible default. User is required to specify.
    private @Nullable String _ingressNode;
    private @Nullable String _ingressVrf;
    private @Nullable IpProtocol _ipProtocol;
    private int _packetLength;
    private @Nonnull Ip _srcIp;
    private @Nullable Integer _srcPort;
    private boolean _tcpFlagsAck;
    private boolean _tcpFlagsCwr;
    private boolean _tcpFlagsEce;
    private boolean _tcpFlagsFin;
    private boolean _tcpFlagsPsh;
    private boolean _tcpFlagsRst;
    private boolean _tcpFlagsSyn;
    private boolean _tcpFlagsUrg;

    private Builder() {
      _dscp = 0;
      _dstIp = Ip.ZERO;
      _ecn = 0;
      _fragmentOffset = 0;
      _ipProtocol = null;
      _srcIp = Ip.ZERO;
      _ingressVrf = Configuration.DEFAULT_VRF_NAME;
      _packetLength = 64; // min-sized ICMP packet (which is more than min-sized TCP/UDP)
      // all tcp flags default to false
    }

    private Builder(Flow flow) {
      _ingressNode = flow._ingressNode;
      _ingressInterface = flow._ingressInterface;
      _ingressVrf = flow._ingressVrf;
      _srcIp = flow._srcIp;
      _dstIp = flow._dstIp;
      _srcPort = flow._srcPort;
      _dstPort = flow._dstPort;
      _ipProtocol = flow._ipProtocol;
      _dscp = flow._dscp;
      _ecn = flow._ecn;
      _fragmentOffset = flow._fragmentOffset;
      _icmpType = flow._icmpType;
      _icmpCode = flow._icmpCode;
      _packetLength = flow._packetLength;
      TcpFlags flags = firstNonNull(flow.getTcpFlags(), TcpFlags.FALSE);
      _tcpFlagsAck = flags.getAck();
      _tcpFlagsCwr = flags.getCwr();
      _tcpFlagsEce = flags.getEce();
      _tcpFlagsFin = flags.getFin();
      _tcpFlagsPsh = flags.getPsh();
      _tcpFlagsRst = flags.getRst();
      _tcpFlagsSyn = flags.getSyn();
      _tcpFlagsUrg = flags.getUrg();
    }

    public Flow build() {
      checkNotNull(_ingressNode, "Cannot build flow without at least specifying ingress node");
      if (_ipProtocol == IpProtocol.ICMP) {
        checkArgument(_icmpType != null, "ICMP packets must have an ICMP type");
        checkArgument(_icmpCode != null, "ICMP packets must have an ICMP code");
        checkArgument(_packetLength >= 64, "ICMP packets must be at least 64 bytes");
      } else if (_ipProtocol == IpProtocol.TCP) {
        checkArgument(_srcPort != null, "TCP packets must have a source port");
        checkArgument(_dstPort != null, "TCP packets must have a destination port");
        checkArgument(_packetLength >= 40, "TCP packets must be at least 40 bytes");
      } else if (_ipProtocol == IpProtocol.UDP) {
        checkArgument(_srcPort != null, "UDP packets must have a source port");
        checkArgument(_dstPort != null, "UDP packets must have a destination port");
        checkArgument(_packetLength >= 28, "UDP packets must be at least 28 bytes");
      }
      checkArgument(_packetLength >= 20, "IP packets must be at least 20 bytes");

      @Nullable Integer icmpCode = _icmpCode;
      @Nullable Integer icmpType = _icmpType;
      if (_ipProtocol != IpProtocol.ICMP) {
        icmpCode = null;
        icmpType = null;
      }

      @Nullable Integer srcPort = _srcPort;
      @Nullable Integer dstPort = _dstPort;
      if (!IpProtocol.IP_PROTOCOLS_WITH_PORTS.contains(_ipProtocol)) {
        srcPort = dstPort = null;
      }

      return new Flow(
          _ingressNode,
          _ingressInterface,
          _ingressVrf,
          _srcIp,
          _dstIp,
          srcPort,
          dstPort,
          firstNonNull(_ipProtocol, IpProtocol.fromNumber(0)),
          _dscp,
          _ecn,
          _fragmentOffset,
          icmpType,
          icmpCode,
          _packetLength,
          _ipProtocol == IpProtocol.TCP
              ? new TcpFlags(
                  _tcpFlagsAck,
                  _tcpFlagsCwr,
                  _tcpFlagsEce,
                  _tcpFlagsFin,
                  _tcpFlagsPsh,
                  _tcpFlagsRst,
                  _tcpFlagsSyn,
                  _tcpFlagsUrg)
              : null);
    }

    public int getDscp() {
      return _dscp;
    }

    public Ip getDstIp() {
      return _dstIp;
    }

    public @Nullable Integer getDstPort() {
      return _dstPort;
    }

    public int getEcn() {
      return _ecn;
    }

    public @Nullable Integer getIcmpCode() {
      return _icmpCode;
    }

    public @Nullable Integer getIcmpType() {
      return _icmpType;
    }

    public @Nullable String getIngressInterface() {
      return _ingressInterface;
    }

    public @Nullable String getIngressNode() {
      return _ingressNode;
    }

    public @Nullable String getIngressVrf() {
      return _ingressVrf;
    }

    public @Nullable IpProtocol getIpProtocol() {
      return _ipProtocol;
    }

    public int getPacketLength() {
      return _packetLength;
    }

    public Ip getSrcIp() {
      return _srcIp;
    }

    public @Nullable Integer getSrcPort() {
      return _srcPort;
    }

    public Builder setDscp(int dscp) {
      _dscp = dscp;
      return this;
    }

    public Builder setDstIp(Ip dstIp) {
      _dstIp = dstIp;
      return this;
    }

    public Builder setDstPort(@Nullable Integer dstPort) {
      _dstPort = dstPort;
      return this;
    }

    public Builder setEcn(int ecn) {
      _ecn = ecn;
      return this;
    }

    public Builder setFragmentOffset(int fragmentOffset) {
      _fragmentOffset = fragmentOffset;
      return this;
    }

    public Builder setIcmpCode(@Nullable Integer icmpCode) {
      _icmpCode = icmpCode;
      return this;
    }

    public Builder setIcmpType(@Nullable Integer icmpType) {
      _icmpType = icmpType;
      return this;
    }

    public Builder setIngressInterface(@Nullable String ingressInterface) {
      _ingressInterface = ingressInterface;

      // invariant: either ingressVrf or ingressInterface is always null.
      if (_ingressInterface != null) {
        _ingressVrf = null;
      }
      return this;
    }

    public Builder setIngressNode(@Nonnull String ingressNode) {
      _ingressNode = ingressNode;
      return this;
    }

    public Builder setIngressVrf(@Nullable String ingressVrf) {
      _ingressVrf = ingressVrf;

      // invariant: either ingressVrf or ingressInterface is always null.
      if (_ingressVrf != null) {
        _ingressInterface = null;
      }
      return this;
    }

    public Builder setIpProtocol(@Nonnull IpProtocol ipProtocol) {
      _ipProtocol = ipProtocol;
      return this;
    }

    public Builder setPacketLength(Integer packetLength) {
      _packetLength = packetLength;
      return this;
    }

    public Builder setSrcIp(Ip srcIp) {
      _srcIp = srcIp;
      return this;
    }

    public Builder setSrcPort(@Nullable Integer srcPort) {
      _srcPort = srcPort;
      return this;
    }

    public Builder setTcpFlagsAck(boolean tcpFlagsAck) {
      _tcpFlagsAck = tcpFlagsAck;
      return this;
    }

    public Builder setTcpFlagsCwr(boolean tcpFlagsCwr) {
      _tcpFlagsCwr = tcpFlagsCwr;
      return this;
    }

    public Builder setTcpFlagsEce(boolean tcpFlagsEce) {
      _tcpFlagsEce = tcpFlagsEce;
      return this;
    }

    public Builder setTcpFlagsFin(boolean tcpFlagsFin) {
      _tcpFlagsFin = tcpFlagsFin;
      return this;
    }

    public Builder setTcpFlagsPsh(boolean tcpFlagsPsh) {
      _tcpFlagsPsh = tcpFlagsPsh;
      return this;
    }

    public Builder setTcpFlagsRst(boolean tcpFlagsRst) {
      _tcpFlagsRst = tcpFlagsRst;
      return this;
    }

    public Builder setTcpFlagsSyn(boolean tcpFlagsSyn) {
      _tcpFlagsSyn = tcpFlagsSyn;
      return this;
    }

    public Builder setTcpFlagsUrg(boolean tcpFlagsUrg) {
      _tcpFlagsUrg = tcpFlagsUrg;
      return this;
    }

    public Builder setTcpFlags(@Nullable TcpFlags tcpFlags) {
      if (tcpFlags != null) {
        _tcpFlagsAck = tcpFlags.getAck();
        _tcpFlagsCwr = tcpFlags.getCwr();
        _tcpFlagsEce = tcpFlags.getEce();
        _tcpFlagsFin = tcpFlags.getFin();
        _tcpFlagsPsh = tcpFlags.getPsh();
        _tcpFlagsRst = tcpFlags.getRst();
        _tcpFlagsSyn = tcpFlags.getSyn();
        _tcpFlagsUrg = tcpFlags.getUrg();
      }
      return this;
    }
  }

  private static final String PROP_DSCP = "dscp";
  static final String PROP_DST_IP = "dstIp";
  static final String PROP_DST_PORT = "dstPort";
  private static final String PROP_ECN = "ecn";
  private static final String PROP_FRAGMENT_OFFSET = "fragmentOffset";
  private static final String PROP_ICMP_CODE = "icmpCode";
  private static final String PROP_ICMP_TYPE = "icmpVar";
  private static final String PROP_INGRESS_INTERFACE = "ingressInterface";
  private static final String PROP_INGRESS_NODE = "ingressNode";
  private static final String PROP_INGRESS_VRF = "ingressVrf";
  private static final String PROP_IP_PROTOCOL = "ipProtocol";
  private static final String PROP_PACKET_LENGTH = "packetLength";
  static final String PROP_SRC_IP = "srcIp";
  static final String PROP_SRC_PORT = "srcPort";
  private static final String PROP_TCP_FLAGS_ACK = "tcpFlagsAck";
  private static final String PROP_TCP_FLAGS_CWR = "tcpFlagsCwr";
  private static final String PROP_TCP_FLAGS_ECE = "tcpFlagsEce";
  private static final String PROP_TCP_FLAGS_FIN = "tcpFlagsFin";
  private static final String PROP_TCP_FLAGS_PSH = "tcpFlagsPsh";
  private static final String PROP_TCP_FLAGS_RST = "tcpFlagsRst";
  private static final String PROP_TCP_FLAGS_SYN = "tcpFlagsSyn";
  private static final String PROP_TCP_FLAGS_URG = "tcpFlagsUrg";
  private static final String PROP_DEPRECATED_STATE = "state";
  private static final String PROP_DEPRECATED_TAG = "tag";

  public static Builder builder() {
    return new Builder();
  }

  private final int _dscp;
  private final @Nonnull Ip _dstIp;
  private final @Nullable Integer _dstPort;
  private final int _ecn;
  private final int _fragmentOffset;
  private final @Nullable Integer _icmpCode;
  private final @Nullable Integer _icmpType;
  private final @Nullable String _ingressInterface;
  private final @Nonnull String _ingressNode;
  private final @Nullable String _ingressVrf;
  private final @Nonnull IpProtocol _ipProtocol;
  private final int _packetLength;
  private final @Nonnull Ip _srcIp;
  private final @Nullable Integer _srcPort;
  private final @Nullable TcpFlags _tcpFlags;

  private Flow(
      @Nonnull String ingressNode,
      @Nullable String ingressInterface,
      @Nullable String ingressVrf,
      @Nonnull Ip srcIp,
      @Nonnull Ip dstIp,
      @Nullable Integer srcPort,
      @Nullable Integer dstPort,
      @Nonnull IpProtocol ipProtocol,
      int dscp,
      int ecn,
      int fragmentOffset,
      @Nullable Integer icmpType,
      @Nullable Integer icmpCode,
      int packetLength,
      @Nullable TcpFlags tcpFlags) {
    checkArgument(
        ingressInterface != null || ingressVrf != null,
        "Either ingressInterface or ingressVrf must not be null.");
    checkArgument(
        ingressInterface == null || ingressVrf == null,
        "Either ingressInterface or ingressVrf must be null.");
    _ingressNode = ingressNode;
    _ingressInterface = ingressInterface;
    _ingressVrf = ingressVrf;
    _srcIp = srcIp;
    _dstIp = dstIp;
    _srcPort = srcPort;
    _dstPort = dstPort;
    _ipProtocol = ipProtocol;
    _dscp = dscp;
    _ecn = ecn;
    _fragmentOffset = fragmentOffset;
    _icmpType = icmpType;
    _icmpCode = icmpCode;
    _packetLength = packetLength;
    _tcpFlags = tcpFlags;
    if (_ipProtocol == IpProtocol.ICMP) {
      checkArgument(_icmpType != null, "ICMP packets must have an ICMP type");
      checkArgument(_icmpCode != null, "ICMP packets must have an ICMP code");
    } else if (_ipProtocol == IpProtocol.TCP) {
      checkArgument(_srcPort != null, "TCP packets must have a source port");
      checkArgument(_dstPort != null, "TCP packets must have a destination port");
      checkArgument(_tcpFlags != null, "TCP packets must have tcp flags");
    } else if (_ipProtocol == IpProtocol.UDP) {
      checkArgument(_srcPort != null, "UDP packets must have a source port");
      checkArgument(_dstPort != null, "UDP packets must have a destination port");
    }
  }

  @JsonCreator
  private static Flow createFlow(
      @JsonProperty(PROP_INGRESS_NODE) String ingressNode,
      @JsonProperty(PROP_INGRESS_INTERFACE) String ingressInterface,
      @JsonProperty(PROP_INGRESS_VRF) String ingressVrf,
      @JsonProperty(PROP_SRC_IP) Ip srcIp,
      @JsonProperty(PROP_DST_IP) Ip dstIp,
      @JsonProperty(PROP_SRC_PORT) @Nullable Integer srcPort,
      @JsonProperty(PROP_DST_PORT) @Nullable Integer dstPort,
      @JsonProperty(PROP_IP_PROTOCOL) IpProtocol ipProtocol,
      @JsonProperty(PROP_DSCP) int dscp,
      @JsonProperty(PROP_ECN) int ecn,
      @JsonProperty(PROP_FRAGMENT_OFFSET) int fragmentOffset,
      @JsonProperty(PROP_ICMP_TYPE) @Nullable Integer icmpType,
      @JsonProperty(PROP_ICMP_CODE) @Nullable Integer icmpCode,
      @JsonProperty(PROP_PACKET_LENGTH) int packetLength,
      @JsonProperty(PROP_TCP_FLAGS_CWR) @Nullable Integer tcpFlagsCwr,
      @JsonProperty(PROP_TCP_FLAGS_ECE) @Nullable Integer tcpFlagsEce,
      @JsonProperty(PROP_TCP_FLAGS_URG) @Nullable Integer tcpFlagsUrg,
      @JsonProperty(PROP_TCP_FLAGS_ACK) @Nullable Integer tcpFlagsAck,
      @JsonProperty(PROP_TCP_FLAGS_PSH) @Nullable Integer tcpFlagsPsh,
      @JsonProperty(PROP_TCP_FLAGS_RST) @Nullable Integer tcpFlagsRst,
      @JsonProperty(PROP_TCP_FLAGS_SYN) @Nullable Integer tcpFlagsSyn,
      @JsonProperty(PROP_TCP_FLAGS_FIN) @Nullable Integer tcpFlagsFin,
      @JsonProperty(PROP_DEPRECATED_TAG) String tag,
      @JsonProperty(PROP_DEPRECATED_STATE) Object ignored) {
    checkArgument(ipProtocol != null, PROP_IP_PROTOCOL + " must not be null");
    TcpFlags tcpFlags = null;
    if (ipProtocol == IpProtocol.TCP) {
      tcpFlags =
          new TcpFlags(
              firstNonNull(tcpFlagsAck, 0) != 0,
              firstNonNull(tcpFlagsCwr, 0) != 0,
              firstNonNull(tcpFlagsEce, 0) != 0,
              firstNonNull(tcpFlagsFin, 0) != 0,
              firstNonNull(tcpFlagsPsh, 0) != 0,
              firstNonNull(tcpFlagsRst, 0) != 0,
              firstNonNull(tcpFlagsSyn, 0) != 0,
              firstNonNull(tcpFlagsUrg, 0) != 0);
    }
    return new Flow(
        requireNonNull(ingressNode, PROP_INGRESS_NODE + " must not be null"),
        ingressInterface,
        ingressVrf,
        requireNonNull(srcIp, PROP_SRC_IP + " must not be null"),
        requireNonNull(dstIp, PROP_DST_IP + " must not be null"),
        srcPort,
        dstPort,
        ipProtocol,
        dscp,
        ecn,
        fragmentOffset,
        icmpType,
        icmpCode,
        packetLength,
        tcpFlags);
  }

  @Override
  public int compareTo(@Nonnull Flow rhs) {
    return Comparator.comparing(Flow::getIngressNode)
        .thenComparing(Flow::getIngressInterface, Comparator.nullsFirst(Comparator.naturalOrder()))
        .thenComparing(Flow::getIngressVrf, Comparator.nullsFirst(Comparator.naturalOrder()))
        .thenComparing(Flow::getSrcIp)
        .thenComparing(Flow::getDstIp)
        .thenComparing((flow) -> flow.getIpProtocol().number())
        .thenComparing(Flow::getSrcPort, Comparator.nullsFirst(Comparator.naturalOrder()))
        .thenComparing(Flow::getDstPort, Comparator.nullsFirst(Comparator.naturalOrder()))
        .thenComparing(Flow::getDscp)
        .thenComparing(Flow::getEcn)
        .thenComparing(Flow::getFragmentOffset)
        .thenComparing(Flow::getIcmpType, Comparator.nullsLast(Comparator.naturalOrder()))
        .thenComparing(Flow::getIcmpCode, Comparator.nullsLast(Comparator.naturalOrder()))
        .thenComparing(Flow::getPacketLength)
        .thenComparing(Flow::getTcpFlags, Comparator.nullsLast(Comparator.naturalOrder()))
        .compare(this, rhs);
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (!(o instanceof Flow)) {
      return false;
    }
    Flow other = (Flow) o;
    return _dscp == other._dscp
        && _dstIp.equals(other._dstIp)
        && Objects.equals(_dstPort, other._dstPort)
        && _ecn == other._ecn
        && _fragmentOffset == other._fragmentOffset
        && Objects.equals(_icmpCode, other._icmpCode)
        && Objects.equals(_icmpType, other._icmpType)
        && _ingressNode.equals(other._ingressNode)
        && Objects.equals(_ingressInterface, other._ingressInterface)
        && Objects.equals(_ingressVrf, other._ingressVrf)
        && _ipProtocol.equals(other._ipProtocol)
        && _packetLength == other._packetLength
        && _srcIp.equals(other._srcIp)
        && Objects.equals(_srcPort, other._srcPort)
        && Objects.equals(_tcpFlags, other._tcpFlags);
  }

  @JsonProperty(PROP_DSCP)
  public int getDscp() {
    return _dscp;
  }

  @Nonnull
  @JsonProperty(PROP_DST_IP)
  public Ip getDstIp() {
    return _dstIp;
  }

  @JsonProperty(PROP_DST_PORT)
  public @Nullable Integer getDstPort() {
    return _dstPort;
  }

  @JsonProperty(PROP_ECN)
  public int getEcn() {
    return _ecn;
  }

  @JsonProperty(PROP_FRAGMENT_OFFSET)
  public int getFragmentOffset() {
    return _fragmentOffset;
  }

  @JsonProperty(PROP_ICMP_CODE)
  @Nullable
  public Integer getIcmpCode() {
    return _icmpCode;
  }

  @JsonProperty(PROP_ICMP_TYPE)
  @Nullable
  public Integer getIcmpType() {
    return _icmpType;
  }

  @Nullable
  @JsonProperty(PROP_INGRESS_INTERFACE)
  public String getIngressInterface() {
    return _ingressInterface;
  }

  @Nonnull
  @JsonProperty(PROP_INGRESS_NODE)
  public String getIngressNode() {
    return _ingressNode;
  }

  @Nullable
  @JsonProperty(PROP_INGRESS_VRF)
  public String getIngressVrf() {
    return _ingressVrf;
  }

  @Nonnull
  @JsonProperty(PROP_IP_PROTOCOL)
  public IpProtocol getIpProtocol() {
    return _ipProtocol;
  }

  @JsonProperty(PROP_PACKET_LENGTH)
  public int getPacketLength() {
    return _packetLength;
  }

  @Nonnull
  @JsonProperty(PROP_SRC_IP)
  public Ip getSrcIp() {
    return _srcIp;
  }

  @JsonProperty(PROP_SRC_PORT)
  public @Nullable Integer getSrcPort() {
    return _srcPort;
  }

  /** Jackson use only. */
  @JsonProperty(PROP_DEPRECATED_TAG)
  @Nonnull
  @Deprecated
  private String getTag() {
    return "tag"; // For backwards compatibility. Older clients expect a tag
  }

  @JsonProperty(PROP_DEPRECATED_STATE)
  @Nonnull
  @Deprecated
  private String getState() {
    return "NEW";
  }

  // Again, backwards-compatibility tcp-flag ugliness below
  @JsonProperty(PROP_TCP_FLAGS_ACK)
  private int getJsonTcpFlagsAck() {
    return _tcpFlags != null && _tcpFlags.getAck() ? 1 : 0;
  }

  @JsonProperty(PROP_TCP_FLAGS_CWR)
  private int getJsonTcpFlagsCwr() {
    return _tcpFlags != null && _tcpFlags.getCwr() ? 1 : 0;
  }

  @JsonProperty(PROP_TCP_FLAGS_ECE)
  private int getJsonTcpFlagsEce() {
    return _tcpFlags != null && _tcpFlags.getEce() ? 1 : 0;
  }

  @JsonProperty(PROP_TCP_FLAGS_FIN)
  private int getJsonTcpFlagsFin() {
    return _tcpFlags != null && _tcpFlags.getFin() ? 1 : 0;
  }

  @JsonProperty(PROP_TCP_FLAGS_PSH)
  private int getJsonTcpFlagsPsh() {
    return _tcpFlags != null && _tcpFlags.getPsh() ? 1 : 0;
  }

  @JsonProperty(PROP_TCP_FLAGS_RST)
  private int getJsonTcpFlagsRst() {
    return _tcpFlags != null && _tcpFlags.getRst() ? 1 : 0;
  }

  @JsonProperty(PROP_TCP_FLAGS_SYN)
  private int getJsonTcpFlagsSyn() {
    return _tcpFlags != null && _tcpFlags.getSyn() ? 1 : 0;
  }

  @JsonProperty(PROP_TCP_FLAGS_URG)
  private int getJsonTcpFlagsUrg() {
    return _tcpFlags != null && _tcpFlags.getUrg() ? 1 : 0;
  }

  @JsonIgnore
  public @Nullable TcpFlags getTcpFlags() {
    return _tcpFlags;
  }

  @Override
  public int hashCode() {
    int hash = _hashCode;
    if (hash == 0) {
      hash =
          Objects.hash(
              _dscp,
              _dstIp,
              _dstPort,
              _ecn,
              _fragmentOffset,
              _icmpCode,
              _icmpType,
              _ingressInterface,
              _ingressNode,
              _ingressVrf,
              _ipProtocol.ordinal(),
              _packetLength,
              _srcIp,
              _srcPort,
              _tcpFlags);
      _hashCode = hash;
    }
    return hash;
  }

  private transient int _hashCode;

  private String tcpFlagsStr() {
    return String.format(
        " tcpFlags:%d%d%d%d%d%d%d%d",
        // Ordered by wire order, not alphabetical / logical order. LSB on the right.
        getJsonTcpFlagsCwr(),
        getJsonTcpFlagsEce(),
        getJsonTcpFlagsUrg(),
        getJsonTcpFlagsAck(),
        getJsonTcpFlagsPsh(),
        getJsonTcpFlagsRst(),
        getJsonTcpFlagsSyn(),
        getJsonTcpFlagsFin());
  }

  public Builder toBuilder() {
    return new Builder(this);
  }

  @Override
  public String toString() {
    boolean icmp = _ipProtocol == IpProtocol.ICMP;
    boolean tcp = _ipProtocol == IpProtocol.TCP;
    boolean udp = _ipProtocol == IpProtocol.UDP;
    String srcPortStr = "";
    String dstPortStr = "";
    String icmpTypeStr = "";
    String icmpCodeStr = "";
    String tcpFlagsStr = "";
    if (tcp || udp) {
      assert _srcPort != null;
      assert _dstPort != null;
      srcPortStr = " srcPort:" + NamedPort.nameFromNumber(_srcPort);
      dstPortStr = " dstPort:" + NamedPort.nameFromNumber(_dstPort);
    }
    if (tcp) {
      tcpFlagsStr = tcpFlagsStr();
    }
    if (icmp) {
      icmpCodeStr = " icmpCode:" + _icmpCode;
      icmpTypeStr = " icmpType:" + _icmpType;
    }
    return "Flow<ingressNode:"
        + _ingressNode
        + (_ingressVrf != null ? " ingressVrf:" + _ingressVrf : "")
        + (_ingressInterface != null ? " iface:" + _ingressInterface : "")
        + " srcIp:"
        + _srcIp
        + " dstIp:"
        + _dstIp
        + " ipProtocol:"
        + _ipProtocol
        + srcPortStr
        + dstPortStr
        + " dscp: "
        + _dscp
        + " ecn:"
        + _ecn
        + " fragmentOffset:"
        + _fragmentOffset
        + icmpTypeStr
        + icmpCodeStr
        + " packetLength:"
        + _packetLength
        + tcpFlagsStr
        + ">";
  }
}


text:
class Aact160AddDesignMaskedRoles < ActiveRecord::Migration
  def change
    add_column :designs, :subject_masked, :boolean
    add_column :designs, :caregiver_masked, :boolean
    add_column :designs, :investigator_masked, :boolean
    add_column :designs, :outcomes_assessor_masked, :boolean
  end
end


text:
\documentclass{article}
\usepackage{graphicx}
\DeclareGraphicsRule{*}{eps}{*}{}
\nofiles
\begin{document}
\thispagestyle{empty}
\includegraphics{figures.1}
\end{document}


text:
package org.bouncycastle.pqc.jcajce.interfaces;

import java.security.Key;

public interface NHKey
    extends Key
{
}


text:
"""Tests hal.hashes.md5 implementation"""
import os

from hal.hashes.md5 import file_to_md5
from hal.hashes.md5 import string_to_md5
from hal.tests.utils import BatteryTests

def test_string_to_md5():
    """Tests hal.hashes.md5.string_to_md5 method"""

    tests = {
        "hello world": "5eb63bbbe01eeed093cb22bb8f5acdc3"
    }
    BatteryTests(tests).assert_all(string_to_md5)

def test_file_to_md5():
    """Tests hal.hashes.md5.file_to_md5 method"""

    path = os.path.join(os.path.dirname(__file__), "__init__.py")
    tests = {
        path: "d41d8cd98f00b204e9800998ecf8427e"
    }
    BatteryTests(tests).assert_all(file_to_md5)


text: <chat chat-id="chatId" room-id="roomId"></chat>


text:
using System;

namespace Yisoft.Framework.Utilities
{
    public class DateTimeUtils
    {
        public static DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

        public static Func<DateTime> UtcNowFunc = () => DateTime.UtcNow;

        public static DateTime UtcNow => UtcNowFunc();

        public static int ToTimeStamp(DateTime dateTime) { return (int) (dateTime.ToUniversalTime() - UnixEpoch).TotalSeconds; }

        public static DateTime FromTimeStamp(int timestamp) { return UnixEpoch.AddSeconds(timestamp).ToLocalTime(); }
    }
}


text:
import { Component } from '@angular/core';
import { MdDialogRef } from '@angular/material';

@Component({
    templateUrl: './mirror_dialog.component.html'
})
export class MirrorDialogComponent {
    mirror: Mirror;

    constructor(public dialogRef: MdDialogRef<MirrorDialogComponent>) {
        this.mirror = {};
    }
}


text:
NOTE: THIS VERSION OF THE REPOSITORY IS NO LONGER ACTIVELY MAINTAINED

_Please see https://github.com/sysmedlab/ehR_

------

**Install**

```
library("devtools")
install_github("claramarquardt/ehR",dependencies = TRUE)
library(ehR)
```
**Documentation**
- See 'function_overview.csv' for an overview of all the functions (and data sets) included in the package

**Datasets & Crosswalks**
The package contains the following data sets and crosswalks:
- _dia_: Simulated EHR diagnosis data for 500 patients
- _ed_: Simulated EHR ED visit data for 500 patients
- _dem_: Simulated EHR demographics data for 500 patients
- _ehR_Cohort_: Simulated cohort & feature set
- _gagne_code_: ICD9 code - gagne co-morbidity category crosswalk (http://scholar.harvard.edu/gagne/software/combined-comorbidity-score) [* note the crosswalk included in the package includes gagne categories that are assigned a 0 weight (these are not included in the here referenced, publicly available version of the crosswalk)]
- _zocat_: ICD9 code - zocat crosswalk

**Notes**
- [1] Requires the newest version of devtools (https://github.com/hadley/devtools) to be installed
```
library(devtools)
install_github("hadley/devtools")
```
- [2] ggplot themes included in the package (theme_[name of theme].R) *may* require a number of additional fonts to be installed and registered with ggplot/ggsave

````
# install the necessary packages
install.packages("extrafontdb",repos="http://cran.cnr.berkeley.edu/",
   dependencies=TRUE)
install.packages("extrafont",repos="http://cran.cnr.berkeley.edu/",
   dependencies=TRUE)

# load the necessary packages
library(extrafont)
library(extrafontdb)

# register the fonts (this step only needs to be execute once)
font_import()
loadfonts()

# Note: There may still be problems when using the themes on a plot saved in a non-PDF format

````

**Development**

- To Contribute:
````
# 1. Clone the repo
git clone https://github.com/ClaraMarquardt/ehR.git

# 2. Make/Save any changes
- Ensure that all dependencies are included in @import statements at the function top and are
listed in the Imports (CRAN Dependency)/ Remotes (Github Dependency) fields of the DESCRIPTION file
- Recompile the package by executing the 'package_management/package_update.sh' script (Note: Prior to
compilation all dependencies need to be (manually) installed)
- Confirm that the compilation was successful by checking the 'package_management/package_update.Rout'
file and the 'function_overview.csv'

# 2. Create a new branch
git checkout -b [branch name]

# 3. Push all changes to the branch (assuming all changes have been committed)
git push origin [branch name]

* Note: Please see the contribution guide prior to committing
any changes: 'package_management/contribution_guide.txt'

# 4. Test by installing from the branch
library(devtools)
install_git("git://github.com/ClaraMarquardt/ehR.git", branch = "[branch name])
````

- Package Management Tools
````
See 'package_management/' for

- (a) a script to update the package ('package_update.sh')

- (b) a script to load the package data and functions locally (rather than as a
package) ('load_package_locally.R')

````


text:
layout: bassam
---


text:
layout: page
title: Young - Koch Wedding
date: 2016-05-24
author: Nathan Moody
tags: weekly links, java
status: published
summary: Maecenas faucibus arcu sapien, quis gravida tortor.
banner: images/banner/leisure-03.jpg
booking:
  startDate: 06/06/2018
  endDate: 06/10/2018
  ctyhocn: NYCSPHX
  groupCode: YKW
published: true
---
Vivamus quis dui eu nibh sollicitudin fringilla. Aliquam interdum aliquam porttitor. Phasellus vitae erat felis. Sed risus nibh, consequat sit amet neque id, vehicula lacinia nisl. Phasellus in imperdiet ligula. Donec hendrerit sodales justo ut blandit. Phasellus est est, facilisis eget elit non, egestas elementum est. Sed elit nisl, lacinia et leo eget, consequat eleifend mauris. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nullam ullamcorper tempus dolor, id euismod turpis sagittis sit amet. Aliquam et lacus sem. Donec maximus commodo leo dictum consequat. Maecenas ac lacinia tortor. Nullam iaculis pulvinar nibh, ac placerat justo ultrices eu. Morbi dapibus, lectus non tempus consequat, odio lectus mattis tortor, ut venenatis nisi ligula sed lectus. Sed orci nisi, luctus sit amet aliquet id, viverra quis odio.

* Sed ullamcorper ligula ac vestibulum ultricies
* Curabitur malesuada mi quis lacus lobortis, id molestie neque elementum
* Praesent consequat nulla vel nunc commodo mattis
* Vestibulum pretium purus quis sapien posuere tempus
* Etiam ut leo at orci bibendum porta sed at orci.

Duis non magna nulla. Maecenas ligula elit, imperdiet quis risus ac, hendrerit pulvinar arcu. Proin ornare odio magna, sit amet cursus ligula lacinia vitae. Donec pharetra justo ut quam tempus rutrum. Morbi sed sollicitudin nibh. Donec nec dictum ante. Nulla pretium rhoncus neque eu convallis. Mauris id aliquam magna. Pellentesque eu convallis augue. Nam nec odio ultrices eros iaculis dictum in auctor felis.


text:
package com.intellij.updater;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;

public class CreateAction extends PatchAction {
  public CreateAction(Patch patch, String path) {
    super(patch, path, Digester.INVALID);
  }

  public CreateAction(Patch patch, DataInputStream in) throws IOException {
    super(patch, in);
  }

  @Override
  protected void doBuildPatchFile(File olderFile, File newerFile, ZipOutputStream patchOutput) throws IOException {
    patchOutput.putNextEntry(new ZipEntry(getPath()));

    if (!Files.isDirectory(newerFile.toPath(), LinkOption.NOFOLLOW_LINKS)) {
      FileType type = getFileType(newerFile);
      writeFileType(patchOutput, type);
      if (type == FileType.SYMLINK) {
        writeLinkInfo(newerFile, patchOutput);
      }
      else {
        Utils.copyFileToStream(newerFile, patchOutput);
      }
    }

    patchOutput.closeEntry();
  }

  private static void writeLinkInfo(File file, OutputStream out) throws IOException {
    String target = Utils.readLink(file);
    if (target.isEmpty()) throw new IOException("Invalid link: " + file);
    byte[] bytes = target.getBytes(StandardCharsets.UTF_8);
    out.write(bytes.length);
    out.write(bytes);
  }

  @Override
  public ValidationResult validate(File toDir) {
    File toFile = getFile(toDir);
    ValidationResult result = doValidateAccess(toFile, ValidationResult.Action.CREATE, true);
    if (result != null) return result;

    if (toFile.exists()) {
      ValidationResult.Option[] options = myPatch.isStrict()
                                          ? new ValidationResult.Option[]{ValidationResult.Option.REPLACE}
                                          : new ValidationResult.Option[]{ValidationResult.Option.REPLACE, ValidationResult.Option.KEEP};
      return new ValidationResult(
        ValidationResult.Kind.CONFLICT, getPath(), ValidationResult.Action.CREATE, ValidationResult.ALREADY_EXISTS_MESSAGE, options);
    }
    return null;
  }

  @Override
  protected boolean isModified(File toFile) {
    return false;
  }

  @Override
  protected void doApply(ZipFile patchFile, File backupDir, File toFile) throws IOException {
    Runner.logger().info("Create action. File: " + toFile.getAbsolutePath());
    prepareToWriteFile(toFile);

    ZipEntry entry = Utils.getZipEntry(patchFile, getPath());
    if (entry.isDirectory()) {
      if (!toFile.mkdir()) {
        throw new IOException("Unable to create directory " + getPath());
      }
    }
    else {
      try (InputStream in = Utils.findEntryInputStreamForEntry(patchFile, entry)) {
        if (in == null) {
          throw new IOException("Invalid entry " + getPath());
        }

        FileType type = readFileType(in);
        if (type == FileType.SYMLINK) {
          Utils.createLink(readLinkInfo(in), toFile);
        }
        else {
          Utils.copyStreamToFile(in, toFile);
          if (type == FileType.EXECUTABLE_FILE) {
            Utils.setExecutable(toFile);
          }
        }
      }
    }
  }

  private static void prepareToWriteFile(File file) throws IOException {
    if (file.exists()) {
      Utils.delete(file);
      return;
    }

    while (file != null && !file.exists()) {
      file = file.getParentFile();
    }
    if (file != null && !file.isDirectory()) {
      Utils.delete(file);
    }
  }

  private static String readLinkInfo(InputStream in) throws IOException {
    int length = in.read();
    if (length <= 0) throw new IOException("Stream format error");
    byte[] bytes = Utils.readBytes(in, length);
    return new String(bytes, StandardCharsets.UTF_8);
  }

  @Override
  protected void doRevert(File toFile, File backupFile) throws IOException {
    Utils.delete(toFile);
  }
}


text:
/**
 * The Java API for working Clara rules. It contains three simple pieces:
 *
 *

 *
The {@link clara.rules.RuleLoader RuleLoader}, responsible for loading rules into a new working memory

 *
The {@link clara.rules.WorkingMemory WorkingMemory}, an immutable instance of a rule session.

 *
The {@link clara.rules.QueryResult QueryResult}, a container of query results.

 *

 *
 *

 * Note this API does not have a separate "knowledge base" class like those of other rules engines. Instead,
 * the user can simply create and reuse a single, empty WorkingMemory object for multiple rule instances -- optionally
 * sticking the initial empty working memory in a static variable. This type of pattern is efficient and possible
 * since the WorkingMemory is immutable, creating a new instance that shares internal state when changes occur.
 *

 *
 * See the Clara Examples
 * project for an example of this in action.
 */
package clara.rules;


text:
public class Java {
    public void test() {}
}


text:
package org.apache.solr.handler.admin;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.Aliases;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.DocRouter;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.common.util.Utils;
import org.apache.zookeeper.KeeperException;

public class ClusterStatus {
  private final ZkStateReader zkStateReader;
  private final String collection;
  private ZkNodeProps message;

  public ClusterStatus(ZkStateReader zkStateReader, ZkNodeProps props) {
    this.zkStateReader = zkStateReader;
    this.message = props;
    collection = props.getStr(ZkStateReader.COLLECTION_PROP);

  }

  @SuppressWarnings("unchecked")
  public  void getClusterStatus(NamedList results)
      throws KeeperException, InterruptedException {
    zkStateReader.updateClusterState();

    // read aliases
    Aliases aliases = zkStateReader.getAliases();
    Map<String, List<String>> collectionVsAliases = new HashMap<>();
    Map<String, String> aliasVsCollections = aliases.getCollectionAliasMap();
    if (aliasVsCollections != null) {
      for (Map.Entry<String, String> entry : aliasVsCollections.entrySet()) {
        List<String> colls = StrUtils.splitSmart(entry.getValue(), ',');
        String alias = entry.getKey();
        for (String coll : colls) {
          if (collection == null || collection.equals(coll))  {
            List<String> list = collectionVsAliases.get(coll);
            if (list == null) {
              list = new ArrayList<>();
              collectionVsAliases.put(coll, list);
            }
            list.add(alias);
          }
        }
      }
    }

    Map roles = null;
    if (zkStateReader.getZkClient().exists(ZkStateReader.ROLES, true)) {
      roles = (Map) Utils.fromJSON(zkStateReader.getZkClient().getData(ZkStateReader.ROLES, null, null, true));
    }

    ClusterState clusterState = zkStateReader.getClusterState();

    // convert cluster state into a map of writable types
    byte[] bytes = Utils.toJSON(clusterState);
    Map<String, Object> stateMap = (Map<String,Object>) Utils.fromJSON(bytes);

    Set<String> collections = new HashSet<>();
    String routeKey = message.getStr(ShardParams._ROUTE_);
    String shard = message.getStr(ZkStateReader.SHARD_ID_PROP);
    if (collection == null) {
      collections = new HashSet<>(clusterState.getCollections());
    } else  {
      collections = Collections.singleton(collection);
    }

    NamedList<Object> collectionProps = new SimpleOrderedMap<Object>();

    for (String name : collections) {
      Map<String, Object> collectionStatus = null;
      DocCollection clusterStateCollection = clusterState.getCollection(name);

      Set<String> requestedShards = new HashSet<>();
      if (routeKey != null) {
        DocRouter router = clusterStateCollection.getRouter();
        Collection<Slice> slices = router.getSearchSlices(routeKey, null, clusterStateCollection);
        for (Slice slice : slices) {
          requestedShards.add(slice.getName());
        }
      }
      if (shard != null) {
        requestedShards.add(shard);
      }

      if (clusterStateCollection.getStateFormat() > 1) {
        bytes = Utils.toJSON(clusterStateCollection);
        Map<String, Object> docCollection = (Map<String, Object>) Utils.fromJSON(bytes);
        collectionStatus = getCollectionStatus(docCollection, name, requestedShards);
      } else {
        collectionStatus = getCollectionStatus((Map<String, Object>) stateMap.get(name), name, requestedShards);
      }

      collectionStatus.put("znodeVersion", clusterStateCollection.getZNodeVersion());
      if (collectionVsAliases.containsKey(name) && !collectionVsAliases.get(name).isEmpty()) {
        collectionStatus.put("aliases", collectionVsAliases.get(name));
      }
      String configName = zkStateReader.readConfigName(name);
      collectionStatus.put("configName", configName);
      collectionProps.add(name, collectionStatus);
    }

    List<String> liveNodes = zkStateReader.getZkClient().getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null, true);

    // now we need to walk the collectionProps tree to cross-check replica state with live nodes
    crossCheckReplicaStateWithLiveNodes(liveNodes, collectionProps);

    NamedList<Object> clusterStatus = new SimpleOrderedMap<>();
    clusterStatus.add("collections", collectionProps);

    // read cluster properties
    Map clusterProps = zkStateReader.getClusterProps();
    if (clusterProps != null && !clusterProps.isEmpty())  {
      clusterStatus.add("properties", clusterProps);
    }

    // add the alias map too
    if (aliasVsCollections != null && !aliasVsCollections.isEmpty())  {
      clusterStatus.add("aliases", aliasVsCollections);
    }

    // add the roles map
    if (roles != null)  {
      clusterStatus.add("roles", roles);
    }

    // add live_nodes
    clusterStatus.add("live_nodes", liveNodes);

    results.add("cluster", clusterStatus);
  }
  /**
   * Get collection status from cluster state.
   * Can return collection status by given shard name.
   *
   *
   * @param collection collection map parsed from JSON-serialized {@link ClusterState}
   * @param name  collection name
   * @param requestedShards a set of shards to be returned in the status.
   *                        An empty or null values indicates <b>all</b> shards.
   * @return map of collection properties
   */
  @SuppressWarnings("unchecked")
  private Map<String, Object> getCollectionStatus(Map<String, Object> collection, String name, Set<String> requestedShards) {
    if (collection == null)  {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Collection: " + name + " not found");
    }
    if (requestedShards == null || requestedShards.isEmpty()) {
      return collection;
    } else {
      Map<String, Object> shards = (Map<String, Object>) collection.get("shards");
      Map<String, Object>  selected = new HashMap<>();
      for (String selectedShard : requestedShards) {
        if (!shards.containsKey(selectedShard)) {
          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Collection: " + name + " shard: " + selectedShard + " not found");
        }
        selected.put(selectedShard, shards.get(selectedShard));
        collection.put("shards", selected);
      }
      return collection;
    }
  }

  /**
   * Walks the tree of collection status to verify that any replicas not reporting a "down" status is
   * on a live node, if any replicas reporting their status as "active" but the node is not live is
   * marked as "down"; used by CLUSTERSTATUS.
   * @param liveNodes List of currently live node names.
   * @param collectionProps Map of collection status information pulled directly from ZooKeeper.
   */

  @SuppressWarnings("unchecked")
  protected void crossCheckReplicaStateWithLiveNodes(List<String> liveNodes, NamedList<Object> collectionProps) {
    Iterator<Map.Entry<String,Object>> colls = collectionProps.iterator();
    while (colls.hasNext()) {
      Map.Entry<String,Object> next = colls.next();
      Map<String,Object> collMap = (Map<String,Object>)next.getValue();
      Map<String,Object> shards = (Map<String,Object>)collMap.get("shards");
      for (Object nextShard : shards.values()) {
        Map<String,Object> shardMap = (Map<String,Object>)nextShard;
        Map<String,Object> replicas = (Map<String,Object>)shardMap.get("replicas");
        for (Object nextReplica : replicas.values()) {
          Map<String,Object> replicaMap = (Map<String,Object>)nextReplica;
          if (Replica.State.getState((String) replicaMap.get(ZkStateReader.STATE_PROP)) != Replica.State.DOWN) {
            // not down, so verify the node is live
            String node_name = (String)replicaMap.get(ZkStateReader.NODE_NAME_PROP);
            if (!liveNodes.contains(node_name)) {
              // node is not live, so this replica is actually down
              replicaMap.put(ZkStateReader.STATE_PROP, Replica.State.DOWN.toString());
            }
          }
        }
      }
    }
  }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Kurswahl.Views
{
    /// <summary>
    /// Interaktionslogik für KursSchuelerView.xaml
    /// </summary>
    public partial class KursSchuelerView : UserControl
    {
        public KursSchuelerView()
        {
            InitializeComponent();
        }
    }
}


text:
{{define "head"}}<title>index</title>{{end}}
{{define "body"}}
[profile]

{{template "signout" .}}

{{template "index" .}}
{{end}}


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.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CSharp
{
    /// <summary>
    /// A binder that knows no symbols and will not delegate further.
    /// </summary>
    internal partial class BuckStopsHereBinder : Binder
    {
        internal BuckStopsHereBinder(CSharpCompilation compilation)
            : base(compilation)
        {
        }

        internal override ImportChain ImportChain
        {
            get
            {
                return null;
            }
        }

        internal override Imports GetImports(ConsList<Symbol> basesBeingResolved)
        {
            return Imports.Empty;
        }

        protected override SourceLocalSymbol LookupLocal(SyntaxToken nameToken)
        {
            return null;
        }

        protected override LocalFunctionSymbol LookupLocalFunction(SyntaxToken nameToken)
        {
            return null;
        }

        internal override bool IsAccessibleHelper(Symbol symbol, TypeSymbol accessThroughType, out bool failedThroughTypeCheck, ref HashSet<DiagnosticInfo> useSiteDiagnostics, ConsList<Symbol> basesBeingResolved)
        {
            failedThroughTypeCheck = false;
            return IsSymbolAccessibleConditional(symbol, Compilation.Assembly, ref useSiteDiagnostics);
        }

        internal override ConstantFieldsInProgress ConstantFieldsInProgress
        {
            get
            {
                return ConstantFieldsInProgress.Empty;
            }
        }

        internal override ConsList<FieldSymbol> FieldsBeingBound
        {
            get
            {
                return ConsList<FieldSymbol>.Empty;
            }
        }

        internal override LocalSymbol LocalInProgress
        {
            get
            {
                return null;
            }
        }

        protected override bool IsUnboundTypeAllowed(GenericNameSyntax syntax)
        {
            return false;
        }

        internal override bool IsInMethodBody
        {
            get
            {
                return false;
            }
        }

        internal override bool IsDirectlyInIterator
        {
            get
            {
                return false;
            }
        }

        internal override bool IsIndirectlyInIterator
        {
            get
            {
                return false;
            }
        }

        internal override GeneratedLabelSymbol BreakLabel
        {
            get
            {
                return null;
            }
        }

        internal override GeneratedLabelSymbol ContinueLabel
        {
            get
            {
                return null;
            }
        }

        internal override BoundExpression ConditionalReceiverExpression
        {
            get
            {
                return null;
            }
        }

        // This should only be called in the context of syntactically incorrect programs.  In other
        // contexts statements are surrounded by some enclosing method or lambda.
        internal override TypeSymbol GetIteratorElementType(YieldStatementSyntax node, DiagnosticBag diagnostics)
        {
            // There's supposed to be an enclosing method or lambda.
            throw ExceptionUtilities.Unreachable;
        }

        internal override Symbol ContainingMemberOrLambda
        {
            get
            {
                return null;
            }
        }

        internal override Binder GetBinder(SyntaxNode node)
        {
            return null;
        }

        internal override ImmutableArray<LocalSymbol> GetDeclaredLocalsForScope(SyntaxNode scopeDesignator)
        {
            throw ExceptionUtilities.Unreachable;
        }

        internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator)
        {
            throw ExceptionUtilities.Unreachable;
        }

        internal override BoundStatement BindSwitchExpressionAndSections(SwitchStatementSyntax node, Binder originalBinder, DiagnosticBag diagnostics)
        {
            // There's supposed to be a SwitchBinder (or other overrider of this method) in the chain.
            throw ExceptionUtilities.Unreachable;
        }

        internal override BoundForStatement BindForParts(DiagnosticBag diagnostics, Binder originalBinder)
        {
            // There's supposed to be a ForLoopBinder (or other overrider of this method) in the chain.
            throw ExceptionUtilities.Unreachable;
        }

        internal override BoundStatement BindForEachParts(DiagnosticBag diagnostics, Binder originalBinder)
        {
            // There's supposed to be a ForEachLoopBinder (or other overrider of this method) in the chain.
            throw ExceptionUtilities.Unreachable;
        }

        internal override BoundStatement BindForEachDeconstruction(DiagnosticBag diagnostics, Binder originalBinder)
        {
            // There's supposed to be a ForEachLoopBinder (or other overrider of this method) in the chain.
            throw ExceptionUtilities.Unreachable;
        }

        internal override BoundWhileStatement BindWhileParts(DiagnosticBag diagnostics, Binder originalBinder)
        {
            // There's supposed to be a WhileBinder (or other overrider of this method) in the chain.
            throw ExceptionUtilities.Unreachable;
        }

        internal override BoundDoStatement BindDoParts(DiagnosticBag diagnostics, Binder originalBinder)
        {
            // There's supposed to be a WhileBinder (or other overrider of this method) in the chain.
            throw ExceptionUtilities.Unreachable;
        }

        internal override BoundStatement BindUsingStatementParts(DiagnosticBag diagnostics, Binder originalBinder)
        {
            // There's supposed to be a UsingStatementBinder (or other overrider of this method) in the chain.
            throw ExceptionUtilities.Unreachable;
        }

        internal override BoundStatement BindLockStatementParts(DiagnosticBag diagnostics, Binder originalBinder)
        {
            // There's supposed to be a LockBinder (or other overrider of this method) in the chain.
            throw ExceptionUtilities.Unreachable;
        }

        internal override ImmutableHashSet<Symbol> LockedOrDisposedVariables
        {
            get { return ImmutableHashSet.Create<Symbol>(); }
        }
    }
}


text:
package fr.free.nrw.commons.upload;

import static fr.free.nrw.commons.contributions.ContributionController.ACTION_INTERNAL_UPLOADS;
import static fr.free.nrw.commons.upload.UploadService.EXTRA_FILES;
import static fr.free.nrw.commons.wikidata.WikidataConstants.PLACE_OBJECT;

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.auth.LoginActivity;
import fr.free.nrw.commons.auth.SessionManager;
import fr.free.nrw.commons.contributions.ContributionController;
import fr.free.nrw.commons.filepicker.UploadableFile;
import fr.free.nrw.commons.kvstore.JsonKvStore;
import fr.free.nrw.commons.mwapi.UserClient;
import fr.free.nrw.commons.nearby.Place;
import fr.free.nrw.commons.theme.BaseActivity;
import fr.free.nrw.commons.upload.categories.UploadCategoriesFragment;
import fr.free.nrw.commons.upload.depicts.DepictsFragment;
import fr.free.nrw.commons.upload.license.MediaLicenseFragment;
import fr.free.nrw.commons.upload.mediaDetails.UploadMediaDetailFragment;
import fr.free.nrw.commons.upload.mediaDetails.UploadMediaDetailFragment.UploadMediaDetailFragmentCallback;
import fr.free.nrw.commons.utils.PermissionUtils;
import fr.free.nrw.commons.utils.ViewUtil;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import timber.log.Timber;

public class UploadActivity extends BaseActivity implements UploadContract.View, UploadBaseFragment.Callback {
    @Inject
    ContributionController contributionController;
    @Inject
    @Named("default_preferences")
    JsonKvStore directKvStore;
    @Inject
    UploadContract.UserActionListener presenter;
    @Inject
    SessionManager sessionManager;
    @Inject
    UserClient userClient;

    @BindView(R.id.cv_container_top_card)
    CardView cvContainerTopCard;

    @BindView(R.id.ll_container_top_card)
    LinearLayout llContainerTopCard;

    @BindView(R.id.rl_container_title)
    RelativeLayout rlContainerTitle;

    @BindView(R.id.tv_top_card_title)
    TextView tvTopCardTitle;

    @BindView(R.id.ib_toggle_top_card)
    ImageButton ibToggleTopCard;

    @BindView(R.id.rv_thumbnails)
    RecyclerView rvThumbnails;

    @BindView(R.id.vp_upload)
    ViewPager vpUpload;

    private boolean isTitleExpanded = true;

    private CompositeDisposable compositeDisposable;
    private ProgressDialog progressDialog;
    private UploadImageAdapter uploadImagesAdapter;
    private List<UploadBaseFragment> fragments;
    private UploadCategoriesFragment uploadCategoriesFragment;
    private DepictsFragment depictsFragment;
    private MediaLicenseFragment mediaLicenseFragment;
    private ThumbnailsAdapter thumbnailsAdapter;

    private Place place;
    private List<UploadableFile> uploadableFiles = Collections.emptyList();
    private int currentSelectedPosition = 0;

    @SuppressLint("CheckResult")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_upload);

        ButterKnife.bind(this);
        compositeDisposable = new CompositeDisposable();
        init();

        PermissionUtils.checkPermissionsAndPerformAction(this,
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
                this::receiveSharedItems,
                R.string.storage_permission_title,
                R.string.write_storage_permission_rationale_for_image_share);
    }

    private void init() {
        initProgressDialog();
        initViewPager();
        initThumbnailsRecyclerView();
        //And init other things you need to
    }

    private void initProgressDialog() {
        progressDialog = new ProgressDialog(this);
        progressDialog.setMessage(getString(R.string.please_wait));
    }

    private void initThumbnailsRecyclerView() {
        rvThumbnails.setLayoutManager(new LinearLayoutManager(this,
                LinearLayoutManager.HORIZONTAL, false));
        thumbnailsAdapter = new ThumbnailsAdapter(() -> currentSelectedPosition);
        rvThumbnails.setAdapter(thumbnailsAdapter);

    }

    private void initViewPager() {
        uploadImagesAdapter = new UploadImageAdapter(getSupportFragmentManager());
        vpUpload.setAdapter(uploadImagesAdapter);
        vpUpload.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset,
                                       int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {
                currentSelectedPosition = position;
                if (position >= uploadableFiles.size()) {
                    cvContainerTopCard.setVisibility(View.GONE);
                } else {
                    thumbnailsAdapter.notifyDataSetChanged();
                    cvContainerTopCard.setVisibility(View.VISIBLE);
                }

            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
    }

    @Override
    public boolean isLoggedIn() {
        return sessionManager.isUserLoggedIn();
    }

    @Override
    protected void onResume() {
        super.onResume();
        presenter.onAttachView(this);
        if (!isLoggedIn()) {
            askUserToLogIn();
        }
        checkBlockStatus();
        checkStoragePermissions();
    }

    /**
     * Makes API call to check if user is blocked from Commons. If the user is blocked, a snackbar
     * is created to notify the user
     */
    protected void checkBlockStatus() {
        compositeDisposable.add(userClient.isUserBlockedFromCommons()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .filter(result -> result)
                .subscribe(result -> showInfoAlert(R.string.block_notification_title,
                        R.string.block_notification, UploadActivity.this::finish)
                ));
    }

    private void checkStoragePermissions() {
        PermissionUtils.checkPermissionsAndPerformAction(this,
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
                () -> {
                    //TODO handle this
                },
                R.string.storage_permission_title,
                R.string.write_storage_permission_rationale_for_image_share);
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    /**
     * Show/Hide the progress dialog
     */
    @Override
    public void showProgress(boolean shouldShow) {
        if (shouldShow) {
            if (!progressDialog.isShowing()) {
                progressDialog.show();
            }
        } else {
            if (progressDialog != null && !isFinishing()) {
                progressDialog.dismiss();
            }
        }
    }

    @Override
    public int getIndexInViewFlipper(UploadBaseFragment fragment) {
        return fragments.indexOf(fragment);
    }

    @Override
    public int getTotalNumberOfSteps() {
        return fragments.size();
    }

    @Override
    public void showMessage(int messageResourceId) {
        ViewUtil.showLongToast(this, messageResourceId);
    }

    @Override
    public List<UploadableFile> getUploadableFiles() {
        return uploadableFiles;
    }

    @Override
    public void showHideTopCard(boolean shouldShow) {
        llContainerTopCard.setVisibility(shouldShow ? View.VISIBLE : View.GONE);
    }

    @Override
    public void onUploadMediaDeleted(int index) {
        fragments.remove(index);//Remove the corresponding fragment
        uploadableFiles.remove(index);//Remove the files from the list
        thumbnailsAdapter.notifyItemRemoved(index); //Notify the thumbnails adapter
        uploadImagesAdapter.notifyDataSetChanged(); //Notify the ViewPager
    }

    @Override
    public void updateTopCardTitle() {
        tvTopCardTitle.setText(getResources()
                .getQuantityString(R.plurals.upload_count_title, uploadableFiles.size(), uploadableFiles.size()));
    }

    @Override
    public void askUserToLogIn() {
        Timber.d("current session is null, asking user to login");
        ViewUtil.showLongToast(this, getString(R.string.user_not_logged_in));
        Intent loginIntent = new Intent(UploadActivity.this, LoginActivity.class);
        startActivity(loginIntent);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == CommonsApplication.OPEN_APPLICATION_DETAIL_SETTINGS) {
            //TODO: Confirm if handling manual permission enabled is required
        }
    }

    private void receiveSharedItems() {
        Intent intent = getIntent();
        String action = intent.getAction();
        if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
            receiveExternalSharedItems();
        } else if (ACTION_INTERNAL_UPLOADS.equals(action)) {
            receiveInternalSharedItems();
        }

        if (uploadableFiles == null || uploadableFiles.isEmpty()) {
            handleNullMedia();
        } else {
            //Show thumbnails
            if (uploadableFiles.size()
                    > 1) {//If there is only file, no need to show the image thumbnails
                thumbnailsAdapter.setUploadableFiles(uploadableFiles);
            } else {
                llContainerTopCard.setVisibility(View.GONE);
            }
            tvTopCardTitle.setText(getResources()
                    .getQuantityString(R.plurals.upload_count_title, uploadableFiles.size(), uploadableFiles.size()));

            fragments = new ArrayList<>();
            for (UploadableFile uploadableFile : uploadableFiles) {
                UploadMediaDetailFragment uploadMediaDetailFragment = new UploadMediaDetailFragment();
                uploadMediaDetailFragment.setImageTobeUploaded(uploadableFile, place);
                uploadMediaDetailFragment.setCallback(new UploadMediaDetailFragmentCallback() {
                    @Override
                    public void deletePictureAtIndex(int index) {
                        presenter.deletePictureAtIndex(index);
                    }

                    @Override
                    public void onNextButtonClicked(int index) {
                        UploadActivity.this.onNextButtonClicked(index);
                    }

                    @Override
                    public void onPreviousButtonClicked(int index) {
                        UploadActivity.this.onPreviousButtonClicked(index);
                    }

                    @Override
                    public void showProgress(boolean shouldShow) {
                        UploadActivity.this.showProgress(shouldShow);
                    }

                    @Override
                    public int getIndexInViewFlipper(UploadBaseFragment fragment) {
                        return fragments.indexOf(fragment);
                    }

                    @Override
                    public int getTotalNumberOfSteps() {
                        return fragments.size();
                    }
                });
                fragments.add(uploadMediaDetailFragment);
            }

            uploadCategoriesFragment = new UploadCategoriesFragment();
            uploadCategoriesFragment.setCallback(this);

            depictsFragment = new DepictsFragment();
            depictsFragment.setCallback(this);

            mediaLicenseFragment = new MediaLicenseFragment();
            mediaLicenseFragment.setCallback(this);

            fragments.add(depictsFragment);
            fragments.add(uploadCategoriesFragment);
            fragments.add(mediaLicenseFragment);

            uploadImagesAdapter.setFragments(fragments);
            vpUpload.setOffscreenPageLimit(fragments.size());
        }
    }

    private void receiveExternalSharedItems() {
        uploadableFiles = contributionController.handleExternalImagesPicked(this, getIntent());
    }

    private void receiveInternalSharedItems() {
        Intent intent = getIntent();

        Timber.d("Received intent %s with action %s", intent.toString(), intent.getAction());

        uploadableFiles = intent.getParcelableArrayListExtra(EXTRA_FILES);
        Timber.i("Received multiple upload %s", uploadableFiles.size());

        place = intent.getParcelableExtra(PLACE_OBJECT);
        resetDirectPrefs();
    }

    public void resetDirectPrefs() {
        directKvStore.remove(PLACE_OBJECT);
    }

    /**
     * Handle null URI from the received intent.
     * Current implementation will simply show a toast and finish the upload activity.
     */
    private void handleNullMedia() {
        ViewUtil.showLongToast(this, R.string.error_processing_image);
        finish();
    }

    private void showInfoAlert(int titleStringID, int messageStringId, Runnable positive, String... formatArgs) {
        new AlertDialog.Builder(this)
                .setTitle(titleStringID)
                .setMessage(getString(messageStringId, (Object[]) formatArgs))
                .setCancelable(true)
                .setPositiveButton(android.R.string.ok, (dialog, id) -> {
                    positive.run();
                    dialog.cancel();
                })
                .create()
                .show();
    }

    @Override
    public void onNextButtonClicked(int index) {
        if (index < fragments.size() - 1) {
            vpUpload.setCurrentItem(index + 1, false);
            fragments.get(index + 1).onBecameVisible();
        } else {
            presenter.handleSubmit();
        }
    }

    @Override
    public void onPreviousButtonClicked(int index) {
        if (index != 0) {
            vpUpload.setCurrentItem(index - 1, true);
            fragments.get(index - 1).onBecameVisible();
        }
    }

    /**
     * The adapter used to show image upload intermediate fragments
     */

    private class UploadImageAdapter extends FragmentStatePagerAdapter {
        List<UploadBaseFragment> fragments;

        public UploadImageAdapter(FragmentManager fragmentManager) {
            super(fragmentManager);
            this.fragments = new ArrayList<>();
        }

        public void setFragments(List<UploadBaseFragment> fragments) {
            this.fragments = fragments;
            notifyDataSetChanged();
        }

        @Override
        public Fragment getItem(int position) {
            return fragments.get(position);
        }

        @Override
        public int getCount() {
            return fragments.size();
        }

        @Override
        public int getItemPosition(Object object) {
            return PagerAdapter.POSITION_NONE;
        }
    }

    @OnClick(R.id.rl_container_title)
    public void onRlContainerTitleClicked() {
        rvThumbnails.setVisibility(isTitleExpanded ? View.GONE : View.VISIBLE);
        isTitleExpanded = !isTitleExpanded;
        ibToggleTopCard.setRotation(ibToggleTopCard.getRotation() + 180);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.onDetachView();
        compositeDisposable.clear();
        if (mediaLicenseFragment != null) {
            mediaLicenseFragment.setCallback(null);
        }
        if (uploadCategoriesFragment != null) {
            uploadCategoriesFragment.setCallback(null);
        }
    }
}


text:
Hello {{username}}, thanks for your review!

As part of our reviewer loyalty program, you have recieved a discount code.

Your code is {{code}}

This code is worth {{discount}}% off your next order with us.

Thanks again!

Store Team


text:
class GPS
{
public:

    /// Update GPS state based on possible bytes received from the module.
    ///
    /// This routine must be called periodically to process incoming data.
    ///
    /// GPS drivers should not override this function; they should implement
    /// ::read instead.
    ///
    void                        update(void);

    /// GPS status codes
    ///
    /// \note Non-intuitive ordering for legacy reasons
    ///
    enum GPS_Status {
        NO_GPS = 0,             ///< No GPS connected/detected
        NO_FIX = 1,             ///< Receiving valid GPS messages but no lock
        GPS_OK = 2              ///< Receiving valid messages and locked
    };

    // GPS navigation engine settings. Not all GPS receivers support
    // this
    enum GPS_Engine_Setting {
        GPS_ENGINE_NONE        = -1,
        GPS_ENGINE_PORTABLE    = 0,
        GPS_ENGINE_STATIONARY  = 2,
        GPS_ENGINE_PEDESTRIAN  = 3,
        GPS_ENGINE_AUTOMOTIVE  = 4,
        GPS_ENGINE_SEA         = 5,
        GPS_ENGINE_AIRBORNE_1G = 6,
        GPS_ENGINE_AIRBORNE_2G = 7,
        GPS_ENGINE_AIRBORNE_4G = 8
    };

    /// Query GPS status
    ///
    /// The 'valid message' status indicates that a recognised message was
    /// received from the GPS within the last 500ms.
    ///
    /// @returns			Current GPS status
    ///
    GPS_Status          status(void) {
        return _status;
    }

    /// GPS time epoch codes
    ///
    enum        GPS_Time_Epoch {
        TIME_OF_DAY     = 0,            ///<
        TIME_OF_WEEK    = 1,            ///< Ublox
        TIME_OF_YEAR    = 2,            ///< MTK, NMEA
        UNIX_EPOCH              = 3                     ///< If available
    };                                                                  ///< SIFR?

    /// Query GPS time epoch
    ///
    /// @returns			Current GPS time epoch code
    ///
    GPS_Time_Epoch              epoch(void) {
        return _epoch;
    }

    /// Startup initialisation.
    ///
    /// This routine performs any one-off initialisation required to set the
    /// GPS up for use.
    ///
    /// Must be implemented by the GPS driver.
    ///
    virtual void        init(enum GPS_Engine_Setting engine_setting = GPS_ENGINE_NONE) = 0;

    // Properties
    uint32_t time;                      ///< GPS time (milliseconds from epoch)
    uint32_t date;                      ///< GPS date (FORMAT TBD)
    int32_t latitude;                   ///< latitude in degrees * 10,000,000
    int32_t longitude;                  ///< longitude in degrees * 10,000,000
    int32_t altitude;                   ///< altitude in cm
    uint32_t ground_speed;      ///< ground speed in cm/sec
    int32_t ground_course;      ///< ground course in 100ths of a degree
    int32_t speed_3d;                   ///< 3D speed in cm/sec (not always available)
    int16_t hdop;                       ///< horizontal dilution of precision in cm
    uint8_t num_sats;           ///< Number of visible satelites

    /// Set to true when new data arrives.  A client may set this
    /// to false in order to avoid processing data they have
    /// already seen.
    bool new_data;

    // Deprecated properties
    bool fix;                           ///< true if we have a position fix (use ::status instead)
    bool valid_read;                    ///< true if we have seen data from the GPS (use ::status instead)

    // Debug support
    bool print_errors;          ///< deprecated

    // HIL support
    virtual void setHIL(uint32_t time, float latitude, float longitude, float altitude,
                        float ground_speed, float ground_course, float speed_3d, uint8_t num_sats);

    /// Time in milliseconds after which we will assume the GPS is no longer
    /// sending us updates and attempt a re-init.
    ///
    /// 1200ms allows a small amount of slack over the worst-case 1Hz update
    /// rate.
    ///
    uint32_t idleTimeout;

    // components of velocity in 2D, in m/s
    float velocity_north(void) {
        return _status == GPS_OK ? _velocity_north : 0;
    }
    float velocity_east(void)  {
        return _status == GPS_OK ? _velocity_east  : 0;
    }
    float velocity_down(void)  {
        return _status == GPS_OK ? _velocity_down  : 0;
    }

    // last ground speed in m/s. This can be used when we have no GPS
    // lock to return the last ground speed we had with lock
    float last_ground_speed(void) {
        return _last_ground_speed_cm * 0.01;
    }

    // the expected lag (in seconds) in the position and velocity readings from the gps
    virtual float get_lag() { return 1.0; }

    // the time we got our last fix in system milliseconds
    uint32_t last_fix_time;

	// return true if the GPS supports raw velocity values

protected:
    Stream      *_port;                 ///< port the GPS is attached to

    /// Constructor
    ///
    /// @note The stream is expected to be set up and configured for the
    ///       correct bitrate before ::init is called.
    ///
    /// @param	s	Stream connected to the GPS module.
    ///
    GPS(Stream *s) : _port(s) {
    };

    /// read from the GPS stream and update properties
    ///
    /// Must be implemented by the GPS driver.
    ///
    /// @returns			true if a valid message was received from the GPS
    ///
    virtual bool        read(void) = 0;

    /// perform an endian swap on a long
    ///
    /// @param	bytes		pointer to a buffer containing bytes representing a
    ///						long in the wrong byte order
    /// @returns			endian-swapped value
    ///
    int32_t                             _swapl(const void *bytes);

    /// perform an endian swap on an int
    ///
    /// @param	bytes		pointer to a buffer containing bytes representing an
    ///						int in the wrong byte order
    ///	@returns			endian-swapped value
    int16_t                             _swapi(const void *bytes);

    /// emit an error message
    ///
    /// based on the value of print_errors, emits the printf-formatted message
    /// in msg,... to stderr
    ///
    /// @param	fmt			printf-like format string
    ///
    /// @note deprecated as-is due to the difficulty of hooking up to a working
    ///       printf vs. the potential benefits
    ///
    void                        _error(const char *msg);

    /// Time epoch code for the gps in use
    GPS_Time_Epoch _epoch;

    enum GPS_Engine_Setting _nav_setting;

    void _write_progstr_block(Stream *_fs, const prog_char *pstr, uint8_t size);
    void _send_progstr(Stream *_fs, const prog_char *pstr, uint8_t size);
    void _update_progstr(void);

    // velocities in cm/s if available from the GPS
    int32_t _vel_north;
    int32_t _vel_east;
    int32_t _vel_down;

    // does this GPS support raw velocity numbers?
    bool _have_raw_velocity;

private:

    /// Last time that the GPS driver got a good packet from the GPS
    ///
    uint32_t _idleTimer;

    /// Our current status
    GPS_Status _status;

    // previous ground speed in cm/s
    uint32_t _last_ground_speed_cm;

    // components of the velocity, in m/s
    float _velocity_north;
    float _velocity_east;
    float _velocity_down;
};

inline int32_t
GPS::_swapl(const void *bytes)
{
    const uint8_t       *b = (const uint8_t *)bytes;
    union {
        int32_t v;
        uint8_t b[4];
    } u;

    u.b[0] = b[3];
    u.b[1] = b[2];
    u.b[2] = b[1];
    u.b[3] = b[0];

    return(u.v);
}

inline int16_t
GPS::_swapi(const void *bytes)
{
    const uint8_t       *b = (const uint8_t *)bytes;
    union {
        int16_t v;
        uint8_t b[2];
    } u;

    u.b[0] = b[1];
    u.b[1] = b[0];

    return(u.v);
}

#endif


text:
using System.Data.Entity;
using System.Reflection;

namespace App.Database.Extensions
{
    internal static class DbContextExtensions
    {
        public static void DisableDatabaseInitialization(this DbContext dbContext)
        {
            var databaseType = typeof(System.Data.Entity.Database);
            var setInitializer = databaseType.GetMethod("SetInitializer", BindingFlags.Static | BindingFlags.Public);
            var type = dbContext.GetType();
            var setInitializerT = setInitializer.MakeGenericMethod(type);

            setInitializerT.Invoke(null, new object[] { null });
        }
    }
}


text:
<?php

namespace Doctrine\Tests\ORM\Functional\Ticket;

use DateTime;

require_once __DIR__ . '/../../../TestInit.php';

/**
 * @group DDC-618
 */
class DDC618Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
    protected function setUp()
    {
        parent::setUp();
        try {
            $this->_schemaTool->createSchema(array(
                $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC618Author'),
                $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC618Book')
            ));

            // Create author 10/Joe with two books 22/JoeA and 20/JoeB
            $author = new DDC618Author();
            $author->id = 10;
            $author->name = 'Joe';
            $this->_em->persist($author);

            // Create author 11/Alice with two books 21/AliceA and 23/AliceB
            $author = new DDC618Author();
            $author->id = 11;
            $author->name = 'Alice';
            $author->addBook('In Wonderland');
            $author->addBook('Reloaded');
            $author->addBook('Test');

            $this->_em->persist($author);

            $this->_em->flush();
            $this->_em->clear();
        } catch(\Exception $e) {

        }
    }

    public function testIndexByHydrateObject()
    {
        $dql = 'SELECT A FROM Doctrine\Tests\ORM\Functional\Ticket\DDC618Author A INDEX BY A.name ORDER BY A.name ASC';
        $result = $this->_em->createQuery($dql)->getResult(\Doctrine\ORM\Query::HYDRATE_OBJECT);

        $joe    = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC618Author', 10);
        $alice  = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC618Author', 11);

        $this->assertArrayHasKey('Joe', $result, "INDEX BY A.name should return an index by the name of 'Joe'.");
        $this->assertArrayHasKey('Alice', $result, "INDEX BY A.name should return an index by the name of 'Alice'.");
    }

    public function testIndexByHydrateArray()
    {
        $dql = 'SELECT A FROM Doctrine\Tests\ORM\Functional\Ticket\DDC618Author A INDEX BY A.name ORDER BY A.name ASC';
        $result = $this->_em->createQuery($dql)->getResult(\Doctrine\ORM\Query::HYDRATE_ARRAY);

        $joe    = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC618Author', 10);
        $alice  = $this->_em->find('Doctrine\Tests\ORM\Functional\Ticket\DDC618Author', 11);

        $this->assertArrayHasKey('Joe', $result, "INDEX BY A.name should return an index by the name of 'Joe'.");
        $this->assertArrayHasKey('Alice', $result, "INDEX BY A.name should return an index by the name of 'Alice'.");
    }

    /**
     * @group DDC-1018
     */
    public function testIndexByJoin()
    {
        $dql = 'SELECT A, B FROM Doctrine\Tests\ORM\Functional\Ticket\DDC618Author A '.
               'INNER JOIN A.books B INDEX BY B.title ORDER BY A.name ASC';
        $result = $this->_em->createQuery($dql)->getResult(\Doctrine\ORM\Query::HYDRATE_OBJECT);

        $this->assertEquals(3, count($result[0]->books)); // Alice, Joe doesnt appear because he has no books.
        $this->assertEquals('Alice', $result[0]->name);
        $this->assertTrue( isset($result[0]->books["In Wonderland"] ), "Indexing by title should have books by title.");
        $this->assertTrue( isset($result[0]->books["Reloaded"] ), "Indexing by title should have books by title.");
        $this->assertTrue( isset($result[0]->books["Test"] ), "Indexing by title should have books by title.");

        $result = $this->_em->createQuery($dql)->getResult(\Doctrine\ORM\Query::HYDRATE_ARRAY);

        $this->assertEquals(3, count($result[0]['books'])); // Alice, Joe doesnt appear because he has no books.
        $this->assertEquals('Alice', $result[0]['name']);
        $this->assertTrue( isset($result[0]['books']["In Wonderland"] ), "Indexing by title should have books by title.");
        $this->assertTrue( isset($result[0]['books']["Reloaded"] ), "Indexing by title should have books by title.");
        $this->assertTrue( isset($result[0]['books']["Test"] ), "Indexing by title should have books by title.");
    }

    /**
     * @group DDC-1018
     */
    public function testIndexByToOneJoinSilentlyIgnored()
    {
        $dql = 'SELECT B, A FROM Doctrine\Tests\ORM\Functional\Ticket\DDC618Book B '.
               'INNER JOIN B.author A INDEX BY A.name ORDER BY A.name ASC';
        $result = $this->_em->createQuery($dql)->getResult(\Doctrine\ORM\Query::HYDRATE_OBJECT);

        $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC618Book', $result[0]);
        $this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Ticket\DDC618Author', $result[0]->author);

        $dql = 'SELECT B, A FROM Doctrine\Tests\ORM\Functional\Ticket\DDC618Book B '.
               'INNER JOIN B.author A INDEX BY A.name ORDER BY A.name ASC';
        $result = $this->_em->createQuery($dql)->getResult(\Doctrine\ORM\Query::HYDRATE_ARRAY);

        $this->assertEquals("Alice", $result[0]['author']['name']);
    }

    /**
     * @group DDC-1018
     */
    public function testCombineIndexBy()
    {
        $dql = 'SELECT A, B FROM Doctrine\Tests\ORM\Functional\Ticket\DDC618Author A INDEX BY A.id '.
               'INNER JOIN A.books B INDEX BY B.title ORDER BY A.name ASC';
        $result = $this->_em->createQuery($dql)->getResult(\Doctrine\ORM\Query::HYDRATE_OBJECT);

        $this->assertArrayHasKey(11, $result); // Alice

        $this->assertEquals(3, count($result[11]->books)); // Alice, Joe doesnt appear because he has no books.
        $this->assertEquals('Alice', $result[11]->name);
        $this->assertTrue( isset($result[11]->books["In Wonderland"] ), "Indexing by title should have books by title.");
        $this->assertTrue( isset($result[11]->books["Reloaded"] ), "Indexing by title should have books by title.");
        $this->assertTrue( isset($result[11]->books["Test"] ), "Indexing by title should have books by title.");
    }
}

/**
 * @Entity
 */
class DDC618Author
{
    /**
     * @Id
     * @Column(type="integer")
     */
    public $id;

    /** @Column(type="string") */
    public $name;

    /**
     * @OneToMany(targetEntity="DDC618Book", mappedBy="author", cascade={"persist"})
     */
    public $books;

    public function __construct()
    {
        $this->books = new \Doctrine\Common\Collections\ArrayCollection;
    }

    public function addBook($title)
    {
        $book = new DDC618Book($title, $this);
        $this->books[] = $book;
    }
}

/**
 * @Entity
 */
class DDC618Book
{
    /**
     * @Id @GeneratedValue
     * @Column(type="integer")
     */
    public $id;

    /** @column(type="string") */
    public $title;

    /** @ManyToOne(targetEntity="DDC618Author", inversedBy="books") */
    public $author;

    function __construct($title, $author)
    {
        $this->title = $title;
        $this->author = $author;
    }
}


text:
<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>shared-components edookit</title>


text:
singleton ShaderData( PFX_FlashShader )
{
   DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
   DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/flashP.hlsl";

   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
   OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/flashP.glsl";

   samplerNames[0] = "$backBuffer";

   defines = "WHITE_COLOR=float4(1.0,1.0,1.0,0.0);MUL_COLOR=float4(1.0,0.25,0.25,0.0)";

   pixVersion = 2.0;
};

singleton PostEffect( FlashFx )
{
   isEnabled = false;
   allowReflectPass = false;

   renderTime = "PFXAfterDiffuse";

   shader = PFX_FlashShader;
   texture[0] = "$backBuffer";
   renderPriority = 10;
   stateBlock = PFX_DefaultStateBlock;
};

function FlashFx::setShaderConsts( %this )
{
   if ( isObject( ServerConnection ) )
   {
      %this.setShaderConst( "$damageFlash", ServerConnection.getDamageFlash() );
      %this.setShaderConst( "$whiteOut", ServerConnection.getWhiteOut() );
   }
   else
   {
      %this.setShaderConst( "$damageFlash", 0 );
      %this.setShaderConst( "$whiteOut", 0 );
   }
}


text:
export function triggerHTMLEvents (target, event, process) {
  const e = document.createEvent('HTMLEvents')
  e.initEvent(event, true, true)
  if (process) process(e)
  target.dispatchEvent(e)
  return e
}
export function triggerMouseEvents (target, event, process) {
  const e = document.createEvent('MouseEvents')
  e.initEvent(event, true, true)
  if (process) process(e)
  target.dispatchEvent(e)
  return e
}


text:
FOUNDATION_EXPORT double WMATAFetcheriOSVersionNumber;

//! Project version string for WMATAFetcheriOS.
FOUNDATION_EXPORT const unsigned char WMATAFetcheriOSVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <WMATAFetcheriOS/PublicHeader.h>


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Neues Mag. Bot. 1: 83 (1794)

#### Original name
Sphaeria spinosa Pers., 1794

### Remarks
null


text:
PONY_EXTERN_C_BEGIN

DECLARE_LIST(strlist, const char);

void stringtab_init();
const char* stringtab(const char* string);
const char* stringtab_len(const char* string, size_t len);

// Must be called with a string allocated by pool_alloc_size, which the
// function takes control of. The function is responsible for freeing this
// string and it must not be accessed again after the call returns.
const char* stringtab_consume(const char* string, size_t buf_size);

void stringtab_done();

PONY_EXTERN_C_END

#endif