text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ejercicio_feedback.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pepe
 */
@Entity
@Table(name = "users", catalog = "Ejercicio_FeedBack", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"),
    @NamedQuery(name = "Users.findByIdPermiso", query = "SELECT u FROM Users u WHERE u.idPermiso = :idPermiso"),
    @NamedQuery(name = "Users.findByNombreUsuario", query = "SELECT u FROM Users u WHERE u.nombreUsuario = :nombreUsuario"),
    @NamedQuery(name = "Users.findByEmail", query = "SELECT u FROM Users u WHERE u.email = :email"),
    @NamedQuery(name = "Users.findByPassword", query = "SELECT u FROM Users u WHERE u.password = :password"),
    @NamedQuery(name = "Users.login", query = "SELECT u FROM Users u WHERE u.email = :email AND u.password = :password"),
    @NamedQuery(name = "Users.cambiarClave", query = "UPDATE Users u SET u.password = :password WHERE u.email = :email")
})
public class Users implements Serializable {

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "emailUsuario")
    private Collection<Comprasusuario> comprasusuarioCollection;

    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "idPermiso", nullable = false, length = 5)
    private String idPermiso;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nombreUsuario", nullable = false, length = 50)
    private String nombreUsuario;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "email", nullable = false, length = 50)
    private String email;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "password", nullable = false, length = 50)
    private String password;

    public Users() {
    }

    public Users(String email) {
        this.email = email;
    }

    public Users(String email, String idPermiso, String nombreUsuario, String password) {
        this.email = email;
        this.idPermiso = idPermiso;
        this.nombreUsuario = nombreUsuario;
        this.password = password;
    }

    public String getIdPermiso() {
        return idPermiso;
    }

    public void setIdPermiso(String idPermiso) {
        this.idPermiso = idPermiso;
    }

    public String getNombreUsuario() {
        return nombreUsuario;
    }

    public void setNombreUsuario(String nombreUsuario) {
        this.nombreUsuario = nombreUsuario;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (email != null ? email.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Users)) {
            return false;
        }
        Users other = (Users) object;
        if ((this.email == null && other.email != null) || (this.email != null && !this.email.equals(other.email))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.entity.Users[ email=" + email + " ]";
    }

    @XmlTransient
    public Collection<Comprasusuario> getComprasusuarioCollection() {
        return comprasusuarioCollection;
    }

    public void setComprasusuarioCollection(Collection<Comprasusuario> comprasusuarioCollection) {
        this.comprasusuarioCollection = comprasusuarioCollection;
    }

}


text:
/**
 * @file    quality_score_iterator.hpp
 * @ingroup index
 * @author  Patrick Flick <patrick.flick@gmail.com>
 * @author  Tony Pan <tpan7@gatech.edu> <tcp1975@gmail.com>
 *
 * @brief   Implements the sliding window quality score generating iterator.
 *
 */

#ifndef BLISS_INDEX_QUALITY_SCORE_ITERATOR_HPP
#define BLISS_INDEX_QUALITY_SCORE_ITERATOR_HPP

#include <vector>

#include "index/quality_scores.hpp"
#include "iterators/sliding_window_iterator.hpp"

namespace bliss
{
namespace index
{

/**
 * @brief The sliding window operator for calculating "Exact" quality scores for k-mers.
 *
 * @details
 *
 * If `p_i` is the probability of a base `i` to be correct, then the probability
 * of a k-mer with bases `b_1,...,b_k` being correct is given as
 *     `p_1 * p_2 * ... * p_k`
 *
 * Since multiplications of floating point numbers is inefficient, we calculate
 * the product in log_2 space in the sliding window. Thus we simply sum the
 * log probabilities into a common sum. Sliding the window by one position thus
 * means that we have to subtract the value "falling out of the window" and
 * add the new value coming in.
 *
 * Retrieving the k-mer probability is then done by calculating the exponent
 * of the current sum to the base of 2.
 *
 * @tparam BaseIterator Type of the underlying base iterator, which returns
 *                      quality scores from the reads.
 * @tparam Encoder     The `Encoder` class, which decodes/encodes
 *                      between specific quality score (in ASCII space) and
 *                      the actual probabilities of bases being correct
 *                      (probabilities in log space).
 */
template <typename BaseIterator, unsigned int KMER_SIZE,
          typename Encoder = bliss::index::Illumina18QualityScoreCodec<double> >
class QualityScoreSlidingWindow
{
  public:

    /// Type of the internal sum is equal to the floating point type
    /// returned by the encoding
    typedef typename Encoder::value_type QualityType;

  private:

  /// The current sum of base-correct probabilities in the current window
  QualityType current_sum = 0;

  /// All current values in the window, updated as a circular buffer since the order does not matter.
  QualityType window_values[KMER_SIZE];

  /// number of incorrect bases in the current window (i.e., bases with zero probability of being correct)
  unsigned int n_incorrect_bases = 0;

  /// The current position in the window_values circular buffer, Points to the next available position
  unsigned int window_pos = 0;

public:
  /// The value_type of the underlying iterator
  typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;

  /**
   * @brief Initializes the sliding window.  at end of initialization, it is set to last position read.
   *
   * @param it[in|out]  The current base iterator position. This will be set to
   *                    the LAST READ position (and NOT the next one)
   */
  inline void init(BaseIterator& it)
  {
    for (unsigned int i = 0; i < KMER_SIZE;)
    {
      // fill the window_values and count the number of bases with
      // zero probability (-inf log-prob of) of begin correct
      QualityType newval = Encoder::decode(*it);
      window_values[i] = newval;

      if ((newval > Encoder::DecodeLUT[0]) && (newval < Encoder::DecodeLUT[95])) {
        current_sum += newval;
      } else {
        ++n_incorrect_bases;
      }
      if (++i < KMER_SIZE) ++it;  // set to LAST READ position
    }
    window_pos = 0;
  }

  /**
   * @brief Slides the window by one character taken from the given iterator.
   *
   * This will read the current character of the iterator and then advance the
   * iterator by one.
   *
   * @param it[in|out]  The underlying iterator position, this will be read
   *                    and then advanced.
   */
  inline void next(BaseIterator& it)
  {
    // slide the window by one, throwing out the last value and adding in
    // the new one in a circular buffer fashion
    QualityType oldval = window_values[window_pos];
    QualityType newval = Encoder::decode(*it);

    window_values[window_pos] = newval;
    window_pos = (window_pos+1) % KMER_SIZE;

    // remove old value from either the sum or the incorrect count
    if ((oldval > Encoder::DecodeLUT[0]) && (oldval < Encoder::DecodeLUT[95]))
    {
      current_sum -= oldval;
    }
    else
    {
      --n_incorrect_bases;
    }

    // add the new value to either the sum or the incorrect count
    if ((newval > Encoder::DecodeLUT[0]) && (newval < Encoder::DecodeLUT[95]))
    {
      current_sum += newval;
    }
    else
    {
      ++n_incorrect_bases;
    }
    ++it;
  }

