text:
package marc.henrard.murisq.product.futures;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;

import org.joda.beans.Bean;
import org.joda.beans.ImmutableBean;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaBean;
import org.joda.beans.MetaProperty;
import org.joda.beans.gen.BeanDefinition;
import org.joda.beans.gen.ImmutableValidator;
import org.joda.beans.gen.PropertyDefinition;
import org.joda.beans.impl.direct.DirectFieldsBeanBuilder;
import org.joda.beans.impl.direct.DirectMetaBean;
import org.joda.beans.impl.direct.DirectMetaProperty;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;

import com.opengamma.strata.collect.ArgChecker;
import com.opengamma.strata.product.ResolvedProduct;
import com.opengamma.strata.product.SecurityId;
import com.opengamma.strata.product.swap.ResolvedSwap;
import com.opengamma.strata.product.swap.ResolvedSwapLeg;
import com.opengamma.strata.product.swap.SwapLegType;

/**
 * A futures based on an Overnight Indexed Swap.
 *

 * The futures price represents the fixed rate of the OIS delivered.
 * Long the futures is long the rate and equivalent to a pay fix OIS.
 *

 * This futures design is described in:
 * Henrard, Marc (2018). Risk-based overnight-linked futures design. TODO: Add SSRN publication link when available.
 *
 * @author Marc Henrard
 */
