text:
package org.seasar.doma.internal.apt.generator;

import static org.seasar.doma.internal.util.AssertionUtil.assertNotNull;

import org.seasar.doma.DomainTypeImplementation;
import org.seasar.doma.internal.ClassName;
import org.seasar.doma.internal.apt.Context;
import org.seasar.doma.internal.apt.meta.domain.DomainMeta;
import org.seasar.doma.internal.util.BoxedPrimitiveUtil;
import org.seasar.doma.jdbc.domain.AbstractDomainType;

public class DomainTypeGenerator extends AbstractGenerator {

  private final DomainMeta domainMeta;

  public DomainTypeGenerator(
      Context ctx, ClassName className, Printer printer, DomainMeta domainMeta) {
    super(ctx, className, printer);
    assertNotNull(domainMeta);
    this.domainMeta = domainMeta;
  }

  @Override
  public void generate() {
    printPackage();
    printClass();
  }

  private void printPackage() {
    if (!packageName.isEmpty()) {
      iprint("package %1$s;%n", packageName);
      iprint("%n");
    }
  }

  private void printClass() {
    if (domainMeta.isParameterized()) {
      iprint("/**%n");
      for (String typeVariable : domainMeta.getTypeVariables()) {
        iprint(" * @param <%1$s> %1$s%n", typeVariable);
      }
      iprint(" */%n");
    } else {
      iprint("/** */%n");
    }
    printGenerated();
    printDomainTypeImplementation();
    if (domainMeta.isParameterized()) {
      iprint(
          "public final class %1$s<%5$s> extends %2$s<%3$s, %4$s> {%n",
          /* 1 */ simpleName,
          /* 2 */ AbstractDomainType.class,
          /* 3 */ ctx.getMoreTypes().boxIfPrimitive(domainMeta.getValueType()),
          /* 4 */ domainMeta.getType(),
          /* 5 */ domainMeta.getTypeParameters());
    } else {
      iprint(
          "public final class %1$s extends %2$s<%3$s, %4$s> {%n",
          /* 1 */ simpleName,
          /* 2 */ AbstractDomainType.class,
          /* 3 */ ctx.getMoreTypes().boxIfPrimitive(domainMeta.getValueType()),
          /* 4 */ domainMeta.getType());
    }
    print("%n");
    indent();
    printValidateVersionStaticInitializer();
    printFields();
    printConstructors();
    printMethods();
    unindent();
    unindent();
    iprint("}%n");
  }

  private void printDomainTypeImplementation() {
    iprint("@%1$s%n", DomainTypeImplementation.class);
  }

  private void printFields() {
    if (domainMeta.isParameterized()) {
      iprint("@SuppressWarnings(\"rawtypes\")%n");
    }
    iprint("private static final %1$s singleton = new %1$s();%n", simpleName);
    print("%n");
  }

  private void printConstructors() {
    iprint("private %1$s() {%n", simpleName);
    iprint("    super(%1$s);%n", domainMeta.getBasicCtType().getWrapperSupplierCode());
    iprint("}%n");
    print("%n");
  }

  private void printMethods() {
    printNewDomainMethod();
    printGetBasicValueMethod();
    printGetBasicClassMethod();
    printGetDomainClassMethod();
    printGetSingletonInternalMethod();
  }

  private void printNewDomainMethod() {
    boolean primitive = domainMeta.getBasicCtType().isPrimitive();
    iprint("@Override%n");
    iprint(
        "protected %1$s newDomain(%2$s value) {%n",
        /* 1 */ domainMeta.getType(),
        /* 2 */ ctx.getMoreTypes().boxIfPrimitive(domainMeta.getValueType()));
    if (!primitive && !domainMeta.getAcceptNull()) {
      iprint("    if (value == null) {%n");
      iprint("        return null;%n");
      iprint("    }%n");
    }
    if (domainMeta.providesConstructor()) {
      if (primitive) {
        iprint(
            "    return new %1$s(%2$s.unbox(value));%n",
            /* 1 */ domainMeta.getType(), BoxedPrimitiveUtil.class);
      } else {
        iprint("    return new %1$s(value);%n", /* 1 */ domainMeta.getType());
      }
    } else {
      if (primitive) {
        iprint(
            "    return %1$s.%2$s(%3$s.unbox(value));%n",
            /* 1 */ domainMeta.getTypeElement(),
            /* 2 */ domainMeta.getFactoryMethod(),
            /* 3 */ BoxedPrimitiveUtil.class);
      } else {
        iprint(
            "    return %1$s.%2$s(value);%n",
            /* 1 */ domainMeta.getTypeElement(), /* 2 */ domainMeta.getFactoryMethod());
      }
    }
    iprint("}%n");
    print("%n");
  }

  private void printGetBasicValueMethod() {
    iprint("@Override%n");
    iprint(
        "protected %1$s getBasicValue(%2$s domain) {%n",
        /* 1 */ ctx.getMoreTypes().boxIfPrimitive(domainMeta.getValueType()),
        /* 2 */ domainMeta.getType());
    iprint("    if (domain == null) {%n");
    iprint("        return null;%n");
    iprint("    }%n");
    iprint("    return domain.%1$s();%n", domainMeta.getAccessorMethod());
    iprint("}%n");
    print("%n");
  }

  private void printGetBasicClassMethod() {
    iprint("@Override%n");
    iprint("public Class<?> getBasicClass() {%n");
    iprint("    return %1$s.class;%n", domainMeta.getValueType());
    iprint("}%n");
    print("%n");
  }

  private void printGetDomainClassMethod() {
    if (domainMeta.isParameterized()) {
      iprint("@SuppressWarnings(\"unchecked\")%n");
    }
    iprint("@Override%n");
    iprint("public Class<%1$s> getDomainClass() {%n", domainMeta.getType());
    if (domainMeta.isParameterized()) {
      iprint("    Class<?> clazz = %1$s.class;%n", domainMeta.getTypeElement());
      iprint("    return (Class<%1$s>) clazz;%n", domainMeta.getType());
    } else {
      iprint("    return %1$s.class;%n", domainMeta.getTypeElement());
    }
    iprint("}%n");
    print("%n");
  }

  private void printGetSingletonInternalMethod() {
    iprint("/**%n");
    iprint(" * @return the singleton%n");
    iprint(" */%n");
    if (domainMeta.isParameterized()) {
      iprint("@SuppressWarnings(\"unchecked\")%n");
      iprint(
          "public static <%1$s> %2$s<%3$s> getSingletonInternal() {%n",
          /* 1 */ domainMeta.getTypeParameters(),
          /* 2 */ simpleName,
          /* 3 */ domainMeta.getTypeVariables());
      iprint("    return (%1$s<%2$s>) singleton;%n", simpleName, domainMeta.getTypeVariables());
    } else {
      iprint("public static %1$s getSingletonInternal() {%n", simpleName);
      iprint("    return singleton;%n");
    }
    iprint("}%n");
    print("%n");
  }
}


text:
class IndexController < ApplicationController
  def verify_session
    render layout: false
  end
end

redpajama_set_name: RedPajamaGithub


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="net.adswitcher.sample.BannerFragment"
    android:id="@+id/bannerLayout">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Banner"
            android:id="@+id/textView_Banner"
            android:layout_gravity="center"
            android:layout_marginTop="150dp" />

        <CheckBox
            android:text="Auto Show"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/checkBox_AutoShow" />

        <TextView
            android:text="Banner 320x50"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/textView_Banner320x50"
            android:textAlignment="center" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:text="Load"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button_LoadBanner320x50"
                android:layout_weight="1" />

            <Button
                android:text="Show"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button_ShowBanner320x50"
                android:layout_weight="1" />

        </LinearLayout>

        <TextView
            android:text="Banner 320x100"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/textView_Banner320x100"
            android:textAlignment="center" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:text="Load"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button_LoadBanner320x100"
                android:layout_weight="1" />

            <Button
                android:text="Show"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button_ShowBanner320x100"
                android:layout_weight="1" />

        </LinearLayout>

        <TextView
            android:text="Banner 300x250"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/textView_Banner300x250"
            android:textAlignment="center" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:text="Load"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button_LoadBanner300x250"
                android:layout_weight="1" />

            <Button
                android:text="Show"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/button_ShowBanner300x250"
                android:layout_weight="1" />

        </LinearLayout>

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hide Banner"
            android:id="@+id/button_hide"
            android:layout_gravity="center_horizontal"
            android:width="150dp"
            android:layout_marginTop="20dp" />
    </LinearLayout>

</FrameLayout>


text:
#include <utils/zone_mgr.h>
#include <utils/queue_plus.h>
#include <linux/version.h>

struct vqe_zone
{
    /**
     * Name of the zone.
     */
    char name[ZONE_MAX_NAME_LEN + 1];
    /**
     * Pointer to the associated slab-cache.
     */
    struct kmem_cache *kcache;
    /**
     * Requested object size in bytes.
     */
    uint32_t req_size;
    /**
     * Adjusted object size used by the slab-cache.
     */
    uint32_t obj_size;
    /**
     * Maximum number of objects that can be allocated:  a cache with
     * without a maximum outstanding element bound is not supported.
     */
    uint32_t max;
    /**
     * Objects currently allocated.
     */
    uint32_t used;
    /**
     * High water mark for allocation.
     */
    uint32_t hiwat;
    /**
     * Failed allocations.
     */
    uint32_t alloc_fail;
    /**
     * Constructor for allocated objects.
     */
    void (*ctor)(void *data);
    /**
     * Destructor for de-allocated objects.
     */
    void (*dtor)(void *data);
    /**
     * Zone linked list entry element.
     */
    VQE_SLIST_ENTRY(vqe_zone) list_ptr;
};

static struct kmem_cache *s_zone_kcache;
static char *s_zone_cache_name;
static VQE_SLIST_HEAD(, vqe_zone) s_zone_list;
static uint32_t s_num_alloc_zones;

#define VQE_ZONE_KCACHE_FLAGS SLAB_HWCACHE_ALIGN
#define VQE_ZONE_KCACHE_MINALIGN 8