  /**
   * @brief Returns the probability [0,1] that the k-mer contains only correct
   *        bases. This is equal to the multiplication of all base probabilities
   *        of being correct.
   *
   * @return The probability that all bases in the sliding window are correct.
   */
  inline QualityType getValue()
  {

      if (n_incorrect_bases > 0)
        return 0.0;
      else
        return std::exp2(current_sum);
  }
};

// /**
//  * compute kmer quality based on phred quality score.
//  *
//  * Q = -10 log_10 P
//  *
//  * where P is probability of error.
//  *
//  * probability of kmer being correct is: (1-p_1)(1-p_2)...(1-p_k)  - this is the computation used via log2.
//  * probability of kmer being incorrect then is 1 - (p(correct...))
//  *
//  * Phrad adds the Phred score, which amounts to p_1 * p_2 * ... * p_k because of the logarithm.
//  *  (probability that all bases in the sequence are incorrect.)
//  * Quake is computes a kmer score based on probability in the phred score.  not clear exactly how.
//  *
//  * value range is in ascii from !(33) to ~(126), using sanger encoding.
//  *
//  * one possible approximation
//  *  now computing k-correct with approximation gives
//  *     1 - sum_1..k(p_i) + 1/2 sum_1..k sum_1..k (p_i)(p_j) - 3rd order term + 4th order term ...
//  *
//  *    p(incorrect) is sum_1..k(p_i) - 1/2 sum_1..k sum_1..k (p_i)(p_j) + 3rd order term - 4th order term ...
//  *
//  *  =====>>>  p(incorrect) < sum_1..k(p_i).
//  *
//  *  approximate with linear terms.  (i.e. probability of 2 or more bases being called incorrectly is low).  bound is not that tight.
//  *
//  *  =====>>>  max_1..k(p_i) < p(incorrect)  - is this always true?
//  *  this would be the lower bound.
//  *  max_1..k(p_i) ~= min_1..k(q_i)
//  *  can also look for top x values, but then it becomes a search
//  *
//  *  =====>>>  sum_1..k(p_i) - 1/2 sum_1..k sum_1..k (p_i)(p_j) < p(incorrect)
//  *  if track s = sum_1..k(p_i), then can compute
//  *        p(incorrect) ~= (s - p_(j-k) + p_j) + (p_(j-k) * s - 0.5 * p_(j-k)^2) - (p_j * s' - 0.5* p_j^2)
//  *        we can save the 2nd order term in array (col-wise partial sum), the 1st order term in array,
//  *        and s.
//  *
//  *
//  *  each term in (1-p_i) is (1- 10^(q/-10)) = (1 - e ^ ((log 10)(q/-10)))
//  *  accumulate using sum(log(term))., expand using e^(sum(log(term))), calculate -10 log_10(1-cumulative).
//  *
//  *
//  *  approximation may not be needed, since we mostly decode, and that uses a LUT table. so only a exp2 is needed.
//  */
//template <typename BaseIterator, unsigned int KMER_SIZE,
//          typename Encoder = bliss::index::Illumina18QualityScoreCodec<float> >
//class ApproximateQualityScoreSlidingWindow;
//

/**
 * @brief Iterator that generates k-mers from character data.
 *
 * @tparam BaseIterator     The underlying iterator of characters. E.g. a
 *                          std::string::iterator. Any iterator yielding
 *                          `char` works.
 * @tparam Kmer             The type of the Kmer, this has to be of type
 *                          bliss::Kmer.
 */
template <typename BaseIterator, unsigned int KMER_SIZE,
          typename Encoder = bliss::index::Illumina18QualityScoreCodec<double> >
class QualityScoreGenerationIterator
: public iterator::sliding_window_iterator<BaseIterator,
                                           QualityScoreSlidingWindow<BaseIterator, KMER_SIZE, Encoder > >
{
protected:
  /// The type of the base class
  typedef iterator::sliding_window_iterator<BaseIterator, QualityScoreSlidingWindow<BaseIterator, KMER_SIZE, Encoder > >
    base_class_t;

  /// The difference_type of character offsets
  typedef typename std::iterator_traits<base_class_t>::difference_type diff_type;

  /// The type of the sliding window.
  typedef QualityScoreSlidingWindow<BaseIterator, KMER_SIZE, Encoder > functor_t;

public:
  typedef typename Encoder::value_type QualityType;

  /// Default constructor.
  QualityScoreGenerationIterator() : base_class_t() {}

  /**
   * @brief   Constructor for the kmer generation iterator using the underlying
   *          iterator `baseBegin` as starting point.
   *
   * @param   baseBegin   An iterator pointing to the first character of the
   *                      sequence to be used for generating k-mers.
   */
  QualityScoreGenerationIterator(const BaseIterator& baseBegin)
    : base_class_t(baseBegin, true) {}

  /**
   * @brief   Constructor for the kmer generation iterator using the underlying
   *          iterator `baseBegin` as starting point.
   *
   * @param baseBegin     An iterator pointing to the first character of the
   *                      sequence to be used for generating k-mers.
   * @param initialze_window    Whether to read the first `KMER_SIZE` characters
   *                            to initialize the sliding window. This will
   *                            have to be set to `false` for creating
   *                            `end` style iterators which would otherwise
   *                            read past the valid range.
   */
  QualityScoreGenerationIterator(const BaseIterator& baseBegin, bool initialize_window)
    : base_class_t(baseBegin, initialize_window) {}

protected:
  /*****************************
   *  non public constructors  *
   *****************************/
  // handling of the `window` object instances is strictly hidden

  /**
   * @brief   Constructor for the kmer generation iterator using the underlying
   *          iterator `baseBegin` as starting point.
   *
   * @param baseBegin     An iterator pointing to the first character of the
   *                      sequence to be used for generating k-mers.
   * @param window        The sliding window object used by the iterator.
   */
  QualityScoreGenerationIterator(const BaseIterator& baseBegin, const functor_t& window)
    : base_class_t(baseBegin, window, true)  {}

  /**
   * @brief   Constructor for the kmer generation iterator using the underlying
   *          iterator `baseBegin` as starting point.
   *
   * @param   baseBegin   An iterator pointing to the first character of the
   *                      sequence to be used for generating k-mers.
   * @param window        The sliding window object used by the iterator.
   * @param initialze_window    Whether to read the first `KMER_SIZE` characters
   *                            to initialize the sliding window. This will
   *                            have to be set to `false` for creating
   *                            `end` style iterators which would otherwise
   *                            read past the valid range.
   */
  QualityScoreGenerationIterator(const BaseIterator& baseBegin, const functor_t& window, bool initialize_window)
    : base_class_t(baseBegin, window, initialize_window)  {}
};

} // namespace index
} // namespace bliss

#endif // BLISS_INDEX_QUALITY_SCORE_ITERATOR_HPP

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.components.messages;

import android.os.SystemClock;

import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting;

import org.chromium.base.Log;
import org.chromium.base.metrics.RecordHistogram;

/**
 * Static utility methods for recording messages related metrics.
 * TODO(https://crbug.com/1382967): remove logs.
 */
public class MessagesMetrics {
    private static final String TAG = "MessagesMetrics";
    private static final String ENQUEUED_HISTOGRAM_NAME = "Android.Messages.Enqueued";
    private static final String ENQUEUED_VISIBLE_HISTOGRAM_NAME =
            "Android.Messages.Enqueued.Visible";
    private static final String ENQUEUED_HIDDEN_HISTOGRAM_NAME = "Android.Messages.Enqueued.Hidden";
    private static final String ENQUEUED_HIDING_HISTOGRAM_NAME = "Android.Messages.Enqueued.Hiding";
    private static final String DISMISSED_HISTOGRAM_PREFIX = "Android.Messages.Dismissed.";
    private static final String TIME_TO_ACTION_HISTOGRAM_PREFIX = "Android.Messages.TimeToAction.";
    private static final String TIME_TO_ACTION_DISMISS_HISTOGRAM_PREFIX =
            "Android.Messages.TimeToAction.Dismiss.";
    static final String STACKING_HISTOGRAM_NAME = "Android.Messages.Stacking";
    static final String STACKING_ACTION_HISTOGRAM_PREFIX = "Android.Messages.Stacking.";
    static final String THREE_STACKED_HISTOGRAM_NAME = "Android.Messages.Stacking.ThreeStacked";

    @IntDef({StackingAnimationType.SHOW_ALL, StackingAnimationType.SHOW_FRONT_ONLY,
            StackingAnimationType.REMOVE_FRONT_AND_SHOW_BACK, StackingAnimationType.REMOVE_ALL,
            StackingAnimationType.REMOVE_FRONT_ONLY, StackingAnimationType.REMOVE_BACK_ONLY,
            StackingAnimationType.SHOW_BACK_ONLY, StackingAnimationType.INSERT_AT_FRONT,
            StackingAnimationType.MAX_VALUE})
    public @interface StackingAnimationType {
        int SHOW_ALL = 0;
        int SHOW_FRONT_ONLY = 1;
        int REMOVE_FRONT_AND_SHOW_BACK = 2;
        int REMOVE_ALL = 3;
        int REMOVE_FRONT_ONLY = 4;
        int REMOVE_BACK_ONLY = 5;
        int SHOW_BACK_ONLY = 6;
        int INSERT_AT_FRONT = 7;
        int MAX_VALUE = 8;
    }

    @IntDef({StackingAnimationAction.INSERT_AT_FRONT, StackingAnimationAction.INSERT_AT_BACK,
            StackingAnimationAction.PUSH_TO_FRONT, StackingAnimationAction.PUSH_TO_BACK,
            StackingAnimationAction.REMOVE_FRONT, StackingAnimationAction.REMOVE_BACK,
            StackingAnimationAction.MAX_VALUE})
    public @interface StackingAnimationAction {
        int INSERT_AT_FRONT = 0;
        int INSERT_AT_BACK = 1;
        int PUSH_TO_FRONT = 2;
        int PUSH_TO_BACK = 3;
        int REMOVE_FRONT = 4;
        int REMOVE_BACK = 5;
        int MAX_VALUE = 6;
    }

    @IntDef({ThreeStackedScenario.HIGH_PRIORITY, ThreeStackedScenario.IN_SEQUENCE,
            ThreeStackedScenario.MAX_VALUE})
    public @interface ThreeStackedScenario {
        int HIGH_PRIORITY = 0;
        int IN_SEQUENCE = 1;
        int MAX_VALUE = 2;
    }

    /** Records metrics when a message is enqueued. */
    static void recordMessageEnqueuedVisible(@MessageIdentifier int messageIdentifier) {
        RecordHistogram.recordEnumeratedHistogram(
                ENQUEUED_HISTOGRAM_NAME, messageIdentifier, MessageIdentifier.COUNT);
        RecordHistogram.recordEnumeratedHistogram(
                ENQUEUED_VISIBLE_HISTOGRAM_NAME, messageIdentifier, MessageIdentifier.COUNT);
    }

    /** Records metrics when a message is enqueued. */
    static void recordMessageEnqueuedHidden(@MessageIdentifier int enqueuedMessage,
            @MessageIdentifier int currentDisplayedMessage) {
        RecordHistogram.recordEnumeratedHistogram(
                ENQUEUED_HISTOGRAM_NAME, enqueuedMessage, MessageIdentifier.COUNT);
        RecordHistogram.recordEnumeratedHistogram(
                ENQUEUED_HIDDEN_HISTOGRAM_NAME, enqueuedMessage, MessageIdentifier.COUNT);
        RecordHistogram.recordEnumeratedHistogram(
                ENQUEUED_HIDING_HISTOGRAM_NAME, currentDisplayedMessage, MessageIdentifier.COUNT);
    }