@BeanDefinition
public class OisFuturesResolved
    implements ResolvedProduct, ImmutableBean, Serializable {

/**
 * The security identifier.
 *

 * This identifier uniquely identifies the security within the system.
 */
@PropertyDefinition(validate = "notNull")
private final SecurityId securityId;
/**
 * The OIS underlying the futures.
 */
@PropertyDefinition(validate = "notNull")
private final ResolvedSwap underlying;
/**
 * The accrual factor or risk measure associated to the futures, typically 0.25 for a 3-month swap.
 */
@PropertyDefinition(validate = "ArgChecker.notNegativeOrZero")
private final double accrualFactor;
/**
 * The futures notional.
 */
@PropertyDefinition(validate = "ArgChecker.notNegativeOrZero")
private final double notional;
/**
 * The last trading date.
 */
@PropertyDefinition(validate = "notNull")
private final LocalDate lastTradeDate;

//-------------------------------------------------------------------------
@ImmutableValidator
private void validate() {
  List<ResolvedSwapLeg> legs = underlying.getLegs();
  ArgChecker.isTrue(legs.size() == 2, "underlying swap must have two legs");
  ArgChecker.isTrue(legs.get(0).getType().equals(SwapLegType.FIXED),
      "underlying swap first leg must be fixed");
  ArgChecker.isTrue(legs.get(1).getType().equals(SwapLegType.OVERNIGHT),
      "underlying swap second leg must be overnight");
  ArgChecker.isFalse(legs.get(0).getStartDate().isBefore(lastTradeDate),
      "underlying swap start must be on or after last trade date");
}

  //------------------------- AUTOGENERATED START -------------------------
  /**
   * The meta-bean for {@code OisFuturesResolved}.
   * @return the meta-bean, not null
   */
  public static OisFuturesResolved.Meta meta() {
    return OisFuturesResolved.Meta.INSTANCE;
  }

  static {
    MetaBean.register(OisFuturesResolved.Meta.INSTANCE);
  }

  /**
   * The serialization version id.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Returns a builder used to create an instance of the bean.
   * @return the builder, not null
   */
  public static OisFuturesResolved.Builder builder() {
    return new OisFuturesResolved.Builder();
  }

  /**
   * Restricted constructor.
   * @param builder  the builder to copy from, not null
   */
  protected OisFuturesResolved(OisFuturesResolved.Builder builder) {
    JodaBeanUtils.notNull(builder.securityId, "securityId");
    JodaBeanUtils.notNull(builder.underlying, "underlying");
    ArgChecker.notNegativeOrZero(builder.accrualFactor, "accrualFactor");
    ArgChecker.notNegativeOrZero(builder.notional, "notional");
    JodaBeanUtils.notNull(builder.lastTradeDate, "lastTradeDate");
    this.securityId = builder.securityId;
    this.underlying = builder.underlying;
    this.accrualFactor = builder.accrualFactor;
    this.notional = builder.notional;
    this.lastTradeDate = builder.lastTradeDate;
    validate();
  }

  @Override
  public OisFuturesResolved.Meta metaBean() {
    return OisFuturesResolved.Meta.INSTANCE;
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the security identifier.
   *

   * This identifier uniquely identifies the security within the system.
   * @return the value of the property, not null
   */
  public SecurityId getSecurityId() {
    return securityId;
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the OIS underlying the futures.
   * @return the value of the property, not null
   */
  public ResolvedSwap getUnderlying() {
    return underlying;
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the accrual factor or risk measure associated to the futures, typically 0.25 for a 3-month swap.
   * @return the value of the property
   */
  public double getAccrualFactor() {
    return accrualFactor;
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the futures notional.
   * @return the value of the property
   */
  public double getNotional() {
    return notional;
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the last trading date.
   * @return the value of the property, not null
   */
  public LocalDate getLastTradeDate() {
    return lastTradeDate;
  }

  //-----------------------------------------------------------------------
  /**
   * Returns a builder that allows this bean to be mutated.
   * @return the mutable builder, not null
   */
  public Builder toBuilder() {
    return new Builder(this);
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if (obj != null && obj.getClass() == this.getClass()) {
      OisFuturesResolved other = (OisFuturesResolved) obj;
      return JodaBeanUtils.equal(securityId, other.securityId) &&
          JodaBeanUtils.equal(underlying, other.underlying) &&
          JodaBeanUtils.equal(accrualFactor, other.accrualFactor) &&
          JodaBeanUtils.equal(notional, other.notional) &&
          JodaBeanUtils.equal(lastTradeDate, other.lastTradeDate);
    }
    return false;
  }

  @Override
  public int hashCode() {
    int hash = getClass().hashCode();
    hash = hash * 31 + JodaBeanUtils.hashCode(securityId);
    hash = hash * 31 + JodaBeanUtils.hashCode(underlying);
    hash = hash * 31 + JodaBeanUtils.hashCode(accrualFactor);
    hash = hash * 31 + JodaBeanUtils.hashCode(notional);
    hash = hash * 31 + JodaBeanUtils.hashCode(lastTradeDate);
    return hash;
  }

  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(192);
    buf.append("OisFuturesResolved{");
    int len = buf.length();
    toString(buf);
    if (buf.length() > len) {
      buf.setLength(buf.length() - 2);
    }
    buf.append('}');
    return buf.toString();
  }

  protected void toString(StringBuilder buf) {
    buf.append("securityId").append('=').append(JodaBeanUtils.toString(securityId)).append(',').append(' ');
    buf.append("underlying").append('=').append(JodaBeanUtils.toString(underlying)).append(',').append(' ');
    buf.append("accrualFactor").append('=').append(JodaBeanUtils.toString(accrualFactor)).append(',').append(' ');
    buf.append("notional").append('=').append(JodaBeanUtils.toString(notional)).append(',').append(' ');
    buf.append("lastTradeDate").append('=').append(JodaBeanUtils.toString(lastTradeDate)).append(',').append(' ');
  }

  //-----------------------------------------------------------------------
  /**
   * The meta-bean for {@code OisFuturesResolved}.
   */
  public static class Meta extends DirectMetaBean {
    /**
     * The singleton instance of the meta-bean.
     */
    static final Meta INSTANCE = new Meta();

    /**
     * The meta-property for the {@code securityId} property.
     */
    private final MetaProperty<SecurityId> securityId = DirectMetaProperty.ofImmutable(
        this, "securityId", OisFuturesResolved.class, SecurityId.class);
    /**
     * The meta-property for the {@code underlying} property.
     */
    private final MetaProperty<ResolvedSwap> underlying = DirectMetaProperty.ofImmutable(
        this, "underlying", OisFuturesResolved.class, ResolvedSwap.class);
    /**
     * The meta-property for the {@code accrualFactor} property.
     */
    private final MetaProperty<Double> accrualFactor = DirectMetaProperty.ofImmutable(
        this, "accrualFactor", OisFuturesResolved.class, Double.TYPE);
    /**
     * The meta-property for the {@code notional} property.
     */
    private final MetaProperty<Double> notional = DirectMetaProperty.ofImmutable(
        this, "notional", OisFuturesResolved.class, Double.TYPE);
    /**
     * The meta-property for the {@code lastTradeDate} property.
     */
    private final MetaProperty<LocalDate> lastTradeDate = DirectMetaProperty.ofImmutable(
        this, "lastTradeDate", OisFuturesResolved.class, LocalDate.class);
    /**
     * The meta-properties.
     */
    private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap(
        this, null,
        "securityId",
        "underlying",
        "accrualFactor",
        "notional",
        "lastTradeDate");

    /**
     * Restricted constructor.
     */
    protected Meta() {
    }

    @Override
    protected MetaProperty<?> metaPropertyGet(String propertyName) {
      switch (propertyName.hashCode()) {
        case 1574023291:  // securityId
          return securityId;
        case -1770633379:  // underlying
          return underlying;
        case -1540322338:  // accrualFactor
          return accrualFactor;
        case 1585636160:  // notional
          return notional;
        case -1041950404:  // lastTradeDate
          return lastTradeDate;
      }
      return super.metaPropertyGet(propertyName);
    }

    @Override
    public OisFuturesResolved.Builder builder() {
      return new OisFuturesResolved.Builder();
    }

    @Override
    public Class<? extends OisFuturesResolved> beanType() {
      return OisFuturesResolved.class;
    }

    @Override
    public Map<String, MetaProperty<?>> metaPropertyMap() {
      return metaPropertyMap$;
    }

    //-----------------------------------------------------------------------
    /**
     * The meta-property for the {@code securityId} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<SecurityId> securityId() {
      return securityId;
    }

    /**
     * The meta-property for the {@code underlying} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<ResolvedSwap> underlying() {
      return underlying;
    }

    /**
     * The meta-property for the {@code accrualFactor} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<Double> accrualFactor() {
      return accrualFactor;
    }

    /**
     * The meta-property for the {@code notional} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<Double> notional() {
      return notional;
    }

    /**
     * The meta-property for the {@code lastTradeDate} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<LocalDate> lastTradeDate() {
      return lastTradeDate;
    }

    //-----------------------------------------------------------------------
    @Override
    protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
      switch (propertyName.hashCode()) {
        case 1574023291:  // securityId
          return ((OisFuturesResolved) bean).getSecurityId();
        case -1770633379:  // underlying
          return ((OisFuturesResolved) bean).getUnderlying();
        case -1540322338:  // accrualFactor
          return ((OisFuturesResolved) bean).getAccrualFactor();
        case 1585636160:  // notional
          return ((OisFuturesResolved) bean).getNotional();
        case -1041950404:  // lastTradeDate
          return ((OisFuturesResolved) bean).getLastTradeDate();
      }
      return super.propertyGet(bean, propertyName, quiet);
    }

    @Override
    protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
      metaProperty(propertyName);
      if (quiet) {
        return;
      }
      throw new UnsupportedOperationException("Property cannot be written: " + propertyName);
    }

  }

  //-----------------------------------------------------------------------
  /**
   * The bean-builder for {@code OisFuturesResolved}.
   */
  public static class Builder extends DirectFieldsBeanBuilder<OisFuturesResolved> {

    private SecurityId securityId;
    private ResolvedSwap underlying;
    private double accrualFactor;
    private double notional;
    private LocalDate lastTradeDate;

    /**
     * Restricted constructor.
     */
    protected Builder() {
    }

    /**
     * Restricted copy constructor.
     * @param beanToCopy  the bean to copy from, not null
     */
    protected Builder(OisFuturesResolved beanToCopy) {
      this.securityId = beanToCopy.getSecurityId();
      this.underlying = beanToCopy.getUnderlying();
      this.accrualFactor = beanToCopy.getAccrualFactor();
      this.notional = beanToCopy.getNotional();
      this.lastTradeDate = beanToCopy.getLastTradeDate();
    }

    //-----------------------------------------------------------------------
    @Override
    public Object get(String propertyName) {
      switch (propertyName.hashCode()) {
        case 1574023291:  // securityId
          return securityId;
        case -1770633379:  // underlying
          return underlying;
        case -1540322338:  // accrualFactor
          return accrualFactor;
        case 1585636160:  // notional
          return notional;
        case -1041950404:  // lastTradeDate
          return lastTradeDate;
        default:
          throw new NoSuchElementException("Unknown property: " + propertyName);
      }
    }

    @Override
    public Builder set(String propertyName, Object newValue) {
      switch (propertyName.hashCode()) {
        case 1574023291:  // securityId
          this.securityId = (SecurityId) newValue;
          break;
        case -1770633379:  // underlying
          this.underlying = (ResolvedSwap) newValue;
          break;
        case -1540322338:  // accrualFactor
          this.accrualFactor = (Double) newValue;
          break;
        case 1585636160:  // notional
          this.notional = (Double) newValue;
          break;
        case -1041950404:  // lastTradeDate
          this.lastTradeDate = (LocalDate) newValue;
          break;
        default:
          throw new NoSuchElementException("Unknown property: " + propertyName);
      }
      return this;
    }

    @Override
    public Builder set(MetaProperty<?> property, Object value) {
      super.set(property, value);
      return this;
    }

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

    //-----------------------------------------------------------------------
    /**
     * Sets the security identifier.
     *

     * This identifier uniquely identifies the security within the system.
     * @param securityId  the new value, not null
     * @return this, for chaining, not null
     */
    public Builder securityId(SecurityId securityId) {
      JodaBeanUtils.notNull(securityId, "securityId");
      this.securityId = securityId;
      return this;
    }

    /**
     * Sets the OIS underlying the futures.
     * @param underlying  the new value, not null
     * @return this, for chaining, not null
     */
    public Builder underlying(ResolvedSwap underlying) {
      JodaBeanUtils.notNull(underlying, "underlying");
      this.underlying = underlying;
      return this;
    }

    /**
     * Sets the accrual factor or risk measure associated to the futures, typically 0.25 for a 3-month swap.
     * @param accrualFactor  the new value
     * @return this, for chaining, not null
     */
    public Builder accrualFactor(double accrualFactor) {
      ArgChecker.notNegativeOrZero(accrualFactor, "accrualFactor");
      this.accrualFactor = accrualFactor;
      return this;
    }

    /**
     * Sets the futures notional.
     * @param notional  the new value
     * @return this, for chaining, not null
     */
    public Builder notional(double notional) {
      ArgChecker.notNegativeOrZero(notional, "notional");
      this.notional = notional;
      return this;
    }

    /**
     * Sets the last trading date.
     * @param lastTradeDate  the new value, not null
     * @return this, for chaining, not null
     */
    public Builder lastTradeDate(LocalDate lastTradeDate) {
      JodaBeanUtils.notNull(lastTradeDate, "lastTradeDate");
      this.lastTradeDate = lastTradeDate;
      return this;
    }

    //-----------------------------------------------------------------------
    @Override
    public String toString() {
      StringBuilder buf = new StringBuilder(192);
      buf.append("OisFuturesResolved.Builder{");
      int len = buf.length();
      toString(buf);
      if (buf.length() > len) {
        buf.setLength(buf.length() - 2);
      }
      buf.append('}');
      return buf.toString();
    }

    protected void toString(StringBuilder buf) {
      buf.append("securityId").append('=').append(JodaBeanUtils.toString(securityId)).append(',').append(' ');
      buf.append("underlying").append('=').append(JodaBeanUtils.toString(underlying)).append(',').append(' ');
      buf.append("accrualFactor").append('=').append(JodaBeanUtils.toString(accrualFactor)).append(',').append(' ');
      buf.append("notional").append('=').append(JodaBeanUtils.toString(notional)).append(',').append(' ');
      buf.append("lastTradeDate").append('=').append(JodaBeanUtils.toString(lastTradeDate)).append(',').append(' ');
    }

  }

  //-------------------------- AUTOGENERATED END --------------------------
}


text:
@interface YFRCircularProgressIndicator : NSView

@property (assign, nonatomic) CGFloat value;

@property (assign, nonatomic) CGFloat thickness;

@property (nonatomic, strong) NSColor* progressColor;
@property (nonatomic, strong) NSColor* overlayColor;
@property (nonatomic, strong) NSColor* textColor;

@property (nonatomic) BOOL showProgressText;

@end

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2010 Google Inc. All Rights Reseved.
//
// 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.google.testing.testify.risk.frontend.client.view;

import com.google.gwt.user.client.ui.Widget;
import com.google.testing.testify.risk.frontend.model.Project;
import com.google.testing.testify.risk.frontend.shared.rpc.ProjectRpcAsync;
import com.google.testing.testify.risk.frontend.shared.rpc.UserRpc.ProjectAccess;

import java.util.List;

/**
 * View on top of the ProjectSettings Widget.
 *
 * @author chrsmith@google.com (Chris Smith)
 */
public interface ProjectSettingsView {

  /**
   * Interface for notifying the Presenter about events arising from the View.
   */
  public interface Presenter {

    /**
     * @return the ProjectID for the project the View is displaying.
     */
    long getProjectId();

    /**
     * @return a handle to the Presenter's ProjectService serverlet. Ideally this should be hidden.
     */
    ProjectRpcAsync getProjectService();

    /**
     * Updates the project name, summary, and description get updated in one batch action.
     */
    void onUpdateProjectInfoClicked(
            String projectName, String projectDescription,
            List<String> projectOwners, List<String> projectEditors, List<String> projectViewers,
            boolean isPublicalyVisible);

    /**
     * Deletes the Project. Proceed with caution.
     */
    public void removeProject();
  }

  /**
   * Shows the "project saved" panel.
   */
  public void showSaved();

  /**
   * Updates the view to enable editing of project data. (Security will still be checked in the
   * backend servlet.)
   */
  public void enableProjectEditing(ProjectAccess userAccessLevel);

  /**
   * Bind the view and the underlying presenter it communicates with.
   */
  public void setPresenter(Presenter presenter);

  /**
   * Initialize user interface elements with the given project settings.
   */
  public void setProjectSettings(Project projectSettings);

  /**
   * Converts the view into a GWT widget.
   */
  public Widget asWidget();
}


text:
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'factory_girl_rails'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)

RSpec.configure do |config|
  config.fixture_path = "#{::Rails.root}/spec/fixtures"

  config.use_transactional_fixtures = true
  config.infer_base_class_for_anonymous_controllers = true
  config.order = "random"

  config.before :suite do
    DatabaseRewinder.clean_all
  end

  config.after :each do
    DatabaseRewinder.clean
  end

  config.before :all do
    FactoryGirl.reload
  end

  config.include FactoryGirl::Syntax::Methods
end


text:
<?php

namespace app\models;

use Yii;
use yii\base\NotSupportedException;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord;
use yii\web\IdentityInterface;

/**
 * "{{%user}}".
 *
 * @property int $id
 * @property string $auth_key
 * @property string $username
 * @property string $old_username
 * @property string $password_hash
 * @property int $role
 * @property int $created_at
 * @property int $updated_at
 * @property int $deleted
 * @property int $division
 * @property string $balance
 * @property string $gitlab
 * @property string $email
 *
 * @property string $employeeName
 * @property Preference[] $preferences
 * @property Restaurant[] $restaurants
 * @property string $short
 * @property Balance[] $balanceHistory
 * @property Balance $latestBalanceHistory
 */
class User extends ActiveRecord implements IdentityInterface
{
    const BOOKKEEPER = [1, 19, 22];

    const ROLE_USER = 1;
    const ROLE_ADMIN = 2;

    const DIVISION_NONE = 0;
    const DIVISION_PHP = 1;
    const DIVISION_ANDROID = 2;
    const DIVISION_IOS = 3;
    const DIVISION_JAVA = 4;
    const DIVISION_QA = 5;
    const DIVISION_MARKETING = 6;

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%user}}';
    }

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [TimestampBehavior::class];
    }

    /**
     * @return array the validation rules.
     */
    public function rules()
    {
        return [
            [['username', 'role', 'division'], 'required'],
            ['email', 'email'],
            [['username', 'gitlab', 'email'], 'string', 'max' => 255],
            ['role', 'in', 'range' => [self::ROLE_ADMIN, self::ROLE_USER]],
            ['division', 'in', 'range' => array_keys(static::divisionLabels())],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'username' => 'Imię',
            'email' => 'Email',
            'role' => 'Rola',
            'division' => 'Grupa',
            'gitlab' => 'GitLab',
        ];
    }

    /**
     * @inheritdoc
     */
    public static function findIdentity($id)
    {
        return static::findOne(['id' => $id, 'deleted' => 0]);
    }

    /**
     * @inheritdoc
     */
    public function getAuthKey()
    {
        return $this->auth_key;
    }

    /**
     * @inheritdoc
     */
    public function getId()
    {
        return $this->getPrimaryKey();
    }

    /**
     * @inheritdoc
     */
    public function validateAuthKey($authKey)
    {
        return $this->getAuthKey() === $authKey;
    }

    /**
     * @inheritdoc
     */
    public static function findIdentityByAccessToken($token, $type = null)
    {
        throw new NotSupportedException;
    }

    /**
     * Generates password hash from password and sets it to the model
     * @param string $password
     */
    public function setPassword($password)
    {
        $this->password_hash = Yii::$app->security->generatePasswordHash($password);
    }

    /**
     * Generates "remember me" authentication key
     */
    public function generateAuthKey()
    {
        $this->auth_key = Yii::$app->security->generateRandomString();
    }

    /**
     * Finds user by username.
     * @param string $username
     * @param bool $statusCheck
     * @return User
     */
    public static function findByUsername($username, $statusCheck = true)
    {
        $conditions = ['username' => $username];
        if ($statusCheck) {
            $conditions['deleted'] = 0;
        }
        return static::findOne($conditions);
    }

    /**
     * Finds user by email.
     * @param string $email
     * @param bool $statusCheck
     * @return User
     */
    public static function findByEmail($email, $statusCheck = true)
    {
        $conditions = ['email' => $email];
        if ($statusCheck) {
            $conditions['deleted'] = 0;
        }
        return static::findOne($conditions);
    }

    /**
     * Checks if user is admin.
     * @return bool
     */
    public function getIsAdmin()
    {
        return $this->role === self::ROLE_ADMIN;
    }

    /**
     * Returns actual user name.
     * @return string
     */
    public function getEmployeeName()
    {
        return $this->deleted ? $this->old_username : $this->username;
    }

    /**
     * Balance history relation
     * @return ActiveQuery
     */
    public function getBalanceHistory()
    {
        return $this->hasMany(Balance::class, ['user_id' => 'id']);
    }

    /**
     * Balance history relation
     * @return ActiveQuery
     */
    public function getLatestBalanceHistory()
    {
        return $this->hasOne(Balance::class, ['user_id' => 'id'])->orderBy(['balance.id' => SORT_DESC])->limit(1);
    }

    /**
     * Validates password
     * @param string $password password to validate
     * @return boolean if password provided is valid for current user
     */
    public function validatePassword($password)
    {
        return Yii::$app->security->validatePassword($password, $this->password_hash);
    }

    /**
     * Adds new user.
     * @return bool
     */
    public function add()
    {
        $old = User::findOne(['username' => mb_strtolower($this->username, 'UTF-8')]);
        if ($old) {
            $this->addError('username', 'Użytkownik o tym imieniu jest już dodany.');
            return false;
        }

        $this->generateAuthKey();
        return $this->save();
    }

    /**
     * Return short name.
     * @return string
     */
    public function getShort()
    {
        $split = explode(' ', $this->username);
        $short = '';
        foreach ($split as $part) {
            if (!empty($part)) {
                $short .= mb_substr($part, 0, 1, 'UTF-8');
            }
        }

        return mb_strtoupper($short, 'UTF-8');
    }

    /**
     * Returns division labels.
     * @return array
     */
    public static function divisionLabels()
    {
        return [
            self::DIVISION_NONE => 'brak',
            self::DIVISION_PHP => 'PHP',
            self::DIVISION_ANDROID => 'Android',
            self::DIVISION_IOS => 'iOS',
            self::DIVISION_JAVA => 'Java',
            self::DIVISION_QA => 'QA',
            self::DIVISION_MARKETING => 'Marketing',
        ];
    }
}


text:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# default
echo "# Running basic script and writing output to temporary directory"
LLP-DB taxID2lin -p 4 -o /tmp/NCBI_taxID2lin.txt


text:
package com.google.javascript.jscomp;

import static com.google.common.truth.Truth.assertThat;

import com.google.common.collect.ImmutableList;
import com.google.javascript.jscomp.CompilerOptions.TracerMode;
import com.google.javascript.jscomp.PhaseOptimizer.Loop;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.Token;

import junit.framework.TestCase;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Tests for {@link PhaseOptimizer}.
 * @author nicksantos@google.com (Nick Santos)
 */
public final class PhaseOptimizerTest extends TestCase {
  private final List<String> passesRun = new ArrayList<>();
  private Node dummyRoot;
  private PhaseOptimizer optimizer;
  private Compiler compiler;
  private PerformanceTracker tracker;

  @Override
  public void setUp() {
    passesRun.clear();
    dummyRoot = new Node(Token.BLOCK);
    // Needed if we are validating the AST using AstValidator.
    dummyRoot.setIsSyntheticBlock(true);
    compiler = new Compiler();
    compiler.initCompilerOptionsIfTesting();
    tracker = new PerformanceTracker(dummyRoot, TracerMode.TIMING_ONLY);
    optimizer = new PhaseOptimizer(compiler, tracker, null);
  }

  public void testOneRun() {
    addOneTimePass("x");
    assertPasses("x");
  }

  public void testLoop1() {
    Loop loop = optimizer.addFixedPointLoop();
    addLoopedPass(loop, "x", 0);
    assertPasses("x");
  }

  public void testLoop2() {
    Loop loop = optimizer.addFixedPointLoop();
    addLoopedPass(loop, "x", 3);
    assertPasses("x", "x", "x", "x");
  }

  public void testSchedulingOfLoopablePasses() {
    Loop loop = optimizer.addFixedPointLoop();
    addLoopedPass(loop, "x", 3);
    addLoopedPass(loop, "y", 1);
    // The pass iterations can be grouped as: [x y] [x y] [x] [x] [y]
    assertPasses("x", "y", "x", "y", "x", "x", "y");
  }

  public void testNotInfiniteLoop() {
    Loop loop = optimizer.addFixedPointLoop();
    addLoopedPass(loop, "x", PhaseOptimizer.MAX_LOOPS - 1);
    optimizer.process(null, dummyRoot);
    assertEquals("There should be no errors.", 0, compiler.getErrorCount());
  }

  public void testInfiniteLoop() {
    Loop loop = optimizer.addFixedPointLoop();
    addLoopedPass(loop, "x", PhaseOptimizer.MAX_LOOPS + 1);
    try {
      optimizer.process(null, dummyRoot);
      fail("Expected RuntimeException");
    } catch (RuntimeException e) {
      assertTrue(e.getMessage(),
          e.getMessage().contains(PhaseOptimizer.OPTIMIZE_LOOP_ERROR));
    }
  }

  public void testSchedulingOfAnyKindOfPasses1() {
    addOneTimePass("a");
    Loop loop = optimizer.addFixedPointLoop();
    addLoopedPass(loop, "x", 3);
    addLoopedPass(loop, "y", 1);
    addOneTimePass("z");
    assertPasses("a", "x", "y", "x", "y", "x", "x", "y", "z");
  }

  public void testSchedulingOfAnyKindOfPasses2() {
    optimizer.consume(
        ImmutableList.of(
            createPassFactory("a", 0, true),
            createPassFactory("b", 1, false),
            createPassFactory("c", 2, false),
            createPassFactory("d", 1, false),
            createPassFactory("e", 1, true),
            createPassFactory("f", 0, true)));
    // The pass iterations can be grouped as:
    // [a] [b c d] [b c d] [c] [b d] [e] [f]
    assertPasses("a", "b", "c", "d", "b", "c", "d", "c", "b", "d", "e", "f");
  }

  public void testSchedulingOfAnyKindOfPasses3() {
    optimizer.consume(
        ImmutableList.of(
            createPassFactory("a", 2, false),
            createPassFactory("b", 1, true),
            createPassFactory("c", 1, false)));
    assertPasses("a", "a", "a", "b", "c", "c");
  }

  public void testSchedulingOfAnyKindOfPasses4() {
    optimizer.consume(
        ImmutableList.of(
            createPassFactory("a", 2, true),
            createPassFactory("b", 0, false),
            createPassFactory("c", 0, false)));
    assertPasses("a", "b", "c");
  }

  public void testDuplicateLoop() {
    Loop loop = optimizer.addFixedPointLoop();
    addLoopedPass(loop, "x", 1);
    try {
      addLoopedPass(loop, "x", 1);
      fail("Expected exception");
    } catch (IllegalArgumentException e) {
      return;
    }
  }

  public void testPassOrdering() {
    Loop loop = optimizer.addFixedPointLoop();
    List<String> optimalOrder = new ArrayList<>(
        PhaseOptimizer.OPTIMAL_ORDER);
    Random random = new Random();
    while (!optimalOrder.isEmpty()) {
      addLoopedPass(
          loop, optimalOrder.remove(random.nextInt(optimalOrder.size())), 0);
    }
    optimizer.process(null, dummyRoot);
    assertEquals(PhaseOptimizer.OPTIMAL_ORDER, passesRun);
  }

  public void testProgress() {
    final List<Double> progressList = new ArrayList<>();
    compiler = new Compiler() {
      @Override void setProgress(double p, String name) {
        progressList.add(p);
      }
    };
    compiler.initCompilerOptionsIfTesting();
    optimizer = new PhaseOptimizer(compiler, null,
        new PhaseOptimizer.ProgressRange(0, 100));
    addOneTimePass("x1");
    addOneTimePass("x2");
    addOneTimePass("x3");
    addOneTimePass("x4");
    optimizer.process(null, dummyRoot);
    assertThat(progressList).hasSize(4);
    assertEquals(25, Math.round(progressList.get(0)));
    assertEquals(50, Math.round(progressList.get(1)));
    assertEquals(75, Math.round(progressList.get(2)));
    assertEquals(100, Math.round(progressList.get(3)));
  }

  public void assertPasses(String ... names) {
    optimizer.process(null, dummyRoot);
    assertEquals(ImmutableList.copyOf(names), passesRun);
  }

  private void addOneTimePass(String name) {
    optimizer.addOneTimePass(
        createPassFactory(name, 0, true));
  }

  private void addLoopedPass(Loop loop, String name, int numChanges) {
    loop.addLoopedPass(
        createPassFactory(name, numChanges, false));
  }

  private PassFactory createPassFactory(
      String name, int numChanges, boolean isOneTime) {
    return createPassFactory(name, createPass(name, numChanges), isOneTime);
  }

  private PassFactory createPassFactory(
      String name, final CompilerPass pass, boolean isOneTime) {
    return new PassFactory(name, isOneTime) {
      @Override
      protected CompilerPass create(AbstractCompiler compiler) {
        return pass;
      }
    };
  }

  private CompilerPass createPass(final String name, int numChanges) {
    final int[] numChangesClosure = new int[] {numChanges};
    return new CompilerPass() {
      @Override public void process(Node externs, Node root) {
        passesRun.add(name);
        if (numChangesClosure[0] > 0) {
          compiler.reportCodeChange();
          numChangesClosure[0] = numChangesClosure[0] - 1;
        }
      }
    };
  }
}


text:
package funpep.server
package util

import java.util.UUID
import java.time.Instant

import argonaut._
import argonaut.Argonaut._

import atto._
import atto.syntax.parser._

import funpep.data._
import funpep.util.parsers._

private[util] trait Codecs {

  import Analysis._

  implicit def UUIDEncode: EncodeJson[UUID] =
    StringEncodeJson.contramap(_.toString)

  implicit def UUIDDecode: DecodeJson[UUID] =
    optionDecoder(_.string.flatMap(uuid.parseOnly(_).option), "UUID")

  implicit def InstantEncode: EncodeJson[Instant] =
    LongEncodeJson.contramap(_.getEpochSecond)

  implicit def InstantDecode: DecodeJson[Instant] =
    optionDecoder(_.number.flatMap(_.toLong).map(Instant.ofEpochSecond), "Instant")

  implicit def StatusEncode: EncodeJson[Status] =
    EncodeJson(_ match {
      case Created(t)   ⇒ ("status" := "created" ) ->: ("time" := t.getEpochSecond) ->: jEmptyObject
      case Started(t)   ⇒ ("status" := "started" ) ->: ("time" := t.getEpochSecond) ->: jEmptyObject
      case Finished(t)  ⇒ ("status" := "finished") ->: ("time" := t.getEpochSecond) ->: jEmptyObject
      case Failed(t, e) ⇒ ("status" := "failed"  ) ->: ("time" := t.getEpochSecond) ->: ("error" := e) ->: jEmptyObject
    })

  implicit def AnalysisEncode: EncodeJson[Analysis] =
    EncodeJson { a ⇒
      ("uuid"        := a.id)          ->:
      ("status"      := a.status)      ->:
      ("threshold"   := a.threshold)   ->:
      ("annotations" := a.annotations) ->:
      jEmptyObject
    }

  implicit def FastaEncode[A]: EncodeJson[Fasta[A]] =
    StringEncodeJson.contramap(fasta ⇒ FastaPrinter.toString(fasta))

  implicit def FastaDecode[A](implicit parser: Parser[A], ev: A ⇒ Compound): DecodeJson[Fasta[A]] =
    optionDecoder(_.string.flatMap(FastaParser.fromString(_).toOption), "Fasta")

}


