text:
// Copyright 2022 Google LLC
//
// 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.

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

package com.google.api.ads.admanager.axis.v202202;

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

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

    public static final java.lang.String _IMPRESSION_LIMIT_EXCEEDED = "IMPRESSION_LIMIT_EXCEEDED";
    public static final java.lang.String _IMPRESSIONS_TOO_LOW = "IMPRESSIONS_TOO_LOW";
    public static final java.lang.String _RANGE_LIMIT_EXCEEDED = "RANGE_LIMIT_EXCEEDED";
    public static final java.lang.String _RANGE_TOO_LOW = "RANGE_TOO_LOW";
    public static final java.lang.String _DUPLICATE_TIME_RANGE = "DUPLICATE_TIME_RANGE";
    public static final java.lang.String _TOO_MANY_FREQUENCY_CAPS = "TOO_MANY_FREQUENCY_CAPS";
    public static final java.lang.String _UNKNOWN = "UNKNOWN";
    public static final FrequencyCapErrorReason IMPRESSION_LIMIT_EXCEEDED = new FrequencyCapErrorReason(_IMPRESSION_LIMIT_EXCEEDED);
    public static final FrequencyCapErrorReason IMPRESSIONS_TOO_LOW = new FrequencyCapErrorReason(_IMPRESSIONS_TOO_LOW);
    public static final FrequencyCapErrorReason RANGE_LIMIT_EXCEEDED = new FrequencyCapErrorReason(_RANGE_LIMIT_EXCEEDED);
    public static final FrequencyCapErrorReason RANGE_TOO_LOW = new FrequencyCapErrorReason(_RANGE_TOO_LOW);
    public static final FrequencyCapErrorReason DUPLICATE_TIME_RANGE = new FrequencyCapErrorReason(_DUPLICATE_TIME_RANGE);
    public static final FrequencyCapErrorReason TOO_MANY_FREQUENCY_CAPS = new FrequencyCapErrorReason(_TOO_MANY_FREQUENCY_CAPS);
    public static final FrequencyCapErrorReason UNKNOWN = new FrequencyCapErrorReason(_UNKNOWN);
    public java.lang.String getValue() { return _value_;}
    public static FrequencyCapErrorReason fromValue(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        FrequencyCapErrorReason enumeration = (FrequencyCapErrorReason)
            _table_.get(value);
        if (enumeration==null) throw new java.lang.IllegalArgumentException();
        return enumeration;
    }
    public static FrequencyCapErrorReason fromString(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        return fromValue(value);
    }
    public boolean equals(java.lang.Object obj) {return (obj == this);}
    public int hashCode() { return toString().hashCode();}
    public java.lang.String toString() { return _value_;}
    public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new org.apache.axis.encoding.ser.EnumSerializer(
            _javaType, _xmlType);
    }
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new org.apache.axis.encoding.ser.EnumDeserializer(
            _javaType, _xmlType);
    }
    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(FrequencyCapErrorReason.class);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202202", "FrequencyCapError.Reason"));
    }
    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

}


text:
package org.wicketopia.component.label;

import org.apache.wicket.markup.html.basic.Label;
import org.metastopheles.PropertyMetaData;
import org.wicketopia.metadata.WicketopiaPropertyFacet;
import org.wicketopia.model.label.DisplayNameModel;

/**
 * A label which displays the appropriate label text for the property.
 *
 * @see org.wicketopia.model.label.DisplayNameModel the model used by this component
 * @since 1.0
 */
public class PropertyLabel extends Label {
//----------------------------------------------------------------------------------------------------------------------
// Fields
//----------------------------------------------------------------------------------------------------------------------

    private static final long serialVersionUID = 1L;

//----------------------------------------------------------------------------------------------------------------------
// Constructors
//----------------------------------------------------------------------------------------------------------------------