    /** Records metrics when a message is dismissed. */
    static void recordDismissReason(
            @MessageIdentifier int messageIdentifier, @DismissReason int dismissReason) {
        String histogramName =
                DISMISSED_HISTOGRAM_PREFIX + messageIdentifierToHistogramSuffix(messageIdentifier);
        RecordHistogram.recordEnumeratedHistogram(
                histogramName, dismissReason, DismissReason.COUNT);
    }

    /**
     * Records metrics with duration of time a message was visible before it was dismissed by a user
     * action.
     */
    static void recordTimeToAction(@MessageIdentifier int messageIdentifier,
            boolean messageDismissedByGesture, long durationMs) {
        String histogramSuffix = messageIdentifierToHistogramSuffix(messageIdentifier);
        RecordHistogram.recordMediumTimesHistogram(
                TIME_TO_ACTION_HISTOGRAM_PREFIX + histogramSuffix, durationMs);
        if (messageDismissedByGesture) {
            RecordHistogram.recordMediumTimesHistogram(
                    TIME_TO_ACTION_DISMISS_HISTOGRAM_PREFIX + histogramSuffix, durationMs);
        }
    }

    static void recordStackingAnimationType(@StackingAnimationType int type) {
        Log.i(TAG, "Triggered message stacking animation type %s.", type);
        RecordHistogram.recordEnumeratedHistogram(
                STACKING_HISTOGRAM_NAME, type, StackingAnimationType.MAX_VALUE);
    }

    static void recordStackingAnimationAction(
            @StackingAnimationAction int action, @MessageIdentifier int messageIdentifier) {
        String suffix = stackingAnimationActionToHistogramSuffix(action);
        RecordHistogram.recordEnumeratedHistogram(STACKING_ACTION_HISTOGRAM_PREFIX + suffix,
                messageIdentifier, StackingAnimationType.MAX_VALUE);
    }

    static void recordThreeStackedScenario(@ThreeStackedScenario int scenario) {
        RecordHistogram.recordEnumeratedHistogram(
                THREE_STACKED_HISTOGRAM_NAME, scenario, ThreeStackedScenario.MAX_VALUE);
    }

    /**
     * Returns current timestamp in milliseconds to be used when recording message's visible
     * duration.
     */
    static long now() {
        return SystemClock.uptimeMillis();
    }

    static String stackingAnimationActionToHistogramSuffix(@StackingAnimationAction int action) {
        if (action == StackingAnimationAction.INSERT_AT_FRONT) {
            return "InsertAtFront";
        } else if (action == StackingAnimationAction.INSERT_AT_BACK) {
            return "InsertAtBack";
        } else if (action == StackingAnimationAction.PUSH_TO_FRONT) {
            return "PushToFront";
        } else if (action == StackingAnimationAction.PUSH_TO_BACK) {
            return "PushToBack";
        } else if (action == StackingAnimationAction.REMOVE_FRONT) {
            return "RemoveFront";
        } else {
            return "RemoveBack";
        }
    }

    /**
     * Returns a histogram suffix string that corresponds to message identifier of the current
     * message.
     * Update this function when adding a new message identifier.
     */
    public static String messageIdentifierToHistogramSuffix(
            @MessageIdentifier int messageIdentifier) {
        switch (messageIdentifier) {
            case MessageIdentifier.TEST_MESSAGE:
                return "TestMessage";
            case MessageIdentifier.SAVE_PASSWORD:
                return "SavePassword";
            case MessageIdentifier.UPDATE_PASSWORD:
                return "UpdatePassword";
            case MessageIdentifier.GENERATED_PASSWORD_SAVED:
                return "GeneratedPasswordSaved";
            case MessageIdentifier.POPUP_BLOCKED:
                return "PopupBlocked";
            case MessageIdentifier.SAFETY_TIP:
                return "SafetyTip";
            case MessageIdentifier.SAVE_ADDRESS_PROFILE:
                return "SaveAddressProfile";
            case MessageIdentifier.MERCHANT_TRUST:
                return "MerchantTrust";
            case MessageIdentifier.ADD_TO_HOMESCREEN_IPH:
                return "AddToHomescreenIPH";
            case MessageIdentifier.SEND_TAB_TO_SELF:
                return "SendTabToSelf";
            case MessageIdentifier.READER_MODE:
                return "ReaderMode";
            case MessageIdentifier.SAVE_CARD:
                return "SaveCard";
            case MessageIdentifier.CHROME_SURVEY:
                return "ChromeSurvey";
            case MessageIdentifier.NOTIFICATION_BLOCKED:
                return "NotificationBlocked";
            case MessageIdentifier.PERMISSION_UPDATE:
                return "PermissionUpdate";
            case MessageIdentifier.ADS_BLOCKED:
                return "AdsBlocked";
            case MessageIdentifier.DOWNLOAD_PROGRESS:
                return "DownloadProgress";
            case MessageIdentifier.SYNC_ERROR:
                return "SyncError";
            case MessageIdentifier.SHARED_HIGHLIGHTING:
                return "SharedHighlighting";
            case MessageIdentifier.NEAR_OOM_REDUCTION:
                return "NearOomReduction";
            case MessageIdentifier.INSTALLABLE_AMBIENT_BADGE:
                return "InstallableAmbientBadge";
            case MessageIdentifier.AUTO_DARK_WEB_CONTENTS:
                return "AutoDarkWebContents";
            case MessageIdentifier.TAILORED_SECURITY_ENABLED:
                return "TailoredSecurityEnabled";
            case MessageIdentifier.TAILORED_SECURITY_DISABLED:
                return "TailoredSecurityDisabled";
            case MessageIdentifier.VR_SERVICES_UPGRADE:
                return "VrServicesUpgrade";
            case MessageIdentifier.AR_CORE_UPGRADE:
                return "ArCoreUpgrade";
            case MessageIdentifier.ABOUT_THIS_SITE:
                return "AboutThisSite";
            case MessageIdentifier.TRANSLATE:
                return "Translate";
            case MessageIdentifier.OFFER_NOTIFICATION:
                return "OfferNotification";
            case MessageIdentifier.EXTERNAL_NAVIGATION:
                return "ExternalNavigation";
            case MessageIdentifier.FRAMEBUST_BLOCKED:
                return "FramebustBlocked";
            case MessageIdentifier.INVALID_MESSAGE:
                return "InvalidMessage";
            case MessageIdentifier.DESKTOP_SITE_GLOBAL_DEFAULT_OPT_OUT:
                return "DesktopSiteGlobalDefaultOptOut";
            case MessageIdentifier.DESKTOP_SITE_GLOBAL_OPT_IN:
                return "DesktopSiteGlobalOptIn";
            case MessageIdentifier.DOWNLOAD_INCOGNITO_WARNING:
                return "DownloadIncognitoWarning";
            case MessageIdentifier.RESTORE_CUSTOM_TAB:
                return "RestoreCustomTab";
            default:
                return "Unknown";
        }
    }

    @VisibleForTesting
    static String getEnqueuedHistogramNameForTesting() {
        return ENQUEUED_HISTOGRAM_NAME;
    }

    @VisibleForTesting
    static String getDismissHistogramNameForTesting(@MessageIdentifier int messageIdentifier) {
        return DISMISSED_HISTOGRAM_PREFIX + messageIdentifierToHistogramSuffix(messageIdentifier);
    }
}


text:
<?php

/**
 * Ashiato filter form base class.
 *
 * @package    OpenPNE
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseAshiatoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'member_id_from' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Member_2'), 'add_empty' => true)),
      'member_id_to'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Member'), 'add_empty' => true)),
      'r_date'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'member_id_from' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Member_2'), 'column' => 'id')),
      'member_id_to'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Member'), 'column' => 'id')),
      'r_date'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'created_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('ashiato_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Ashiato';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'member_id_from' => 'ForeignKey',
      'member_id_to'   => 'ForeignKey',
      'r_date'         => 'Date',
      'created_at'     => 'Date',
      'updated_at'     => 'Date',
    );
  }
}


text:
/*
 * DatFileDataReader.cpp
 *
 *  Created on: 04.02.2010
 *
 */

#include "DatFileDataReader.hpp"

#include "clustering/Document.hpp"