text:
<?php

namespace Demofony2\AppBundle\Menu;

use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\Translator;

/**
 * Class MenuBuilder.
 *
 * @category Menu
 *
 * @author   David Romaní <david@flux.cat>
 */
class FrontendMenu
{
    /**
     * @var FactoryInterface
     */
    private $factory;

    /**
     * @var Translator
     */
    private $translator;

    /**
     * Constructor
     *
     * @param FactoryInterface $factory
     * @param Translator       $translator
     */
    public function __construct(FactoryInterface $factory, Translator $translator)
    {
        $this->factory = $factory;
        $this->translator = $translator;
    }

    /**
     * Create main menu.
     *
     * @param Request $request
     *
     * @return ItemInterface
     */
    public function createMainMenu(Request $request)
    {
        $menu = $this->factory->createItem('root');
        $menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');
        $menu->setChildrenAttribute('id', 'nav-accordion');
        $menu->setExtras(array('firstClass' => null));

        $menu->addChild('home', array(
                'label' => 'front.home.home',
                'route' => 'demofony2_front_homepage',
            ));
        $menu->addChild('transparency', array(
                'label' => 'front.home.transparency',
                'route' => 'demofony2_front_transparency',
                'current' => $request->get('_route') == 'demofony2_front_transparency' ||
                    $request->get('_route') == 'demofony2_front_transparency_list' ||
                    $request->get('_route') == 'demofony2_front_transparency_detail' ||
                    $request->get('_route') == 'demofony2_front_transparency_law_detail' ||
                    $request->get('_route') == 'demofony2_front_cms_rendering_account' ||
                    $request->get('_route') == 'demofony2_front_cms_collaborates' ||
                    $request->get('_route') == 'demofony2_front_cms_transparency_law' ||
                    $request->get('_route') == 'demofony2_front_cms_public_information',
            ));
        $menu->addChild('participation', array(
                'label' => 'front.home.participation',
                'route' => 'demofony2_front_participation',
                'current' => $request->get('_route') == 'demofony2_front_participation' ||
                    $request->get('_route') == 'demofony2_front_participation_calendar' ||
                    $request->get('_route') == 'demofony2_front_participation_discussions' ||
                    $request->get('_route') == 'demofony2_front_participation_discussions_edit' ||
                    $request->get('_route') == 'demofony2_front_participation_discussions_list_open' ||
                    $request->get('_route') == 'demofony2_front_participation_discussions_list_closed' ||
                    $request->get('_route') == 'demofony2_front_participation_discussion_show_page' ||
                    $request->get('_route') == 'demofony2_front_participation_citizen_forums' ||
                    $request->get('_route') == 'demofony2_front_participation_citizen_forums_edit' ||
                    $request->get('_route') == 'demofony2_front_participation_citizen_initiative_list_open' ||
                    $request->get('_route') == 'demofony2_front_participation_citizen_initiative_list_closed' ||
                    $request->get('_route') == 'demofony2_front_participation_citizen_initiative_detail' ||
                    $request->get('_route') == 'demofony2_front_participation_citizen_forums_edit' ||
                    $request->get('_route') == 'demofony2_front_participation_proposals' ||
                    $request->get('_route') == 'demofony2_front_participation_proposals_list_open' ||
                    $request->get('_route') == 'demofony2_front_participation_proposals_list_closed' ||
                    $request->get('_route') == 'demofony2_front_participation_proposals_edit' ||
                    $request->get('_route') == 'demofony2_front_participation_proposals_show' ||
                    $request->get('_route') == 'demofony2_front_participation_proposals_new' ||
                    $request->get('_route') == 'calendar_event_list_by_month' ||
                    $request->get('_route') == 'calendar_event_list_by_week',
            ));

        return $menu;
    }
}


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

#include "components/autofill_assistant/browser/actions/wait_for_dom_action.h"

#include <utility>

#include "base/bind.h"
#include "base/callback.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/mock_callback.h"
#include "components/autofill_assistant/browser/actions/action_test_utils.h"
#include "components/autofill_assistant/browser/actions/mock_action_delegate.h"
#include "components/autofill_assistant/browser/wait_for_dom_observer.h"
#include "components/autofill_assistant/browser/web/element.h"
#include "components/autofill_assistant/browser/web/mock_web_controller.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace autofill_assistant {
namespace {

using ::base::test::RunOnceCallback;
using ::testing::_;
using ::testing::ElementsAre;
using ::testing::Invoke;
using ::testing::Pointee;
using ::testing::Property;
using ::testing::ReturnRef;
using ::testing::WithArgs;

class WaitForDomActionTest : public testing::Test {
 public:
  WaitForDomActionTest() {}

  void SetUp() override {
    ON_CALL(mock_web_controller_, FindElement(_, _, _))
        .WillByDefault(WithArgs<2>([](auto&& callback) {
          std::move(callback).Run(ClientStatus(ELEMENT_RESOLUTION_FAILED),
                                  std::make_unique<ElementFinder::Result>());
        }));

    EXPECT_CALL(mock_action_delegate_, WaitForDomWithSlowWarning(_, _, _, _, _))
        .WillRepeatedly(Invoke(this, &WaitForDomActionTest::FakeWaitForDom));
  }

 protected:
  // Fakes ActionDelegate::WaitForDom.
  void FakeWaitForDom(
      base::TimeDelta max_wait_time,
      bool allow_interrupt,
      WaitForDomObserver* observer,
      base::RepeatingCallback<
          void(BatchElementChecker*,
               base::OnceCallback<void(const ClientStatus&)>)> check_elements,
      base::OnceCallback<void(const ClientStatus&, base::TimeDelta)> callback) {
    checker_ = std::make_unique<BatchElementChecker>();
    has_check_elements_result_ = false;
    check_elements.Run(
        checker_.get(),
        base::BindOnce(&WaitForDomActionTest::OnCheckElementsDone,
                       base::Unretained(this)));
    checker_->AddAllDoneCallback(
        base::BindOnce(&WaitForDomActionTest::OnWaitForDomDone,
                       base::Unretained(this), std::move(callback)));
    checker_->Run(&mock_web_controller_);
  }

  // Called from the check_elements callback passed to FakeWaitForDom.
  void OnCheckElementsDone(const ClientStatus& result) {
    ASSERT_FALSE(has_check_elements_result_);  // Duplicate calls
    has_check_elements_result_ = true;
    check_elements_result_ = result;
  }

  // Called by |checker_| once it's done. This ends the call to
  // FakeWaitForDom().
  void OnWaitForDomDone(
      base::OnceCallback<void(const ClientStatus&, base::TimeDelta)> callback) {
    ASSERT_TRUE(
        has_check_elements_result_);  // OnCheckElementsDone() not called
    std::move(callback).Run(check_elements_result_,
                            base::Milliseconds(fake_wait_time_));
  }

  // Runs the action defined in |proto_| and reports the result to |callback_|.
  void Run() {
    ActionProto action_proto;
    *action_proto.mutable_wait_for_dom() = proto_;
    WaitForDomAction action(&mock_action_delegate_, action_proto);
    action.ProcessAction(callback_.Get());
  }

  MockActionDelegate mock_action_delegate_;
  MockWebController mock_web_controller_;
  base::MockCallback<Action::ProcessActionCallback> callback_;
  WaitForDomProto proto_;
  std::unique_ptr<BatchElementChecker> checker_;
  bool has_check_elements_result_ = false;
  ClientStatus check_elements_result_;
  int fake_wait_time_ = 0;
};

TEST_F(WaitForDomActionTest, NoSelectors) {
  EXPECT_CALL(
      callback_,
      Run(Pointee(Property(&ProcessedActionProto::status, INVALID_ACTION))));
  Run();
}

TEST_F(WaitForDomActionTest, ConditionMet) {
  EXPECT_CALL(mock_web_controller_,
              FindElement(Selector({"#element"}), /* strict= */ false, _))
      .WillRepeatedly(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(OkClientStatus(),
                                std::make_unique<ElementFinder::Result>());
      }));

  *proto_.mutable_wait_condition()->mutable_match() =
      ToSelectorProto("#element");
  EXPECT_CALL(
      callback_,
      Run(Pointee(Property(&ProcessedActionProto::status, ACTION_APPLIED))));
  Run();
}

TEST_F(WaitForDomActionTest, TimingStatsConditionMet) {
  EXPECT_CALL(mock_web_controller_,
              FindElement(Selector({"#element"}), /* strict= */ false, _))
      .WillRepeatedly(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(OkClientStatus(),
                                std::make_unique<ElementFinder::Result>());
      }));

  fake_wait_time_ = 500;
  *proto_.mutable_wait_condition()->mutable_match() =
      ToSelectorProto("#element");

  ProcessedActionProto capture;
  EXPECT_CALL(callback_, Run(_)).WillOnce(testing::SaveArgPointee<0>(&capture));
  Run();

  EXPECT_EQ(capture.timing_stats().wait_time_ms(), 500);
}

TEST_F(WaitForDomActionTest, ConditionNotMet) {
  *proto_.mutable_wait_condition()->mutable_match() =
      ToSelectorProto("#element");
  EXPECT_CALL(callback_, Run(Pointee(Property(&ProcessedActionProto::status,
                                              ELEMENT_RESOLUTION_FAILED))));
  Run();
}

TEST_F(WaitForDomActionTest, ReportMatchesToServer) {
  EXPECT_CALL(mock_web_controller_,
              FindElement(Selector({"#element1"}), /* strict= */ false, _))
      .WillRepeatedly(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(OkClientStatus(),
                                std::make_unique<ElementFinder::Result>());
      }));
  EXPECT_CALL(mock_web_controller_,
              FindElement(Selector({"#element2"}), /* strict= */ false, _))
      .WillRepeatedly(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(ClientStatus(ELEMENT_RESOLUTION_FAILED),
                                std::make_unique<ElementFinder::Result>());
      }));
  EXPECT_CALL(mock_web_controller_,
              FindElement(Selector({"#element3"}), /* strict= */ false, _))
      .WillRepeatedly(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(ClientStatus(ELEMENT_RESOLUTION_FAILED),
                                std::make_unique<ElementFinder::Result>());
      }));
  EXPECT_CALL(mock_web_controller_,
              FindElement(Selector({"#element4"}), /* strict= */ false, _))
      .WillRepeatedly(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(OkClientStatus(),
                                std::make_unique<ElementFinder::Result>());
      }));

  auto* any_of = proto_.mutable_wait_condition()->mutable_any_of();
  auto* condition1 = any_of->add_conditions();
  *condition1->mutable_match() = ToSelectorProto("#element1");
  condition1->set_payload("1");

  auto* condition2 = any_of->add_conditions();
  *condition2->mutable_none_of()->add_conditions()->mutable_match() =
      ToSelectorProto("#element2");
  condition2->set_payload("2");

  auto* condition3 = any_of->add_conditions();
  *condition3->mutable_match() = ToSelectorProto("#element3");
  condition3->set_payload("3");

  auto* condition4 = any_of->add_conditions();
  *condition4->mutable_none_of()->add_conditions()->mutable_match() =
      ToSelectorProto("#element4");
  condition4->set_payload("4");

  // Condition 1 and 2 are met, conditions 3 and 4 are not.

  ProcessedActionProto capture;
  EXPECT_CALL(callback_, Run(_)).WillOnce(testing::SaveArgPointee<0>(&capture));
  Run();

  EXPECT_THAT(capture.wait_for_dom_result().matching_condition_payloads(),
              ElementsAre("1", "2"));
}