    public PropertyLabel(String id, PropertyMetaData propertyMetadata) {
        super(id, new DisplayNameModel(WicketopiaPropertyFacet.get(propertyMetadata)));
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.amazonaws.services.databasemigrationservice.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.databasemigrationservice.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * DescribeReplicationInstanceTaskLogsResult JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeReplicationInstanceTaskLogsResultJsonUnmarshaller implements
        Unmarshaller<DescribeReplicationInstanceTaskLogsResult, JsonUnmarshallerContext> {

    public DescribeReplicationInstanceTaskLogsResult unmarshall(JsonUnmarshallerContext context) throws Exception {
        DescribeReplicationInstanceTaskLogsResult describeReplicationInstanceTaskLogsResult = new DescribeReplicationInstanceTaskLogsResult();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return describeReplicationInstanceTaskLogsResult;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("ReplicationInstanceArn", targetDepth)) {
                    context.nextToken();
                    describeReplicationInstanceTaskLogsResult.setReplicationInstanceArn(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("ReplicationInstanceTaskLogs", targetDepth)) {
                    context.nextToken();
                    describeReplicationInstanceTaskLogsResult.setReplicationInstanceTaskLogs(new ListUnmarshaller<ReplicationInstanceTaskLog>(
                            ReplicationInstanceTaskLogJsonUnmarshaller.getInstance()).unmarshall(context));
                }
                if (context.testExpression("Marker", targetDepth)) {
                    context.nextToken();
                    describeReplicationInstanceTaskLogsResult.setMarker(context.getUnmarshaller(String.class).unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return describeReplicationInstanceTaskLogsResult;
    }

    private static DescribeReplicationInstanceTaskLogsResultJsonUnmarshaller instance;

    public static DescribeReplicationInstanceTaskLogsResultJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new DescribeReplicationInstanceTaskLogsResultJsonUnmarshaller();
        return instance;
    }
}


text:
namespace google {
namespace cloud {
namespace retail_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

PredictionServiceConnectionImpl::PredictionServiceConnectionImpl(
    std::unique_ptr<google::cloud::BackgroundThreads> background,
    std::shared_ptr<retail_internal::PredictionServiceStub> stub,
    Options options)
    : background_(std::move(background)),
      stub_(std::move(stub)),
      options_(internal::MergeOptions(
          std::move(options), PredictionServiceConnection::options())) {}

StatusOr<google::cloud::retail::v2::PredictResponse>
PredictionServiceConnectionImpl::Predict(
    google::cloud::retail::v2::PredictRequest const& request) {
  return google::cloud::internal::RetryLoop(
      retry_policy(), backoff_policy(), idempotency_policy()->Predict(request),
      [this](grpc::ClientContext& context,
             google::cloud::retail::v2::PredictRequest const& request) {
        return stub_->Predict(context, request);
      },
      request, __func__);
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace retail_internal
}  // namespace cloud
}  // namespace google


text:
<?php namespace Znck\Repositories;

use Closure;
use Illuminate\Contracts\Container\Container as Application;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Laravel\Scout\Searchable;
use Znck\Repositories\Contracts\Criteria;
use Znck\Repositories\Exceptions\NotFoundResourceException;
use Znck\Repositories\Exceptions\RepositoryException;
use Znck\Repositories\Exceptions\ScoutNotFoundException;
use Znck\Repositories\Exceptions\UnsupportedScoutFeature;

abstract class Repository implements Contracts\Repository, Contracts\Validating, Contracts\HasTransactions, Contracts\RepositoryExtras
{
    use Traits\RepositoryHelper;

    public static $repositories = [];

    /**
     * @var Application
     */
    protected $app;

    /**
     * @var \Illuminate\Support\Collection
     */
    protected $criteria;

    /**
     * @var string
     */
    protected $model;

    /**
     * @var Model
     */
    protected $instance;

    /**
     * @var \Illuminate\Database\Eloquent\Builder
     */
    protected $query;

    /**
     * @var \Laravel\Scout\Builder
     */
    protected $scout;

    /**
     * Eager relations.
     *
     * @var array
     */
    protected $with = [];

    /**
     * @var bool
     */
    protected $skipCriteria = false;

    public function __construct(Application $app)
    {
        $this->app = $app;
        $this->criteria = new Collection();
        $this->boot();
    }

    public function boot()
    {
    }

    protected function makeModel()
    {
        $class = $this->model;

        if (! is_string($class) or ! class_exists($class)) {
            throw new RepositoryException($class);
        }

        $this->instance = $this->app->make($class);

        if (! $this->instance instanceof Model) {
            throw new RepositoryException($class);
        }

        $this->query = $this->instance->newQuery();
    }

    public static function register(array $map)
    {
        self::$repositories += $map;
    }

    protected function isSearching()
    {
        return ! is_null($this->scout);
    }

    protected function applyCriteria()
    {
        $this->getQuery()->with($this->with);

        if ($this->skipCriteria) {
            return $this;
        }

        if ($this->isSearching()) {
            foreach ($this->getCriteria() as $criteria) {
                $criteria->apply($this->scout, $this);
            }
        } else {
            foreach ($this->getCriteria() as $criteria) {
                $criteria->apply($this->getQuery(), $this);
            }
        }

        return $this;
    }

    /**
     * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder
     */
    public function getQuery()
    {
        if (is_null($this->query)) {
            $this->makeModel();
        }

        return $this->query;
    }

    /**
     * Get all criteria.
     *
     * @return \Illuminate\Support\Collection|Criteria[]
     */
    public function getCriteria()
    {
        return $this->criteria;
    }

    /**
     * Remove all criteria.
     *
     * @return $this
     */
    public function clearCriteria()
    {
        $this->criteria = new Collection();

        return $this;
    }

    /**
     * Retrieve the "count" result of the query.
     *
     * @param string $columns
     *
     * @throws \Znck\Repositories\Exceptions\UnsupportedScoutFeature
     *
     * @return int
     */
    public function count($columns = '*')
    {
        $this->applyCriteria();

        if ($this->isSearching()) {
            throw new UnsupportedScoutFeature('scout: count() is not supported!');
        }

        return $this->getQuery()->count($columns);
    }

    /**
     * Get all items.
     *
     * @param array $columns
     *
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function all($columns = ['*'])
    {
        $this->applyCriteria();

        if ($this->isSearching()) {
            return $this->scout->get()->load($this->with);
        }

        return $this->getQuery()->get($columns);
    }

    /**
     * Find a model by its primary key.
     *
     * @param string|int $id
     * @param array      $columns
     *
     * @return Model
     */
    public function find($id, $columns = ['*'])
    {
        $this->applyCriteria();

        if ($this->isSearching()) {
            return $this->scout->where($this->getModel()->getKeyName(), $id)->first()->load($this->with);
        }

        $result = $this->getQuery()->find($id, $columns);

        if (! $result instanceof Model) {
            throw new NotFoundResourceException('Not found.');
        }

        return $result;
    }

    /**
     * Find a model by given key. (This would return first matching object).
     *
     * @param string $key
     * @param mixed  $value
     *
     * @return Model
     */
    public function findBy(string $key, $value)
    {
        $this->applyCriteria();

        if ($this->isSearching()) {
            return $this->scout->where($key, $value)->get()->load($this->with);
        }

        $result = $this->getQuery()->where($key, $value)->first();

        if (! $result instanceof Model) {
            throw new NotFoundResourceException('Not found.');
        }

        return $result;
    }

    /**
     * Find models by their primary keys.
     *
     * @param array $ids
     * @param array $columns
     *
     * @throws \Znck\Repositories\Exceptions\UnsupportedScoutFeature
     *
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function findMany(array $ids, $columns = ['*'])
    {
        $this->applyCriteria();

        if ($this->isSearching()) {
            throw new UnsupportedScoutFeature('scout: wherein is not supported!');
        }

        return $this->getQuery()
                    ->whereIn($this->getModel()->getKeyName(), $ids)
                    ->get();
    }

    /**
     * @return Model
     */
    public function getModel(): Model
    {
        if (is_null($this->instance)) {
            $this->makeModel();
        }

        return $this->instance;
    }

    /**
     * Get all items.
     *
     * @param array $columns
     *
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function first($columns = ['*'])
    {
        $this->applyCriteria();

        if ($this->isSearching()) {
            return $this->scout->first()->load($this->with);
        }

        return $this->getQuery()->first($columns);
    }

    /**
     * Paginate the given query.
     *
     * @param int      $perPage
     * @param array    $columns
     * @param string   $pageName
     * @param int|null $page
     *
     * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
     */
    public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $this->applyCriteria();

        if ($this->isSearching()) {
            /** @var \Illuminate\Pagination\LengthAwarePaginator $paginator */
            $paginator = $this->scout->paginate($perPage, $pageName, $perPage);
            /** @var \Illuminate\Database\Eloquent\Collection $collection */
            $collection = $paginator->getCollection();
            $collection->load($this->with);

            return $paginator;
        }

        return $this->getQuery()->paginate($perPage, $columns, $pageName, $page);
    }

    /**
     * Paginate the given query into a simple paginator.
     *
     * @param int      $perPage
     * @param array    $columns
     * @param string   $pageName
     * @param int|null $page
     *
     * @return \Illuminate\Contracts\Pagination\Paginator
     */
    public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $this->applyCriteria();

        if ($this->isSearching()) {
            /** @var \Illuminate\Pagination\Paginator $paginator */
            $paginator = $this->scout->paginate($perPage, $pageName, $perPage);
            /** @var \Illuminate\Database\Eloquent\Collection $collection */
            $collection = $paginator->getCollection();
            $collection->load($this->with);

            return $paginator;
        }

        return $this->getQuery()->simplePaginate($perPage, $columns, $pageName, $page);
    }

    /**
     * Find models matching query string.
     *
     * @param string            $q
     * @param callable|\Closure $callback
     *
     * @throws \Exception
     *
     * @return $this
     */
    public function search(string $q, $callback = null)
    {
        if (! in_array(Searchable::class, class_uses_recursive($this->model))) {
            throw new ScoutNotFoundException($this->model);
        }

        /* @noinspection PhpUndefinedMethodInspection */
        $this->scout = $this->getModel()->search($q);

        if (is_callable($callback)) {
            call_user_func_array($callback, [$this->scout, $this]);
        } elseif ($callback instanceof Closure) {
            $callback($this->scout, $this);
        }

        return $this;
    }

    /**
     * Remove a criterion.
     *
     * @param Criteria|null $criteria
     *
     * @return Criteria
     */
    public function popCriteria(Criteria $criteria = null) : Criteria
    {
        if (is_null($criteria)) {
            return $this->getCriteria()->pop();
        }

        $class = get_class($criteria);
        foreach ($this->getCriteria() as $index => $value) {
            if ($value instanceof $class) {
                $this->getCriteria()->slice($index, 1);

                return $value;
            }
        }

        return null;
    }

    /**
     * Push Criteria for filter the query.
     *
     * @param Criteria $criteria
     *
     * @return $this
     */
    public function pushCriteria(Criteria $criteria)
    {
        $this->getCriteria()->push($criteria);

        return $this;
    }

    /**
     * Reset repository.
     *
     * @return \Znck\Repositories\Contracts\Repository
     */
    public function refresh()
    {
        $this->query = $this->getModel()->newQuery();
        $this->scout = null;
        $this->boot();

        return $this;
    }

    /**
     * @param bool $skip
     *
     * @return $this
     */
    public function skipCriteria($skip = true)
    {
        $this->skipCriteria = $skip;

        return $this;
    }

    /**
     * Get result of the query.
     *
     * @param string|array|\Closure $column
     * @param string                $operator
     * @param mixed                 $value
     * @param string                $boolean
     *
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function where($column, $operator = null, $value = null, $boolean = 'and')
    {
        $this->applyCriteria();

        return $this->getQuery()->where($column, $operator, $value, $boolean)->get();
    }

    public function with($relations)
    {
        $this->with = array_merge($this->with, (is_array($relations) ? $relations : (array) $relations));

        return $this;
    }

    public function __call($name, $arguments)
    {
        $query = $this->getQuery();
        $result = call_user_func_array([$query, $name], $arguments);

        if ($query === $result) {
            return $this;
        }

        return $result;
    }
}


text:
class Collection < ActiveRecord::Base

  has_many :movies

  validates_presence_of :collection_title

  def to_param
    "#{id}-#{collection_title.downcase.gsub(/[^a-z1-9]+/i, '-')}"
  end

end


text:
package org.elasticsearch.upgrades;

import org.elasticsearch.Version;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.common.Booleans;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.xpack.core.watcher.support.xcontent.ObjectPath;
import org.hamcrest.Matcher;

import java.io.IOException;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;

public class RollupIDUpgradeIT extends AbstractUpgradeTestCase {
    private static final Version UPGRADE_FROM_VERSION =
        Version.fromString(System.getProperty("tests.upgrade_from_version"));

    /**
     * This test verifies that as a cluster is upgraded incrementally, new documents eventually switch
     * over to the "new" form of ID (128 bit Murmur3 ids).
     *
     * Rollup IDs are essentially the hashed concatenation of keys returned by the composite aggregation,
     * so the field values that are being indexed (timestamp, value, etc) directly affect the
     * ID that is generated.
     *
     * We don't know which node will get the Rollup task to start, so we don't know when it will migrate.
     * The first doc is guaranteed to be the "old" style since all nodes are un-upgraded.  The second
     * and third phase will have a mixed cluster, and the rollup task may or may not migrate.  In those
     * phases we have two options (old and new) for the document added in the phase.
     *
     * The last phase is guaranteed to be new as it's a fully upgraded cluster.
     */
    public void testIDsUpgradeCorrectly() throws Exception {
        assumeTrue("Rollup became available in 6.3", UPGRADE_FROM_VERSION.onOrAfter(Version.V_6_3_0));
        assumeTrue("Rollup ID change happened in 6.4", UPGRADE_FROM_VERSION.before(Version.V_6_4_0));
        switch (CLUSTER_TYPE) {
            case OLD:
                break;
            case MIXED:
                Request waitForYellow = new Request("GET", "/_cluster/health");
                waitForYellow.addParameter("wait_for_nodes", "3");
                waitForYellow.addParameter("wait_for_status", "yellow");
                client().performRequest(waitForYellow);
                break;
            case UPGRADED:
                Request waitForGreen = new Request("GET", "/_cluster/health/target,rollup");
                waitForGreen.addParameter("wait_for_nodes", "3");
                waitForGreen.addParameter("wait_for_status", "green");
                // wait for long enough that we give delayed unassigned shards to stop being delayed
                waitForGreen.addParameter("timeout", "70s");
                waitForGreen.addParameter("level", "shards");
                client().performRequest(waitForGreen);
                break;
            default:
                throw new UnsupportedOperationException("Unknown cluster type [" + CLUSTER_TYPE + "]");
        }

        OffsetDateTime timestamp = Instant.parse("2018-01-01T00:00:01.000Z").atOffset(ZoneOffset.UTC);

        if (CLUSTER_TYPE == ClusterType.OLD) {
            String recoverQuickly = "{\"settings\": {\"index.unassigned.node_left.delayed_timeout\": \"100ms\"}}";

            Request createTargetIndex = new Request("PUT", "/target");
            createTargetIndex.setJsonEntity(recoverQuickly);
            client().performRequest(createTargetIndex);

            final Request indexRequest = new Request("POST", "/target/_doc/1");
            indexRequest.setJsonEntity("{\"timestamp\":\"" + timestamp.toString() + "\",\"value\":123}");
            client().performRequest(indexRequest);

            // create the rollup job
            final Request createRollupJobRequest = new Request("PUT", "/_xpack/rollup/job/rollup-id-test");
            createRollupJobRequest.setJsonEntity("{"
                + "\"index_pattern\":\"target\","
                + "\"rollup_index\":\"rollup\","
                + "\"cron\":\"*/1 * * * * ?\","
                + "\"page_size\":100,"
                + "\"groups\":{"
                + "    \"date_histogram\":{"
                + "        \"field\":\"timestamp\","
                + "        \"interval\":\"5m\""
                + "      },"
                +       "\"histogram\":{"
                + "        \"fields\": [\"value\"],"
                + "        \"interval\":1"
                + "      },"
                +       "\"terms\":{"
                + "        \"fields\": [\"value\"]"
                + "      }"
                + "},"
                + "\"metrics\":["
                + "    {\"field\":\"value\",\"metrics\":[\"min\",\"max\",\"sum\"]}"
                + "]"
                + "}");

            Map<String, Object> createRollupJobResponse = entityAsMap(client().performRequest(createRollupJobRequest));
            assertThat(createRollupJobResponse.get("acknowledged"), equalTo(Boolean.TRUE));

            Request updateSettings = new Request("PUT", "/rollup/_settings");
            updateSettings.setJsonEntity(recoverQuickly);
            client().performRequest(updateSettings);

            // start the rollup job
            final Request startRollupJobRequest = new Request("POST", "_xpack/rollup/job/rollup-id-test/_start");
            Map<String, Object> startRollupJobResponse = entityAsMap(client().performRequest(startRollupJobRequest));
            assertThat(startRollupJobResponse.get("started"), equalTo(Boolean.TRUE));

            assertRollUpJob("rollup-id-test");
            List<String> ids = getSearchResults(1);
            assertThat(ids, containsInAnyOrder("3310683722"));

        }

        if (CLUSTER_TYPE == ClusterType.MIXED && Booleans.parseBoolean(System.getProperty("tests.first_round"))) {
            final Request indexRequest = new Request("POST", "/target/_doc/2");
            indexRequest.setJsonEntity("{\"timestamp\":\"" + timestamp.plusDays(1).toString() + "\",\"value\":345}");
            client().performRequest(indexRequest);

            assertRollUpJob("rollup-id-test");
            client().performRequest(new Request("POST", "rollup/_refresh"));

            List<String> ids = getSearchResults(2);
            // first doc, guaranteed old style
            ids.remove("3310683722");

            // next doc may be either style
            ids.removeAll(Arrays.asList("621059582", "rollup-id-test$ehY4NAyVSy8xxUDZrNXXIA"));
            assertThat(ids.toString(),ids.size(), equalTo(0));
        }

        if (CLUSTER_TYPE == ClusterType.MIXED && Booleans.parseBoolean(System.getProperty("tests.first_round")) == false) {
            final Request indexRequest = new Request("POST", "/target/_doc/3");
            indexRequest.setJsonEntity("{\"timestamp\":\"" + timestamp.plusDays(2).toString() + "\",\"value\":456}");
            client().performRequest(indexRequest);

            assertRollUpJob("rollup-id-test");
            client().performRequest(new Request("POST", "rollup/_refresh"));

            List<String> ids = getSearchResults(3);

            // first doc, guaranteed old style
            ids.remove("3310683722");

            // next two docs may be either style
            ids.removeAll(Arrays.asList("621059582", "4288019978",
                "rollup-id-test$ehY4NAyVSy8xxUDZrNXXIA", "rollup-id-test$60RGDSb92YI5LH4_Fnq_1g"));
            assertThat(ids.toString(), ids.size(), equalTo(0));

        }

        if (CLUSTER_TYPE == ClusterType.UPGRADED) {
            final Request indexRequest = new Request("POST", "/target/_doc/4");
            indexRequest.setJsonEntity("{\"timestamp\":\"" + timestamp.plusDays(3).toString() + "\",\"value\":567}");
            client().performRequest(indexRequest);

            assertRollUpJob("rollup-id-test");
            client().performRequest(new Request("POST", "rollup/_refresh"));

            List<String> ids = getSearchResults(4);
            // first doc, guaranteed old style
            ids.remove("3310683722");

            // next two docs may be either style
            ids.removeAll(Arrays.asList("621059582", "4288019978",
                "rollup-id-test$ehY4NAyVSy8xxUDZrNXXIA", "rollup-id-test$60RGDSb92YI5LH4_Fnq_1g"));

            // Last is guaranteed to be new
            ids.remove("rollup-id-test$LAKZftDeQwsUtdPixrkkzQ");
            assertThat(ids.toString(), ids.size(), equalTo(0));
        }

    }

    private List<String> getSearchResults(int expectedCount) throws Exception {
        final List<String> collectedIDs = new ArrayList<>();
        assertBusy(() -> {
            collectedIDs.clear();
            client().performRequest(new Request("POST", "rollup/_refresh"));
            final Request searchRequest = new Request("GET", "rollup/_search");
            try {
                Map<String, Object> searchResponse = entityAsMap(client().performRequest(searchRequest));
                assertNotNull(ObjectPath.eval("hits.total", searchResponse));
                assertThat(ObjectPath.eval("hits.total", searchResponse), equalTo(expectedCount));

                for (int i = 0; i < expectedCount; i++) {
                    String id = ObjectPath.eval("hits.hits." + i + "._id", searchResponse);
                    collectedIDs.add(id);
                    Map<String, Object> doc = ObjectPath.eval("hits.hits." + i + "._source", searchResponse);
                    assertNotNull(doc);
                    if (id.startsWith("rollup-id-test")) {
                        assertThat(doc.get("_rollup.version"), equalTo(2));
                    } else {
                        assertThat(doc.get("_rollup.version"), equalTo(1));
                    }
                }
            } catch (IOException e) {
                fail();
            }
        });
        return collectedIDs;
    }

    @SuppressWarnings("unchecked")
    private void assertRollUpJob(final String rollupJob) throws Exception {
        final Matcher<?> expectedStates = anyOf(equalTo("indexing"), equalTo("started"));
        waitForRollUpJob(rollupJob, expectedStates);

        // check that the rollup job is started using the RollUp API
        final Request getRollupJobRequest = new Request("GET", "_xpack/rollup/job/" + rollupJob);
        Map<String, Object> getRollupJobResponse = entityAsMap(client().performRequest(getRollupJobRequest));
        Map<String, Object> job = getJob(getRollupJobResponse, rollupJob);
        if (job != null) {
            assertThat(ObjectPath.eval("status.job_state", job), expectedStates);
        }

        // check that the rollup job is started using the Tasks API
        final Request taskRequest = new Request("GET", "_tasks");
        taskRequest.addParameter("detailed", "true");
        taskRequest.addParameter("actions", "xpack/rollup/*");
        Map<String, Object> taskResponse = entityAsMap(client().performRequest(taskRequest));
        Map<String, Object> taskResponseNodes = (Map<String, Object>) taskResponse.get("nodes");
        Map<String, Object> taskResponseNode = (Map<String, Object>) taskResponseNodes.values().iterator().next();
        Map<String, Object> taskResponseTasks = (Map<String, Object>) taskResponseNode.get("tasks");
        Map<String, Object> taskResponseStatus = (Map<String, Object>) taskResponseTasks.values().iterator().next();
        assertThat(ObjectPath.eval("status.job_state", taskResponseStatus), expectedStates);

        // check that the rollup job is started using the Cluster State API
        final Request clusterStateRequest = new Request("GET", "_cluster/state/metadata");
        Map<String, Object> clusterStateResponse = entityAsMap(client().performRequest(clusterStateRequest));
        List<Map<String, Object>> rollupJobTasks = ObjectPath.eval("metadata.persistent_tasks.tasks", clusterStateResponse);

        boolean hasRollupTask = false;
        for (Map<String, Object> task : rollupJobTasks) {
            if (ObjectPath.eval("id", task).equals(rollupJob)) {
                hasRollupTask = true;
                break;
            }
        }
        if (hasRollupTask == false) {
            fail("Expected persistent task for [" + rollupJob + "] but none found.");
        }

    }

    private void waitForRollUpJob(final String rollupJob, final Matcher<?> expectedStates) throws Exception {
        assertBusy(() -> {
            final Request getRollupJobRequest = new Request("GET", "_xpack/rollup/job/" + rollupJob);
            Response getRollupJobResponse = client().performRequest(getRollupJobRequest);
            assertThat(getRollupJobResponse.getStatusLine().getStatusCode(), equalTo(RestStatus.OK.getStatus()));

            Map<String, Object> job = getJob(getRollupJobResponse, rollupJob);
            if (job != null) {
                assertThat(ObjectPath.eval("status.job_state", job), expectedStates);
            }
        }, 30L, TimeUnit.SECONDS);
    }

    private static Map<String, Object> getJob(Response response, String targetJobId) throws IOException {
        return getJob(ESRestTestCase.entityAsMap(response), targetJobId);
    }

    @SuppressWarnings("unchecked")
    private static Map<String, Object> getJob(Map<String, Object> jobsMap, String targetJobId) throws IOException {

        List<Map<String, Object>> jobs =
            (List<Map<String, Object>>) XContentMapValues.extractValue("jobs", jobsMap);

        if (jobs == null) {
            return null;
        }

        for (Map<String, Object> job : jobs) {
            String jobId = (String) ((Map<String, Object>) job.get("config")).get("id");
            if (jobId.equals(targetJobId)) {
                return job;
            }
        }
        return null;
    }
}


text: export { SkipLink } from './SkipLink';


text:
package com.jsh.erp.datasource.mappers;

import com.jsh.erp.datasource.entities.MaterialAttribute;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MaterialAttributeMapperEx {

    List<MaterialAttribute> selectByConditionMaterialAttribute(
            @Param("attributeField") String attributeField,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows);

    Long countsByMaterialAttribute(
            @Param("attributeField") String attributeField);

    int batchDeleteMaterialAttributeByIds(
            @Param("ids") String ids[]);
}


text:
'use strict';

var wrapComponent = require('./base/util').wrapComponent;
var Cmp = require('react-ui-component').Item;

module.exports = {
    Item: wrapComponent(Cmp)
};


text:
#import "MXUsersDevicesMap.h"

@implementation MXUsersDevicesMap

- (instancetype)init
{
    self = [super init];
    if (self)
    {
        _map = [NSDictionary dictionary];
    }

    return self;
}

- (instancetype)initWithMap:(NSDictionary *)map
{
    self = [super init];
    if (self)
    {
        _map = map;
    }

    return self;
}

- (NSUInteger)count
{
    NSUInteger count = 0;

    for (NSString *userId in _map)
    {
        count += _map[userId].count;
    }

    return count;
}

- (NSArray<NSString *> *)userIds
{
    return _map.allKeys;
}

- (NSArray<NSString *> *)deviceIdsForUser:(NSString *)userId
{
    return _map[userId].allKeys;
}

-(id)objectForDevice:(NSString *)deviceId forUser:(NSString *)userId
{
    return _map[userId][deviceId];
}

- (NSArray<id>*)objectsForUser:(NSString*)userId
{
    return _map[userId].allValues;
}

- (NSArray<id>*)allObjects
{
    NSMutableArray *objects = [NSMutableArray array];

    for (NSString *userId in _map)
    {
        [objects addObjectsFromArray:_map[userId].allValues];
    }

    return objects;
}

- (void)setObject:(id)object forUser:(NSString *)userId andDevice:(NSString *)deviceId
{
    NSMutableDictionary *mutableMap = [NSMutableDictionary dictionaryWithDictionary:self.map];

    mutableMap[userId] = [NSMutableDictionary dictionaryWithDictionary:mutableMap[userId]];
    mutableMap[userId][deviceId] = object;

    _map = mutableMap;
}

-(void)setObjects:(NSDictionary *)objectsPerDevices forUser:(NSString *)userId
{
    NSMutableDictionary *mutableMap = [NSMutableDictionary dictionaryWithDictionary:_map];
    mutableMap[userId] = objectsPerDevices;

    _map = mutableMap;
}

- (void)addEntriesFromMap:(MXUsersDevicesMap*)map
{
    NSMutableDictionary *mutableMap = [NSMutableDictionary dictionaryWithDictionary:_map];
    [mutableMap addEntriesFromDictionary:map.map];

    _map = mutableMap;
}

- (void)removeAllObjects
{
    _map = @{};
}

- (void)removeObjectsForUser:(NSString *)userId
{
    NSMutableDictionary *mutableMap = [NSMutableDictionary dictionaryWithDictionary:_map];
    [mutableMap removeObjectForKey:userId];

    _map = mutableMap;
}

- (void)removeObjectForUser:(NSString *)userId andDevice:(NSString *)deviceId
{
    NSMutableDictionary *mutableMap = [NSMutableDictionary dictionaryWithDictionary:self.map];

    mutableMap[userId] = [NSMutableDictionary dictionaryWithDictionary:mutableMap[userId]];
    [mutableMap[userId] removeObjectForKey:deviceId];

    _map = mutableMap;
}

- (NSString *)description
{
    return _map.description;
}

#pragma mark - NSCoding
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self)
    {
        _map = [aDecoder decodeObjectForKey:@"map"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_map forKey:@"map"];
}

#pragma mark - NSCopying
- (id)copyWithZone:(NSZone *)zone
{
    MXUsersDevicesMap *usersDevicesMapCopy = [[MXUsersDevicesMap allocWithZone:zone] init];

    for (NSString *userId in _map)
    {
        for (NSString *deviceId in _map[userId])
        {
            id objectCopy = [_map[userId][deviceId] copy];
            [usersDevicesMapCopy setObject:objectCopy forUser:userId andDevice:deviceId];
        }
    }

    return usersDevicesMapCopy;
}

@end


text:
package common.tx.bridge;

import javax.xml.ws.wsaddressing.W3CEndpointReference;
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;

import org.aries.tx.TransactionContext;
import org.aries.tx.TransactionContextFactory;
import org.aries.tx.TransactionContextImpl;
import org.aries.tx.recovery.participant.XTSATRecoveryManager;
import org.aries.tx.service.coordinator.ATCoordinator;
import org.aries.tx.service.subordinate.SubordinateATCoordinator;

import tx.manager.registry.ServiceRegistry;

import com.arjuna.ats.arjuna.coordinator.ActionStatus;
import common.tx.CoordinationConstants;
import common.tx.InstanceIdentifier;
import common.tx.exception.NoActivityException;
import common.tx.exception.SystemException;
import common.tx.exception.UnknownTransactionException;
import common.tx.model.context.CoordinationContext;

/**
 * An API class for use by the JTA ==> AT bridge manager providing a wrapper around a subordinate transaction.
 * Static methods are provided to create and register a WS-AT subordinate transaction or to locate a recovered
 * transaction. The returned wrapper allows a client to drive the coordinator through prepare, (phase 2) commit
 * and/or rollback, to access the transaction id under which the coordinator is registered and, if the transaction
 * has not been recovered, to obtain a resumable tx context for the transaction.
 *
 * n.b. this class only supports bridging to WS-AT 1.1 transactions.
 */
public class BridgeWrapper {

