text:
package org.apache.ibatis.domain.misc;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RichType {

  private RichType richType;

  private String richField;

  private String richProperty;

  private Map richMap = new HashMap();

  private List richList = new ArrayList() {
    {
      add("bar");
    }
  };

  public RichType getRichType() {
    return richType;
  }

  public void setRichType(RichType richType) {
    this.richType = richType;
  }

  public String getRichProperty() {
    return richProperty;
  }

  public void setRichProperty(String richProperty) {
    this.richProperty = richProperty;
  }

  public List getRichList() {
    return richList;
  }

  public void setRichList(List richList) {
    this.richList = richList;
  }

  public Map getRichMap() {
    return richMap;
  }

  public void setRichMap(Map richMap) {
    this.richMap = richMap;
  }
}


text:
.display-settings ul {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
}

.display-settings li {
  flex: 0 0 50%;
  margin-bottom: 1rem;
}

.display-settings span,
.display-settings label {
  min-width: 8rem;
  display: inline-block;
}

.display-settings select,
.display-settings input:not([type="checkbox"]) {
  width: 10rem;
}

redpajama_set_name: RedPajamaGithub


text:
package com.siyeh.ig.internationalization;

import com.intellij.psi.PsiLiteralExpression;
import com.intellij.psi.PsiType;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
import com.siyeh.ig.InspectionGadgetsFix;
import com.siyeh.ig.fixes.IntroduceConstantFix;
import com.siyeh.ig.psiutils.ExpressionUtils;
import org.jetbrains.annotations.NotNull;

public class MagicCharacterInspection extends BaseInspection {

  @Override
  protected InspectionGadgetsFix buildFix(Object... infos) {
    return new IntroduceConstantFix();
  }

  @Override
  @NotNull
  public String getDisplayName() {
    return InspectionGadgetsBundle.message("magic.character.display.name");
  }

  @Override
  @NotNull
  public String buildErrorString(Object... infos) {
    return InspectionGadgetsBundle.message(
      "magic.character.problem.descriptor");
  }

  @Override
  protected boolean buildQuickFixesOnlyForOnTheFlyErrors() {
    return true;
  }

  @Override
  public BaseInspectionVisitor buildVisitor() {
    return new CharacterLiteralsShouldBeExplicitlyDeclaredVisitor();
  }

  private static class CharacterLiteralsShouldBeExplicitlyDeclaredVisitor
    extends BaseInspectionVisitor {

    @Override
    public void visitLiteralExpression(
      @NotNull PsiLiteralExpression expression) {
      super.visitLiteralExpression(expression);
      final PsiType type = expression.getType();
      if (type == null) {
        return;
      }
      if (!type.equals(PsiType.CHAR)) {
        return;
      }
      final String text = expression.getText();
      if (text == null) {
        return;
      }
      if (text.equals(" ")) {
        return;
      }
      if (ExpressionUtils.isDeclaredConstant(expression)) {
        return;
      }
      if (NonNlsUtils.isNonNlsAnnotatedUse(expression)) {
        return;
      }
      registerError(expression);
    }
  }
}


text:
package com.google.sps.database;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.EntityNotFoundException;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.PreparedQuery;
import com.google.appengine.api.datastore.Query;
import com.google.sps.graph.UserVertex;

public class DatabaseRetriever implements Serializable {

  /** */
  private static final long serialVersionUID = 1L;

  public DatabaseRetriever() {}

  static Map<String, UserVertex> vertexMap = new HashMap<String, UserVertex>();

  public List<String> getNamesFromDb() {
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    Query query = new Query("User");
    PreparedQuery pq = datastore.prepare(query);
    List<String> names = new ArrayList<String>();
    for (Entity userEntity : pq.asIterable()) {
      String firstName = (String) userEntity.getProperty("firstName");
      String lastName = (String) userEntity.getProperty("lastName");
      // unique separator to account for names like Marie Rose Shapiro
      String name = firstName + "@" + lastName;
      names.add(name);
    }
    return names;
  }

  public static Map<UserVertex, Integer> getImmediateFriends(String currUserId) {
    Map<UserVertex, Integer> friendsToNumSharedGroups = new HashMap<UserVertex, Integer>();
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    Entity currUserEntity = getEntityFromId(currUserId, "User", datastore);

    if (currUserEntity != null) {
      List<Long> groupIds =
          (currUserEntity.getProperty("groups") == null)
              ? new ArrayList<Long>()
              : (List<Long>) currUserEntity.getProperty("groups");

      for (Long groupId : groupIds) {
        Entity groupEntity = getEntityFromId(groupId, "Group", datastore);
        if (groupEntity != null) {
          List<String> memberIds = (List<String>) groupEntity.getProperty("memberIds");
          for (String memberId : memberIds) {
            if (!memberId.equals(currUserId)) {
              UserVertex userVertex = null;
              if (vertexMap.containsKey(memberId)) {
                userVertex = vertexMap.get(memberId);
              } else {
                userVertex = new UserVertex(memberId);
                vertexMap.put(memberId, userVertex);
              }
              if (!friendsToNumSharedGroups.containsKey(userVertex)) {
                friendsToNumSharedGroups.put(userVertex, 1);
              } else {
                friendsToNumSharedGroups.put(
                    userVertex, 1 + friendsToNumSharedGroups.get(userVertex));
              }
            }
          }
        }
      }
    }

    return friendsToNumSharedGroups;
  }

  private UserVertex getVertex(String userId) {
    return new UserVertex(userId);
  }

  public static Entity getEntityFromId(String id, String type, DatastoreService datastore) {
    try {
      return datastore.get(KeyFactory.createKey(type, id));
    } catch (EntityNotFoundException e) {
      System.err.println("Cannot get entity from database");
      return null;
    }
  }

  public static Entity getEntityFromId(long id, String type, DatastoreService datastore) {
    try {
      return datastore.get(KeyFactory.createKey(type, id));
    } catch (EntityNotFoundException e) {
      System.err.println("Cannot get entity from database");
      return null;
    }
  }
}


text:
<?php

namespace App\Controller;

use Cake\Core\Configure;
use Cake\Network\Exception\ForbiddenException;
use Cake\Network\Exception\NotFoundException;
use Cake\View\Exception\MissingTemplateException;

/**
 * Static content controller
 *
 * This controller will render views from Template/Pages/
 *
 * @link http://book.cakephp.org/3.0/en/controllers/pages-controller.html
 */
class PagesController extends AppController
{

    /**
     * Displays a view
     *
     * @return void|\Cake\Network\Response
     * @throws \Cake\Network\Exception\ForbiddenException When a directory traversal attempt.
     * @throws \Cake\Network\Exception\NotFoundException When the view file could not
     *   be found or \Cake\View\Exception\MissingTemplateException in debug mode.
     */
    public function display()
    {
        $path = func_get_args();

        $count = count($path);
        if (!$count) {
            return $this->redirect('/');
        }
        if (in_array('..', $path, true) || in_array('.', $path, true)) {
            throw new ForbiddenException();
        }
        $page = $subpage = null;
        $title = '';
        if (!empty($path[0])) {
            $page = $path[0];
            $title .= $page;
        }
        if (!empty($path[1])) {
            $subpage = $path[1];
            $title .= ' - ' . $subpage;
        }
        $this->set('title', $title);
        $this->set(compact('page', 'subpage'));

        try {
            $this->render(implode('/', $path));
        } catch (MissingTemplateException $e) {
            if (Configure::read('debug')) {
                throw $e;
            }
            throw new NotFoundException();
        }
    }
}


text:
dojo.declare("AdminByAccordion", wm.Page, {
	start: function() {

	},
	"preferredDevice": "desktop",

	_end: 0
});


text:
"use strict";
var expect = require("expect.js");
var sinon = require('sinon');
var logstash = require('../lib/logstash');

describe( "logstash", function() {
    it( "works", function() {
        var stream = logstash.createStream();
        sinon.stub( stream, "send", function() {
            console.log("send: ", arguments )
        } );
        stream.write({ time: new Date(), msg: "Test", level: 20, testField: 1 } );
        expect( stream.send.callCount ).to.be( 1 );
        var arg0 = stream.send.firstCall.args[0];
        var obj = JSON.parse( arg0 );
        expect( obj["@timestamp"] ).to.contain( "20" );
        expect( obj.message ).to.be( "Test" );
        expect( obj.tags ).to.eql( ["bunyan"] );
        expect( obj.level ).to.be( "debug" );
        expect( obj.testField ).to.be( 1 );
    } );
} );


text:
package org.apache.geode.cache.lucene.internal.distributed;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;

import org.apache.logging.log4j.Logger;
import org.apache.lucene.search.Query;

import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.FunctionException;
import org.apache.geode.cache.execute.RegionFunctionContext;
import org.apache.geode.cache.execute.ResultSender;
import org.apache.geode.cache.lucene.LuceneIndex;
import org.apache.geode.cache.lucene.LuceneIndexNotFoundException;
import org.apache.geode.cache.lucene.LuceneQueryException;
import org.apache.geode.cache.lucene.LuceneQueryProvider;
import org.apache.geode.cache.lucene.LuceneService;
import org.apache.geode.cache.lucene.LuceneServiceProvider;
import org.apache.geode.cache.lucene.internal.InternalLuceneIndex;
import org.apache.geode.cache.lucene.internal.LuceneIndexCreationInProgressException;
import org.apache.geode.cache.lucene.internal.LuceneIndexStats;
import org.apache.geode.cache.lucene.internal.LuceneServiceImpl;
import org.apache.geode.cache.lucene.internal.repository.IndexRepository;
import org.apache.geode.cache.lucene.internal.repository.IndexResultCollector;
import org.apache.geode.cache.lucene.internal.repository.RepositoryManager;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.BucketNotFoundException;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.PrimaryBucketException;
import org.apache.geode.internal.cache.execute.InternalFunction;
import org.apache.geode.internal.cache.execute.InternalFunctionInvocationTargetException;
import org.apache.geode.internal.cache.execute.PartitionedRegionFunctionResultSender;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.security.ResourcePermission;