namespace impact_tr4 {

DatFileDataReader::DatFileDataReader()
{

}

#if 0
void DatFileDataReader::parseFiles(Document *pDocument, std::vector<ImageChar> &imageCharVec, std::vector<std::string> &charVec) const
{
	imageCharVec.clear(); charVec.clear();
	// load document images if not done yet:
	if (!pDocument->isDocumentImagesLoaded()) {
		std::cout << "opening document images for dat files!" << std::endl;
		pDocument->openDocumentImages();
	}
	// create XML filenames:
	pDocument->createSegmentationResultFileNames("dat", pDocument->parsingParameters().filenamePrefix,  pDocument->parsingParameters().filenameSuffix);
//	pDocument->createSegmentationResultFileNames("dat");
//	std::cout << "created segmentation result filenames" << std::endl;

	const ParseSubsetType pType = pDocument->parsingParameters().parsingType;

	for (int i=0; i<pDocument->nFiles(); ++i) {
		std::cout << "parsing image file " << i << std::endl;
		this->parseSingleImageFile(pDocument->fileName(i), pDocument->segmentationResultFileName(i), pDocument->imagePointer(i), imageCharVec, charVec, i);
	}

	return;
} // end parseXMLFiles
#endif

void DatFileDataReader::parseSingleImageFile(const std::string fileName, const std::string resultFileName, GrayImage<> *pImage, std::vector<ImageChar> &imageCharVec, const int imageId /*= 0*/) const
{
	std::cout << "parsing dat file: " << resultFileName << std::endl;
//	GrayImage<int> image(resultFileName);

#if 1
	std::ifstream datFile(resultFileName.c_str(), std::ios::in | std::ios::binary);
	unsigned int width, height;

	datFile.read((char*)&width, sizeof(unsigned int));
	datFile.read((char*)&height, sizeof(unsigned int));
	std::cout << "image, width = " << pImage->width() << ", height = " << pImage->height() << std::endl;
	std::cout << "read dat file, width = " << width << ", height = " << height << std::endl;
	unsigned int size = width * height;
	std::vector<unsigned int> imData(size);
	datFile.read((char*)&imData[0], sizeof(unsigned int)*size);

	const int maxBoxes = 50000;
	std::vector<int> maxX(maxBoxes, -1);
	std::vector<int> maxY(maxBoxes, -1);
	std::vector<int> minX(maxBoxes, width+1);
	std::vector<int> minY(maxBoxes, height+1);

	int i=0;
	for (int x=0; x<width; ++x) {
		for (int y=0; y<height; ++y) {
			i = y*width + x;
			if (imData[i]!=0) {
//				std::cout << imData[i] << std::endl;
				int valInd = imData[i]-1;
				if (x > maxX[valInd]) maxX[valInd] = x;
				if (y > maxY[valInd]) maxY[valInd] = y;
				if (x < minX[valInd]) minX[valInd] = x;
				if (y < minY[valInd]) minY[valInd] = y;
			}
		} // end for y
	} // end for x
#if 1
	int nParsedBoxes = 0;
	for (int i=0; i<maxBoxes; ++i) {
		if (maxX[i]!=-1) {
			BoundingBox bbox(minX[i], minY[i], maxX[i]-minX[i]+1, maxY[i]-minY[i]+1);
			ImageChar imChar(bbox, pImage, imageId, imageCharVec.size());
			imageCharVec.push_back(imChar);
			nParsedBoxes++;
		}
	}
	std::cout << "nParsedBoxes = " << nParsedBoxes << std::endl;
#endif

#endif

     return;
} // end parseSingleImageFile

} // end of namespace impact_tr4


text:
from beritest_tools import BaseBERITestCase
from nose.plugins.attrib import attr

class test_cp2_x_cchecktype(BaseBERITestCase):

    @attr('capabilities')
    def test_cp2_x_cchecktype_1(self):
        '''Test that cchecktype raises an exception if the otypes don't match'''
        self.assertRegisterEqual(self.MIPS.a2, 1, "cchecktype did not raise an exception when otypes did not match")

    @attr('capabilities')
    def test_cp2_x_cchecktype_2(self):
        '''Test that cchecktype set the capability cause register when otypes didn't match'''
        self.assertRegisterEqual(self.MIPS.a3, 0x0404, "cchecktype did not set the cause register correctly when otypes didn't match")


text:
namespace LASI.Interop
{
    using Utilities;
    using System;
    using System.Collections.Generic;

    /// <summary>
    /// Provides high level management facilities for the concurrency concurrency level of operations performed by the analysis facilities in LASI.Core.
    /// Adjust these values via the <see cref="SetByPerformanceMode(PerformanceProfile)"/> to dynamically adapt the peak consumption of Logical Cores.
    /// </summary>
    public static class Concurrency
    {
        static Concurrency()
        {
            // This is critical for LASI.Core to obey the same concurrency constraints as its client
            // assemblies without a circular dependency
            Core.Configuration.Configuration.ConfigureConcurrency(concurrencyCalculationMap[PerformanceProfile.High].Apply(Environment.ProcessorCount));
        }

        /// <summary>
        /// Sets the maximum allowed Concurrency level based on the supplied ResourceUsageMode.
        /// </summary>
        /// <param name="profile">
        /// The <see cref="PerformanceProfile"/> value from which to determine concurrency settings.
        /// </param>
        public static void SetByPerformanceMode(PerformanceProfile profile)
        {
            // Get the number of logical cores.
            Max = concurrencyCalculationMap[profile](Environment.ProcessorCount);
        }

        private static readonly IReadOnlyDictionary<PerformanceProfile, Func<int, int>> concurrencyCalculationMap = new Dictionary<PerformanceProfile, Func<int, int>>
        {
            [PerformanceProfile.High] = logicalCores => logicalCores < 3 ? logicalCores : logicalCores - 1,
            [PerformanceProfile.Normal] = logicalCores => logicalCores < 3 ? logicalCores : logicalCores - 2,
            [PerformanceProfile.Low] = logicalCores => logicalCores < 4 ? 1 : logicalCores - 3
        };

        /// <summary>
        /// The maximum allowed Concurrency level for Parallel operations.
        /// </summary>
        public static int Max
        {
            get;
            private set;
        }
    }
}


text:
/**
 *
 */
package com.kisueht.view.action.sheet;

import com.kisueht.view.action.AbstractAction;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ListView;

/**
 * @author kisueht
 *
 */
public class ActionSheetList extends AbstractAction{

	private ListView mListView;
	private OnActionItemSelectListener mOnActionItemSelectListener;

	private String[] contents;

	/**
	 * @param context
	 */
	protected ActionSheetList(Context context) {
		super(context);

		initView();
	}

	private void initView() {
		mListView = new ListView(getContext());
	}

	public void setContents(String[] contents) {
		this.contents = contents;

		mListView.setAdapter(new ActionListAdapter());
	}

	public void setOnActionItemSelectListener(OnActionItemSelectListener onActionItemSelectListener) {
		this.mOnActionItemSelectListener = onActionItemSelectListener;
	}

	private class ActionListAdapter extends BaseAdapter implements OnItemClickListener{

		private ActionListAdapter() {
			super();
			// TODO Auto-generated constructor stub

			mListView.setOnItemClickListener(this);
		}

		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return contents.length;
		}

		@Override
		public Object getItem(int arg0) {
			// TODO Auto-generated method stub
			return contents[arg0];
		}

		@Override
		public long getItemId(int arg0) {
			// TODO Auto-generated method stub
			return arg0;
		}

		@Override
		public View getView(int arg0, View arg1, ViewGroup arg2) {
			// TODO Auto-generated method stub

			return null;
		}

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			// TODO Auto-generated method stub
			mOnActionItemSelectListener.onItemSelect(arg2);
		}

	}

	public interface OnActionItemSelectListener{
		public void onItemSelect(int position);
	}

}


text:
function mysql_update_passwords() {
    local mysql_user; mysql_user="$( get_value MYSQL_USER '' )"
    local mysql_password; mysql_password="$( get_value MYSQL_PASSWORD '' )"
    if [ -n "${mysql_password}" ]; then
        mysql_set_password "${mysql_user}" "${mysql_password}"
    fi

    local mysql_admin_password; mysql_admin_password="$( get_value MYSQL_ADMIN_PASSWORD '' )"
    if [ -n "${mysql_admin_password}" ]; then
        if version_ge "${MYSQL_VERSION}" "5.7"; then
            mysql_create_user_if_not_exists root
        fi
        mysql_cmd <<EOSQL
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${mysql_admin_password}' WITH GRANT OPTION;
EOSQL
    elif [ "root" != "${mysql_user}" ]; then
        mysql_drop_user root
    fi
}

mysql_update_passwords


text:
package enums // import "google.golang.org/genproto/googleapis/ads/googleads/v1/enums"

import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "google.golang.org/genproto/googleapis/api/annotations"

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package

// 3-Tier brand safety suitability control.
type BrandSafetySuitabilityEnum_BrandSafetySuitability int32

const (
	// Not specified.
	BrandSafetySuitabilityEnum_UNSPECIFIED BrandSafetySuitabilityEnum_BrandSafetySuitability = 0
	// Used for return value only. Represents value unknown in this version.
	BrandSafetySuitabilityEnum_UNKNOWN BrandSafetySuitabilityEnum_BrandSafetySuitability = 1
	// This option lets you show ads across all inventory on YouTube and video
	// partners that meet our standards for monetization. This option may be an
	// appropriate choice for brands that want maximum access to the full
	// breadth of videos eligible for ads, including, for example, videos that
	// have strong profanity in the context of comedy or a documentary, or
	// excessive violence as featured in video games.
	BrandSafetySuitabilityEnum_EXPANDED_INVENTORY BrandSafetySuitabilityEnum_BrandSafetySuitability = 2
	// This option lets you show ads across a wide range of content that's
	// appropriate for most brands, such as popular music videos, documentaries,
	// and movie trailers. The content you can show ads on is based on YouTube's
	// advertiser-friendly content guidelines that take into account, for
	// example, the strength or frequency of profanity, or the appropriateness
	// of subject matter like sensitive events. Ads won't show, for example, on
	// content with repeated strong profanity, strong sexual content, or graphic
	// violence.
	BrandSafetySuitabilityEnum_STANDARD_INVENTORY BrandSafetySuitabilityEnum_BrandSafetySuitability = 3
	// This option lets you show ads on a reduced range of content that's
	// appropriate for brands with particularly strict guidelines around
	// inappropriate language and sexual suggestiveness; above and beyond what
	// YouTube's advertiser-friendly content guidelines address. The videos
	// accessible in this sensitive category meet heightened requirements,
	// especially for inappropriate language and sexual suggestiveness. For
	// example, your ads will be excluded from showing on some of YouTube's most
	// popular music videos and other pop culture content across YouTube and
	// Google video partners.
	BrandSafetySuitabilityEnum_LIMITED_INVENTORY BrandSafetySuitabilityEnum_BrandSafetySuitability = 4
)

