text:
package org.apache.activemq.artemis.core.journal.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord;

public class JournalTransaction
{

   private JournalRecordProvider journal;

   private List<JournalUpdate> pos;

   private List<JournalUpdate> neg;

   private final long id;

   // All the files this transaction is touching on.
   // We can't have those files being reclaimed if there is a pending transaction
   private Set<JournalFile> pendingFiles;

   private TransactionCallback currentCallback;

   private boolean compacting = false;

   private Map<JournalFile, TransactionCallback> callbackList;

   private JournalFile lastFile = null;

   private final AtomicInteger counter = new AtomicInteger();

   public JournalTransaction(final long id, final JournalRecordProvider journal)
   {
      this.id = id;
      this.journal = journal;
   }

   public void replaceRecordProvider(final JournalRecordProvider provider)
   {
      journal = provider;
   }

   /**
    * @return the id
    */
   public long getId()
   {
      return id;
   }

   public int getCounter(final JournalFile file)
   {
      return internalgetCounter(file).intValue();
   }

   public void incCounter(final JournalFile file)
   {
      internalgetCounter(file).incrementAndGet();
   }

   public long[] getPositiveArray()
   {
      if (pos == null)
      {
         return new long[0];
      }
      else
      {
         int i = 0;
         long[] ids = new long[pos.size()];
         for (JournalUpdate el : pos)
         {
            ids[i++] = el.getId();
         }
         return ids;
      }
   }

   public void setCompacting()
   {
      compacting = true;

      // Everything is cleared on the transaction...
      // since we are compacting, everything is at the compactor's level
      clear();
   }

   /** This is used to merge transactions from compacting */
   public void merge(final JournalTransaction other)
   {
      if (other.pos != null)
      {
         if (pos == null)
         {
            pos = new ArrayList<JournalUpdate>();
         }

         pos.addAll(other.pos);
      }

      if (other.neg != null)
      {
         if (neg == null)
         {
            neg = new ArrayList<JournalUpdate>();
         }

         neg.addAll(other.neg);
      }

      if (other.pendingFiles != null)
      {
         if (pendingFiles == null)
         {
            pendingFiles = new HashSet<JournalFile>();
         }

         pendingFiles.addAll(other.pendingFiles);
      }

      compacting = false;
   }

   /**
    *
    */
   public void clear()
   {
      // / Compacting is recreating all the previous files and everything
      // / so we just clear the list of previous files, previous pos and previous adds
      // / The transaction may be working at the top from now

      if (pendingFiles != null)
      {
         pendingFiles.clear();
      }

      if (callbackList != null)
      {
         callbackList.clear();
      }

      if (pos != null)
      {
         pos.clear();
      }

      if (neg != null)
      {
         neg.clear();
      }

      counter.set(0);

      lastFile = null;

      currentCallback = null;
   }

   /**
    * @param currentFile
    * @param data
    */
   public void fillNumberOfRecords(final JournalFile currentFile, final JournalInternalRecord data)
   {
      data.setNumberOfRecords(getCounter(currentFile));
   }

   public TransactionCallback getCallback(final JournalFile file) throws Exception
   {
      if (callbackList == null)
      {
         callbackList = new HashMap<JournalFile, TransactionCallback>();
      }

      currentCallback = callbackList.get(file);

      if (currentCallback == null)
      {
         currentCallback = new TransactionCallback();
         callbackList.put(file, currentCallback);
      }

      if (currentCallback.getErrorMessage() != null)
      {
         throw ActiveMQExceptionType.createException(currentCallback.getErrorCode(), currentCallback.getErrorMessage());
      }

      currentCallback.countUp();

      return currentCallback;
   }

   public void addPositive(final JournalFile file, final long id, final int size)
   {
      incCounter(file);

      addFile(file);

      if (pos == null)
      {
         pos = new ArrayList<JournalUpdate>();
      }

      pos.add(new JournalUpdate(file, id, size));
   }

   public void addNegative(final JournalFile file, final long id)
   {
      incCounter(file);

      addFile(file);

      if (neg == null)
      {
         neg = new ArrayList<JournalUpdate>();
      }

      neg.add(new JournalUpdate(file, id, 0));
   }

   /**
    * The caller of this method needs to guarantee appendLock.lock at the journal. (unless this is being called from load what is a single thread process).
    * */
   public void commit(final JournalFile file)
   {
      JournalCompactor compactor = journal.getCompactor();

      if (compacting)
      {
         compactor.addCommandCommit(this, file);
      }
      else
      {

         if (pos != null)
         {
            for (JournalUpdate trUpdate : pos)
            {
               JournalRecord posFiles = journal.getRecords().get(trUpdate.id);

               if (compactor != null && compactor.lookupRecord(trUpdate.id))
               {
                  // This is a case where the transaction was opened after compacting was started,
                  // but the commit arrived while compacting was working
                  // We need to cache the counter update, so compacting will take the correct files when it is done
                  compactor.addCommandUpdate(trUpdate.id, trUpdate.file, trUpdate.size);
               }
               else if (posFiles == null)
               {
                  posFiles = new JournalRecord(trUpdate.file, trUpdate.size);

                  journal.getRecords().put(trUpdate.id, posFiles);
               }
               else
               {
                  posFiles.addUpdateFile(trUpdate.file, trUpdate.size);
               }
            }
         }

         if (neg != null)
         {
            for (JournalUpdate trDelete : neg)
            {
               if (compactor != null)
               {
                  compactor.addCommandDelete(trDelete.id, trDelete.file);
               }
               else
               {
                  JournalRecord posFiles = journal.getRecords().remove(trDelete.id);

                  if (posFiles != null)
                  {
                     posFiles.delete(trDelete.file);
                  }
               }
            }
         }

         // Now add negs for the pos we added in each file in which there were
         // transactional operations

         for (JournalFile jf : pendingFiles)
         {
            file.incNegCount(jf);
         }
      }
   }

   public void waitCallbacks() throws InterruptedException
   {
      if (callbackList != null)
      {
         for (TransactionCallback callback : callbackList.values())
         {
            callback.waitCompletion();
         }
      }
   }

   /** Wait completion at the latest file only */
   public void waitCompletion() throws Exception
   {
      if (currentCallback != null)
      {
         currentCallback.waitCompletion();
      }
   }

   /**
    * The caller of this method needs to guarantee appendLock.lock before calling this method if being used outside of the lock context.
    * or else potFilesMap could be affected
    * */
   public void rollback(final JournalFile file)
   {
      JournalCompactor compactor = journal.getCompactor();

      if (compacting && compactor != null)
      {
         compactor.addCommandRollback(this, file);
      }
      else
      {
         // Now add negs for the pos we added in each file in which there were
         // transactional operations
         // Note that we do this on rollback as we do on commit, since we need
         // to ensure the file containing
         // the rollback record doesn't get deleted before the files with the
         // transactional operations are deleted
         // Otherwise we may run into problems especially with XA where we are
         // just left with a prepare when the tx
         // has actually been rolled back

         for (JournalFile jf : pendingFiles)
         {
            file.incNegCount(jf);
         }
      }
   }

   /**
    * The caller of this method needs to guarantee appendLock.lock before calling this method if being used outside of the lock context.
    * or else potFilesMap could be affected
    * */
   public void prepare(final JournalFile file)
   {
      // We don't want the prepare record getting deleted before time

      addFile(file);
   }

   /** Used by load, when the transaction was not loaded correctly */
   public void forget()
   {
      // The transaction was not committed or rolled back in the file, so we
      // reverse any pos counts we added
      for (JournalFile jf : pendingFiles)
      {
         jf.decPosCount();
      }

   }

   @Override
   public String toString()
   {
      return "JournalTransaction(" + id + ")";
   }

   private AtomicInteger internalgetCounter(final JournalFile file)
   {
      if (lastFile != file)

      {
         lastFile = file;
         counter.set(0);
      }
      return counter;
   }

   private void addFile(final JournalFile file)
   {
      if (pendingFiles == null)
      {
         pendingFiles = new HashSet<JournalFile>();
      }

      if (!pendingFiles.contains(file))
      {
         pendingFiles.add(file);

         // We add a pos for the transaction itself in the file - this
         // prevents any transactional operations
         // being deleted before a commit or rollback is written
         file.incPosCount();
      }
   }

   private static class JournalUpdate
   {
      private final JournalFile file;

      long id;

      int size;

      /**
       * @param file
       * @param id
       * @param size
       */
      private JournalUpdate(final JournalFile file, final long id, final int size)
      {
         super();
         this.file = file;
         this.id = id;
         this.size = size;
      }

      /**
       * @return the id
       */
      public long getId()
      {
         return id;
      }
   }
}


text:
package gov.nih.nci.evs.api.model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.server.ResponseStatusException;

import gov.nih.nci.evs.api.service.MetadataService;
import gov.nih.nci.evs.api.util.TerminologyUtils;

/**
 * Search criteria object for /concept/search implementation without a
 * terminology field.
 */
public class SearchCriteriaWithoutTerminology extends BaseModel {

  /** The Constant logger. */
  @SuppressWarnings("unused")
  private static final Logger logger =
      LoggerFactory.getLogger(SearchCriteriaWithoutTerminology.class);

  /** The term. */
  private String term;

  /** The type. */
  private String type = "contains";

  /** The include. */
  private String include = "minimal";

  /** The from record. */
  private Integer fromRecord = 0;

  /** The page size. */
  private Integer pageSize = 10;

  /** The concept status. */
  private List<String> conceptStatus;

  /** The property. */
  private List<String> property;

  /** The synonym source. */
  private List<String> synonymSource;

  /** The synonym type. */
  private List<String> synonymType;

  /** The definition source. */
  private List<String> definitionSource;

  /** The definition type. */
  private List<String> definitionType;

  /** The synonym term type. */
  private List<String> synonymTermType;

  /** The subset group */
  private List<String> subset;

  /** The inverse. */
  // private Boolean inverse = null;

  /** The association. */
  // private List<String> association;

  /** The role. */
  // private List<String> role;

  /**
   * Instantiates an empty {@link SearchCriteriaWithoutTerminology}.
   */
  public SearchCriteriaWithoutTerminology() {
    // n/a
  }

  /**
   * Instantiates a {@link SearchCriteriaWithoutTerminology} from the specified
   * parameters.
   *
   * @param other the other
   */
  public SearchCriteriaWithoutTerminology(final SearchCriteriaWithoutTerminology other) {
    populateFrom(other);
  }

  /**
   * Populate from.
   *
   * @param other the other
   */
  public void populateFrom(final SearchCriteriaWithoutTerminology other) {
    // association = new ArrayList<>(other.getAssociation());
    conceptStatus = new ArrayList<>(other.getConceptStatus());
    definitionSource = new ArrayList<>(other.getDefinitionSource());
    definitionType = new ArrayList<>(other.getDefinitionType());
    fromRecord = other.getFromRecord();
    include = other.getInclude();
    // inverse = other.getInverse();
    pageSize = other.getPageSize();
    property = new ArrayList<>(other.getProperty());
    // role = new ArrayList<>(other.getRole());
    synonymSource = new ArrayList<>(other.getSynonymSource());
    synonymType = new ArrayList<>(other.getSynonymType());
    synonymTermType = new ArrayList<>(other.getSynonymTermType());
    term = other.getTerm();
    type = other.getType();
    subset = new ArrayList<>(other.getSubset());
  }