/**
 * {@link LuceneQueryFunction} coordinates text search on a member. It receives text search query
 * from the coordinator and arguments like region and buckets. It invokes search on the local index
 * and provides a result collector. The locally collected results are sent to the search
 * coordinator.
 */
public class LuceneQueryFunction implements InternalFunction<LuceneFunctionContext> {
  private static final long serialVersionUID = 1L;
  public static final String ID = LuceneQueryFunction.class.getName();

  private static final Logger logger = LogService.getLogger();

  @Override
  public void execute(FunctionContext<LuceneFunctionContext> context) {
    if (context.getResultSender() instanceof PartitionedRegionFunctionResultSender) {
      PartitionedRegionFunctionResultSender resultSender =
          (PartitionedRegionFunctionResultSender) context.getResultSender();
      KnownVersion clientVersion = resultSender.getClientVersion();
      if (LuceneServiceImpl.LUCENE_REINDEX == false
          || (clientVersion != null && clientVersion
              .ordinal() < LuceneServiceImpl.LUCENE_REINDEX_ENABLED_VERSION_ORDINAL)) {
        // is a client server connection (or reindex disabled)
        execute(context, true);
        return;
      }
    }
    execute(context, false);
  }

  private void handleIfRetryNeededOnException(LuceneIndexCreationInProgressException ex,
      RegionFunctionContext ctx) {
    PartitionedRegion userDataRegion = (PartitionedRegion) ctx.getDataSet();

    // get the remote members
    Set<InternalDistributedMember> remoteMembers =
        userDataRegion.getRegionAdvisor().adviseAllPRNodes();
    // Old members with version numbers 1.6 or lower cannot handle IndexCreationInProgressException
    // Hence the query waits for the repositories to be ready instead of throwing the exception
    if (!remoteMembers.isEmpty()) {
      for (InternalDistributedMember remoteMember : remoteMembers) {
        if (remoteMember.getVersion().ordinal() < KnownVersion.GEODE_1_6_0.ordinal()) {
          // re-execute but wait till indexing is complete
          execute(ctx, true);
          return;
        }
      }
    }
    // Cannot send IndexingInProgressException as the function may have been executed a new server
    // on behalf of an old version client.
    throw new FunctionException(new LuceneQueryException(
        "Lucene Index is not available, currently indexing"));
  }

  public void execute(FunctionContext<LuceneFunctionContext> context, boolean waitForRepository) {
    RegionFunctionContext ctx = (RegionFunctionContext) context;
    ResultSender<TopEntriesCollector> resultSender = ctx.getResultSender();

    Region region = ctx.getDataSet();

    LuceneFunctionContext<IndexResultCollector> searchContext =
        (LuceneFunctionContext) ctx.getArguments();
    if (searchContext == null) {
      throw new IllegalArgumentException("Missing search context");
    }

    LuceneQueryProvider queryProvider = searchContext.getQueryProvider();
    if (queryProvider == null) {
      throw new IllegalArgumentException("Missing query provider");
    }

    InternalLuceneIndex index = getLuceneIndex(context.getCache(), region, searchContext);
    if (index == null) {
      throw new LuceneIndexNotFoundException(searchContext.getIndexName(), region.getFullPath());
    }
    RepositoryManager repoManager = index.getRepositoryManager();
    LuceneIndexStats stats = index.getIndexStats();

    Query query = getQuery(queryProvider, index);

    if (logger.isDebugEnabled()) {
      logger.debug("Executing lucene query: {}, on region {}", query, region.getFullPath());
    }

    int resultLimit = searchContext.getLimit();
    CollectorManager manager = searchContext.getCollectorManager();
    if (manager == null) {
      manager = new TopEntriesCollectorManager(null, resultLimit);
    }

    Collection<IndexResultCollector> results = new ArrayList<>();
    TopEntriesCollector mergedResult = null;
    try {
      long start = stats.startQuery();
      Collection<IndexRepository> repositories = null;

      try {
        repositories = repoManager.getRepositories(ctx, waitForRepository);

        for (IndexRepository repo : repositories) {
          IndexResultCollector collector = manager.newCollector(repo.toString());
          if (logger.isDebugEnabled()) {
            logger.debug("Executing search on repo: " + repo);
          }
          repo.query(query, resultLimit, collector);
          results.add(collector);
        }
        mergedResult = (TopEntriesCollector) manager.reduce(results);
      } finally {
        stats.endQuery(start, mergedResult == null ? 0 : mergedResult.size());
      }
      stats.incNumberOfQueryExecuted();
      resultSender.lastResult(mergedResult);
    } catch (IOException | BucketNotFoundException | CacheClosedException
        | PrimaryBucketException e) {
      logger.debug("Exception during lucene query function", e);
      throw new InternalFunctionInvocationTargetException(e);
    } catch (LuceneIndexCreationInProgressException ex) {
      if (!waitForRepository) {
        handleIfRetryNeededOnException(ex, ctx);
      } else {
        logger.warn("The lucene query should have waited for the index to be created");
        throw new FunctionException(new LuceneQueryException(
            "Lucene Index is not available, currently indexing"));
      }
    }
  }

  private InternalLuceneIndex getLuceneIndex(final Cache cache, final Region region,
      final LuceneFunctionContext<IndexResultCollector> searchContext) {
    LuceneService service = LuceneServiceProvider.get(cache);
    InternalLuceneIndex index = null;
    try {
      index = (InternalLuceneIndex) service.getIndex(searchContext.getIndexName(),
          region.getFullPath());
      if (index == null) {
        while (service instanceof LuceneServiceImpl && (((LuceneServiceImpl) service)
            .getDefinedIndex(searchContext.getIndexName(), region.getFullPath()) != null)) {
          try {
            Thread.sleep(10);
          } catch (InterruptedException e) {
            return null;
          }
          cache.getCancelCriterion().checkCancelInProgress(null);
        }
        index = (InternalLuceneIndex) service.getIndex(searchContext.getIndexName(),
            region.getFullPath());
      }
    } catch (CacheClosedException e) {
      throw new InternalFunctionInvocationTargetException(
          "Cache is closed when attempting to retrieve index:" + region.getFullPath(), e);
    }

    return index;
  }

  private Query getQuery(final LuceneQueryProvider queryProvider, final LuceneIndex index) {
    Query query = null;
    try {
      query = queryProvider.getQuery(index);
    } catch (LuceneQueryException e) {
      logger.warn("", e);
      throw new FunctionException(e);
    }
    return query;
  }

  @Override
  public String getId() {
    return ID;
  }

  @Override
  public boolean optimizeForWrite() {
    return true;
  }

  @Override
  public Collection<ResourcePermission> getRequiredPermissions(String regionName) {
    return Collections.singletonList(new ResourcePermission(ResourcePermission.Resource.DATA,
        ResourcePermission.Operation.READ, regionName));
  }
}


text:
using System;

namespace SharpVectors.Converters
{
    /// <summary>
    /// Defines the current state of the mouse handling logic.
    /// </summary>
    public enum MouseHandlingMode
    {
        /// <summary>
        /// Not in any special mode.
        /// </summary>
        None,

        /// <summary>
        /// The user is left-dragging rectangles with the mouse.
        /// </summary>
        DraggingRectangles,

        /// <summary>
        /// The user is left-mouse-button-dragging to pan the viewport.
        /// </summary>
        Panning,

        /// <summary>
        /// The user is holding down shift and left-clicking or right-clicking to zoom in or out.
        /// </summary>
        Zooming,
    }
}


text:
package org.elasticsearch.client;

import org.apache.http.util.EntityUtils;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.client.ccr.CcrStatsRequest;
import org.elasticsearch.client.ccr.CcrStatsResponse;
import org.elasticsearch.client.ccr.DeleteAutoFollowPatternRequest;
import org.elasticsearch.client.ccr.FollowInfoRequest;
import org.elasticsearch.client.ccr.FollowInfoResponse;
import org.elasticsearch.client.ccr.FollowStatsRequest;
import org.elasticsearch.client.ccr.FollowStatsResponse;
import org.elasticsearch.client.ccr.ForgetFollowerRequest;
import org.elasticsearch.client.ccr.GetAutoFollowPatternRequest;
import org.elasticsearch.client.ccr.GetAutoFollowPatternResponse;
import org.elasticsearch.client.ccr.IndicesFollowStats;
import org.elasticsearch.client.ccr.IndicesFollowStats.ShardFollowStats;
import org.elasticsearch.client.ccr.PauseFollowRequest;
import org.elasticsearch.client.ccr.PutAutoFollowPatternRequest;
import org.elasticsearch.client.ccr.PutFollowRequest;
import org.elasticsearch.client.ccr.PutFollowResponse;
import org.elasticsearch.client.ccr.ResumeFollowRequest;
import org.elasticsearch.client.ccr.UnfollowRequest;
import org.elasticsearch.client.core.AcknowledgedResponse;
import org.elasticsearch.client.core.BroadcastResponse;
import org.elasticsearch.client.indices.CloseIndexRequest;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.CreateIndexResponse;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.index.seqno.ReplicationTracker;
import org.elasticsearch.test.rest.yaml.ObjectPath;
import org.junit.Before;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;

public class CCRIT extends ESRestHighLevelClientTestCase {