TEST_F(WaitForDomActionTest, StoreMatchForLater) {
  Selector expected_selector({"#element"});
  EXPECT_CALL(mock_web_controller_,
              FindElement(expected_selector, /* strict= */ false, _))
      .WillOnce(WithArgs<2>([&expected_selector](auto&& callback) {
        auto element_result = std::make_unique<ElementFinder::Result>();
        element_result->dom_object.object_data.object_id =
            expected_selector.proto.filters(0).css_selector();
        std::move(callback).Run(OkClientStatus(), std::move(element_result));
      }));

  auto* condition = proto_.mutable_wait_condition();
  *condition->mutable_match() = ToSelectorProto("#element");
  condition->set_payload("1");
  condition->mutable_client_id()->set_identifier("element");

  EXPECT_CALL(callback_, Run(_));
  Run();

  EXPECT_TRUE(mock_action_delegate_.GetElementStore()->HasElement("element"));
}

TEST_F(WaitForDomActionTest, StoreStrictMatchForLater) {
  Selector expected_selector({"#element"});
  EXPECT_CALL(mock_web_controller_,
              FindElement(expected_selector, /* strict= */ true, _))
      .WillOnce(WithArgs<2>([&expected_selector](auto&& callback) {
        auto element_result = std::make_unique<ElementFinder::Result>();
        element_result->dom_object.object_data.object_id =
            expected_selector.proto.filters(0).css_selector();
        std::move(callback).Run(OkClientStatus(), std::move(element_result));
      }));

  auto* condition = proto_.mutable_wait_condition();
  *condition->mutable_match() = ToSelectorProto("#element");
  condition->set_payload("1");
  condition->mutable_client_id()->set_identifier("element");
  condition->set_require_unique_element(true);

  EXPECT_CALL(callback_, Run(_));
  Run();

  EXPECT_TRUE(mock_action_delegate_.GetElementStore()->HasElement("element"));
}

TEST_F(WaitForDomActionTest, StrictMatchFailsForMultipleElements) {
  Selector expected_selector({"#element"});
  EXPECT_CALL(mock_web_controller_,
              FindElement(expected_selector, /* strict= */ true, _))
      .WillOnce(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(ClientStatus(TOO_MANY_ELEMENTS),
                                std::make_unique<ElementFinder::Result>());
      }));

  auto* condition = proto_.mutable_wait_condition();
  *condition->mutable_match() = ToSelectorProto("#element");
  condition->set_payload("1");
  condition->mutable_client_id()->set_identifier("element");
  condition->set_require_unique_element(true);

  EXPECT_CALL(callback_, Run(_));
  Run();

  EXPECT_FALSE(mock_action_delegate_.GetElementStore()->HasElement("element"));
}

TEST_F(WaitForDomActionTest, RemoveElementsNoLongerFound) {
  Selector expected_found_selector({"#element-found"});
  Selector expected_not_found_selector({"#element-not-found"});
  test_util::MockFindElement(mock_web_controller_, expected_found_selector);
  EXPECT_CALL(mock_web_controller_,
              FindElement(expected_not_found_selector, _, _))
      .WillOnce(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(ClientStatus(ELEMENT_RESOLUTION_FAILED),
                                std::make_unique<ElementFinder::Result>());
      }));

  // A previous run found this element.
  mock_action_delegate_.GetElementStore()->AddElement("element2",
                                                      DomObjectFrameStack());

  auto* any_of = proto_.mutable_wait_condition()->mutable_any_of();
  auto* condition1 = any_of->add_conditions();
  *condition1->mutable_match() = ToSelectorProto("#element-found");
  condition1->mutable_client_id()->set_identifier("element1");
  auto* condition2 = any_of->add_conditions();
  *condition2->mutable_match() = ToSelectorProto("#element-not-found");
  condition2->mutable_client_id()->set_identifier("element2");

  EXPECT_CALL(callback_, Run(_));
  Run();

  EXPECT_TRUE(mock_action_delegate_.GetElementStore()->HasElement("element1"));
  EXPECT_FALSE(mock_action_delegate_.GetElementStore()->HasElement("element2"));
}

TEST_F(WaitForDomActionTest, ReturnsRolledUpErrorInformation) {
  ProcessedActionStatusDetailsProto log_info;

  Selector selector_1({"#element-1"});
  ElementFinderInfoProto* info_1 = log_info.add_element_finder_info();
  info_1->set_tracking_id(1);
  info_1->set_failed_filter_index_range_start(0);
  info_1->set_failed_filter_index_range_end(2);
  info_1->set_status(INVALID_SELECTOR);
  EXPECT_CALL(mock_web_controller_, FindElement(selector_1, _, _))
      .WillOnce(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(ClientStatus(ELEMENT_RESOLUTION_FAILED),
                                std::make_unique<ElementFinder::Result>());
      }));
  Selector selector_2({"#element-2"});
  ElementFinderInfoProto* info_2 = log_info.add_element_finder_info();
  info_2->set_tracking_id(2);
  info_2->set_failed_filter_index_range_start(1);
  info_2->set_failed_filter_index_range_end(3);
  info_2->set_get_document_failed(true);
  info_2->set_status(ELEMENT_RESOLUTION_FAILED);
  EXPECT_CALL(mock_web_controller_, FindElement(selector_2, _, _))
      .WillOnce(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(ClientStatus(ELEMENT_RESOLUTION_FAILED),
                                std::make_unique<ElementFinder::Result>());
      }));
  Selector selector_3({"#element-3"});
  ElementFinderInfoProto* info_3 = log_info.add_element_finder_info();
  info_3->set_tracking_id(3);
  info_3->set_status(ACTION_APPLIED);
  EXPECT_CALL(mock_web_controller_, FindElement(selector_3, _, _))
      .WillOnce(WithArgs<2>([](auto&& callback) {
        std::move(callback).Run(ClientStatus(ACTION_APPLIED),
                                std::make_unique<ElementFinder::Result>());
      }));
  ProcessedActionStatusDetailsProto clear_log_info;
  EXPECT_CALL(mock_action_delegate_, GetLogInfo)
      .WillOnce(ReturnRef(clear_log_info))  // Once to clear at the start.
      .WillOnce(ReturnRef(log_info));       // Once to fill at the end.

  auto* condition = proto_.mutable_wait_condition()->mutable_all_of();
  auto* condition_1 = condition->add_conditions();
  *condition_1->mutable_match() = ToSelectorProto("#element-1");
  condition_1->mutable_match()->set_tracking_id(1);
  condition_1->mutable_client_id()->set_identifier("element-1");
  auto* condition_2 = condition->add_conditions();
  *condition_2->mutable_match() = ToSelectorProto("#element-2");
  condition_2->mutable_client_id()->set_identifier("element-2");
  condition_2->mutable_match()->set_tracking_id(2);
  auto* condition_3 = condition->add_conditions();
  *condition_3->mutable_match() = ToSelectorProto("#element-3");
  condition_3->mutable_client_id()->set_identifier("element-3");
  condition_3->mutable_match()->set_tracking_id(3);

  ProcessedActionProto capture;
  EXPECT_CALL(callback_, Run(_)).WillOnce(testing::SaveArgPointee<0>(&capture));
  Run();

  EXPECT_EQ(capture.status(), ELEMENT_RESOLUTION_FAILED);
  ASSERT_EQ(capture.status_details().element_finder_info_size(), 3);
  EXPECT_EQ(capture.status_details().element_finder_info(0).status(),
            INVALID_SELECTOR);
  EXPECT_EQ(capture.status_details().element_finder_info(0).tracking_id(), 1);
  EXPECT_EQ(capture.status_details()
                .element_finder_info(0)
                .failed_filter_index_range_start(),
            0);
  EXPECT_EQ(capture.status_details()
                .element_finder_info(0)
                .failed_filter_index_range_end(),
            2);
  EXPECT_EQ(capture.status_details().element_finder_info(1).status(),
            ELEMENT_RESOLUTION_FAILED);
  EXPECT_EQ(capture.status_details().element_finder_info(1).tracking_id(), 2);
  EXPECT_EQ(capture.status_details()
                .element_finder_info(1)
                .failed_filter_index_range_start(),
            1);
  EXPECT_EQ(capture.status_details()
                .element_finder_info(1)
                .failed_filter_index_range_end(),
            3);
  EXPECT_TRUE(
      capture.status_details().element_finder_info(1).get_document_failed());
  EXPECT_EQ(capture.status_details().element_finder_info(2).status(),
            ACTION_APPLIED);
  EXPECT_EQ(capture.status_details().element_finder_info(2).tracking_id(), 3);
}

}  // namespace
}  // namespace autofill_assistant


text:
using namespace appleseed::animatecamera;
using namespace appleseed::shared;
using namespace foundation;
using namespace renderer;
using namespace std;
namespace bf = boost::filesystem;

namespace
{
    //
    // Command line parameters are globally accessible within this file.
    //

    CommandLineHandler g_cl;

    //
    // Define a strict weak ordering on foundation::Transform<> objects.
    //

    template <typename T>
    struct TransformComparer
    {
        bool operator()(const Transform<T>& lhs, const Transform<T>& rhs) const
        {
            typedef typename Transform<T>::MatrixType MatrixType;

            const MatrixType& lhs_mat = lhs.get_local_to_parent();
            const MatrixType& rhs_mat = rhs.get_local_to_parent();

            const T Eps = make_eps<T>(1.0e-6f, 1.0e-12);

            for (size_t i = 0; i < MatrixType::Components; ++i)
            {
                const T delta = lhs_mat[i] - rhs_mat[i];

                if (delta < -Eps)
                    return true;

                if (delta > Eps)
                    return false;
            }

            return false;
        }
    };

    //
    // Define an ordering on pairs of transforms.
    //

    template <typename T>
    struct TransformPairComparer
    {
        typedef pair<Transform<T>, Transform<T> > TransformPair;

        bool operator()(const TransformPair& lhs, const TransformPair& rhs) const
        {
            TransformComparer<T> transform_comparer;

            return
                transform_comparer(lhs.first, rhs.first) ? true :
                transform_comparer(rhs.first, lhs.first) ? false :
                transform_comparer(lhs.second, rhs.second);
        }
    };