	/**
	 * cached reference to the WS-AT 1.1. context factory - we only support bridging to WS-AT 1.1 subordinate
	 * transactions
	 */
//	private static ContextFactoryImple contextFactory = (ContextFactoryImple)
//	ContextFactoryMapper.getMapper().getContextFactory(CoordinationConstants.WSAT_PROTOCOL);

	private final static BridgeWrapper[] EMPTY_SCAN = new BridgeWrapper[0];

	/**
	 * the standard type string used to identify AT AT subordinate transactions. bridge clients
	 * must ensure that they do not employ this type for their subordinates.
	 */

	public static final String SUBORDINATE_TX_TYPE_AT_AT = SubordinateATCoordinator.SUBORDINATE_TX_TYPE_AT_AT;

	/**
	 * create an AT 1.1 subordinate transaction, associate it with the AT 1.1. registry then return a
	 * BridgedTransaction wrapper allowing the transaction to be driven through prepare, commit
	 * and/or rollback and providing access to the transaction id and a context which can be used to
	 * resume the transaction.
	 * @param subordinateType a unique string which groups subordinates for the benefit of their parent
	 * tx/app and allows them to be identified and retrieved as a group during recovery. this must differ
	 * from the string {@link SUBORDINATE_TX_TYPE_AT_AT}
	 * @param expires the timeout for the bridged-to transaction or 0 if no timeout is required
	 * @param isSecure true if AT 1.1. protocol messages for the bridged-to transaction should employ
	 * secure communications, otherwise false
	 * @return a wrapper for the bridged-to transaction
	 * @throws SystemException
	 */
	public static BridgeWrapper create(String subordinateType, long expires, boolean isSecure) {
		// the AT 1.1 context factory provides us with a means to create the required data.

		BridgeTxData bridgeTxData = createBridgedTransaction(subordinateType, expires, isSecure);
		if (bridgeTxData != null) {
			BridgeWrapper bridgeWrapper = new BridgeWrapper();
			bridgeWrapper.context = new TransactionContextImpl(bridgeTxData.context);
			bridgeWrapper.coordinator = bridgeTxData.coordinator;
			bridgeWrapper.id = bridgeTxData.identifier;
			bridgeWrapper.subordinateType = subordinateType;
			return bridgeWrapper;
		} else {
			return null;
		}
	}