    @Before
    public void setupRemoteClusterConfig() throws Exception {
        // Configure local cluster as remote cluster:
        // TODO: replace with nodes info highlevel rest client code when it is available:
        final Request request = new Request("GET", "/_nodes");
        Map<?, ?> nodesResponse = (Map<?, ?>) toMap(client().performRequest(request)).get("nodes");
        // Select node info of first node (we don't know the node id):
        nodesResponse = (Map<?, ?>) nodesResponse.get(nodesResponse.keySet().iterator().next());
        String transportAddress = (String) nodesResponse.get("transport_address");

        ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();
        updateSettingsRequest.transientSettings(Collections.singletonMap("cluster.remote.local_cluster.seeds", transportAddress));
        ClusterUpdateSettingsResponse updateSettingsResponse =
            highLevelClient().cluster().putSettings(updateSettingsRequest, RequestOptions.DEFAULT);
        assertThat(updateSettingsResponse.isAcknowledged(), is(true));

        assertBusy(() -> {
            Map<?, ?> localConnection = (Map<?, ?>) toMap(client()
                .performRequest(new Request("GET", "/_remote/info")))
                .get("local_cluster");
            assertThat(localConnection, notNullValue());
            assertThat(localConnection.get("connected"), is(true));
        });
    }

    public void testIndexFollowing() throws Exception {
        CcrClient ccrClient = highLevelClient().ccr();

        CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
        createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
        CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT);
        assertThat(response.isAcknowledged(), is(true));

        PutFollowRequest putFollowRequest = new PutFollowRequest("local_cluster", "leader", "follower", ActiveShardCount.ONE);
        PutFollowResponse putFollowResponse = execute(putFollowRequest, ccrClient::putFollow, ccrClient::putFollowAsync);
        assertThat(putFollowResponse.isFollowIndexCreated(), is(true));
        assertThat(putFollowResponse.isFollowIndexShardsAcked(), is(true));
        assertThat(putFollowResponse.isIndexFollowingStarted(), is(true));

        IndexRequest indexRequest = new IndexRequest("leader")
            .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
            .source("{}", XContentType.JSON);
        highLevelClient().index(indexRequest, RequestOptions.DEFAULT);

        SearchRequest leaderSearchRequest = new SearchRequest("leader");
        SearchResponse leaderSearchResponse = highLevelClient().search(leaderSearchRequest, RequestOptions.DEFAULT);
        assertThat(leaderSearchResponse.getHits().getTotalHits().value, equalTo(1L));

        try {
            assertBusy(() -> {
                FollowInfoRequest followInfoRequest = new FollowInfoRequest("follower");
                FollowInfoResponse followInfoResponse =
                    execute(followInfoRequest, ccrClient::getFollowInfo, ccrClient::getFollowInfoAsync);
                assertThat(followInfoResponse.getInfos().size(), equalTo(1));
                assertThat(followInfoResponse.getInfos().get(0).getFollowerIndex(), equalTo("follower"));
                assertThat(followInfoResponse.getInfos().get(0).getLeaderIndex(), equalTo("leader"));
                assertThat(followInfoResponse.getInfos().get(0).getRemoteCluster(), equalTo("local_cluster"));
                assertThat(followInfoResponse.getInfos().get(0).getStatus(), equalTo(FollowInfoResponse.Status.ACTIVE));

                FollowStatsRequest followStatsRequest = new FollowStatsRequest("follower");
                FollowStatsResponse followStatsResponse =
                    execute(followStatsRequest, ccrClient::getFollowStats, ccrClient::getFollowStatsAsync);
                List<ShardFollowStats> shardFollowStats = followStatsResponse.getIndicesFollowStats().getShardFollowStats("follower");
                long followerGlobalCheckpoint = shardFollowStats.stream()
                    .mapToLong(ShardFollowStats::getFollowerGlobalCheckpoint)
                    .max()
                    .getAsLong();
                assertThat(followerGlobalCheckpoint, equalTo(0L));

                SearchRequest followerSearchRequest = new SearchRequest("follower");
                SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
                assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(1L));
            });
        } catch (Exception e) {
            IndicesFollowStats followStats = ccrClient.getCcrStats(new CcrStatsRequest(), RequestOptions.DEFAULT).getIndicesFollowStats();
            for (Map.Entry<String, List<ShardFollowStats>> entry : followStats.getShardFollowStats().entrySet()) {
                for (ShardFollowStats shardFollowStats : entry.getValue()) {
                    if (shardFollowStats.getFatalException() != null) {
                        logger.warn(new ParameterizedMessage("fatal shard follow exception {}", shardFollowStats.getShardId()),
                            shardFollowStats.getFatalException());
                    }
                }
            }
        }

        PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("follower");
        AcknowledgedResponse pauseFollowResponse = execute(pauseFollowRequest, ccrClient::pauseFollow, ccrClient::pauseFollowAsync);
        assertThat(pauseFollowResponse.isAcknowledged(), is(true));

        highLevelClient().index(indexRequest, RequestOptions.DEFAULT);

        ResumeFollowRequest resumeFollowRequest = new ResumeFollowRequest("follower");
        AcknowledgedResponse resumeFollowResponse = execute(resumeFollowRequest, ccrClient::resumeFollow, ccrClient::resumeFollowAsync);
        assertThat(resumeFollowResponse.isAcknowledged(), is(true));

        assertBusy(() -> {
            FollowStatsRequest followStatsRequest = new FollowStatsRequest("follower");
            FollowStatsResponse followStatsResponse =
                execute(followStatsRequest, ccrClient::getFollowStats, ccrClient::getFollowStatsAsync);
            List<ShardFollowStats> shardFollowStats = followStatsResponse.getIndicesFollowStats().getShardFollowStats("follower");
            long followerGlobalCheckpoint = shardFollowStats.stream()
                .mapToLong(ShardFollowStats::getFollowerGlobalCheckpoint)
                .max()
                .getAsLong();
            assertThat(followerGlobalCheckpoint, equalTo(1L));

            SearchRequest followerSearchRequest = new SearchRequest("follower");
            SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
            assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(2L));
        });

        // Need to pause prior to unfollowing it:
        pauseFollowRequest = new PauseFollowRequest("follower");
        pauseFollowResponse = execute(pauseFollowRequest, ccrClient::pauseFollow, ccrClient::pauseFollowAsync);
        assertThat(pauseFollowResponse.isAcknowledged(), is(true));

        assertBusy(() -> {
            FollowInfoRequest followInfoRequest = new FollowInfoRequest("follower");
            FollowInfoResponse followInfoResponse =
                execute(followInfoRequest, ccrClient::getFollowInfo, ccrClient::getFollowInfoAsync);
            assertThat(followInfoResponse.getInfos().size(), equalTo(1));
            assertThat(followInfoResponse.getInfos().get(0).getFollowerIndex(), equalTo("follower"));
            assertThat(followInfoResponse.getInfos().get(0).getLeaderIndex(), equalTo("leader"));
            assertThat(followInfoResponse.getInfos().get(0).getRemoteCluster(), equalTo("local_cluster"));
            assertThat(followInfoResponse.getInfos().get(0).getStatus(), equalTo(FollowInfoResponse.Status.PAUSED));
        });

        // Need to close index prior to unfollowing it:
        CloseIndexRequest closeIndexRequest = new CloseIndexRequest("follower");
        org.elasticsearch.action.support.master.AcknowledgedResponse closeIndexReponse =
            highLevelClient().indices().close(closeIndexRequest, RequestOptions.DEFAULT);
        assertThat(closeIndexReponse.isAcknowledged(), is(true));

        UnfollowRequest unfollowRequest = new UnfollowRequest("follower");
        AcknowledgedResponse unfollowResponse = execute(unfollowRequest, ccrClient::unfollow, ccrClient::unfollowAsync);
        assertThat(unfollowResponse.isAcknowledged(), is(true));
    }

    public void testForgetFollower() throws IOException {
        final CcrClient ccrClient = highLevelClient().ccr();

        final CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
        final Map<String, String> settings = new HashMap<>(3);
        final int numberOfShards = randomIntBetween(1, 2);
        settings.put("index.number_of_replicas", "0");
        settings.put("index.number_of_shards", Integer.toString(numberOfShards));
        settings.put("index.soft_deletes.enabled", Boolean.TRUE.toString());
        createIndexRequest.settings(settings);
        final CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT);
        assertThat(response.isAcknowledged(), is(true));

        final PutFollowRequest putFollowRequest = new PutFollowRequest("local_cluster", "leader", "follower", ActiveShardCount.ONE);
        final PutFollowResponse putFollowResponse = execute(putFollowRequest, ccrClient::putFollow, ccrClient::putFollowAsync);
        assertTrue(putFollowResponse.isFollowIndexCreated());
        assertTrue(putFollowResponse.isFollowIndexShardsAcked());
        assertTrue(putFollowResponse.isIndexFollowingStarted());

        final String clusterName = highLevelClient().info(RequestOptions.DEFAULT).getClusterName();

        final Request statsRequest = new Request("GET", "/follower/_stats");
        final Response statsResponse = client().performRequest(statsRequest);
        final ObjectPath statsObjectPath = ObjectPath.createFromResponse(statsResponse);
        final String followerIndexUUID = statsObjectPath.evaluate("indices.follower.uuid");

        final PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("follower");
        AcknowledgedResponse pauseFollowResponse = execute(pauseFollowRequest, ccrClient::pauseFollow, ccrClient::pauseFollowAsync);
        assertTrue(pauseFollowResponse.isAcknowledged());

        final ForgetFollowerRequest forgetFollowerRequest =
                new ForgetFollowerRequest(clusterName, "follower", followerIndexUUID, "local_cluster", "leader");
        final BroadcastResponse forgetFollowerResponse =
                execute(forgetFollowerRequest, ccrClient::forgetFollower, ccrClient::forgetFollowerAsync);
        assertThat(forgetFollowerResponse.shards().total(), equalTo(numberOfShards));
        assertThat(forgetFollowerResponse.shards().successful(), equalTo(numberOfShards));
        assertThat(forgetFollowerResponse.shards().skipped(), equalTo(0));
        assertThat(forgetFollowerResponse.shards().failed(), equalTo(0));
        assertThat(forgetFollowerResponse.shards().failures(), empty());

        final Request retentionLeasesRequest = new Request("GET", "/leader/_stats");
        retentionLeasesRequest.addParameter("level", "shards");
        final Response retentionLeasesResponse = client().performRequest(retentionLeasesRequest);
        final Map<?, ?> shardsStats = ObjectPath.createFromResponse(retentionLeasesResponse).evaluate("indices.leader.shards");
        assertThat(shardsStats.keySet(), hasSize(numberOfShards));
        for (int i = 0; i < numberOfShards; i++) {
            final List<?> shardStats = (List<?>) shardsStats.get(Integer.toString(i));
            assertThat(shardStats, hasSize(1));
            final Map<?, ?> shardStatsAsMap = (Map<?, ?>) shardStats.get(0);
            final Map<?, ?> retentionLeasesStats = (Map<?, ?>) shardStatsAsMap.get("retention_leases");
            final List<?> leases = (List<?>) retentionLeasesStats.get("leases");
            for (final Object lease : leases) {
                assertThat(((Map<?, ?>) lease).get("source"), equalTo(ReplicationTracker.PEER_RECOVERY_RETENTION_LEASE_SOURCE));
            }
        }
    }

    public void testAutoFollowing() throws Exception {
        CcrClient ccrClient = highLevelClient().ccr();
        PutAutoFollowPatternRequest putAutoFollowPatternRequest =
            new PutAutoFollowPatternRequest("pattern1", "local_cluster", Collections.singletonList("logs-*"));
        putAutoFollowPatternRequest.setFollowIndexNamePattern("copy-{{leader_index}}");
        AcknowledgedResponse putAutoFollowPatternResponse =
            execute(putAutoFollowPatternRequest, ccrClient::putAutoFollowPattern, ccrClient::putAutoFollowPatternAsync);
        assertThat(putAutoFollowPatternResponse.isAcknowledged(), is(true));

        CreateIndexRequest createIndexRequest = new CreateIndexRequest("logs-20200101");
        createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
        CreateIndexResponse response = highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT);
        assertThat(response.isAcknowledged(), is(true));

        assertBusy(() -> {
            CcrStatsRequest ccrStatsRequest = new CcrStatsRequest();
            CcrStatsResponse ccrStatsResponse = execute(ccrStatsRequest, ccrClient::getCcrStats, ccrClient::getCcrStatsAsync);
            assertThat(ccrStatsResponse.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(), equalTo(1L));
            assertThat(ccrStatsResponse.getIndicesFollowStats().getShardFollowStats("copy-logs-20200101"), notNullValue());
        });
        assertThat(indexExists("copy-logs-20200101"), is(true));

        GetAutoFollowPatternRequest getAutoFollowPatternRequest =
            randomBoolean() ? new GetAutoFollowPatternRequest("pattern1") : new GetAutoFollowPatternRequest();
        GetAutoFollowPatternResponse getAutoFollowPatternResponse =
            execute(getAutoFollowPatternRequest, ccrClient::getAutoFollowPattern, ccrClient::getAutoFollowPatternAsync);
        assertThat(getAutoFollowPatternResponse.getPatterns().size(), equalTo(1));
        GetAutoFollowPatternResponse.Pattern pattern = getAutoFollowPatternResponse.getPatterns().get("pattern1");
        assertThat(pattern, notNullValue());
        assertThat(pattern.getRemoteCluster(), equalTo(putAutoFollowPatternRequest.getRemoteCluster()));
        assertThat(pattern.getLeaderIndexPatterns(), equalTo(putAutoFollowPatternRequest.getLeaderIndexPatterns()));
        assertThat(pattern.getFollowIndexNamePattern(), equalTo(putAutoFollowPatternRequest.getFollowIndexNamePattern()));

        // Cleanup:
        final DeleteAutoFollowPatternRequest deleteAutoFollowPatternRequest = new DeleteAutoFollowPatternRequest("pattern1");
        AcknowledgedResponse deleteAutoFollowPatternResponse =
            execute(deleteAutoFollowPatternRequest, ccrClient::deleteAutoFollowPattern, ccrClient::deleteAutoFollowPatternAsync);
        assertThat(deleteAutoFollowPatternResponse.isAcknowledged(), is(true));

        PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("copy-logs-20200101");
        AcknowledgedResponse pauseFollowResponse = ccrClient.pauseFollow(pauseFollowRequest, RequestOptions.DEFAULT);
        assertThat(pauseFollowResponse.isAcknowledged(), is(true));
    }

    private static Map<String, Object> toMap(Response response) throws IOException {
        return XContentHelper.convertToMap(JsonXContent.jsonXContent, EntityUtils.toString(response.getEntity()), false);
    }

}