var BrandSafetySuitabilityEnum_BrandSafetySuitability_name = map[int32]string{
	0: "UNSPECIFIED",
	1: "UNKNOWN",
	2: "EXPANDED_INVENTORY",
	3: "STANDARD_INVENTORY",
	4: "LIMITED_INVENTORY",
}
var BrandSafetySuitabilityEnum_BrandSafetySuitability_value = map[string]int32{
	"UNSPECIFIED":        0,
	"UNKNOWN":            1,
	"EXPANDED_INVENTORY": 2,
	"STANDARD_INVENTORY": 3,
	"LIMITED_INVENTORY":  4,
}

func (x BrandSafetySuitabilityEnum_BrandSafetySuitability) String() string {
	return proto.EnumName(BrandSafetySuitabilityEnum_BrandSafetySuitability_name, int32(x))
}
func (BrandSafetySuitabilityEnum_BrandSafetySuitability) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_brand_safety_suitability_9d82860afb461eab, []int{0, 0}
}

// Container for enum with 3-Tier brand safety suitability control.
type BrandSafetySuitabilityEnum struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *BrandSafetySuitabilityEnum) Reset()         { *m = BrandSafetySuitabilityEnum{} }
func (m *BrandSafetySuitabilityEnum) String() string { return proto.CompactTextString(m) }
func (*BrandSafetySuitabilityEnum) ProtoMessage()    {}
func (*BrandSafetySuitabilityEnum) Descriptor() ([]byte, []int) {
	return fileDescriptor_brand_safety_suitability_9d82860afb461eab, []int{0}
}
func (m *BrandSafetySuitabilityEnum) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_BrandSafetySuitabilityEnum.Unmarshal(m, b)
}
func (m *BrandSafetySuitabilityEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_BrandSafetySuitabilityEnum.Marshal(b, m, deterministic)
}
func (dst *BrandSafetySuitabilityEnum) XXX_Merge(src proto.Message) {
	xxx_messageInfo_BrandSafetySuitabilityEnum.Merge(dst, src)
}
func (m *BrandSafetySuitabilityEnum) XXX_Size() int {
	return xxx_messageInfo_BrandSafetySuitabilityEnum.Size(m)
}
func (m *BrandSafetySuitabilityEnum) XXX_DiscardUnknown() {
	xxx_messageInfo_BrandSafetySuitabilityEnum.DiscardUnknown(m)
}

var xxx_messageInfo_BrandSafetySuitabilityEnum proto.InternalMessageInfo

func init() {
	proto.RegisterType((*BrandSafetySuitabilityEnum)(nil), "google.ads.googleads.v1.enums.BrandSafetySuitabilityEnum")
	proto.RegisterEnum("google.ads.googleads.v1.enums.BrandSafetySuitabilityEnum_BrandSafetySuitability", BrandSafetySuitabilityEnum_BrandSafetySuitability_name, BrandSafetySuitabilityEnum_BrandSafetySuitability_value)
}

func init() {
	proto.RegisterFile("google/ads/googleads/v1/enums/brand_safety_suitability.proto", fileDescriptor_brand_safety_suitability_9d82860afb461eab)
}

var fileDescriptor_brand_safety_suitability_9d82860afb461eab = []byte{
	// 339 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x50, 0x4d, 0x4b, 0xfb, 0x30,
	0x1c, 0xfe, 0xb7, 0xfb, 0xa3, 0x90, 0x1d, 0x9c, 0x05, 0x77, 0x98, 0xee, 0xb0, 0x7d, 0x80, 0x94,
	0xe2, 0x2d, 0x7a, 0x49, 0x6d, 0x1d, 0x45, 0xcd, 0xca, 0xba, 0xd5, 0x17, 0x0a, 0x23, 0xb3, 0xb5,
	0x14, 0xb6, 0x64, 0x2c, 0xdd, 0x60, 0x07, 0x3f, 0x89, 0x37, 0x8f, 0x7e, 0x14, 0x3f, 0x8a, 0x27,
	0x3f, 0x82, 0x24, 0x71, 0x55, 0x61, 0x7a, 0x09, 0x0f, 0xbf, 0xe7, 0x85, 0x3c, 0x0f, 0x38, 0xcd,
	0x39, 0xcf, 0xa7, 0x99, 0x4d, 0x53, 0x61, 0x6b, 0x28, 0xd1, 0xca, 0xb1, 0x33, 0xb6, 0x9c, 0x09,
	0x7b, 0xb2, 0xa0, 0x2c, 0x1d, 0x0b, 0xfa, 0x90, 0x95, 0xeb, 0xb1, 0x58, 0x16, 0x25, 0x9d, 0x14,
	0xd3, 0xa2, 0x5c, 0xc3, 0xf9, 0x82, 0x97, 0xdc, 0x6a, 0x6b, 0x0b, 0xa4, 0xa9, 0x80, 0x95, 0x1b,
	0xae, 0x1c, 0xa8, 0xdc, 0xad, 0xa3, 0x4d, 0xf8, 0xbc, 0xb0, 0x29, 0x63, 0xbc, 0xa4, 0x65, 0xc1,
	0x99, 0xd0, 0xe6, 0xee, 0x93, 0x01, 0x5a, 0xae, 0xcc, 0x8f, 0x54, 0x7c, 0xf4, 0x95, 0xee, 0xb3,
	0xe5, 0xac, 0xfb, 0x08, 0x9a, 0xdb, 0x59, 0x6b, 0x0f, 0xd4, 0x47, 0x24, 0x0a, 0xfd, 0xb3, 0xe0,
	0x3c, 0xf0, 0xbd, 0xc6, 0x3f, 0xab, 0x0e, 0x76, 0x47, 0xe4, 0x82, 0xf4, 0xaf, 0x49, 0xc3, 0xb0,
	0x9a, 0xc0, 0xf2, 0x6f, 0x42, 0x4c, 0x3c, 0xdf, 0x1b, 0x07, 0x24, 0xf6, 0xc9, 0xb0, 0x3f, 0xb8,
	0x6d, 0x98, 0xf2, 0x1e, 0x0d, 0x31, 0xf1, 0xf0, 0xe0, 0xfb, 0xbd, 0x66, 0x1d, 0x80, 0xfd, 0xcb,
	0xe0, 0x2a, 0x18, 0xfe, 0x90, 0xff, 0x77, 0xdf, 0x0d, 0xd0, 0xb9, 0xe7, 0x33, 0xf8, 0x67, 0x43,
	0xf7, 0x70, 0xfb, 0x17, 0x43, 0x59, 0x30, 0x34, 0xee, 0xdc, 0x4f, 0x77, 0xce, 0xa7, 0x94, 0xe5,
	0x90, 0x2f, 0x72, 0x3b, 0xcf, 0x98, 0xaa, 0xbf, 0x59, 0x7b, 0x5e, 0x88, 0x5f, 0xc6, 0x3f, 0x51,
	0xef, 0xb3, 0x59, 0xeb, 0x61, 0xfc, 0x62, 0xb6, 0x7b, 0x3a, 0x0a, 0xa7, 0x02, 0x6a, 0x28, 0x51,
	0xec, 0x40, 0x39, 0x96, 0x78, 0xdd, 0xf0, 0x09, 0x4e, 0x45, 0x52, 0xf1, 0x49, 0xec, 0x24, 0x8a,
	0x7f, 0x33, 0x3b, 0xfa, 0x88, 0x10, 0x4e, 0x05, 0x42, 0x95, 0x02, 0xa1, 0xd8, 0x41, 0x48, 0x69,
	0x26, 0x3b, 0xea, 0x63, 0xc7, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x21, 0x5e, 0x5b, 0x6e, 0x14,
	0x02, 0x00, 0x00,
}


text:
package it.playfellas.superapp.logic.slave.game1;

import java.util.List;

import it.playfellas.superapp.logic.db.TileSelector;
import it.playfellas.superapp.tiles.Tile;

/**
 * Created by affo on 03/08/15.
 */
public class IntruderDispenserInverter extends IntruderTileDispenser {
    private IntruderTileDispenser normal;

    public IntruderDispenserInverter(TileSelector ts, IntruderTileDispenser normalDispenser) {
        super(ts);
        this.normal = normalDispenser;
    }

    @Override
    List<Tile> newTargets(int n) {
        int noCritical = n / 2;
        int noEasy = n - noCritical;
        List<Tile> tgts = normal.getTargets(n);
        List<Tile> easy = normal.getEasy(noEasy, tgts);
        List<Tile> critical = normal.getCritical(noCritical, tgts);
        easy.addAll(critical);
        return easy;
    }

    @Override
    List<Tile> newCritical(int n, List<Tile> targets) {
        return normal.getTargets(n);
    }

    @Override
    List<Tile> newEasy(int n, List<Tile> targets) {
        return normal.getTargets(n);
    }
}


text:
<?php

namespace backend\models;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Language;