#define VQE_ZONE_ERROR(format,...) \
    printk(KERN_ERR "<vqe-zone>" format "\n", ##__VA_ARGS__);

/**---------------------------------------------------------------------------
 * Initialize a slab-cache to keep zone pointers.
 *
 * @param[out] boolean Returns true if the creation of the slab-cache
 * succeeds, or if the cache already exists.
 *---------------------------------------------------------------------------*/
#define VQE_ZONE_CACHE_NAME "__vqe_zone_cache"
static boolean
vqe_zone_cache_init (void)
{
    s_zone_cache_name = kmalloc(sizeof(VQE_ZONE_CACHE_NAME) + 1,
                                GFP_KERNEL);
    if (!s_zone_cache_name) {
        return (FALSE);
    }
    strlcpy(s_zone_cache_name, VQE_ZONE_CACHE_NAME,
            sizeof(VQE_ZONE_CACHE_NAME) + 1);
    s_zone_kcache = kmem_cache_create(s_zone_cache_name,
                                      sizeof(struct vqe_zone),
                                      VQE_ZONE_KCACHE_MINALIGN,
                                      VQE_ZONE_KCACHE_FLAGS,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
                                      NULL,
#endif
                                      NULL);
    return (s_zone_kcache != NULL);
}

/**---------------------------------------------------------------------------
 * Allocate a new zone pointer from the zone slab-cache.
 *
 * @param[out] zone* Pointer to a zone object.
 *---------------------------------------------------------------------------*/
static struct vqe_zone *
vqe_zone_cache_alloc (void)
{
    struct vqe_zone *z;

    if (!s_num_alloc_zones &&
        !vqe_zone_cache_init()) {
        VQE_ZONE_ERROR("Zone cache initialization failed");
        return (NULL);
    }

    ASSERT(s_zone_kcache != NULL);
    z = kmem_cache_alloc(s_zone_kcache, GFP_KERNEL);
    if (z) {
        s_num_alloc_zones++;
        memset(z, 0, sizeof(*z));
        VQE_SLIST_INSERT_HEAD(&s_zone_list, z, list_ptr);
    }

    return (z);
}

/**---------------------------------------------------------------------------
 * Free a zone pointer to the zone slab cache. There must not be any
 * outstanding allocations from this zone before the object can be destroyed.
 *
 * @param[in] z Pointer to the zone object.
 *---------------------------------------------------------------------------*/
static void
vqe_zone_cache_free (struct vqe_zone *z)
{
    ASSERT(s_zone_kcache != NULL);
    ASSERT(s_zone_cache_name != NULL);
    ASSERT(z != NULL);
    ASSERT(s_num_alloc_zones > 0);

    VQE_SLIST_REMOVE(&s_zone_list, z, vqe_zone, list_ptr);
    kmem_cache_free(s_zone_kcache, z);
    s_num_alloc_zones--;
    if (!s_num_alloc_zones) {
        kmem_cache_destroy(s_zone_kcache);
        kfree(s_zone_cache_name);
        s_zone_kcache = NULL;
        s_zone_cache_name = NULL;
    }
}

/**---------------------------------------------------------------------------
 * Public interface to allocate a new zone.
 *
 * @param[in] zone_name A unique name for the zone. If a zone with the
 * specified name already exists, the method will return null. This parameter
 * must be non-null.
 * @param[in] flags Used for static or dynamic zones and are ignored in this
 * implementation. All zones are dynamic.
 * @param[in] size The size of elements in the zone.
 * @param[in] max Maximum number of elements that can be allocated from
 * the zone; this parameter must be non-zero.
 * @param[in] ctor A method which is invoked on each object of the zone
 * after allocation; may be specified as null.
 * @param[out] dtor A method which is invoked on each object of the zone
 * prior to de-allocation; may be specified as null.
 * @param[out] zone* Pointer to the allocated zone.
 *---------------------------------------------------------------------------*/
struct vqe_zone *
zone_instance_get_loc (char *zone_name, int flags,
		       int size, int max,
		       void (*ctor)(void *), void (*dtor)(void *))
{
    struct vqe_zone *z = NULL, *zl;
    struct kmem_cache *kcache;

    if (!zone_name ||
        !size ||
        !max ||
        (strnlen(zone_name, ZONE_MAX_NAME_LEN+1) == ZONE_MAX_NAME_LEN+1)) {
        VQE_ZONE_ERROR("Invalid arguments (%s)", __FUNCTION__);
        goto done;
    }

    VQE_SLIST_FOREACH(zl, &s_zone_list, list_ptr) {
        if (!strcmp(zone_name, zl->name)) {
            VQE_ZONE_ERROR("Zone %s already exists", zone_name);
            goto done;
        }
    }

    z = vqe_zone_cache_alloc();
    if (!z) {
        VQE_ZONE_ERROR("Zone cache object allocation failed");
        goto done;
    }

    strlcpy(z->name, zone_name, sizeof(z->name));
    kcache = kmem_cache_create(z->name,
                               size,
                               VQE_ZONE_KCACHE_MINALIGN,
                               VQE_ZONE_KCACHE_FLAGS,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
                               NULL,
#endif
                               NULL);
    if (!kcache) {
        VQE_ZONE_ERROR("Creation of slab-cache failed");
        goto done;
    }

    z->kcache = kcache;
    z->req_size = size;
    z->obj_size = kmem_cache_size(kcache);
    z->max = max;
    z->ctor = ctor;
    z->dtor = dtor;
    return (z);

  done:
    if (z != NULL) {
        vqe_zone_cache_free(z);
    }
    return (NULL);
}

/**---------------------------------------------------------------------------
 * Public interface to destroy a zone.
 *
 * @param[in] z Pointer to the zone object.
 * @param[out] int32_t Returns 0 on success, -1 on failure.
 *---------------------------------------------------------------------------*/
int32_t
zone_instance_put (struct vqe_zone *z)
{
    int32_t rv = 0;

    ASSERT(z != NULL);
    ASSERT(z->kcache != NULL);

    if (z->used) {
        VQE_ZONE_ERROR("Zone \"%s\" has outstanding allocations (%u) "
                       "cannot be destroyed", z->name, z->used);
        rv = -1;
    } else {
        kmem_cache_destroy(z->kcache);
        vqe_zone_cache_free(z);
    }
    return (rv);
}

/**---------------------------------------------------------------------------
 * Public interface to allocate an object from a zone.
 *
 * @param[in] z Pointer to the zone object.
 * @param[out] void* Pointer to the allocated object.
 *---------------------------------------------------------------------------*/
void *
zone_acquire (struct vqe_zone *z)
{
    void *data = NULL;

    ASSERT(z != NULL);

    if (unlikely(z->used == z->max)) {
        z->alloc_fail++;
    } else {
        data = kmem_cache_alloc(z->kcache, GFP_ATOMIC);
        if (likely(data)) {
            if (unlikely(z->ctor)) {
                (*z->ctor)(data);
            }
            z->used++;
            if (unlikely(z->used > z->hiwat)) {
                z->hiwat = z->used;
            }
        } else {
            z->alloc_fail++;
        }
    }

    return (data);
}

/**---------------------------------------------------------------------------
 * Public interface to release an allocated object to it's parent zone.
 *
 * @param[in] z Pointer to the zone object.
 * @param[in] data Pointer to the allocated object.
 *---------------------------------------------------------------------------*/
void
zone_release (struct vqe_zone *z, void *data)
{
    ASSERT(z != NULL);
    ASSERT(data != NULL);

    if (unlikely(z->dtor)) {
        (*z->dtor)(data);
    }
    z->used--;
    ASSERT(z->used >= 0);
    kmem_cache_free(z->kcache, data);
}

/**---------------------------------------------------------------------------
 * Public interface to get the total static allocated size for all objects in
 * a zone - unsupported for kernel zone.
 *
 * @param[in] el_size Requested object size in bytes.
 * @param[in] num Number of objects to be created.
 * @param[out] int32_t Bytes statically allocated for the zone.
 *---------------------------------------------------------------------------*/
int32_t
zm_zone_size (int32_t el_size, int32_t num)
{
    VQE_ZONE_ERROR("Unsupported API");
    return (0);
}

/**---------------------------------------------------------------------------
 * Public interface to get the "actual" size of a zone's objects after HW
 * cache-line alignment / hidden fields.
 *
 * @param[in] z Pointer to the zone.
 * @param[out] int32_t Actual allocated size of the objects in the zone.
 *---------------------------------------------------------------------------*/
int32_t
zm_elem_size (const struct vqe_zone *z)
{
    ASSERT(z != NULL);
    return (z->obj_size);
}

/**---------------------------------------------------------------------------
 * Public interface to retrieve zone statistics.
 *
 * @param[in] z Pointer to the zone.
 * @param[out] zi Zone information pointer.
 * @param[out] Returns 0 on success, -1 on failure.
 *---------------------------------------------------------------------------*/
int32_t
zm_zone_get_info (const struct vqe_zone *z,
                  zone_info_t *zi)
{
    if (!z || !zi) {
        VQE_ZONE_ERROR("Invalid arguments (%s)", __FUNCTION__);
        return (-1);
    }

    zi->max = z->max;
    zi->used = z->used;
    zi->hiwat = z->hiwat;
    zi->alloc_fail = z->alloc_fail;
    return (0);
}

/**---------------------------------------------------------------------------
 * Public interface to shrink the slab-cache associated with a zone.
 *
 * @param[in] z Pointer to the zone.
 *---------------------------------------------------------------------------*/
void
zone_shrink_cache (struct vqe_zone *z)
{
    ASSERT(z != NULL);
    kmem_cache_shrink(z->kcache);
}

/**---------------------------------------------------------------------------
 * STUB.
 *---------------------------------------------------------------------------*/
void
zone_ctor_no_zero (void *arg)
{
}


text:
from __future__ import absolute_import

from django.db import models

class TestModel(models.Model):
    pass


text:
module Arel
  module Nodes
    class UnqualifiedColumn
      attr_accessor :attribute

      def initialize attribute
        @attribute = attribute
      end

      def column
        @attribute.column
      end

      def name
        @attribute.name
      end
    end
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Ann. Rep. N. Y. St. Mus. nat. Hist. 32: 26 (1880)

#### Original name
Agaricus anisarius Peck

### Remarks
null


text:
class Ruler < ActiveRecord::Base

  validates :gvdate,
    presence: true,
    length: {maximum: 10}
  validates :fort_group,
    presence: true,
    length: {maximum: 10}
  validates :fort_code,
    presence: true,
    length: {maximum: 10}
  validates :fort_name,
    allow_nil: true,
    length: {maximum: 100}
  validates :formal_name,
    allow_nil: true,
    length: {maximum: 100}
  validates :guild_name,
    presence: true,
    length: {maximum: 50}
  validates :source,
    presence: true,
    length: {maximum: 50}

  scope :for_date,  lambda{|d| where(gvdate: d)}
  scope :for_group, lambda{|g| where(fort_group: g)}

  class << self

    def gvdates
      self.uniq(:gvdate).pluck(:gvdate).sort
    end

  end

end


text:
// <copyright file="CalenderPrintBehavior.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

namespace WpfApp1
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Interactivity;
    using System.Windows.Media;
    using System.Windows.Shapes;

    /// <summary>
    /// Day表示用ビヘイビアクラス
    /// </summary>
    public class CalenderPrintBehavior : Behavior<Rectangle>
    {
        /// <summary>
        /// DayPropaty(xaml)を扱うプロパティ
        /// </summary>
        private static readonly DependencyProperty NumberProperty =
            DependencyProperty.Register(
                "Number", // プロパティ名を指定
                typeof(string), // プロパティの型を指定
                typeof(CalenderPrintBehavior), // プロパティを所有する型を指定
                new PropertyMetadata(string.Empty, NumberChanged)); // メタデータを指定。ここではデフォルト値を設定してる

        /// <summary>
        /// DayPropaty(xaml)を扱うプロパティ
        /// </summary>
        private static readonly DependencyProperty DateMonthProperty =
            DependencyProperty.Register(
                "Key",
                typeof(string),
                typeof(CalenderPrintBehavior),
                new PropertyMetadata(string.Empty, KeyCheck));

        private string number = string.Empty;

        private string key = string.Empty;

        /// <summary>
        /// Gets or sets 文字列Day(DayClass)の情報を扱うプロパティ
        /// </summary>
        public string Number
        {
            get { return this.number; }
            set { this.number = value; }
        }

        /// <summary>
        /// Gets or sets 先頭の文字列
        /// </summary>
        public string Key
        {
            get { return this.key; }
            set { this.key = value; }
        }

        /// <summary>
        /// 要素がアタッチ(加えられた)されたときの処理
        /// </summary>
        protected override void OnAttached()
        {
            base.OnAttached();
        }

        /// <summary>
        /// 要素がデタッチされたときの処理
        /// </summary>
        protected override void OnDetaching()
        {
            base.OnDetaching();
        }

        /// <summary>
        /// 文字列DayをCalenderDictionaryに登録したnumberに変更するメソッド
        /// </summary>
        /// <param name="d">クラス情報</param>
        /// <param name="e">変更情報</param>
        private static void NumberChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((CalenderPrintBehavior)d).Number = (string)e.NewValue;
            ((CalenderPrintBehavior)d).CreateFillResource();
        }

        /// <summary>
        /// 文字列DayをCalenderDictionaryに登録したKeyに変更するメソッド
        /// </summary>
        /// <param name="d">クラス情報</param>
        /// <param name="e">変更情報</param>
        private static void KeyCheck(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((CalenderPrintBehavior)d).Key = (string)e.NewValue;
            ((CalenderPrintBehavior)d).CreateFillResource();
        }

        private void CreateFillResource()
        {
            // keyとnumberが空でなく、かつRectangleが読み込まれているとき
            if (this.Key != string.Empty && this.Number != string.Empty && this.AssociatedObject != null)
            {
                var dayPath = this.Key + this.Number;
                var resource = this.AssociatedObject.FindResource(dayPath);
                this.AssociatedObject.Fill = (Brush)resource;
            }
        }
    }
}