text:
package org.auraframework.util.json;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Date;
import java.util.Map;

import org.auraframework.util.json.Serialization.ReferenceScope;

/**
 * Json interface
 */
public interface Json {

    enum IndentType {
        BRACE(true, "  "), SQUARE(true, "  "), PARAM(true, ""), COMMENT(false, " * ");

        private boolean separated;
        private String indent;

        IndentType(boolean separated, String indent) {
            this.separated = separated;
            this.indent = indent;
        }

        /**
         * Determines if this instance is separated.
         *
         * @return The separated.
         */
        public boolean isSeparated() {
            return this.separated;
        }

        /**
         * Gets the indent for this instance.
         *
         * @return The indent.
         */
        public String getIndent() {
            return this.indent;
        }
    }

    /*
    * JBUCH: HALO: TODO:
    *
    * ApplicationKey Enum to provide key based minification while serializing json
    * Ideally, we will replace all uses of pure strings on the Server and Client; and be able to use
    * the shortName in non-dev scenarios (resulting in 10-40% app.js size reduction).
    *
    * *sigh* I had it mostly working, but had to abandon branch due to large code change conflicts
    * with other team members. Because of that, I can only afford to change these four right now,
    * since they are used directly in this file for the structure of the frame, or net new:
    * ACCESS (access), SERIAL_ID (serId), SERIAL_REFID (serRefId), VALUE (value)
    *
    * While these three don't buy us much, my current hope is only to offset the additional cost
    * of access="G|P" values in the definitions.
    *
    * */
    enum ApplicationKey {
        ABSTRACT("isAbstract","ab"),
        ACCESS("xs" /*"access"*/,"xs"),
        ACTION("action","x"),
        ACTIONS("action","xx"),
        ACTIONDEFS("actionDefs","ac"),
        ACTIONTYPE("actionType","at"),
        ATTRIBUTES("attributes","a"),
        ATTRIBUTEDEFS("attributeDefs","ad"),
        COMPONENTDEF("componentDef","c"),
        CONTROLLERDEF("controllerDef","cd"),
        CREATIONPATH("creationPath","cp"),
        CSSPRELOADED("isCSSPreloaded","css"),
        DEFAULT("default","d"),
        DEFTYPE("defType","dt"),
        DESCRIPTOR("descriptor","de"),
        EVENTDEF("eventDef","ed"),
        EVENTS("events","e"),
        FACETS("facets","fa"),
        FUNCTIONS("functions","f"),
        HANDLERS("handlers","eh"),
        HASSERVERDEPENDENCIES("hasServerDeps","hs"),
        HELPERDEF("helperDef","h"),
        INCLUDES("includes","ic"),
        INTERFACES("interfaces","i"),
        LOCALID("localId","lid"),
        MEMBERS("members","mm"),
        MODEL("model","m"),
        MODELDEF("modelDef","md"),
        METHODS("methods","me"),
        NAME("name","n"),
        ORIGINAL("original","o"),
        PARAMS("params","pa"),
        PROVIDE("provide","p"),
        PROVIDERDEF("providerDef","pd"),
        REGISTEREVENTDEFS("registerEventDefs","re"),
        RENDERERDEF("rendererDef","rd"),
        REQUIRED("required","rq"),
        REQUIREDVERSIONDEFS("requiredVersionDefs","rv"),
        RETURNTYPE("returnType","rt"),
        SERIAL_ID("s"/*"serId"*/,"sid"),
        SERIAL_REFID("r"/*"serRefId"*/,"rid"),
        STYLEDEF("styleDef","st"),
        SUBDEFS("subDefs","sb"),
        SUPERDEF("superDef","su"),
        TYPE("type","t"),
        VALUE("v"/*"value"*/,"v"),
        VALUES("values","vv"),
        VALUEPROVIDER("valueProvider","vp");

        private String name;
        private String shortName;

        ApplicationKey(String name, String shortName){
            this.name=name;
            this.shortName=shortName;
        }

        @Override
        public String toString(){
            return useShortName?this.shortName:this.name;
        }

        private static Boolean useShortName=false;
        public static void useShortKey(Boolean useShortKey){
            useShortName=useShortKey;
        }
    }

    void checkIndent(IndentType type, String message);
    void clearReferences();
    void close() throws IOException;

    Appendable getAppendable();
    String getIndent();
    Integer getRefId(ReferenceScope rs, Object value);
    JsonSerializationContext getSerializationContext();
    void pushIndent(IndentType type);
    void popIndent(IndentType type, String message);
    void writeArray(Collection<?> array) throws IOException;
    void writeArray(Object[] array) throws IOException;
    void writeArrayBegin() throws IOException;
    void writeArrayEnd() throws IOException;
    void writeArrayEntry(Object value) throws IOException;
    OutputStream writeBinaryStreamBegin(long streamLength) throws IOException;
    void writeBinaryStreamEnd() throws IOException;
    void writeBreak() throws IOException;
    void writeComma() throws IOException;
    void writeComment(String body) throws IOException;
    void writeCommentBegin() throws IOException;
    void writeCommentBody(String body) throws IOException;
    void writeCommentEnd() throws IOException;
    void writeDate(Date value) throws IOException;
    void writeIndent() throws IOException;
    void writeLiteral(Object value) throws IOException;
    void writeMap(Map<?, ?> map) throws IOException;
    void writeMapBegin() throws IOException;
    void writeMapEnd() throws IOException;
    void writeMapEntry(Object key, Object value) throws IOException;
    void writeMapEntry(Object key, Object value, String type) throws IOException;
    void writeMapKey(Object key) throws IOException;
    void writeMapSeparator() throws IOException;
    void writeString(Object value) throws IOException;
    void writeValue(Object value) throws IOException;
}