	/**
	 * class used to return data required to manage a bridged to subordinate transaction
	 */
	public static class BridgeTxData {
		public CoordinationContext context;
		public SubordinateATCoordinator coordinator;
		public String identifier;
	}

	/**
	 * create a bridged to subordinate WS-AT 1.1 transaction, associate it with the registrar and create and return
	 * a coordination context for it. n.b. this is a private, behind-the-scenes method for use by the JTA-AT
	 * transaction bridge code.
	 * @param subordinateType a unique string which groups subordinates for the benefit of their parent tx/app and
	 * allows them to be identified and retrieved as a group during recovery
	 * @param expires the timeout for the bridged to AT transaction
	 * @param isSecure true if the registration cooridnator URL should use a secure address, otherwise false.
	 * @return a coordination context for the bridged to transaction
	 */
	public static BridgeTxData createBridgedTransaction (String subordinateType, Long expires, boolean isSecure) {
		// we must have a type and it must not be the AT-AT subordinate type
		if (subordinateType == null || SubordinateATCoordinator.SUBORDINATE_TX_TYPE_AT_AT.equals(subordinateType)) {
			return null;
		}
		// we need to create a subordinate transaction and register it as both a durable and volatile
		// participant with the registration service defined in the current context

		SubordinateATCoordinator subTransaction = null;
		try {
			subTransaction = (SubordinateATCoordinator) createSubordinate(subordinateType);
		} catch (NoActivityException e) {
			// will not happen
			return null;
		} catch (SystemException e) {
			// may happen
			return null;
		}

		// ok now create the context

		ServiceRegistry serviceRegistry = ServiceRegistry.getInstance();
		String registrationCoordinatorURI = serviceRegistry.getServiceURI(CoordinationConstants.REGISTRATION_SERVICE_NAME);

		String transactionId = subTransaction.get_uid().stringForm();
		CoordinationContext coordinationContext = TransactionContextFactory.createCoordinationContext(transactionId, expires);

		W3CEndpointReference registrationCoordinator = getRegistrationCoordinator(registrationCoordinatorURI, transactionId);
		coordinationContext.setRegistrationService(registrationCoordinator);

		// now associate the tx id with the sub transaction

//		try {
//			registrar.associate(subTransaction);
//		} catch (Exception e) {
//			// will not happen
//		}

		BridgeTxData bridgeTxData = new BridgeTxData();
		bridgeTxData.context = coordinationContext;
		bridgeTxData.coordinator = subTransaction;
		bridgeTxData.identifier = transactionId;
		return bridgeTxData;
	}

	private static W3CEndpointReference getRegistrationCoordinator(String registrationCoordinatorURI, String identifier) {
		W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
		builder.serviceName(CoordinationConstants.REGISTRATION_SERVICE_QNAME);
		builder.endpointName(CoordinationConstants.REGISTRATION_ENDPOINT_QNAME);
		// strictly we shouldn't need to set the address because we are in the same web app as the
		// coordinator but we have to as the W3CEndpointReference implementation is incomplete
		builder.address(registrationCoordinatorURI);
		InstanceIdentifier.setEndpointInstanceIdentifier(builder, identifier);
		W3CEndpointReference registrationCoordinator = builder.build();
		return registrationCoordinator;
	}

	public static Object createSubordinate() throws NoActivityException, SystemException {
		return createSubordinate(SubordinateATCoordinator.SUBORDINATE_TX_TYPE_AT_AT);
	}

	public static ATCoordinator createSubordinate(String subordinateType) throws NoActivityException, SystemException {
		try {
			ATCoordinator subordinateCoordinator = createSubordinateCoordinator(subordinateType);
			//subordinateCoordinator.enlistSynchronization(new CleanupSynchronization(subordinateCoordinator.get_uid().stringForm(), registrar));
			//registrar.associate(subordinateCoordinator);
			return subordinateCoordinator;
		} catch (Exception e) {
			throw new SystemException(e.getMessage());
		}
	}

	public static ATCoordinator createSubordinateCoordinator(String subordinateType) throws SystemException {
		try {
			SubordinateATCoordinator coord = new SubordinateATCoordinator(subordinateType);
			int status = coord.start(null);
			if (status != ActionStatus.RUNNING)
				throw new SystemException("Unexpected status: "+ActionStatus.stringForm(status));
			return coord;
		} catch (SystemException e) {
			throw e;
		} catch (Exception e) {
			throw new SystemException(e.getMessage());
		}
	}

	/**
	 * recreate a wrapper for a bridged-to WS-AT 1.1 transaction recovered from the log
	 * @param identifier the identifier of a previously created bridged-to transaction
	 * @return a wrapper for the bridged-to transaction or null if it may still be awaiting recovery
	 * @throws UnknownTransactionException if recovery has been performed and no transaction with the
	 * given identifier has been found in the log
	 */
	public static BridgeWrapper recover(String identifier) throws UnknownTransactionException {
		SubordinateATCoordinator coordinator = SubordinateATCoordinator.getRecoveredCoordinator(identifier);
		if (coordinator != null) {
			BridgeWrapper bridgeWrapper = new BridgeWrapper();
			bridgeWrapper.context = null;
			bridgeWrapper.coordinator =coordinator;
			bridgeWrapper.id = identifier;
			bridgeWrapper.subordinateType = coordinator.getSubordinateType();
			return bridgeWrapper;
		} else {
			XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
			if (recoveryManager != null && recoveryManager.isCoordinatorRecoveryStarted())
				throw new UnknownTransactionException();
			return null;
		}
	}

	/**
	 * return a list of bridge wrappers for all recovered subordinate transactions with a given
	 * subordinate type
	 * @param subordinateType the subordinate type supplied in the original bridge wrapper create call
	 * which created the subordinate transaction.
	 * @return a possibly zero-length array of bridge wrappers for all recovered subordinate AT transactions
	 * with the given subordinate type or null if a subordinate coordinator recovery scan has not yet occurred
	 */
	public static BridgeWrapper[] scan(String subordinateType) {
		// return null if not yet ready

		XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
		if (!recoveryManager.isCoordinatorRecoveryStarted()) {
			return null;
		}

		// refuse to expose the internal AT - AT subordinates

		if (subordinateType == null || subordinateType.equals(SUBORDINATE_TX_TYPE_AT_AT)) {
			return EMPTY_SCAN;
		}

		SubordinateATCoordinator[] coordinators = SubordinateATCoordinator.listRecoveredCoordinators();
		int count = 0;

		for (int i = 0; i < coordinators.length; i++) {
			if (coordinators[i].getSubordinateType().equals(subordinateType)) {
				count++;
			}
		}

		if (count == 0) {
			return EMPTY_SCAN;
		}

		BridgeWrapper[] result = new BridgeWrapper[count];
		count = 0;

		for (int i = 0; i < coordinators.length; i++) {
			SubordinateATCoordinator coordinator = coordinators[i];
			if (coordinator.getSubordinateType().equals(subordinateType)) {
				BridgeWrapper bridgeWrapper = new BridgeWrapper();
				bridgeWrapper.context = null;
				bridgeWrapper.coordinator = coordinator;
				bridgeWrapper.id = coordinator.get_uid().stringForm();
				bridgeWrapper.subordinateType = coordinator.getSubordinateType();
				result[count++] = bridgeWrapper;
			}
		}

		return result;
	}

	private SubordinateATCoordinator coordinator;

	private TransactionContext context;

	private String id;

	private String subordinateType;

	/**
	 * this class handles all creation of bridged transactions
	 */
	private BridgeWrapper() {
	}