  /**
   * Returns the term.
   *
   * @return the term
   */
  public String getTerm() {
    return term;
  }

  /**
   * Sets the term.
   *
   * @param term the term
   */
  public void setTerm(final String term) {
    this.term = term;
  }

  /**
   * Returns the type.
   *
   * @return the type
   */
  public String getType() {
    return type;
  }

  /**
   * Sets the type.
   *
   * @param type the type
   */
  public void setType(final String type) {
    this.type = type;
  }

  /**
   * Returns the include.
   *
   * @return the include
   */
  public String getInclude() {
    return include;
  }

  /**
   * Sets the include.
   *
   * @param include the include
   */
  public void setInclude(final String include) {
    this.include = include;
  }

  /**
   * Returns the from record.
   *
   * @return the from record
   */
  public Integer getFromRecord() {
    return fromRecord;
  }

  /**
   * Sets the from record.
   *
   * @param fromRecord the from record
   */
  public void setFromRecord(final Integer fromRecord) {
    this.fromRecord = fromRecord;
  }

  /**
   * Returns the page size.
   *
   * @return the page size
   */
  public Integer getPageSize() {
    return pageSize;
  }

  /**
   * Sets the page size.
   *
   * @param pageSize the page size
   */
  public void setPageSize(final Integer pageSize) {
    this.pageSize = pageSize;
  }

  /**
   * Returns the concept status.
   *
   * @return the concept status
   */
  public List<String> getConceptStatus() {
    if (conceptStatus == null) {
      conceptStatus = new ArrayList<>();
    }
    return conceptStatus;
  }

  /**
   * Sets the concept status.
   *
   * @param conceptStatus the concept status
   */
  public void setConceptStatus(final List<String> conceptStatus) {
    this.conceptStatus = conceptStatus;
  }

  /**
   * Returns the property.
   *
   * @return the property
   */
  public List<String> getProperty() {
    if (property == null) {
      property = new ArrayList<>();
    }
    return property;
  }

  /**
   * Sets the property.
   *
   * @param property the property
   */
  public void setProperty(final List<String> property) {
    this.property = property;
  }

  /**
   * Returns the synonym source.
   *
   * @return the synonym source
   */
  public List<String> getSynonymSource() {
    if (synonymSource == null) {
      synonymSource = new ArrayList<>();
    }
    return synonymSource;
  }

  /**
   * Sets the synonym source.
   *
   * @param synonymSource the synonym source
   */
  public void setSynonymSource(final List<String> synonymSource) {
    this.synonymSource = synonymSource;
  }

  /**
   * Returns the synonym type.
   *
   * @return the synonym type
   */
  public List<String> getSynonymType() {
    if (synonymType == null) {
      synonymType = new ArrayList<>();
    }
    return synonymType;
  }

  /**
   * Sets the synonym type.
   *
   * @param synonymType the synonym type
   */
  public void setSynonymType(final List<String> synonymType) {
    this.synonymType = synonymType;
  }

  /**
   * Returns the definition source.
   *
   * @return the definition source
   */
  public List<String> getDefinitionSource() {
    if (definitionSource == null) {
      definitionSource = new ArrayList<>();
    }
    return definitionSource;
  }

  /**
   * Sets the definition source.
   *
   * @param definitionSource the definition source
   */
  public void setDefinitionSource(final List<String> definitionSource) {
    this.definitionSource = definitionSource;
  }

  /**
   * Returns the definition type.
   *
   * @return the definition type
   */
  public List<String> getDefinitionType() {
    if (definitionType == null) {
      definitionType = new ArrayList<>();
    }
    return definitionType;
  }

  /**
   * Sets the definition type.
   *
   * @param definitionType the definition type
   */
  public void setDefinitionType(final List<String> definitionType) {
    this.definitionType = definitionType;
  }

  /**
   * Returns the synonym term type.
   *
   * @return the synonym term type
   */
  public List<String> getSynonymTermType() {
    if (synonymTermType == null) {
      synonymTermType = new ArrayList<>();
    }
    return synonymTermType;
  }

  /**
   * Sets the synonym term type.
   *
   * @param synonymTermType the synonym term type
   */
  public void setSynonymTermType(final List<String> synonymTermType) {
    this.synonymTermType = synonymTermType;
  }

  /**
   * Returns the inverse.
   *
   * @return the inverse
   */
  // public Boolean getInverse() {
  // return inverse;
  // }

  /**
   * Sets the inverse.
   *
   * @param inverse the inverse
   */
  // public void setInverse(final Boolean inverse) {
  // this.inverse = inverse;
  // }

  /**
   * Returns the association.
   *
   * @return the association
   */
  // public List<String> getAssociation() {
  // if (association == null) {
  // association = new ArrayList<>();
  // }
  // return association;
  // }

  /**
   * Sets the association.
   *
   * @param association the association
   */
  // public void setAssociation(final List<String> association) {
  // this.association = association;
  // }

  /**
   * Returns the role.
   *
   * @return the role
   */
  // public List<String> getRole() {
  // if (role == null) {
  // role = new ArrayList<>();
  // }
  // return role;
  // }

  /**
   * Sets the role.
   *
   * @param role the role
   */
  // public void setRole(final List<String> role) {
  // this.role = role;
  // }

  /**
   * @return the
   */
  public List<String> getSubset() {
    if (subset == null) {
      subset = new ArrayList<>();
    }
    return subset;
  }

  /**
   * @param the to set
   */
  public void setSubset(List<String> subset) {
    this.subset = subset;
  }

  /**
   * Compute include param.
   *
   * @return the include param
   */
  public IncludeParam computeIncludeParam() {
    return new IncludeParam(include);
  }

  /**
   * Check required fields.
   *
   * @return true, if successful
   */
  public boolean checkRequiredFields() {
    if (term == null) {
      return false;
    }
    return true;
  }

  /**
   * Check required fields.
   *
   * @return true, if successful
   * @throws Exception the exception
   */
  public void checkPagination() throws Exception {
    if (pageSize < 1 || pageSize > 1000) {
      throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
          "Parameter 'pageSize' must be between 1 and 1000 = " + pageSize);

    }

    // This rule is no longer required, non-aligned fromRecord/pageSize
    // supported
    // if (fromRecord % pageSize != 0) {
    // throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
    // "Parameter 'fromRecord' should be the first record of a page, e.g.
    // fromRecord % pageSize == 0");
    // }
  }

  /**
   * Compute missing required fields.
   *
   * @return the string
   */
  public String computeMissingRequiredFields() {
    return "term";
  }

  /**
   * Validate.
   *
   * @param terminology the terminology instance
   * @param metadataService the metadata service
   * @throws Exception the exception
   */
  public void validate(final Terminology terminology, final MetadataService metadataService)
    throws Exception {
    // if (getTerm() == null) {
    // throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
    // "Required parameter 'term' is missing");
    // }

    if (!TerminologyUtils
        .asSet("AND", "OR", "phrase", "exact", "contains", "fuzzy", "match", "startsWith")
        .contains(getType())) {
      throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
          "Required parameter 'type' has an invalid value = " + type);
    }

    if (fromRecord < 0) {
      throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
          "Parameter 'fromRecord' must be >= 0 = " + fromRecord);
    }

    if (pageSize < 1) {
      throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
          "Parameter 'pageSize' must be between 1 and 1000 = " + pageSize);
    }

    if (pageSize > 1000) {
      throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
          "Parameter 'pageSize' must be between 1 and 1000 = " + pageSize);
    }

    // Validate concept status
    if (getConceptStatus().size() > 0) {
      final Set<String> conceptStatuses =
          new HashSet<>(metadataService.getConceptStatuses(terminology.getTerminology()).get());
      for (final String cs : getConceptStatus()) {
        if (!conceptStatuses.contains(cs)) {
          throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
              "Parameter 'conceptStatus' has an invalid value = " + cs);
        }
      }
    }

    // Validate synonym source - must be a valid synonym source
    if (getSynonymSource().size() > 0) {
      final Set<String> synonymSources =
          metadataService.getSynonymSources(terminology.getTerminology()).stream()
              .map(c -> c.getCode()).collect(Collectors.toSet());
      for (final String ss : getSynonymSource()) {
        if (!synonymSources.contains(ss)) {
          throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
              "Parameter 'synonymSource' has an invalid value = " + ss);
        }
      }
    }

    // Validate definition source - must be a valid definition source
    if (getDefinitionSource().size() > 0) {
      final Set<String> definitionSources =
          metadataService.getDefinitionSources(terminology.getTerminology()).stream()
              .map(c -> c.getCode()).collect(Collectors.toSet());
      for (final String ss : getDefinitionSource()) {
        if (!definitionSources.contains(ss)) {
          throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
              "Parameter 'definitionSource' has an invalid value = " + ss);
        }
      }
    }

  }

  /**
   * Hash code.
   *
   * @return the int
   */
  /* see superclass */
  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    // result =
    // prime * result + ((association == null) ? 0 :
    // association.hashCode());
    result = prime * result + ((conceptStatus == null) ? 0 : conceptStatus.hashCode());
    result = prime * result + ((definitionSource == null) ? 0 : definitionSource.hashCode());
    result = prime * result + ((fromRecord == null) ? 0 : fromRecord.hashCode());
    result = prime * result + ((include == null) ? 0 : include.hashCode());
    // result = prime * result + ((inverse == null) ? 0 : inverse.hashCode());
    result = prime * result + ((pageSize == null) ? 0 : pageSize.hashCode());
    result = prime * result + ((property == null) ? 0 : property.hashCode());
    // result = prime * result + ((role == null) ? 0 : role.hashCode());
    result = prime * result + ((synonymSource == null) ? 0 : synonymSource.hashCode());
    result = prime * result + ((synonymTermType == null) ? 0 : synonymTermType.hashCode());
    result = prime * result + ((term == null) ? 0 : term.hashCode());
    result = prime * result + ((type == null) ? 0 : type.hashCode());
    result = prime * result + ((subset == null) ? 0 : subset.hashCode());
    return result;
  }

  /**
   * Equals.
   *
   * @param obj the obj
   * @return true, if successful
   */
  /* see superclass */
  @Override
  public boolean equals(final Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    final SearchCriteriaWithoutTerminology other = (SearchCriteriaWithoutTerminology) obj;
    // if (association == null) {
    // if (other.association != null) {
    // return false;
    // }
    // } else if (!association.equals(other.association)) {
    // return false;
    // }
    if (conceptStatus == null) {
      if (other.conceptStatus != null) {
        return false;
      }
    } else if (!conceptStatus.equals(other.conceptStatus)) {
      return false;
    }
    if (definitionSource == null) {
      if (other.definitionSource != null) {
        return false;
      }
    } else if (!definitionSource.equals(other.definitionSource)) {
      return false;
    }
    if (fromRecord == null) {
      if (other.fromRecord != null) {
        return false;
      }
    } else if (!fromRecord.equals(other.fromRecord)) {
      return false;
    }
    if (include == null) {
      if (other.include != null) {
        return false;
      }
    } else if (!include.equals(other.include)) {
      return false;
    }
    // if (inverse == null) {
    // if (other.inverse != null) {
    // return false;
    // }
    // } else if (!inverse.equals(other.inverse)) {
    // return false;
    // }
    if (pageSize == null) {
      if (other.pageSize != null) {
        return false;
      }
    } else if (!pageSize.equals(other.pageSize)) {
      return false;
    }
    if (property == null) {
      if (other.property != null) {
        return false;
      }
    } else if (!property.equals(other.property)) {
      return false;
    }
    // if (role == null) {
    // if (other.role != null) {
    // return false;
    // }
    // } else if (!role.equals(other.role)) {
    // return false;
    // }
    if (synonymSource == null) {
      if (other.synonymSource != null) {
        return false;
      }
    } else if (!synonymSource.equals(other.synonymSource)) {
      return false;
    }
    if (synonymTermType == null) {
      if (other.synonymTermType != null) {
        return false;
      }
    } else if (!synonymTermType.equals(other.synonymTermType)) {
      return false;
    }
    if (subset == null) {
      if (other.subset != null) {
        return false;
      }
    } else if (!subset.equals(other.subset)) {
      return false;
    }
    if (term == null) {
      if (other.term != null) {
        return false;
      }
    } else if (!term.equals(other.term)) {
      return false;
    }
    if (type == null) {
      if (other.type != null) {
        return false;
      }
    } else if (!type.equals(other.type)) {
      return false;
    }
    return true;
  }
}