text:
using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Owin;

namespace NuGetCalcWeb.Middlewares
{
    public class CacheControlMiddleware : OwinMiddleware
    {
        public const string RespondNotModifiedKey = "NuGetCalcWeb.Middlewares.CacheControlMiddleware#RespondNotModified";

        public CacheControlMiddleware(OwinMiddleware next, DateTime utcNow)
            : base(next)
        {
            this.lastModified = new DateTime(utcNow.Year, utcNow.Month, utcNow.Day, utcNow.Hour, utcNow.Minute, utcNow.Second, DateTimeKind.Utc);
            this.lastModifiedString = this.lastModified.ToString("R", CultureInfo.InvariantCulture);
            this.etag = string.Concat(BitConverter.GetBytes(utcNow.Ticks).Select(b => b.ToString("x2")));
        }

        private readonly DateTime lastModified;
        private readonly string lastModifiedString;
        private readonly string etag;

        public override Task Invoke(IOwinContext context)
        {
            if (context.Request.IsGetOrHeadRequest())
            {
                var res = context.Response;
                res.Headers.Set("Last-Modified", this.lastModifiedString);
                res.ETag = string.Concat("\"", this.etag, "\"");
                context.Set(RespondNotModifiedKey, ((Func<bool>)(() =>
                {
                    var ifNoneMatch = context.Request.Headers.GetCommaSeparatedValues("If-None-Match");
                    if (ifNoneMatch != null && ifNoneMatch.Any(x => x == "*" || x == this.etag))
                    {
                        res.StatusCode = 304;
                        return true;
                    }

                    var ifModifiedSince = context.Request.Headers.Get("If-Modified-Since");
                    DateTime ifModifiedSinceDt;
                    if (ifModifiedSince != null
                        && DateTime.TryParseExact(ifModifiedSince, "R", CultureInfo.InvariantCulture, DateTimeStyles.None, out ifModifiedSinceDt)
                        && ifModifiedSinceDt >= this.lastModified)
                    {
                        res.StatusCode = 304;
                        return true;
                    }

                    return false;
                })));
            }
            return this.Next.Invoke(context);
        }
    }

    public static class CacheControlExtensions
    {
        public static bool RespondNotModified(this IOwinContext context)
        {
            var func = context.Get<Func<bool>>(CacheControlMiddleware.RespondNotModifiedKey);
            if (func == null)
            {
                var req = context.Request;
                Trace.TraceWarning("{0} {1}?{2}: RespondNotModified is not in the environment", req.Method, req.Path, req.QueryString);
                return false;
            }
            return func();
        }
    }
}


text:
module Awspec::Generator
  module Doc
    module Type
      class Route53HostedZone < Base
        def initialize
          super
          @type = Awspec::Type::Route53HostedZone.new('example.com.')
          @ret = @type.resource
          @matchers = []
          @ignore_matchers = []
          @describes = []
        end
      end
    end
  end
end


text:
RM=rm -f
CC=gcc
SUDO=sudo
CFLAGS=-framework ApplicationServices -framework Carbon

SRCS=kiirogaa.c
TARGET=./kiirogaa

all: $(TARGET)

clean:
	-$(RM) $(TARGET)

test: $(TARGET)
	$(SUDO) $(TARGET)

$(TARGET): $(SRCS)
	$(CC) -o $(TARGET) $(SRCS) $(CFLAGS)


text:
#ifndef VICE_UIREU_H
#define VICE_UIREU_H

extern void ui_reu_settings_dialog(video_canvas_t *canvas);

#endif