/**
 * LanguageSearch represents the model behind the search form about `common\models\Language`.
 */
class LanguageSearch extends Language
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'is_default', 'sorting', 'status'], 'integer'],
            [['title', 'code', 'locale'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Language::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'defaultOrder' => ['sorting' => SORT_ASC],
            ],
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'is_default' => $this->is_default,
            'sorting' => $this->sorting,
            'status' => $this->status,
        ]);

        $query->andFilterWhere(['like', 'title', $this->title])
            ->andFilterWhere(['like', 'code', $this->code])
            ->andFilterWhere(['like', 'locale', $this->locale]);

        return $dataProvider;
    }
}


text:
var gulp       = require('gulp');
var browserify = require('browserify');
var reactify   = require('reactify');
var uglify     = require('gulp-uglify');
var source     = require('vinyl-source-stream');
var buffer     = require('vinyl-buffer');
var rename     = require('gulp-rename');
var watchify   = require('watchify');
var gutil      = require('gulp-util');
var chalk      = require('chalk');
var config     = require('../config');

function getBundler(isDev) {
    var bundler = browserify({
        entries:      [config.src + 'App.jsx'],
        extensions:   ['.js', '.jsx'],
        debug:        isDev,
        cache:        {},  // for watchify
        packageCache: {},  // for watchify
        fullPaths:    true // for watchify
    });

    bundler.transform(reactify, {
        es6: true
    });

    return bundler;
}

gulp.task('watch:js', function () {
    var watcher = watchify(getBundler(true));

    return watcher
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .on('update', function () {
            watcher.bundle()
                .pipe(source('mozaik.js'))
                .pipe(gulp.dest(config.dest))
                .pipe(buffer())
                .pipe(uglify())
                .pipe(rename({suffix: '.min'}))
                .pipe(gulp.dest(config.dest))
            ;

            gutil.log(chalk.green('Updated JavaScript sources'));
        })
        .bundle() // Create the initial bundle when starting the task
        .pipe(source('mozaik.js'))
        .pipe(gulp.dest(config.dest))
        .pipe(buffer())
        .pipe(uglify())
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest(config.dest))
    ;
});

gulp.task('watch:js:dev', function () {
    var watcher = watchify(getBundler(true));

    return watcher
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .on('update', function () {
            watcher.bundle()
                .pipe(source('mozaik.js'))
                .pipe(buffer())
                .pipe(gulp.dest(config.dest))
            ;

            gutil.log(chalk.green('Updated JavaScript sources [dev]'));
        })
        .bundle() // Create the initial bundle when starting the task
        .pipe(source('mozaik.js'))
        .pipe(gulp.dest(config.dest))
    ;
});

gulp.task('js:dev', function () {
    return getBundler(true)
        .bundle()
        .pipe(source('mozaik.js'))
        .pipe(gulp.dest(config.dest))
    ;
});

gulp.task('js', ['js:dev'], function () {
    return gulp.src(config.dest + '/mozaik.js')
        .pipe(uglify())
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest(config.dest))
    ;
});


text:
import { cond } from "./index";
export = cond;


text:
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hackvg.domain;

import com.hackvg.model.entities.MoviesWrapper;
import com.hackvg.model.rest.RestDataSource;
import com.squareup.otto.Bus;

import javax.inject.Inject;

/**
 * This class is an implementation of {@link GetMoviesUsecase}
 */
public class GetMoviesUsecaseController implements GetMoviesUsecase {

    private final RestDataSource mDataSource;
    private final Bus mUiBus;
    private int mCurrentPage = 1;

    /**
     * Constructor of the class.
     *
     * @param uiBus The bus to communicate the domain module and the app module
     * @param dataSource The data source to retrieve the list of movies
     */
    @Inject
    public GetMoviesUsecaseController(RestDataSource dataSource, Bus uiBus) {

        mDataSource = dataSource;
        mUiBus = uiBus;

        mUiBus.register(this);
    }

    @Override
    public void requestPopularMovies() {

        mDataSource.getMoviesByPage(mCurrentPage);
    }

    @Override
    public void sendMoviesToPresenter (MoviesWrapper response) {

        mUiBus.post(response);
    }

    @Override
    public void unRegister() {

        mUiBus.unregister(this);
    }

    @Override
    public void execute() {

        requestPopularMovies();
        mCurrentPage++;
    }
}


text:
         Du hast manchmal das Gefühl, dass weniger mehr wäre?
			Du willst mehr für Nachhaltigkeit tun und fragst dich, wo du ansetzen sollst?
			Egal ob Langzeit-Veganer*in oder Klima-Noob, der Wandel beginnt bei dir zu Hause.

Du hast mitgefastet? So sammelst du Klima-Punkte

				Egal, was und wie viele Tage du gefastet hast: Trage deine Erfolge unter klima-challenge.de/mitmachen ein, sammle so mit uns Klimapunkte und nimm an der Schlussverlosung teil! (Einträge bis zum 1. Mai)

	      	Das Punktesystem ist nicht auf Aktionen von Einzelpersonen zugeschnitten, daher kann es sein, dass dich manche Fragen/ Antwortmöglichkeiten etwas verwirren. Versuche einfach, so passend wie möglich zu antworten und ignoriere es einfach, wenn irrtümlich von "Verband" die Rede ist.

				Hier ein paar Tipps, was du bei nicht ganz eindeutigen Antwortoptionen angeben kannst:

				Für alle Fastenarten:

					Bitte beschreibe im Textfeld auf der ersten Seite kurz, was du gefastet hast (ggf. in welchem Rahmen/ mit wem) und ggf. welche Erfahrungen du dabei gemacht hast/ wie die Erfahrung war.

					Bei der Teilnehmerzahl trägst du ein, ob du alleine klima-gefastet hast oder mit anderen als Gruppe (dann bitte nur ein gemeinsamer Eintrag)

					"In Bezug auf die klimafreundliche Aktion haben die Teilnehmer_innen…
					=> wähle "sich engagiert, selbst mit angepackt oder sind aktiv geworden."

					"Wurden den Teilnehmer_innen Ideen mitgegeben, was sie über diese Aktion hinaus konkret selbst tun können, um das Klima zu schützen?" → Ja (durch die Mails der Klima-Challenge)

					Wieviel Zeit habt Ihr für Planung, Durchführung und Nachbereitung gebraucht? Hier kannst du angeben, wie viel Zeit dich die Umstellung, z.B. für die Recherche von Alternativen, in etwa gekostet hat.

				Versuchs-Vegetarier_in/ -Veganer_in

					Wähle bei "Welche Aktion habt ihr durchgeführt" Versuchsvegetarier_in/ Versuchsveganer_in

		      Plastik-Fasten

					Wähle bei "Welche Aktion habt ihr durchgeführt?": Sonstiges

					Kurzbeschreibung im Textfeld: Bitte beschreibe so genau wie möglich, was du eingespart hast. Welche Verpackungen/ Plastikartikel konntest du einsparen und wie häufig war das? Hast du dir irgendwas angeschafft, das Plastikartikel dauerhaft ersetzt? Hast du auf andere Weise Plastik vermieden? Lass' uns wissen, wie! Wir berechnen dann deine zusätzlichen Klima-Punkte :)

				Shopping-Fasten

		      	Wähle bei "Welche Aktion habt ihr durchgeführt" Shopping-Fasten

					"Auf wie viele neue Kleidungsstücke wurde verzichtet?" → Hierzu zählen alle Kleidungsstücke, die du gekauft hättest, wenn du nicht gefastet hättest. Überlege dir, wie viele Kleidungsstücke du sonst pro Monat kaufst und orientiere dich daran.

			<md-whiteframe class="md-whiteframe-z2 card">

Voller Erfolg!

				Diese Fastenzeit stand ganz im Zeichen des Klimaschutzes. Wir können stolz verkünden: 40 Tage lang haben 300 junge Menschen die Challenge verfolgt, ihr Alltagshandeln klimafreundlicher zu gestalten! Das ist eine tolle Bilanz, danke an alle Teilnehmer_innen!

			</md-whiteframe>

Mitmachen - so geht's!

Wähle aus folgenden Kanälen, um unsere Tipps und Tricks zu entdecken: Messenger (Whatsapp oder Telegram), Instagram, unsere Facebook-Gruppe oder E-Mail. Für Whatsapp/Telegram und E-Mail melde dich in den folgenden Formularen an, für Instagram und Facebook folge den Links.

				<md-whiteframe class="md-whiteframe-z2 card action-card">

                  <ng-md-icon style="fill: #02bcd4" size="90" icon="whatsapp"></ng-md-icon>

Mitmachen per Messenger

Liste der TeilnehmerInnen (nur für Admins sichtbar):

						<md-list>
							<md-list-item class="md-3-line" ng-repeat="participant in messengerParticipants">

{{ participant.fullName }}

{{ participant.mobile }}

{{ participant.selectedOffer == 'Sonstiges' ? participant.customOffer : participant.selectedOffer }}

