text:
<?php

namespace Sidus\FilterBundle\Pagination;

use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query\AST\AggregateExpression;
use Doctrine\ORM\Query\AST\PathExpression;
use Doctrine\ORM\Query\AST\SelectExpression;
use Doctrine\ORM\Query\AST\SelectStatement;
use Doctrine\ORM\Query\SqlWalker;

/**
 * Custom CountOutputWalker copied from Doctrine with huge performance improvements and fix for Oracle
 *
 * @author  Madeline Veyrenc <mveyrenc@clever-age.com>
 */
class CountOutputWalker extends SqlWalker
{
    /**
     * @var \Doctrine\DBAL\Platforms\AbstractPlatform
     */
    private $platform;

    /**
     * Stores various parameters that are otherwise unavailable
     * because Doctrine\ORM\Query\SqlWalker keeps everything private without
     * accessors.
     *
     * @param \Doctrine\ORM\Query              $query
     * @param \Doctrine\ORM\Query\ParserResult $parserResult
     * @param array                            $queryComponents
     *
     * @throws \Doctrine\DBAL\DBALException
     */
    public function __construct($query, $parserResult, array $queryComponents)
    {
        $this->platform = $query->getEntityManager()->getConnection()->getDatabasePlatform();

        parent::__construct($query, $parserResult, $queryComponents);
    }

    /**
     * Walks down a SelectStatement AST node, wrapping it in a COUNT (SELECT DISTINCT).
     *
     * Note that the ORDER BY clause is not removed. Many SQL implementations (e.g. MySQL)
     * are able to cache subqueries. By keeping the ORDER BY clause intact, the limitSubQuery
     * that will most likely be executed next can be read from the native SQL cache.
     *
     * @param SelectStatement $AST
     *
     * @throws \RuntimeException
     * @throws \Doctrine\ORM\Mapping\MappingException
     * @throws \Doctrine\ORM\OptimisticLockException
     * @throws \Doctrine\ORM\Query\QueryException
     *
     * @return string
     */
    public function walkSelectStatement(SelectStatement $AST)
    {
        if ('mssql' === $this->platform->getName()) {
            $AST->orderByClause = null;
        }

        if ($AST->groupByClause) {
            $countExpr = $this->platform->getCountExpression('*');
            $sql = parent::walkSelectStatement($AST);

            return "SELECT {$countExpr} AS dctrn_count FROM ({$sql}) dctrn_table";
        }

        $this->getQuery()->setHint(self::HINT_DISTINCT, true);

        if ($AST->havingClause) {
            throw new \RuntimeException(
                'Cannot count query that uses a HAVING clause. Use the output walkers for pagination'
            );
        }

        // Get the root entity and alias from the AST fromClause
        $from = $AST->fromClause->identificationVariableDeclarations;

        if (\count($from) > 1) {
            throw new \RuntimeException(
                'Cannot count query which selects two FROM components, cannot make distinction'
            );
        }

        $fromRoot = reset($from);
        $rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
        /** @var ClassMetadata $rootClass */
        $rootClass = $this->getQueryComponent($rootAlias)['metadata'];
        $identifierFieldName = $rootClass->getSingleIdentifierFieldName();

        $pathType = PathExpression::TYPE_STATE_FIELD;
        if (isset($rootClass->associationMappings[$identifierFieldName])) {
            $pathType = PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION;
        }

        $pathExpression = new PathExpression(
            PathExpression::TYPE_STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION,
            $rootAlias,
            $identifierFieldName
        );
        $pathExpression->type = $pathType;

        $distinct = $this->getQuery()->getHint(self::HINT_DISTINCT);
        $AST->selectClause->selectExpressions = [
            new SelectExpression(
                new AggregateExpression('COUNT', $pathExpression, $distinct),
                null
            ),
        ];

        // ORDER BY is not needed, only increases query execution through unnecessary sorting.
        $AST->orderByClause = null;

        $sql = parent::walkSelectStatement($AST);

        return str_replace(
            "AS {$this->platform->getSQLResultCasing('sclr_0')} FROM",
            "AS {$this->platform->getSQLResultCasing('dctrn_count')} FROM",
            $sql
        );
    }
}


text:
/**
 * @author bjcul
 *
 */
module inflexion {
	exports bjc.inflexion.nouns;
	exports bjc.inflexion.examples;
	exports bjc.inflexion;

	requires junit;
	requires org.apache.commons.compress;
}

redpajama_set_name: RedPajamaGithub


text:
<!--[metadata]>
+++
title = "Generic"
description = "Generic driver for machine"
keywords = ["machine, Generic, driver"]
[menu.main]
parent="smn_machine_drivers"
+++
<![end-metadata]-->

# Generic

Create machines using an existing VM/Host with SSH.

This is useful if you are using a provider that Machine does not support
directly or if you would like to import an existing host to allow Docker
Machine to manage.

The driver will perform a list of tasks on create:

-   If docker is not running on the host, it will be installed automatically.
-   It will update the host packages (`apt-get update`, `yum update`...).
-   It will generate certificates to secure the docker daemon.
-   The docker daemon will be restarted, thus all running containers will be stopped.
-   The hostname will be changed to fit the machine name.

### Example

To create a machine instance, specify `--driver generic`, the IP address or DNS
name of the host and the path to the SSH private key authorized to connect
to the host.

    $ docker-machine create \
      --driver generic \
      --generic-ip-address=203.0.113.81 \
      --generic-ssh-key ~/.ssh/id_rsa \
      vm

### Sudo privileges

The user that is used to SSH into the host can be specified with
`--generic-ssh-user` flag. This user has to have password-less sudo
privileges.
If it's not the case, you need to edit the `sudoers` file and configure the user
as a sudoer with `NOPASSWD`. See https://help.ubuntu.com/community/Sudoers.

### Options

-   `--generic-engine-port`: Port to use for Docker Daemon (Note: This flag will not work with boot2docker).
-   `--generic-ip-address`: **required** IP Address of host.
-   `--generic-ssh-key`: Path to the SSH user private key.
-   `--generic-ssh-user`: SSH username used to connect.
-   `--generic-ssh-port`: Port to use for SSH.

> **Note**: You must use a base operating system supported by Machine.

#### Environment variables and default values

| CLI option                 | Environment variable | Default                   |
| -------------------------- | -------------------- | ------------------------- |
| `--generic-engine-port`    | `GENERIC_ENGINE_PORT`| `2376`                    |
| **`--generic-ip-address`** | `GENERIC_IP_ADDRESS` | -                         |
| `--generic-ssh-key`        | `GENERIC_SSH_KEY`    | -                         |
| `--generic-ssh-user`       | `GENERIC_SSH_USER`   | `root`                    |
| `--generic-ssh-port`       | `GENERIC_SSH_PORT`   | `22`                      |


text:
using System;
using System.IO;
using Cassette.IO;
using Cassette.Utilities;

namespace Cassette.BundleProcessing
{
    class CompileAsset : IAssetTransformer
    {
        public CompileAsset(ICompiler compiler, IDirectory rootDirectory)
        {
            this.compiler = compiler;
            this.rootDirectory = rootDirectory;
        }

        readonly ICompiler compiler;
        readonly IDirectory rootDirectory;

        public Func<Stream> Transform(Func<Stream> openSourceStream, IAsset asset)
        {
            return delegate
            {
                using (var input = new StreamReader(openSourceStream()))
                {
                    var compileResult = Compile(asset, input);
                    AddRawFileReferenceForEachImportedFile(asset, compileResult);
                    return compileResult.Output.AsStream();
                }
            };
        }

        CompileResult Compile(IAsset asset, StreamReader input)
        {
            var context = CreateCompileContext(asset);
            return compiler.Compile(input.ReadToEnd(), context);
        }

        CompileContext CreateCompileContext(IAsset asset)
        {
            return new CompileContext
            {
                SourceFilePath = asset.Path,
                RootDirectory = rootDirectory
            };
        }

        void AddRawFileReferenceForEachImportedFile(IAsset asset, CompileResult compileResult)
        {
            foreach (var importedFilePath in compileResult.ImportedFilePaths)
            {
                asset.AddRawFileReference(importedFilePath);
            }
        }
    }
}


text:
package com.senacor.ddt.objectmatrix.csv;

import java.io.IOException;
import java.io.Reader;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import au.com.bytecode.opencsv.CSVReader;

import com.senacor.ddt.objectmatrix.DefaultStringMatrix;
import com.senacor.ddt.objectmatrix.StringMatrix;
import com.senacor.ddt.objectmatrix.DefaultStringMatrix.StringMatrixReader;
import com.senacor.ddt.util.ParamChecker;

/**
 * A StringMatrixReader implementation that loads a CSV (Character Separated Value) file into memory and then provides
 * indexed-based access to the contained values. Whitespace surrounding field values is trimmed.
 *

 * The delimiting character separating the values can be specified, even as a Regular Expression (internally
 * {@link String#split(String, int)} is used).
 *

 * All lines in the CSV file must have the same number of delimiters, i.e. the same number of fields.
 *
 * @author Carl-Eric Menzel
 * @version $Id$
 */
public class CsvStringMatrixReader implements StringMatrixReader {
  private static final Log log = LogFactory.getLog(CsvStringMatrixReader.class);

  /**
   * This array contains the full data of the CSV file that was read in. The first index selects the column, the second
   * index selects the row.
   *

   * This makes filling the array a little awkward when reading the file line by line, but it correctly represents the
   * natural way to access fields in a matrix and also matches the parameter order of all applicable methods in
   * StringMatrix and ObjectMatrix.
   */
  private final String[][] data;

  private final int rows;

  private final int columns;

  private final String identifier;

  private final char delim;

  /**
   * Construct a CsvStringMatrixReader instance, reading the CSV file from the given {@link Reader} and using the given
   * delimiter to split the lines into fields. The entire file will be read into memory by this constructor.
   *
   * @param input
   *          A Reader providing the CSV file. Must not be null.
   * @param delimiter
   *          The delimiter used to separate the values in each line. Must not be empty.
   * @param identifier
   *          An arbitrary identifier for the StringMatrix ({@link StringMatrix#getMatrixIdentifier()}). Must not be
   *          null.
   * @throws IOException
   *           If the file cannot be read.
   * @throws IllegalArgumentException
   *           If
   *

   *
any of the parameters is null

not all lines in the CSV file have the same number of fields
   *

the file is empty

   *

   */
  public CsvStringMatrixReader(final Reader input, final char delimiter, final String identifier) throws IOException,
      IllegalArgumentException {
    ParamChecker.notNull("input", input);
    ParamChecker.notBlank("delimiter", delimiter);
    ParamChecker.notNull("identifier", identifier);
    this.identifier = identifier;
    this.delim = delimiter;

    final List lines = readFile(input);
    this.data = buildArray(lines);
    this.rows = this.data[0].length;
    this.columns = this.data.length;
    if (log.isDebugEnabled()) {
      log.debug("Loaded CSV file with " + this.rows + " rows and " + this.columns + " columns.");
    }
  }