    //
    // The base class for animation generators.
    //

    class AnimationGenerator
    {
      public:
        AnimationGenerator(
            const string&   base_output_filename,
            Logger&         logger)
          : m_base_output_filename(base_output_filename)
          , m_logger(logger)
        {
        }

        virtual ~AnimationGenerator() {}

        void generate()
        {
            const vector<size_t> frames = do_generate();

            LOG_INFO(
                m_logger,
                "generating render script%s...",
                g_cl.m_part_count.value() > 1 ? "s" : "");

#ifdef _WIN32
            generate_windows_render_script(frames);
#else
            LOG_WARNING(m_logger, "oops, don't know how to generate a render script for this platform.");
#endif
        }

      protected:
        const string        m_base_output_filename;
        Logger&             m_logger;

        virtual vector<size_t> do_generate() = 0;

        static string make_numbered_filename(
            const string&   filename,
            const size_t    number,
            const size_t    digits = 4)
        {
            const bf::path path(filename);

            stringstream sstr;
            sstr << path.stem().string();
            sstr << '.';
            sstr << setw(digits) << setfill('0') << number;
            sstr << path.extension().string();

            return sstr.str();
        }

        auto_release_ptr<Project> load_master_project()
        {
            // Construct the schema file path.
            const bf::path schema_filepath =
                  bf::path(Application::get_root_path())
                / "schemas"
                / "project.xsd";

            // Read the master project file.
            const char* project_filepath = g_cl.m_filenames.values()[0].c_str();
            ProjectFileReader reader;
            auto_release_ptr<Project> project(
                reader.read(
                    project_filepath,
                    schema_filepath.string().c_str()));

            // Bail out if the master project file couldn't be read.
            if (project.get() == 0)
                LOG_FATAL(m_logger, "failed to load master project file %s", project_filepath);

            return project;
        }

      private:
        void generate_windows_render_script(const vector<size_t>& frames) const
        {
            const size_t part_count = g_cl.m_part_count.value();
            const size_t frames_per_part =
                static_cast<size_t>(ceil(static_cast<double>(frames.size()) / part_count));

            for (size_t part = 1, frame_begin = 0; frame_begin < frames.size(); ++part)
            {
                const size_t frame_end = min(frame_begin + frames_per_part, frames.size());

                generate_windows_render_script(
                    frames,
                    part,
                    frame_begin,
                    frame_end);

                frame_begin = frame_end;
            }
        }

        void generate_windows_render_script(
            const vector<size_t>&   frames,
            const size_t            part,
            const size_t            frame_begin,
            const size_t            frame_end) const
        {
            const string RenderScriptBaseFileName = "render.bat";

            const string script_filename =
                frame_begin == 0 && frame_end == frames.size()
                    ? RenderScriptBaseFileName
                    : make_numbered_filename(RenderScriptBaseFileName, part);

            FILE* script_file = fopen(script_filename.c_str(), "wt");

            if (script_file == 0)
                LOG_FATAL(m_logger, "could not write to %s.", script_filename.c_str());

            fprintf(
                script_file,
                "%s",
                "@echo off\n"
                "\n"
                "set cmdoptions=/WAIT /BELOWNORMAL /MIN\n"
                "set bin=\"%1\"\n"
                "set outputpath=\"%2\"\n"
                "set options=\n"
                "\n"
                "if %outputpath% == \"\" (\n"
                "    set outputpath=frames\n"
                ")\n"
                "\n"
                "if %bin% == \"\" (\n"
                "    echo Usage: %0 path-to-appleseed-binary\n"
                "    goto :end\n"
                ")\n"
                "\n"
                "if not exist %bin% (\n"
                "    echo Could not find %bin%, exiting.\n"
                "    goto :end\n"
                ")\n"
                "\n"
                "if not exist %outputpath% (\n"
                "    mkdir %outputpath%\n"
                ")\n"
                "\n");

            const string output_format = g_cl.m_output_format.value();

            for (size_t i = frame_begin; i < frame_end; ++i)
            {
                const size_t current_frame = i + 1;
                const size_t actual_frame = frames[i];

                const string project_filename = make_numbered_filename(m_base_output_filename + ".appleseed", current_frame);
                const string image_filename = make_numbered_filename(m_base_output_filename + "." + output_format, current_frame);
                const string image_filepath = "%outputpath%\\" + image_filename;

                fprintf(script_file, "if exist \"%s\" (\n", image_filepath.c_str());
                fprintf(script_file, "    echo Skipping %s because it was already rendered...\n", project_filename.c_str());
                fprintf(script_file, ") else (\n");

                if (actual_frame == current_frame)
                {
                    fprintf(script_file, "    echo Rendering %s to %s...\n", project_filename.c_str(), image_filepath.c_str());
                    fprintf(
                        script_file,
                        "    start \"Rendering %s to %s...\" %%cmdoptions%% %%bin%% %s -o \"%s\" %%options%%\n",
                        project_filename.c_str(),
                        image_filepath.c_str(),
                        project_filename.c_str(),
                        image_filepath.c_str());
                }
                else
                {
                    const string source_image_filename = make_numbered_filename(m_base_output_filename + "." + output_format, actual_frame);
                    const string source_image_filepath = "%outputpath%\\" + source_image_filename;

                    fprintf(
                        script_file,
                        "    echo Copying %s to %s...\n",
                        source_image_filepath.c_str(),
                        image_filepath.c_str());
                    fprintf(
                        script_file,
                        "    copy \"%s\" \"%s\" >nul\n",
                        source_image_filepath.c_str(),
                        image_filepath.c_str());
                }

                fprintf(script_file, ")\n\n");
            }

            fprintf(
                script_file,
                "echo.\n"
                "echo Rendering terminated.\n"
                "echo.\n"
                "\n"
                ":end\n");

            fclose(script_file);
        }
    };

    //
    // Generate an animation using a custom camera path.
    //

    class PathAnimationGenerator
      : public AnimationGenerator
    {
      public:
        PathAnimationGenerator(
            const string&   base_output_filename,
            Logger&         logger)
          : AnimationGenerator(base_output_filename, logger)
        {
        }

      private:
        virtual vector<size_t> do_generate()
        {
            typedef pair<Transformd, Transformd> TransformPair;
            typedef map<TransformPair, size_t, TransformPairComparer<double> > TransformMap;

            TransformMap transform_map;
            vector<size_t> frames;

            // Load the animation path file from disk.
            AnimationPath animation_path(m_logger);
            animation_path.load(
                g_cl.m_animation_path.value().c_str(),
                g_cl.m_3dsmax_mode.is_set() ? AnimationPath::Autodesk3dsMax : AnimationPath::Default);

            // Load the master project from disk.
            auto_release_ptr<Project> project(load_master_project());

            if (animation_path.size() == 0)
                return frames;

            const size_t frame_count =
                animation_path.size() > 1
                    ? animation_path.size() - 1
                    : 1;

            for (size_t i = 0; i < frame_count; ++i)
            {
                const size_t frame = i + 1;

                // Don't render twice the same frame.
                if (i + 1 < animation_path.size())
                {
                    const TransformPair transform_pair(animation_path[i], animation_path[i + 1]);
                    const TransformMap::const_iterator transform_map_key = transform_map.find(transform_pair);

                    if (transform_map_key != transform_map.end())
                    {
                        LOG_INFO(
                            m_logger, "frame " FMT_SIZE_T " is the same as frame " FMT_SIZE_T ".",
                            frame,
                            transform_map_key->second);
                        frames.push_back(transform_map_key->second);
                        continue;
                    }

                    transform_map.insert(make_pair(transform_pair, frame));
                }

                // Set the camera's transform sequence.
                Camera* camera = project->get_uncached_active_camera();
                camera->transform_sequence().clear();
                camera->transform_sequence().set_transform(0.0f, animation_path[i]);
                if (i + 1 < animation_path.size())
                    camera->transform_sequence().set_transform(1.0f, animation_path[i + 1]);

                // Write the project file for this frame.
                const string new_path = make_numbered_filename(m_base_output_filename + ".appleseed", frame);
                ProjectFileWriter::write(
                    project.ref(),
                    new_path.c_str(),
                    i == 0 ? ProjectFileWriter::Defaults : ProjectFileWriter::OmitWritingGeometryFiles);
                project->set_path(new_path.c_str());

                frames.push_back(frame);
            }

            assert(frames.size() == frame_count);

            return frames;
        }
    };

    //
    // Generate a turntable animation.
    //

    class TurntableAnimationGenerator
      : public AnimationGenerator
    {
      public:
        TurntableAnimationGenerator(
            const string&   base_output_filename,
            Logger&         logger)
          : AnimationGenerator(base_output_filename, logger)
        {
        }

      private:
        virtual vector<size_t> do_generate()
        {
            vector<size_t> frames;

            // Retrieve the command line parameter values.
            const int frame_count = g_cl.m_frame_count.value();
            const Vector3d center_offset(
                g_cl.m_camera_target.values()[0],
                g_cl.m_camera_target.values()[1],
                g_cl.m_camera_target.values()[2]);
            const double normalized_distance = g_cl.m_camera_distance.value();
            const double normalized_elevation = g_cl.m_camera_elevation.value();

            if (frame_count < 1)
                LOG_FATAL(m_logger, "the frame count must be greater than or equal to 1.");

            // Load the master project from disk.
            auto_release_ptr<Project> project(load_master_project());

            // Retrieve the scene's bounding box.
            const AABB3d scene_bbox(project->get_scene()->compute_bbox());
            const Vector3d extent = scene_bbox.extent();
            const double max_radius = 0.5 * max(extent.x, extent.z);
            const double max_height = 0.5 * extent.y;

            // Precompute some stuff.
            const Vector3d Up(0.0, 1.0, 0.0);
            const Vector3d center = scene_bbox.center() + center_offset;
            const double distance = max_radius * normalized_distance;
            const double elevation = max_height * normalized_elevation;

            // Compute the transform of the camera at the last frame.
            const double angle = -1.0 / frame_count * TwoPi<double>();
            const Vector3d position(distance * cos(angle), elevation, distance * sin(angle));
            Transformd previous_transform(
                Transformd::from_local_to_parent(
                    Matrix4d::make_lookat(position, center, Up)));

            for (int i = 0; i < frame_count; ++i)
            {
                // Compute the transform of the camera at this frame.
                const double angle = (i * TwoPi<double>()) / frame_count;
                const Vector3d position(distance * cos(angle), elevation, distance * sin(angle));
                const Transformd new_transform(
                    Transformd::from_local_to_parent(
                        Matrix4d::make_lookat(position, center, Up)));

                // Set the camera's transform sequence.
                Camera* camera = project->get_uncached_active_camera();
                camera->transform_sequence().clear();
                camera->transform_sequence().set_transform(0.0f, previous_transform);
                camera->transform_sequence().set_transform(1.0f, new_transform);
                previous_transform = new_transform;

                // Write the project file for this frame.
                const size_t frame = static_cast<size_t>(i + 1);
                const string new_path = make_numbered_filename(m_base_output_filename + ".appleseed", frame);
                ProjectFileWriter::write(
                    project.ref(),
                    new_path.c_str(),
                    i == 0 ? ProjectFileWriter::Defaults : ProjectFileWriter::OmitWritingGeometryFiles);
                project->set_path(new_path.c_str());

                frames.push_back(frame);
            }

            assert(frames.size() == static_cast<size_t>(frame_count));

            return frames;
        }
    };
}