redpajama_set_name: RedPajamaGithub


text:
package org.jsimpledb.core;

import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.reflect.TypeToken;

import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Pattern;

import org.dellroad.stuff.java.Primitive;
import org.dellroad.stuff.java.PrimitiveSwitch;

/**
 * A registry of {@link FieldType}s.
 *
 *

 * All {@link FieldType}s in a {@link FieldTypeRegistry} are registered under a unique type name.
 * However, multiple registered {@link FieldType}s may support the same {@linkplain FieldType#getTypeToken Java type}.
 *

 *
 *
Arrays

 *
 *

 * Array types will be automatically created and registered on demand, assuming the base element
 * type is already registered.
 *

 *
 *

 * Arrays are passed by value: i.e., the entire array is copied. Therefore, changes to array elements after
 * getting or setting a field have no effect on the field's value.
 *

 *
 *

 * Arrays of references are not currently supported.
 *

 *
 *

 * The following types are automatically registered (or generated on demand):
 *

 *
Primitive types ({@code boolean}, {@code int}, etc.)

 *
Primitive wrapper types ({@link Boolean}, {@link Integer}, etc.)

 *
{@link String}

 *
Array types

 *
{@link Enum} types

 *
{@link java.util.Date}

 *
{@link java.util.UUID}

 *
{@link java.net.URI}

 *
{@link java.io.File}

 *
{@link java.util.regex.Pattern}

 *

 */
public class FieldTypeRegistry {

    /**
     * {@code void} primitive wrapper type (null values not allowed).
     */
    static final VoidType VOID = new VoidType();

    /**
     * {@code Void} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Void> VOID_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.VOID);

    /**
     * {@code boolean} primitive wrapper type (null values not allowed).
     */
    static final BooleanType BOOLEAN = new BooleanType();

    /**
     * {@code Boolean} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Boolean> BOOLEAN_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.BOOLEAN);

    /**
     * {@code byte} primitive wrapper type (null values not allowed).
     */
    static final ByteType BYTE = new ByteType();

    /**
     * {@code Byte} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Byte> BYTE_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.BYTE);

    /**
     * {@code char} primitive wrapper type (null values not allowed).
     */
    static final CharacterType CHARACTER = new CharacterType();

    /**
     * {@code Character} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Character> CHARACTER_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.CHARACTER);

    /**
     * {@code short} primitive wrapper type (null values not allowed).
     */
    static final ShortType SHORT = new ShortType();

    /**
     * {@code Short} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Short> SHORT_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.SHORT);

    /**
     * {@code int} primitive type (null values not allowed).
     */
    static final IntegerType INTEGER = new IntegerType();

    /**
     * {@code Integer} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Integer> INTEGER_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.INTEGER);

    /**
     * {@code float} primitive wrapper type (null values not allowed).
     */
    static final FloatType FLOAT = new FloatType();

    /**
     * {@code Float} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Float> FLOAT_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.FLOAT);

    /**
     * {@code long} primitive wrapper type (null values not allowed).
     */
    static final LongType LONG = new LongType();

    /**
     * {@code Long} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Long> LONG_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.LONG);

    /**
     * {@code double} primitive wrapper type (null values not allowed).
     */
    static final DoubleType DOUBLE = new DoubleType();

    /**
     * {@code Double} primitive wrapper type (null values allowed).
     */
    static final PrimitiveWrapperType<Double> DOUBLE_WRAPPER = new PrimitiveWrapperType<>(FieldTypeRegistry.DOUBLE);

    /**
     * Type for {@link ObjId}s (null values are not allowed).
     */
    static final ObjIdType OBJ_ID = new ObjIdType();

    /**
     * Type for object references with no restriction (null values are allowed).
     */
    static final ReferenceFieldType REFERENCE = new ReferenceFieldType();

    /**
     * Type for {@link String}s.
     */
    static final NullSafeType<String> STRING = new NullSafeType<>(new StringType());

    /**
     * Type for {@link Date}s.
     */
    static final NullSafeType<Date> DATE = new NullSafeType<>(new DateType());

    /**
     * Type for {@link UUID}s.
     */
    static final NullSafeType<UUID> UUID = new NullSafeType<>(new UUIDType());

    /**
     * Type for {@link URI}s.
     */
    static final NullSafeType<URI> URI = new URIType();

    /**
     * Type for {@link File}s.
     */
    static final NullSafeType<File> FILE = new FileType();

    /**
     * Type for {@link Pattern}s.
     */
    static final NullSafeType<Pattern> PATTERN = new PatternType();

    private final HashMap<String, FieldType<?>> typesByName = new HashMap<>();
    private final HashMap<TypeToken<?>, ArrayList<FieldType<?>>> typesByType = new HashMap<>();

    /**
     * Constructor. Creates an instance with all of the pre-defined {@link FieldType}s (e.g., for
     * types such as primitive types, {@link String}, etc.) already registered.
     */
    public FieldTypeRegistry() {
        this.add(FieldTypeRegistry.REFERENCE);
        this.add(FieldTypeRegistry.VOID_WRAPPER);
        this.add(FieldTypeRegistry.BOOLEAN);
        this.add(FieldTypeRegistry.BOOLEAN_WRAPPER);
        this.add(FieldTypeRegistry.BYTE);
        this.add(FieldTypeRegistry.BYTE_WRAPPER);
        this.add(FieldTypeRegistry.SHORT);
        this.add(FieldTypeRegistry.SHORT_WRAPPER);
        this.add(FieldTypeRegistry.CHARACTER);
        this.add(FieldTypeRegistry.CHARACTER_WRAPPER);
        this.add(FieldTypeRegistry.INTEGER);
        this.add(FieldTypeRegistry.INTEGER_WRAPPER);
        this.add(FieldTypeRegistry.FLOAT);
        this.add(FieldTypeRegistry.FLOAT_WRAPPER);
        this.add(FieldTypeRegistry.LONG);
        this.add(FieldTypeRegistry.LONG_WRAPPER);
        this.add(FieldTypeRegistry.DOUBLE);
        this.add(FieldTypeRegistry.DOUBLE_WRAPPER);
        this.add(FieldTypeRegistry.STRING);
        this.add(FieldTypeRegistry.DATE);
        this.add(FieldTypeRegistry.UUID);
        this.add(FieldTypeRegistry.URI);
        this.add(FieldTypeRegistry.FILE);
        this.add(FieldTypeRegistry.PATTERN);
    }

