text:
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package alluxio.thrift;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
public class TAcl implements org.apache.thrift.TBase<TAcl, TAcl._Fields>, java.io.Serializable, Cloneable, Comparable<TAcl> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAcl");

  private static final org.apache.thrift.protocol.TField OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField OWNING_GROUP_FIELD_DESC = new org.apache.thrift.protocol.TField("owningGroup", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField ENTRIES_FIELD_DESC = new org.apache.thrift.protocol.TField("entries", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField MODE_FIELD_DESC = new org.apache.thrift.protocol.TField("mode", org.apache.thrift.protocol.TType.I16, (short)4);
  private static final org.apache.thrift.protocol.TField IS_DEFAULT_FIELD_DESC = new org.apache.thrift.protocol.TField("isDefault", org.apache.thrift.protocol.TType.BOOL, (short)5);
  private static final org.apache.thrift.protocol.TField IS_DEFAULT_EMPTY_FIELD_DESC = new org.apache.thrift.protocol.TField("isDefaultEmpty", org.apache.thrift.protocol.TType.BOOL, (short)6);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new TAclStandardSchemeFactory());
    schemes.put(TupleScheme.class, new TAclTupleSchemeFactory());
  }

  private String owner; // optional
  private String owningGroup; // optional
  private List<TAclEntry> entries; // optional
  private short mode; // optional
  private boolean isDefault; // optional
  private boolean isDefaultEmpty; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    OWNER((short)1, "owner"),
    OWNING_GROUP((short)2, "owningGroup"),
    ENTRIES((short)3, "entries"),
    MODE((short)4, "mode"),
    IS_DEFAULT((short)5, "isDefault"),
    IS_DEFAULT_EMPTY((short)6, "isDefaultEmpty");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // OWNER
          return OWNER;
        case 2: // OWNING_GROUP
          return OWNING_GROUP;
        case 3: // ENTRIES
          return ENTRIES;
        case 4: // MODE
          return MODE;
        case 5: // IS_DEFAULT
          return IS_DEFAULT;
        case 6: // IS_DEFAULT_EMPTY
          return IS_DEFAULT_EMPTY;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __MODE_ISSET_ID = 0;
  private static final int __ISDEFAULT_ISSET_ID = 1;
  private static final int __ISDEFAULTEMPTY_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.OWNER,_Fields.OWNING_GROUP,_Fields.ENTRIES,_Fields.MODE,_Fields.IS_DEFAULT,_Fields.IS_DEFAULT_EMPTY};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.OWNER, new org.apache.thrift.meta_data.FieldMetaData("owner", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.OWNING_GROUP, new org.apache.thrift.meta_data.FieldMetaData("owningGroup", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ENTRIES, new org.apache.thrift.meta_data.FieldMetaData("entries", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TAclEntry.class))));
    tmpMap.put(_Fields.MODE, new org.apache.thrift.meta_data.FieldMetaData("mode", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.IS_DEFAULT, new org.apache.thrift.meta_data.FieldMetaData("isDefault", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.IS_DEFAULT_EMPTY, new org.apache.thrift.meta_data.FieldMetaData("isDefaultEmpty", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAcl.class, metaDataMap);
  }

  public TAcl() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TAcl(TAcl other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetOwner()) {
      this.owner = other.owner;
    }
    if (other.isSetOwningGroup()) {
      this.owningGroup = other.owningGroup;
    }
    if (other.isSetEntries()) {
      List<TAclEntry> __this__entries = new ArrayList<TAclEntry>(other.entries.size());
      for (TAclEntry other_element : other.entries) {
        __this__entries.add(new TAclEntry(other_element));
      }
      this.entries = __this__entries;
    }
    this.mode = other.mode;
    this.isDefault = other.isDefault;
    this.isDefaultEmpty = other.isDefaultEmpty;
  }

  public TAcl deepCopy() {
    return new TAcl(this);
  }

  @Override
  public void clear() {
    this.owner = null;
    this.owningGroup = null;
    this.entries = null;
    setModeIsSet(false);
    this.mode = 0;
    setIsDefaultIsSet(false);
    this.isDefault = false;
    setIsDefaultEmptyIsSet(false);
    this.isDefaultEmpty = false;
  }

  public String getOwner() {
    return this.owner;
  }

  public TAcl setOwner(String owner) {
    this.owner = owner;
    return this;
  }

  public void unsetOwner() {
    this.owner = null;
  }

  /** Returns true if field owner is set (has been assigned a value) and false otherwise */
  public boolean isSetOwner() {
    return this.owner != null;
  }

  public void setOwnerIsSet(boolean value) {
    if (!value) {
      this.owner = null;
    }
  }

  public String getOwningGroup() {
    return this.owningGroup;
  }

  public TAcl setOwningGroup(String owningGroup) {
    this.owningGroup = owningGroup;
    return this;
  }

  public void unsetOwningGroup() {
    this.owningGroup = null;
  }

  /** Returns true if field owningGroup is set (has been assigned a value) and false otherwise */
  public boolean isSetOwningGroup() {
    return this.owningGroup != null;
  }

  public void setOwningGroupIsSet(boolean value) {
    if (!value) {
      this.owningGroup = null;
    }
  }

  public int getEntriesSize() {
    return (this.entries == null) ? 0 : this.entries.size();
  }

  public java.util.Iterator<TAclEntry> getEntriesIterator() {
    return (this.entries == null) ? null : this.entries.iterator();
  }

  public void addToEntries(TAclEntry elem) {
    if (this.entries == null) {
      this.entries = new ArrayList<TAclEntry>();
    }
    this.entries.add(elem);
  }

  public List<TAclEntry> getEntries() {
    return this.entries;
  }

  public TAcl setEntries(List<TAclEntry> entries) {
    this.entries = entries;
    return this;
  }

  public void unsetEntries() {
    this.entries = null;
  }

  /** Returns true if field entries is set (has been assigned a value) and false otherwise */
  public boolean isSetEntries() {
    return this.entries != null;
  }

  public void setEntriesIsSet(boolean value) {
    if (!value) {
      this.entries = null;
    }
  }

  public short getMode() {
    return this.mode;
  }

  public TAcl setMode(short mode) {
    this.mode = mode;
    setModeIsSet(true);
    return this;
  }

  public void unsetMode() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MODE_ISSET_ID);
  }

  /** Returns true if field mode is set (has been assigned a value) and false otherwise */
  public boolean isSetMode() {
    return EncodingUtils.testBit(__isset_bitfield, __MODE_ISSET_ID);
  }

  public void setModeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MODE_ISSET_ID, value);
  }

  public boolean isIsDefault() {
    return this.isDefault;
  }

  public TAcl setIsDefault(boolean isDefault) {
    this.isDefault = isDefault;
    setIsDefaultIsSet(true);
    return this;
  }

  public void unsetIsDefault() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISDEFAULT_ISSET_ID);
  }

  /** Returns true if field isDefault is set (has been assigned a value) and false otherwise */
  public boolean isSetIsDefault() {
    return EncodingUtils.testBit(__isset_bitfield, __ISDEFAULT_ISSET_ID);
  }

  public void setIsDefaultIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISDEFAULT_ISSET_ID, value);
  }

  public boolean isIsDefaultEmpty() {
    return this.isDefaultEmpty;
  }

  public TAcl setIsDefaultEmpty(boolean isDefaultEmpty) {
    this.isDefaultEmpty = isDefaultEmpty;
    setIsDefaultEmptyIsSet(true);
    return this;
  }

  public void unsetIsDefaultEmpty() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISDEFAULTEMPTY_ISSET_ID);
  }

  /** Returns true if field isDefaultEmpty is set (has been assigned a value) and false otherwise */
  public boolean isSetIsDefaultEmpty() {
    return EncodingUtils.testBit(__isset_bitfield, __ISDEFAULTEMPTY_ISSET_ID);
  }

  public void setIsDefaultEmptyIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISDEFAULTEMPTY_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case OWNER:
      if (value == null) {
        unsetOwner();
      } else {
        setOwner((String)value);
      }
      break;

    case OWNING_GROUP:
      if (value == null) {
        unsetOwningGroup();
      } else {
        setOwningGroup((String)value);
      }
      break;

    case ENTRIES:
      if (value == null) {
        unsetEntries();
      } else {
        setEntries((List<TAclEntry>)value);
      }
      break;

    case MODE:
      if (value == null) {
        unsetMode();
      } else {
        setMode((Short)value);
      }
      break;

    case IS_DEFAULT:
      if (value == null) {
        unsetIsDefault();
      } else {
        setIsDefault((Boolean)value);
      }
      break;

    case IS_DEFAULT_EMPTY:
      if (value == null) {
        unsetIsDefaultEmpty();
      } else {
        setIsDefaultEmpty((Boolean)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case OWNER:
      return getOwner();

    case OWNING_GROUP:
      return getOwningGroup();

    case ENTRIES:
      return getEntries();

    case MODE:
      return getMode();

    case IS_DEFAULT:
      return isIsDefault();

    case IS_DEFAULT_EMPTY:
      return isIsDefaultEmpty();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case OWNER:
      return isSetOwner();
    case OWNING_GROUP:
      return isSetOwningGroup();
    case ENTRIES:
      return isSetEntries();
    case MODE:
      return isSetMode();
    case IS_DEFAULT:
      return isSetIsDefault();
    case IS_DEFAULT_EMPTY:
      return isSetIsDefaultEmpty();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof TAcl)
      return this.equals((TAcl)that);
    return false;
  }

  public boolean equals(TAcl that) {
    if (that == null)
      return false;

    boolean this_present_owner = true && this.isSetOwner();
    boolean that_present_owner = true && that.isSetOwner();
    if (this_present_owner || that_present_owner) {
      if (!(this_present_owner && that_present_owner))
        return false;
      if (!this.owner.equals(that.owner))
        return false;
    }

    boolean this_present_owningGroup = true && this.isSetOwningGroup();
    boolean that_present_owningGroup = true && that.isSetOwningGroup();
    if (this_present_owningGroup || that_present_owningGroup) {
      if (!(this_present_owningGroup && that_present_owningGroup))
        return false;
      if (!this.owningGroup.equals(that.owningGroup))
        return false;
    }

    boolean this_present_entries = true && this.isSetEntries();
    boolean that_present_entries = true && that.isSetEntries();
    if (this_present_entries || that_present_entries) {
      if (!(this_present_entries && that_present_entries))
        return false;
      if (!this.entries.equals(that.entries))
        return false;
    }

    boolean this_present_mode = true && this.isSetMode();
    boolean that_present_mode = true && that.isSetMode();
    if (this_present_mode || that_present_mode) {
      if (!(this_present_mode && that_present_mode))
        return false;
      if (this.mode != that.mode)
        return false;
    }

    boolean this_present_isDefault = true && this.isSetIsDefault();
    boolean that_present_isDefault = true && that.isSetIsDefault();
    if (this_present_isDefault || that_present_isDefault) {
      if (!(this_present_isDefault && that_present_isDefault))
        return false;
      if (this.isDefault != that.isDefault)
        return false;
    }

    boolean this_present_isDefaultEmpty = true && this.isSetIsDefaultEmpty();
    boolean that_present_isDefaultEmpty = true && that.isSetIsDefaultEmpty();
    if (this_present_isDefaultEmpty || that_present_isDefaultEmpty) {
      if (!(this_present_isDefaultEmpty && that_present_isDefaultEmpty))
        return false;
      if (this.isDefaultEmpty != that.isDefaultEmpty)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List<Object> list = new ArrayList<Object>();

    boolean present_owner = true && (isSetOwner());
    list.add(present_owner);
    if (present_owner)
      list.add(owner);

    boolean present_owningGroup = true && (isSetOwningGroup());
    list.add(present_owningGroup);
    if (present_owningGroup)
      list.add(owningGroup);

    boolean present_entries = true && (isSetEntries());
    list.add(present_entries);
    if (present_entries)
      list.add(entries);

    boolean present_mode = true && (isSetMode());
    list.add(present_mode);
    if (present_mode)
      list.add(mode);

    boolean present_isDefault = true && (isSetIsDefault());
    list.add(present_isDefault);
    if (present_isDefault)
      list.add(isDefault);

    boolean present_isDefaultEmpty = true && (isSetIsDefaultEmpty());
    list.add(present_isDefaultEmpty);
    if (present_isDefaultEmpty)
      list.add(isDefaultEmpty);

    return list.hashCode();
  }

  @Override
  public int compareTo(TAcl other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetOwner()).compareTo(other.isSetOwner());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOwner()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owner, other.owner);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOwningGroup()).compareTo(other.isSetOwningGroup());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOwningGroup()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owningGroup, other.owningGroup);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEntries()).compareTo(other.isSetEntries());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEntries()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.entries, other.entries);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMode()).compareTo(other.isSetMode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMode()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mode, other.mode);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsDefault()).compareTo(other.isSetIsDefault());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsDefault()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isDefault, other.isDefault);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsDefaultEmpty()).compareTo(other.isSetIsDefaultEmpty());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsDefaultEmpty()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isDefaultEmpty, other.isDefaultEmpty);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("TAcl(");
    boolean first = true;

    if (isSetOwner()) {
      sb.append("owner:");
      if (this.owner == null) {
        sb.append("null");
      } else {
        sb.append(this.owner);
      }
      first = false;
    }
    if (isSetOwningGroup()) {
      if (!first) sb.append(", ");
      sb.append("owningGroup:");
      if (this.owningGroup == null) {
        sb.append("null");
      } else {
        sb.append(this.owningGroup);
      }
      first = false;
    }
    if (isSetEntries()) {
      if (!first) sb.append(", ");
      sb.append("entries:");
      if (this.entries == null) {
        sb.append("null");
      } else {
        sb.append(this.entries);
      }
      first = false;
    }
    if (isSetMode()) {
      if (!first) sb.append(", ");
      sb.append("mode:");
      sb.append(this.mode);
      first = false;
    }
    if (isSetIsDefault()) {
      if (!first) sb.append(", ");
      sb.append("isDefault:");
      sb.append(this.isDefault);
      first = false;
    }
    if (isSetIsDefaultEmpty()) {
      if (!first) sb.append(", ");
      sb.append("isDefaultEmpty:");
      sb.append(this.isDefaultEmpty);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TAclStandardSchemeFactory implements SchemeFactory {
    public TAclStandardScheme getScheme() {
      return new TAclStandardScheme();
    }
  }

  private static class TAclStandardScheme extends StandardScheme<TAcl> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TAcl struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // OWNER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.owner = iprot.readString();
              struct.setOwnerIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // OWNING_GROUP
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.owningGroup = iprot.readString();
              struct.setOwningGroupIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // ENTRIES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list32 = iprot.readListBegin();
                struct.entries = new ArrayList<TAclEntry>(_list32.size);
                TAclEntry _elem33;
                for (int _i34 = 0; _i34 < _list32.size; ++_i34)
                {
                  _elem33 = new TAclEntry();
                  _elem33.read(iprot);
                  struct.entries.add(_elem33);
                }
                iprot.readListEnd();
              }
              struct.setEntriesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // MODE
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.mode = iprot.readI16();
              struct.setModeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // IS_DEFAULT
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.isDefault = iprot.readBool();
              struct.setIsDefaultIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // IS_DEFAULT_EMPTY
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.isDefaultEmpty = iprot.readBool();
              struct.setIsDefaultEmptyIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TAcl struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.owner != null) {
        if (struct.isSetOwner()) {
          oprot.writeFieldBegin(OWNER_FIELD_DESC);
          oprot.writeString(struct.owner);
          oprot.writeFieldEnd();
        }
      }
      if (struct.owningGroup != null) {
        if (struct.isSetOwningGroup()) {
          oprot.writeFieldBegin(OWNING_GROUP_FIELD_DESC);
          oprot.writeString(struct.owningGroup);
          oprot.writeFieldEnd();
        }
      }
      if (struct.entries != null) {
        if (struct.isSetEntries()) {
          oprot.writeFieldBegin(ENTRIES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.entries.size()));
            for (TAclEntry _iter35 : struct.entries)
            {
              _iter35.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetMode()) {
        oprot.writeFieldBegin(MODE_FIELD_DESC);
        oprot.writeI16(struct.mode);
        oprot.writeFieldEnd();
      }
      if (struct.isSetIsDefault()) {
        oprot.writeFieldBegin(IS_DEFAULT_FIELD_DESC);
        oprot.writeBool(struct.isDefault);
        oprot.writeFieldEnd();
      }
      if (struct.isSetIsDefaultEmpty()) {
        oprot.writeFieldBegin(IS_DEFAULT_EMPTY_FIELD_DESC);
        oprot.writeBool(struct.isDefaultEmpty);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TAclTupleSchemeFactory implements SchemeFactory {
    public TAclTupleScheme getScheme() {
      return new TAclTupleScheme();
    }
  }

  private static class TAclTupleScheme extends TupleScheme<TAcl> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TAcl struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetOwner()) {
        optionals.set(0);
      }
      if (struct.isSetOwningGroup()) {
        optionals.set(1);
      }
      if (struct.isSetEntries()) {
        optionals.set(2);
      }
      if (struct.isSetMode()) {
        optionals.set(3);
      }
      if (struct.isSetIsDefault()) {
        optionals.set(4);
      }
      if (struct.isSetIsDefaultEmpty()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetOwner()) {
        oprot.writeString(struct.owner);
      }
      if (struct.isSetOwningGroup()) {
        oprot.writeString(struct.owningGroup);
      }
      if (struct.isSetEntries()) {
        {
          oprot.writeI32(struct.entries.size());
          for (TAclEntry _iter36 : struct.entries)
          {
            _iter36.write(oprot);
          }
        }
      }
      if (struct.isSetMode()) {
        oprot.writeI16(struct.mode);
      }
      if (struct.isSetIsDefault()) {
        oprot.writeBool(struct.isDefault);
      }
      if (struct.isSetIsDefaultEmpty()) {
        oprot.writeBool(struct.isDefaultEmpty);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TAcl struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.owner = iprot.readString();
        struct.setOwnerIsSet(true);
      }
      if (incoming.get(1)) {
        struct.owningGroup = iprot.readString();
        struct.setOwningGroupIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.entries = new ArrayList<TAclEntry>(_list37.size);
          TAclEntry _elem38;
          for (int _i39 = 0; _i39 < _list37.size; ++_i39)
          {
            _elem38 = new TAclEntry();
            _elem38.read(iprot);
            struct.entries.add(_elem38);
          }
        }
        struct.setEntriesIsSet(true);
      }
      if (incoming.get(3)) {
        struct.mode = iprot.readI16();
        struct.setModeIsSet(true);
      }
      if (incoming.get(4)) {
        struct.isDefault = iprot.readBool();
        struct.setIsDefaultIsSet(true);
      }
      if (incoming.get(5)) {
        struct.isDefaultEmpty = iprot.readBool();
        struct.setIsDefaultEmptyIsSet(true);
      }
    }
  }

}