	/**
	 * obtain the identifier for the bridged-to transaction
	 * @return the identifier for the bridged-to transaction
	 */
	public String getIdentifier() {
		return id;
	}

	/**
	 * obtain a resumable transaction context for the bridged-to transaction
	 * @return a resumable transaction context
	 * @throws UnknownTransactionException if this transaction has been recovered from the log and hence
	 * has no associated transaction context.
	 */
	public TransactionContext getContext() throws UnknownTransactionException {
		if (context == null)
			throw new UnknownTransactionException();
		return context;
	}

	/**
	 * obtain the subordinate type for the bridged-to transaction
	 * @return the subordinate type for the bridged-to transaction
	 */
	public String getSubordinateType() {
		return subordinateType;
	}

	/**
	 * initiate synchronization beforeCompletion processing for the bridged-to transaction
	 * @return true if the beforeCompletion succeeds otherwise false.
	 */
	public boolean prepareVolatile() {
		return coordinator.prepareVolatile();
	}

	/**
	 * prepare the bridged-to transaction
	 * @return the result of preparing the transaction
	 */
	public int prepare() {
		return coordinator.prepare();
	}

	/**
	 * initiate synchronization afterCompletion processing for the bridged-to transaction following a
	 * successful commit
	 */
	public void commitVolatile() {
		coordinator.commitVolatile();
	}

	/**
	 * perform a phase 2 commit for the bridged-to transaction
	 */
	public void commit() {
		coordinator.commit();
	}

	/**
	 * initiate synchronization afterCompletion processing for the bridged-to transaction following a
	 * rollback
	 */
	public void rollbackVolatile() {
		coordinator.rollbackVolatile();
	}

	/**
	 * rollback the bridged-to transaction
	 */
	public void rollback() {
		coordinator.rollback();
	}

}


text:
<!DOCTYPE html>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1"/>

  <title>Colegas</title>
  <meta name="author" content="" />
  <meta name="description"
        content="Vocês percebem o potencial dramático e narrativo de um filme que usa atores com Síndrome de Down para interpretar personagens com Síndrome de Down? Percebem? Porque talvez os idealizadores de Colegas..."/>

  <meta name="yandex-verification" content="48a8210fc043c5e8" />

  <meta name="generator" content="Hugo 0.54.0" />

  <meta itemprop="name" content="Colegas"/>
  <meta itemprop="description"
        content="Vocês percebem o potencial dramático e narrativo de um filme que usa atores com Síndrome de Down para interpretar personagens com Síndrome de Down? Percebem? Porque talvez os idealizadores de Colegas..."/>
  <meta itemprop="image"
        content="/img/logo.svg"/>

  <meta property="og:title" content="Colegas"/>
  <meta property="og:type"
        content="article"/>
  <meta property="og:url" content="http://www.cinetenisverde.com.br/colegas/"/>
  <meta property="og:image"
        content="/img/logo.svg"/>
  <meta property="og:description"
        content="Vocês percebem o potencial dramático e narrativo de um filme que usa atores com Síndrome de Down para interpretar personagens com Síndrome de Down? Percebem? Porque talvez os idealizadores de Colegas..."/>
  <meta property="og:site_name" content="Cine Tênis Verde"/>
  <meta property="article:published_time"
        content="2016-07-28T00:00:00+00:00"/>
  <meta property="article:section" content="post"/>

  <meta name="twitter:card" content="summary"/>
  <meta name="twitter:site"
        content=""/>
  <meta name="twitter:title" content="Colegas"/>
  <meta name="twitter:description"
        content="Vocês percebem o potencial dramático e narrativo de um filme que usa atores com Síndrome de Down para interpretar personagens com Síndrome de Down? Percebem? Porque talvez os idealizadores de Colegas..."/>
  <meta name="twitter:creator"
        content=""/>
  <meta name="twitter:image:src"
        content="/img/logo.svg"/>

  <link rel="stylesheet" type="text/css" href="/css/capsule.min.css"/>
  <link rel="stylesheet" type="text/css" href="/css/custom.css"/>

  <link rel="apple-touch-icon" href="/img/apple-touch-icon.png"/>
  <link rel="icon" href="/img/favicon.ico"/>

 Cine Tênis Verde

    <input type="checkbox" id="navbar-burger-state"/>

      search

      twitter

      rss

Colegas

    ★☆☆☆☆

 Wanderley Caloni, July 28, 2016

Vocês percebem o potencial dramático e narrativo de um filme que usa atores com Síndrome de Down para interpretar personagens com Síndrome de Down? Percebem? Porque talvez os idealizadores de Colegas não tenham tido essa mesma visão. Aliás, o lado comercial da empreitada pode ser a principal responsável por um amontoado de caos envolvido em uma história menos que clichê: simplesmente sem sentido.

Porém, seria interessante se a parte sem sentido estivesse do lado de Stalone (Ariel Goldenberg), Aninha (Rita Pokk) e Márcio (Breno Viola), os heróis da história, que fogem da clínica onde vivem para realizar seus sonhos. Afinal de contas, é deles o direito do caos, das emoções descontroladas, da vivência como não costumamos ver no Cinema.

No entanto, o caos está mais pro lado de Arlindo (Lima Duarte), o narrador onisciente chatíssimo que narra tudo que estamos vendo na tela. Além dele, uma dupla de policiais vindo direto do Zorra Total, que costuma apontar a arma para testemunhas. Acima deles, um suposto “inspetor jovem demais para o cargo” que faz inveja aos papéis completamente sem graça de Marcos Veras. Em torno deles, repórteres de telejornais tão caseiros que nem o jornal do bairro teria coragem de produzir. Para finalizar, figurantes de todos os tipos, cores, gêneros, convivendo por alguns minutos com essas pequenas criaturas e assumindo que são extremamente perigosas porque sim.

Se há algo de idílico em Colegas, isso ficou na sala de edição. O que temos é o uso de momentos, frases e situações em filmes clássicos do cinema sendo enfiados de qualquer jeito em um filme sem pé nem cabeça. Temos também um ônibus cujo itinerário passa por uma praia deserta (no meio da areia) e temos atores que acenam para a câmera, em um claro exemplo não do amadorismo desses atores, mas do uso errado da emoção pelos idealizadores do longa, que nos lançam para fora do filme sempre que uma piada sem sentido/referência/acenos para a câmera é inserido no filme.

E tudo isso torna Colegas excessivamente longo, completamente esquecível e absurdamente desnecessário. Torna também a ideia de usar atores com Síndrome de Down não tão atraente para outros trabalhos. O que ele provou é que é possível. Porém, o preço a ser pago, a ver pelo filme, é proibitivo para a arte.

           Imagens e créditos no IMDB.

    ★☆☆☆☆

 Colegas ● Colegas. Colegas (Brazil, 2012). Dirigido por Marcelo Galvão. Escrito por Marcelo Galvão. Com Ariel Goldenberg, Rita Pokk, Breno Viola, Lima Duarte, Marco Luque, Daniel Torres, Monaliza Marchi, Amélia Bittencourt, Giulia Merigo de Souza. ● Nota: 1/5. Categoria: movies.  Publicado em 2016-07-28.  Texto escrito por Wanderley Caloni.

Quer comentar?