  /**
   * Read the entire file line-by-line and return the result as a list.
   *
   * @param input
   *          the file to be read
   * @return a list of strings representing each line in the file
   * @throws IOException
   *           if something goes wrong
   */
  private List readFile(final Reader input) throws IOException {
    return new CSVReader(input, this.delim).readAll();
  }

  /**
   * Convert the list of lines to a String[][] array by splitting each line into fields using the given delimiter regex.
   *
   * @param lines
   *          List of lines
   * @return the 2-dimensional string array
   */
  private String[][] buildArray(final List lines) {
    assert !lines.isEmpty() : "lines is unexpectedly empty";

    final int numberOfLines = lines.size();

    final String[] firstLine = (String[]) lines.get(0);
    final int numberOfFields = firstLine.length;

    final String[][] result = new String[numberOfFields][numberOfLines];
    for (int currentRow = 0; currentRow < lines.size(); currentRow++) {
      final String[] currentLine = (String[]) lines.get(currentRow);
      final boolean lineIsEmpty;
      if ((currentLine.length == 0) || ((currentLine.length == 1) && (currentLine[0].trim().length() == 0))) {
        // OpenCSV's CSVReader gives us a 1-element string array containing an empty string, if it
        // encounters
        // an empty line. we just want to skip over empty lines:
        lineIsEmpty = true;
      } else {
        if (currentLine.length != numberOfFields) {
          throw new IllegalArgumentException("Field count in line " + currentRow
              + " differs from field count in first line");
        }
        lineIsEmpty = false;
      }
      for (int currentColumn = 0; currentColumn < numberOfFields; currentColumn++) {
        // since we read line by line the outer loop walks over the rows and the inner loop over the
        // columns.
        // thus the filling of the array is a little awkward (faster-counting index is the first
        // index),
        // but as explained at {@link #data} this makes for more convenient reading access.
        result[currentColumn][currentRow] = lineIsEmpty ? "" : currentLine[currentColumn].trim();
      }
    }

    return result;
  }

  /**
   * Returns the String at the given position in the matrix/array.
   *
   * @see DefaultStringMatrix.StringMatrixReader#getString(int, int)
   */
  public String getString(final int colIndex, final int rowIndex) throws IndexOutOfBoundsException {
    return this.data[colIndex][rowIndex];
  }

  /**
   * @see com.senacor.ddt.objectmatrix.DefaultStringMatrix.StringMatrixReader#getNumberOfRows()
   */
  public int getNumberOfRows() {
    return this.rows;
  }

  /**
   * @see com.senacor.ddt.objectmatrix.DefaultStringMatrix.StringMatrixReader#getNumberOfColumns()
   */
  public int getNumberOfColumns() {
    return this.columns;
  }

  /**
   * @see com.senacor.ddt.objectmatrix.DefaultStringMatrix.StringMatrixReader#getIdentifier()
   */
  public String getIdentifier() {
    return this.identifier;
  }
}


text:
package com.android.server.wm;

public class BlackFrame
{
  // Constructors

  public BlackFrame(android.view.SurfaceSession arg1, android.graphics.Rect arg2, android.graphics.Rect arg3, int arg4) throws android.view.Surface.OutOfResourcesException{
  }
  // Methods

  public void kill(){
  }
  public void hide(){
  }
  public void setMatrix(android.graphics.Matrix arg1){
  }
  public void clearMatrix(){
  }
}


text:
#include "lib.h"
#include "array.h"
#include "mail-storage-private.h"
#include "test-mail-storage.h"

#define TEST_UID_VALIDITY 1

static bool test_mailbox_is_readonly(struct mailbox *box ATTR_UNUSED)
{
	return FALSE;
}

static bool test_mailbox_allow_new_keywords(struct mailbox *box ATTR_UNUSED)
{
	return TRUE;
}

static int test_mailbox_enable(struct mailbox *box,
			       enum mailbox_feature features)
{
	box->enabled_features |= features;
	return 0;
}

static int test_mailbox_open(struct mailbox *box ATTR_UNUSED)
{
	return 0;
}

static void test_mailbox_close(struct mailbox *box ATTR_UNUSED)
{
}

static int
test_mailbox_create(struct mailbox *box,
		    const struct mailbox_update *update ATTR_UNUSED,
		    bool directory ATTR_UNUSED)
{
	mail_storage_set_error(box->storage, MAIL_ERROR_NOTPOSSIBLE,
			       "Test mailbox creation isn't supported");
	return -1;
}

static int
test_mailbox_update(struct mailbox *box,
		    const struct mailbox_update *update ATTR_UNUSED)
{
	mail_storage_set_error(box->storage, MAIL_ERROR_NOTPOSSIBLE,
			       "Test mailbox update isn't supported");
	return -1;
}

static int test_mailbox_delete(struct mailbox *box)
{
	mail_storage_set_error(box->storage, MAIL_ERROR_NOTPOSSIBLE,
			       "Test mailbox delete isn't supported");
	return -1;
}

static int test_mailbox_rename(struct mailbox *src,
			       struct mailbox *dest ATTR_UNUSED,
			       bool rename_children ATTR_UNUSED)
{
	mail_storage_set_error(src->storage, MAIL_ERROR_NOTPOSSIBLE,
			       "Test mailbox rename isn't supported");
	return -1;
}

static void test_mailbox_get_status(struct mailbox *box ATTR_UNUSED,
				    enum mailbox_status_items items ATTR_UNUSED,
				    struct mailbox_status *status_r)
{
	memset(status_r, 0, sizeof(*status_r));
	status_r->uidvalidity = TEST_UID_VALIDITY;
	status_r->uidnext = 1;
}

static struct mailbox_sync_context *
test_mailbox_sync_init(struct mailbox *box,
		       enum mailbox_sync_flags flags ATTR_UNUSED)
{
	struct mailbox_sync_context *ctx;

	ctx = i_new(struct mailbox_sync_context, 1);
	ctx->box = box;
	return ctx;
}

static bool
test_mailbox_sync_next(struct mailbox_sync_context *ctx ATTR_UNUSED,
		       struct mailbox_sync_rec *sync_rec_r ATTR_UNUSED)
{
	return FALSE;
}

static int
test_mailbox_sync_deinit(struct mailbox_sync_context *ctx,
			 struct mailbox_sync_status *status_r)
{
	if (status_r != NULL)
		memset(status_r, 0, sizeof(*status_r));
	i_free(ctx);
	return 0;
}

static void test_mailbox_notify_changes(struct mailbox *box ATTR_UNUSED)
{
}

static struct mailbox_transaction_context *
test_mailbox_transaction_begin(struct mailbox *box,
			       enum mailbox_transaction_flags flags)
{
	struct mailbox_transaction_context *ctx;

	ctx = i_new(struct mailbox_transaction_context, 1);
	ctx->box = box;
	ctx->flags = flags;
	i_array_init(&ctx->module_contexts, 5);
	return ctx;
}

static void
test_mailbox_transaction_rollback(struct mailbox_transaction_context *t)
{
	array_free(&t->module_contexts);
	i_free(t);
}

static int
test_mailbox_transaction_commit(struct mailbox_transaction_context *t,
				struct mail_transaction_commit_changes *changes_r)
{
	changes_r->uid_validity = TEST_UID_VALIDITY;
	test_mailbox_transaction_rollback(t);
	return 0;
}

static void
test_mailbox_transaction_set_max_modseq(struct mailbox_transaction_context *t ATTR_UNUSED,
					uint64_t max_modseq ATTR_UNUSED,
					ARRAY_TYPE(seq_range) *seqs ATTR_UNUSED)
{
}

static int
test_mailbox_keywords_create(struct mailbox *box ATTR_UNUSED,
			     const char *const keywords[] ATTR_UNUSED,
			     struct mail_keywords **keywords_r,
			     bool skip_invalid ATTR_UNUSED)
{
	*keywords_r = i_new(struct mail_keywords, 1);
	(*keywords_r)->refcount = 1;
	return 0;
}

static struct mail_keywords *
test_mailbox_keywords_create_from_indexes(struct mailbox *box ATTR_UNUSED,
					  const ARRAY_TYPE(keyword_indexes) *idx ATTR_UNUSED)
{
	struct mail_keywords *keywords;

	keywords = i_new(struct mail_keywords, 1);
	keywords->refcount++;
	return keywords;
}

static void test_mailbox_keywords_ref(struct mail_keywords *keywords)
{
	keywords->refcount++;
}

static void test_mailbox_keywords_unref(struct mail_keywords *keywords)
{
	if (--keywords->refcount == 0)
		i_free(keywords);
}

static bool
test_mailbox_keyword_is_valid(struct mailbox *box ATTR_UNUSED,
			      const char *keyword ATTR_UNUSED,
			      const char **error_r ATTR_UNUSED)
{
	return TRUE;
}

static void
test_mailbox_get_seq_range(struct mailbox *box ATTR_UNUSED,
			   uint32_t uid1, uint32_t uid2,
			   uint32_t *seq1_r, uint32_t *seq2_r)
{
	*seq1_r = uid1;
	*seq2_r = uid2;
}

static void
test_mailbox_get_uid_range(struct mailbox *box ATTR_UNUSED,
			   const ARRAY_TYPE(seq_range) *seqs,
			   ARRAY_TYPE(seq_range) *uids)
{
	array_append_array(uids, seqs);
}

static bool
test_mailbox_get_expunged_uids(struct mailbox *box ATTR_UNUSED,
			       uint64_t prev_modseq ATTR_UNUSED,
			       const ARRAY_TYPE(seq_range) *uids_filter ATTR_UNUSED,
			       ARRAY_TYPE(mailbox_expunge_rec) *expunges ATTR_UNUSED)
{
	return FALSE;
}

static struct mailbox_header_lookup_ctx *
test_mailbox_header_lookup_init(struct mailbox *box,
				const char *const headers[])
{
	struct mailbox_header_lookup_ctx *ctx;

	ctx = i_new(struct mailbox_header_lookup_ctx, 1);
	ctx->box = box;
	ctx->headers = headers; /* now exactly right, but .. */
	return ctx;
}

static void
test_mailbox_header_lookup_deinit(struct mailbox_header_lookup_ctx *ctx)
{
	i_free(ctx);
}

static struct mail_search_context *
test_mailbox_search_init(struct mailbox_transaction_context *t,
			 struct mail_search_args *args,
			 const enum mail_sort_type *sort_program ATTR_UNUSED)
{
	struct mail_search_context *ctx;

	ctx = i_new(struct mail_search_context, 1);
	ctx->transaction = t;
	ctx->args = args;

	i_array_init(&ctx->results, 5);
	i_array_init(&ctx->module_contexts, 5);
	return ctx;
}