{{ participant.messengerType }}

							</md-list-item>
						</md-list>

							Vielen Dank fürs Mitmachen!

						<form name="messengerForm" ng-submit="addMessenger()" ng-hide="messengerSubmitted">
							<md-input-container flex>
								Name (+ ggf. Verband)
								<input type="text" ng-model="fullName" ng-required="true">
							</md-input-container>
							<md-input-container flex>
								Dein Beitrag
								<select ng-model="selectedOffer" required>
									<option ng-repeat="offer in offers">{{ offer }}</option>
								</select>
							</md-input-container>
							<md-input-container ng-show="selectedOffer == 'Sonstiges'" flex>
	                     Was ist dein Ziel?
	                     <input type="text" ng-model="customOffer">
	                  </md-input-container>
							<md-input-container flex>
	                     Handynummer eintragen
	                     <input type="text" ng-model="mobile" ng-required="true">
	                  </md-input-container>
							<md-button class="md-raised md-primary" style="float: right">Mitmachen</md-button>
							<md-radio-group ng-model="messengerType">
								<md-radio-button value="WhatsApp">WhatsApp</md-radio-button>
								<md-radio-button value="Telegram">Telegram</md-radio-button>
							</md-radio-group>
						</form>
                  Wir nehmen dich gerne in unsere Telegram- oder Whatsapp-Broadcast-Gruppe auf (d.h. ohne Gruppenchat). WICHTIG! Nur, wenn du unsere Nummer in deinen Kontakten abspeicherst, können wir dich hinzufügen: +491772730898.

            </md-whiteframe>

				<md-whiteframe class="md-whiteframe-z2 card action-card">

                  <ng-md-icon style="fill: #02bcd4" size="90" icon="email"></ng-md-icon>

Mitmachen per E-Mail

Liste der TeilnehmerInnen (nur für Admins sichtbar):

						<md-list>
							<md-list-item class="md-3-line" ng-repeat="participant in emailParticipants">

{{ participant.fullName }}

{{ participant.email }}

{{ participant.selectedOffer == 'Sonstiges' ? participant.customOffer : participant.selectedOffer }}

							</md-list-item>
						</md-list>

							Vielen Dank fürs Mitmachen!

						<form name="emailForm" ng-submit="addEmail()" ng-hide="emailSubmitted">
							<md-input-container flex>
								Name (+ ggf. Verband)
								<input type="text" ng-model="fullName" ng-required="true">
							</md-input-container>
							<md-input-container flex>
								Dein Beitrag
								<select ng-model="selectedOffer" required>
									<option ng-repeat="offer in offers">{{ offer }}</option>
								</select>
							</md-input-container>
							<md-input-container ng-show="selectedOffer == 'Sonstiges'" flex>
	                     Was ist dein Ziel?
	                     <input type="text" ng-model="customOffer">
	                  </md-input-container>
							<md-button class="md-raised md-primary" style="float: right">Mitmachen</md-button>
							<md-input-container flex>
	                     E-Mail-Adresse eintragen
	                     <input type="email" ng-model="email" ng-required="true">
	                  </md-input-container>
						</form>
                  Du erhältst während des Klimafastens eine wöchentliche Zusammenfassung unserer Posts und Kurznachrichten per E-Mail von uns.

            </md-whiteframe>

Deine Belohnung:
Punkte, Poetry und Preise

         Neben der wohligen Gewissheit, etwas Gutes getan zu haben, kannst du nach Ende der Fastenzeit deine Erfolge bei uns auf der Seite eintragen und so Punkte für die Klima-Challenge sammeln.

				Wenn wir das letzte Etappenziel erreichen, stellt sich Minister Wenzel der finalen Herausforderung und tritt bei unserem Poetry Slam auf der IdeenExpo auf!

				Außerdem kannst du tolle Preise absahnen! Damit du nach der Fastenzeit weiter durchhältst, verlosen wir als Starthilfe Klima-Kochbücher, schnieke Soulbottles und Bahngutscheine.

			<md-whiteframe class="md-whiteframe-z2 card small-frame rotate-right" style="max-width: 400px; margin: 0 auto;">

                  Macht mit beim #klimafasten2017

         </md-whiteframe>


text:
package demo.inventory.function;

import demo.inventory.domain.Inventory;
import demo.inventory.domain.InventoryStatus;
import demo.inventory.event.InventoryEvent;
import demo.inventory.event.InventoryEventType;
import org.apache.log4j.Logger;
import org.springframework.statemachine.StateContext;

import java.util.function.Function;

public class InventoryReleased extends InventoryFunction {

    final private Logger log = Logger.getLogger(InventoryReleased.class);

    public InventoryReleased(StateContext<InventoryStatus, InventoryEventType> context, Function<InventoryEvent,
            Inventory> lambda) {
        super(context, lambda);
    }

    /**
     * Apply an {@link InventoryEvent} to the lambda function that was provided through the
     * constructor of this {@link InventoryFunction}.
     *
     * @param event is the {@link InventoryEvent} to apply to the lambda function
     */
    @Override
    public Inventory apply(InventoryEvent event) {
        log.info("Executing workflow for inventory released...");
        return super.apply(event);
    }
}


text:
<?php

/**
 *  Bluware PHP Lite & Scaleable Web Frame.
 *
 *  @author   Eugen Melnychenko
 */

namespace Frame\Daemon;

class Exception extends \Exception
{
    //
}


text:
package org.apache.ignite.internal.processors.hadoop.impl.examples;

import java.io.IOException;
import java.util.Iterator;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reducer;
import org.apache.hadoop.mapred.Reporter;
import org.apache.ignite.internal.processors.hadoop.impl.HadoopErrorSimulator;

/**
 * Combiner and Reducer phase of WordCount job.
 */
public class HadoopWordCount1Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
    /** Flag is to check that mapper was configured before run. */
    private boolean wasConfigured;

    /** {@inheritDoc} */
    @Override public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter)
            throws IOException {
        assert wasConfigured : "Reducer should be configured";

        int sum = 0;

        while (values.hasNext())
            sum += values.next().get();

        output.collect(key, new IntWritable(sum));

        HadoopErrorSimulator.instance().onReduce();
    }

    /** {@inheritDoc} */
    @Override public void configure(JobConf job) {
        super.configure(job);

        wasConfigured = true;

        HadoopErrorSimulator.instance().onReduceConfigure();
    }
}


text:
'use strict';

var Lash = require('../index');
var test = require('tap').test;

test('Lash error handling', function (t) {

    t.plan(1);
    var s = Lash();

    s.stack(function produceerror (next) {
        // pass through this step right away with no errors
        // then fire an error 2 seconds after.
        // it should interrupt the stack down the line.
        setTimeout(function () {
            next('this is an error');
        }, 2000);

        next(null);
    });

    s.stack(function mockProcessingFunc (next) {
        // here we pretend to be doing some work for 3
        // seconds. If an err happens during the work,
        // next should be noop.
        setTimeout(function () {

            // things can still happen here until
            // next() is called and it goes nowhere.

            // should be noop and lead nowhere
            // as previous function errored the stack.
            next(null);

        }, 3000);
    });

    s.stack(function shouldNotReach (next) {
        t.fail('should not hit this function');
        next(null);
    });

    s.stack(function closeStack (err) {
        t.equal(err, 'this is an error');
    });

    s.collapse();
});


text:
(function () {
    'use strict';
    angular.module('ftDashboard.components.settings', [])
        .value('version', '0.1')

        .value('youtrackUri', 'Your YoutrackUri with trailing slash')
        .value('youtrackLogin', 'your youtrack login with admin rights')
        .value('youtrackPassword', 'your password')
        .value('youtrackProjectId', 'your youtrack project ID')
        .value('youtrackUserRole', 'youtrack user role to be tracked in hall')
        .value('youtrackAgileBoard', 'name of the agile board')
        /**
         * If instead of only finished tasks you want to add also burned points then
         * fill this value, if not, it should be null. You should put here exact
         * name of estimated story points field (with spaces and correct letter case)
         *
         * {String} Name of a field or null if tracking disabled
         */
        .value('youtrackEstimationField', "Estimated story points field name")

        .value('gitlabProjectId', ['an array', 'of', 'your gitlab project ID'])
        .value('gitlabToken', 'your gitlab private token')
        .value('gitlabUri', 'your gitlab URI with a trailing slash')
        //TODO: cleanup all usages of this URI, pass gitlabUri and project id instead
        .factory('gitlabProjectUri', ['gitlabUri', 'gitlabProjectId', function(gitlabUri, gitlabProjectId) {
            return gitlabUri + 'api/v3/projects/' + gitlabProjectId + '/';
        }])

        .value('jenkinsToken', 'your jenkins private token')
        .value('jenkinsUri', 'Your jenkins URI with a trailing slash')
        .factory('jenkinsProjectUri', ['jenkinsUri', function(jenkinsUri) {
            return jenkinsUri + 'job/<your project name>/lastBuild/api/json';
        }])

        //if you're using remine as a issues backend, then this should be filled
        .value('redmineKey', 'your redmine key')
        .value('redmineUri', 'your redmine URI with trailing slash')
        .factory('projectUri', ['redmineUri', function(redmineUri) {
             return redmineUri + '/projects/[your project name in a redmine]/';
        }])
        //redmine group id
        .value('groupId', 'your group ID (integer) containing users')
        .factory('Versions', ['$resource', 'projectUri', 'redmineKey', function ($resource, projectUri, redmineKey) {
            return $resource(projectUri + 'versions.json', {key: redmineKey});
        }])

        /*
         * General app settings, independent to backends, but might be used
         * by them as well.
         *
         */
        .value('hallLength', 3)
        //defines how long pagination should be done before quitting
        //you should use this value in your services if you want to implement
        //recursive calls for data
        .value('maxRecursiveCalls', 200)
        ;
})();