      Share


text:
#include "wt_internal.h"

/*
 * __wt_direct_io_size_check --
 *	Return a size from the configuration, complaining if it's insufficient
 * for direct I/O.
 */
int
__wt_direct_io_size_check(WT_SESSION_IMPL *session,
    const char **cfg, const char *config_name, uint32_t *allocsizep)
{
	WT_CONFIG_ITEM cval;
	WT_CONNECTION_IMPL *conn;
	int64_t align;

	*allocsizep = 0;

	conn = S2C(session);

	WT_RET(__wt_config_gets(session, cfg, config_name, &cval));

	/*
	 * This function exists as a place to hang this comment: if direct I/O
	 * is configured, page sizes must be at least as large as any buffer
	 * alignment as well as a multiple of the alignment.  Linux gets unhappy
	 * if you configure direct I/O and then don't do I/O in alignments and
	 * units of its happy place.
	 */
	if (FLD_ISSET(conn->direct_io,
	   WT_FILE_TYPE_CHECKPOINT | WT_FILE_TYPE_DATA)) {
		align = (int64_t)conn->buffer_alignment;
		if (align != 0 && (cval.val < align || cval.val % align != 0))
			WT_RET_MSG(session, EINVAL,
			    "when direct I/O is configured, the %s size must "
			    "be at least as large as the buffer alignment as "
			    "well as a multiple of the buffer alignment",
			    config_name);
	}
	*allocsizep = (uint32_t)cval.val;
	return (0);
}

/*
 * __create_file --
 *	Create a new 'file:' object.
 */
static int
__create_file(WT_SESSION_IMPL *session,
    const char *uri, int exclusive, const char *config)
{
	WT_DECL_ITEM(val);
	WT_DECL_RET;
	uint32_t allocsize;
	int is_metadata;
	const char *filename, **p, *filecfg[] =
	    { WT_CONFIG_BASE(session, file_meta), config, NULL, NULL };
	char *fileconf;

	fileconf = NULL;

	is_metadata = strcmp(uri, WT_METAFILE_URI) == 0;

	filename = uri;
	if (!WT_PREFIX_SKIP(filename, "file:"))
		WT_RET_MSG(session, EINVAL, "Expected a 'file:' URI: %s", uri);

	/* Check if the file already exists. */
	if (!is_metadata && (ret =
	    __wt_metadata_search(session, uri, &fileconf)) != WT_NOTFOUND) {
		if (exclusive)
			WT_TRET(EEXIST);
		goto err;
	}

	/* Sanity check the allocation size. */
	WT_RET(__wt_direct_io_size_check(
	    session, filecfg, "allocation_size", &allocsize));

	/* Create the file. */
	WT_ERR(__wt_block_manager_create(session, filename, allocsize));
	if (WT_META_TRACKING(session))
		WT_ERR(__wt_meta_track_fileop(session, NULL, uri));

	/*
	 * If creating an ordinary file, append the file ID and current version
	 * numbers to the passed-in configuration and insert the resulting
	 * configuration into the metadata.
	 */
	if (!is_metadata) {
		WT_ERR(__wt_scr_alloc(session, 0, &val));
		WT_ERR(__wt_buf_fmt(session, val,
		    "id=%" PRIu32 ",version=(major=%d,minor=%d)",
		    ++S2C(session)->next_file_id,
		    WT_BTREE_MAJOR_VERSION_MAX, WT_BTREE_MINOR_VERSION_MAX));
		for (p = filecfg; *p != NULL; ++p)
			;
		*p = val->data;
		WT_ERR(__wt_config_collapse(session, filecfg, &fileconf));
		WT_ERR(__wt_metadata_insert(session, uri, fileconf));
	}

	/*
	 * Open the file to check that it was setup correctly.   We don't need
	 * to pass the configuration, we just wrote the collapsed configuration
	 * into the metadata file, and it's going to be read/used by underlying
	 * functions.
	 *
	 * Keep the handle exclusive until it is released at the end of the
	 * call, otherwise we could race with a drop.
	 */
	WT_ERR(__wt_session_get_btree(
	    session, uri, NULL, NULL, WT_DHANDLE_EXCLUSIVE));
	if (WT_META_TRACKING(session))
		WT_ERR(__wt_meta_track_handle_lock(session, 1));
	else
		WT_ERR(__wt_session_release_btree(session));

err:	__wt_scr_free(session, &val);
	__wt_free(session, fileconf);
	return (ret);
}

/*
 * __wt_schema_colgroup_source --
 *	Get the URI of the data source for a column group.
 */
int
__wt_schema_colgroup_source(WT_SESSION_IMPL *session,
    WT_TABLE *table, const char *cgname, const char *config, WT_ITEM *buf)
{
	WT_CONFIG_ITEM cval;
	WT_DECL_RET;
	size_t len;
	const char *prefix, *suffix, *tablename;

	tablename = table->name + strlen("table:");
	if ((ret = __wt_config_getones(session, config, "type", &cval)) == 0 &&
	    !WT_STRING_MATCH("file", cval.str, cval.len)) {
		prefix = cval.str;
		len = cval.len;
		suffix = "";
	} else {
		prefix = "file";
		len = strlen(prefix);
		suffix = ".wt";
	}
	WT_RET_NOTFOUND_OK(ret);

	if (cgname == NULL)
		WT_RET(__wt_buf_fmt(session, buf, "%.*s:%s%s",
		    (int)len, prefix, tablename, suffix));
	else
		WT_RET(__wt_buf_fmt(session, buf, "%.*s:%s_%s%s",
		    (int)len, prefix, tablename, cgname, suffix));

	return (0);
}

/*
 * __create_colgroup --
 *	Create a column group.
 */
static int
__create_colgroup(WT_SESSION_IMPL *session,
    const char *name, int exclusive, const char *config)
{
	WT_CONFIG_ITEM cval;
	WT_DECL_RET;
	WT_ITEM confbuf, fmt, namebuf;
	WT_TABLE *table;
	size_t tlen;
	const char **cfgp, *cfg[4] =
	    { WT_CONFIG_BASE(session, colgroup_meta), config, NULL, NULL };
	const char *sourcecfg[] = { config, NULL, NULL };
	const char *cgname, *source, *tablename;
	char *cgconf, *sourceconf, *oldconf;

	cgconf = sourceconf = oldconf = NULL;
	WT_CLEAR(fmt);
	WT_CLEAR(confbuf);
	WT_CLEAR(namebuf);

	tablename = name;
	if (!WT_PREFIX_SKIP(tablename, "colgroup:"))
		return (EINVAL);
	cgname = strchr(tablename, ':');
	if (cgname != NULL) {
		tlen = (size_t)(cgname - tablename);
		++cgname;
	} else
		tlen = strlen(tablename);

	if ((ret =
	    __wt_schema_get_table(session, tablename, tlen, 1, &table)) != 0)
		WT_RET_MSG(session, (ret == WT_NOTFOUND) ? ENOENT : ret,
		    "Can't create '%s' for non-existent table '%.*s'",
		    name, (int)tlen, tablename);

	/* Make sure the column group is referenced from the table. */
	if (cgname != NULL && (ret =
	    __wt_config_subgets(session, &table->cgconf, cgname, &cval)) != 0)
		WT_ERR_MSG(session, EINVAL,
		    "Column group '%s' not found in table '%.*s'",
		    cgname, (int)tlen, tablename);

	/* Find the first NULL entry in the cfg stack. */
	for (cfgp = &cfg[1]; *cfgp; cfgp++)
		;

	/* Add the source to the colgroup config before collapsing. */
	if (__wt_config_getones(
	    session, config, "source", &cval) == 0 && cval.len != 0) {
		WT_ERR(__wt_buf_fmt(
		    session, &namebuf, "%.*s", (int)cval.len, cval.str));
		source = namebuf.data;
	} else {
		WT_ERR(__wt_schema_colgroup_source(
		    session, table, cgname, config, &namebuf));
		source = namebuf.data;
		WT_ERR(__wt_buf_fmt(
		    session, &confbuf, "source=\"%s\"", source));
		*cfgp++ = confbuf.data;
	}

	/* Calculate the key/value formats: these go into the source config. */
	WT_ERR(__wt_buf_fmt(session, &fmt, "key_format=%s", table->key_format));
	if (cgname == NULL)
		WT_ERR(__wt_buf_catfmt
		    (session, &fmt, ",value_format=%s", table->value_format));
	else {
		if (__wt_config_getones(session, config, "columns", &cval) != 0)
			WT_ERR_MSG(session, EINVAL,
			    "No 'columns' configuration for '%s'", name);
		WT_ERR(__wt_buf_catfmt(session, &fmt, ",value_format="));
		WT_ERR(__wt_struct_reformat(session,
		    table, cval.str, cval.len, NULL, 1, &fmt));
	}
	sourcecfg[1] = fmt.data;
	WT_ERR(__wt_config_concat(session, sourcecfg, &sourceconf));

	WT_ERR(__wt_schema_create(session, source, sourceconf));

	WT_ERR(__wt_config_collapse(session, cfg, &cgconf));
	if ((ret = __wt_metadata_insert(session, name, cgconf)) != 0) {
		/*
		 * If the entry already exists in the metadata, we're done.
		 * This is an error for exclusive creates but okay otherwise.
		 */
		if (ret == WT_DUPLICATE_KEY)
			ret = exclusive ? EEXIST : 0;
		goto err;
	}

	WT_ERR(__wt_schema_open_colgroups(session, table));

err:	__wt_free(session, cgconf);
	__wt_free(session, sourceconf);
	__wt_free(session, oldconf);
	__wt_buf_free(session, &confbuf);
	__wt_buf_free(session, &fmt);
	__wt_buf_free(session, &namebuf);

	__wt_schema_release_table(session, table);
	return (ret);
}

/*
 * __wt_schema_index_source --
 *	Get the URI of the data source for an index.
 */
int
__wt_schema_index_source(WT_SESSION_IMPL *session,
    WT_TABLE *table, const char *idxname, const char *config, WT_ITEM *buf)
{
	WT_CONFIG_ITEM cval;
	WT_DECL_RET;
	size_t len;
	const char *prefix, *suffix, *tablename;

	tablename = table->name + strlen("table:");
	if ((ret = __wt_config_getones(session, config, "type", &cval)) == 0 &&
	    !WT_STRING_MATCH("file", cval.str, cval.len)) {
		prefix = cval.str;
		len = cval.len;
		suffix = "_idx";
	} else {
		prefix = "file";
		len = strlen(prefix);
		suffix = ".wti";
	}
	WT_RET_NOTFOUND_OK(ret);

	WT_RET(__wt_buf_fmt(session, buf, "%.*s:%s_%s%s",
	    (int)len, prefix, tablename, idxname, suffix));

	return (0);
}

/*
 * __create_index --
 *	Create an index.
 */
static int
__create_index(WT_SESSION_IMPL *session,
    const char *name, int exclusive, const char *config)
{
	WT_CONFIG kcols, pkcols;
	WT_CONFIG_ITEM ckey, cval, icols, kval;
	WT_DECL_PACK_VALUE(pv);
	WT_DECL_RET;
	WT_ITEM confbuf, extra_cols, fmt, namebuf;
	WT_PACK pack;
	WT_TABLE *table;
	const char *cfg[4] =
	    { WT_CONFIG_BASE(session, index_meta), NULL, NULL, NULL };
	const char *sourcecfg[] = { config, NULL, NULL };
	const char *source, *idxname, *tablename;
	char *sourceconf, *idxconf;
	size_t tlen;
	int have_extractor;
	u_int i, npublic_cols;

	idxconf = sourceconf = NULL;
	WT_CLEAR(confbuf);
	WT_CLEAR(fmt);
	WT_CLEAR(extra_cols);
	WT_CLEAR(namebuf);
	have_extractor = 0;

	tablename = name;
	if (!WT_PREFIX_SKIP(tablename, "index:"))
		return (EINVAL);
	idxname = strchr(tablename, ':');
	if (idxname == NULL)
		WT_RET_MSG(session, EINVAL, "Invalid index name, "
		    "should be <table name>:<index name>: %s", name);

	tlen = (size_t)(idxname++ - tablename);
	if ((ret =
	    __wt_schema_get_table(session, tablename, tlen, 1, &table)) != 0)
		WT_RET_MSG(session, ret,
		    "Can't create an index for a non-existent table: %.*s",
		    (int)tlen, tablename);

	if (table->is_simple)
		WT_RET_MSG(session, EINVAL,
		    "%s requires a table with named columns", name);

	if (__wt_config_getones(session, config, "source", &cval) == 0) {
		WT_ERR(__wt_buf_fmt(session, &namebuf,
		    "%.*s", (int)cval.len, cval.str));
		source = namebuf.data;
	} else {
		WT_ERR(__wt_schema_index_source(
		    session, table, idxname, config, &namebuf));
		source = namebuf.data;

		/* Add the source name to the index config before collapsing. */
		WT_ERR(__wt_buf_catfmt(session, &confbuf,
		    ",source=\"%s\"", source));
	}

	if (__wt_config_getones_none(
	    session, config, "extractor", &cval) == 0 && cval.len != 0) {
		have_extractor = 1;
		/* Custom extractors must supply a key format. */
		if ((ret = __wt_config_getones(
		    session, config, "key_format", &kval)) != 0)
			WT_ERR_MSG(session, EINVAL,
			    "%s: custom extractors require a key_format", name);
	}

	/* Calculate the key/value formats. */
	WT_CLEAR(icols);
	if (__wt_config_getones(session, config, "columns", &icols) != 0 &&
	    !have_extractor)
		WT_ERR_MSG(session, EINVAL,
		    "%s: requires 'columns' configuration", name);

	/*
	 * Count the public columns using the declared columns for normal
	 * indices or the key format for custom extractors.
	 */
	npublic_cols = 0;
	if (!have_extractor) {
		WT_ERR(__wt_config_subinit(session, &kcols, &icols));
		while ((ret = __wt_config_next(&kcols, &ckey, &cval)) == 0)
			++npublic_cols;
		WT_ERR_NOTFOUND_OK(ret);
	} else {
		WT_ERR(__pack_initn(session, &pack, kval.str, kval.len));
		while ((ret = __pack_next(&pack, &pv)) == 0)
			++npublic_cols;
		WT_ERR_NOTFOUND_OK(ret);
	}

	/*
	 * The key format for an index is somewhat subtle: the application
	 * specifies a set of columns that it will use for the key, but the
	 * engine usually adds some hidden columns in order to derive the
	 * primary key.  These hidden columns are part of the source's
	 * key_format, which we are calculating now, but not part of an index
	 * cursor's key_format.
	 */
	WT_ERR(__wt_config_subinit(session, &pkcols, &table->colconf));
	for (i = 0; i < table->nkey_columns &&
	    (ret = __wt_config_next(&pkcols, &ckey, &cval)) == 0;
	    i++) {
		/*
		 * If the primary key column is already in the secondary key,
		 * don't add it again.
		 */
		if (__wt_config_subgetraw(session, &icols, &ckey, &cval) == 0) {
			if (have_extractor)
				WT_ERR_MSG(session, EINVAL,
				    "an index with a custom extractor may not "
				    "include primary key columns");
			continue;
		}
		WT_ERR(__wt_buf_catfmt(
		    session, &extra_cols, "%.*s,", (int)ckey.len, ckey.str));
	}
	if (ret != 0 && ret != WT_NOTFOUND)
		goto err;

	/* Index values are empty: all columns are packed into the index key. */
	WT_ERR(__wt_buf_fmt(session, &fmt, "value_format=,key_format="));

	if (have_extractor) {
		WT_ERR(__wt_buf_catfmt(session, &fmt, "%.*s",
		    (int)kval.len, kval.str));
		WT_CLEAR(icols);
	}

	/*
	 * Construct the index key format, or append the primary key columns
	 * for custom extractors.
	 */
	WT_ERR(__wt_struct_reformat(session, table,
	    icols.str, icols.len, (const char *)extra_cols.data, 0, &fmt));

	/* Check for a record number index key, which makes no sense. */
	WT_ERR(__wt_config_getones(session, fmt.data, "key_format", &cval));
	if (cval.len == 1 && cval.str[0] == 'r')
		WT_ERR_MSG(session, EINVAL,
		    "column-store index may not use the record number as its "
		    "index key");

	WT_ERR(__wt_buf_catfmt(
	    session, &fmt, ",index_key_columns=%u", npublic_cols));

	sourcecfg[1] = fmt.data;
	WT_ERR(__wt_config_concat(session, sourcecfg, &sourceconf));

	WT_ERR(__wt_schema_create(session, source, sourceconf));

	cfg[1] = sourceconf;
	cfg[2] = confbuf.data;
	WT_ERR(__wt_config_collapse(session, cfg, &idxconf));
	if ((ret = __wt_metadata_insert(session, name, idxconf)) != 0) {
		/*
		 * If the entry already exists in the metadata, we're done.
		 * This is an error for exclusive creates but okay otherwise.
		 */
		if (ret == WT_DUPLICATE_KEY)
			ret = exclusive ? EEXIST : 0;
		goto err;
	}

err:	__wt_free(session, idxconf);
	__wt_free(session, sourceconf);
	__wt_buf_free(session, &confbuf);
	__wt_buf_free(session, &extra_cols);
	__wt_buf_free(session, &fmt);
	__wt_buf_free(session, &namebuf);

	__wt_schema_release_table(session, table);
	return (ret);
}

/*
 * __create_table --
 *	Create a table.
 */
static int
__create_table(WT_SESSION_IMPL *session,
    const char *name, int exclusive, const char *config)
{
	WT_CONFIG conf;
	WT_CONFIG_ITEM cgkey, cgval, cval;
	WT_DECL_RET;
	WT_TABLE *table;
	const char *cfg[4] =
	    { WT_CONFIG_BASE(session, table_meta), config, NULL, NULL };
	const char *tablename;
	char *tableconf, *cgname;
	size_t cgsize;
	int ncolgroups;

	cgname = NULL;
	table = NULL;
	tableconf = NULL;

	tablename = name;
	if (!WT_PREFIX_SKIP(tablename, "table:"))
		return (EINVAL);

	if ((ret = __wt_schema_get_table(session,
	    tablename, strlen(tablename), 0, &table)) == 0) {
		__wt_schema_release_table(session, table);
		return (exclusive ? EEXIST : 0);
	}
	WT_RET_NOTFOUND_OK(ret);

	WT_ERR(__wt_config_gets(session, cfg, "colgroups", &cval));
	WT_ERR(__wt_config_subinit(session, &conf, &cval));
	for (ncolgroups = 0;
	    (ret = __wt_config_next(&conf, &cgkey, &cgval)) == 0;
	    ncolgroups++)
		;
	WT_ERR_NOTFOUND_OK(ret);

	WT_ERR(__wt_config_collapse(session, cfg, &tableconf));
	if ((ret = __wt_metadata_insert(session, name, tableconf)) != 0) {
		/*
		 * If the entry already exists in the metadata, we're done.
		 * This is an error for exclusive creates but okay otherwise.
		 */
		if (ret == WT_DUPLICATE_KEY)
			ret = exclusive ? EEXIST : 0;
		goto err;
	}

	/* Attempt to open the table now to catch any errors. */
	WT_ERR(__wt_schema_get_table(
	    session, tablename, strlen(tablename), 1, &table));

	if (ncolgroups == 0) {
		cgsize = strlen("colgroup:") + strlen(tablename) + 1;
		WT_ERR(__wt_calloc_def(session, cgsize, &cgname));
		snprintf(cgname, cgsize, "colgroup:%s", tablename);
		WT_ERR(__create_colgroup(session, cgname, exclusive, config));
	}

	if (0) {
err:		if (table != NULL) {
			WT_TRET(__wt_schema_remove_table(session, table));
			table = NULL;
		}
	}
	if (table != NULL)
		__wt_schema_release_table(session, table);
	__wt_free(session, cgname);
	__wt_free(session, tableconf);
	return (ret);
}

/*
 * __create_data_source --
 *	Create a custom data source.
 */
static int
__create_data_source(WT_SESSION_IMPL *session,
    const char *uri, const char *config, WT_DATA_SOURCE *dsrc)
{
	WT_CONFIG_ITEM cval;
	const char *cfg[] = {
	    WT_CONFIG_BASE(session, session_create), config, NULL };

	/*
	 * Check to be sure the key/value formats are legal: the underlying
	 * data source doesn't have access to the functions that check.
	 */
	WT_RET(__wt_config_gets(session, cfg, "key_format", &cval));
	WT_RET(__wt_struct_check(session, cval.str, cval.len, NULL, NULL));
	WT_RET(__wt_config_gets(session, cfg, "value_format", &cval));
	WT_RET(__wt_struct_check(session, cval.str, cval.len, NULL, NULL));

	/*
	 * User-specified collators aren't supported for data-source objects.
	 */
	if (__wt_config_getones_none(
	    session, config, "collator", &cval) != WT_NOTFOUND && cval.len != 0)
		WT_RET_MSG(session, EINVAL,
		    "WT_DATA_SOURCE objects do not support WT_COLLATOR "
		    "ordering");

	return (dsrc->create(dsrc, &session->iface, uri, (WT_CONFIG_ARG *)cfg));
}

/*
 * __wt_schema_create --
 *	Process a WT_SESSION::create operation for all supported types.
 */
int
__wt_schema_create(
    WT_SESSION_IMPL *session, const char *uri, const char *config)
{
	WT_CONFIG_ITEM cval;
	WT_DATA_SOURCE *dsrc;
	WT_DECL_RET;
	int exclusive;

	exclusive = (
	    __wt_config_getones(session, config, "exclusive", &cval) == 0 &&
	    cval.val != 0);

	/*
	 * We track create operations: if we fail in the middle of creating a
	 * complex object, we want to back it all out.
	 */
	WT_RET(__wt_meta_track_on(session));

	if (WT_PREFIX_MATCH(uri, "colgroup:"))
		ret = __create_colgroup(session, uri, exclusive, config);
	else if (WT_PREFIX_MATCH(uri, "file:"))
		ret = __create_file(session, uri, exclusive, config);
	else if (WT_PREFIX_MATCH(uri, "lsm:"))
		ret = __wt_lsm_tree_create(session, uri, exclusive, config);
	else if (WT_PREFIX_MATCH(uri, "index:"))
		ret = __create_index(session, uri, exclusive, config);
	else if (WT_PREFIX_MATCH(uri, "table:"))
		ret = __create_table(session, uri, exclusive, config);
	else if ((dsrc = __wt_schema_get_source(session, uri)) != NULL)
		ret = dsrc->create == NULL ?
		    __wt_object_unsupported(session, uri) :
		    __create_data_source(session, uri, config, dsrc);
	else
		ret = __wt_bad_object_type(session, uri);

	session->dhandle = NULL;
	WT_TRET(__wt_meta_track_off(session, ret != 0));

	return (ret);
}


text:
namespace fast {

ImageMultiply::ImageMultiply() {
    createInputPort(0);
    createInputPort(1);
    createOutputPort(0);
    createOpenCLProgram(Config::getKernelSourcePath() + "Algorithms/ImageMultiply/ImageMultiply.cl");
}

void ImageMultiply::execute() {
    auto input1 = getInputData<Image>(0);
    auto input2 = getInputData<Image>(1);

    if(input1->getSize() != input2->getSize())
        throw Exception("Size of both input images to ImageMultiply must be equal");

    auto output = Image::createFromImage(input1);
    SceneGraph::setParentNode(output, input1);
    Vector3ui size = input1->getSize();

    OpenCLDevice::pointer device = std::dynamic_pointer_cast<OpenCLDevice>(getMainDevice());
    cl::CommandQueue queue = device->getCommandQueue();

    std::string buildOptions = "-DDATA_TYPE=" + getCTypeAsString(output->getDataType());
    if(input1->getDimensions() == 3) {
        cl::Program program = getOpenCLProgram(device, "", buildOptions);
        cl::Kernel kernel(program, "multiply3D");

        OpenCLImageAccess::pointer access1 = input1->getOpenCLImageAccess(ACCESS_READ, device);
        OpenCLImageAccess::pointer access2 = input2->getOpenCLImageAccess(ACCESS_READ, device);
        OpenCLBufferAccess::pointer access3 = output->getOpenCLBufferAccess(ACCESS_READ_WRITE, device);
        kernel.setArg(0, *access1->get3DImage());
        kernel.setArg(1, *access2->get3DImage());
        kernel.setArg(2, *access3->get());
        kernel.setArg(3, output->getNrOfChannels());

        queue.enqueueNDRangeKernel(
                kernel,
                cl::NullRange,
                cl::NDRange(size.x(), size.y(), size.z()),
                cl::NullRange
        );
    } else {
        cl::Program program = getOpenCLProgram(device, "", buildOptions);
        cl::Kernel kernel(program, "multiply2D");

        auto access1 = input1->getOpenCLImageAccess(ACCESS_READ, device);
        auto access2 = input2->getOpenCLImageAccess(ACCESS_READ, device);
        auto access3 = output->getOpenCLImageAccess(ACCESS_READ_WRITE, device);
        kernel.setArg(0, *access1->get2DImage());
        kernel.setArg(1, *access2->get2DImage());
        kernel.setArg(2, *access3->get2DImage());
        kernel.setArg(3, input1->getNrOfChannels());
        kernel.setArg(4, input2->getNrOfChannels());
        kernel.setArg(5, output->getNrOfChannels());

        queue.enqueueNDRangeKernel(
                kernel,
                cl::NullRange,
                cl::NDRange(size.x(), size.y()),
                cl::NullRange
        );
    }
    addOutputData(0, output);
}

}


text: Rails.application.config.session_store :cookie_store, key: '_rails-property-manager_session'


text:
<?php

namespace Drupal\Tests\views\Kernel\Plugin;

use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\Tests\user\Traits\UserCreationTrait;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\views\Views;

/**
 * Tests \Drupal\views\Plugin\views\row\RssFields.
 *
 * @group views
 */
class RssFieldsTest extends ViewsKernelTestBase {
  use NodeCreationTrait;
  use ContentTypeCreationTrait;
  use UserCreationTrait;

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['node', 'field', 'text', 'filter'];