static int test_mailbox_search_deinit(struct mail_search_context *ctx)
{
	array_free(&ctx->results);
	array_free(&ctx->module_contexts);
	i_free(ctx);
	return 0;
}

static bool
test_mailbox_search_next_nonblock(struct mail_search_context *ctx ATTR_UNUSED,
				  struct mail *mail ATTR_UNUSED,
				  bool *tryagain_r)
{
	*tryagain_r = FALSE;
	return FALSE;
}

static bool
test_mailbox_search_next_update_seq(struct mail_search_context *ctx ATTR_UNUSED)
{
	return FALSE;
}

static struct mail_save_context *
test_mailbox_save_alloc(struct mailbox_transaction_context *t)
{
	struct mail_save_context *ctx;

	ctx = i_new(struct mail_save_context, 1);
	ctx->transaction = t;
	return ctx;
}

static int
test_mailbox_save_begin(struct mail_save_context *ctx ATTR_UNUSED,
			struct istream *input ATTR_UNUSED)
{
	return -1;
}

static int
test_mailbox_save_continue(struct mail_save_context *ctx ATTR_UNUSED)
{
	return -1;
}

static int
test_mailbox_save_finish(struct mail_save_context *ctx ATTR_UNUSED)
{
	return -1;
}

static void
test_mailbox_save_cancel(struct mail_save_context *ctx ATTR_UNUSED)
{
}

static int
test_mailbox_copy(struct mail_save_context *ctx ATTR_UNUSED,
		  struct mail *mail ATTR_UNUSED)
{
	return -1;
}

static bool test_mailbox_is_inconsistent(struct mailbox *box ATTR_UNUSED)
{
	return FALSE;
}

struct mailbox test_mailbox = {
	.v = {
		test_mailbox_is_readonly,
		test_mailbox_allow_new_keywords,
		test_mailbox_enable,
		test_mailbox_open,
		test_mailbox_close,
		NULL,
		test_mailbox_create,
		test_mailbox_update,
		test_mailbox_delete,
		test_mailbox_rename,
		test_mailbox_get_status,
		NULL,
		NULL,
		NULL,
		test_mailbox_sync_init,
		test_mailbox_sync_next,
		test_mailbox_sync_deinit,
		NULL,
		test_mailbox_notify_changes,
		test_mailbox_transaction_begin,
		test_mailbox_transaction_commit,
		test_mailbox_transaction_rollback,
		test_mailbox_transaction_set_max_modseq,
		test_mailbox_keywords_create,
		test_mailbox_keywords_create_from_indexes,
		test_mailbox_keywords_ref,
		test_mailbox_keywords_unref,
		test_mailbox_keyword_is_valid,
		test_mailbox_get_seq_range,
		test_mailbox_get_uid_range,
		test_mailbox_get_expunged_uids,
		NULL,
		NULL,
		NULL,
		test_mailbox_mail_alloc,
		test_mailbox_header_lookup_init,
		test_mailbox_header_lookup_deinit,
		test_mailbox_search_init,
		test_mailbox_search_deinit,
		test_mailbox_search_next_nonblock,
		test_mailbox_search_next_update_seq,
		test_mailbox_save_alloc,
		test_mailbox_save_begin,
		test_mailbox_save_continue,
		test_mailbox_save_finish,
		test_mailbox_save_cancel,
		test_mailbox_copy,
		NULL,
		test_mailbox_is_inconsistent
	}
};

struct mailbox *
test_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
		   const char *name, enum mailbox_flags flags)
{
	struct mailbox *box;
	pool_t pool;

	pool = pool_alloconly_create("test mailbox", 1024);
	box = p_new(pool, struct mailbox, 1);
	*box = test_mailbox;
	box->name = p_strdup(pool, name);
	box->storage = storage;
	box->list = list;

	box->pool = pool;
	box->flags = flags;

	p_array_init(&box->search_results, pool, 16);
	p_array_init(&box->module_contexts, pool, 5);
	return box;
}


text:
/*
 * File:   cow_string_storage.hpp
 * Author: annas
 *
 * Created on 7. November 2016, 00:54
 */

#ifndef _STD_COW_STRING_STORAGE_H_
#define _STD_COW_STRING_STORAGE_H_
#include "common.hpp"
#include "spinlock.hpp"
namespace std
{
	struct string_rep
	{
	    void add_ref() {
                SPINLOCK(loc) {
                    ++refs;
                }
            }
	    bool release() {
                SPINLOCK(loc) {
                    --refs;
                }
                return refs <= 0;
            }
            void init(short new_capacity = 0) {
                refs = 1;
                size = 0;
                capacity = new_capacity;
	    }

	    short   refs;
	    short   size;
	    short   capacity;
            std::spinlock loc;

	    static const size_t kMaxCapacity = (1 << (sizeof(short) << 3)) >> 1;
	};
	typedef char ERR_InvalidStringRepSize[sizeof(string_rep) == 6 ? 1 : -1];

	template<typename E, class TAllocator> class cow_string_storage
	{
	        typedef char ERR_CharTypeTooBigSeeM_BufferComment[sizeof(E) <= 2 ? 1 : -1];
	public:
            using value_type = E;
	    using size_type = int;
	    using allocator_type = TAllocator;
            using const_iterator = value_type*;

	    static const unsigned long  kGranularity = 32;

	        explicit cow_string_storage(const allocator_type& allocator)
	        	: m_allocator(allocator)
	        {
	                construct_string(0);
	        }
	        cow_string_storage(const value_type* str, const allocator_type& allocator)
	        	:  m_allocator(allocator)
	        {
	                const int len = strlen(str);
	                construct_string(len);
	                Sys::MemCpy(m_data, str, len*sizeof(value_type));
	                assert(len < string_rep::kMaxCapacity);
	                get_rep()->size = static_cast<short>(len);
	                m_data[len] = 0;
	        }
	        cow_string_storage(const value_type* str, size_type len, const allocator_type& allocator)
	        	: m_allocator(allocator)
	        {
	                construct_string(len);
	                Sys::MemCpy(m_data, str, len*sizeof(value_type));
	                assert(len < string_rep::kMaxCapacity);
	                get_rep()->size = static_cast<short>(len);
	                m_data[len] = 0;
	        }
                ow_string_storage(size_type len, const allocator_type& allocator)
	        	: m_allocator(allocator)
	        {
	                construct_string(len);
	                assert(len < string_rep::kMaxCapacity);
	                get_rep()->size = static_cast<short>(len);
	                m_data[len] = 0;
	        }
	        cow_string_storage(const cow_string_storage& rhs, const allocator_type& allocator)
	        	: m_data(rhs.m_data), m_allocator(allocator)
	        {
	                if (rhs.is_dynamic())
	                {
	                        get_rep()->add_ref();
	                }
	                else
	                {
	                        const int len = rhs.length();
	                        construct_string(len);
	                        Sys::MemCpy(m_data, rhs.c_str(), len*sizeof(value_type));
	                        assert(len < string_rep::kMaxCapacity);
	                        get_rep()->size = static_cast<short>(len);
	                        m_data[len] = 0;
	                }
	        }
	        ~cow_string_storage()
	        {
	                if (!is_dynamic())
	                        RDE_ASSERT(get_rep()->refs == 1);
	                release_string();
	        }
	        cow_string_storage& operator=(const cow_string_storage& rhs)
	        {
	                if (m_data != rhs.m_data)
	                {
	                        release_string();
	                        m_data = rhs.m_data;
	                        get_rep()->add_ref();
	                }
	                return *this;
	        }

	        void assign(const value_type* str, size_type len)
	        {
	                assert(str != m_data);
	                release_string();
	                construct_string(len);
	                Sys::MemCpy(m_data, str, len*sizeof(value_type));
	                get_rep()->size = short(len);
	                m_data[len] = 0;
	        }
                 void resize( size_type len)
	        {
	                const size_type prevLen = length();
	                const size_type newCapacity = len;
	                make_unique(newCapacity);
	                string_rep* rep = get_rep();
	                assert(rep->capacity >= short(newCapacity));
	                const size_type newLen = prevLen + len;
	                assert(short(newLen) <= rep->capacity);
	                m_data[newLen] = 0;
	                rep->size = short(newLen);
	        }
	        void append(const value_type* str, size_type len)
	        {
	                const size_type prevLen = length();
	                const size_type newCapacity = prevLen + len;
	                make_unique(newCapacity);
	                string_rep* rep = get_rep();
	                assert(rep->capacity >= short(newCapacity));
	                const size_type newLen = prevLen + len;
	                assert(short(newLen) <= rep->capacity);
	                Sys::MemCpy(m_data + prevLen, str, len * sizeof(value_type));
	                m_data[newLen] = 0;
	                rep->size = short(newLen);
	        }

	        inline const value_type* c_str() const
	        {
	                return m_data;
	        }
	        inline size_type length() const
	        {
	                return get_rep()->size;
	        }
	        const allocator_type& get_allocator() const     { return m_allocator; }

	        value_type* reserve(size_type capacity_hint)
	        {
	                make_unique(capacity_hint);
	                return m_data;
	        }
	        void clear()
	        {
	                resize(0);
	        }
	        void resize(size_type size)
	        {
	                string_rep* rep = get_rep();
	                make_unique(size);
	                rep->size = (short)size;
	                m_data[size] = 0;
	        }

	protected:
	        bool invariant() const
	        {
	                assert(m_data);
	                string_rep* rep = get_rep();
	                assert(rep->refs >= 1);
	                assert(rep->size <= rep->capacity);
	                if (length() != 0)
	                        assert(m_data[length()] == 0);
	                return true;
	        }
	        void make_unique(size_type capacity_hint)
	        {
	                string_rep* rep = get_rep();
	                assert(rep->refs >= 1);

	                if (capacity_hint != 0)
	                {
	                        ++capacity_hint;
	                        capacity_hint = (capacity_hint+kGranularity-1) & ~(kGranularity-1);
	                        if (capacity_hint < kGranularity)
	                                capacity_hint = kGranularity;
	                }
	                assert(capacity_hint < string_rep::kMaxCapacity);
	                // Reallocate string only if we truly need to make it unique
	                // (it's shared) or if our current buffer is too small.
	                if (rep->refs > 1 || short(capacity_hint) > rep->capacity)
	                {
	                        if (capacity_hint > 0)
	                        {
	                                const size_type toAlloc = sizeof(string_rep) + sizeof(value_type)*capacity_hint;
	                                void* newMem = m_allocator.allocate(toAlloc);
	                                string_rep* newRep = reinterpret_cast<string_rep*>(newMem);
	                                newRep->init(short(capacity_hint));
	                                value_type* newData = reinterpret_cast<value_type*>(newRep + 1);
	                                Sys::MemCpy(newData, m_data, rep->size*sizeof(value_type));
	                                newRep->size = rep->size;
	                                newData[rep->size] = 0;
	                                release_string();
	                                m_data = newData;
	                        }
	                        else
	                        {
	                                release_string();
	                                string_rep* rep = reinterpret_cast<string_rep*>(m_buffer);
	                                rep->init();
	                                m_data = reinterpret_cast<value_type*>(rep + 1);
	                                *m_data = 0;
	                        }
	                }
	        }
	        inline E* get_data()   { return m_data; }

	private:
	        inline string_rep* get_rep() const
	        {
	                return reinterpret_cast<string_rep*>(m_data) - 1;
	        }
	        void construct_string(size_type capacity)
	        {
	                if (capacity != 0)
	                {
	                        ++capacity;
	                        capacity = (capacity+kGranularity-1) & ~(kGranularity-1);
	                        if (capacity < kGranularity)
	                                capacity = kGranularity;
	                        assert(capacity < string_rep::kMaxCapacity);

	                        const size_type toAlloc = sizeof(string_rep) + sizeof(value_type)*capacity;
	                        void* mem = m_allocator.allocate(toAlloc);
	                        string_rep* rep = reinterpret_cast<string_rep*>(mem);
	                        rep->init(static_cast<short>(capacity));
	                        m_data = reinterpret_cast<value_type*>(rep + 1);
	                }
	                else    // empty string, no allocation needed. Use our internal buffer.
	                {
	                        string_rep* rep = reinterpret_cast<string_rep*>(m_buffer);
	                        rep->init();
	                        m_data = reinterpret_cast<value_type*>(rep + 1);
	                }
	                *m_data = 0;
	        }
	        void release_string()
	        {
	                string_rep* rep = get_rep();
	                if (rep->release() && rep->capacity != 0)
	                {
	                        assert(is_dynamic());
	                        m_allocator.deallocate(rep, rep->capacity);
	                }
	        }
	        bool is_dynamic() const
	        {
	                return get_rep() != reinterpret_cast<const string_rep*>(&m_buffer[0]);
	        }

	        E*                      m_data;
	        char            		m_buffer[sizeof(string_rep)+2];
	        TAllocator      		m_allocator;
	};
}