text:
// can always push corresponding min to minstack
public class MinStack {

    private Stack<Integer> data;
    private Stack<Integer> min;

    /** initialize your data structure here. */
    public MinStack() {
        data = new Stack<>();
        min = new Stack<>();
    }

    public void push(int x) {
        data.push(x);
        if (min.isEmpty() || x<=min.peek()) // note: <= here
            min.push(x);
    }

    public void pop() {
        if (data.isEmpty()) return;

        if (min.peek().equals(data.peek()) min.pop();
        data.pop();
    }

    public int top() {
        return data.peek();
    }

    public int getMin() {
        return min.peek();
    }
}

class MinStack {
    private Stack<Integer> data;
    private Stack<Integer> min;

    /** initialize your data structure here. */
    public MinStack() {
        data = new Stack<>();
        min = new Stack<>();
    }

    public void push(int x) {
        data.push(x);
        if (min.isEmpty() || x<=min.peek()) min.push(x);
        else min.push(min.peek());
    }

    public void pop() {
        data.pop();
        min.pop();
    }

    public int top() {
        return data.peek();
    }

    public int getMin() {
        return min.peek();
    }
}

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack obj = new MinStack();
 * obj.push(x);
 * obj.pop();
 * int param_3 = obj.top();
 * int param_4 = obj.getMin();
 */


text:
<!DOCTYPE html>

PASS

FAIL


text:
 convert fix-spot.png -resize 16x16\>  spotify-linux-16.png
 convert fix-spot.png -resize 22x22\>  spotify-linux-22.png
 convert fix-spot.png -resize 24x24\>  spotify-linux-24.png
 convert fix-spot.png -resize 32x32\>  spotify-linux-32.png
 convert fix-spot.png -resize 48x48\>  spotify-linux-48.png
 convert fix-spot.png -resize 64x64\>  spotify-linux-64.png
 convert fix-spot.png -resize 128x128\>  spotify-linux-128.png
 convert fix-spot.png -resize 256x256\>  spotify-linux-256.png
 convert fix-spot.png -resize 512x512\>  spotify-linux-512.png


text:
extern zend_class_entry *arangodbclient_database_ce;

ZEPHIR_INIT_CLASS(ArangoDBClient_Database);

PHP_METHOD(ArangoDBClient_Database, create);
PHP_METHOD(ArangoDBClient_Database, delete);
PHP_METHOD(ArangoDBClient_Database, listDatabases);
PHP_METHOD(ArangoDBClient_Database, databases);
PHP_METHOD(ArangoDBClient_Database, listUserDatabases);
PHP_METHOD(ArangoDBClient_Database, getInfo);

ZEND_BEGIN_ARG_INFO_EX(arginfo_arangodbclient_database_create, 0, 0, 2)
	ZEND_ARG_OBJ_INFO(0, connection, ArangoDBClient\\Connection, 0)
	ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_arangodbclient_database_delete, 0, 0, 2)
	ZEND_ARG_OBJ_INFO(0, connection, ArangoDBClient\\Connection, 0)
	ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_arangodbclient_database_listdatabases, 0, 0, 1)
	ZEND_ARG_OBJ_INFO(0, connection, ArangoDBClient\\Connection, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_arangodbclient_database_databases, 0, 0, 1)
	ZEND_ARG_OBJ_INFO(0, connection, ArangoDBClient\\Connection, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_arangodbclient_database_listuserdatabases, 0, 0, 1)
	ZEND_ARG_OBJ_INFO(0, connection, ArangoDBClient\\Connection, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_arangodbclient_database_getinfo, 0, 0, 1)
	ZEND_ARG_OBJ_INFO(0, connection, ArangoDBClient\\Connection, 0)
ZEND_END_ARG_INFO()