text:
import os, sys

_PIGASUS_PLUGIN_DIR = "PIGASUS_PLUGIN_DIR"

def load(name):
    try:
        path = os.environ[_PIGASUS_PLUGIN_DIR]
    except KeyError:
        print("Error: Please set the environment variable ", _PIGASUS_PLUGIN_DIR)
        sys.exit(1)
    # ... add _PIGASUS_PLUGIN_DIR into PYTHONPATH
    sys.path.insert(0,path)
    # ...
    try:
        mod = __import__("%s" % name)
        return mod
    except:
        print("Error: the module ", name \
                , " is not installed. Please download and save it in " \
                , path \
                , " for any additional information, contact ratnaniahmed@gmail.com")
        sys.exit(1)


text:
package query

import (
	"testing"

	. "github.com/smartystreets/goconvey/convey"
)

func TestDecorator(t *testing.T) {
	Convey("NewDecorator", t, func() {
		So(func() { NewDecorator("", Args{}) }, ShouldNotPanic)
	})

	Convey("Apply", t, func() {

		Convey("When the statement doesn't include the placeholder of decorator", func() {
			statement := "SELECT * FROM [account.table]"

			d := NewDecorator(statement, Args{startDate: "2015-07-08 17:00:00"})
			actual, err := d.Apply()

			So(actual, ShouldBeBlank)
			So(err, ShouldNotBeNil)
		})

		Convey("When the statement includes the placeholder of decorator", func() {
			statement := "SELECT * FROM [account.table@]"

			Convey("The argument includes the startDate", func() {

				Convey("The argument of startDate is formatted date string", func() {
					startDate := "2015-07-08 17:00:00"

					Convey("The argument of tz is 0, which means UTC", func() {
						d := NewDecorator(statement, Args{startDate: startDate, buffer: 1})
						actual, err := d.Apply()

						expected := "SELECT * FROM [account.table@1436371200000-]"
						So(actual, ShouldEqual, expected)
						So(err, ShouldBeNil)
					})

					Convey("The argument of tz is -9, which means JST", func() {
						d := NewDecorator(statement, Args{startDate: startDate, tz: -9, buffer: 1})
						actual, err := d.Apply()

						expected := "SELECT * FROM [account.table@1436338800000-]"
						So(actual, ShouldEqual, expected)
						So(err, ShouldBeNil)
					})
				})

				Convey("The argument of startDate is not formatted date string", func() {
					startDate := "2015/07/08 170000"

					d := NewDecorator(statement, Args{startDate: startDate})
					actual, err := d.Apply()

					So(actual, ShouldBeBlank)
					So(err, ShouldNotBeNil)
				})
			})

			Convey("The argument includes the startDate and endDate", func() {

				Convey("The argument of startDate and endDate are formatted date string", func() {
					startDate := "2015-07-08 17:00:00"
					endDate := "2015-07-08 18:00:00"

					Convey("The argument of tz is 0, which means UTC", func() {
						d := NewDecorator(statement, Args{startDate: startDate, endDate: endDate, buffer: 1})
						actual, err := d.Apply()

						expected := "SELECT * FROM [account.table@1436371200000-1436382000000]"
						So(actual, ShouldEqual, expected)
						So(err, ShouldBeNil)
					})

					Convey("The argument of tz is -9, which means JST", func() {
						d := NewDecorator(statement, Args{startDate: startDate, endDate: endDate, tz: -9, buffer: 1})
						actual, err := d.Apply()

						expected := "SELECT * FROM [account.table@1436338800000-1436349600000]"
						So(actual, ShouldEqual, expected)
						So(err, ShouldBeNil)
					})
				})

				Convey("The argument of endDate is not formatted date string", func() {
					startDate := "2015-07-08 17:00:00"
					endDate := "2015/07/08 180000"

					d := NewDecorator(statement, Args{startDate: startDate, endDate: endDate})
					actual, err := d.Apply()

					So(actual, ShouldBeBlank)
					So(err, ShouldNotBeNil)
				})
			})

			Convey("The argument includes the beforeHour", func() {

				Convey("The argument of beforeHour is greater than 0", func() {
					d := NewDecorator(statement, Args{beforeHour: 3.0, buffer: 1})
					actual, err := d.Apply()

					expected := "SELECT * FROM [account.table@-10800000-]"
					So(actual, ShouldEqual, expected)
					So(err, ShouldBeNil)
				})

				Convey("The argument of beforeHour is 0", func() {
					d := NewDecorator(statement, Args{beforeHour: 1.0, buffer: 1})
					actual, err := d.Apply()

					expected := "SELECT * FROM [account.table@-3600000-]"
					So(actual, ShouldEqual, expected)
					So(err, ShouldBeNil)
				})
			})
		})

		Convey("When the statement includes the placeholders of decorator and customFunc", func() {
			statement := "SELECT * FROM [account.table@] WHERE _tz(2015-07-08 17:00:00) <= time"
			d := NewDecorator(statement, Args{beforeHour: 3.0, tz: -9.0, buffer: 1})
			actual, err := d.Apply()

			expected := "SELECT * FROM [account.table@-10800000-] WHERE DATE_ADD('2015-07-08 17:00:00', -9, 'HOUR') <= time"
			So(actual, ShouldEqual, expected)
			So(err, ShouldBeNil)
		})
	})

	Convey("Revert", t, func() {
		statement := "SELECT * FROM [account.table@] WHERE _tz(2015-07-08 17:00:00) <= time ORDER BY time DESC"
		d := NewDecorator(statement, Args{tz: -9})

		expected := "SELECT * FROM [account.table] WHERE DATE_ADD('2015-07-08 17:00:00', -9, 'HOUR') <= time ORDER BY time DESC"
		So(d.Revert(), ShouldEqual, expected)
	})
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Observ. mycol. (Havniae) 1: 66 (1815)

#### Original name
Agaricus leucothejus Fr.

### Remarks
null


text:
from __future__ import absolute_import, print_function, unicode_literals

import time

class Clock(object):
    """ Logical timestamp generator.
    """
    def __init__(self, timestamp=None):
        if timestamp:
            self.l = (timestamp >> 16) & 0xffffffffffff
            self.c = timestamp & 0xffff
        else:
            self.l = 0
            self.c = 0
            self.tick()

    def update(self, rt=None):
        """ Updates the clock with a received timestamp from another node.

        :param rt: received timestamp
        """
        ml = (rt >> 16) & 0xffffffffffff
        mc = rt & 0xffff

        old_l = self.l
        pt = int(round((time.time() + 0.0005) * 1000.0))
        self.l = max(old_l, ml, pt)
        if self.l == old_l == ml:
            self.c = max(self.c, mc) + 1
        elif self.l == old_l:
            self.c += 1
        elif self.l == ml:
            self.c = mc + 1
        else:
            self.c = 0

    def tick(self):
        """ Updates and tick the clock for local or send events.

        :return: the updated timestamp
        """
        # local or send event
        old_l = self.l
        pt = int(round((time.time() + 0.0005) * 1000.0))
        self.l = max(old_l, pt)
        if self.l == old_l:
            self.c += 1
        else:
            self.c = 0

        return self.timestamp()

    def timestamp(self):
        """ Gets the current timestamp without updating counter.

        :return: the timestamp
        """
        return (self.l << 16) | self.c

    def seconds(self):
        """ Gets the value compatible with time.time() function.

        :return: the float value represent seconds from epoc
        """
        return (self.l/1000.0) + (self.c/65536.0)

    def __hash__(self):
        return self.timestamp()

    def __cmp__(self, other):
        if self.l != other.l:
            if self.l > other.l:
                return 1
            if self.l < other.l:
                return -1

        if self.c != other.c:
            if self.c > other.c:
                return 1
            if self.c < other.c:
                return -1
        return 0

    def __repr__(self):
        return "Clock[l=%r, c=%r]" % (self.l, self.c)

    @staticmethod
    def timestamp_to_secs(ts):
        """ Converts a timestamp to seconds.
        :param ts: the clock's timestamp.
        :return:
        """
        l = (ts >> 16) & 0xffffffffffff
        c = ts & 0xffff
        return (l/1000.0) + (c/65536.0)

clock = Clock()

__all__ = ['Clock', 'clock']


text:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
    <Appenders>
        <Console name="Console">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
        <File name="MyFile" fileName="logs/log4j.log">
            <PatternLayout>
                <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n</Pattern>
            </PatternLayout>
        </File>
        <Async name="Async">
            <AppenderRef ref="MyFile"/>
        </Async>
    </Appenders>
    <Loggers>
        <Root level="error">
            <AppenderRef ref="Console"/>
        </Root>
    </Loggers>
</Configuration>


text:
var path = require('path');
var webpack = require('webpack');

var webpackDevHost = 'localhost'
var webpackDevPort = '7777'

module.exports = {
  devtool: 'cheap-module-eval-source-map',
  entry: [
    'webpack-dev-server/client?http://' + webpackDevHost + ':' + webpackDevPort,
    'webpack/hot/only-dev-server',
    './index'
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ],
  resolve: {
    extensions: ['', '.js']
  },
  module: {
    loaders: [{
      test: /\.js$/,
      loaders: ['react-hot', 'babel'],
      exclude: /node_modules/,
      include: __dirname
    }]
  }
};