//
// Entry point of animatecamera.
//

int main(int argc, const char* argv[])
{
    // Initialize the logger that will be used throughout the program.
    SuperLogger logger;

    // Make sure appleseed is correctly installed.
    Application::check_installation(logger);

    // Parse the command line.
    g_cl.parse(argc, argv, logger);

    // Load an apply settings from the settings file.
    Dictionary settings;
    Application::load_settings("appleseed.tools.xml", settings, logger);
    logger.configure_from_settings(settings);

    // Apply command line arguments.
    g_cl.apply(logger);

    // Configure the renderer's global logger.
    // Must be done after settings have been loaded and the command line
    // has been parsed, because these two operations may replace the log
    // target of the global logger.
    global_logger().initialize_from(logger);

    const string base_output_filename =
        bf::path(g_cl.m_filenames.values()[1]).stem().string();

    auto_ptr<AnimationGenerator> generator;

    if (g_cl.m_animation_path.is_set())
        generator.reset(new PathAnimationGenerator(base_output_filename, logger));
    else generator.reset(new TurntableAnimationGenerator(base_output_filename, logger));

    generator->generate();

    return 0;
}


text:
<?php function page_css(){ ?>

    <link href="<?php echo base_url('assets/admin'); ?>/css/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />

    <link href="<?php echo base_url('assets/admin'); ?>/css/iCheck/all.css" rel="stylesheet" type="text/css" />

    <link href="<?php echo base_url('assets/admin'); ?>/css/colorpicker/bootstrap-colorpicker.min.css" rel="stylesheet"/>

    <link href="<?php echo base_url('assets/admin'); ?>/css/timepicker/bootstrap-timepicker.min.css" rel="stylesheet"/>

<?php } ?>

<?php include('header.php'); ?>

Change password

                <?php echo form_open_multipart('', ['role' => 'form', 'class' => 'form-horizontal']); ?>

                        <div class="form-group <?php if(form_error('old_password')) echo 'has-error'; ?>">
                            Old Password
                                *

                                <input type="password" name="old_password" class="form-control" placeholder="Enter Old Password">
                                <?php echo form_error('old_password') ?>

                        <div class="form-group <?php if(form_error('password')) echo 'has-error'; ?>">
                            New Password
                                *

                                <input type="password" name="password" class="form-control" placeholder="Enter New Password">
                                <?php echo form_error('password') ?>

                        <div class="form-group <?php if(form_error('passconf')) echo 'has-error'; ?>">
                            New Password Confirmation
                                *

                                <input type="password" name="passconf" class="form-control" placeholder="Enter New Confirmation Password">
                                <?php echo form_error('passconf') ?>

                        <button type="submit" name="submit" value="changePassword" class="btn btn-primary">
                             Change Password
                        </button>

                </form>

<?php function page_js(){ ?>

<?php } ?>


text:
@interface StoreViewController ()
@property (weak, nonatomic) IBOutlet UILabel *goldenEggLabel;
@property (weak, nonatomic) IBOutlet UILabel *whiteEggLabel;

@end

@implementation StoreViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSLog(@"store: %@", _store);
    [self refreshStoreUI];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)doneButtonPressed:(id)sender {
    [self.delegate storeViewControllerDidPressDone:self];
}

- (IBAction)buyGoldenEggButtonPressed:(id)sender {
    [self.delegate storeViewControllerDidBuyGoldenEgg:self];

    _store.goldenEggCount++;
    [self refreshStoreUI];
}

- (IBAction)buyWhiteEggButtonPressed:(id)sender {
    [self.delegate storeViewControllerDidBuyWhiteEgg:self];

    _store.whiteEggCount++;
    [self refreshStoreUI];
}

- (void)refreshStoreUI {

    self.goldenEggLabel.text = [@(_store.goldenEggCount) stringValue];
    self.whiteEggLabel.text = [@(_store.whiteEggCount) stringValue];

}
@end


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<groupId>org.xml-cml</groupId>
	<artifactId>ami-chemtext</artifactId>
	<version>0.1-SNAPSHOT</version>
	<description>Plugin architecture for converting  text to chemistry </description>
	<name>AMI-chemtext</name>
	<!-- <parent> <groupId>uk.ac.cam.ch.wwmm</groupId> <artifactId>wwmm-parent</artifactId>
		<version>5-SNAPSHOT</version> </parent> -->
	<!-- this should not be necessary -->
	<properties>
	</properties>

	<!--Remove <repositories> for releases to Maven central -->
	<repositories>
		<repository>
			<id>ebi-repo</id>
			<name>EBI Maven Repository</name>
			<url>http://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo/</url>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>never</updatePolicy>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>ebi-repo-snapshots</id>
			<name>EBI Maven Snapshots Repository</name>
			<url>http://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo-snapshots/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>interval:7200</updatePolicy>
			</snapshots>
		</repository>
		<repository>
			<id>ebi-repo-3rd</id>
			<name>EBI Maven Snapshots Repository</name>
			<url>http://www.ebi.ac.uk/~maven/m2repo</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>ucc-repo</id>
			<name>UCC Maven Repository</name>
			<url>https://maven.ch.cam.ac.uk/m2repo</url>
		</repository>
	</repositories>

	<prerequisites>
		<maven>3.0.4</maven>
	</prerequisites>

	<build>
		<plugins>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>appassembler-maven-plugin</artifactId>
				<version>1.8.1</version>
				<configuration>

					<programs>
						<program>
							<mainClass>org.xmlcml.ami2.plugins.gene.GenePlugin</mainClass>
							<id>ami2-gene</id>
						</program>
					</programs>

					<!-- Prevent long directories -->
					<repositoryLayout>flat</repositoryLayout>

				</configuration>

				<executions>
					<execution>
						<id>assembly</id>
						<phase>package</phase>
						<goals>
							<goal>assemble</goal>
						</goals>
					</execution>
				</executions>

			</plugin>

			<plugin>
				<!--Tool for building a Debian package (.deb) http://tech.ebuddy.com/2013/10/02/automating-debian-package-creation-and-management-with-mavenant/
					https://github.com/brndkfr/xmppbot/blob/master/xmppbot/pom.xml -->
				<artifactId>jdeb</artifactId>
				<groupId>org.vafer</groupId>
				<version>1.3</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>jdeb</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<dataSet>
						<data>
							<src>${project.build.directory}/appassembler/</src>
							<type>directory</type>
							<mapper>
								<type>perm</type>
								<filemode>555</filemode>
								<prefix>/usr/share/ami-repo</prefix>
							</mapper>
						</data>
						<!-- <data> <src>${basedir}/src/test/resources/org/xmlcml/ami/html/multiple.312.html</src>
							<type>file</type> <mapper> <type>perm</type> <filemode>555</filemode> <prefix>/usr/share/ami-repo/exampleData/html</prefix>
							</mapper> </data> -->
					</dataSet>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.4.1</version>
				<configuration>
					<descriptor>src/main/assembly/bin.xml</descriptor>
				</configuration>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
			</plugin>

		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.xml-cml</groupId>
			<artifactId>euclid</artifactId>
			<version>1.1-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>org.xml-cml</groupId>
			<artifactId>cmlxom</artifactId>
			<version>3.1</version>
		</dependency>

		<dependency>
			<groupId>uk.ac.cam.ch.wwmm</groupId>
			<artifactId>chemicalTagger</artifactId>
<!--  			<version>1.4.0</version> -->
 			<version>1.5.0-SNAPSHOT</version>

		</dependency>

		<dependency>
			<groupId>org.xml-cml</groupId>
			<artifactId>ami-chem</artifactId>
			<version>0.1-SNAPSHOT</version>
		</dependency>

		<!-- tests -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>

	</dependencies>

</project>


text:
#ifndef OFCONSOL_H
#define OFCONSOL_H

#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/ofstream.h"
#include "dcmtk/ofstd/ofthread.h"

#define INCLUDE_CSTDLIB
#include "dcmtk/ofstd/ofstdinc.h"

/** Singleton class which provides thread-safe access to the standard console
 *  output and error streams. Allows multiple threads to concurrently create
 *  output even if that output is redirected to file or memory.
 *  Protection is implemented if the module is compiled with -DWITH_THREADS
 *  and is based on Mutexes.
 *  Use of the singleton prior to start of main (i.e. from global constructors)
 *  is allowed, but any use after the end of main is undefined.
 */
class OFConsole
{
public:

  /** destructor.
   */
  virtual ~OFConsole(){ }

  /** acquires a lock on the cout stream and returns a reference
   *  to the stream.
   *  @return reference to cout stream
   */
  STD_NAMESPACE ostream& lockCout()
  {
#ifdef WITH_THREADS
    coutMutex.lock();
#endif
    return *currentCout;
  }

  /** releases the lock on the cout stream.
   */
  void unlockCout()
  {
#ifdef WITH_THREADS
    coutMutex.unlock();
#endif
  }

  /** returns a reference to the current cout stream.
   *  This method neither locks nor unlocks the stream - the called
   *  must ensure that the stream is locked and unlocked appropriately.
   *  @return reference to cout stream
   */
  STD_NAMESPACE ostream& getCout()
  {
    return *currentCout;
  }

  /** exchanges the cout stream object.
   *  This method acquires its own lock. Cout must not
   *  be locked by the calling thread, otherwise a deadlock may occur.
   *  The caller must ensure that the same stream object is not set
   *  both as cout and cerr because this might result in a conflict
   *  if one thread locks and uses cout, and another one locks and uses cerr.
   *  Use the join() method instead, see below.
   *  @param newCout new cout stream, default: restore the stream that was
   *         active upon creation of the console object.
   *  @return pointer to replaced cout stream.
   */
  STD_NAMESPACE ostream *setCout(STD_NAMESPACE ostream *newCout=NULL);

  /** acquires a lock on the cerr stream and returns a reference
   *  to the stream.
   *  @return reference to cerr stream
   */
  STD_NAMESPACE ostream& lockCerr()
  {
#ifdef WITH_THREADS
    cerrMutex.lock();
#endif
    if (joined)
    {
#ifdef WITH_THREADS
      coutMutex.lock();
#endif
      return *currentCout;
    }
    else return *currentCerr;
  }

  /** returns a reference to the current cerr stream.
   *  This method neither locks nor unlocks the stream - the called
   *  must ensure that the stream is locked and unlocked appropriately.
   *  @return reference to cerr stream
   */
  STD_NAMESPACE ostream& getCerr()
  {
    if (joined) return *currentCout;
    else return *currentCerr;
  }

  /** releases the lock on the cerr stream.
   */
  void unlockCerr()
  {
#ifdef WITH_THREADS
    if (joined) coutMutex.unlock();
    cerrMutex.unlock();
#endif
  }