text:
    create table Attachment (
        id numeric(19,0) identity not null,
        accessType int null,
        attachedAt datetime null,
        attachmentContentId numeric(19,0) not null,
        contentType varchar(255) null,
        name varchar(255) null,
        attachment_size int null,
        attachedBy_id varchar(255) null,
        TaskData_Attachments_Id numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    create table AuditTaskImpl (
        id numeric(19,0) identity not null,
        activationTime datetime null,
        actualOwner varchar(255) null,
        createdBy varchar(255) null,
        createdOn datetime null,
        deploymentId varchar(255) null,
        description varchar(255) null,
        dueDate datetime null,
        name varchar(255) null,
        parentId numeric(19,0) not null,
        priority int not null,
        processId varchar(255) null,
        processInstanceId numeric(19,0) not null,
        processSessionId numeric(19,0) not null,
        status varchar(255) null,
        taskId numeric(19,0) null,
        workItemId numeric(19,0) null,
        lastModificationDate datetime,
        primary key (id)
    ) lock datarows
    go

    create table BAMTaskSummary (
        pk numeric(19,0) identity not null,
        createdDate datetime null,
        duration numeric(19,0) null,
        endDate datetime null,
        processInstanceId numeric(19,0) not null,
        startDate datetime null,
        status varchar(255) null,
        taskId numeric(19,0) not null,
        taskName varchar(255) null,
        userId varchar(255) null,
        OPTLOCK int null,
        primary key (pk)
    ) lock datarows
    go

    create table BooleanExpression (
        id numeric(19,0) identity not null,
        expression text null,
        type varchar(255) null,
        Escalation_Constraints_Id numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    create table CaseIdInfo (
        id bigint identity not null,
        caseIdPrefix varchar(255) null,
        currentValue bigint null,
        primary key (id)
    ) lock datarows
    go

    create table CaseFileDataLog (
        id bigint identity not null,
        caseDefId varchar(255) null,
        caseId varchar(255) null,
        itemName varchar(255) null,
        itemType varchar(255) null,
        itemValue varchar(255) null,
        lastModified datetime null,
        lastModifiedBy varchar(255) null,
        primary key (id)
    ) lock datarows
    go
    create table CaseRoleAssignmentLog (
        id bigint identity not null,
        caseId varchar(255) null,
        entityId varchar(255) null,
        processInstanceId bigint not null,
        roleName varchar(255) null,
        type int not null,
        primary key (id)
    ) lock datarows
    go

    create table Content (
        id numeric(19,0) identity not null,
        content image null,
        primary key (id)
    ) lock datarows
    go

    create table ContextMappingInfo (
        mappingId numeric(19,0) identity not null,
        CONTEXT_ID varchar(255) not null,
        KSESSION_ID numeric(19,0) not null,
        OWNER_ID varchar(255) null,
        OPTLOCK int null,
        primary key (mappingId)
    ) lock datarows
    go

    create table CorrelationKeyInfo (
        keyId numeric(19,0) identity not null,
        name varchar(255) not null,
        processInstanceId numeric(19,0) not null,
        OPTLOCK int null,
        primary key (keyId)
    ) lock datarows
    go

    create table CorrelationPropertyInfo (
        propertyId numeric(19,0) identity not null,
        name varchar(255) null,
        value varchar(255) null,
        OPTLOCK int null,
        correlationKey_keyId numeric(19,0) null,
        primary key (propertyId)
    ) lock datarows
    go

    create table Deadline (
        id numeric(19,0) identity not null,
        deadline_date datetime null,
        escalated smallint null,
        Deadlines_StartDeadLine_Id numeric(19,0) null,
        Deadlines_EndDeadLine_Id numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    create table Delegation_delegates (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table DeploymentStore (
        id numeric(19,0) identity not null,
        attributes varchar(255) null,
        DEPLOYMENT_ID varchar(255) null,
        deploymentUnit text null,
        state int null,
        updateDate datetime null,
        primary key (id)
    ) lock datarows
    go

    create table ErrorInfo (
        id numeric(19,0) identity not null,
        message varchar(255) null,
        stacktrace varchar(5000) null,
        timestamp datetime null,
        REQUEST_ID numeric(19,0) not null,
        primary key (id)
    ) lock datarows
    go

    create table Escalation (
        id numeric(19,0) identity not null,
        name varchar(255) null,
        Deadline_Escalation_Id numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    create table EventTypes (
        InstanceId numeric(19,0) not null,
        element varchar(255) null
    ) lock datarows
    go

    create table ExecutionErrorInfo (
        id bigint identity not null,
        ERROR_ACK smallint null,
        ERROR_ACK_AT datetime null,
        ERROR_ACK_BY varchar(255) null,
        ACTIVITY_ID bigint null,
        ACTIVITY_NAME varchar(255) null,
        DEPLOYMENT_ID varchar(255) null,
        ERROR_INFO text null,
        ERROR_DATE datetime null,
        ERROR_ID varchar(255) null,
        ERROR_MSG varchar(255) null,
        INIT_ACTIVITY_ID bigint null,
        JOB_ID bigint null,
        PROCESS_ID varchar(255) null,
        PROCESS_INST_ID bigint null,
        ERROR_TYPE varchar(255) null,
        primary key (id)
    ) lock datarows
    go

    create table I18NText (
        id numeric(19,0) identity not null,
        language varchar(255) null,
        shortText varchar(255) null,
        text text null,
        Task_Subjects_Id numeric(19,0) null,
        Task_Names_Id numeric(19,0) null,
        Task_Descriptions_Id numeric(19,0) null,
        Reassignment_Documentation_Id numeric(19,0) null,
        Notification_Subjects_Id numeric(19,0) null,
        Notification_Names_Id numeric(19,0) null,
        Notification_Documentation_Id numeric(19,0) null,
        Notification_Descriptions_Id numeric(19,0) null,
        Deadline_Documentation_Id numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    create table NodeInstanceLog (
        id numeric(19,0) identity not null,
        connection varchar(255) null,
        log_date datetime null,
        externalId varchar(255) null,
        nodeId varchar(255) null,
        nodeInstanceId varchar(255) null,
        nodeName varchar(255) null,
        nodeType varchar(255) null,
        processId varchar(255) null,
        processInstanceId numeric(19,0) not null,
        sla_due_date datetime null,
        slaCompliance int null,
        type int not null,
        workItemId numeric(19,0) null,
        nodeContainerId varchar(255) null,
        referenceId numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    create table Notification (
        DTYPE varchar(31) not null,
        id numeric(19,0) identity not null,
        priority int not null,
        Escalation_Notifications_Id numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    create table Notification_BAs (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table Notification_Recipients (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table Notification_email_header (
        Notification_id numeric(19,0) not null,
        emailHeaders_id numeric(19,0) not null,
        mapkey varchar(255) not null,
        primary key (Notification_id, mapkey)
    ) lock datarows
    go

    create table OrganizationalEntity (
        DTYPE varchar(31) not null,
        id varchar(255) not null,
        primary key (id)
    ) lock datarows
    go

    create table PeopleAssignments_BAs (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table PeopleAssignments_ExclOwners (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table PeopleAssignments_PotOwners (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table PeopleAssignments_Recipients (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table PeopleAssignments_Stakeholders (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table ProcessInstanceInfo (
        InstanceId numeric(19,0) identity not null,
        lastModificationDate datetime null,
        lastReadDate datetime null,
        processId varchar(255) null,
        processInstanceByteArray image null,
        startDate datetime null,
        state int not null,
        OPTLOCK int null,
        primary key (InstanceId)
    ) lock datarows
    go

    create table ProcessInstanceLog (
        id numeric(19,0) identity not null,
        correlationKey varchar(255) null,
        duration numeric(19,0) null,
        end_date datetime null,
        externalId varchar(255) null,
        user_identity varchar(255) null,
        outcome varchar(255) null,
        parentProcessInstanceId numeric(19,0) null,
        processId varchar(255) null,
        processInstanceDescription varchar(255) null,
        processInstanceId numeric(19,0) not null,
        processName varchar(255) null,
        processType int null,
        processVersion varchar(255) null,
        sla_due_date datetime null,
        slaCompliance int null,
        start_date datetime null,
        status int null,
        primary key (id)
    ) lock datarows
    go

    create table QueryDefinitionStore (
        id numeric(19,0) identity not null,
        qExpression text null,
        qName varchar(255) null,
        qSource varchar(255) null,
        qTarget varchar(255) null,
        primary key (id)
    ) lock datarows
    go

    create table Reassignment (
        id numeric(19,0) identity not null,
        Escalation_Reassignments_Id numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    create table Reassignment_potentialOwners (
        task_id numeric(19,0) not null,
        entity_id varchar(255) not null
    ) lock datarows
    go

    create table RequestInfo (
        id numeric(19,0) identity not null,
        commandName varchar(255) null,
        deploymentId varchar(255) null,
        executions int not null,
        businessKey varchar(255) null,
        message varchar(255) null,
        owner varchar(255) null,
        priority int not null,
        processInstanceId numeric(19,0),
        requestData image null,
        responseData image null,
        retries int not null,
        status varchar(255) null,
        timestamp datetime null,
        primary key (id)
    ) lock datarows
    go

    create table SessionInfo (
        id numeric(19,0) identity not null,
        lastModificationDate datetime null,
        rulesByteArray image null,
        startDate datetime null,
        OPTLOCK int null,
        primary key (id)
    ) lock datarows
    go

    create table Task (
        id numeric(19,0) identity not null,
        archived smallint null,
        allowedToDelegate varchar(255) null,
        description varchar(255) null,
        formName varchar(255) null,
        name varchar(255) null,
        priority int not null,
        subTaskStrategy varchar(255) null,
        subject varchar(255) null,
        activationTime datetime null,
        createdOn datetime null,
        deploymentId varchar(255) null,
        documentAccessType int null,
        documentContentId numeric(19,0) not null,
        documentType varchar(255) null,
        expirationTime datetime null,
        faultAccessType int null,
        faultContentId numeric(19,0) not null,
        faultName varchar(255) null,
        faultType varchar(255) null,
        outputAccessType int null,
        outputContentId numeric(19,0) not null,
        outputType varchar(255) null,
        parentId numeric(19,0) not null,
        previousStatus int null,
        processId varchar(255) null,
        processInstanceId numeric(19,0) not null,
        processSessionId numeric(19,0) not null,
        skipable tinyint not null,
        status varchar(255) null,
        workItemId numeric(19,0) not null,
        taskType varchar(255) null,
        OPTLOCK int null,
        taskInitiator_id varchar(255) null,
        actualOwner_id varchar(255) null,
        createdBy_id varchar(255) null,
        primary key (id)
    ) lock datarows
    go

    create table TaskDef (
        id numeric(19,0) identity not null,
        name varchar(255) null,
        priority int not null,
        primary key (id)
    ) lock datarows
    go

    create table TaskEvent (
        id numeric(19,0) identity not null,
        logTime datetime null,
        message varchar(255) null,
        processInstanceId numeric(19,0) null,
        taskId numeric(19,0) null,
        type varchar(255) null,
        userId varchar(255) null,
        OPTLOCK int null,
        workItemId numeric(19,0) null,
        correlationKey varchar(255),
        processType int,
        primary key (id)
    ) lock datarows
    go

    create table TaskVariableImpl (
        id numeric(19,0) identity not null,
        modificationDate datetime null,
        name varchar(255) null,
        processId varchar(255) null,
        processInstanceId numeric(19,0) null,
        taskId numeric(19,0) null,
        type int null,
        value varchar(4000) null,
        primary key (id)
    ) lock datarows
    go

    create table VariableInstanceLog (
        id numeric(19,0) identity not null,
        log_date datetime null,
        externalId varchar(255) null,
        oldValue varchar(255) null,
        processId varchar(255) null,
        processInstanceId numeric(19,0) not null,
        value varchar(255) null,
        variableId varchar(255) null,
        variableInstanceId varchar(255) null,
        primary key (id)
    ) lock datarows
    go

    create table WorkItemInfo (
        workItemId numeric(19,0) identity not null,
        creationDate datetime null,
        name varchar(255) null,
        processInstanceId numeric(19,0) not null,
        state numeric(19,0) not null,
        OPTLOCK int null,
        workItemByteArray image null,
        primary key (workItemId)
    ) lock datarows
    go

    create table email_header (
        id numeric(19,0) identity not null,
        body text null,
        fromAddress varchar(255) null,
        language varchar(255) null,
        replyToAddress varchar(255) null,
        subject varchar(255) null,
        primary key (id)
    ) lock datarows
    go

    create table task_comment (
        id numeric(19,0) identity not null,
        addedAt datetime null,
        text text null,
        addedBy_id varchar(255) null,
        TaskData_Comments_Id numeric(19,0) null,
        primary key (id)
    ) lock datarows
    go

    alter table Attachment
        add constraint FK1C93543D937BFB5
        foreign key (attachedBy_id)
        references OrganizationalEntity
    go

    alter table Attachment
        add constraint FK1C9354333CA892A
        foreign key (TaskData_Attachments_Id)
        references Task
    go

    alter table BooleanExpression
        add constraint FKE3D208C06C97C90E
        foreign key (Escalation_Constraints_Id)
        references Escalation
    go

    alter table CaseIdInfo
        add constraint UK_CaseIdInfo_1 unique (caseIdPrefix)
    go

    alter table CorrelationPropertyInfo
        add constraint FK761452A5D87156ED
        foreign key (correlationKey_keyId)
        references CorrelationKeyInfo
    go

    alter table CorrelationKeyInfo add constraint IDX_CorrelationKeyInfo_name unique (name)
    go

    alter table Deadline
        add constraint FK21DF3E78A9FE0EF4
        foreign key (Deadlines_StartDeadLine_Id)
        references Task
    go

    alter table Deadline
        add constraint FK21DF3E78695E4DDB
        foreign key (Deadlines_EndDeadLine_Id)
        references Task
    go

    alter table Delegation_delegates
        add constraint FK47485D5772B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table Delegation_delegates
        add constraint FK47485D57786553A5
        foreign key (task_id)
        references Task
    go

    alter table DeploymentStore
        add constraint UK_DeploymentStore_1 unique (DEPLOYMENT_ID)
    go

    alter table ErrorInfo
        add constraint FK8B1186B6724A467
        foreign key (REQUEST_ID)
        references RequestInfo
    go

    alter table Escalation
        add constraint FK67B2C6B5D1E5CC1
        foreign key (Deadline_Escalation_Id)
        references Deadline
    go

    alter table EventTypes
        add constraint FKB0E5621F7665489A
        foreign key (InstanceId)
        references ProcessInstanceInfo
    go

    alter table I18NText
        add constraint FK2349686BF4ACCD69
        foreign key (Task_Subjects_Id)
        references Task
    go

    alter table I18NText
        add constraint FK2349686B424B187C
        foreign key (Task_Names_Id)
        references Task
    go

    alter table I18NText
        add constraint FK2349686BAB648139
        foreign key (Task_Descriptions_Id)
        references Task
    go

    alter table I18NText
        add constraint FK2349686BB340A2AA
        foreign key (Reassignment_Documentation_Id)
        references Reassignment
    go

    alter table I18NText
        add constraint FK2349686BF0CDED35
        foreign key (Notification_Subjects_Id)
        references Notification
    go

    alter table I18NText
        add constraint FK2349686BCC03ED3C
        foreign key (Notification_Names_Id)
        references Notification
    go

    alter table I18NText
        add constraint FK2349686B77C1C08A
        foreign key (Notification_Documentation_Id)
        references Notification
    go

    alter table I18NText
        add constraint FK2349686B18DDFE05
        foreign key (Notification_Descriptions_Id)
        references Notification
    go

    alter table I18NText
        add constraint FK2349686B78AF072A
        foreign key (Deadline_Documentation_Id)
        references Deadline
    go

    alter table Notification
        add constraint FK2D45DD0BC0C0F29C
        foreign key (Escalation_Notifications_Id)
        references Escalation
    go

    alter table Notification_BAs
        add constraint FK2DD68EE072B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table Notification_BAs
        add constraint FK2DD68EE093F2090B
        foreign key (task_id)
        references Notification
    go

    alter table Notification_Recipients
        add constraint FK98FD214E72B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table Notification_Recipients
        add constraint FK98FD214E93F2090B
        foreign key (task_id)
        references Notification
    go

    alter table Notification_email_header
        add constraint UK_F30FE3446CEA0510 unique (emailHeaders_id)
    go

    alter table Notification_email_header
        add constraint FKF30FE3448BED1339
        foreign key (emailHeaders_id)
        references email_header
    go

    alter table Notification_email_header
        add constraint FKF30FE3443E3E97EB
        foreign key (Notification_id)
        references Notification
    go

    alter table PeopleAssignments_BAs
        add constraint FK9D8CF4EC72B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table PeopleAssignments_BAs
        add constraint FK9D8CF4EC786553A5
        foreign key (task_id)
        references Task
    go

    alter table PeopleAssignments_ExclOwners
        add constraint FKC77B97E472B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table PeopleAssignments_ExclOwners
        add constraint FKC77B97E4786553A5
        foreign key (task_id)
        references Task
    go

    alter table PeopleAssignments_PotOwners
        add constraint FK1EE418D72B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table PeopleAssignments_PotOwners
        add constraint FK1EE418D786553A5
        foreign key (task_id)
        references Task
    go

    alter table PeopleAssignments_Recipients
        add constraint FKC6F615C272B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table PeopleAssignments_Recipients
        add constraint FKC6F615C2786553A5
        foreign key (task_id)
        references Task
    go

    alter table PeopleAssignments_Stakeholders
        add constraint FK482F79D572B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table PeopleAssignments_Stakeholders
        add constraint FK482F79D5786553A5
        foreign key (task_id)
        references Task
    go

    alter table QueryDefinitionStore
        add constraint UK_4ry5gt77jvq0orfttsoghta2j unique (qName)
    go

    alter table Reassignment
        add constraint FK724D056062A1E871
        foreign key (Escalation_Reassignments_Id)
        references Escalation
    go

    alter table Reassignment_potentialOwners
        add constraint FK90B59CFF72B3A123
        foreign key (entity_id)
        references OrganizationalEntity
    go

    alter table Reassignment_potentialOwners
        add constraint FK90B59CFF35D2FEE0
        foreign key (task_id)
        references Reassignment
    go

    alter table Task
        add constraint FK27A9A53C55C806
        foreign key (taskInitiator_id)
        references OrganizationalEntity
    go

    alter table Task
        add constraint FK27A9A5B723BE8B
        foreign key (actualOwner_id)
        references OrganizationalEntity
    go

    alter table Task
        add constraint FK27A9A55427E8F1
        foreign key (createdBy_id)
        references OrganizationalEntity
    go

    alter table task_comment
        add constraint FK61F475A57A3215D9
        foreign key (addedBy_id)
        references OrganizationalEntity
    go

    alter table task_comment
        add constraint FK61F475A5F510CB46
        foreign key (TaskData_Comments_Id)
        references Task
    go

    create index IDX_Attachment_Id ON Attachment(attachedBy_id)
    go
    create index IDX_Attachment_DataId ON Attachment(TaskData_Attachments_Id)
    go
    create index IDX_BoolExpr_Id ON BooleanExpression(Escalation_Constraints_Id)
    go
    create index IDX_CorrPropInfo_Id ON CorrelationPropertyInfo(correlationKey_keyId)
    go
    create index IDX_Deadline_StartId ON Deadline(Deadlines_StartDeadLine_Id)
    go
    create index IDX_Deadline_EndId ON Deadline(Deadlines_EndDeadLine_Id)
    go
    create index IDX_Delegation_EntityId ON Delegation_delegates(entity_id)
    go
    create index IDX_Delegation_TaskId ON Delegation_delegates(task_id)
    go
    create index IDX_ErrorInfo_Id ON ErrorInfo(REQUEST_ID)
    go
    create index IDX_Escalation_Id ON Escalation(Deadline_Escalation_Id)
    go
    create index IDX_EventTypes_Id ON EventTypes(InstanceId)
    go
    create index IDX_I18NText_SubjId ON I18NText(Task_Subjects_Id)
    go
    create index IDX_I18NText_NameId ON I18NText(Task_Names_Id)
    go
    create index IDX_I18NText_DescrId ON I18NText(Task_Descriptions_Id)
    go
    create index IDX_I18NText_ReassignId ON I18NText(Reassignment_Documentation_Id)
    go
    create index IDX_I18NText_NotSubjId ON I18NText(Notification_Subjects_Id)
    go
    create index IDX_I18NText_NotNamId ON I18NText(Notification_Names_Id)
    go
    create index IDX_I18NText_NotDocId ON I18NText(Notification_Documentation_Id)
    go
    create index IDX_I18NText_NotDescrId ON I18NText(Notification_Descriptions_Id)
    go
    create index IDX_I18NText_DeadDocId ON I18NText(Deadline_Documentation_Id)
    go
    create index IDX_Not_EscId ON Notification(Escalation_Notifications_Id)
    go
    create index IDX_NotBAs_Entity ON Notification_BAs(entity_id)
    go
    create index IDX_NotBAs_Task ON Notification_BAs(task_id)
    go
    create index IDX_NotRec_Entity ON Notification_Recipients(entity_id)
    go
    create index IDX_NotRec_Task ON Notification_Recipients(task_id)
    go
    create index IDX_NotEmail_Header ON Notification_email_header(emailHeaders_id)
    go
    create index IDX_NotEmail_Not ON Notification_email_header(Notification_id)
    go
    create index IDX_PAsBAs_Entity ON PeopleAssignments_BAs(entity_id)
    go
    create index IDX_PAsBAs_Task ON PeopleAssignments_BAs(task_id)
    go
    create index IDX_PAsExcl_Entity ON PeopleAssignments_ExclOwners(entity_id)
    go
    create index IDX_PAsExcl_Task ON PeopleAssignments_ExclOwners(task_id)
    go
    create index IDX_PAsPot_TaskEntity ON PeopleAssignments_PotOwners(task_id,entity_id)
    go
    create index IDX_PAsRecip_Entity ON PeopleAssignments_Recipients(entity_id)
    go
    create index IDX_PAsRecip_Task ON PeopleAssignments_Recipients(task_id)
    go
    create index IDX_PAsStake_Entity ON PeopleAssignments_Stakeholders(entity_id)
    go
    create index IDX_PAsStake_Task ON PeopleAssignments_Stakeholders(task_id)
    go
    create index IDX_Reassign_Esc ON Reassignment(Escalation_Reassignments_Id)
    go
    create index IDX_ReassignPO_Entity ON Reassignment_potentialOwners(entity_id)
    go
    create index IDX_ReassignPO_Task ON Reassignment_potentialOwners(task_id)
    go
    create index IDX_Task_Initiator ON Task(taskInitiator_id)
    go
    create index IDX_Task_ActualOwner ON Task(actualOwner_id)
    go
    create index IDX_Task_CreatedBy ON Task(createdBy_id)
    go
    create index IDX_TaskComments_CreatedBy ON task_comment(addedBy_id)
    go
    create index IDX_TaskComments_Id ON task_comment(TaskData_Comments_Id)
    go

    create index IDX_Task_processInstanceId on Task(processInstanceId)
    go
    create index IDX_Task_processId on Task(processId)
    go
    create index IDX_Task_status on Task(status)
    go
    create index IDX_Task_archived on Task(archived)
    go
    create index IDX_Task_workItemId on Task(workItemId)
    go

    create index IDX_TaskEvent_taskId on TaskEvent (taskId)
    go

    create index IDX_EventTypes_element ON EventTypes(element)
    go

    create index IDX_CMI_Context ON ContextMappingInfo(CONTEXT_ID)
    go
    create index IDX_CMI_KSession ON ContextMappingInfo(KSESSION_ID)
    go
    create index IDX_CMI_Owner ON ContextMappingInfo(OWNER_ID)
    go

    create index IDX_RequestInfo_status ON RequestInfo(status)
    go
    create index IDX_RequestInfo_timestamp ON RequestInfo(timestamp)
    go
    create index IDX_RequestInfo_owner ON RequestInfo(owner)
    go

    create index IDX_BAMTaskSumm_createdDate on BAMTaskSummary(createdDate)
    go
    create index IDX_BAMTaskSumm_duration on BAMTaskSummary(duration)
    go
    create index IDX_BAMTaskSumm_endDate on BAMTaskSummary(endDate)
    go
    create index IDX_BAMTaskSumm_pInstId on BAMTaskSummary(processInstanceId)
    go
    create index IDX_BAMTaskSumm_startDate on BAMTaskSummary(startDate)
    go
    create index IDX_BAMTaskSumm_status on BAMTaskSummary(status)
    go
    create index IDX_BAMTaskSumm_taskId on BAMTaskSummary(taskId)
    go
    create index IDX_BAMTaskSumm_taskName on BAMTaskSummary(taskName)
    go
    create index IDX_BAMTaskSumm_userId on BAMTaskSummary(userId)
    go

    create index IDX_PInstLog_duration on ProcessInstanceLog(duration)
    go
    create index IDX_PInstLog_end_date on ProcessInstanceLog(end_date)
    go
    create index IDX_PInstLog_extId on ProcessInstanceLog(externalId)
    go
    create index IDX_PInstLog_user_identity on ProcessInstanceLog(user_identity)
    go
    create index IDX_PInstLog_outcome on ProcessInstanceLog(outcome)
    go
    create index IDX_PInstLog_parentPInstId on ProcessInstanceLog(parentProcessInstanceId)
    go
    create index IDX_PInstLog_pId on ProcessInstanceLog(processId)
    go
    create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription)
    go
    create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId)
    go
    create index IDX_PInstLog_pName on ProcessInstanceLog(processName)
    go
    create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion)
    go
    create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date)
    go
    create index IDX_PInstLog_status on ProcessInstanceLog(status)
    go
    create index IDX_PInstLog_correlation on ProcessInstanceLog(correlationKey)
    go

    create index IDX_VInstLog_pInstId on VariableInstanceLog(processInstanceId)
    go
    create index IDX_VInstLog_varId on VariableInstanceLog(variableId)
    go
    create index IDX_VInstLog_pId on VariableInstanceLog(processId)
    go

    create index IDX_NInstLog_pInstId on NodeInstanceLog(processInstanceId)
    go
    create index IDX_NInstLog_nodeType on NodeInstanceLog(nodeType)
    go
    create index IDX_NInstLog_pId on NodeInstanceLog(processId)
    go
    create index IDX_NInstLog_workItemId on NodeInstanceLog (workItemId)
    go

    create index IDX_ErrorInfo_pInstId on ExecutionErrorInfo(PROCESS_INST_ID)
    go
    create index IDX_ErrorInfo_errorAck on ExecutionErrorInfo(ERROR_ACK)
    go

    create index IDX_AuditTaskImpl_taskId on AuditTaskImpl(taskId)
    go
    create index IDX_AuditTaskImpl_pInstId on AuditTaskImpl(processInstanceId)
    go
    create index IDX_AuditTaskImpl_workItemId on AuditTaskImpl(workItemId)
    go
    create index IDX_AuditTaskImpl_name on AuditTaskImpl(name)
    go
    create index IDX_AuditTaskImpl_processId on AuditTaskImpl(processId)
    go
    create index IDX_AuditTaskImpl_status on AuditTaskImpl(status)
    go

    create index IDX_TaskVariableImpl_taskId on TaskVariableImpl(taskId)
    go
    create index IDX_TaskVariableImpl_pInstId on TaskVariableImpl(processInstanceId)
    go
    create index IDX_TaskVariableImpl_processId on TaskVariableImpl(processId)
    go


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
   xmlns:mvc="http://www.springframework.org/schema/mvc"
   xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">

   <context:component-scan base-package="cz.jiripinkas.abcvids.controller" />

   <bean id="viewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="/WEB-INF/jsp/" />
      <property name="suffix" value=".jsp" />
   </bean>

   <mvc:annotation-driven />

   <mvc:interceptors>
      <bean class="cz.jiripinkas.abcvids.interceptors.SettingsInterceptor" />
   </mvc:interceptors>

</beans>


text:
Crawler for get proxies

## Requeriments

* Docker 1.5 ou higher

## How to build one docker image

    make build

## shell

run interactive docker with  scrapy 1.0.1

    make shell

## Start xroxy crawler

    make run


text:
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

	Issue 1668

NotoNaskhArabic.ttf:

ړ ټ ڼ ډ

NotoNaskhArabicUI.ttf:

ړ ټ ڼ ډ


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CopyAndLineObjects : MonoBehaviour {
    public GameObject gameObject;
    public int num;
    public float offsetX;

	// Use this for initialization
	void Awake () {
        for (int i = 0; i < num; ++i)
        {
            var originRectTransForm = gameObject.GetComponent<RectTransform>();
            var newObj = GameObject.Instantiate(gameObject,gameObject.transform.parent);
            var rectTransform = newObj.GetComponent<RectTransform>();
            rectTransform.position = new Vector3(originRectTransForm.position.x + i * offsetX, originRectTransForm.position.y, originRectTransForm.position.z);
        }
	}

	// Update is called once per frame
	void Update () {

	}
}


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* CompressSocket.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using AM;
using AM.IO;

using CodeJam;

using JetBrains.Annotations;

using MoonSharp.Interpreter;

#endregion

namespace ManagedIrbis.Infrastructure.Sockets
{
    /// <summary>
    /// Сжимает содержимое пакета для экономии трафика.
    /// </summary>
    [PublicAPI]
    [MoonSharpUserData]
    public sealed class CompressSocket
        : AbstractClientSocket
    {
        #region Construction

        /// <summary>
        /// Constructor.
        /// </summary>
        public CompressSocket
            (
                [NotNull] IrbisConnection connection,
                [NotNull] AbstractClientSocket innerSocket
            )
            : base(connection)
        {
            Code.NotNull(connection, "connection");
            Code.NotNull(innerSocket, "innerSocket");

            InnerSocket = innerSocket;
        }

        #endregion

        #region Public methods

        #endregion

        #region AbstractClientSocket members

        /// <inheritdoc cref="AbstractClientSocket.AbortRequest"/>
        public override void AbortRequest()
        {
            InnerSocket.ThrowIfNull().AbortRequest();
        }

        /// <inheritdoc cref="AbstractClientSocket.ExecuteRequest"/>
        public override byte[] ExecuteRequest
            (
                byte[][] request
            )
        {
            Code.NotNull(request, "request");

            byte[][] compressed = new byte[1][];
            byte[] merged = ArrayUtility.Merge(request);
            compressed[0] = CompressionUtility.Compress(merged);
            byte[] result = InnerSocket.ThrowIfNull().ExecuteRequest(compressed);
            result = CompressionUtility.Decompress(result);

            return result;
        }

        #endregion
    }
}


text:
package main

import (
	"flag"
	"net"
	"strconv"
	"sync"
	"time"

	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/grpclog"
	"google.golang.org/grpc/interop"
	testpb "google.golang.org/grpc/interop/grpc_testing"
)

var (
	serverHost = flag.String("server_host", "127.0.0.1", "The server host name")
	serverPort = flag.Int("server_port", 8080, "The server port number")
	testCase   = flag.String("test_case", "goaway",
		`Configure different test cases. Valid options are:
        goaway : client sends two requests, the server will send a goaway in between;
        rst_after_header : server will send rst_stream after it sends headers;
        rst_during_data : server will send rst_stream while sending data;
        rst_after_data : server will send rst_stream after sending data;
        ping : server will send pings between each http2 frame;
        max_streams : server will ensure that the max_concurrent_streams limit is upheld;`)
	largeReqSize  = 271828
	largeRespSize = 314159
)

func largeSimpleRequest() *testpb.SimpleRequest {
	pl := interop.ClientNewPayload(testpb.PayloadType_COMPRESSABLE, largeReqSize)
	return &testpb.SimpleRequest{
		ResponseType: testpb.PayloadType_COMPRESSABLE,
		ResponseSize: int32(largeRespSize),
		Payload:      pl,
	}
}

// sends two unary calls. The server asserts that the calls use different connections.
func goaway(tc testpb.TestServiceClient) {
	interop.DoLargeUnaryCall(tc)
	// sleep to ensure that the client has time to recv the GOAWAY.
	// TODO(ncteisen): make this less hacky.
	time.Sleep(1 * time.Second)
	interop.DoLargeUnaryCall(tc)
}

func rstAfterHeader(tc testpb.TestServiceClient) {
	req := largeSimpleRequest()
	reply, err := tc.UnaryCall(context.Background(), req)
	if reply != nil {
		grpclog.Fatalf("Client received reply despite server sending rst stream after header")
	}
	if grpc.Code(err) != codes.Internal {
		grpclog.Fatalf("%v.UnaryCall() = _, %v, want _, %v", tc, grpc.Code(err), codes.Internal)
	}
}

func rstDuringData(tc testpb.TestServiceClient) {
	req := largeSimpleRequest()
	reply, err := tc.UnaryCall(context.Background(), req)
	if reply != nil {
		grpclog.Fatalf("Client received reply despite server sending rst stream during data")
	}
	if grpc.Code(err) != codes.Unknown {
		grpclog.Fatalf("%v.UnaryCall() = _, %v, want _, %v", tc, grpc.Code(err), codes.Unknown)
	}
}

func rstAfterData(tc testpb.TestServiceClient) {
	req := largeSimpleRequest()
	reply, err := tc.UnaryCall(context.Background(), req)
	if reply != nil {
		grpclog.Fatalf("Client received reply despite server sending rst stream after data")
	}
	if grpc.Code(err) != codes.Internal {
		grpclog.Fatalf("%v.UnaryCall() = _, %v, want _, %v", tc, grpc.Code(err), codes.Internal)
	}
}

func ping(tc testpb.TestServiceClient) {
	// The server will assert that every ping it sends was ACK-ed by the client.
	interop.DoLargeUnaryCall(tc)
}

func maxStreams(tc testpb.TestServiceClient) {
	interop.DoLargeUnaryCall(tc)
	var wg sync.WaitGroup
	for i := 0; i < 15; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			interop.DoLargeUnaryCall(tc)
		}()
	}
	wg.Wait()
}

func main() {
	flag.Parse()
	serverAddr := net.JoinHostPort(*serverHost, strconv.Itoa(*serverPort))
	var opts []grpc.DialOption
	opts = append(opts, grpc.WithInsecure())
	conn, err := grpc.Dial(serverAddr, opts...)
	if err != nil {
		grpclog.Fatalf("Fail to dial: %v", err)
	}
	defer conn.Close()
	tc := testpb.NewTestServiceClient(conn)
	switch *testCase {
	case "goaway":
		goaway(tc)
		grpclog.Println("goaway done")
	case "rst_after_header":
		rstAfterHeader(tc)
		grpclog.Println("rst_after_header done")
	case "rst_during_data":
		rstDuringData(tc)
		grpclog.Println("rst_during_data done")
	case "rst_after_data":
		rstAfterData(tc)
		grpclog.Println("rst_after_data done")
	case "ping":
		ping(tc)
		grpclog.Println("ping done")
	case "max_streams":
		maxStreams(tc)
		grpclog.Println("max_streams done")
	default:
		grpclog.Fatal("Unsupported test case: ", *testCase)
	}
}