  /**
   * {@inheritdoc}
   */
  public static $testViews = ['test_display_feed'];

  /**
   * {@inheritdoc}
   */
  protected function setUp($import_test_views = TRUE): void {
    parent::setUp($import_test_views);

    $this->installConfig(['node', 'filter']);
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installEntitySchema('path_alias');
    $this->createContentType(['type' => 'article']);
  }

  /**
   * Tests correct processing of link fields.
   *
   * This overlaps with \Drupal\Tests\views\Functional\Plugin\DisplayFeedTest to
   * ensure that root-relative links also work in a scenario without
   * subdirectory.
   */
  public function testLink() {
    // Set up the current user as uid 1 so the test doesn't need to deal with
    // permission.
    $this->setUpCurrentUser(['uid' => 1]);

    $node = $this->createNode([
      'type' => 'article',
      'title' => 'Article title',
      'body' => [
        0 => [
          'value' => 'A paragraph',
          'format' => filter_default_format(),
        ],
      ],
    ]);

    $node_url = $node->toUrl()->setAbsolute()->toString();

    $renderer = $this->container->get('renderer');

    $view = Views::getView('test_display_feed');
    $output = $view->preview('feed_2');
    $output = (string) $renderer->renderRoot($output);
    $this->assertStringContainsString('<link>' . $node_url . '</link>', $output);
  }

}


text:
class IngredientsController < ApplicationController
  before_action :set_ingredient, only: [:show, :edit, :update, :destroy]