    /**
     * Add multiple user-defined {@link FieldType} to this registry, using newly created instances of the named classes.
     *
     * @param classNames names of classes that implement {@link FieldType}
     * @throws IllegalArgumentException if {@code classNames} is null
     * @throws IllegalArgumentException if {@code classNames} contains a null class or a class with invalid annotation(s)
     * @throws IllegalArgumentException if {@code classNames} contains an invalid {@link FieldType} class
     * @throws RuntimeException if instantiation of a class fails
     */
    public void addNamedClasses(Iterable<String> classNames) {
        Preconditions.checkArgument(classNames != null, "null classNames");
        this.addClasses(Iterables.transform(classNames, new Function<String, Class<? extends FieldType<?>>>() {
            @Override
            @SuppressWarnings("unchecked")
            public Class<? extends FieldType<?>> apply(String name) {
                final Class<?> c;
                try {
                    c = Class.forName(name, false, Thread.currentThread().getContextClassLoader());
                } catch (RuntimeException e) {
                    throw e;
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
                try {
                    return (Class<? extends FieldType<?>>)(Object)c.asSubclass(FieldType.class);
                } catch (ClassCastException e) {
                    throw new IllegalArgumentException("class `" + name + "' does not implement " + FieldType.class, e);
                }
            }
        }));
    }

    /**
     * Add multiple user-defined {@link FieldType} to this registry, using newly created instances of the specified classes.
     *
     * @param classes implementations of types to add
     * @throws IllegalArgumentException if {@code classes} is null
     * @throws IllegalArgumentException if {@code classes} contains a null class or a class with invalid annotation(s)
     * @throws IllegalArgumentException if {@code classes} contains an invalid {@link FieldType} class
     */
    public void addClasses(Iterable<? extends Class<? extends FieldType<?>>> classes) {
        Preconditions.checkArgument(classes != null, "null classes");
        for (Class<? extends FieldType<?>> type : classes)
            this.addClass(type);
    }

    /**
     * Add a user-defined {@link FieldType} to this registry, using a newly created instance of the specified class.
     *
     * @param typeClass implementation of type to add
     * @throws IllegalArgumentException if {@code typeClass} is null
     * @throws IllegalArgumentException if {@code typeClass} cannot be instantiated
     * @throws IllegalArgumentException if the {@linkplain FieldType#getName type name} conflicts with an existing type
     * @throws IllegalArgumentException if the {@linkplain FieldType#getName type name} ends with {@code []} (array name)
     */
    public void addClass(Class<? extends FieldType<?>> typeClass) {

        // Sanity check
        Preconditions.checkArgument(typeClass != null, "null typeClass");

        // Instantiate class
        final FieldType<?> fieldType;
        try {
            fieldType = (FieldType<?>)typeClass.newInstance();
        } catch (Exception e) {
            throw new IllegalArgumentException("can't instantiate " + typeClass, e);
        }

        // Register it
        this.add(fieldType);
    }

    /**
     * Add a user-defined {@link FieldType} to the registry.
     *
     * @param type type to add
     * @return true if type was added, false if type was already registered
     * @throws IllegalArgumentException if {@code type} is null
     * @throws IllegalArgumentException if {@code type} has a name that conflicts with an existing, but different, type
     * @throws IllegalArgumentException if {@code type} has a name that ends with {@code []} (array name)
     */
    public synchronized boolean add(FieldType<?> type) {
        Preconditions.checkArgument(type != null, "null type");
        Preconditions.checkArgument(!type.name.endsWith(ArrayType.ARRAY_SUFFIX), "illegal array type name `" + type.name + "'");
        final FieldType<?> other = this.typesByName.get(type.name);
        if (other != null) {
            if (other.equals(type))
                return false;
            throw new IllegalArgumentException("type name `" + type.name + "' conflicts with existing type " + other);
        }
        this.typesByName.put(type.name, type);
        final TypeToken<?> typeToken = type.getTypeToken();
        if (!this.typesByType.containsKey(typeToken))
            this.typesByType.put(typeToken, Lists.newArrayList(Collections.<FieldType<?>>singleton(type)));
        else
            this.typesByType.get(typeToken).add(type);
        return true;
    }

    /**
     * Get the {@link FieldType} with the given name in this registry.
     *
     * @param name type name
     * @return type with name {@code name}, or null if not found
     * @throws IllegalArgumentException if {@code name} is null
     */
    public synchronized FieldType<?> getFieldType(final String name) {

        // Sanity check
        Preconditions.checkArgument(name != null, "null name");

        // Handle array types
        if (name.endsWith(ArrayType.ARRAY_SUFFIX)) {
            final FieldType<?> elementType = this.getFieldType(name.substring(0, name.length() - ArrayType.ARRAY_SUFFIX.length()));
            return this.getArrayType(elementType);
        }

        // Handle non-array type
        return this.typesByName.get(name);
    }

    /**
     * Get the array {@link FieldType} with the given element type.
     *
     * @param elementType array element type
     * @param <E> array element type
     * @throws IllegalArgumentException if {@code elementType} is null
     * @throws IllegalArgumentException if the resulting array type has too many dimensions
     * @return array type with element type {@code elementType}
     */
    @SuppressWarnings("unchecked")
    public <E> FieldType<E[]> getArrayType(final FieldType<E> elementType) {

        // Sanity check
        Preconditions.checkArgument(elementType != null, "null elementType");

        // Create array type
        final Primitive<?> primitive = Primitive.get(elementType.typeToken.getRawType());
        final ArrayType<?, ?> notNullType = primitive == null ? this.createObjectArrayType(elementType) :
          primitive.visit(new PrimitiveSwitch<ArrayType<?, ?>>() {
            @Override
            public ArrayType<?, ?> caseVoid() {
                throw new IllegalArgumentException("cannot create array of type `" + elementType.name + "'");
            }
            @Override
            public ArrayType<?, ?> caseBoolean() {
                return new BooleanArrayType();
            }
            @Override
            public ArrayType<?, ?> caseByte() {
                return new ByteArrayType();
            }
            @Override
            public ArrayType<?, ?> caseCharacter() {
                return new CharacterArrayType();
            }
            @Override
            public ArrayType<?, ?> caseShort() {
                return new ShortArrayType();
            }
            @Override
            public ArrayType<?, ?> caseInteger() {
                return new IntegerArrayType();
            }
            @Override
            public ArrayType<?, ?> caseFloat() {
                return new FloatArrayType();
            }
            @Override
            public ArrayType<?, ?> caseLong() {
                return new LongArrayType();
            }
            @Override
            public ArrayType<?, ?> caseDouble() {
                return new DoubleArrayType();
            }
        });
        return (FieldType<E[]>)this.createNullSafeType(notNullType);
    }

    /**
     * Get all {@link FieldType}s in this registry that supports values of the given Java type, which must
     * exactly match the {@link FieldType}'s {@linkplain FieldType#getTypeToken supported Java type}.
     *
     * @param typeToken field value type
     * @param <T> field value type
     * @return unmodifiable list of {@link FieldType}s supporting Java values of type {@code typeToken}
     * @throws IllegalArgumentException if {@code typeToken} is null
     */
    @SuppressWarnings("unchecked")
    public synchronized <T> List<FieldType<T>> getFieldTypes(TypeToken<T> typeToken) {

        // Sanity check
        Preconditions.checkArgument(typeToken != null, "null typeToken");

        // Handle array types
        final TypeToken<?> elementTypeToken = typeToken.getComponentType();
        if (elementTypeToken != null) {
            final ArrayList<FieldType<T>> fieldTypes = new ArrayList<FieldType<T>>();
            for (FieldType<?> elementFieldType : this.getFieldTypes(elementTypeToken))
                fieldTypes.add((FieldType<T>)this.getArrayType(this.getFieldType(elementTypeToken)));
            return Collections.unmodifiableList(fieldTypes);
        }

        // Handle non-array types
        final ArrayList<FieldType<T>> fieldTypes = (ArrayList<FieldType<T>>)(Object)this.typesByType.get(typeToken);
        return fieldTypes != null ? Collections.unmodifiableList(fieldTypes) : Collections.<FieldType<T>>emptyList();
    }

    /**
     * Get the unique {@link FieldType} in this registry that supports values of the given Java type, which must
     * exactly match the {@link FieldType}'s {@linkplain FieldType#getTypeToken supported Java type}.
     * There must be exactly one such {@link FieldType}, otherwise an {@link IllegalArgumentException} is thrown.
     *
     * @param typeToken field value type
     * @param <T> field value type
     * @return {@link FieldType} supporting Java values of type {@code typeToken}
     * @throws IllegalArgumentException if {@code typeToken} is null
     * @throws IllegalArgumentException if no registered {@link FieldType}s supports {@code typeToken}
     * @throws IllegalArgumentException if more than one registered {@link FieldType} supports {@code typeToken}
     */
    public <T> FieldType<T> getFieldType(TypeToken<T> typeToken) {
        final List<FieldType<T>> fieldTypes = this.getFieldTypes(typeToken);
        switch (fieldTypes.size()) {
        case 0:
            throw new IllegalArgumentException("no registered types support values of type " + typeToken);
        case 1:
            return fieldTypes.get(0);
        default:
            throw new IllegalArgumentException("multiple registered types support values of type " + typeToken + ": " + fieldTypes);
        }
    }

    /**
     * Get all types registered with this instance.
     *
     * @return mapping from type name to type
     */
    public synchronized Map<String, FieldType<?>> getAll() {
        return new HashMap<String, FieldType<?>>(this.typesByName);
    }

    // This method exists solely to bind the generic type parameters
    private <E> ObjectArrayType<E> createObjectArrayType(FieldType<E> elementType) {
        return new ObjectArrayType<E>(elementType);
    }

    // This method exists solely to bind the generic type parameters
    private <T> NullSafeType<T> createNullSafeType(FieldType<T> notNullType) {
        return new NullSafeType<T>(notNullType);
    }
}


text:
function addLogPrefix(prefix, args) {
  return [].concat.apply([prefix], args);
}

module Shumway.Shell {

}


text:
.user-profile .header .avatar {
  float: left;
  margin-right: 25px;
  border: 2px solid #e9ecee;
  position: relative;
  top: 3px; }
.user-profile .header .name {
  font-weight: 600;
  margin: 20px 0 8px 0;
  line-height: 26px;
  margin-bottom: 10px;
  float: none; }
.user-profile .header span.area {
  color: #7d848c;
  font-style: italic;
  font-size: 14px; }
.user-profile .header a.btn-flat {
  margin-top: 18px; }
.user-profile .header a.delete-user {
  margin-left: 10px;
  font-size: 14px; }
.user-profile .profile .profile-box {
  border-top: 1px solid #dde2e9;
  padding-top: 23px;
  width: 90%; }
.user-profile .profile .section {
  margin-bottom: 80px; }
  .user-profile .profile .section.comment {
    margin-bottom: 100px;
    margin-top: 60px; }
.user-profile .profile .bio {
  box-shadow: 4px 0px 3px -1px rgba(226, 226, 226, 0.1);
  border-right: 1px solid #edeef1; }
  .user-profile .profile .bio .span12 {
    margin-left: 0; }
  .user-profile .profile .bio h6 {
    font-weight: 600;
    font-size: 14px; }
  .user-profile .profile .bio p {
    color: #777e86; }
  .user-profile .profile .bio textarea {
    width: 97%;
    margin-bottom: 13px;
    height: 80px; }
  .user-profile .profile .bio .submit-box {
    text-align: right; }
    .user-profile .profile .bio .submit-box input.btn-flat {
      font-weight: 500; }
    .user-profile .profile .bio .submit-box span {
      text-transform: uppercase;
      color: #7e91aa;
      font-weight: 600;
      display: inline-block;
      vertical-align: middle;
      margin: 0 2px 0 8px; }
    .user-profile .profile .bio .submit-box input.reset {
      color: #7e91aa;
      font-weight: 500; }
.user-profile .address h6 {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 30px;
  margin-left: 30px; }
.user-profile .address iframe {
  width: 90%;
  margin-bottom: 30px;
  float: right; }
.user-profile .address ul {
  padding: 0;
  margin-left: 30px;
  list-style: none; }
  .user-profile .address ul li {
    font-size: 13px;
    line-height: 21px; }
    .user-profile .address ul li.ico-li {
      margin: 7px 0 7px; }
  .user-profile .address ul i {
    display: inline-block;
    position: relative;
    top: 4px;
    margin-right: 7px; }
    .user-profile .address ul i.ico-mail {
      margin-right: 5px; }

/* responsive */
@media (min-width: 768px) and (max-width: 979px) {
  .user-profile .address ul {
    margin-left: 18px; }
    .user-profile .address ul i {
      display: none; }
    .user-profile .address ul li.ico-li {
      font-weight: bold; }
      .user-profile .address ul li.ico-li a {
        font-weight: normal; } }
@media (max-width: 767px) {
  .user-profile .profile .bio {
    border-right: 0 none;
    border-bottom: 1px solid #edeef1;
    box-shadow: 0px 4px 3px -1px rgba(226, 226, 226, 0.1); }
    .user-profile .profile .bio .span12 {
      width: auto; }
  .user-profile .profile .profile-box {
    width: 100%; }
  .user-profile .address {
    margin-top: 44px; }
    .user-profile .address iframe {
      width: 100%; }
    .user-profile .address h6 {
      margin-left: 0; }
    .user-profile .address ul {
      margin: 0; }
  .user-profile .header a.btn-flat {
    margin: 0; }
  .user-profile .header a.edit {
    margin-right: 10px; } }
@media (max-width: 480px) {
  .user-profile .header a.btn-flat {
    margin: 0; }
  .user-profile .header a.edit {
    margin-right: 10px; } }


text:
<?php

namespace Simnang\LoanPro\Constants;

/**
 * Class EMPLOYERS
 * @package Simnang\LoanPro\Constants
 */
class EMPLOYERS{
    const ADDRESS               = 'Address';
    const CUSTOM_FIELD_VALUES   = 'CustomFieldValues';
    const COMPANY_NAME          = 'companyName';
    const TITLE                 = 'title';
    const PHONE                 = 'phone';
    const INCOME                = 'income';
    const INCOME_FREQUENCY__C   = 'incomeFrequency';
    const HIRE_DATE             = 'hireDate';
    const PAY_DATE              = 'payDate';
    const PAY_DATE_FREQUENCY__C = 'payDateFrequency';
    const ACTIVE                = 'active';
    const CREATED               = 'created';
}


text:
NovuscodeLibrary
================

A Delphi library of utility functions and non-visual classes.

Support for Delphi XE - Delphi 11

Library Features
--------

* Shell and Capture functions.
* Log functions.
* Template and Parser functions.
* Plugin functions

How to install
--------------

\Source\Packages\DELPHIXXX

1. NovusCodeLibrary_Core.dpk - Common Base to all functions in the library.

2. NovusCodeLibrary_Env.dpk - Environment functions library.

3. NovusCodeLibrary_Indy.dpk - Indy functions library. Requires http://indyproject.org

4. NovusCodeLibrary_Log.dpk - Log functions library.

5. NovusCodeLibrary_Parser.dpk - Template and Parser functions library.

6. NovusCodeLibrary_Plugin.dpk - Plugin functions library.

7. NovusCodeLibrary_SQLDir.dpk - SQLDirect functions library. Requires http://sql-direct.com/

8. NovusCodeLibrary_VCLUtils.dpk - VCL function library.

9. NovusCodeLibrary_XML.dpk - XML functions library. Requires http://jvcl.delphi-jedi.org/

10. NovusCodeLibrary_Console.dpk - Console and CLI Library.

11. NovusCodeLibrary_WebUtils.dpk - Web functions library.

12. NovusCodeLibrary_cURL.dpk - cURL function library. Requires https://github.com/Mercury13/curl4delphi

Changelog
---------

[Changelog](https://github.com/novuslogic/NovuscodeLibrary/blob/master/Changelog.md)

Licence
-------
[Apache License Version 2.0](LICENSE)


text:
SYNONYM

#### According to
GRIN Taxonomy for Plants

#### Published in
Studies in Calenduleae 1:89. 1943

#### Original name
null

### Remarks
null


text:
def main():
    from IPython.parallel.apps import ipcontrollerapp as app
    app.launch_new_instance()

if __name__ == '__main__':
    main()


text:
package broker

import (
	"bytes"
	"log"
	"math/rand"
	"strconv"
	"testing"
	"time"

	"github.com/kr/beanstalk"
)

const (
	address    = "127.0.0.1:11300"
	defaultTtr = 10 * time.Second
)

// TestWorkerSuccess demonstrates a successful exit(0) task (delete).
func TestWorkerSuccess(t *testing.T) {
	tube, id := queueJob("hello world", 10, defaultTtr)
	expectStdout := []byte("HELLO WORLD")

	cmd := "tr [a-z] [A-Z]"
	results := make(chan *JobResult)
	b := New(address, tube, 0, cmd, results)

	ticks := make(chan bool)
	defer close(ticks)
	go b.Run(ticks)
	ticks <- true // handle a single job

	result := <-results

	if result.JobId != id {
		t.Fatalf("result.JobId %d != queueJob id %d", result.JobId, id)
	}
	if !bytes.Equal(result.Stdout, expectStdout) {
		t.Fatalf("Stdout mismatch: '%s' != '%s'\n", result.Stdout, expectStdout)
	}
	if result.ExitStatus != 0 {
		t.Fatalf("Unexpected exit status %d", result.ExitStatus)
	}

	assertTubeEmpty(tube)
}

// TestWorkerFailure demonstrates a failed exit(1) task (release).
func TestWorkerFailure(t *testing.T) {
	tube, id := queueJob("hello world", 10, defaultTtr)

	cmd := "false"
	results := make(chan *JobResult)
	b := New(address, tube, 0, cmd, results)

	ticks := make(chan bool)
	defer close(ticks)
	go b.Run(ticks)
	ticks <- true // handle a single job

	result := <-results

	if result.JobId != id {
		t.Fatalf("result.JobId %d != queueJob id %d", result.JobId, id)
	}

	if result.ExitStatus != 1 {
		t.Fatalf("result.ExitStatus %d, expected 1", result.ExitStatus)
	}

	assertJobStat(t, id, "state", "ready")
	assertJobStat(t, id, "releases", "1")
	assertJobStat(t, id, "pri", "10")
}

func TestWorkerTimeout(t *testing.T) {
	ttr := 1 * time.Second
	tube, id := queueJob("TestWorkerTimeout", 10, ttr)

	cmd := "sleep 4"
	results := make(chan *JobResult)
	b := New(address, tube, 0, cmd, results)

	ticks := make(chan bool)
	defer close(ticks)
	go b.Run(ticks)

	start := time.Now()
	ticks <- true // handle a single job
	result := <-results
	duration := time.Since(start)

	if duration < 1*time.Second {
		t.Fatalf("%v too short to have timed out correctly", duration)
	}

	if !result.TimedOut {
		t.Fatalf("Expected job %d JobResult.TimedOut to be true", id)
	}

	assertJobStat(t, id, "state", "ready")
	assertJobStat(t, id, "timeouts", "1")

	ticks <- true // handle another job
	result = <-results
	if !result.Buried {
		t.Fatalf("Expected job %d JobResult.Buried", id)
	}
	assertJobStat(t, id, "state", "buried")
	assertJobStat(t, id, "timeouts", "1")
}

func queueJob(body string, priority uint32, ttr time.Duration) (string, uint64) {
	r := rand.New(rand.NewSource(time.Now().UnixNano()))
	tubeName := "cmdstalk-test-" + strconv.FormatInt(r.Int63(), 16)
	assertTubeEmpty(tubeName)

	c, err := beanstalk.Dial("tcp", address)
	if err != nil {
		log.Fatal(err)
	}

	tube := beanstalk.Tube{Conn: c, Name: tubeName}

	id, err := tube.Put([]byte(body), priority, 0, ttr)
	if err != nil {
		log.Fatal(err)
	}

	return tubeName, id
}

func assertTubeEmpty(tubeName string) {
	// TODO
}

func assertJobStat(t *testing.T, id uint64, key, value string) {
	c, err := beanstalk.Dial("tcp", address)
	if err != nil {
		t.Fatal(err)
	}
	stats, err := c.StatsJob(id)
	if err != nil {
		t.Fatal(err)
	}
	if stats[key] != value {
		t.Fatalf("job %d %s = %s, expected %s", id, key, stats[key], value)
	}
}


text:
from django.urls import include, path
from rest_framework import routers

from .views import ExamplesView, JobsView, QueryView
from .viewsets import (DropdownViewSet, ExampleViewSet, FormViewSet,
                       PhaseViewSet, QueryJobViewSet, QueryLanguageViewSet,
                       QueueViewSet, StatusViewSet)

app_name = 'query'

router = routers.DefaultRouter()
router.register(r'status', StatusViewSet, basename='status')
router.register(r'forms', FormViewSet, basename='form')
router.register(r'dropdowns', DropdownViewSet, basename='dropdown')
router.register(r'jobs', QueryJobViewSet, basename='job')
router.register(r'examples', ExampleViewSet, basename='example')
router.register(r'queues', QueueViewSet, basename='queue')
router.register(r'querylanguages', QueryLanguageViewSet, basename='querylanguage')
router.register(r'phases', PhaseViewSet, basename='phase')

urlpatterns = [
    path(r'', QueryView.as_view(), name='query'),
    path(r'jobs/', JobsView.as_view(), name='jobs'),
    path(r'examples/', ExamplesView.as_view(), name='examples'),

    # rest api
    path(r'api/', include(router.urls)),
]


text:
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var xenon_1 = require("xenon");
var HierarchicalRefinementFilter = (function (_super) {
    __extends(HierarchicalRefinementFilter, _super);
    function HierarchicalRefinementFilter() {
        _super.apply(this, arguments);
    }
    return HierarchicalRefinementFilter;
}(xenon_1.Component));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = HierarchicalRefinementFilter;
//# sourceMappingURL=HierarchicalRefinementFilter.js.map


text:
@implementation BMXSwipableCellGestureDelegate {
    UITableViewCell __weak *_cell;
}

- (instancetype)initWithCell:(UITableViewCell* )cell
{
    self = [super init];
    if (self) {
        _cell = cell;
    }
    return self;

}

#pragma mark - UIGestureRecognizerDelegate

- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gesture {
    CGPoint translation = [gesture translationInView: _cell.superview];
    return (fabsf(translation.x) > fabsf(translation.y));
}

@end


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<title>Modules - ZeroSDN</title>
<link rel="stylesheet"
	href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />

<link rel="stylesheet" href="css/style.css" />

Logging

Modules

Topology

Modules

		<button type="button" ng-click="update()" class="btn btn-sm">
			 Update
		</button>

					Name
					Unique ID
					Status
					Enable/Disable
					Stop

					{{row.name}}
					{{row.UniqueId}}
					{{row.currentState}}

						<button type="button" ng-click="changeState(row)"
							class="btn btn-sm">
							Enable/Disable
						</button>

						<button type="button" ng-click="stopModule(row)"
							class="btn btn-sm btn-danger">
							 Stop
						</button>


text:
package EDU.purdue.cs.bloat.editor;

/**
 * LocalVariable represents a local variable index operand to various
 * instructions.
 *
 * @author Nate Nystrom (<a
 *         href="mailto:nystrom@cs.purdue.edu">nystrom@cs.purdue.edu</a>)
 */
public class LocalVariable {
	private String name;

	private Type type;

	private int index;

	/**
	 * Constructor.
	 *
	 * @param index
	 *            The index of the local variable in the method's local variable
	 *            array.
	 */
	public LocalVariable(final int index) {
		this.name = null;
		this.type = null;
		this.index = index;
	}

	/**
	 * Constructor.
	 *
	 * @param name
	 *            The name of the local variable.
	 * @param type
	 *            The descriptor (or index into the constant pool) representing
	 *            the variable type.
	 * @param index
	 *            The index of the local variable in the method's local variable
	 *            array.
	 */
	public LocalVariable(final String name, final Type type, final int index) {
		this.name = name;
		this.type = type;
		this.index = index;
	}

	/**
	 * Hash the local variable.
	 *
	 * A stricter hashing than using the index will break Hashtable lookups
	 * since a variable could have a name assigned to it after its first use.
	 *
	 * @return The hash code.
	 */
	public int hashCode() {
		return index;
	}

	/**
	 * Check if an object is equal to this variable.
	 *
	 * A stricter comparison than comparing indices will break Hashtable lookups
	 * since a variable could have a name assigned to it after its first use.
	 *
	 * @param obj
	 *            The object to compare against.
	 * @return true if equal, false if not.
	 */
	public boolean equals(final Object obj) {
		return (obj != null) && (obj instanceof LocalVariable)
				&& (((LocalVariable) obj).index == index);
	}

	/**
	 * Get the name of the local variable.
	 *
	 * @return The name of the local variable.
	 */
	public String name() {
		return name;
	}

	/**
	 * Get the type of the local variable.
	 *
	 * @return The type of the local variable.
	 */
	public Type type() {
		return type;
	}

	/**
	 * Get the index into the local variable array.
	 *
	 * @return The index into the local variable array.
	 */
	public int index() {
		return index;
	}

	/**
	 * Convert the variable to a string.
	 *
	 * @return A string representation of the variable.
	 */
	public String toString() {
		if (name == null) {
			return "Local$" + index;
		}

		return name + "$" + index;
	}
}


text:
warning: 'This file is auto generated by `npm run web:inject`, do not edit by hand'
examples:
  - is_unicode('We the peoples of the United Nations...!')
estarget: es5
returns:
  - 'true'
dependencies: []
authors:
  original by:
    - 'Brett Zamir (https://brett-zamir.me)'
notes:
  - Almost all strings in JavaScript should be Unicode
type: function
layout: function
title: PHP's is_unicode in JavaScript
description: >-
  Here's what our current JavaScript equivalent to PHP's is_unicode
  looks like.
function: is_unicode
category: var
language: php
permalink: php/var/is_unicode/
alias:
  - /functions/php/is_unicode/
  - /functions/var/is_unicode/
  - /php/is_unicode/
  - /functions/is_unicode/
---
{% codeblock lang:javascript %}module.exports = function is_unicode (vr) { // eslint-disable-line camelcase
  //  discuss at: https://locutus.io/php/is_unicode/
  // original by: Brett Zamir (https://brett-zamir.me)
  //      note 1: Almost all strings in JavaScript should be Unicode
  //   example 1: is_unicode('We the peoples of the United Nations...!')
  //   returns 1: true

  if (typeof vr !== 'string') {
    return false
  }

  // If surrogates occur outside of high-low pairs, then this is not Unicode
  var arr = []
  var highSurrogate = '[\uD800-\uDBFF]'
  var lowSurrogate = '[\uDC00-\uDFFF]'
  var highSurrogateBeforeAny = new RegExp(highSurrogate + '([\\s\\S])', 'g')
  var lowSurrogateAfterAny = new RegExp('([\\s\\S])' + lowSurrogate, 'g')
  var singleLowSurrogate = new RegExp('^' + lowSurrogate + '$')
  var singleHighSurrogate = new RegExp('^' + highSurrogate + '$')

  while ((arr = highSurrogateBeforeAny.exec(vr)) !== null) {
    if (!arr[1] || !arr[1].match(singleLowSurrogate)) {
      // If high not followed by low surrogate
      return false
    }
  }
  while ((arr = lowSurrogateAfterAny.exec(vr)) !== null) {
    if (!arr[1] || !arr[1].match(singleHighSurrogate)) {
      // If low not preceded by high surrogate
      return false
    }
  }

  return true
}
{% endcodeblock %}


text:
package dbService.dao;

import dbService.dataSets.UsersDataSet;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

/**
 * @author v.chibrikov
 *

 *         Пример кода для курса на https://stepic.org/
 *

 *         Описание курса и лицензия: https://github.com/vitaly-chibrikov/stepic_java_webserver
 */
public class UsersDAO {

    private Session session;

    public UsersDAO(Session session) {
        this.session = session;
    }

    public UsersDataSet get(long id) throws HibernateException {
        return (UsersDataSet) session.get(UsersDataSet.class, id);
    }

    public long getUserId(String name) throws HibernateException {
        Criteria criteria = session.createCriteria(UsersDataSet.class);
        return ((UsersDataSet) criteria.add(Restrictions.eq("name", name)).uniqueResult()).getId();
    }

    public long insertUser(String name) throws HibernateException {
        return (Long) session.save(new UsersDataSet(name));
    }
}


text:
package org.apache.pig.test;

import junit.framework.Assert;
import junit.framework.TestCase;

import org.apache.pig.EvalFunc;
import org.apache.pig.PigServer;
import org.apache.pig.data.BagFactory;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.Tuple;
import org.apache.pig.test.utils.TestHelper;
import org.junit.Test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.text.DecimalFormat;
import java.util.Iterator;

public class TestLocal2 extends TestCase {

    private String initString = "local";
    //MiniCluster cluster = MiniCluster.buildCluster();

    private PigServer pig ;

    public TestLocal2() throws Throwable {
        pig = new PigServer(initString) ;
    }

    @Test
    public void testUnion1() throws Exception {
        File tmpFile1 = genDataSetFile(false, 30 ) ;
        File tmpFile2 = genDataSetFile(false, 50 ) ;
        pig.registerQuery("a = load '"
                + Util.generateURI(tmpFile1.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("b = load '"
                + Util.generateURI(tmpFile2.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("c = union a, b; ") ;

        verifyUnion( "c", 30 + 50 );
    }

    @Test
    public void testUnion1WithNulls() throws Exception {

        File tmpFile1 = genDataSetFile(true, 30 ) ;
        File tmpFile2 = genDataSetFile(true, 50 ) ;
        pig.registerQuery("a = load '"
                + Util.generateURI(tmpFile1.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("b = load '"
                + Util.generateURI(tmpFile2.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("c = union a, b; ") ;

        verifyUnion( "c", 30 + 50 );
    }

    @Test
    public void testUnion2() throws Exception {

        File tmpFile1 = genDataSetFile(false, 30) ;
        File tmpFile2 = genDataSetFile(false, 50) ;
        pig.registerQuery("a = load '"
                + Util.generateURI(tmpFile1.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("b = load '"
                + Util.generateURI(tmpFile2.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("a1 = foreach a generate $0, $1; ") ;
        pig.registerQuery("b1 = foreach b generate $0, $1; ") ;
        pig.registerQuery("c = union a1, b1; ") ;

        verifyUnion( "c", 30 + 50 );
    }

    @Test
    public void testUnion2WithNulls() throws Exception {
        File tmpFile1 = genDataSetFile(true, 30) ;
        File tmpFile2 = genDataSetFile(true, 50) ;
        pig.registerQuery("a = load '"
                + Util.generateURI(tmpFile1.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("b = load '"
                + Util.generateURI(tmpFile2.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("a1 = foreach a generate $0, $1; ") ;
        pig.registerQuery("b1 = foreach b generate $0, $1; ") ;
        pig.registerQuery("c = union a1, b1; ") ;

        verifyUnion( "c", 30 + 50 );
    }

    @Test
    public void testPig800Distinct() throws Exception {
        // Regression test for Pig-800
        File fp1 = File.createTempFile("test", "txt");
        PrintStream ps = new PrintStream(new FileOutputStream(fp1));

        ps.println("1\t1}");
        ps.close();

        pig.registerQuery("A = load '"
                + Util.generateURI(fp1.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("B = foreach A generate flatten("
                + Pig800Udf.class.getName() + "($0));");
        pig.registerQuery("C = distinct B;");

        Iterator<Tuple> iter = pig.openIterator("C");
        // Before PIG-800 was fixed this went into an infinite loop, so just
        // managing to open the iterator is sufficient.

    }

    @Test
    public void testPig800Sort() throws Exception {
        // Regression test for Pig-800
        File fp1 = File.createTempFile("test", "txt");
        PrintStream ps = new PrintStream(new FileOutputStream(fp1));

        ps.println("1\t1}");
        ps.close();

        pig.registerQuery("A = load '"
                + Util.generateURI(fp1.toString(), pig.getPigContext())
                + "'; ");
        pig.registerQuery("B = foreach A generate flatten("
                + Pig800Udf.class.getName() + "($0));");
        pig.registerQuery("C = order B by $0;");

        Iterator<Tuple> iter = pig.openIterator("C");
        // Before PIG-800 was fixed this went into an infinite loop, so just
        // managing to open the iterator is sufficient.

    }

    @Test
    public void testJoin1() throws Exception {
        // Regression test for Pig-925
        File fp1 = File.createTempFile("test1", "txt");
        PrintStream ps = new PrintStream(new FileOutputStream(fp1));

        ps.println("1\t1");
        ps.println("2\t2");
        ps.close();

        File fp2 = File.createTempFile("test2", "txt");
        ps = new PrintStream(new FileOutputStream(fp2));

        ps.println("1\t1");
        ps.println("2\t2");
        ps.close();

        pig.registerQuery("A = load '"
                + Util.generateURI(fp1.toString(), pig.getPigContext())
                + "'AS (a0:int, a1:int); ");
        pig.registerQuery("B = load '"
                + Util.generateURI(fp2.toString(), pig.getPigContext())
                + "'AS (b0:int, b1:int); ");
        pig.registerQuery("C = join A by a0, B by b0;");

        Iterator<Tuple> iter = pig.openIterator("C");
        assertTrue(iter.hasNext());
        Tuple t = iter.next();
        assertTrue(t.get(0).equals(new Integer(1)));
        assertTrue(t.get(1).equals(new Integer(1)));
        assertTrue(t.get(2).equals(new Integer(1)));
        assertTrue(t.get(3).equals(new Integer(1)));

        assertTrue(iter.hasNext());
        t = iter.next();
        assertTrue(t.get(0).equals(new Integer(2)));
        assertTrue(t.get(1).equals(new Integer(2)));
        assertTrue(t.get(2).equals(new Integer(2)));
        assertTrue(t.get(3).equals(new Integer(2)));

        assertTrue(!iter.hasNext());
    }

    static public class Pig800Udf extends EvalFunc<DataBag> {

        @Override
        public DataBag exec(Tuple input) throws IOException {
            DataBag output = BagFactory.getInstance().newDefaultBag();
            return output;
        }
    }

    //verifies results
    public void verifyUnion(String id, int actualCount ) throws Exception {

        Iterator<Tuple> it = pig.openIterator(id);
        Tuple t = null ;
        int count = 0 ;

        while(it.hasNext()) {
            t = it.next() ;
            System.out.println(count + ":" + t) ;
            count++ ;
        }

        Assert.assertEquals(count, actualCount);
    }

    @Test
    public void testLocalInit() throws Exception {
        File pigFile = new File("script.pig");
        File siteFile = new File("mapred-site.xml");
        try {
            pigFile.createNewFile();
            int status,status2;
            status = Util.executeJavaCommand("java -cp "+
                    System.getProperty("java.class.path") +
                    "  org.apache.pig.Main -x local " + pigFile.getAbsolutePath() );

            String contents = "<?xml version=\"1.0\"?>\n" +
            "<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?>\n" +
            "<configuration xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n" +
            "  <property>\n" +
            "    <name>mapred.system.dir</name>\n" +
            "    <value>/mapredsystem/hadoop/mapredsystem</value>\n" +
            "    <description>No description</description>\n" +
            "    <final>true</final>\n" +
            "  </property>\n" +
            "</configuration>\n";
            assertTrue( siteFile.createNewFile() );
            PrintStream ps = new PrintStream(siteFile);
            ps.print(contents);
            ps.close();
            status2 = Util.executeJavaCommand("java -cp "+
                    System.getProperty("java.class.path") +
                    "  org.apache.pig.Main -x local " + pigFile.getAbsolutePath() );
            assertEquals( "Without a mapred-site.xml pig should just run", 0, status );
            assertEquals( "With map.system.dir redefined in mapred-site.xml pig " +
                    "should exit", 2, status2 );
        } finally {
            if( siteFile.exists() )
                siteFile.delete();
            if( pigFile.exists() )
                pigFile.delete();
        }
    }

    /***
     * For generating a sample dataset
     */
    private File genDataSetFile(boolean hasNulls, int dataLength ) throws IOException {

        String[][] data = new String[dataLength][] ;

        DecimalFormat formatter = new DecimalFormat("0000000");

        if ( hasNulls == true ) {

                for (int i = 0; i < dataLength; i++) {

                     data[i] = new String[2] ;
                     if ( i % 7  == 0 ) {
                        data[i][0] = "";
                        data[i][1] = formatter.format(dataLength - i);

                     } else if ( i % 10 ==0  ) {

                        data[i][0] = formatter.format(i % 10);
                        data[i][1] = "";

                     } else if ( i % 13 == 0 ) {

                        data[i][0] = "";
                        data[i][1] = "";

                     } else {
                        data[i][0] = formatter.format(i % 10);
                        data[i][1] = formatter.format(dataLength - i);
                     }
             }

        } else {

            for (int i = 0; i < dataLength; i++) {
                data[i] = new String[2] ;
                data[i][0] = formatter.format(i % 10);
                data[i][1] = formatter.format(dataLength - i);
            }

        }
        return TestHelper.createTempFile(data) ;
    }

}


text:
layout: page
title: Chandler Financial Conference
date: 2016-05-24
author: Stephen Ellison
tags: weekly links, java
status: published
summary: Ut tristique consectetur lectus, vitae molestie velit rutrum id. Mauris.
banner: images/banner/people.jpg
booking:
  startDate: 04/09/2017
  endDate: 04/11/2017
  ctyhocn: DVNPTHX
  groupCode: CFC
published: true
---
Mauris porttitor eu lectus a pulvinar. Integer vel augue rutrum, tempor elit eleifend, congue dolor. Fusce aliquet, mi eu consectetur accumsan, eros elit tristique diam, ut tristique felis nulla eget orci. Vivamus sit amet congue urna. Nulla neque neque, dapibus id nisl posuere, luctus volutpat lacus. Nullam a odio dapibus nisl aliquam pulvinar et ac mi. Sed eu sem lorem. Etiam euismod venenatis erat, ut dictum elit posuere vel. Nullam enim nisi, ornare a porttitor in, semper a ligula. Sed non libero ut turpis ornare sodales.
Vestibulum vitae fringilla risus. Duis molestie felis sit amet turpis sagittis consectetur. Maecenas quis libero luctus, feugiat ex id, consectetur erat. Vestibulum mollis placerat euismod. Vivamus vel aliquam tellus. Integer vestibulum est nisi. Cras id vestibulum nisi. Integer bibendum sed nisi a vulputate. Pellentesque tincidunt, diam vitae accumsan tincidunt, metus erat ultrices purus, eget fringilla ante elit non erat. Curabitur volutpat tortor ligula, eget tincidunt purus accumsan ut. Praesent malesuada, est id sodales sodales, metus metus luctus turpis, quis tristique turpis tellus id dui.

* Nunc et erat at elit ultrices fringilla bibendum interdum diam
* Nunc congue nulla non sodales venenatis
* Suspendisse vitae odio bibendum augue congue consequat
* Aenean pulvinar orci vel dui tempor feugiat.

Pellentesque ante purus, imperdiet malesuada dignissim nec, placerat vitae turpis. In faucibus nibh ut maximus porttitor. Nullam vitae nulla sed augue mollis elementum vitae ut magna. Sed sit amet ante eu nulla lacinia rhoncus a quis nibh. Sed semper euismod enim maximus gravida. Nulla rhoncus faucibus scelerisque. Proin neque ipsum, pellentesque ut lacus non, pretium cursus felis. Nulla in nulla et turpis semper sodales ut facilisis ante. Quisque vel metus nec justo sagittis lobortis. Maecenas nec elit eget arcu iaculis maximus non ac odio. Donec venenatis fringilla odio.


text:
#pragma once
#ifndef EL_DISTMATRIX_MC_STAR_DECL_HPP
#define EL_DISTMATRIX_MC_STAR_DECL_HPP

namespace El {

// Partial specialization to A[MC,* ].
//
// The rows of these distributed matrices will be replicated on all
// processes (*), and the columns will be distributed like "Matrix Columns"
// (MC). Thus the columns will be distributed among columns of the process
// grid.
template<typename T>
class DistMatrix<T,MC,STAR> : public AbstractDistMatrix<T>
{
public:
    // Typedefs
    // ========
    typedef AbstractDistMatrix<T> absType;
    typedef DistMatrix<T,MC,STAR> type;

    // Constructors and destructors
    // ============================

    // Create a 0 x 0 distributed matrix
    DistMatrix( const El::Grid& g=DefaultGrid(), int root=0 );
    // Create a height x width distributed matrix
    DistMatrix
    ( Int height, Int width, const El::Grid& g=DefaultGrid(), int root=0 );
    // Create a copy of distributed matrix (redistribute if necessary)
    DistMatrix( const type& A );
    DistMatrix( const absType& A );
    template<Dist U,Dist V> DistMatrix( const DistMatrix<T,U,V>& A );
    template<Dist U,Dist V> DistMatrix( const BlockDistMatrix<T,U,V>& A );
    // Move constructor
    DistMatrix( type&& A ) EL_NOEXCEPT;
    // Destructor
    ~DistMatrix();

    DistMatrix<T,MC,STAR>* Construct
    ( const El::Grid& g, int root ) const override;
    DistMatrix<T,STAR,MC>* ConstructTranspose
    ( const El::Grid& g, int root ) const override;
    DistMatrix<T,MC,STAR>* ConstructDiagonal
    ( const El::Grid& g, int root ) const override;

    // Operator overloading
    // ====================

    // Return a view
    // -------------
          type operator()( Range<Int> I, Range<Int> J );
    const type operator()( Range<Int> I, Range<Int> J ) const;

    // Make a copy
    // -----------
    type& operator=( const absType& A );
    type& operator=( const DistMatrix<T,MC,  MR  >& A );
    type& operator=( const DistMatrix<T,MC,  STAR>& A );
    type& operator=( const DistMatrix<T,STAR,MR  >& A );
    type& operator=( const DistMatrix<T,MD,  STAR>& A );
    type& operator=( const DistMatrix<T,STAR,MD  >& A );
    type& operator=( const DistMatrix<T,MR,  MC  >& A );
    type& operator=( const DistMatrix<T,MR,  STAR>& A );
    type& operator=( const DistMatrix<T,STAR,MC  >& A );
    type& operator=( const DistMatrix<T,VC,  STAR>& A );
    type& operator=( const DistMatrix<T,STAR,VC  >& A );
    type& operator=( const DistMatrix<T,VR,  STAR>& A );
    type& operator=( const DistMatrix<T,STAR,VR  >& A );
    type& operator=( const DistMatrix<T,STAR,STAR>& A );
    type& operator=( const DistMatrix<T,CIRC,CIRC>& A );
    template<Dist U,Dist V> type& operator=( const BlockDistMatrix<T,U,V>& A );

    // Move assignment
    // ---------------
    type& operator=( type&& A );

    // Rescaling
    // ---------
    const type& operator*=( T alpha );

    // Addition/subtraction
    // --------------------
    const type& operator+=( const absType& A );
    const type& operator-=( const absType& A );

    // Basic queries
    // =============
    El::DistData DistData() const override;

    Dist ColDist()             const override;
    Dist RowDist()             const override;
    Dist PartialColDist()      const override;
    Dist PartialRowDist()      const override;
    Dist PartialUnionColDist() const override;
    Dist PartialUnionRowDist() const override;
    Dist CollectedColDist()    const override;
    Dist CollectedRowDist()    const override;

    mpi::Comm DistComm()      const override;
    mpi::Comm CrossComm()     const override;
    mpi::Comm RedundantComm() const override;
    mpi::Comm ColComm()       const override;
    mpi::Comm RowComm()       const override;

    int RowStride()     const override;
    int ColStride()     const override;
    int DistSize()      const override;
    int CrossSize()     const override;
    int RedundantSize() const override;

private:
    // Friend declarations
    // ===================
    template<typename S,Dist U,Dist V> friend class DistMatrix;
    template<typename S,Dist U,Dist V> friend class BlockDistMatrix;
};

} // namespace El

#endif // ifndef EL_DISTMATRIX_MC_STAR_DECL_HPP


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.communication.rooms.implementation.models;

import com.azure.communication.rooms.models.RoomJoinPolicy;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** The meeting room. */
@Fluent
public final class RoomModel {
    /*
     * Unique identifier of a room. This id is server generated.
     */
    @JsonProperty(value = "id")
    private String id;

    /*
     * The timestamp when the room was created at the server. The timestamp is
     * in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
     */
    @JsonProperty(value = "createdDateTime")
    private OffsetDateTime createdDateTime;

    /*
     * The timestamp from when the room is open for joining. The timestamp is
     * in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
     */
    @JsonProperty(value = "validFrom")
    private OffsetDateTime validFrom;

    /*
     * The timestamp from when the room can no longer be joined. The timestamp
     * is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
     */
    @JsonProperty(value = "validUntil")
    private OffsetDateTime validUntil;

    /*
     * The Policy based on which Participants can join a room.
     */
    @JsonProperty(value = "roomJoinPolicy")
    private RoomJoinPolicy roomJoinPolicy;

    /*
     * Collection of room participants.
     */
    @JsonProperty(value = "participants")
    private List<RoomParticipant> participants;

    /**
     * Get the id property: Unique identifier of a room. This id is server generated.
     *
     * @return the id value.
     */
    public String getId() {
        return this.id;
    }

    /**
     * Set the id property: Unique identifier of a room. This id is server generated.
     *
     * @param id the id value to set.
     * @return the RoomModel object itself.
     */
    public RoomModel setId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the createdDateTime property: The timestamp when the room was created at the server. The timestamp is in
     * RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
     *
     * @return the createdDateTime value.
     */
    public OffsetDateTime getCreatedDateTime() {
        return this.createdDateTime;
    }

    /**
     * Set the createdDateTime property: The timestamp when the room was created at the server. The timestamp is in
     * RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
     *
     * @param createdDateTime the createdDateTime value to set.
     * @return the RoomModel object itself.
     */
    public RoomModel setCreatedDateTime(OffsetDateTime createdDateTime) {
        this.createdDateTime = createdDateTime;
        return this;
    }

    /**
     * Get the validFrom property: The timestamp from when the room is open for joining. The timestamp is in RFC3339
     * format: `yyyy-MM-ddTHH:mm:ssZ`.
     *
     * @return the validFrom value.
     */
    public OffsetDateTime getValidFrom() {
        return this.validFrom;
    }

    /**
     * Set the validFrom property: The timestamp from when the room is open for joining. The timestamp is in RFC3339
     * format: `yyyy-MM-ddTHH:mm:ssZ`.
     *
     * @param validFrom the validFrom value to set.
     * @return the RoomModel object itself.
     */
    public RoomModel setValidFrom(OffsetDateTime validFrom) {
        this.validFrom = validFrom;
        return this;
    }

    /**
     * Get the validUntil property: The timestamp from when the room can no longer be joined. The timestamp is in
     * RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
     *
     * @return the validUntil value.
     */
    public OffsetDateTime getValidUntil() {
        return this.validUntil;
    }

    /**
     * Set the validUntil property: The timestamp from when the room can no longer be joined. The timestamp is in
     * RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
     *
     * @param validUntil the validUntil value to set.
     * @return the RoomModel object itself.
     */
    public RoomModel setValidUntil(OffsetDateTime validUntil) {
        this.validUntil = validUntil;
        return this;
    }

    /**
     * Get the roomJoinPolicy property: The Policy based on which Participants can join a room.
     *
     * @return the roomJoinPolicy value.
     */
    public RoomJoinPolicy getRoomJoinPolicy() {
        return this.roomJoinPolicy;
    }

    /**
     * Set the roomJoinPolicy property: The Policy based on which Participants can join a room.
     *
     * @param roomJoinPolicy the roomJoinPolicy value to set.
     * @return the RoomModel object itself.
     */
    public RoomModel setRoomJoinPolicy(RoomJoinPolicy roomJoinPolicy) {
        this.roomJoinPolicy = roomJoinPolicy;
        return this;
    }

    /**
     * Get the participants property: Collection of room participants.
     *
     * @return the participants value.
     */
    public List<RoomParticipant> getParticipants() {
        return this.participants;
    }

    /**
     * Set the participants property: Collection of room participants.
     *
     * @param participants the participants value to set.
     * @return the RoomModel object itself.
     */
    public RoomModel setParticipants(List<RoomParticipant> participants) {
        this.participants = participants;
        return this;
    }
}


text:
"""empty message

Revision ID: 6f4c0b38c768
Revises: ea7468155632
Create Date: 2017-12-05 05:48:17.586000

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from datetime import datetime

# revision identifiers, used by Alembic.
revision = '6f4c0b38c768'
down_revision = 'ea7468155632'
branch_labels = None
depends_on = None

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('courses', 'randomize_questions',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False)
    op.add_column('users', sa.Column('date_of_registration', sa.String(128), nullable=False,
                    server_default=str(datetime.utcnow())))
    op.alter_column('users', 'is_active_premium',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=True)
    op.alter_column('users', 'is_confirmed',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=True)
    op.alter_column('users', 'phone_number',
               existing_type=mysql.VARCHAR(length=128),
               nullable=True)
    op.drop_index('ix_users_phone_number', table_name='users')
    op.create_index(op.f('ix_users_phone_number'), 'users', ['phone_number'], unique=False)
    # ### end Alembic commands ###

def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_users_phone_number'), table_name='users')
    op.create_index('ix_users_phone_number', 'users', ['phone_number'], unique=True)
    op.alter_column('users', 'phone_number',
               existing_type=mysql.VARCHAR(length=128),
               nullable=False)
    op.alter_column('users', 'is_confirmed',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=True)
    op.alter_column('users', 'is_active_premium',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=True)
    op.drop_column('users', 'date_of_registration')
    op.alter_column('courses', 'randomize_questions',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False)
    # ### end Alembic commands ###


text:
function btnStartVmware(str)
{
    var xmlhttp;

    if (null == str)
    {
        return;
    }

    document.getElementById("txtInfo").innerHTML="";

    if (window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest();
    }
    else
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function()
    {
        if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200))
        {
            document.getElementById("txtInfo").innerText = "Start Vmware OK !";
        }
    }

    xmlhttp.open("POST", "start_vmware_ok.jsp", true);
    xmlhttp.send();
}

function btnStopVmware(str)
{
    var xmlhttp;

    if (null == str)
    {
        return;
    }

    document.getElementById("txtInfo").innerHTML="";

    if (window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest();
    }
    else
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function()
    {
        if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200))
        {
            document.getElementById("txtInfo").innerText = "Stop Vmware OK !";
        }
    }

    xmlhttp.open("POST", "stop_vmware_ok.jsp", true);
    xmlhttp.send();
}

function btnStartHyperV(str)
{
    var xmlhttp;

    if (null == str)
    {
        return;
    }

    document.getElementById("txtInfo").innerHTML="";

    if (window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest();
    }
    else
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function()
    {
        if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200))
        {
            document.getElementById("txtInfo").innerText = "Start Hyper-V OK !";
        }
    }

    xmlhttp.open("POST", "start_hyper_v_ok.jsp", true);
    xmlhttp.send();
}
function btnStopHyperV(str)
{
    var xmlhttp;

    if (null == str)
    {
        return;
    }

    document.getElementById("txtInfo").innerHTML="";

    if (window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest();
    }
    else
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function()
    {
        if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200))
        {
            document.getElementById("txtInfo").innerText = "Stop Hyper-V OK !";
        }
    }

    xmlhttp.open("POST", "stop_hyper_v_ok.jsp", true);
    xmlhttp.send();
}

function btnStartDocker(str)
{
    var xmlhttp;

    if (null == str)
    {
        return;
    }

    document.getElementById("txtInfo").innerHTML="";

    if (window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest();
    }
    else
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function()
    {
        if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200))
        {
            document.getElementById("txtInfo").innerText = "Start Docker OK !";
        }
    }

    xmlhttp.open("POST", "start_docker_ok.jsp", true);
    xmlhttp.send();
}

function btnStopDocker(str)
{
    var xmlhttp;

    if (null == str)
    {
        return;
    }

    document.getElementById("txtInfo").innerHTML="";

    if (window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest();
    }
    else
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function()
    {
        if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200))
        {
            document.getElementById("txtInfo").innerText = "Stop Docker OK !";
        }
    }

    xmlhttp.open("POST", "stop_docker_ok.jsp", true);
    xmlhttp.send();
}


text:
package http

import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"

	"gopkg.in/src-d/go-git.v4/plumbing"
	"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp"
	"gopkg.in/src-d/go-git.v4/plumbing/transport"
	"gopkg.in/src-d/go-git.v4/plumbing/transport/test"

	. "gopkg.in/check.v1"
	"gopkg.in/src-d/go-git-fixtures.v3"
)

type UploadPackSuite struct {
	test.UploadPackSuite
	BaseSuite
}

var _ = Suite(&UploadPackSuite{})

func (s *UploadPackSuite) SetUpSuite(c *C) {
	s.BaseSuite.SetUpTest(c)
	s.UploadPackSuite.Client = DefaultClient
	s.UploadPackSuite.Endpoint = s.prepareRepository(c, fixtures.Basic().One(), "basic.git")
	s.UploadPackSuite.EmptyEndpoint = s.prepareRepository(c, fixtures.ByTag("empty").One(), "empty.git")
	s.UploadPackSuite.NonExistentEndpoint = s.newEndpoint(c, "non-existent.git")
}

// Overwritten, different behaviour for HTTP.
func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) {
	r, err := s.Client.NewUploadPackSession(s.NonExistentEndpoint, s.EmptyAuth)
	c.Assert(err, IsNil)
	info, err := r.AdvertisedReferences()
	c.Assert(err, Equals, transport.ErrRepositoryNotFound)
	c.Assert(info, IsNil)
}

func (s *UploadPackSuite) TestuploadPackRequestToReader(c *C) {
	r := packp.NewUploadPackRequest()
	r.Wants = append(r.Wants, plumbing.NewHash("d82f291cde9987322c8a0c81a325e1ba6159684c"))
	r.Wants = append(r.Wants, plumbing.NewHash("2b41ef280fdb67a9b250678686a0c3e03b0a9989"))
	r.Haves = append(r.Haves, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))

	sr, err := uploadPackRequestToReader(r)
	c.Assert(err, IsNil)
	b, _ := ioutil.ReadAll(sr)
	c.Assert(string(b), Equals,
		"0032want 2b41ef280fdb67a9b250678686a0c3e03b0a9989\n"+
			"0032want d82f291cde9987322c8a0c81a325e1ba6159684c\n0000"+
			"0032have 6ecf0ef2c2dffb796033e5a02219af86ec6584e5\n"+
			"0009done\n",
	)
}

func (s *UploadPackSuite) prepareRepository(c *C, f *fixtures.Fixture, name string) *transport.Endpoint {
	fs := f.DotGit()

	err := fixtures.EnsureIsBare(fs)
	c.Assert(err, IsNil)

	path := filepath.Join(s.base, name)
	err = os.Rename(fs.Root(), path)
	c.Assert(err, IsNil)

	return s.newEndpoint(c, name)
}

func (s *UploadPackSuite) newEndpoint(c *C, name string) *transport.Endpoint {
	ep, err := transport.NewEndpoint(fmt.Sprintf("http://localhost:%d/%s", s.port, name))
	c.Assert(err, IsNil)

	return ep
}


text:
/**
 * AudioErrorReason.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
 */

package com.google.api.ads.adwords.axis.v201406.cm;

public class AudioErrorReason implements java.io.Serializable {
    private java.lang.String _value_;
    private static java.util.HashMap _table_ = new java.util.HashMap();

    // Constructor
    protected AudioErrorReason(java.lang.String value) {
        _value_ = value;
        _table_.put(_value_,this);
    }

    public static final java.lang.String _INVALID_AUDIO = "INVALID_AUDIO";
    public static final java.lang.String _PROBLEM_READING_AUDIO_FILE = "PROBLEM_READING_AUDIO_FILE";
    public static final java.lang.String _ERROR_STORING_AUDIO = "ERROR_STORING_AUDIO";
    public static final java.lang.String _FILE_TOO_LARGE = "FILE_TOO_LARGE";
    public static final java.lang.String _UNSUPPORTED_AUDIO = "UNSUPPORTED_AUDIO";
    public static final java.lang.String _ERROR_GENERATING_STREAMING_URL = "ERROR_GENERATING_STREAMING_URL";
    public static final AudioErrorReason INVALID_AUDIO = new AudioErrorReason(_INVALID_AUDIO);
    public static final AudioErrorReason PROBLEM_READING_AUDIO_FILE = new AudioErrorReason(_PROBLEM_READING_AUDIO_FILE);
    public static final AudioErrorReason ERROR_STORING_AUDIO = new AudioErrorReason(_ERROR_STORING_AUDIO);
    public static final AudioErrorReason FILE_TOO_LARGE = new AudioErrorReason(_FILE_TOO_LARGE);
    public static final AudioErrorReason UNSUPPORTED_AUDIO = new AudioErrorReason(_UNSUPPORTED_AUDIO);
    public static final AudioErrorReason ERROR_GENERATING_STREAMING_URL = new AudioErrorReason(_ERROR_GENERATING_STREAMING_URL);
    public java.lang.String getValue() { return _value_;}
    public static AudioErrorReason fromValue(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        AudioErrorReason enumeration = (AudioErrorReason)
            _table_.get(value);
        if (enumeration==null) throw new java.lang.IllegalArgumentException();
        return enumeration;
    }
    public static AudioErrorReason fromString(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        return fromValue(value);
    }
    public boolean equals(java.lang.Object obj) {return (obj == this);}
    public int hashCode() { return toString().hashCode();}
    public java.lang.String toString() { return _value_;}
    public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new org.apache.axis.encoding.ser.EnumSerializer(
            _javaType, _xmlType);
    }
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new org.apache.axis.encoding.ser.EnumDeserializer(
            _javaType, _xmlType);
    }
    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(AudioErrorReason.class);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201406", "AudioError.Reason"));
    }
    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

}


text:
#import "WHActivityView.h"

@interface WHActivityView ()

@property (nonatomic, strong) UIView *activityView;
@property (nonatomic, strong) UIButton *cancelButton;

@end

@implementation WHActivityView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.5f];
    }

    return self;
}

- (UIView *)activityView {
    if (!_activityView) {
        UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        [indicator startAnimating];

        _activityView = indicator;

        [self addSubview:_activityView];
    }

    return _activityView;
}

- (void)layoutSubviews {
    [super layoutSubviews];

    self.activityView.center = CGPointMake(self.frame.size.width * 0.5f, self.frame.size.height * 0.5f);
}

@end