text:
title: First Elixir Open Source Contribution
---

Today my first open source contribution
to an [Elixir](http://elixir-lang.org) project was released!
[Tentacat](https://github.com/edgurgel/tentacat), a library for interacting with
the [GitHub](https://github.com) REST API now supports [requesting the latest
release for a
repository](https://github.com/edgurgel/tentacat/releases/tag/v0.6.0).

I learned a number of things in the process, including translating techniques for
testable API interactions for verifying clients. In short `exvcr` is a library
patterned after the VCR rubygem allowing recording and replaying of API
interactions for the purpose of testing. API replay has its issues around not
catching API contract changes, but it is a nice way for a library maintainer to
begin to verify contract adherence coupled with a stable API or further
integration testing.

redpajama_set_name: RedPajamaGithub


text:
package ubic.gemma.web.services;

import org.apache.commons.lang3.time.StopWatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import ubic.gemma.core.analysis.expression.coexpression.CoexpressionMetaValueObject;
import ubic.gemma.core.analysis.expression.coexpression.CoexpressionValueObjectExt;
import ubic.gemma.core.analysis.expression.coexpression.GeneCoexpressionSearchService;
import ubic.gemma.core.genome.gene.service.GeneService;
import ubic.gemma.model.analysis.expression.ExpressionExperimentSet;
import ubic.gemma.model.expression.experiment.BioAssaySet;
import ubic.gemma.model.genome.Gene;
import ubic.gemma.persistence.service.expression.experiment.ExpressionExperimentSetService;
import ubic.gemma.persistence.util.EntityUtils;
import ubic.gemma.persistence.util.Settings;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;

public class GeneCoexpressionSearchEndpoint extends AbstractGemmaEndpoint {

    /**
     * The local name of the expected request/response.
     */
    public static final String LOCAL_NAME = "geneCoexpressionSearch";
    /**
     * The maximum number of coexpression results to return per input gene; a value of zero will return all possible
     * results (ie. max is infinity). We limit this to avoid results sets from blowing up ridiculously.
     */
    public static final int MAX_RESULTS = 100;
    private static Log log = LogFactory.getLog( GeneCoexpressionSearchEndpoint.class );
    private GeneService geneService;
    private GeneCoexpressionSearchService geneCoexpressionSearchService;
    private ExpressionExperimentSetService expressionExperimentSetService;

    public void setExpressionExperimentSetService( ExpressionExperimentSetService service ) {
        expressionExperimentSetService = service;
    }

    public void setGeneCoexpressionSearchService( GeneCoexpressionSearchService geneCoexpressionSearchService ) {
        this.geneCoexpressionSearchService = geneCoexpressionSearchService;
    }

    public void setGeneService( GeneService geneService ) {
        this.geneService = geneService;
    }

    /**
     * Reads the given requestElement, and sends a the response back.
     *
     * @param requestElement the contents of the SOAP message as DOM elements
     * @param document       a DOM document to be used for constructing Nodes
     * @return the response element
     */
    @Override
    protected Element invokeInternal( Element requestElement, Document document ) {

        try {
            StopWatch watch = new StopWatch();
            watch.start();
            setLocalName( LOCAL_NAME );

            String queryGeneId = getNodeValue( requestElement, "query_gene_id" );
            String pairQueryGeneId = getOptionalNodeValue( requestElement, "pair_query_gene_id" );
            String stringency = getNodeValue( requestElement, "stringency" );

            Collection<Gene> queryGenes = new LinkedList<>();
            Gene queryGene = geneService.findByNCBIId( Integer.parseInt( queryGeneId ) );
            if ( queryGene == null ) {
                String msg = "Query gene with id [" + queryGeneId + "] cannot be found.";
                return buildBadResponse( document, msg );
            }
            queryGenes.add( queryGene );

            if ( pairQueryGeneId != null ) {
                Gene queryGene2 = geneService.findByNCBIId( Integer.parseInt( pairQueryGeneId ) );
                if ( queryGene2 == null ) {
                    String msg = "Query gene with id [" + pairQueryGeneId + "] cannot be found.";
                    return buildBadResponse( document, msg );
                }

                queryGenes.add( queryGene2 );
            }

            Collection<ExpressionExperimentSet> eeSets = expressionExperimentSetService.findByName( "All mouse" );
            // .load(5662l); // uses 'All mouse' by default.
            ExpressionExperimentSet eeSet = eeSets.iterator().next();
            Collection<BioAssaySet> experiments = eeSet.getExperiments();
            Collection<Long> inputEeIds = new ArrayList<>();
            for ( BioAssaySet e : experiments ) {
                inputEeIds.add( e.getId() );
            }

            CoexpressionMetaValueObject metaVO;
            if ( pairQueryGeneId == null ) {
                metaVO = geneCoexpressionSearchService.coexpressionSearch( inputEeIds, EntityUtils.getIds( queryGenes ),
                        Integer.valueOf( stringency ), MAX_RESULTS, false );
            } else {
                metaVO = geneCoexpressionSearchService.coexpressionSearch( inputEeIds, EntityUtils.getIds( queryGenes ),
                        Integer.valueOf( stringency ), MAX_RESULTS, true );
            }

            Collection<CoexpressionValueObjectExt> coexpressedGenes = metaVO.getResults();

            if ( coexpressedGenes.isEmpty() ) {
                String msg = "No coexpressed genes found.";
                return buildBadResponse( document, msg );
            }

            Element responseWrapper = document.createElementNS( NAMESPACE_URI, LOCAL_NAME );
            Element responseElement = document.createElementNS( NAMESPACE_URI, LOCAL_NAME + RESPONSE );
            responseWrapper.appendChild( responseElement );

            for ( CoexpressionValueObjectExt cvo : coexpressedGenes ) {
                Element item = document.createElement( "CoexpressionSearchResult" );

                Element foundGeneElement = document.createElement( "found_gene_id" );
                foundGeneElement.appendChild( document.createTextNode(
                        cvo.getFoundGene().getNcbiId() == null ? "" : cvo.getFoundGene().getNcbiId().toString() ) );
                item.appendChild( foundGeneElement );

                Element numExperimentsElement = document.createElement( "num_experiments_tested" );
                numExperimentsElement.appendChild( document.createTextNode( cvo.getNumTestedIn().toString() ) );
                item.appendChild( numExperimentsElement );

                Element numCoexpressedElement = document.createElement( "num_experiments_coexpressed" );
                numCoexpressedElement.appendChild(
                        document.createTextNode( String.valueOf( cvo.getSupportingExperiments().size() ) ) );
                item.appendChild( numCoexpressedElement );

                Element gemmaURL = document.createElement( "gemma_details_url" );
                gemmaURL.appendChild( document.createTextNode(
                        Settings.getBaseUrl() + "searchCoexpression.html?g=" + queryGene.getId() + "," + cvo
                                .getFoundGene().getId() + "&s=" + stringency + "&t=2&q&a=5662&an=All%20mouse" ) );
                item.appendChild( gemmaURL );

                responseElement.appendChild( item );
            }
            watch.stop();
            Long time = watch.getTime();

            if ( time > 1000 ) {
                log.info( "XML response for " + coexpressedGenes.size() + " results built in " + time + "ms." );
            }
            return responseWrapper;
        } catch ( Exception e ) {
            return buildBadResponse( document, e.getMessage() );
        }

    }

}


text:
from github import Github
from datetime import datetime
import os

TOKEN = os.environ['TOKEN']
REPO = os.environ['REPO']
WORKFLOW = os.environ['WORKFLOW']
FLAG_LABEL = os.environ['FLAG_LABEL']
RUN_NUMBER = os.environ['RUN_NUMBER']

def get_tagged_issues(repo, flag_label, workflow):
    issues = repo.get_issues(state='open', labels=[flag_label])
    tagged_issues =[]
    for issue in issues:
        if workflow in issue.body:
            tagged_issues.append(issue)
    return(tagged_issues)

def create_issue(repo, flag_label, workflow, run_number):
    body_string = f"{workflow} run number {run_number} failed.\n"
    body_string += "Please examine the run itself for details.\n\n"
    body_string += "This issue has been automatically generated for "
    body_string += "notification purposes."

    title_string = f"{workflow} Scheduled Run Failed"
    new_issue = repo.create_issue(title = title_string, body = body_string,
                                  labels=[flag_label])
    return(new_issue)

def add_comment(issue, run_number):
    dt_string = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
    msg_string = "Error reoccurred: " + dt_string
    msg_string += " run number: " + run_number
    issue.create_comment(msg_string)
    return()

if __name__ == "__main__":

    g = Github(TOKEN)
    repo = g.get_repo(REPO)
    tagged_issues = get_tagged_issues(repo, FLAG_LABEL, WORKFLOW)
    if not tagged_issues:
        create_issue(repo, FLAG_LABEL, WORKFLOW, RUN_NUMBER)
    else:
        for issue in tagged_issues:
            add_comment(issue, RUN_NUMBER)
    for issue in tagged_issues:
        print(issue.number)
        print(issue.closed_at)


text:
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2002, Eric D. Friedman All Rights Reserved.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
///////////////////////////////////////////////////////////////////////////////

package com.gemstone.gnu.trove;

import java.io.ObjectOutputStream;
import java.io.IOException;

/**
 * Implementation of the variously typed procedure interfaces that supports
 * writing the arguments to the procedure out on an ObjectOutputStream.
 * In the case of two-argument procedures, the arguments are written out
 * in the order received.
 *
 * <p>
 * Any IOException is trapped here so that it can be rethrown in a writeObject
 * method.
 * </p>
 *
 * Created: Sun Jul  7 00:14:18 2002
 *
 * @author Eric D. Friedman
 * @version $Id: SerializationProcedure.java,v 1.3 2002/07/08 23:54:13 ericdf Exp $
 */

class SerializationProcedure implements TDoubleDoubleProcedure,
    TDoubleFloatProcedure,
    TDoubleIntProcedure,
    TDoubleLongProcedure,
    TDoubleObjectProcedure,
    TDoubleProcedure,
    TFloatDoubleProcedure,
    TFloatFloatProcedure,
    TFloatIntProcedure,
    TFloatLongProcedure,
    TFloatObjectProcedure,
    TFloatProcedure,
    TIntDoubleProcedure,
    TIntFloatProcedure,
    TIntIntProcedure,
    TIntLongProcedure,
    TIntObjectProcedure,
    TIntProcedure,
    TLongDoubleProcedure,
    TLongFloatProcedure,
    TLongIntProcedure,
    TLongLongProcedure,
    TLongObjectProcedure,
    TLongProcedure,
    TObjectDoubleProcedure,
    TObjectFloatProcedure,
    TObjectIntProcedure,
    TObjectLongProcedure,
    TObjectObjectProcedure,
    TObjectProcedure {

    private final ObjectOutputStream stream;
    IOException exception;

    SerializationProcedure (ObjectOutputStream stream) {
        this.stream = stream;
    }

    public boolean execute(int val) {
        try {
            stream.writeInt(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(double val) {
        try {
            stream.writeDouble(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(long val) {
        try {
            stream.writeLong(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(float val) {
        try {
            stream.writeFloat(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(Object val) {
        try {
            stream.writeObject(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(Object key, Object val) {
        try {
            stream.writeObject(key);
            stream.writeObject(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(Object key, int val) {
        try {
            stream.writeObject(key);
            stream.writeInt(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(Object key, long val) {
        try {
            stream.writeObject(key);
            stream.writeLong(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(Object key, double val) {
        try {
            stream.writeObject(key);
            stream.writeDouble(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(Object key, float val) {
        try {
            stream.writeObject(key);
            stream.writeFloat(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(int key, Object val) {
        try {
            stream.writeInt(key);
            stream.writeObject(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(int key, int val) {
        try {
            stream.writeInt(key);
            stream.writeInt(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(int key, long val) {
        try {
            stream.writeInt(key);
            stream.writeLong(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(int key, double val) {
        try {
            stream.writeInt(key);
            stream.writeDouble(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(int key, float val) {
        try {
            stream.writeInt(key);
            stream.writeFloat(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(long key, Object val) {
        try {
            stream.writeLong(key);
            stream.writeObject(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(long key, int val) {
        try {
            stream.writeLong(key);
            stream.writeInt(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(long key, long val) {
        try {
            stream.writeLong(key);
            stream.writeLong(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(long key, double val) {
        try {
            stream.writeLong(key);
            stream.writeDouble(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(long key, float val) {
        try {
            stream.writeLong(key);
            stream.writeFloat(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(double key, Object val) {
        try {
            stream.writeDouble(key);
            stream.writeObject(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(double key, int val) {
        try {
            stream.writeDouble(key);
            stream.writeInt(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(double key, long val) {
        try {
            stream.writeDouble(key);
            stream.writeLong(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(double key, double val) {
        try {
            stream.writeDouble(key);
            stream.writeDouble(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(double key, float val) {
        try {
            stream.writeDouble(key);
            stream.writeFloat(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(float key, Object val) {
        try {
            stream.writeFloat(key);
            stream.writeObject(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(float key, int val) {
        try {
            stream.writeFloat(key);
            stream.writeInt(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(float key, long val) {
        try {
            stream.writeFloat(key);
            stream.writeLong(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(float key, double val) {
        try {
            stream.writeFloat(key);
            stream.writeDouble(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }

    public boolean execute(float key, float val) {
        try {
            stream.writeFloat(key);
            stream.writeFloat(val);
        } catch (IOException e) {
            this.exception = e;
            return false;
        }
        return true;
    }
}// SerializationProcedure


text:
// This header is generated for Chilkat v9.5.0

#ifndef _CkXmp_H
#define _CkXmp_H

#include "chilkatDefs.h"

#include "CkString.h"
#include "CkMultiByteBase.h"

class CkXml;
class CkStringArray;
class CkByteData;

#ifndef __sun__
#pragma pack (push, 8)
#endif

// CLASS: CkXmp
class CK_VISIBLE_PUBLIC CkXmp  : public CkMultiByteBase
{
    private:

	// Don't allow assignment or copying these objects.
	CkXmp(const CkXmp &);
	CkXmp &operator=(const CkXmp &);

    public:
	CkXmp(void);
	virtual ~CkXmp(void);

	static CkXmp *createNew(void);
	void CK_VISIBLE_PRIVATE inject(void *impl);

	// May be called when finished with the object to free/dispose of any
	// internal resources held by the object.
	void dispose(void);

	// BEGIN PUBLIC INTERFACE

	// ----------------------
	// Properties
	// ----------------------
	// The number of XMP metadata documents found within the JPG or TIFF file loaded by
	// LoadAppFile.
	int get_NumEmbedded(void);

	// Determines whether structures are stored with rdf:parseType="Resource", or
	// within an "rdf:Description" sub-node.
	bool get_StructInnerDescrip(void);
	// Determines whether structures are stored with rdf:parseType="Resource", or
	// within an "rdf:Description" sub-node.
	void put_StructInnerDescrip(bool newVal);

	// ----------------------
	// Methods
	// ----------------------
	// Adds or replaces an XMP property array. The XMP metadata to be updated is
	// contained in the XML object passed in the 1st argument. The 2nd argument
	// specifies the array type, which can be "bag", "seq", or "alt". The property name
	// should be prefixed with the namespace, such as "dc:subject".
	bool AddArray(CkXml &xml, const char *arrType, const char *propName, CkStringArray &values);

	// Adds a namespace to URI mapping. When a property is added via AddSimpleString or
	// any of the other methods, the property name is namespace qualified. When adding
	// the first property in a namespace, the rdf:Description is automatically added
	// and the URI is obtained from the namespace-to-URI mappings. The standard (and
	// commonly used) namespace mappings are defined by default. This is only used if
	// the namespace is custom or not already handled.
	void AddNsMapping(const char *ns, const char *uri);

	// Adds or replaces an XMP date property. The XMP metadata to be updated is
	// contained in the XML object passed in the 1st argument. The property name should
	// be prefixed with the namespace, such as "xap:CreateDate".
	bool AddSimpleDate(CkXml &iXml, const char *propName, SYSTEMTIME &propVal);

	// Adds or updates an XMP integer property. The XMP metadata to be updated is
	// contained in the XML object passed in the 1st argument. The property name should
	// be prefixed with the namespace, such as "tiff:XResolution".
	bool AddSimpleInt(CkXml &iXml, const char *propName, int propVal);

	// Adds or updates a simple XMP string property. The XMP metadata to be updated is
	// contained in the XML object passed in the 1st argument. The property name should
	// be prefixed with the namespace, such as "photoshop:Credit".
	bool AddSimpleStr(CkXml &iXml, const char *propName, const char *propVal);

	// Adds or updates an XMP structured property value. The XMP metadata to be updated
	// is contained in the XML object passed in the 1st argument. The structure name
	// should be prefixed with the namespace, such as
	// "Iptc4xmpCore:CreatorContactInfo". The property name within the structure should
	// also be prefixed with the namespace, such as "Iptc4xmpCore:CiAdrCity".
	bool AddStructProp(CkXml &iChilkatXml, const char *structName, const char *propName, const char *propValue);

	// Appends a new XMP metadata file to the XMP object. Any XMPs appended via this
	// method will be present in the file when SaveAppFile is called. Files containing
	// XMP metadata typically only include a single XMP document, so this method is
	// usually only called when adding XMP metadata to a file for the first time.
	bool Append(CkXml &iXml);

	// Converts a date to a string representation. This method is added for convenience
	// (just in case date-to-string conversions are required).
	bool DateToString(SYSTEMTIME &d, CkString &outStr);
	// Converts a date to a string representation. This method is added for convenience
	// (just in case date-to-string conversions are required).
	const char *dateToString(SYSTEMTIME &d);

	// Finds and returns an XMP array property. The property name should be prefixed
	// with the namespace, such as "dc:subject".
	// The caller is responsible for deleting the object returned by this method.
	CkStringArray *GetArray(CkXml &iXml, const char *propName);

	// Returns the Nth embedded XMP document as a Chilkat XML object.
	// The caller is responsible for deleting the object returned by this method.
	CkXml *GetEmbedded(int index);

	// The caller is responsible for deleting the object returned by this method.
	CkXml *GetProperty(CkXml &iXml, const char *propName);

	// Finds and returns an XMP date property. The property name should be prefixed
	// with the namespace, such as "xap:ModifyDate".
	bool GetSimpleDate(CkXml &iXml, const char *propName, SYSTEMTIME &outSysTime);

	// Finds and returns an XMP integer property. The property name should be prefixed
	// with the namespace, such as "tiff:ResolutionUnit".
	int GetSimpleInt(CkXml &iXml, const char *propName);

	// Finds and returns an XMP simple string property. The property name should be
	// prefixed with the namespace, such as "photoshop:Source".
	bool GetSimpleStr(CkXml &iXml, const char *propName, CkString &outStr);
	// Finds and returns an XMP simple string property. The property name should be
	// prefixed with the namespace, such as "photoshop:Source".
	const char *getSimpleStr(CkXml &iXml, const char *propName);
	// Finds and returns an XMP simple string property. The property name should be
	// prefixed with the namespace, such as "photoshop:Source".
	const char *simpleStr(CkXml &iXml, const char *propName);

	// Returns the property names used by an exsting structure within an XMP document.
	// The contents of the structure can be retrieved by calling GetStructValue for
	// each property name returned by GetStructPropNames.
	// The caller is responsible for deleting the object returned by this method.
	CkStringArray *GetStructPropNames(CkXml &iXml, const char *structName);

	// Returns the value of a single item within an XMP structure property. Property
	// names should always be prefixed with the namespace.
	bool GetStructValue(CkXml &iXml, const char *structName, const char *propName, CkString &outStr);
	// Returns the value of a single item within an XMP structure property. Property
	// names should always be prefixed with the namespace.
	const char *getStructValue(CkXml &iXml, const char *structName, const char *propName);
	// Returns the value of a single item within an XMP structure property. Property
	// names should always be prefixed with the namespace.
	const char *structValue(CkXml &iXml, const char *structName, const char *propName);

	// Loads a TIFF or JPG file into the XMP object.
	bool LoadAppFile(const char *filename);

	// Loads a JPG or TIFF from an byte buffer containing the image file data.
	bool LoadFromBuffer(const CkByteData &fileData, const char *ext);

	// Creates and returns a new/empty XMP metadata document as a Chilkat XML object.
	// The caller is responsible for deleting the object returned by this method.
	CkXml *NewXmp(void);

	// Removes all XMP metadata documents from an XMP object. After calling this
	// method, call SaveAppFile to rewrite the JPG or TIFF file with the XMP metadata
	// removed.
	bool RemoveAllEmbedded(void);

	// Removes an XMP array property from the XMP document.
	bool RemoveArray(CkXml &iXml, const char *propName);

	// Removes a single XMP metadata document from the JPG or TIFF file. Call
	// SaveAppFile to persist the changes to disk.
	bool RemoveEmbedded(int index);

	// Removes a namespace-to-URI mapping.
	void RemoveNsMapping(const char *ns);

	// Removes a simple XMP property from the XMP document.
	bool RemoveSimple(CkXml &iXml, const char *propName);

	// Removes an XMP structure property from the XMP document.
	bool RemoveStruct(CkXml &iXml, const char *structName);

	// Removes a single member from an XMP structured property.
	bool RemoveStructProp(CkXml &iXml, const char *structName, const char *propName);

	// Persists all changes made to the XMP document(s) by saving the XMP object to a
	// file. Changes made by adding, updating, or removing properties are not persisted
	// to the filesystem until this is called.
	bool SaveAppFile(const char *filename);

	// Saves a JPG or TIFF image with updated XMP to a byte buffer.
	bool SaveToBuffer(CkByteData &outBytes);

	// Converts a string to a date value. This method is added for convenience (just in
	// case string-to-date conversions are required).
	bool StringToDate(const char *str, SYSTEMTIME &outSysTime);

	// Unlocks the XMP component at runtime. This must be called once at the beginning
	// of your application. Passing an arbitrary value initiates a fully-functional
	// 30-day trial. A permanent unlock code is required to use the component beyond 30
	// days.
	bool UnlockComponent(const char *unlockCode);

	// END PUBLIC INTERFACE

};
#ifndef __sun__
#pragma pack (pop)
#endif

#endif


text:
if [ "$1" = "-h" ]
then
  echo "Locate aligned fragments within 2 full proteins"
  echo "Arguments:"
  echo " 1. NCBI Accession of first protein 1"
  echo " 2. Aligned fragment of protein 1"
  echo " 3. NCBI Accession of first protein 2"
  echo " 4. Aligned fragment of protein 2"
  echo " 5. (Optional) substitution matrix to use. (Defaul: BL50)"
  echo " 6. (Optional) Indicate whether plots will be shown (Values: show/quiet; Default: show)"
  exit 1
fi

#Define the substitution matrix to work with
mat="BL50"
mode=""

#Identify the type of substitution matrix, if given
if [[ ! -z "$5" ]] && ([[ "$5" != "quiet" ]] && [[ "$5" != "show" ]])
then
  mat=$5
fi

#Check the mode of operation: quiet/show
if [[ "$5" == "quiet" ]] || [[ "$6" == "quiet" ]]
then
  mode="-q"
fi

locateFragment.pl -a  $1 -f $2 $mode
locateFragment.pl -a  $3 -f $4 $mode
alignSeqsFiles.pl -q $1_frag.faa -ql $1_frag -s $3_frag.faa -sl $3_frag -e 0.1 -c 20 -cc X -m $mat
alignSeqsFiles.pl -q $1.faa -ql $1 -s $3.faa -sl $3 -e 0.1 -c 5 -cc X -m $mat

#Open html reports if apropriate
if [[ $mode != "-q" ]]
then
  open ssearch*/*.html
fi


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>ip::resolver_service::resolve (1 of 2 overloads)</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../../../boost_asio.html" title="Boost.Asio">
<link rel="up" href="../resolve.html" title="ip::resolver_service::resolve">
<link rel="prev" href="../resolve.html" title="ip::resolver_service::resolve">
<link rel="next" href="overload2.html" title="ip::resolver_service::resolve (2 of 2 overloads)">

Home
Libraries
People
FAQ
More

ip::resolver_service::resolve
          (1 of 2 overloads)

            Resolve a query to a list of entries.

iterator_type resolve(
    implementation_type & impl,
    const query_type & query,
    boost::system::error_code & ec);

Copyright © 2003-2014 Christopher M. Kohlhoff

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
'use strict';

/*!
 * Module dependencies.
 */

var fs = require('fs')
  , path = require('path')
  , vm = require('vm')
  , semver = require('semver')
  , uglify = require('uglify-js')
  , utils = require('./utils')
  , info = require('../package.json')
  , debug = require('debug')(info.name)
  , log

/**
 *
 *
 *
 */

function Multiverse(source, target, autoBuild) {
  this.sourceDir = source
  this.targetDir = target
  this.__tree = {}
  debug('created for source: `%s` and target: `%s`', source, target)
  autoBuild && this.build()
}

/**
 * Get relative path of file, normalizing source and target directories
 *
 * @param {String} file path
 * @return {String} normalized path
 */

Multiverse.prototype.getRelativePath = function(fpath) {
  return fpath
    .replace(this.targetDir, '')
    .split('/')
    .slice(2)
    .join('/')
}

/**
 * Get the base / source path for a given file
 *
 * @param {String} file path
 * @return {String} base file path
 */

Multiverse.prototype.getBasePath = function(fpath) {
  return path.join(this.sourceDir, this.getRelativePath(fpath))
}

/**
 * TODO: determine if using uglify to combine modules is OK...
 *
 * Build a new version of a given file path combining the source file
 * and the versioned file
 *
 * @param {String} file path
 * @return {Object} new module exports
 */

Multiverse.prototype.buildFile = function(fpath) {
  var basePath = this.getBasePath(fpath)
    , src = fs.readFileSync(basePath, 'utf-8') + ';\n;' + fs.readFileSync(fpath, 'utf-8')

  var code = uglify.parse(src, {
    filename: fpath
  , minify: false
  , fromString: true
  , compress: false
  })

  code.figure_out_scope()
  // exp = Multiverse.requireString(src, fpath)
  return Multiverse.requireString(code.print_to_string(), fpath)
}

/**
 * Walk through the given directory and build an exports tree
 *
 * @param {String} directory path
 * @param {Object} options for filtering / exports iterator
 * @return {Object} exports tree
 */

Multiverse.prototype.tree = function(dir, options) {
  var x = {}
    , self = this

  options || (options = {})

  fs.readdirSync(dir).forEach(function(file) {
    var fpath = path.join(dir, file)
      , ext = path.extname(file)
      , name = path.basename(file, ext)
      , isDir = utils.isDirectory(fpath)
      , exp

    // If a filter was provided, check that the file is valid
    if (options.filter && !options.filter(file, fpath, isDir)) {
      return
    }

    // Directory recursion
    if (isDir) {
      x[file] = self.tree(fpath, options)
      if (x[file].hasOwnProperty('__path')) {
        debug('warning: `__path` property collision for `%s`', fpath)
      }
      x[file].__path = fpath
      return
    }

    // Check if we are within the target version directory
    if (~dir.indexOf(self.targetDir)) {
      exp = self.buildFile(fpath)
    } else {
      exp = require(fpath)
    }

    // If an iterator was passed, use it to transform the found exports
    x[name] = options.iterator ? options.iterator(name, fpath, exp) : exp
    if (x[name].hasOwnProperty('__path')) {
      debug('warning: `__path` property collision for `%s`', fpath)
    }
    x[name].__path = fpath
  })
  return x
}

/**
 * Create a sandboxed virtual module representing the given file path
 * and exports object provided
 *
 * @param {String} filePath Absolute path to module (file to load)
 * @param {Object} mocks Hash of mocked dependencies
 * @param {Any} specific module exports
 * @return {Object} created module context
 */

Multiverse.requireVirtual = function(filePath, mocks, exp) {
  mocks || (mocks = {})
  exp || (exp = {})

  // this is necessary to allow relative path modules within loaded file
  // i.e. requiring ./some inside file /a/b.js needs to be resolved to /a/some
  function resolve(name) {
    if (name.charAt(0) !== '.') return name
    return path.resolve(path.dirname(filePath), name)
  }
  var context = {
    require: function(name) {
      return mocks[name] || require(resolve(name))
    }
  , console: console
  , exports: exp
  , module: { exports: exp }
  }
  vm.runInNewContext(fs.readFileSync(filePath), context)
  return context
}

/**
 * Build the multiverse for the current source and target directories, creates
 * a clone of the source exports for each available version, extending it with
 * the version specific exports, this will also stub out all require paths for
 * each version for files that exist in the source but not the version
 *
 * @param {Object} tree options for base / source directory
 * @param {Object} tree options for version directory
 * @return {Object} version export tree
 */

Multiverse.prototype.build = function(baseOpts, versionOpts) {
  var self = this
  debug('building tree')

  baseOpts || (baseOpts = {})
  versionOpts || (versionOpts = {})

  // Create an object tree of the base code from exports
  var original = this.tree(this.sourceDir, utils.extend({
    filter: function(name, fpath, isDir) {
      return fpath !== self.targetDir
    }
  }, baseOpts))

  // Create an object tree for all found versions of the code
  var versions = this.tree(this.targetDir, versionOpts)

  // Fill in the object tree from the original exported code
  for (var v in versions) {
    versions[v] = utils.extend(utils.clone(original), versions[v])
  }

  // Build the require cache
  function buildCache(source, v) {
    for (var prop in source) {
      var obj = source[prop]
        , fpath = obj.__path
        , opath

      if (!fpath) {
        continue
      }

      if (!~fpath.indexOf(self.targetDir) && v) {
        opath = fpath
        fpath = fpath.replace(self.sourceDir, path.join(self.targetDir, v))
      }

      if (~fpath.indexOf('.js')) {
        try {
          // Since the filepath may not exist in the current version, use the
          // original filepath, cache the virtual module in require for later use
          require.cache[fpath] = Multiverse.requireVirtual(opath || fpath, null, obj)
          source[prop] = require.cache[fpath].exports
        } catch (e) {
          debug('error loading %s', fpath)
        }
      } else if (utils.isObject(obj)) {
        buildCache(obj, v || prop)
      }
    }
  }

  // Cleanup all extra properties created during build
  function clean(obj) {
    for (var prop in obj) {
      delete obj[prop].__path
      utils.isObject(obj[prop]) && clean(obj[prop])
    }
  }

  buildCache(versions)
  clean(versions)
  debug('build completed for `%s`', Object.keys(versions).join(', '))
  this.__tree = versions
  return this.__tree
}

/**
 * NOTE: this should probably be removed or log warning, the tree
 * that is built internally may not be the same as the original exports
 *
 * Get the built export tree for the requested version
 *
 * @param {String} version
 * @return {Object} export tree
 */

Multiverse.prototype.getVersionTree = function(version) {
  var v = this.findVersion(version)
  return v ? this.__tree[v] : this.__tree.original
}

/**
 * Find an available version that satisfies supplied version
 *
 * @param {String} version
 * @return {String|Boolean} matching version
 */

Multiverse.prototype.findVersion = function(version) {
  return version ? this.getVersions().filter(function(x) {
    return semver.satisfies(x, version)
  })[0] : false
}

/**
 * Get all available versions
 *
 * @return {Array} available versions
 */

Multiverse.prototype.getVersions = function() {
  return Object.keys(this.__tree).sort(semver.rcompare)
}

/**
 * Require a file / module matching an available version
 *
 * @param {String} file path to base file
 * @param {String} version
 * @return {Object} module exports
 */

Multiverse.prototype.require =
Multiverse.prototype.requireVersion = function(fpath, version) {
  var v = this.findVersion(version)
    , caller = getCallFile()
    , dirname = path.dirname(caller)
    , oPath = path.resolve(dirname, fpath)
    , target = path.join(this.targetDir, v)
    , vPath = oPath.replace(this.sourceDir, target)
    , cache = require.cache[vPath] || require.cache[vPath + '.js']

  return cache ? cache.exports : require(vPath)
}

/**
 * Create a module from a string of code
 *
 * @param {String} source / code
 * @param {String} filename
 * @return {Object} resulting exports from code
 */

Multiverse.requireString = function(src, filename) {
  var Module = module.constructor
    , m = new Module()

  m._compile(src, filename)
  return m.exports
}

/**
 * General logging helper
 */

log =
Multiverse.log =
Multiverse.prototype.log = function() {
  Array.prototype.slice.call(arguments).forEach(function(arg) {
    if (typeof arg === 'function') arg = arg.toString()
    debug('\n', require('util').inspect(arg, false, null, true), '\n')
  })
}

/**
 * Get filename of calling function
 *
 * @return {String} filename
 */

function getCallFile() {
  try {
    var err = new Error()
      , callerfile
      , currentfile

    err.prepareStackTrace = function(err, stack) {
      return stack
    }
    currentfile = err.stack.shift().getFileName()

    while (err.stack.length) {
      callerfile = err.stack.shift().getFileName()
      if (currentfile !== callerfile) {
        return callerfile
      }
    }
  } catch (e) {}
  return undefined
}

/*!
 * Module exports.
 */

module.exports = Multiverse


text:
layout: post
author: tlchristian
title: Thu-Mai's Pipes and Filters
date: 2014-03-07
---

This week, we learned some pretty cool Unix commands to help understand how we can combine programs to create more efficient code.  Going through the Pipes and Filters exercise reminded me a bit of programming in R in terms of generating file objects.  It's interesting to see how each exercise has actually given me a greater ability to **decode** unfamiliar programs. I guess fluency is the recurring theme.
No need for intimidation; it seems that learning different programming languages is all about putting the pieces together.  No matter the shape of each piece, they all fit together...somehow.

For this week's exercise, I re-read the assignment carefully to get familiar with each of the pieces of the shell commands the lesson introduced. For the pipes, I wanted to see what each process did, so I broke the command apart, then add each process one at a time.  This was a very useful approach not only to figure out what the processes did, but also to see the behavior of each when appended to the command.  It was easy to see how the process applied to the output generated by the preceding process.  Fun!

#Challenges

**1. Explain the effect of `-n` on the `sort -n` command.**

By including `-n` in the `sort` command, the inputs are treated as numerical values rather than strings. Thus, the inputs are sorted numerically. Without `-n`, the inputs are treated as strings and are ordered as such.

---

**2. What is the difference between `wc -1 < mydata.dat` and `wc -1 mydata.dat`?**

To output the number of lines in the `mydata.dat` file, we use the `wc -1 mydata.dat` command.  By adding `<` to create the command `wc -1 < mydata.dat`, the program opens and reads from the `mydata.dat` file to process the line count. The program sends the contents of `mydata.dat` to `wc`'s standard input. This is referred to as *redirecting input*.

---

**3. Why do you think `uniq` only removes *adjacent* duplicated lines? What other command could you combine with it to remove all duplicated lines?**

Rather than reading the contents of the entire file before removing duplicates, `uniq` compares lines as it reads them, according to [this](http://www.ibm.com/developerworks/library/l-tiptex6/).  When considering large data files, the processing required to read through the entire file and compare each line to every other line would likely take a prohibitive amount of processing effort and time.  By sorting the list first, `uniq` is able to do its work as it works its way down the list.

To remove all duplicated lines, you would add `-u` to the command to create `uniq -u salmon.txt`.  You could also use the `sort -u salmon.txt` command.
In a **pipe**, you could use `sort salmon.txt | uniq`, which first sorts the list so that duplicates are consecutive. `uniq` will then recognize and remove the adjacent-occurring duplicate lines.
The output of these commands is:

```
coho
steelhead
```

---

**4. What text passes through each of the pipes and the final redirect in the pipeline `cat animals.txt | head -5 | tail -3 | sort -r > final.txt`?**

This pipeline command tells the shell to reverse sort the last 3 lines of the top 5 lines of `animals.txt`, and generate the file `final.txt` containing the output text below:

```
2012-11-06,rabbit
2012-11-06,deer
2012-11-05,raccoon
```

---

**5. What other command(s) could be added to `cut -d , -f 2 animals.txt` in a pipeline to find out what animals the file contains (without any duplicates in their names)?**

A deduped list of animals can be generated using the pipeline command: `cut -d , -f 2 animals.txt | sort -u`.  `sort -u` sorts and pulls the unique lines from the output of the preceding `cut` command, resulting in the following output:

```
bear
deer
fox
rabbit
raccoon
```

---
---


text:
package org.uddi.api_v3;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for tModelInfo complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="tModelInfo">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{urn:uddi-org:api_v3}name"/>
 *         <element ref="{urn:uddi-org:api_v3}description" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="tModelKey" use="required" type="{urn:uddi-org:api_v3}tModelKey" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "tModelInfo", propOrder = {
    "name",
    "description"
})
public class TModelInfo implements Serializable{
	@XmlTransient
	private static final long serialVersionUID = -9208130813266936633L;
	@XmlElement(required = true)
    protected Name name;
    protected List<Description> description;
    @XmlAttribute(required = true)
    protected String tModelKey;

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link Name }
     *
     */
    public Name getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link Name }
     *
     */
    public void setName(Name value) {
        this.name = value;
    }

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

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

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

     *    getDescription().add(newItem);
     *

     *
     *
     *

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

    /**
     * Gets the value of the tModelKey property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTModelKey() {
        return tModelKey;
    }

    /**
     * Sets the value of the tModelKey property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTModelKey(String value) {
        this.tModelKey = value;
    }

}


text:
package com.hashvoid.crossbinder.hod;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates that the annotated type can never participate in dependency injection or be bound to a
 * concrete object. The annotated type must be an interface for this annotation to be relevant.
 *
 * @author randondiesel
 */

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface NonBindable {

}


text:
        <link rel="stylesheet" type="text/css" href="../../../../asset/static/prettify.css" />
        <link rel="stylesheet" type="text/css" href="../../../../asset/static/style.css" />

                Zephir Documentation v1.0.1

                    <input class="search-box" placeholder="Search for a class or namespace " type="text" />

Home

Classes

Phalconry\Mvc\Response\TypeXml

Source

        Class

        Class

            Phalconry

            Mvc

            Response

TypeXml

namespace Phalconry\Mvc\Response;

use Phalcon\Http\ResponseInterface;
use Phalconry\Http\Util\MimeType;

class TypeXml extends AbstractDataType
{

	public function formatResponse(<ResponseInterface> response)
    {
		var data, status;

        let data = this->getData();

		if ! data {
			let data = response->getContent();
		}

		this->setData(data);

        let status = response->getHeaders()->get("Status");

		if ! status {
			response->setStatusCode(200, "OK");
			let status = "200 OK";
		}

		this->prepend("status", (int)substr(status, 0, 3));
		this->prepend("message", substr(status, 4));

		if response->{"getDI"}()->getRequest()->hasQuery("dev") {
			this->append("diagnostics", response->{"getDI"}()->getShared("diagnostics")->getAll());
		}

		response->setContent(this->encode());
	}

	public function getContentType()
    {
		return MimeType::XML;
	}

	public function encode()
    {
		var writer;
        let writer = new \Utils\XmlWriter();

        return writer->write(this->getContent());
	}

}


text:
import os
import json
import shutil
import sqlite3
import collections
import string
import re
from citation_vim.zotero.data import ZoteroData
from citation_vim.zotero.betterbibtex import BetterBibtex
from citation_vim.utils import check_path, raiseError, compat_str
from citation_vim.item import Item

class ZoteroParser(object):

    def __init__(self, context):
        self.context = context
        self.zotero_path = context['zotero_path']
        self.cache_path = context['cache_path']
        self.et_al_limit = context['et_al_limit']
        self.key_format = context['key_format']
        self.html_regex = re.compile('<[^<]+?>')
        if not check_path(os.path.join(self.zotero_path, u"zotero.sqlite")):
            raiseError(u"{} is not a valid zotero path".format(self.zotero_path))

    def load(self):
        """
        Returns:
        A zotero database as an array of standardised Items.
        """
        zotero = ZoteroData(self.context)
        zot_data = zotero.load()
        bb = BetterBibtex(self.zotero_path, self.cache_path)
        bb_citekeys = bb.load_citekeys()
        return self.build_items(zot_data, bb_citekeys)

    def build_items(self, zot_data, bb_citekeys):
        items = []
        for zot_id, zot_item in zot_data:
            item = Item()
            item.collections = zot_item.collections # Allways an array.
            item.abstract    = self.clean(zot_item.abstractNote)
            item.doi         = self.clean(zot_item.DOI)
            item.isbn        = self.clean(zot_item.ISBN)
            item.publication = self.clean(zot_item.publicationTitle)
            item.language    = self.clean(zot_item.language)
            item.issue       = self.clean(zot_item.issue)
            item.pages       = self.clean(zot_item.pages)
            item.publisher   = self.clean(zot_item.publisher)
            item.title       = self.clean(zot_item.title)
            item.type        = self.clean(zot_item.type)
            item.url         = zot_item.url
            item.volume      = self.clean(zot_item.volume)
            item.author      = self.clean(zot_item.format_author(self.et_al_limit))
            item.date        = self.clean(zot_item.format_date())
            item.file        = zot_item.format_attachment()
            item.notes       = self.clean(zot_item.format_notes())
            item.tags        = self.clean(zot_item.format_tags())
            item.zotero_key  = self.clean(zot_item.key)
            item.key         = self.format_key(item, zot_item, bb_citekeys)
            item.combine()
            items.append(item)
        return items

    def clean(self, string):
        string = compat_str(string) # Cast as a unicode string in python 2 or 3
        return self.html_regex.sub('', string) # Remove any html formatting

    def format_key(self, item, zot_item, bb_citekeys):
        """
        Returns:
        A custom formatted key if present, or a better bibtex key, or the zotero hash.
        """
        if self.context['key_format'] > "":
            return self.custom_key(item, zot_item)
        elif zot_item.id in bb_citekeys:
            return bb_citekeys[zot_item.id]
        else:
            return zot_item.key

    def custom_key(self, item, zot_item):
        title = compat_str(zot_item.title.lower())
        title = self.context['key_title_banned_regex'].sub('', title)
        title = title.partition(' ')[0]
        date = item.date # Use the allready formatted date
        author = compat_str(zot_item.format_first_author().replace(" ", "_"))
        replacements = {
            u"zotero_key": item.zotero_key,
            u"title": title.lower(),
            u"Title": title.capitalize(),
            u"author": author.lower(),
            u"Author": author.capitalize(),
            u"date": date.replace(' ', '-').capitalize() # Date may be 'In-press' etc.
        }
        key_format = u'%s' % self.context['key_format']
        key = key_format.format(**replacements)
        key = self.context['key_clean_regex'].sub('', key)
        return key


text:
/**
 * Created by thomashourlier on 16/01/15.
 */

/// <reference path='../../typings/tsd.d.ts' />
/// <reference path='chrome/messaging.ts' />
/// <reference path='chrome/contentscript.ts' />
/// <reference path='injected/autobidder.ts' />
/// <reference path='models/Bidder.ts' />
/// <reference path='models/Bid.ts' />
/// <reference path='models/Auction.ts' />
/// <reference path='models/Item.ts' />
/// <reference path='models/AuctionHouse.ts' />
/// <reference path='models/AuctionModel.ts' />
/// <reference path='controllers/AuctionController.ts' />
/// <reference path='services/NetworkService.ts' />
/// <reference path='filters/BiddingBidderFilter.ts' />
/// <reference path='directives/AuctionInfoDirective.ts' />
/// <reference path='directives/BidderInfoDirective.ts' />
/// <reference path='directives/BidInfoDirective.ts' />
/// <reference path='app.ts' />

module Madbid{
    export interface ISerializable{
        toJson(): any;
    }

    export interface IStringNumberMap{
        [index: string]: number;
    }

    export interface INumberBooleanMap{
        [index: number]: boolean;
    }

    export interface IMadbidResponse{
        cmd: string;
        status: number;
        version: string;
        response: any;
    }

    export interface IMadbidUpdateResponse{
        items: Array<IMadbidAuction>;
        reference: IMadbidReference;
    }

    export interface IMadbidRefreshResponse{
        items: Array<IMadbidItem>;
        reference: IMadbidReference;
    }

    export interface IMadbidReference{
        timestamp: string;
        image_base?: string;
        sms_cost?: number;
        sms_msisdn?: number;
    }

    export interface IMadbidAuction{
        auction_id?: number;
        date_bid: string;
        date_timeout?: string;
        highest_bid: number;
        highest_bidder?: string;
        state?: number;
        timeout?: number;
    }

    export interface IMadbidItem{
        title: string;
        shipping_costs: number;
        buynow_data: IMadbidBuyNowData;
        auction_id: number;
        auction_data: IMadbidAuctionData;
        rrp: number;
    }

    export interface IMadbidAuctionData{
        cerdit_cost: number;
        last_bid: IMadbidAuction;
    }

    export interface IMadbidBuyNowData{
        base_price: number;
    }
}


text:
layout: post
status: publish
published: true
title: Present.tv
author:
  display_name: dbieber
  login: dbieber
  email: dbieber@princeton.edu
  url: ''
author_login: dbieber
author_email: dbieber@princeton.edu
wordpress_id: 331
wordpress_url: http://princetonacm.com/?p=331
date: '2013-09-12 00:52:10 -0400'
date_gmt: '2013-09-12 00:52:10 -0400'
categories:
- broadcast
tags: []
comments: []
---

http://www.present.tv/jobs/

Why join Present?

Present is an early stage startup that allows people to discover, create, and share live video with the world.  We're creating a way for people to see whatever they want to at any time; to feel empowered to see what's happening anywhere without the obstacle of distance.  Present is building the future of media broadcasting, leveling viewers and content creators, and we'd love for you to build with us.

We're a Tigerlabs portfolio company.  Working with us now, you'll participate largely in product development, customer engagement, and business development – every one of us does.  You'll attend speaker series and you'll meet leaders in NYC venture capital, and the startup ecosystem.  The daily grind at this stage is best described as making shit happen – if that's what you're into, you'll fit right in.

Our office is located in Princeton, NJ.

Our culture

- Nothing is difficult.

- "Fun": adjective a way to describe a situation in which you have to do something you're not at all familiar with.

- Be adaptable… startup life comes with occasional sharp turns and call-ins.

- See what needs to be done, and make great moves.

- Make mistakes and own them – just don't miss opportunities.  (Recognize, and internalize lessons from those mistakes!)

- Be curious, and question the status quo.

- 'It's impossible' sounds more like 'I have not looked into it.'

Benefits & perks

- Play a huge role as an early contributor to Presents' products.

- Play some fierce ping-pong with startups, awesome VCs, and international business leaders.

- Your mentors are leaders in the startup world.

- Contribute business, product, and technology.

Other benefits & perks

- Do you like dogs?  Me too!  All week there are dogs around the office

  - Don't worry they aren't in your space if you don't like them ;(

- Ripstick when your not coding.

- Coffee makes you smarter.  Enjoy nearby Small World Coffee.

- ...Yes, there is an Xbox.

If interested in applying, please send your resume and Github to dan@present.tv


text:
require 'makeprintable/version'
require 'rubygems'
require 'rest-client'
require 'json'
require 'crack'

require File.expand_path('../misc/hash.rb', __FILE__)
require File.expand_path('../makeprintable/client.rb', __FILE__)

module MakePrintable
  class << self
    attr_accessor :configuration
  end

  def self.configure
    self.configuration ||= Configuration.new
    yield(configuration)
  end

  class Configuration
    attr_accessor :api_key
  end
end


text:
var expect = require('chai').expect;
var Dispatcher = require('../lib/dispatcher');

function noop() {}

describe('Dispatcher', function () {
  var eventName = 'event:test';
  var dispatcher;
  var events;

  beforeEach(function () {
    dispatcher = new Dispatcher();
    events = [];
  });

  describe('register', function () {
    it('should fail if no name is provided', function () {
      expect(function () {
        dispatcher.register(null, noop);
      }).to.throw();
    });

    it('should fail if no function is provided', function () {
      expect(function () {
        dispatcher.register(eventName, null);
      }).to.throw();

      expect(function () {
        dispatcher.register(eventName, 42);
      }).to.throw();
    });
  });

  describe('unregister', function () {
    it('should fail if no name is provided', function () {
      expect(function () {
        dispatcher.unregister(null, noop);
      }).to.throw();
    });

    it('should fail if no function is provided', function () {
      expect(function () {
        dispatcher.unregister(eventName, null);
      }).to.throw();

      expect(function () {
        dispatcher.unregister(eventName, 42);
      }).to.throw();
    });
  });

  describe('dispatch', function () {
    it('should fail if no name is provided', function () {
      expect(function () {
        dispatcher.dispatch(null);
      }).to.throw();
    });

    it('should fire all registered handlers', function () {
      function one() {
        events.push('one');
      }

      function two() {
        events.push('two');
      }

      dispatcher.register(eventName, one);
      dispatcher.register(eventName, two);
      dispatcher.dispatch(eventName);

      expect(events).to.contain('one');
      expect(events).to.contain('two');
    });

    it('should pass along one additional argument', function (done) {
      var value = { foo: 'bar' };

      function handler(arg) {
        expect(arguments.length).to.equal(1);
        expect(arg).to.deep.equal(value);
        done();
      }

      dispatcher.register(eventName, handler);
      dispatcher.dispatch(eventName, value);
    });

    it('should not fire unregistered handlers', function () {
      function one() {
        events.push('one');
      }

      function two() {
        events.push('two');
      }

      dispatcher.register(eventName, one);
      dispatcher.register(eventName, two);
      dispatcher.unregister(eventName, one);
      dispatcher.dispatch(eventName);

      expect(events).to.contain('two');
    });
  });
});