  # GET /ingredients
  # GET /ingredients.json
  def index
    @ingredients = Ingredient.all
  end

  # GET /ingredients/1
  # GET /ingredients/1.json
  def show
  end

  # GET /ingredients/new
  def new
    @ingredient = Ingredient.new
    @recipe = Recipe.find(params[:recipe_id])
  end

  # GET /ingredients/1/edit
  def edit
    @recipe = Recipe.find(params[:recipe_id])
  end

  # POST /ingredients
  # POST /ingredients.json
  def create
    @ingredient = Ingredient.new(ingredient_params)

    respond_to do |format|
      if @ingredient.save
        format.html { redirect_to recipe_path(id: @ingredient.recipe_id)}
        format.json { render :show, status: :created, location: @ingredient }
      else
        format.html { render :new }
        format.json { render json: @ingredient.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /ingredients/1
  # PATCH/PUT /ingredients/1.json
  def update
    respond_to do |format|
      if @ingredient.update(ingredient_params)
        format.html { redirect_to recipe_path(id: @ingredient.recipe_id), notice: 'Ingredient was successfully updated.'}
        format.json { render :show, status: :ok, location: @ingredient }
      else
        format.html { render :edit }
        format.json { render json: @ingredient.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /ingredients/1
  # DELETE /ingredients/1.json
  def destroy
    @id = @ingredient.recipe_id
    @ingredient.destroy
    redirect_to recipe_url id: @id

  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_ingredient
      @ingredient = Ingredient.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def ingredient_params
      params.require(:ingredient).permit(:name, :quantity, :measure, :recipe_id)

    end
end


text: Simple fuel tracking application written in F#


text:
import React from 'react';
import PropTypes from 'prop-types';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Forms.css';
import forms from './form_data';

const formsMarkup = forms.map(({ name, link }, index) => (

    {name}

));

class Forms extends React.Component {
  static propTypes = {
    title: PropTypes.string.isRequired,
  };

  render() {
    return (

{this.props.title}

            {formsMarkup}

    );
  }
}

export default withStyles(s)(Forms);


text:
"""A simple example that illustrates returning UTF-8 encoded data within a JSON outputting hug endpoint"""
import hug

@hug.get()
def unicode_response():
    """An example endpoint that returns unicode data nested within the result object"""
    return {"data": ["Τη γλώσσα μου έδωσαν ελληνική"]}


text:
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "jekyll"
require "jekyll-webmention_io"
require "html-proofer"

ENV["JEKYLL_LOG_LEVEL"] = "error"

def dest_dir
  File.expand_path("../tmp/dest", __dir__)
end

def source_dir
  File.expand_path("fixtures", __dir__)
end

CONFIG_DEFAULTS = {
  "source"      => source_dir,
  "destination" => dest_dir,
  "gems"        => ["jekyll-webmention_io"],
}.freeze

def make_page(options = {})
  page = Jekyll::Page.new site, CONFIG_DEFAULTS["source"], "", "page.md"
  page.data = options
  page
end

def make_post(options = {})
  filename = File.expand_path("_posts/2001-01-01-post.md", CONFIG_DEFAULTS["source"])
  config = { :site => site, :collection => site.collections["posts"] }
  page = Jekyll::Document.new filename, config
  page.merge_data!(options)
  page
end

def make_site(options = {})
  config = Jekyll.configuration CONFIG_DEFAULTS.merge(options)
  Jekyll::Site.new(config)
end

def make_context(registers = {}, environments = {})
  Liquid::Context.new(environments, {}, { :site => site, :page => page }.merge(registers))
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <property name="LOG_FILE" value="logs/restriction-run-app.log" />

    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
    <include resource="org/springframework/boot/logging/logback/file-appender.xml"/>

    <logger name="uk.ac.ebi.spot" level="DEBUG" additivity="false">
        <appender-ref ref="FILE" />
    </logger>

    <root level="INFO">
        <!--<appender-ref ref="CONSOLE" />-->
        <appender-ref ref="FILE" />
    </root>

</configuration>


text:
namespace mojo {

// This must be specialized for any type |T| to be serialized/deserialized as
// a mojom array.
//
// Usually you would like to do a partial specialization for a container (e.g.
// vector) template. Imagine you want to specialize it for Container<>, you need
// to implement:
//
//   template <typename T>
//   struct ArrayTraits<Container<T>> {
//     using Element = T;
//     // These two statements are optional. Use them if you'd like to serialize
//     // a container that supports iterators but does not support O(1) random
//     // access and so GetAt(...) would be expensive.
//     // using Iterator = T::iterator;
//     // using ConstIterator = T::const_iterator;
//
//     // These two methods are optional. Please see comments in struct_traits.h
//     // Note that unlike with StructTraits, IsNull() is called *twice* during
//     // serialization for ArrayTraits.
//     static bool IsNull(const Container<T>& input);
//     static void SetToNull(Container<T>* output);
//
//     static size_t GetSize(const Container<T>& input);
//
//     // These two methods are optional. They are used to access the
//     // underlying storage of the array to speed up copy of POD types.
//     static T* GetData(Container<T>& input);
//     static const T* GetData(const Container<T>& input);
//
//     // The following six methods are optional if the GetAt(...) methods are
//     // implemented. These methods specify how to read the elements of
//     // Container in some sequential order specified by the iterator.
//     //
//     // Acquires an iterator positioned at the first element in the container.
//     static ConstIterator GetBegin(const Container<T>& input);
//     static Iterator GetBegin(Container<T>& input);
//
//     // Advances |iterator| to the next position within the container.
//     static void AdvanceIterator(ConstIterator& iterator);
//     static void AdvanceIterator(Iterator& iterator);
//
//     // Returns a reference to the value at the current position of
//     // |iterator|. Optionally, the ConstIterator version of GetValue can
//     // return by value instead of by reference if it makes sense for the
//     // type.
//     static const T& GetValue(ConstIterator& iterator);
//     static T& GetValue(Iterator& iterator);
//
//     // These two methods are optional if the iterator methods are
//     // implemented.
//     static T& GetAt(Container<T>& input, size_t index);
//     static const T& GetAt(const Container<T>& input, size_t index);
//
//     // Returning false results in deserialization failure and causes the
//     // message pipe receiving it to be disconnected.
//     static bool Resize(Container<T>& input, size_t size);
//   };
//
template <typename T>
struct ArrayTraits {
  static_assert(internal::AlwaysFalse<T>::value,
                "Cannot find the mojo::ArrayTraits specialization. Did you "
                "forget to include the corresponding header file?");
};

}  // namespace mojo

#endif  // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_H_


text:
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>

<!--

Copyright (c) 2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University).  All
Rights Reserved.  This program is distributed under the W3C's Software
Intellectual Property License.  This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

See W3C License http://www.w3.org/Consortium/Legal/ for more details.

-->

<!DOCTYPE test SYSTEM "dom3.dtd">
<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="checkcharacternormalization02">
<metadata>
<title>checkcharacternormalization02</title>
<creator>Curt Arnold</creator>
<description>
Parsing a non-Unicode normalized document should raise PARSE_ERR if check-character-normalization
is false.
</description>
<date qualifier="created">2004-03-31</date>
<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save#LS-LSParser-parseURI"/>
<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#parameter-check-character-normalization"/>
</metadata>
<var name="doc" type="Document"/>
<var name="domConfig" type="DOMConfiguration"/>
<var name="domImplLS" type="DOMImplementationLS"/>
<var name="lsParser" type="LSParser"/>
<var name="resourceURI" type="DOMString"/>
<var name="canSet" type="boolean"/>
<var name="nullSchemaLanguage" type="DOMString" isNull="true"/>
<var name="errorMonitor" type="DOMErrorMonitor"/>
<var name="errors" type="List"/>
<var name="error" type="DOMError"/>
<var name="severity" type="int"/>
<var name="type" type="DOMString"/>
<var name="errorCount" type="int" value="0"/>
<implementation var="domImplLS"/>
<createLSParser var="lsParser" obj="domImplLS" mode="1" schemaType="nullSchemaLanguage"/>
<domConfig obj="lsParser" var="domConfig" interface="LSParser"/>
<canSetParameter var="canSet" obj="domConfig" name='"check-character-normalization"' value="true"/>
<if><isTrue value="canSet"/>
<setParameter obj="domConfig" name='"check-character-normalization"' value="true"/>
<setParameter obj="domConfig" name='"error-handler"' value="errorMonitor"/>
<getResourceURI var="resourceURI" href='"characternormalization1"' contentType="text/xml"/>
<assertLSException id="throw_PARSE_ERR">
        <PARSE_ERR>
                <parseURI var="doc" obj="lsParser" uri="resourceURI"/>
        </PARSE_ERR>
</assertLSException>
<allErrors var="errors" obj="errorMonitor"/>
<for-each member="error" collection="errors">
        <severity var="severity" obj="error"/>
        <type var="type" obj="error" interface="DOMError"/>
        <if><greater actual="severity" expected="1"/>
                <assertEquals actual="severity" expected="2" id="isError" ignoreCase="false"/>
                <assertEquals actual="type" expected='"check-character-normalization-failure"' id="isCheck_Failure" ignoreCase="false"/>
                <increment var="errorCount" value="1"/>
        </if>
</for-each>
<assertEquals actual="errorCount" expected="1" ignoreCase="false" id="oneError"/>
</if>
</test>