  /** exchanges the cerr stream object.
   *  This method acquires its own lock. Cerr must not
   *  be locked by the calling thread, otherwise a deadlock may occur.
   *  The caller must ensure that the same stream object is not set
   *  both as cout and cerr because this might result in a conflict
   *  if one thread locks and uses cout, and another one locks and uses cerr.
   *  Use the join() method instead, see below.
   *  @param newCerr new cerr stream, default: restore the stream that was
   *         active upon creation of the console object.
   *  @return pointer to replaced cerr stream.
   */
  STD_NAMESPACE ostream *setCerr(STD_NAMESPACE ostream *newCerr=NULL);

  /** combines the cerr and cout streams.
   *  After a call to this method, both cout and cerr related methods
   *  lock, unlock and return the cout stream.
   *  This method acquires its own locks. Neither cout nor cerr may
   *  be locked by the calling thread, otherwise a deadlock may occur.
   */
  void join();

  /** splits combined cerr and cout streams.
   *  After a call to this method, cout and cerr related methods
   *  again lock, unlock and return different cout and cerr objects.
   *  This method acquires its own locks. Neither cout nor cerr may
   *  be locked by the calling thread, otherwise a deadlock may occur.
   */
  void split();

  /** Checks whether cout and cerr are currently combined.
   *  This method acquires its own locks. Neither cout nor cerr may
   *  be locked by the calling thread, otherwise a deadlock may occur.
   *  @return OFTrue if streams are combined, OFFalse otherwise.
   */
  OFBool isJoined();

  /** returns the singleton instance of this class.
   *  May be called before main() but not after end of main
   */
  static OFConsole& instance();

private:

  /** default constructor. After construction, the cout methods refer to the
   *  standard output stream and the cerr methods refer to the standard
   *  error stream. If compiled with -DDCMTK_GUI, string streams named
   *  COUT and CERR are used instead.
   */
  OFConsole();

  /** private undefined copy constructor */
  OFConsole(const OFConsole &arg);

  /** private undefined assignment operator */
  OFConsole& operator=(const OFConsole &arg);

  /** pointer to current cout stream, never NULL */
  STD_NAMESPACE ostream *currentCout;

  /** pointer to current cerr stream, never NULL */
  STD_NAMESPACE ostream *currentCerr;

  /** true if streams are combined, false otherwise */
  int joined;

#ifdef WITH_THREADS
  /** mutex protecting access to cout */
  OFMutex coutMutex;

  /** mutex protecting access to cerr */
  OFMutex cerrMutex;
#endif

  // dummy declaration to keep gcc quiet
  friend class OFConsoleDummyFriend;
};

/** macro for accessing the glocal console object.
 *  This used to be an external global variable in earlier DCMTK releases
 */
#define ofConsole (OFConsole::instance())

/*
 * definitions for COUT, CERR, CLOG.
 *
 * NOTE: DIRECT USE OF THESE MACROS IS UNSAFE IN MULTITHREAD APPLICATIONS.
 */

#ifdef DCMTK_GUI

extern OFOStringStream COUT;
extern OFOStringStream CERR;

#else /* DCMTK_GUI */

#define COUT (ofConsole.getCout())
#define CERR (ofConsole.getCerr())

#endif /* DCMTK_GUI */

#endif /* OFCONSOL_H */

/*
 *
 * CVS/RCS Log:
 * $Log: ofconsol.h,v $
 * Revision 1.21  2010-10-14 13:15:50  joergr
 * Updated copyright header. Added reference to COPYRIGHT file.
 *
 * Revision 1.20  2010-10-04 14:44:47  joergr
 * Replaced "#ifdef _REENTRANT" by "#ifdef WITH_THREADS" where appropriate (i.e.
 * in all cases where OFMutex, OFReadWriteLock, etc. are used).
 *
 * Revision 1.19  2006/08/14 16:42:26  meichel
 * Updated all code in module ofstd to correctly compile if the standard
 *   namespace has not included into the global one with a "using" directive.
 *
 * Revision 1.18  2005/12/08 16:05:52  meichel
 * Changed include path schema for all DCMTK header files
 *
 * Revision 1.17  2004/01/21 11:50:10  meichel
 * Fixed DOS CR/LF in preprocessor directives
 *
 * Revision 1.16  2004/01/16 10:30:12  joergr
 * Removed acknowledgements with e-mail addresses from CVS log.
 *
 * Revision 1.15  2003/12/17 17:38:39  meichel
 * Changed definition of COUT and CERR macros to allow redirection to file.
 *
 * Revision 1.14  2003/12/05 10:37:41  joergr
 * Removed leading underscore characters from preprocessor symbols (reserved
 * symbols). Updated copyright date where appropriate.
 *
 * Revision 1.13  2002/11/27 11:23:05  meichel
 * Adapted module ofstd to use of new header file ofstdinc.h
 *
 * Revision 1.12  2002/05/16 15:56:33  meichel
 * Changed ofConsole into singleton implementation that can safely
 *   be used prior to start of main, i.e. from global constructors
 *
 * Revision 1.11  2002/05/16 08:16:44  meichel
 * changed return type of OFConsole::setCout() and OFConsole::setCerr()
 *   to pointer instead of reference.
 *
 * Revision 1.10  2002/05/02 14:05:50  joergr
 * Added support for standard and non-standard string streams (which one is
 * supported is detected automatically via the configure mechanism).
 *
 * Revision 1.9  2002/04/16 13:36:02  joergr
 * Added configurable support for C++ ANSI standard includes (e.g. streams).
 *
 * Revision 1.8  2001/06/01 15:51:33  meichel
 * Updated copyright header
 *
 * Revision 1.7  2000/12/13 15:14:25  joergr
 * Introduced dummy parameter for "default" constructor of class OFConsole
 * to "convince" linker of gcc 2.5.8 (NeXTSTEP) to allocate memory for global
 * variable 'ofConsole'.
 *
 * Revision 1.6  2000/10/10 12:01:21  meichel
 * Created/updated doc++ comments
 *
 * Revision 1.5  2000/09/26 13:46:12  meichel
 * Simplified inline code in ofconsol.h, required by Sun CC 2.x
 *
 * Revision 1.4  2000/06/21 15:47:54  meichel
 * Including stdlib.h, required for Sun CC 4.2
 *
 * Revision 1.3  2000/04/14 15:41:40  meichel
 * Added unprotected get methods, required for the cmdata debug facility.
 *
 * Revision 1.2  2000/04/14 15:16:08  meichel
 * Added new class OFConsole and global instance ofConsole which provide
 *   access to standard output and error streams in a way that allows multiple
 *   threads to safely create output concurrently.
 *
 * Revision 1.1  2000/03/03 14:02:47  meichel
 * Implemented library support for redirecting error messages into memory
 *   instead of printing them to stdout/stderr for GUI applications.
 *
 *
 */


text:
using System;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Tests.Common.Builders.Interfaces;

namespace Umbraco.Cms.Tests.Common.Builders;

public class RelationTypeBuilder
    : ChildBuilderBase<RelationBuilder, IRelationTypeWithIsDependency>,
        IWithIdBuilder,
        IWithAliasBuilder,
        IWithNameBuilder,
        IWithKeyBuilder,
        IWithCreateDateBuilder,
        IWithUpdateDateBuilder,
        IWithDeleteDateBuilder
{
    private string _alias;
    private Guid? _childObjectType;
    private DateTime? _createDate;
    private DateTime? _deleteDate;
    private int? _id;
    private bool? _isBidirectional;
    private bool? _isDependency;
    private Guid? _key;
    private string _name;
    private Guid? _parentObjectType;
    private DateTime? _updateDate;

    public RelationTypeBuilder()
        : base(null)
    {
    }

    public RelationTypeBuilder(RelationBuilder parentBuilder)
        : base(parentBuilder)
    {
    }

    string IWithAliasBuilder.Alias
    {
        get => _alias;
        set => _alias = value;
    }

    DateTime? IWithCreateDateBuilder.CreateDate
    {
        get => _createDate;
        set => _createDate = value;
    }

    DateTime? IWithDeleteDateBuilder.DeleteDate
    {
        get => _deleteDate;
        set => _deleteDate = value;
    }

    int? IWithIdBuilder.Id
    {
        get => _id;
        set => _id = value;
    }

    Guid? IWithKeyBuilder.Key
    {
        get => _key;
        set => _key = value;
    }

    string IWithNameBuilder.Name
    {
        get => _name;
        set => _name = value;
    }

    DateTime? IWithUpdateDateBuilder.UpdateDate
    {
        get => _updateDate;
        set => _updateDate = value;
    }

    public RelationTypeBuilder WithIsBidirectional(bool isBidirectional)
    {
        _isBidirectional = isBidirectional;
        return this;
    }

    public RelationTypeBuilder WithIsDependency(bool isDependency)
    {
        _isDependency = isDependency;
        return this;
    }

    public RelationTypeBuilder WithChildObjectType(Guid childObjectType)
    {
        _childObjectType = childObjectType;
        return this;
    }

    public RelationTypeBuilder WithParentObjectType(Guid parentObjectType)
    {
        _parentObjectType = parentObjectType;
        return this;
    }

    public override IRelationTypeWithIsDependency Build()
    {
        var alias = _alias ?? Guid.NewGuid().ToString();
        var name = _name ?? Guid.NewGuid().ToString();
        var parentObjectType = _parentObjectType;
        var childObjectType = _childObjectType;
        var id = _id ?? 0;
        var key = _key ?? Guid.NewGuid();
        var isBidirectional = _isBidirectional ?? false;
        var isDependency = _isDependency ?? false;
        var createDate = _createDate ?? DateTime.Now;
        var updateDate = _updateDate ?? DateTime.Now;
        var deleteDate = _deleteDate;

        return new RelationType(name, alias, isBidirectional, parentObjectType, childObjectType, isDependency)
        {
            Id = id,
            Key = key,
            CreateDate = createDate,
            UpdateDate = updateDate,
            DeleteDate = deleteDate
        };
    }
}


text:
package frclibj;

public class TrcIIRFilter
{
    private static final String moduleName = "TrcIIRFilter";
    private static final boolean debugEnabled = false;
    private TrcDbgTrace dbgTrace = null;

    private double weight;
    private double filteredData;

    public TrcIIRFilter()
    {
        this(0.9);
    }   //TrcIIRFilter

    public TrcIIRFilter(double weight)
    {
        if (debugEnabled)
        {
            dbgTrace = new TrcDbgTrace(
                    moduleName,
                    false,
                    TrcDbgTrace.TraceLevel.API,
                    TrcDbgTrace.MsgLevel.INFO);
        }

        if (weight < 0.0 || weight > 1.0)
        {
            throw new IllegalArgumentException(
                    "Weight must be a positive fraction within 1.0.");
        }

        this.weight = weight;
        filteredData = 0.0;
    }   //TrcIIRFilter

    public double filter(double data)
    {
        final String funcName = "filter";

        filteredData = filteredData*(1.0 - weight) + data*weight;

        if (debugEnabled)
        {
            dbgTrace.traceEnter(
                    funcName, TrcDbgTrace.TraceLevel.API,
                    "data=%f", data);
            dbgTrace.traceEnter(
                    funcName, TrcDbgTrace.TraceLevel.API,
                    "=%f", filteredData);
        }
        return filteredData;
    }   //filter

}   //class TrcIIRFilter