ZEPHIR_INIT_FUNCS(arangodbclient_database_method_entry) {
	PHP_ME(ArangoDBClient_Database, create, arginfo_arangodbclient_database_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
	PHP_ME(ArangoDBClient_Database, delete, arginfo_arangodbclient_database_delete, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
	PHP_ME(ArangoDBClient_Database, listDatabases, arginfo_arangodbclient_database_listdatabases, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
	PHP_ME(ArangoDBClient_Database, databases, arginfo_arangodbclient_database_databases, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
	PHP_ME(ArangoDBClient_Database, listUserDatabases, arginfo_arangodbclient_database_listuserdatabases, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
	PHP_ME(ArangoDBClient_Database, getInfo, arginfo_arangodbclient_database_getinfo, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
	PHP_FE_END
};


text:
using std::cout;
using std::default_random_engine;
using std::endl;
using std::random_device;
using std::uniform_int_distribution;
using std::vector;

// @include
int NumCombinationsForFinalScore(int final_score,
                                 const vector<int>& individual_play_scores) {
  vector<vector<int>> num_combinations_for_score(
      individual_play_scores.size(), vector<int>(final_score + 1, 0));
  for (int i = 0; i < individual_play_scores.size(); ++i) {
    num_combinations_for_score[i][0] = 1;  // One way to reach 0.
    for (int j = 1; j <= final_score; ++j) {
      int without_this_play =
          i >= 1 ? num_combinations_for_score[i - 1][j] : 0;
      int with_this_play =
          j >= individual_play_scores[i]
              ? num_combinations_for_score[i][j - individual_play_scores[i]]
              : 0;
      num_combinations_for_score[i][j] = without_this_play + with_this_play;
    }
  }
  return num_combinations_for_score.back().back();
}
// @exclude

void SimpleTest() {
  vector<int> individual_play_scores = {2, 3, 7};
  assert(4 == NumCombinationsForFinalScore(12, individual_play_scores));
  assert(1 == NumCombinationsForFinalScore(5, individual_play_scores));
  assert(3 == NumCombinationsForFinalScore(9, individual_play_scores));
}

int CheckAnswer(int total_score, const vector<int>& score_ways) {
  vector<int> combinations(total_score + 1, 0);
  combinations[0] = 1;  // One way to reach 0.
  for (int score : score_ways) {
    for (int j = score; j <= total_score; ++j) {
      combinations[j] += combinations[j - score];
    }
  }
  return combinations[total_score];
}

int main(int argc, char* argv[]) {
  SimpleTest();
  default_random_engine gen((random_device())());
  int k;
  vector<int> individual_play_scores;
  if (argc == 1) {
    uniform_int_distribution<int> k_dis(0, 999);
    k = k_dis(gen);
    uniform_int_distribution<int> size_dis(1, 50);
    individual_play_scores.resize(size_dis(gen));
    for (int i = 0; i < individual_play_scores.size(); ++i) {
      uniform_int_distribution<int> score_dis(1, 1000);
      individual_play_scores[i] = score_dis(gen);
    }
  } else if (argc == 2) {
    k = atoi(argv[1]);
    uniform_int_distribution<int> size_dis(1, 50);
    individual_play_scores.resize(size_dis(gen));
    for (int i = 0; i < individual_play_scores.size(); ++i) {
      uniform_int_distribution<int> score_dis(1, 1000);
      individual_play_scores[i] = score_dis(gen);
    }
  } else {
    k = atoi(argv[1]);
    for (int i = 2; i < argc; ++i) {
      individual_play_scores.emplace_back(atoi(argv[i]));
    }
  }
  cout << NumCombinationsForFinalScore(k, individual_play_scores) << endl;
  assert(NumCombinationsForFinalScore(k, individual_play_scores) ==
         CheckAnswer(k, individual_play_scores));
  return 0;
}


text:
<?php
namespace Codeception\Module;

use Codeception\Lib\Interfaces\DataMapper;
use Codeception\Module as CodeceptionModule;
use Codeception\Exception\ModuleConfigException;
use Codeception\Lib\Interfaces\DependsOnModule;
use Codeception\Lib\Interfaces\DoctrineProvider;
use Codeception\TestInterface;
use Doctrine\ORM\EntityManager;
use Codeception\Util\Stub;

/**
 * Allows integration and testing for projects with Doctrine2 ORM.
 * Doctrine2 uses EntityManager to perform all database operations.
 *
 * When using with Zend Framework 2 or Symfony2 Doctrine connection is automatically retrieved from Service Locator.
 * In this case you should include either **Symfony** or **ZF2** module and specify it as dependent for Doctrine:
 *
 * ```
 * modules:
 *     enabled:
 *         - Symfony
 *         - Doctrine2:
 *             depends: Symfony
 * ```
 *
 * If you don't use any of frameworks above, you should specify a callback function to receive entity manager:
 *
 * ```
 * modules:
 *     enabled:
 *         - Doctrine2:
 *             connection_callback: ['MyDb', 'createEntityManager']
 *
 * ```
 *
 * This will use static method of `MyDb::createEntityManager()` to establish EntityManager.
 *
 * By default module will wrap everything into transaction for each test and rollback it afterwards. By doing this
 * tests won't write anything to database, and so will run much faster and will be isolate dfrom each other.
 * This behavior can be changed by specifying `cleanup: false` in config.
 *
 * ## Status
 *
 * * Maintainer: **davert**
 * * Stability: **stable**
 * * Contact: codecept@davert.mail.ua
 *
 * ## Config
 *
 * * cleanup: true - all doctrine queries will be run in transaction, which will be rolled back at the end of test.
 * * connection_callback: - callable that will return an instance of EntityManager. This is a must if you run Doctrine without Zend2 or Symfony2 frameworks
 *
 *  ### Example (`functional.suite.yml`)
 *
 *      modules:
 *         enabled: [Doctrine2]
 *         config:
 *            Doctrine2:
 *               cleanup: false
 *
 * ## Public Properties
 *
 * * `em` - Entity Manager
 */

class Doctrine2 extends CodeceptionModule implements DependsOnModule, DataMapper
{

    protected $config = [
        'cleanup' => true,
        'connection_callback' => false,
        'depends' => null
    ];

    protected $dependencyMessage = <<<EOF
Provide connection_callback function to establish database connection and get Entity Manager:

modules:
    enabled:
        - Doctrine2:
            connection_callback: [My\ConnectionClass, getEntityManager]

Or set a dependent module, which can be either Symfony or ZF2 to get EM from service locator:

modules:
    enabled:
        - Doctrine2:
            depends: Symfony
EOF;

    /**
     * @var \Doctrine\ORM\EntityManager
     */
    public $em = null;

    /**
     * @var \Codeception\Lib\Interfaces\DoctrineProvider
     */
    private $dependentModule;

    public function _depends()
    {
        if ($this->config['connection_callback']) {
            return [];
        }
        return ['Codeception\Lib\Interfaces\DoctrineProvider' => $this->dependencyMessage];
    }

    public function _inject(DoctrineProvider $dependentModule = null)
    {
        $this->dependentModule = $dependentModule;
    }

    public function _beforeSuite($settings = [])
    {
        $this->retrieveEntityManager();
    }

    public function _before(TestInterface $test)
    {
        $this->retrieveEntityManager();
        if ($this->config['cleanup']) {
            $this->em->getConnection()->beginTransaction();
        }
    }

    protected function retrieveEntityManager()
    {
        if ($this->dependentModule) {
            $this->em = $this->dependentModule->_getEntityManager();
        } else {
            if (is_callable($this->config['connection_callback'])) {
                $this->em = call_user_func($this->config['connection_callback']);
            }
        }

        if (!$this->em) {
            throw new ModuleConfigException(
                __CLASS__,
                "EntityManager can't be obtained.\n \n"
                . "Please specify either `connection_callback` config option\n"
                . "with callable which will return instance of EntityManager or\n"
                . "pass a dependent module which are Symfony or ZF2\n"
                . "to connect to Doctrine using Dependency Injection Container"
            );
        }

        if (!($this->em instanceof \Doctrine\ORM\EntityManager)) {
            throw new ModuleConfigException(
                __CLASS__,
                "Connection object is not an instance of \\Doctrine\\ORM\\EntityManager.\n"
                . "Use `connection_callback` or dependent framework modules to specify one"
            );
        }

        $this->em->getConnection()->connect();
    }

    public function _after(TestInterface $test)
    {
        if (!$this->em instanceof \Doctrine\ORM\EntityManager) {
            return;
        }
        if ($this->config['cleanup'] && $this->em->getConnection()->isTransactionActive()) {
            try {
                $this->em->getConnection()->rollback();
            } catch (\PDOException $e) {
            }
        }
        $this->clean();
        $this->em->getConnection()->close();
    }

    protected function clean()
    {
        $em = $this->em;

        $reflectedEm = new \ReflectionClass($em);
        if ($reflectedEm->hasProperty('repositories')) {
            $property = $reflectedEm->getProperty('repositories');
            $property->setAccessible(true);
            $property->setValue($em, []);
        }
        $this->em->clear();
    }

    /**
     * Performs $em->flush();
     */
    public function flushToDatabase()
    {
        $this->em->flush();
    }

    /**
     * Adds entity to repository and flushes. You can redefine it's properties with the second parameter.
     *
     * Example:
     *
     * ``` php
     * <?php
     * $I->persistEntity(new \Entity\User, array('name' => 'Miles'));
     * $I->persistEntity($user, array('name' => 'Miles'));
     * ```
     *
     * @param $obj
     * @param array $values
     */
    public function persistEntity($obj, $values = [])
    {
        if ($values) {
            $reflectedObj = new \ReflectionClass($obj);
            foreach ($values as $key => $val) {
                $property = $reflectedObj->getProperty($key);
                $property->setAccessible(true);
                $property->setValue($obj, $val);
            }
        }

        $this->em->persist($obj);
        $this->em->flush();
    }

    /**
     * Mocks the repository.
     *
     * With this action you can redefine any method of any repository.
     * Please, note: this fake repositories will be accessible through entity manager till the end of test.
     *
     * Example:
     *
     * ``` php
     * <?php
     *
     * $I->haveFakeRepository('Entity\User', array('findByUsername' => function($username) {  return null; }));
     *
     * ```
     *
     * This creates a stub class for Entity\User repository with redefined method findByUsername,
     * which will always return the NULL value.
     *
     * @param $classname
     * @param array $methods
     */
    public function haveFakeRepository($classname, $methods = [])
    {
        $em = $this->em;

        $metadata = $em->getMetadataFactory()->getMetadataFor($classname);
        $customRepositoryClassName = $metadata->customRepositoryClassName;

        if (!$customRepositoryClassName) {
            $customRepositoryClassName = '\Doctrine\ORM\EntityRepository';
        }

        $mock = Stub::make(
            $customRepositoryClassName,
            array_merge(
                [
                    '_entityName' => $metadata->name,
                    '_em' => $em,
                    '_class' => $metadata
                ],
                $methods
            )
        );
        $em->clear();
        $reflectedEm = new \ReflectionClass($em);
        if ($reflectedEm->hasProperty('repositories')) {
            $property = $reflectedEm->getProperty('repositories');
            $property->setAccessible(true);
            $property->setValue($em, array_merge($property->getValue($em), [$classname => $mock]));
        } else {
            $this->debugSection(
                'Warning',
                'Repository can\'t be mocked, the EventManager class doesn\'t have "repositories" property'
            );
        }
    }

    /**
     * Persists record into repository.
     * This method crates an entity, and sets its properties directly (via reflection).
     * Setters of entity won't be executed, but you can create almost any entity and save it to database.
     * Returns id using `getId` of newly created entity.
     *
     * ```php
     * $I->haveInRepository('Entity\User', array('name' => 'davert'));
     * ```
     */
    public function haveInRepository($entity, array $data)
    {
        $reflectedEntity = new \ReflectionClass($entity);
        $entityObject = $reflectedEntity->newInstance();
        foreach ($reflectedEntity->getProperties() as $property) {
            /** @var $property \ReflectionProperty */
            if (!isset($data[$property->name])) {
                continue;
            }
            $property->setAccessible(true);
            $property->setValue($entityObject, $data[$property->name]);
        }
        $this->em->persist($entityObject);
        $this->em->flush();

        if (method_exists($entityObject, 'getId')) {
            $id = $entityObject->getId();
            $this->debug("$entity entity created with id:$id");
            return $id;
        }
    }

    /**
     * Flushes changes to database executes a query defined by array.
     * It builds query based on array of parameters.
     * You can use entity associations to build complex queries.
     *
     * Example:
     *
     * ``` php
     * <?php
     * $I->seeInRepository('User', array('name' => 'davert'));
     * $I->seeInRepository('User', array('name' => 'davert', 'Company' => array('name' => 'Codegyre')));
     * $I->seeInRepository('Client', array('User' => array('Company' => array('name' => 'Codegyre')));
     * ?>
     * ```
     *
     * Fails if record for given criteria can\'t be found,
     *
     * @param $entity
     * @param array $params
     */
    public function seeInRepository($entity, $params = [])
    {
        $res = $this->proceedSeeInRepository($entity, $params);
        $this->assert($res);
    }

    /**
     * Flushes changes to database and performs ->findOneBy() call for current repository.
     *
     * @param $entity
     * @param array $params
     */
    public function dontSeeInRepository($entity, $params = [])
    {
        $res = $this->proceedSeeInRepository($entity, $params);
        $this->assertNot($res);
    }

    protected function proceedSeeInRepository($entity, $params = [])
    {
        // we need to store to database...
        $this->em->flush();
        $data = $this->em->getClassMetadata($entity);
        $qb = $this->em->getRepository($entity)->createQueryBuilder('s');
        $this->buildAssociationQuery($qb, $entity, 's', $params);
        $this->debug($qb->getDQL());
        $res = $qb->getQuery()->getArrayResult();

        return ['True', (count($res) > 0), "$entity with " . json_encode($params)];
    }

    /**
     * Selects field value from repository.
     * It builds query based on array of parameters.
     * You can use entity associations to build complex queries.
     *
     * Example:
     *
     * ``` php
     * <?php
     * $email = $I->grabFromRepository('User', 'email', array('name' => 'davert'));
     * ?>
     * ```
     *
     * @version 1.1
     * @param $entity
     * @param $field
     * @param array $params
     * @return array
     */
    public function grabFromRepository($entity, $field, $params = [])
    {
        // we need to store to database...
        $this->em->flush();
        $data = $this->em->getClassMetadata($entity);
        $qb = $this->em->getRepository($entity)->createQueryBuilder('s');
        $qb->select('s.' . $field);
        $this->buildAssociationQuery($qb, $entity, 's', $params);
        $this->debug($qb->getDQL());
        return $qb->getQuery()->getSingleScalarResult();
    }

    /**
     * It's Fuckin Recursive!
     *
     * @param $qb
     * @param $assoc
     * @param $alias
     * @param $params
     */
    protected function buildAssociationQuery($qb, $assoc, $alias, $params)
    {
        $data = $this->em->getClassMetadata($assoc);
        foreach ($params as $key => $val) {
            if (isset($data->associationMappings)) {
                if ($map = array_key_exists($key, $data->associationMappings)) {
                    if (is_array($val)) {
                        $qb->innerJoin("$alias.$key", $key);
                        foreach ($val as $column => $v) {
                            if (is_array($v)) {
                                $this->buildAssociationQuery($qb, $map['targetEntity'], $column, $v);
                                continue;
                            }
                            $paramname = $key . '__' . $column;
                            $qb->andWhere("$key.$column = :$paramname");
                            $qb->setParameter($paramname, $v);
                        }
                        continue;
                    }
                }
            }
            if ($val === null) {
                $qb->andWhere("s.$key IS NULL");
            } else {
                $paramname = str_replace(".", "", "s_$key");
                $qb->andWhere("s.$key = :$paramname");
                $qb->setParameter($paramname, $val);
            }
        }
    }

    public function _getEntityManager()
    {
        return $this->em;
    }
}


text:
imaiworks/cf-php-build-pack-cakephpを元に
bluemixでのcakephpの設定テスト

### License

This software includes the work that is distributed in the [Apache License 2.0].

[Apache License 2.0]:http://www.apache.org/licenses/LICENSE-2.0


text:
package com.asakusafw.vocabulary.windgate;

import com.asakusafw.windgate.core.DriverScript;

/**
 * An abstract interface of WindGate importer/exporter process description.
 * @since 0.2.2
 * @version 0.8.0
 */
public interface WindGateProcessDescription {

    /**
     * Returns the WindGate profile name to be used.
     * @return the WindGate profile name
     */
    String getProfileName();

    /**
     * Returns the driver script of this description.
     * @return the driver script
     * @throws IllegalStateException if failed to build a valid script
     */
    DriverScript getDriverScript();
}


text:
package program;

import java.util.HashMap;

public class LearningExample {
    private HashMap<Attribute, String> values;
    private Classification classification;

    public LearningExample(HashMap<Attribute, String> values, Classification classification) {
        this.values = values;
        this.classification = classification;
    }

    public Classification getClassification() {
        return classification;
    }

    public String getValue(Attribute attr) {
        return values.get(attr);
    }

}


text:
/**
 * Created by airswoop1 on 6/25/14.
 */

angular.module('formApp.DocumentUploader',[]).factory('documentUpload', ["$http", "$upload", "$q", function($http, $upload, $q) {

    function resizeDocument(file, doc_type, renderFn, callback) {

        var reader = new FileReader();
        reader.readAsDataURL(file);

        reader.onloadend = function(evt) {
            var tempImg = new Image();
            tempImg.src = reader.result;

            tempImg.onload = function () {

                var MAX_WIDTH = 800,
                    MAX_HEIGHT = 600,
                    tempW = tempImg.width,
                    tempH = tempImg.height;

                //  is it landscape? if so...
                if (tempW > tempH) {
                    if (tempW > MAX_WIDTH) {
                        tempH *= MAX_WIDTH / tempW;
                        tempW = MAX_WIDTH;
                    }
                } else {
                    if (tempH > MAX_HEIGHT) {
                        tempW *= MAX_HEIGHT / tempH;
                        tempH = MAX_HEIGHT;
                    }
                }

                var canvas = document.createElement('canvas');
                canvas.width = tempW;
                canvas.height = tempH;

                var ctx = canvas.getContext("2d");
                ctx.drawImage(this,0, 0, tempW, tempH);

                var dataURL = canvas.toDataURL(file.type);

	            renderFn(doc_type ,dataURL);

                callback(dataURL);
            }
        }
    }

    return {
        onFileSelect : function($files, $scope, type, user_id) {
            var deferred = $q.defer(),
                file = $files[0],
                data = {
                    'user_id':user_id,
                    'document_type':type,
                    'file_name': file.name,
                    'file_type':file.type
                };

            if(/(iPad|iPhone|iPod)/g.test( navigator.userAgent )){

                data['platform'] = 'ios';
	            if (window.FileReader) {
					var fileReader = new FileReader();
		            fileReader.readAsDataURL(file);
		            fileReader.onloadend = function(evt){
			            $scope.renderImg(type, evt.target.result);
		            }

	            }
                $scope.upload = $upload.upload(
                    {
                        'url': '/upload_docs',
                        'data': data,
                        'file' : file
                    }
                )
                .progress(function(evt) {
                    return deferred.promise;
                })
                .success(function(d, status, headers, config) {
                    // file is uploaded successfully

                    return deferred.resolve(d);
                })
                .error(function(err, data){
                    return deferred.reject(err);
                });

            }
            else{
                resizeDocument(file, type, $scope.renderImg, function(file_url){

                    data['file_base64'] = file_url;
                    data['platform'] = 'other';

                    $scope.upload = $upload
                        .upload({
                            'url': '/upload_docs',
                            'data': data
                        })
                        .progress(function(evt) {

                        })
                        .success(function(d, status, headers, config) {
		                    d["data"] = data;

                            // file is uploaded successfully
                            return deferred.resolve(d);
                        })
                        .error(function(err){
                            return deferred.reject(err);
                        });

                });

            }

            return deferred.promise;
        }
    }
}])
/**
 * Created by airswoop1 on 7/11/14.
 */
angular.module('formApp.apiFactory',[]).factory('API', ["$http", function($http) {
    return {
        uploadFeedback : function(formData, callback) {
            $http.post('/submit_feedback', JSON.stringify(formData))
                .success(function(data, status) {

                    if(status === 201){
                        callback(true);
                    }
                    else {
                        callback(null);
                    }
                })
                .error(function(data) {
                    console.log(data);
                    callback(null)

                });
        },

        uploadBasicInfo : function(formData, callback) {

            $http.post('/upload_user_info', JSON.stringify(formData))
                .success(function(data, status) {

                    if(status === 201){
                        callback(true, data.user_id);
                    }
                    else {
                        callback(null);
                    }
                })
                .error(function(data) {
                    console.log(data);

                    callback(null)

                });
        },

        getDocumentStatus : function(user_id, callback) {
          $http.post('/get_doc_status',JSON.stringify({"user_id":user_id}))
              .success(function(data, status){
                  callback(data);
              })
              .error(function(data){
                  callback(null);
              });
        },

	    uploadPartialInterviewInfo : function(formData, callback) {
		    $http.post('/update_user_info', JSON.stringify(formData))
			    .success(function(data, status) {

				    if(status === 201){
					    callback(true);
				    }
				    else {
					    callback(null);
				    }
			    })
			    .error(function(data) {
				    console.log(data);

				    callback(null)

			    });

	    }

    }
}])
/**
 * Created by airswoop1 on 7/30/14.
 */
angular.module('formApp.userDataFactory',[]).factory('userDataFactory',
	function(){

		this.DOC_STATUS = {
			"UPLOADED": 2,
			"IN_PROGRESS":1,
			"NOT_UPLOADED":0
		};

		var userData = {
			'docs' : {
				'IDENTITY':this.DOC_STATUS.NOT_UPLOADED,
				'RESIDENCE':this.DOC_STATUS.NOT_UPLOADED,
				'HOUSEHOLD_COMPOSITION':this.DOC_STATUS.NOT_UPLOADED,
				'AGE':this.DOC_STATUS.NOT_UPLOADED,
				'SSN':this.DOC_STATUS.NOT_UPLOADED,
				'CITIZENSHIP':this.DOC_STATUS.NOT_UPLOADED,
				'ALIEN_STATUS':this.DOC_STATUS.NOT_UPLOADED,
				'EARNED_INCOME':this.DOC_STATUS.NOT_UPLOADED,
				'ALT_INCOME':this.DOC_STATUS.NOT_UPLOADED,
				'RESOURCES':this.DOC_STATUS.NOT_UPLOADED
			},
			docProgress : {
				'IDENTITY':0,
				'RESIDENCE':0,
				'HOUSEHOLD_COMPOSITION':0,
				'AGE':0,
				'SSN':0,
				'CITIZENSHIP':0,
				'ALIEN_STATUS':0,
				'EARNED_INCOME':0,
				'ALT_INCOME':0,
				'RESOURCES':0
			},

			'interviewProgress': {
				"eligibility":false,
				"household":false,
				"income":false,
				"expenses":false
			},

			'user':{}
		};

		return {
			"userData":userData
		};

	});


text:
import unittest

from openmdao.main.api import Container
from openmdao.main.datatypes.enum import Enum

class IntTestCase(unittest.TestCase):
    def setUp(self):
        """this setup function will be called before each test in this class"""
        self.hobj = Container()

    def tearDown(self):
        """this teardown function will be called after each test"""
        self.hobj = None

    def test_constructors(self):

        try:
            self.hobj.add('nothing',
                          Enum(iotype='in'))
        except Exception, err:
            errstring = "Enum must contain at least one value."
            self.assertEqual(str(err), errstring)
        else:
            self.fail("Exception expected")

        self.hobj.add('simplest',
                      Enum(1, iotype='in'))
        self.assertEqual(1, self.hobj.simplest)

        self.hobj.add('strangest',
                      Enum(1, 1, iotype='in'))
        self.assertEqual(1, self.hobj.strangest)

        self.hobj.add('simple_nodefault',
                      Enum((1, 2, 3), iotype='in'))
        self.assertEqual(1, self.hobj.simple_nodefault)

        self.hobj.add('simple_default',
                      Enum(2, (1, 2, 3), iotype='in'))
        self.assertEqual(2, self.hobj.simple_default)

        try:
            self.hobj.add('out_of_bounds',
                          Enum(4, (1, 2, 3), iotype='in'))
        except Exception, err:
            errstring = "Default value not in values."
            self.assertEqual(str(err), errstring)
        else:
            self.fail("Exception expected")

        try:
            self.hobj.add('bad_alias_size',
                          Enum(3, (1, 2, 3), iotype='in',
                               aliases=('a', 'b')))
        except Exception, err:
            errstring = "Length of aliases does not match length of values."
            self.assertEqual(str(err), errstring)
        else:
            self.fail("Exception expected")

        self.hobj.add('good_alias_size',
                      Enum(3, (1, 2, 3), iotype='in',
                           aliases=('a', 'b', 'c')))
        self.assertEqual(3, self.hobj.good_alias_size)

    def test_set_to_default(self):

        self.hobj.add('e1', Enum(2, (0, 2, 3), iotype='in'))
        self.assertEqual(2, self.hobj.e1)
        self.hobj.e1 = 3
        self.assertEqual(3, self.hobj.e1)

        self.hobj.revert_to_defaults()

        self.assertEqual(2, self.hobj.e1)

    def test_set_to_bad_value(self):

        self.hobj.add('e1', Enum("red", ("red", "green", "blue"), iotype='in'))
        self.assertEqual('red', self.hobj.e1)
        try:
            self.hobj.e1 = "brown"
        except Exception, err:
            errstring = ": Variable 'e1' must be in ('red', 'green', 'blue'), but a value of brown <type 'str'> was specified."
            self.assertEqual(str(err), errstring)
        else:
            self.fail("Exception expected")

    def test_get_attributes(self):

        # Mixed enum
        self.hobj.add('e1', Enum("red", ("red", "green", 3), iotype='in'))
        attrs = self.hobj.get_attributes(True)
        attr = attrs['Inputs']
        self.assertTrue({'name': 'e1',
                         'id': 'e1',
                         'indent': 0,
                         'values': ('red', 'green', 3),
                         'value_types': ['str', 'str', 'int'],
                         'value': 'red',
                         'connected': '',
                         'type': 'enum',
                         'assumed_default': False} in attr)

    def enum_typecheck(self):

        self.hobj.add('E_float', Enum('2.0', (1.0, 2.0, 3.0), iotype='in'))
        self.hobj.E_float = 2
        self.assertTrue(isinstance(self.hobj.E_float, float))
        self.hobj.add('E_int', Enum('2', (1, 2, 3), iotype='in'))
        self.hobj.E_float = 3.0000
        self.assertTrue(isinstance(self.hobj.E_float, int))

if __name__ == "__main__":
    unittest.main()


text:
namespace mozc {
namespace {

class ValueCostCompare {
 public:
  bool operator()(SerializedDictionary::const_iterator a,
                  SerializedDictionary::const_iterator b) const {
    return a.cost() < b.cost();
  }
};

class IsEqualValue {
 public:
  bool operator()(const SerializedDictionary::const_iterator a,
                  const SerializedDictionary::const_iterator b) const {
    return a.value() == b.value();
  }
};

// Insert Emoticon into the |segment|
// Top |initial_insert_size| candidates are inserted from |initial_insert_pos|.
// Remained candidates are added to the buttom.
void InsertCandidates(SerializedDictionary::const_iterator begin,
                      SerializedDictionary::const_iterator end,
                      size_t initial_insert_pos, size_t initial_insert_size,
                      bool is_no_learning, Segment *segment) {
  if (segment->candidates_size() == 0) {
    LOG(WARNING) << "candidates_size is 0";
    return;
  }

  const Segment::Candidate &base_candidate = segment->candidate(0);
  size_t offset = std::min(initial_insert_pos, segment->candidates_size());

  // Sort values by cost just in case
  std::vector<SerializedDictionary::const_iterator> sorted_value;
  for (auto iter = begin; iter != end; ++iter) {
    sorted_value.push_back(iter);
  }

  std::sort(sorted_value.begin(), sorted_value.end(), ValueCostCompare());

  // after sorting the values by |cost|, adjacent candidates
  // will have the same value. It is almost OK to use std::unique to
  // remove dup entries, it is not a perfect way though.
  sorted_value.erase(
      std::unique(sorted_value.begin(), sorted_value.end(), IsEqualValue()),
      sorted_value.end());

  for (size_t i = 0; i < sorted_value.size(); ++i) {
    Segment::Candidate *c = nullptr;

    if (i < initial_insert_size) {
      c = segment->insert_candidate(offset);
      ++offset;
    } else {
      c = segment->push_back_candidate();
    }

    if (c == nullptr) {
      LOG(ERROR) << "cannot insert candidate at " << offset;
      continue;
    }

    c->Init();
    // TODO(taku): set an appropriate POS here.
    c->lid = sorted_value[i].lid();
    c->rid = sorted_value[i].rid();
    c->cost = base_candidate.cost;
    c->value.assign(sorted_value[i].value().data(),
                    sorted_value[i].value().size());
    c->content_value = c->value;
    c->key = base_candidate.key;
    c->content_key = base_candidate.content_key;
    // no full/half width normalizations
    c->attributes |= Segment::Candidate::NO_EXTRA_DESCRIPTION;
    c->attributes |= Segment::Candidate::NO_VARIANTS_EXPANSION;
    c->attributes |= Segment::Candidate::CONTEXT_SENSITIVE;
    if (is_no_learning) {
      c->attributes |= Segment::Candidate::NO_LEARNING;
    }

    constexpr char kBaseEmoticonDescription[] = "顔文字";

    if (sorted_value[i].description().empty()) {
      c->description = kBaseEmoticonDescription;
    } else {
      std::string description = kBaseEmoticonDescription;
      description.append(" ");
      description.append(sorted_value[i].description().data(),
                         sorted_value[i].description().size());
      c->description = description;
    }
  }
}

}  // namespace

bool EmoticonRewriter::RewriteCandidate(Segments *segments) const {
  bool modified = false;
  for (size_t i = 0; i < segments->conversion_segments_size(); ++i) {
    const Segment &segment = segments->conversion_segment(i);
    const std::string &key = segment.key();
    if (key.empty()) {
      // This case happens for zero query suggestion.
      continue;
    }
    bool is_no_learning = false;
    SerializedDictionary::const_iterator begin;
    SerializedDictionary::const_iterator end = dic_.end();
    size_t initial_insert_size = 0;
    size_t initial_insert_pos = 0;

    // TODO(taku): Emoticon dictionary does not always include "facemark".
    // Displaying non-facemarks with "かおもじ" is not always correct.
    // We have to distinguish pure facemarks and other symbol marks.

    if (key == "かおもじ") {
      // When key is "かおもじ", default candidate size should be small enough.
      // It is safe to expand all candidates at this time.
      begin = dic_.begin();
      CHECK(begin != dic_.end());
      end = dic_.end();
      // set large value(100) so that all candidates are pushed to the bottom
      initial_insert_pos = RewriterUtil::CalculateInsertPosition(segment, 100);
      initial_insert_size = dic_.size();
    } else if (key == "かお") {
      // When key is "かお", expand all candidates in conservative way.
      begin = dic_.begin();
      CHECK(begin != dic_.end());
      // first 6 candidates are inserted at 4 th position.
      // Other candidates are pushed to the buttom.
      initial_insert_pos = RewriterUtil::CalculateInsertPosition(segment, 4);
      initial_insert_size = 6;
    } else if (key == "ふくわらい") {
      // Choose one emoticon randomly from the dictionary.
      // TODO(taku): want to make it "generate" more funny emoticon.
      begin = dic_.begin();
      CHECK(begin != dic_.end());
      uint32_t n = 0;
      // use secure random not to predict the next emoticon.
      Util::GetRandomSequence(reinterpret_cast<char *>(&n), sizeof(n));
      begin += n % dic_.size();
      end = begin + 1;
      initial_insert_pos = RewriterUtil::CalculateInsertPosition(segment, 4);
      initial_insert_size = 1;
      is_no_learning = true;  // do not learn this candidate.
    } else {
      const auto range = dic_.equal_range(key);
      begin = range.first;
      end = range.second;
      if (begin != end) {
        initial_insert_pos = RewriterUtil::CalculateInsertPosition(segment, 6);
        initial_insert_size = std::distance(begin, end);
      }
    }

    if (begin == end) {
      continue;
    }

    InsertCandidates(begin, end, initial_insert_pos, initial_insert_size,
                     is_no_learning, segments->mutable_conversion_segment(i));
    modified = true;
  }

  return modified;
}

std::unique_ptr<EmoticonRewriter> EmoticonRewriter::CreateFromDataManager(
    const DataManagerInterface &data_manager) {
  absl::string_view token_array_data, string_array_data;
  data_manager.GetEmoticonRewriterData(&token_array_data, &string_array_data);
  return std::make_unique<EmoticonRewriter>(token_array_data,
                                            string_array_data);
}

EmoticonRewriter::EmoticonRewriter(absl::string_view token_array_data,
                                   absl::string_view string_array_data)
    : dic_(token_array_data, string_array_data) {}

EmoticonRewriter::~EmoticonRewriter() = default;

int EmoticonRewriter::capability(const ConversionRequest &request) const {
  if (request.request().mixed_conversion()) {
    return RewriterInterface::ALL;
  }
  return RewriterInterface::CONVERSION;
}

bool EmoticonRewriter::Rewrite(const ConversionRequest &request,
                               Segments *segments) const {
  if (!request.config().use_emoticon_conversion()) {
    VLOG(2) << "no use_emoticon_conversion";
    return false;
  }
  return RewriteCandidate(segments);
}
}  // namespace mozc


text:
<?php

namespace Joli\Php7Checker\tests\Functional;

class ListHandlingChangedTest extends AbstractFunctionalTestCase
{
    public function testItFindsNoErrorWhenNotUsingEmptyList()
    {
        $this->assertErrors([], 'Checker/ListHandlingChanged/test1.php');
        $this->assertErrors([], 'Checker/ListHandlingChanged/test5.php');
    }

    public function testItFindsErrorWhenUsingEmptyList()
    {
        $this->assertErrors([
            [3, 'Empty list() assignments are no longer supported.'],
        ], 'Checker/ListHandlingChanged/test2.php');

        $this->assertErrors([
            [3, 'Empty list() assignments are no longer supported.'],
        ], 'Checker/ListHandlingChanged/test3.php');

        $this->assertErrors([
            [3, 'Empty list() assignments are no longer supported.'],
        ], 'Checker/ListHandlingChanged/test4.php');
    }
}


text:
export LLAMA_AM_SERVER_OPTS="-Xmx1024m ${LLAMA_AM_SERVER_OPTS}"

export LLAMA_AM_SERVER_CLASSPATH=${LLAMA_AM_SERVER_CLASSPATH}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Rabdosia flexicaulis C.Y.Wu & H.W.Li

### Remarks
null


text:
/*global define*/
define([
    'oro/datagrid/action/model-action',
    'oroworkflow/js/activation-handler'
], function (ModelAction, ActivationHandler) {
    'use strict';

    var WorkflowActivateAction;

    /**
     * Activate AJAX action, triggers confirmation dialog and activate workflow definition
     *
     * @export  oro/datagrid/action/workflow-activate-action
     * @class   oro.datagrid.action.WorkflowActivateAction
     * @extends oro.datagrid.action.ModelAction
     */
    WorkflowActivateAction = ModelAction.extend({
        execute: function () {
            var datagrid = this.datagrid;

            this.on('activation_start', function () {
                datagrid.showLoading();
            });
            this.on('activation_success', function () {
                datagrid.hideLoading();
                datagrid.collection.fetch({reset: true});
            });
            this.on('activation_error', function (xhr) {
                datagrid.hideLoading();
            });

            ActivationHandler.call(this, this.getLink());
        }
    });

    return WorkflowActivateAction;
});


text:
package utils;

import java.util.AbstractQueue;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

/**
 * A shameless copy of Java's ArrayBlockingQueue with only a minor difference:
 * the elements in this queue are unique. When a new element is added to the queue
 * the contains() method is called and the new element is only added to the queue
 * if it does not already exist in this queue. Another subtle difference of this
 * class is the availability of a blocking peek() method: you can "peek", get an
 * element without removing it, however, if the queue is empty, the calling thread
 * is blocked until an element is added to the queue.
 *
 * @author Mehran Maghoumi
 *
 */

public class UniqueBlockingQueue<E> extends AbstractQueue<E>
		implements BlockingQueue<E>, java.io.Serializable {

	/**
	 * Serialization ID. This class relies on default serialization even for the
	 * items array, which is default-serialized, even if it is empty. Otherwise
	 * it could not be declared final, which is necessary here.
	 */
	private static final long serialVersionUID = -817911632652898426L;

	/** The queued items */
	final Object[] items;

	/** items index for next take, poll, peek or remove */
	int takeIndex;

	/** items index for next put, offer, or add */
	int putIndex;

	/** Number of elements in the queue */
	int count;

	/*
	 * Concurrency control uses the classic two-condition algorithm found in any
	 * textbook.
	 */

	/** Main lock guarding all access */
	final ReentrantLock lock;
	/** Condition for waiting takes */
	private final Condition notEmpty;
	/** Condition for waiting puts */
	private final Condition notFull;

	// Internal helper methods

	/**
	 * Circularly increment i.
	 */
	final int inc(int i) {
		return (++i == items.length) ? 0 : i;
	}

	/**
	 * Circularly decrement i.
	 */
	final int dec(int i) {
		return ((i == 0) ? items.length : i) - 1;
	}

	@SuppressWarnings("unchecked")
	static <E> E cast(Object item) {
		return (E) item;
	}

	/**
	 * Returns item at index i.
	 */
	final E itemAt(int i) {
		return this.<E> cast(items[i]);
	}

	/**
	 * Throws NullPointerException if argument is null.
	 *
	 * @param v
	 *            the element
	 */
	private static void checkNotNull(Object v) {
		if (v == null)
			throw new NullPointerException();
	}

	/**
	 * Inserts element at current put position, advances, and signals. Call only
	 * when holding lock.
	 */
	private void insert(E x) {
		// if we already have the element in the queue, just mimic an add!
		if (contains(x)) {
			notEmpty.signal();
			return;
		}

		items[putIndex] = x;
		putIndex = inc(putIndex);
		++count;
		notEmpty.signal();
	}

	/**
	 * Extracts element at current take position, advances, and signals. Call
	 * only when holding lock.
	 */
	private E extract() {
		final Object[] items = this.items;
		E x = this.<E> cast(items[takeIndex]);
		items[takeIndex] = null;
		takeIndex = inc(takeIndex);
		--count;
		notFull.signal();
		return x;
	}

	/**
	 * Deletes item at position i. Utility for remove and iterator.remove. Call
	 * only when holding lock.
	 */
	void removeAt(int i) {
		final Object[] items = this.items;
		// if removing front item, just advance
		if (i == takeIndex) {
			items[takeIndex] = null;
			takeIndex = inc(takeIndex);
		} else {
			// slide over all others up through putIndex.
			for (;;) {
				int nexti = inc(i);
				if (nexti != putIndex) {
					items[i] = items[nexti];
					i = nexti;
				} else {
					items[i] = null;
					putIndex = i;
					break;
				}
			}
		}
		--count;
		notFull.signal();
	}

	/**
	 * Creates an {@code ArrayBlockingQueue} with the given (fixed) capacity and
	 * default access policy.
	 *
	 * @param capacity
	 *            the capacity of this queue
	 * @throws IllegalArgumentException
	 *             if {@code capacity < 1}
	 */
	public UniqueBlockingQueue(int capacity) {
		this(capacity, false);
	}

	/**
	 * Creates an {@code ArrayBlockingQueue} with the given (fixed) capacity and
	 * the specified access policy.
	 *
	 * @param capacity
	 *            the capacity of this queue
	 * @param fair
	 *            if {@code true} then queue accesses for threads blocked on
	 *            insertion or removal, are processed in FIFO order; if
	 *            {@code false} the access order is unspecified.
	 * @throws IllegalArgumentException
	 *             if {@code capacity < 1}
	 */
	public UniqueBlockingQueue(int capacity, boolean fair) {
		if (capacity <= 0)
			throw new IllegalArgumentException();
		this.items = new Object[capacity];
		lock = new ReentrantLock(fair);
		notEmpty = lock.newCondition();
		notFull = lock.newCondition();
	}

	/**
	 * Creates an {@code ArrayBlockingQueue} with the given (fixed) capacity,
	 * the specified access policy and initially containing the elements of the
	 * given collection, added in traversal order of the collection's iterator.
	 *
	 * @param capacity
	 *            the capacity of this queue
	 * @param fair
	 *            if {@code true} then queue accesses for threads blocked on
	 *            insertion or removal, are processed in FIFO order; if
	 *            {@code false} the access order is unspecified.
	 * @param c
	 *            the collection of elements to initially contain
	 * @throws IllegalArgumentException
	 *             if {@code capacity} is less than {@code c.size()}, or less
	 *             than 1.
	 * @throws NullPointerException
	 *             if the specified collection or any of its elements are null
	 */
	public UniqueBlockingQueue(int capacity, boolean fair,
			Collection<? extends E> c) {
		this(capacity, fair);

		final ReentrantLock lock = this.lock;
		lock.lock(); // Lock only for visibility, not mutual exclusion
		try {
			int i = 0;
			try {
				for (E e : c) {
					checkNotNull(e);
					items[i++] = e;
				}
			} catch (ArrayIndexOutOfBoundsException ex) {
				throw new IllegalArgumentException();
			}
			count = i;
			putIndex = (i == capacity) ? 0 : i;
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Inserts the specified element at the tail of this queue if it is possible
	 * to do so immediately without exceeding the queue's capacity, returning
	 * {@code true} upon success and throwing an {@code IllegalStateException}
	 * if this queue is full.
	 *
	 * @param e
	 *            the element to add
	 * @return {@code true} (as specified by {@link Collection#add})
	 * @throws IllegalStateException
	 *             if this queue is full
	 * @throws NullPointerException
	 *             if the specified element is null
	 */
	public boolean add(E e) {
		return super.add(e);
	}

	/**
	 * Inserts the specified element at the tail of this queue if it is possible
	 * to do so immediately without exceeding the queue's capacity, returning
	 * {@code true} upon success and {@code false} if this queue is full. This
	 * method is generally preferable to method {@link #add}, which can fail to
	 * insert an element only by throwing an exception.
	 *
	 * @throws NullPointerException
	 *             if the specified element is null
	 */
	public boolean offer(E e) {
		checkNotNull(e);
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			if (count == items.length)
				return false;
			else {
				insert(e);
				return true;
			}
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Inserts the specified element at the tail of this queue, waiting for
	 * space to become available if the queue is full.
	 *
	 * @throws InterruptedException
	 *             {@inheritDoc}
	 * @throws NullPointerException
	 *             {@inheritDoc}
	 */
	public void put(E e) throws InterruptedException {
		checkNotNull(e);
		final ReentrantLock lock = this.lock;
		lock.lockInterruptibly();
		try {
			while (count == items.length)
				notFull.await();
			insert(e);
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Inserts the specified element at the tail of this queue, waiting up to
	 * the specified wait time for space to become available if the queue is
	 * full.
	 *
	 * @throws InterruptedException
	 *             {@inheritDoc}
	 * @throws NullPointerException
	 *             {@inheritDoc}
	 */
	public boolean offer(E e, long timeout, TimeUnit unit)
			throws InterruptedException {

		checkNotNull(e);
		long nanos = unit.toNanos(timeout);
		final ReentrantLock lock = this.lock;
		lock.lockInterruptibly();
		try {
			while (count == items.length) {
				if (nanos <= 0)
					return false;
				nanos = notFull.awaitNanos(nanos);
			}
			insert(e);
			return true;
		} finally {
			lock.unlock();
		}
	}

	public E poll() {
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			return (count == 0) ? null : extract();
		} finally {
			lock.unlock();
		}
	}

	public E take() throws InterruptedException {
		final ReentrantLock lock = this.lock;
		lock.lockInterruptibly();
		try {
			while (count == 0)
				notEmpty.await();
			return extract();
		} finally {
			lock.unlock();
		}
	}

	public E poll(long timeout, TimeUnit unit) throws InterruptedException {
		long nanos = unit.toNanos(timeout);
		final ReentrantLock lock = this.lock;
		lock.lockInterruptibly();
		try {
			while (count == 0) {
				if (nanos <= 0)
					return null;
				nanos = notEmpty.awaitNanos(nanos);
			}
			return extract();
		} finally {
			lock.unlock();
		}
	}

	public E peek() {
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			return (count == 0) ? null : itemAt(takeIndex);
		} finally {
			lock.unlock();
		}
	}

	/**
     * Retrieves, but does not remove, the head of this queue.
     * Will block the calling thread if the queue is empty!!
     *
     * @return the head of this queue
     */
	public E blockPeek() throws InterruptedException {
		final ReentrantLock lock = this.lock;
		lock.lockInterruptibly();
		try {
			while (count == 0)
				notEmpty.await();
			return itemAt(takeIndex);
		} finally {
			lock.unlock();
		}
	}

	// this doc comment is overridden to remove the reference to collections
	// greater in size than Integer.MAX_VALUE
	/**
	 * Returns the number of elements in this queue.
	 *
	 * @return the number of elements in this queue
	 */
	public int size() {
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			return count;
		} finally {
			lock.unlock();
		}
	}

	// this doc comment is a modified copy of the inherited doc comment,
	// without the reference to unlimited queues.
	/**
	 * Returns the number of additional elements that this queue can ideally (in
	 * the absence of memory or resource constraints) accept without blocking.
	 * This is always equal to the initial capacity of this queue less the
	 * current {@code size} of this queue.
	 *
	 *

	 * Note that you cannot always tell if an attempt to insert an
	 * element will succeed by inspecting {@code remainingCapacity} because it
	 * may be the case that another thread is about to insert or remove an
	 * element.
	 */
	public int remainingCapacity() {
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			return items.length - count;
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Removes a single instance of the specified element from this queue, if it
	 * is present. More formally, removes an element {@code e} such that
	 * {@code o.equals(e)}, if this queue contains one or more such elements.
	 * Returns {@code true} if this queue contained the specified element (or
	 * equivalently, if this queue changed as a result of the call).
	 *
	 *

	 * Removal of interior elements in circular array based queues is an
	 * intrinsically slow and disruptive operation, so should be undertaken only
	 * in exceptional circumstances, ideally only when the queue is known not to
	 * be accessible by other threads.
	 *
	 * @param o
	 *            element to be removed from this queue, if present
	 * @return {@code true} if this queue changed as a result of the call
	 */
	public boolean remove(Object o) {
		if (o == null)
			return false;
		final Object[] items = this.items;
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			for (int i = takeIndex, k = count; k > 0; i = inc(i), k--) {
				if (o.equals(items[i])) {
					removeAt(i);
					return true;
				}
			}
			return false;
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Returns {@code true} if this queue contains the specified element. More
	 * formally, returns {@code true} if and only if this queue contains at
	 * least one element {@code e} such that {@code o.equals(e)}.
	 *
	 * @param o
	 *            object to be checked for containment in this queue
	 * @return {@code true} if this queue contains the specified element
	 */
	public boolean contains(Object o) {
		if (o == null)
			return false;
		final Object[] items = this.items;
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			for (int i = takeIndex, k = count; k > 0; i = inc(i), k--)
				if (o.equals(items[i]))
					return true;
			return false;
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Returns an array containing all of the elements in this queue, in proper
	 * sequence.
	 *
	 *

	 * The returned array will be "safe" in that no references to it are
	 * maintained by this queue. (In other words, this method must allocate a
	 * new array). The caller is thus free to modify the returned array.
	 *
	 *

	 * This method acts as bridge between array-based and collection-based APIs.
	 *
	 * @return an array containing all of the elements in this queue
	 */
	public Object[] toArray() {
		final Object[] items = this.items;
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			final int count = this.count;
			Object[] a = new Object[count];
			for (int i = takeIndex, k = 0; k < count; i = inc(i), k++)
				a[k] = items[i];
			return a;
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Returns an array containing all of the elements in this queue, in proper
	 * sequence; the runtime type of the returned array is that of the specified
	 * array. If the queue fits in the specified array, it is returned therein.
	 * Otherwise, a new array is allocated with the runtime type of the
	 * specified array and the size of this queue.
	 *
	 *

	 * If this queue fits in the specified array with room to spare (i.e., the
	 * array has more elements than this queue), the element in the array
	 * immediately following the end of the queue is set to {@code null}.
	 *
	 *

	 * Like the {@link #toArray()} method, this method acts as bridge between
	 * array-based and collection-based APIs. Further, this method allows
	 * precise control over the runtime type of the output array, and may, under
	 * certain circumstances, be used to save allocation costs.
	 *
	 *

	 * Suppose {@code x} is a queue known to contain only strings. The following
	 * code can be used to dump the queue into a newly allocated array of
	 * {@code String}:
	 *
	 *

	 * String[] y = x.toArray(new String[0]);
	 *

	 *
	 * Note that {@code toArray(new Object[0])} is identical in function to
	 * {@code toArray()}.
	 *
	 * @param a
	 *            the array into which the elements of the queue are to be
	 *            stored, if it is big enough; otherwise, a new array of the
	 *            same runtime type is allocated for this purpose
	 * @return an array containing all of the elements in this queue
	 * @throws ArrayStoreException
	 *             if the runtime type of the specified array is not a supertype
	 *             of the runtime type of every element in this queue
	 * @throws NullPointerException
	 *             if the specified array is null
	 */
	@SuppressWarnings("unchecked")
	public <T> T[] toArray(T[] a) {
		final Object[] items = this.items;
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			final int count = this.count;
			final int len = a.length;
			if (len < count)
				a = (T[]) java.lang.reflect.Array.newInstance(
						a.getClass().getComponentType(), count);
			for (int i = takeIndex, k = 0; k < count; i = inc(i), k++)
				a[k] = (T) items[i];
			if (len > count)
				a[count] = null;
			return a;
		} finally {
			lock.unlock();
		}
	}

	public String toString() {
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			int k = count;
			if (k == 0)
				return "[]";

			StringBuilder sb = new StringBuilder();
			sb.append('[');
			for (int i = takeIndex;; i = inc(i)) {
				Object e = items[i];
				sb.append(e == this ? "(this Collection)" : e);
				if (--k == 0)
					return sb.append(']').toString();
				sb.append(',').append(' ');
			}
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Atomically removes all of the elements from this queue. The queue will be
	 * empty after this call returns.
	 */
	public void clear() {
		final Object[] items = this.items;
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			for (int i = takeIndex, k = count; k > 0; i = inc(i), k--)
				items[i] = null;
			count = 0;
			putIndex = 0;
			takeIndex = 0;
			notFull.signalAll();
		} finally {
			lock.unlock();
		}
	}

	/**
	 * @throws UnsupportedOperationException
	 *             {@inheritDoc}
	 * @throws ClassCastException
	 *             {@inheritDoc}
	 * @throws NullPointerException
	 *             {@inheritDoc}
	 * @throws IllegalArgumentException
	 *             {@inheritDoc}
	 */
	public int drainTo(Collection<? super E> c) {
		checkNotNull(c);
		if (c == this)
			throw new IllegalArgumentException();
		final Object[] items = this.items;
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			int i = takeIndex;
			int n = 0;
			int max = count;
			while (n < max) {
				c.add(this.<E> cast(items[i]));
				items[i] = null;
				i = inc(i);
				++n;
			}
			if (n > 0) {
				count = 0;
				putIndex = 0;
				takeIndex = 0;
				notFull.signalAll();
			}
			return n;
		} finally {
			lock.unlock();
		}
	}

	/**
	 * @throws UnsupportedOperationException
	 *             {@inheritDoc}
	 * @throws ClassCastException
	 *             {@inheritDoc}
	 * @throws NullPointerException
	 *             {@inheritDoc}
	 * @throws IllegalArgumentException
	 *             {@inheritDoc}
	 */
	public int drainTo(Collection<? super E> c, int maxElements) {
		checkNotNull(c);
		if (c == this)
			throw new IllegalArgumentException();
		if (maxElements <= 0)
			return 0;
		final Object[] items = this.items;
		final ReentrantLock lock = this.lock;
		lock.lock();
		try {
			int i = takeIndex;
			int n = 0;
			int max = (maxElements < count) ? maxElements : count;
			while (n < max) {
				c.add(this.<E> cast(items[i]));
				items[i] = null;
				i = inc(i);
				++n;
			}
			if (n > 0) {
				count -= n;
				takeIndex = i;
				notFull.signalAll();
			}
			return n;
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Returns an iterator over the elements in this queue in proper sequence.
	 * The elements will be returned in order from first (head) to last (tail).
	 *
	 *

	 * The returned {@code Iterator} is a "weakly consistent" iterator that will
	 * never throw {@link java.util.ConcurrentModificationException
	 * ConcurrentModificationException}, and guarantees to traverse elements as
	 * they existed upon construction of the iterator, and may (but is not
	 * guaranteed to) reflect any modifications subsequent to construction.
	 *
	 * @return an iterator over the elements in this queue in proper sequence
	 */
	public Iterator<E> iterator() {
		return new Itr();
	}

	/**
	 * Iterator for ArrayBlockingQueue. To maintain weak consistency with
	 * respect to puts and takes, we (1) read ahead one slot, so as to not
	 * report hasNext true but then not have an element to return -- however we
	 * later recheck this slot to use the most current value; (2) ensure that
	 * each array slot is traversed at most once (by tracking "remaining"
	 * elements); (3) skip over null slots, which can occur if takes race ahead
	 * of iterators. However, for circular array-based queues, we cannot rely on
	 * any well established definition of what it means to be weakly consistent
	 * with respect to interior removes since these may require slot overwrites
	 * in the process of sliding elements to cover gaps. So we settle for
	 * resiliency, operating on established apparent nexts, which may miss some
	 * elements that have moved between calls to next.
	 */
	private class Itr implements Iterator<E> {
		private int remaining; // Number of elements yet to be returned
		private int nextIndex; // Index of element to be returned by next
		private E nextItem; // Element to be returned by next call to next
		private E lastItem; // Element returned by last call to next
		private int lastRet; // Index of last element returned, or -1 if none

		Itr() {
			final ReentrantLock lock = UniqueBlockingQueue.this.lock;
			lock.lock();
			try {
				lastRet = -1;
				if ((remaining = count) > 0)
					nextItem = itemAt(nextIndex = takeIndex);
			} finally {
				lock.unlock();
			}
		}

		public boolean hasNext() {
			return remaining > 0;
		}

		public E next() {
			final ReentrantLock lock = UniqueBlockingQueue.this.lock;
			lock.lock();
			try {
				if (remaining <= 0)
					throw new NoSuchElementException();
				lastRet = nextIndex;
				E x = itemAt(nextIndex); // check for fresher value
				if (x == null) {
					x = nextItem; // we are forced to report old value
					lastItem = null; // but ensure remove fails
				}
				else
					lastItem = x;
				while (--remaining > 0 && // skip over nulls
						(nextItem = itemAt(nextIndex = inc(nextIndex))) == null)
					;
				return x;
			} finally {
				lock.unlock();
			}
		}

		public void remove() {
			final ReentrantLock lock = UniqueBlockingQueue.this.lock;
			lock.lock();
			try {
				int i = lastRet;
				if (i == -1)
					throw new IllegalStateException();
				lastRet = -1;
				E x = lastItem;
				lastItem = null;
				// only remove if item still at index
				if (x != null && x == items[i]) {
					boolean removingHead = (i == takeIndex);
					removeAt(i);
					if (!removingHead)
						nextIndex = dec(nextIndex);
				}
			} finally {
				lock.unlock();
			}
		}
	}

}


text:
var $ = global.$ = global.jQuery = require('jquery');
var Backbone = require('backbone');
var _ = global._ = require('underscore');
Backbone.$ = $;
var Marionette = require('backbone.marionette');

var Bluebird = require('bluebird');

require('utils/exceptions');
Bluebird.onPossiblyUnhandledRejection(function (error) {
	throw error;
});

// preloaders
var preload = require('utils/imagePreloader');

Marionette.Application.prototype.registerPreloader =
    function (identifier, options, func) {
        var promise;

        this.preloaders = this.preloaders || {};

        options = _.defaults(options || {}, {
            collections: [],
            routeDependent: false, //this is important- if we're waiting on a specific
            waitCount: 5
        });

        options.getImages = func;

        //Intentionally creating a closure so the promise var is maintained between calls;
        options.preload = function (collections, parameters) {
            var collectionsNeeded = _.map(options.collections, function (collection) {
                return collections[collection].promise;
            });

            if (options.routeDependent) {
                if (_.isEmpty(parameters)) {
                    throw "Route parameters must be passed";
                } else {
                    collectionsNeeded.push(parameters);
                    promise = false; //reset it since we have to be able to run this for different routes
                }
            }

            if (!promise) {
                promise = Bluebird.all(collectionsNeeded).spread(options.getImages).then(function (paths) {
                    return preload(paths, options.waitCount);
                }).then(function () {
                    return collectionsNeeded;
                });
            }

            return promise;
        };

        this.preloaders[identifier] = options;
    };

// Transition Regions
var TransitionRegion = require('./regions/TransitionRegion');

var mainTransitionRegion = new Marionette.TransitionRegion({
    el: '#region-main'
});

app = new Marionette.Application();

app.addRegions({
    regionMain: mainTransitionRegion,
    regionHeader: '#region-header'
});

app.Behaviors = app.Behaviors || {};

Marionette.Behaviors.behaviorsLookup = function() {
    return app.Behaviors;
};

app.addInitializer(function() {

    Backbone.history.start({
        pushState: true,
        root: '/'
    });

});

module.exports = app;


text:
#include <unistd.h>
#include <string.h>

#include <ns/lvl4_state_machine.h>
#include <ns/log.h>

ns::Lvl4SM::Lvl4SM():
	_reconnect(false),
	_reprocess(false)
{
}

ns::Lvl4SM::~Lvl4SM()
{
}

bool ns::Lvl4SM::process_lvl4_data(int s, uint32_t navail, Target const& target, HostSM& hsm)
{
	_D(BOOST_LOG_NAMED_SCOPE("Lvl4SM::process_lvl4_data"));

	uint32_t prev_pos = _buf.size();
	unsigned char* buf_read = _buf.grow_by(navail);
	int nread = read(s, buf_read, navail);
	if (nread <= 0) {
		// TODO: callback
		_D(BOOST_LOG_TRIVIAL(trace) << s << "invalid read size: " << strerror(errno) << std::endl);
		return false;
	}
	int ret;
	do {
		ret = _trigger.process_buffer(ConnectedTarget(s, target), *this, hsm, _buf, prev_pos);
		prev_pos = 0;
	}
	while (ret == DataTrigger::CanProcessAgain);
	return ret == DataTrigger::NoMoreToProcess;
}

bool ns::Lvl4SM::process_buffer(int s, Target const& target, HostSM& hsm)
{
	int ret;
	do {
		ret = _trigger.process_buffer(ConnectedTarget(s, target), *this, hsm, _buf, 0);
	}
	while (ret == DataTrigger::CanProcessAgain);
	return ret == DataTrigger::NoMoreToProcess;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

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

  <parent>
    <groupId>org.apache.maven.plugins.project-info-reports.it.git</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>

  <groupId>org.apache.maven.plugins.project-info-reports.it.git.push</groupId>
  <artifactId>push</artifactId>
  <packaging>pom</packaging>

  <name>git scm url with push!=pull</name>

  <modules>
    <module>inherited</module>
  </modules>

  <scm>
    <connection>scm:git:http://git-wip-us.apache.org/repos/asf/maven.git</connection>
    <developerConnection>scm:git:[fetch=]http://git-wip-us.apache.org/repos/asf/maven.git[push=]ssh://git-wip-us.apache.org/repos/asf/maven.git</developerConnection>
  </scm>
</project>


text:
extern crate itertools;
extern crate modifier;
extern crate postgres;

use postgres::types::ToSql;
use std::borrow::Cow;
use std::fmt;

pub use self::delete::Delete;
pub use self::insert::Insert;
pub use self::predicate::Predicate;
pub use self::select::Select;
pub use self::update::Update;
pub use modifier::Set;
pub use util::escape;

mod delete;
mod insert;
mod predicate;
mod select;
mod update;
mod util;

#[derive(Debug)]
pub struct Assignment<'a>(pub Cow<'static, str>, pub &'a ToSql);
pub type Assignments<'a> = Vec<Assignment<'a>>;

#[derive(Debug)]
pub struct Condition<'a>(pub Cow<'static, str>, pub Predicate<'a>);
pub type Conditions<'a> = Vec<Condition<'a>>;

#[derive(Debug)]
pub struct Selection(pub Cow<'static, str>);
pub type Selections = Vec<Selection>;

#[derive(Debug)]
pub struct Order(pub Cow<'static, str>, pub Dir);
pub type Orders = Vec<Order>;

#[derive(Debug)]
pub struct Query<'a>(pub String, pub Vec<&'a ToSql>);

#[derive(Debug)]
pub struct Limit(pub usize);

impl fmt::Display for Limit {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        fmt::Display::fmt(&self.0, f)
    }
}

#[derive(Debug)]
pub struct Offset(pub usize);

impl fmt::Display for Offset {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        fmt::Display::fmt(&self.0, f)
    }
}

pub trait Statement<'a> {
    fn into_query(self) -> Query<'a>;
}

#[derive(Debug)]
pub enum Dir {
    Asc,
    Desc,
}

impl fmt::Display for Dir {
    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
        match *self {
            Dir::Asc => fmt::Display::fmt("ASC", f),
            Dir::Desc => fmt::Display::fmt("DESC", f),
        }
    }
}