#endif


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace connect_4_ai.Model
{
    class AlgoritmicPlayer : Player
    {
        private double[] scores;
        private int playerNum;
        private int maxDepth;
        private string resultsPath;

        public AlgoritmicPlayer(int maxDepth, string resultsPath)
        {
            this.maxDepth = maxDepth;
            this.resultsPath = resultsPath;
            playerNum = 1;
        }

        public AlgoritmicPlayer(int maxDepth) : this(maxDepth,"") {}

        public int getPlayerNum()
        {
            return playerNum;
        }

        public void setPlayerNum(int playerNum)
        {
            this.playerNum = playerNum;
        }

        public virtual int getSelectedCol(Board board)
        {
            Console.Write("Pensando...");
            scores = new double[board.columns];
            for(var i=0; i< scores.Length; i++) { scores[i] = 0; }
            rateColumns(board);
            int selectedCol = getBestRatedCol();
            if (resultsPath != "")
            {
                saveResult(board, selectedCol+1);
            }
            return selectedCol;
        }

        private int getBestRatedCol()
        {
            double maxValue = scores.Max();
            List<int> maxIndexes = new List<int>();
            for (int i=0; i < scores.Length; i++)
            {
                if (scores[i]==maxValue)
                {
                    maxIndexes.Add(i);
                }
            }
            return maxIndexes[0];
        }

        private void saveResult(Board board, int selectedCol)
        {
            using (var w = new StreamWriter(resultsPath, true))
            {
                string line = board.getCSV(this) + "," + selectedCol;
                w.WriteLine(line);
                w.Flush();
            }
        }

        private void rateColumns(Board board)
        {
            for (int col = 0; col < board.columns; col++)
            {
                if (board.colHasSpace(col))
                {
                    rateColumn(col, board.clone(), playerNum, col, 1, maxDepth);
                }
                else
                {
                    scores[col] = double.MinValue;
                }
            }
        }

        private void rateColumn(int col, Board board, int nroPlayerTurn, int colReference, int level, int maxDepth)
        {
            board.selectColumn(col, nroPlayerTurn);
            int winner = board.getStatus();
            if(winner == 0)
            {
                if (level < maxDepth)
                {
                    for (int subcol = 0; subcol < board.columns; subcol++)
                    {
                        if (board.colHasSpace(subcol))
                        {
                            rateColumn(subcol, board.clone(), nroPlayerTurn * -1, colReference, level + 1, maxDepth);
                        }
                    }
                }
            }
            else if (winner == playerNum)
            {
                if (level == 1)
                {
                    scores[colReference] = double.MaxValue;
                }

            }
            else
            {
                if (level == 2)
                {
                    if (col != colReference)
                    {
                        scores[col] += double.MaxValue / board.columns;
                    }
                    else
                    {
                        scores[colReference] += -1 * double.MaxValue / board.columns;
                    }
                }
                scores[colReference] += (-1.0 / Math.Pow(level, 2));
            }
        }

    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LeagueSharp;
using LeagueSharp.Common;

namespace MySharpSupport.AI
{
    public static class Init
    {
        /// <summary>
        /// Initializes the AI with a specified delay
        /// </summary>
        public static void DoInitWithDelay(int min = 1000, int max=15000)
        {
            Utility.DelayAction.Add(new Random().Next(min, max), DoFullInitialization);
        }

        /// <summary>
        /// 0-delay initialization
        /// </summary>
        public static void DoFullInitialization()
        {
            Core.MainMenu = new Menu("MySharpSupport", "mysharpsupport", true);
            Core.MainMenu.AddItem(
                new MenuItem("mycarryis", "ADC to Follow").SetValue(
                    new StringList(
                        ObjectManager.Get<Obj_AI_Hero>()
                            .Where(h => h.IsAlly && !h.IsMe)
                            .OrderByDescending(a => a.Spellbook.Spells.Any(s => s.Name == "SummonerHeal"))
                            .Select(hero => hero.ChampionName)
                            .ToArray())));
            Core.MainMenu.AddItem(
                new MenuItem("maxdistfromcarry", "Max Distance from Carry: ").SetValue(
                    new Slider(
                        Math.Min(
                            Math.Min((int) ObjectManager.Player.GetSpell(SpellSlot.Q).SData.CastRange,
                                (int) ObjectManager.Player.GetSpell(SpellSlot.W).SData.CastRange),
                            (int) ObjectManager.Player.GetSpell(SpellSlot.E).SData.CastRange), 100, 800)));
            Core.MainMenu.AddItem(
                new MenuItem("startingitem", "Starting Item").SetValue(
                    new StringList(new[] {"AncientCoin", "RelicShield", "SpellthiefsEdge"})));
            Core.MainMenu.AddItem(
                new MenuItem("firstitem", "First Item").SetValue(
                    new StringList(new[]
                    {
                        "Sightstone", "TalismanOfAscension", "FrostQueensClaim", "FaceOfTheMountain", "ZekesHarbinger",
                        "LocketOfTheIronSolari", "MikaelsCrucible", "ZhonyasHourglass", "Morellonomicon", "RodOfAges"
                    })));
            Core.MainMenu.AddItem(
                new MenuItem("seconditem", "Second Item").SetValue(
                    new StringList(new[]
                    {
                        "TalismanOfAscension", "Sightstone", "FrostQueensClaim", "FaceOfTheMountain", "ZekesHarbinger",
                        "LocketOfTheIronSolari", "MikaelsCrucible", "ZhonyasHourglass", "Morellonomicon", "RodOfAges"
                    })));
            Core.MainMenu.AddItem(
                new MenuItem("thirditem", "Third Item").SetValue(
                    new StringList(new[]
                    {
                        "ZekesHarbinger", "TalismanOfAscension", "Sightstone", "FrostQueensClaim", "FaceOfTheMountain",
                        "LocketOfTheIronSolari", "MikaelsCrucible", "ZhonyasHourglass", "Morellonomicon", "RodOfAges"
                    })));
            Core.MainMenu.AddItem(
                new MenuItem("fourthitem", "Fourth Item").SetValue(
                    new StringList(new[]
                    {
                        "TalismanOfAscension", "Sightstone", "FrostQueensClaim", "FaceOfTheMountain", "ZekesHarbinger",
                        "LocketOfTheIronSolari", "MikaelsCrucible", "ZhonyasHourglass", "Morellonomicon", "RodOfAges"
                    })));
            Core.MainMenu.AddItem(
                new MenuItem("fifthitem", "Fifth Item").SetValue(
                    new StringList(new[]
                    {

                        "LocketOfTheIronSolari", "TalismanOfAscension", "Sightstone", "FrostQueensClaim",
                        "FaceOfTheMountain", "ZekesHarbinger", "MikaelsCrucible", "ZhonyasHourglass", "Morellonomicon",
                        "RodOfAges"
                    })));
            Core.MainMenu.AddItem(
                new MenuItem("sixthitem", "Sixth Item").SetValue(
                    new StringList(new[]
                    {
                        "MikaelsCrucible", "LocketOfTheIronSolari", "TalismanOfAscension", "Sightstone",
                        "FrostQueensClaim",
                        "FaceOfTheMountain", "ZekesHarbinger", "ZhonyasHourglass", "Morellonomicon",
                        "RodOfAges"
                    })));
            Core.MainMenu.AddToMainMenu();

            Game.OnUpdate += Core.OnUpdate;
            Game.OnChat += ChatCommands.OnChat;
            new AutoLevel(TreesAutoLevel.GetSequence().Select(l => l - 1));
            AutoLevel.Enable();
        }
    }
}


text:
package com.widowcrawler.terminator.model;

/**
 * @author Scott Mansfield
 */
public enum RuleType {
    ALLOW,
    DISALLOW
}


text:
package lombok.eclipse.handlers;

import griffon.plugins.cassandra.CassandraAware;
import lombok.core.AnnotationValues;
import lombok.core.handlers.CassandraAwareConstants;
import lombok.core.handlers.CassandraAwareHandler;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.ast.EclipseType;
import org.eclipse.jdt.internal.compiler.ast.Annotation;

import static lombok.core.util.ErrorMessages.canBeUsedOnClassAndEnumOnly;

/**
 * @author Andres Almiray
 */
public class HandleCassandraAware extends EclipseAnnotationHandler<CassandraAware> {
    private final EclipseCassandraAwareHandler handler = new EclipseCassandraAwareHandler();

    @Override
    public void handle(AnnotationValues<CassandraAware> annotation, Annotation source, EclipseNode annotationNode) {
        EclipseType type = EclipseType.typeOf(annotationNode, source);
        if (type.isAnnotation() || type.isInterface()) {
            annotationNode.addError(canBeUsedOnClassAndEnumOnly(CassandraAware.class));
            return;
        }

        EclipseUtil.addInterface(type.get(), CassandraAwareConstants.CASSANDRA_CONTRIBUTION_HANDLER_TYPE, source);
        handler.addCassandraProviderField(type);
        handler.addCassandraProviderAccessors(type);
        handler.addCassandraContributionMethods(type);
        type.editor().rebuild();
    }

    private static class EclipseCassandraAwareHandler extends CassandraAwareHandler<EclipseType> {
    }
}


text:
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({ name: 'isInQueue' })
export class IsInQueuePipe implements PipeTransform {
  transform(media: GoogleApiYouTubeVideoResource, medias: string[]): any {
    return medias.includes(media.id);
  }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Blastenia paragoga Körb.

### Remarks
null


text:
'use strict';

var livereload = require('livereload'),
    connectLr = require('connect-livereload-safe');

module.exports = function(lingon, config) {

  // add script tag injection middleware to the express server
  lingon.one('serverConfigure', function() {

    config = config || {};
    config.port = config.port || 35729;
    config.host = config.host || 'localhost';

    // inject browser script tag
    lingon.server.use(connectLr({
      host: 'http://' + config.host + ':' + config.port
    }));
  });

  // start the livereload server
  lingon.one('serverStarted', function() {

    var server;

    // set livereload to watch the source dir
    config.watchDir = config.watchDir || process.cwd() + '/' + lingon.config.sourcePath;

    // add extensions for livereload to watch
    config.exts = config.exts || lingon.config.directiveFileTypes.concat(Object.keys(lingon.config.extensionRewrites));

    server = livereload.createServer(config);

    server.watch(config.watchDir);

    lingon.log.info('Livereload is listening on port ' + config.port);
  });
};


text:
<?php

// Register service provider
$app->register(new Marvin\Pages\Provider\InstallServiceProvider());
$app->register(new Marvin\Pages\Provider\FrontendServiceProvider());

// Mount plugin controller provider
$app->mount('/admin/pages', new Marvin\Pages\Controller\AdminControllerProvider());
$app->mount('/', new Marvin\Pages\Controller\FrontendControllerProvider());
if ($app['debug']) {
    $app->mount('/install/pages', new Marvin\Pages\Controller\InstallControllerProvider());
}


text:
TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'roda-plugins'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install roda-plugins

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it ( https://github.com/[my-github-username]/roda-plugins/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Austral. Paniceae 241. 1987

#### Original name
null

### Remarks
null


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/common_bg"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/height_top_bar"
        android:background="@color/top_bar_normal_bg"
        android:gravity="center_vertical" >

        <TextView
            android:id="@+id/message_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="@string/address_book"
            android:textColor="@color/bottom_text_color_normal"
            android:textSize="18sp" />

        <ImageView
            android:id="@+id/iv_new_contact"
            android:layout_width="48dp"
            android:layout_height="match_parent"
            android:layout_alignParentRight="true"
            android:background="@drawable/common_tab_bg"
            android:clickable="true"
            android:scaleType="centerInside"
            android:src="@drawable/add" />
    </RelativeLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <RelativeLayout
            android:id="@+id/rl_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <LinearLayout
                android:id="@+id/ll_loading"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="2dp"
                android:gravity="center_vertical"
                android:visibility="gone" >

                <ProgressBar
                    android:layout_width="28dp"
                    android:layout_height="28dp" />

                <TextView
                    android:id="@+id/tv_loaing"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="6dp"
                    android:text="@string/now_refresh_list" />
            </LinearLayout>

            <include
                android:id="@+id/search_bar_view"
                layout="@layout/search_bar_with_padding"/>

            <ListView
                android:id="@+id/list"
                android:layout_below="@+id/search_bar_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@android:color/transparent"
                android:cacheColorHint="#00000000"
                android:descendantFocusability="afterDescendants"
                android:divider="@color/divider_list"
                android:dividerHeight="1px"
                android:fastScrollEnabled="false" />
 			<com.easemob.chatuidemo.widget.Sidebar
                android:id="@+id/sidebar"
                android:layout_width="30dp"
                android:layout_height="match_parent"
                android:layout_alignParentRight="true"
                android:background="@android:color/transparent"
                android:clickable="true" />

            <TextView
                android:id="@+id/floating_header"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:background="@drawable/show_head_toast_bg"
                android:gravity="center"
                android:paddingLeft="25dp"
                android:paddingRight="25dp"
                android:textColor="@android:color/white"
                android:textSize="40sp"
                android:visibility="invisible" />

        </RelativeLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_gravity="center"
            android:visibility="gone"
            android:id="@+id/progress_bar">
	        <ProgressBar
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:layout_gravity="center_horizontal"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/now_refresh_list"
                android:layout_gravity="center_horizontal"/>
	    </LinearLayout>

    </FrameLayout>

</LinearLayout>


text:
package main

import (
	"github.com/ant0ine/go-json-rest/rest"
	"log"
	"net"
	"net/http"
)

func main() {
	api := rest.NewApi()
	api.Use(rest.DefaultDevStack...)
	router, err := rest.MakeRouter(
		rest.Get("/lookup/#host", func(w rest.ResponseWriter, req *rest.Request) {
			ip, err := net.LookupIP(req.PathParam("host"))
			if err != nil {
				rest.Error(w, err.Error(), http.StatusInternalServerError)
				return
			}
			w.WriteJson(&ip)
		}),
	)
	if err != nil {
		log.Fatal(err)
	}
	api.SetApp(router)
	log.Fatal(http.ListenAndServe(":8080", api.MakeHandler()))
}


text:
DnsProto::DefaultServerList DnsProto::BuildDefaultServerListImpl() {
    DefaultServerList ip_list{};

    FIXED_INFO *dnsServersInfo = NULL;
    ULONG dnsServersInfoBuffSize = 0;

    //We have to call GetNetworkParams twice -
    //First, we need to get size of the buffer
    //which will hold the information about default DNS resolvers.
    DWORD dwRetVal = GetNetworkParams(dnsServersInfo, &dnsServersInfoBuffSize);
    if (dwRetVal != ERROR_BUFFER_OVERFLOW) {
        //We had different error than ERROR_BUFFER_OVERFLOW.
        //It shouldn't happen so return empty list of ips.
        LOG(ERROR, "Error while getting required size of dnsServersInfo buffer: " << GetFormattedWindowsErrorMsg());
        return ip_list;
    }

    dnsServersInfo = (FIXED_INFO *)std::malloc(dnsServersInfoBuffSize);
    if (!dnsServersInfo) {
        LOG(ERROR, "Allocation of DNS servers information buffer failed");
        return ip_list;
    }

    //With second call we fill allocated memory with the data.
    dwRetVal = GetNetworkParams(dnsServersInfo, &dnsServersInfoBuffSize);
    if (dwRetVal != NO_ERROR) {
        LOG(ERROR, "Error while filling dnsServerInfo buffer: " << GetFormattedWindowsErrorMsg());
        return ip_list;
    }

    PIP_ADDR_STRING dnsServerIPAddr = &dnsServersInfo->DnsServerList;
    while(dnsServerIPAddr) {
        boost::system::error_code ec;
        IpAddress ip = IpAddress::from_string(dnsServerIPAddr->IpAddress.String, ec);
        if (!ec.value()) {
            ip_list.push_back(ip);
        }
        dnsServerIPAddr = dnsServerIPAddr->Next;
    }
    std::free(dnsServersInfo);

    return ip_list;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Folia cryptog. Estonica 37: 89 (2001)

#### Original name
Proprioscypha echinulata Raitv. & Leenurm

### Remarks
null


text:
package algorithm

import (
	"fmt"

	"k8s.io/kubernetes/pkg/api/unversioned"
	"k8s.io/kubernetes/pkg/api/v1"
	extensions "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
	"k8s.io/kubernetes/pkg/labels"
)

// NodeLister interface represents anything that can list nodes for a scheduler.
type NodeLister interface {
	// We explicitly return []*v1.Node, instead of v1.NodeList, to avoid
	// performing expensive copies that are unneded.
	List() ([]*v1.Node, error)
}

// FakeNodeLister implements NodeLister on a []string for test purposes.
type FakeNodeLister []*v1.Node

// List returns nodes as a []string.
func (f FakeNodeLister) List() ([]*v1.Node, error) {
	return f, nil
}

// PodLister interface represents anything that can list pods for a scheduler.
type PodLister interface {
	// We explicitly return []*v1.Pod, instead of v1.PodList, to avoid
	// performing expensive copies that are unneded.
	List(labels.Selector) ([]*v1.Pod, error)
}

// FakePodLister implements PodLister on an []v1.Pods for test purposes.
type FakePodLister []*v1.Pod

// List returns []*v1.Pod matching a query.
func (f FakePodLister) List(s labels.Selector) (selected []*v1.Pod, err error) {
	for _, pod := range f {
		if s.Matches(labels.Set(pod.Labels)) {
			selected = append(selected, pod)
		}
	}
	return selected, nil
}

// ServiceLister interface represents anything that can produce a list of services; the list is consumed by a scheduler.
type ServiceLister interface {
	// Lists all the services
	List(labels.Selector) ([]*v1.Service, error)
	// Gets the services for the given pod
	GetPodServices(*v1.Pod) ([]*v1.Service, error)
}

// FakeServiceLister implements ServiceLister on []v1.Service for test purposes.
type FakeServiceLister []*v1.Service

// List returns v1.ServiceList, the list of all services.
func (f FakeServiceLister) List(labels.Selector) ([]*v1.Service, error) {
	return f, nil
}

// GetPodServices gets the services that have the selector that match the labels on the given pod.
func (f FakeServiceLister) GetPodServices(pod *v1.Pod) (services []*v1.Service, err error) {
	var selector labels.Selector

	for i := range f {
		service := f[i]
		// consider only services that are in the same namespace as the pod
		if service.Namespace != pod.Namespace {
			continue
		}
		selector = labels.Set(service.Spec.Selector).AsSelectorPreValidated()
		if selector.Matches(labels.Set(pod.Labels)) {
			services = append(services, service)
		}
	}
	return
}

// ControllerLister interface represents anything that can produce a list of ReplicationController; the list is consumed by a scheduler.
type ControllerLister interface {
	// Lists all the replication controllers
	List(labels.Selector) ([]*v1.ReplicationController, error)
	// Gets the services for the given pod
	GetPodControllers(*v1.Pod) ([]*v1.ReplicationController, error)
}

// EmptyControllerLister implements ControllerLister on []v1.ReplicationController returning empty data
type EmptyControllerLister struct{}

// List returns nil
func (f EmptyControllerLister) List(labels.Selector) ([]*v1.ReplicationController, error) {
	return nil, nil
}

// GetPodControllers returns nil
func (f EmptyControllerLister) GetPodControllers(pod *v1.Pod) (controllers []*v1.ReplicationController, err error) {
	return nil, nil
}

// FakeControllerLister implements ControllerLister on []v1.ReplicationController for test purposes.
type FakeControllerLister []*v1.ReplicationController

// List returns []v1.ReplicationController, the list of all ReplicationControllers.
func (f FakeControllerLister) List(labels.Selector) ([]*v1.ReplicationController, error) {
	return f, nil
}

// GetPodControllers gets the ReplicationControllers that have the selector that match the labels on the given pod
func (f FakeControllerLister) GetPodControllers(pod *v1.Pod) (controllers []*v1.ReplicationController, err error) {
	var selector labels.Selector

	for i := range f {
		controller := f[i]
		if controller.Namespace != pod.Namespace {
			continue
		}
		selector = labels.Set(controller.Spec.Selector).AsSelectorPreValidated()
		if selector.Matches(labels.Set(pod.Labels)) {
			controllers = append(controllers, controller)
		}
	}
	if len(controllers) == 0 {
		err = fmt.Errorf("Could not find Replication Controller for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels)
	}

	return
}

// ReplicaSetLister interface represents anything that can produce a list of ReplicaSet; the list is consumed by a scheduler.
type ReplicaSetLister interface {
	// Gets the replicasets for the given pod
	GetPodReplicaSets(*v1.Pod) ([]*extensions.ReplicaSet, error)
}

// EmptyReplicaSetLister implements ReplicaSetLister on []extensions.ReplicaSet returning empty data
type EmptyReplicaSetLister struct{}

// GetPodReplicaSets returns nil
func (f EmptyReplicaSetLister) GetPodReplicaSets(pod *v1.Pod) (rss []*extensions.ReplicaSet, err error) {
	return nil, nil
}

// FakeReplicaSetLister implements ControllerLister on []extensions.ReplicaSet for test purposes.
type FakeReplicaSetLister []*extensions.ReplicaSet

// GetPodReplicaSets gets the ReplicaSets that have the selector that match the labels on the given pod
func (f FakeReplicaSetLister) GetPodReplicaSets(pod *v1.Pod) (rss []*extensions.ReplicaSet, err error) {
	var selector labels.Selector

	for _, rs := range f {
		if rs.Namespace != pod.Namespace {
			continue
		}
		selector, err = unversioned.LabelSelectorAsSelector(rs.Spec.Selector)
		if err != nil {
			return
		}

		if selector.Matches(labels.Set(pod.Labels)) {
			rss = append(rss, rs)
		}
	}
	if len(rss) == 0 {
		err = fmt.Errorf("Could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels)
	}

	return
}


text:
#region License

#endregion

namespace Spring.Social.OAuth1
{
    /// <summary>
    /// A ServiceProvider that uses the OAuth 1.0 protocol.
    /// </summary>
    /// <typeparam name="T">The service provider's API type.</typeparam>
    /// <author>Keith Donald</author>
    /// <author>Bruno Baia (.NET)</author>
    public interface IOAuth1ServiceProvider<T> : IServiceProvider<T> where T : IApiBinding
    {
        /// <summary>
        /// Gets the service interface for carrying out the "OAuth dance" with this provider.
        /// The result of the OAuth dance is an access token that can be used to obtain an API binding with <see cref="M:GetApi(string,string)"/> method.
        /// </summary>
        IOAuth1Operations OAuthOperations { get; }

        /// <summary>
        /// Returns an API interface allowing the client application to access protected resources on behalf of a user.
        /// </summary>
        /// <param name="accessToken">The API access token.</param>
        /// <param name="secret">The access token secret.</param>
        /// <returns>A binding to the service provider's API.</returns>
        T GetApi(string accessToken, string secret);
    }
}


text:
import m1;

std::array<endpoint_t, 10> endpoints{};

int main(int, char*[]) {
    auto count = lookup(endpoints.data(), endpoints.size(), //
                        "releases.llvm.org", "https");

    std::cout << count << std::endl;
    for (auto i = 0u; i < count; ++i) {
        endpoints[i];
    }
    return count > 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}


text:
const path = require('path');
const test = require('ava');
const chai = require('chai');
const expect = chai.expect;
const spies = require('chai-spies');
chai.use(spies);
const TestUtils = require('fountain-generator').TestUtils;

let context;

test.before(() => {
  context = TestUtils.mock('component');
  context.config = {get: () => context.props};
  require('../../generators/component/index');
  process.chdir(path.resolve(__dirname, '../../'));
});

test(`Call this.copyTemplate 3 times without 'dir' option`, t => {
  const spy = chai.spy.on(context, 'copyTemplate');
  TestUtils.call(context, 'writing');
  expect(spy).to.have.been.called.exactly(3);
  t.true(context.copyTemplate['src/app/myComponent.js'].length > 0);
  t.true(context.copyTemplate['src/app/myComponent.html'].length > 0);
  t.true(context.copyTemplate['src/app/myComponent.spec.js'].length > 0);
});

test(`Call this.copyTemplate 3 times with 'dir' option`, t => {
  const spy = chai.spy.on(context, 'copyTemplate');
  TestUtils.call(context, 'writing', {dir: 'game'});
  expect(spy).to.have.been.called.exactly(3);
  t.true(context.copyTemplate['src/app/game/myComponent.js'].length > 0);
  t.true(context.copyTemplate['src/app/game/myComponent.html'].length > 0);
  t.true(context.copyTemplate['src/app/game/myComponent.spec.js'].length > 0);
});


text:
from __future__ import absolute_import, division, print_function, unicode_literals

import datetime

import pytest
from django.core.validators import ValidationError
from django.test import TestCase

from gargoyle.conditions import AbstractDate, BeforeDate, ConditionSet, OnOrAfterDate, Percent, Range
from gargoyle.manager import SwitchManager
from gargoyle.models import SELECTIVE, Switch

class RangeTests(TestCase):

    def test_is_active(self):
        condition = Range()
        assert not condition.is_active('1-2', 0)
        assert condition.is_active('1-2', 1)
        assert condition.is_active('1-2', 2)
        assert not condition.is_active('1-2', 3)

    def test_is_active_should_allow_floats(self):
        condition = Range()
        assert not condition.is_active('1-2', 0.0)
        assert not condition.is_active('1-2', 0.9)
        assert condition.is_active('1-2', 1.0)
        assert condition.is_active('1-2', 1.5)
        assert condition.is_active('1-2', 2.0)
        assert not condition.is_active('1-2', 2.1)
        assert not condition.is_active('1-2', 2.01)
        assert not condition.is_active('1-2', 2.001)
        assert not condition.is_active('1-2', 3.0)
        assert not condition.is_active('1-2', 9e9)

    def test_is_active_shouldnt_allow_strings(self):
        condition = Range()
        assert not condition.is_active('1-2', '0')
        assert not condition.is_active('1-2', '1')
        assert not condition.is_active('1-2', '2')
        assert not condition.is_active('1-2', '3')

    def test_clean_success(self):
        condition = Range()
        assert condition.clean('1-2') == '1-2'

    def test_clean_fail_empty(self):
        condition = Range()
        with pytest.raises(ValidationError):
            condition.clean('')

    def test_clean_fail_no_dash(self):
        condition = Range()
        with pytest.raises(ValidationError):
            condition.clean('1')

    def test_clean_fail_no_second_number(self):
        condition = Range()
        with pytest.raises(ValidationError):
            condition.clean('1-')

    def test_clean_fail_no_first_number(self):
        condition = Range()
        with pytest.raises(ValidationError):
            condition.clean('-2')

    def test_clean_fail_no_numbers(self):
        condition = Range()
        with pytest.raises(ValidationError):
            condition.clean('-')

    def test_clean_fail_too_many_numbers(self):
        condition = Range()
        with pytest.raises(ValidationError):
            condition.clean('1-2-3')

class PercentTests(TestCase):
    def test_clean_success(self):
        condition = Percent()
        assert condition.clean('0-50') == '0-50'

    def test_clean_fail_no_first_number(self):
        condition = Percent()
        with pytest.raises(ValidationError):
            condition.clean('-50')

    def test_clean_fail_no_second_number(self):
        condition = Percent()
        with pytest.raises(ValidationError):
            condition.clean('10-')

    def test_clean_fail_no_numbers(self):
        condition = Percent()
        with pytest.raises(ValidationError):
            condition.clean('-')

    def test_clean_fail_empty(self):
        condition = Percent()
        with pytest.raises(ValidationError):
            condition.clean('')

    def test_clean_fail_out_of_range(self):
        condition = Percent()
        with pytest.raises(ValidationError):
            condition.clean('10-160')

    def test_clean_first_greater_than_second(self):
        condition = Percent()
        with pytest.raises(ValidationError):
            condition.clean('80-20')

class AbstractDateTests(TestCase):
    def test_clean_success(self):
        condition = AbstractDate()
        assert condition.clean('2016-01-01') == '2016-01-01'

    def test_clean_failed(self):
        condition = AbstractDate()
        with pytest.raises(ValidationError):
            condition.clean("20160101")

class BeforeDateTests(TestCase):
    def test_is_active_date_less(self):
        condition = BeforeDate()
        assert condition.is_active("2016-08-05", datetime.date(2016, 8, 2))

    def test_is_active_date_equal(self):
        condition = BeforeDate()
        assert not condition.is_active("2016-08-05", datetime.date(2016, 8, 5))

    def test_is_active_date_greater(self):
        condition = BeforeDate()
        assert not condition.is_active("2016-08-05", datetime.date(2016, 8, 10))

class OnOrAfterDateTests(TestCase):
    def test_is_active_date_less(self):
        condition = OnOrAfterDate()
        assert not condition.is_active("2016-08-05", datetime.date(2016, 8, 2))

    def test_is_active_date_equal(self):
        condition = OnOrAfterDate()
        assert condition.is_active("2016-08-05", datetime.date(2016, 8, 5))

    def test_is_active_date_greater(self):
        condition = OnOrAfterDate()
        assert condition.is_active("2016-08-05", datetime.date(2016, 8, 10))

class NumberConditionSet(ConditionSet):
    in_range = Range()

    def get_field_value(self, instance, field_name):
        if field_name == 'in_range':
            return instance

class NumberConditionSetTests(TestCase):

    condition_set = __name__ + '.' + NumberConditionSet.__name__

    def setUp(self):
        super(NumberConditionSetTests, self).setUp()
        self.gargoyle = SwitchManager(Switch, key='key', value='value', instances=True, auto_create=True)
        self.gargoyle.register(NumberConditionSet())

        Switch.objects.create(key='test', status=SELECTIVE)
        self.switch = self.gargoyle['test']

    def test_range(self):
        self.switch.add_condition(
            condition_set=self.condition_set,
            field_name='in_range',
            condition='1-3',
        )

        assert not self.gargoyle.is_active('test', 0)
        assert self.gargoyle.is_active('test', 1)
        assert self.gargoyle.is_active('test', 2)
        assert self.gargoyle.is_active('test', 3)
        assert not self.gargoyle.is_active('test', 4)


text:
define(
//begin v1.x content
({
	insertEntity: "Symbool invoegen"
})

//end v1.x content
);


text:
// UpdateSearchViewModel.cs, 10.06.2019
// Copyright (C) Dominic Beger 17.06.2019

using System;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Threading;
using nUpdate.Internal.Core;
using nUpdate.Internal.Core.Localization;
using nUpdate.Updating;
using nUpdate.WPFUserInterface.ServiceInterfaces;
using nUpdate.WPFUserInterface.ViewModel.Interfaces;

// ReSharper disable once CheckNamespace
namespace nUpdate.WPFUserInterface.ViewModel
{
    public class UpdateSearchViewModel : UpdateUiBaseViewModel, IDialogViewModel
    {
        public UpdateSearchViewModel(UpdateManager manager)
        {
            UpdateManager = manager;
            LocProperties = LocalizationHelper.GetLocalizationProperties(UpdateManager.LanguageCulture,
                UpdateManager.CultureFilePaths);

            WindowIcon = GetIcon(IconHelper.ExtractAssociatedIcon(Application.ExecutablePath));
            WindowTitle = LocProperties.UpdateSearchDialogHeader;

            Abort = new RelayCommand(o => Abort_Execute(), o => true);
        }

        internal bool UpdatesFound { get; set; }

        internal bool HasError { get; set; }
        public LocalizationProperties LocProperties { get; }

        public ICommand Abort { get; }
        public bool DialogResult { get; set; }
        public string WindowTitle { get; set; }
        public Dispatcher CurrentDispatcher { get; set; }

        public async void DialogLoaded()
        {
            try
            {
                UpdatesFound = await UpdateManager.SearchForUpdatesAsync();
            }
            catch (OperationCanceledException)
            {
                return;
            }
            catch (Exception ex)
            {
                var msgService = ServiceContainer.Instance.GetService<IMessageboxService>();
                msgService.Show(ex.Message, LocProperties.UpdateSearchErrorCaption, EnuMessageBoxButton.Ok,
                    EnuMessageBoxImage.Error);

                UpdatesFound = false;
                HasError = true;
            }

            var dialogService = ServiceContainer.Instance.GetService<IDialogWindowService>();
            dialogService.CloseDialog();
        }

        public void DialogClosing()
        {
            DialogResult = UpdatesFound;
            if (!DialogResult) UpdateManager.CancelSearchAsync();
        }

        private void Abort_Execute()
        {
            UpdatesFound = false;
            var dialogService = ServiceContainer.Instance.GetService<IDialogWindowService>();
            dialogService.CloseDialog();
        }
    }
}


text:
#ifndef GFFT_H
#define GFFT_H

#include <complex>
#include <iostream>
#include <valarray>

const double PI = 3.141592653589793238460;

typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;

class GFFT {
public:
    GFFT(long length);
    ~GFFT();
    void make_fft (double f [], const double x []);
private:
    void fft(CArray& x);
    long len;
    Complex *xc;
};

#endif


text:
package self.micromagic.eterna.search.impl;

import self.micromagic.eterna.dao.preparer.PreparerCreater;
import self.micromagic.eterna.dao.preparer.ValuePreparer;
import self.micromagic.eterna.search.BuilderResult;
import self.micromagic.eterna.search.ConditionBuilder;
import self.micromagic.eterna.search.ConditionProperty;
import self.micromagic.eterna.share.AttributeManager;
import self.micromagic.eterna.share.EternaException;
import self.micromagic.eterna.share.EternaFactory;
import self.micromagic.eterna.share.Tool;
import self.micromagic.util.StringAppender;
import self.micromagic.util.StringTool;

/**
 * builder的实现类.
 */
class ConditionBuilderImpl
		implements ConditionBuilder
{
	static final String EQUALS_OPT_TAG = "=";
	static final String LIKE_OPT_TAG = "LIKE";

	public ConditionBuilderImpl(String operator, boolean needValue, AttributeManager attrs)
	{
		this.operator = operator;
		this.needValue = needValue;
		this.attrs = attrs;
	}
	private final String operator;
	private final boolean needValue;
	private final AttributeManager attrs;
	boolean emptyToNull = true;

	public boolean initialize(EternaFactory factory)
			throws EternaException
	{
		if (this.factory != null)
		{
			return true;
		}
		this.factory = factory;
		if (!StringTool.isEmpty(this.prepareName))
		{
			this.prepare = factory.getPrepare(this.prepareName);
		}
		Boolean b = Tool.checkEmptyToNull(
				(String) this.getAttribute(Tool.EMPTY_TO_NULL_FLAG), factory);
		if (b != null)
		{
			this.emptyToNull = b.booleanValue();
		}
		return false;
	}
	private EternaFactory factory;
	String prepareName;

	public EternaFactory getFactory()
	{
		return this.factory;
	}

	public String getName()
			throws EternaException
	{
		return this.name;
	}
	String name;

	public String getCaption()
			throws EternaException
	{
		return this.caption;
	}
	String caption;

	public PreparerCreater getPreparerCreater()
			throws EternaException
	{
		return this.prepare;
	}
	private PreparerCreater prepare;

	public BuilderResult buildeCondition(String colName, Object value, ConditionProperty cp)
			throws EternaException
	{
		if (this.needValue)
		{
			if (value == null || (this.emptyToNull && StringTool.isEmpty(value)))
			{
				return this.getNullCheckCondition(colName);
			}

			int count = colName.length() + this.operator.length() + 3;
			StringAppender sqlPart = StringTool.createStringAppender(count);
			sqlPart.append(colName).append(' ').append(this.operator).append(" ?");
			PreparerCreater pCreater = this.getPreparerCreater();
			if (LIKE_OPT_TAG.equalsIgnoreCase(this.operator))
			{
				String strValue = value.toString();
				if (pCreater != null)
				{
					String newStr = BuilderGenerator.dealEscapeString(strValue);
					if (newStr != strValue)
					{
						value = strValue = newStr;
						sqlPart.append(" escape '\\'");
					}
				}
				else
				{
					// 对于没有设置prepare的, 默认加上escape
					sqlPart.append(" escape '\\'");
				}
			}
			ValuePreparer[] preparers = new ValuePreparer[1];
			if (pCreater == null)
			{
				preparers[0] = cp.createValuePreparer(value);
			}
			else
			{
				preparers[0] = pCreater.createPreparer(value);
			}
			return new BuilderResult(sqlPart.toString(), preparers);
		}
		else
		{
			int count = colName.length() + this.operator.length() + 1;
			StringAppender temp = StringTool.createStringAppender(count);
			temp.append(colName).append(' ').append(this.operator);
			return new BuilderResult(temp.toString());
		}
	}

	protected BuilderResult getNullCheckCondition(String colName)
	{
		boolean equalsFlag = EQUALS_OPT_TAG.equalsIgnoreCase(this.operator)
				|| LIKE_OPT_TAG.equalsIgnoreCase(this.operator);
		String temp = equalsFlag ? colName + " IS NULL" : colName + " IS NOT NULL";
		return new BuilderResult(temp);
	}

	public Object getAttribute(String name)
			throws EternaException
	{
		return this.attrs.getAttribute(name);
	}

	public String[] getAttributeNames()
			throws EternaException
	{
		return this.attrs.getAttributeNames();
	}

}


text:
import { Component } from '@angular/core';

@Component({
  template: '<my-test></my-test>'
})
export class TestPage {

}


text:
CREATE TABLE uaocs_outdatedindex_abort (a INT, b INT, c CHAR(128)) WITH (appendonly=true, orientation=column) DISTRIBUTED BY (a);
CREATE INDEX uaocs_outdatedindex_abort_index ON uaocs_outdatedindex_abort(b);
INSERT INTO uaocs_outdatedindex_abort SELECT i as a, i as b, 'hello world' as c FROM generate_series(1, 50) AS i;
INSERT INTO uaocs_outdatedindex_abort SELECT i as a, i as b, 'hello world' as c FROM generate_series(51, 100) AS i;
ANALYZE uaocs_outdatedindex_abort;

SET enable_seqscan=false;
DELETE FROM uaocs_outdatedindex_abort WHERE a < 16;
VACUUM uaocs_outdatedindex_abort;
SELECT * FROM uaocs_outdatedindex_abort WHERE b = 20;
SELECT * FROM uaocs_outdatedindex_abort WHERE b = 10;
INSERT INTO uaocs_outdatedindex_abort SELECT i as a, i as b, 'Good morning' as c FROM generate_series(1, 4) AS i;
BEGIN;
INSERT INTO uaocs_outdatedindex_abort SELECT i as a, i as b, 'Good morning' as c FROM generate_series(5, 8) AS i;
INSERT INTO uaocs_outdatedindex_abort SELECT i as a, i as b, 'Good morning' as c FROM generate_series(9, 12) AS i;
ROLLBACK;
SELECT * FROM uaocs_outdatedindex_abort WHERE b < 16;


text:
from __future__ import print_function

import datetime
import threading
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
from xml.sax.saxutils import escape

import idaapi
import idautils
import idc

# Wait for any processing to get done
idaapi.autoWait()

# On Windows with NTFS filesystem a filepath with ':'
# is treated as NTFS ADS (Alternative Data Stream)
# and so saving file with such name fails
dt = datetime.datetime.now().isoformat().replace(':', '-')

# Save the database so nothing gets lost.
if idaapi.IDA_SDK_VERSION >= 700:
    idaapi.save_database(idc.GetIdbPath() + '.' + dt)
else:
    idc.SaveBase(idc.GetIdbPath() + '.' + dt)

DEBUG_MARSHALLING = False

def create_marshaller(use_format=None, just_to_str=False):
    assert use_format or just_to_str, 'Either pass format to use or make it converting the value to str.'

    def wrapper(_marshaller, value, appender):
        if use_format:
            marshalled = use_format % value
        elif just_to_str:
            marshalled = '<value><string>%s</string></value>' % escape(str(value))

        if DEBUG_MARSHALLING:
            print("Marshalled: '%s'" % marshalled)

        appender(marshalled)

    return wrapper

xmlrpclib.Marshaller.dispatch[type(0L)] = create_marshaller("<value><i8>%d</i8></value>")
xmlrpclib.Marshaller.dispatch[type(0)] = create_marshaller("<value><i8>%d</i8></value>")
xmlrpclib.Marshaller.dispatch[idaapi.cfuncptr_t] = create_marshaller(just_to_str=True)

host = '127.0.0.1'
port = 8888
orig_LineA = idc.LineA

def LineA(*a, **kw):
    v = orig_LineA(*a, **kw)
    if v and v.startswith('\x01\x04; '):
        v = v[4:]
    return v

idc.LineA = LineA

mutex = threading.Condition()

def wrap(f):
    def wrapper(*a, **kw):
        rv = []
        error = []

        def work():
            try:
                result = f(*a, **kw)
                rv.append(result)
            except Exception as e:
                error.append(e)

        with mutex:
            flags = idaapi.MFF_WRITE
            if f == idc.SetColor:
                flags |= idaapi.MFF_NOWAIT
                rv.append(None)
            idaapi.execute_sync(work, flags)

        if error:
            msg = 'Failed on calling {}.{} with args: {}, kwargs: {}\nException: {}' \
                .format(f.__module__, f.__name__, a, kw, str(error[0]))
            print('[!!!] ERROR:', msg)
            raise error[0]

        return rv[0]

    return wrapper

def register_module(module):
    for name, function in module.__dict__.items():
        if hasattr(function, '__call__'):
            server.register_function(wrap(function), name)

server = SimpleXMLRPCServer((host, port), logRequests=True, allow_none=True)
register_module(idc)
register_module(idautils)
register_module(idaapi)
server.register_function(lambda a: eval(a, globals(), locals()), 'eval')
server.register_introspection_functions()

print('IDA Pro xmlrpc hosted on http://%s:%s' % (host, port))
print('Call `shutdown()` to shutdown the IDA Pro xmlrpc server.')

thread = threading.Thread(target=server.serve_forever)
thread.daemon = True
thread.start()

def shutdown():
    global server
    global thread
    server.shutdown()
    server.server_close()
    del server
    del thread


text:
package org.apache.log4j.varia;

import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.helpers.OptionConverter;

/**
 * This is a very simple filter based on string matching.
 *
 *
The filter admits two options StringToMatch and
 * AcceptOnMatch. If there is a match between the value of the
 * StringToMatch option and the message of the {@link org.apache.log4j.spi.LoggingEvent},
 * then the {@link #decide(LoggingEvent)} method returns {@link org.apache.log4j.spi.Filter#ACCEPT} if
 * the AcceptOnMatch option value is true, if it is false then
 * {@link org.apache.log4j.spi.Filter#DENY} is returned. If there is no match, {@link
 * org.apache.log4j.spi.Filter#NEUTRAL} is returned.
 *
 * @author Ceki Gülcü
 * @since 0.9.0
 */
public class StringMatchFilter extends Filter {

  /**
     @deprecated Options are now handled using the JavaBeans paradigm.
     This constant is not longer needed and will be removed in the
     near term.
   */
  public static final String STRING_TO_MATCH_OPTION = "StringToMatch";

  /**
     @deprecated Options are now handled using the JavaBeans paradigm.
     This constant is not longer needed and will be removed in the
     near term.
   */
  public static final String ACCEPT_ON_MATCH_OPTION = "AcceptOnMatch";

  boolean acceptOnMatch = true;
  String stringToMatch;

  /**
     @deprecated We now use JavaBeans introspection to configure
     components. Options strings are no longer needed.
  */
  public
  String[] getOptionStrings() {
    return new String[] {STRING_TO_MATCH_OPTION, ACCEPT_ON_MATCH_OPTION};
  }

  /**
     @deprecated Use the setter method for the option directly instead
     of the generic setOption method.
  */
  public
  void setOption(String key, String value) {

    if(key.equalsIgnoreCase(STRING_TO_MATCH_OPTION)) {
      stringToMatch = value;
    } else if (key.equalsIgnoreCase(ACCEPT_ON_MATCH_OPTION)) {
      acceptOnMatch = OptionConverter.toBoolean(value, acceptOnMatch);
    }
  }

  public
  void setStringToMatch(String s) {
    stringToMatch = s;
  }

  public
  String getStringToMatch() {
    return stringToMatch;
  }

  public
  void setAcceptOnMatch(boolean acceptOnMatch) {
    this.acceptOnMatch = acceptOnMatch;
  }

  public
  boolean getAcceptOnMatch() {
    return acceptOnMatch;
  }

  /**
     Returns {@link Filter#NEUTRAL} is there is no string match.
   */
  public
  int decide(LoggingEvent event) {
    String msg = event.getRenderedMessage();

    if(msg == null ||  stringToMatch == null) {
        return Filter.NEUTRAL;
    }

    if( msg.indexOf(stringToMatch) == -1 ) {
      return Filter.NEUTRAL;
    } else { // we've got a match
      if(acceptOnMatch) {
	return Filter.ACCEPT;
      } else {
	return Filter.DENY;
      }
    }
  }
}


text:
require 'chefspec'

describe 'notifications::delayed' do
  let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '18.04').converge(described_recipe) }
  let(:template) { chef_run.template('/tmp/notifying_resource') }

  it 'sends a notification to the service' do
    expect(template).to notify('service[receiving_resource]').delayed
    expect(template).to_not notify('service[not_receiving_resource]').delayed
  end

  it 'sends the specific notification to the serivce delayed' do
    expect(template).to notify('service[receiving_resource]').to(:restart).delayed
    expect(template).to_not notify('service[receiving_resource]').to(:restart).immediately
  end
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Importer
{
    public interface IImporter
    {
        void Import();
    }
}


text:
package vkaretko;

/**
 * Part 1. Base syntax
 * Lesson 6. Control questions and test task.
 * Task. Create a program, that checks string "sub" is substring of "origin"
 * Do not use methods String.indexOf and String.contains.
 * Convert a string to an array of characters and check.
 *
 * @author Karetko Victor
 * @version 1.00
 * @since 02.11.2016
 */
public class SubString {
    /**
     * Method checks whether the string contains a substring
     *
     * @param origin string in which to search the substring
     * @param sub substring to check
     * @return true if the string contains a substring and false otherwise
     */
    boolean contains(String origin, String sub) {

        boolean result = false;

        char[] originChars = origin.toCharArray();
        char[] subChars = sub.toCharArray();

        for (int i = 0; i < originChars.length - subChars.length; i++) {
            if (originChars[i] == subChars[0]) {
                int count = 0;
                for (int j = 0; j < subChars.length; j++) {
                    if (originChars[i+j] == subChars[j]) {
                        count++;
                    }
                }
                if (count == subChars.length) {
                    result = true;
                }
            }
        }
        return result;
    }
}


text:
package com.jaalee.sdk.connection;

/**
 * Callback used to indicate state of the connection to the beacon.
 *
 */
public abstract interface ConnectionCallback
{
	/**
	 * Invoked when connection to beacon is established.
	 * @param paramBeaconCharacteristics Beacon's characteristics.
	 */
	public abstract void onAuthenticated(BeaconCharacteristics paramBeaconCharacteristics);

	/**
	 * Invoked when there was a problem within authentication to the beacon.
	 */
	public abstract void onAuthenticationError();

	/**
	 * Connection was closed to the beacon. Can happen when beacon is out of range.
	 */
	public abstract void onDisconnected();
}


text:
/**
 * Pyranid is a minimalist JDBC interface for modern Java applications.
 *

 * See https://www.pyranid.com for more detailed documentation and code samples.
 *
 *

// Minimal setup, uses defaults
Database database = Database.forDataSource(dataSource).build();

// Customized setup
Database customDatabase = Database.forDataSource(dataSource).instanceProvider(new InstanceProvider() {
  @Override
  public <T> T provide(Class<T> instanceClass) {
    // You might have your DI framework vend resultset row instances
    return guiceInjector.getInstance(instanceClass);
  }
}).resultSetMapper(new ResultSetMapper() {
  @Override
  public <T> T map(ResultSet rs, Class<T> resultClass) {
    // Do some custom mapping here
  }
}).preparedStatementBinder(new PreparedStatementBinder() {
  @Override
  public void bind(PreparedStatement ps, List<Object> parameters) {
    // Do some custom binding here
  }
}).statementLogger(new StatementLogger() {
  @Override
  public void log(StatementLog statementLog) {
    // Send log to whatever output sink you'd like
    out.println(statementLog);
  }
}).build();

// Queries
Optional<Car> specificCar = database.queryForObject("SELECT * FROM car WHERE id = ?", Car.class, 123);
List<Car> blueCars = database.queryForList("SELECT * FROM car WHERE color = ?", Car.class, Color.BLUE);
Optional<UUID> id = database.queryForObject("SELECT id FROM widget LIMIT 1", UUID.class);
List<BigDecimal> balances = database.queryForList("SELECT balance FROM account", BigDecimal.class);

// Statements
int updateCount = database.execute("UPDATE car SET color = ?", Color.RED);
Optional<UUID> id = database.executeReturning("INSERT INTO book VALUES (?) RETURNING id", UUID.class, "The Stranger");

// Transactions
database.transaction(() -> {
  BigDecimal balance1 = database.queryForObject("SELECT balance FROM account WHERE id = 1", BigDecimal.class).get();
  BigDecimal balance2 = database.queryForObject("SELECT balance FROM account WHERE id = 2", BigDecimal.class).get();

  balance1 = balance1.subtract(amount);
  balance2 = balance2.add(amount);

  database.execute("UPDATE account SET balance = ? WHERE id = 1", balance1);
  database.execute("UPDATE account SET balance = ? WHERE id = 2", balance2);
});

 *
 * @author Mark Allen
 * @since 1.0.0
 */
package com.pyranid;


text:
package com.example.wallapop.activity.base;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

import android.app.Activity;
import android.app.Application;

import com.example.wallapop.utils.Constants;
import com.example.wallapop.utils.imageloader.core.ImageLoader;
import com.example.wallapop.utils.imageloader.core.ImageLoaderConfiguration;

/**
 * Created by york on 15/4/17.
 */
public class WallapopApplication extends Application {
    /**
     * 活动的activity
     */
    public List<Activity> mActiveActivity = new LinkedList<Activity>();

    private volatile static WallapopApplication instance;

    public synchronized static WallapopApplication getInstance() {
        if (instance == null) {
            synchronized (WallapopApplication.class) {
                if (instance == null) {
                    instance = new WallapopApplication();
                }
            }
        }
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        File cacheDir = new File(Constants.dir_appcache);
        // ImageLoaderConfiguration config = new
        // ImageLoaderConfiguration.Builder(
        // getApplicationContext()).threadPoolSize(THREAD_POOL_MAX)
        // .threadPriority(Thread.NORM_PRIORITY - 2)
        // .memoryCache(new UsingFreqLimitedMemoryCache(MEMORY_CACHE_SIZE_MAX))
        // .memoryCacheExtraOptions(MAX_IMG_W_FOR_MEMORY_CACHE,
        // MAX_IMG_H_FOR_MEMORY_CACHE)
        // .denyCacheImageMultipleSizesInMemory().diskCache(new
        // UnlimitedDiskCache(cacheDir))
        // // .diskCacheFileNameGenerator(new Md5FileNameGenerator())
        // // .enableLogging() // Not necessary in common
        // // .offOutOfMemoryHandling()
        // // .memoryCache(new WeakMemoryCache())
        // .build();
        // Initialize ImageLoader with configuration.
        ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(this));
        // ImageLoader.getInstance().init(config);
    }

    // add Activity
    public void addActivity(Activity activity) {
        mActiveActivity.add(activity);
    }

    public void exit() {
        try {
            for (Activity activity : mActiveActivity) {
                if (activity != null)
                    activity.finish();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            System.exit(0);
        }
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        System.gc();
    }
}