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

namespace NDifference.UnitTests
{
	public class IMatchFuzzilyFacts
	{
		[Fact]
		public void IMatchFuzzily_Collection_Contains_Fuzzy_Match()
		{
			var list = new List<FuzzyMatchItem>(Enumerable.Repeat(new FuzzyMatchItem(), 10));

			list.Add(new FuzzyMatchItem { AllowFuzzyMatch = true });

			Assert.True(list.ContainsFuzzyMatchFor(new FuzzyMatchItem()));
		}

		[Fact]
		public void IMatchFuzzily_Collection_Finds_Fuzzy_Match()
		{
			var list = new List<FuzzyMatchItem>(Enumerable.Repeat(new FuzzyMatchItem(), 10));

			list.Add(new FuzzyMatchItem { AllowFuzzyMatch = true });

			Assert.NotNull(list.FindFuzzyMatchFor(new FuzzyMatchItem()));
		}

		[Fact]
		public void IMatchFuzzily_Collection_Finds_All_Fuzzy_Matches()
		{
			var list = new List<FuzzyMatchItem>();

			list.Add(new FuzzyMatchItem { AllowFuzzyMatch = true });

			list.AddRange(Enumerable.Repeat(new FuzzyMatchItem(), 10));

			list.Add(new FuzzyMatchItem { AllowFuzzyMatch = true });

			Assert.Equal(2, list.FindAllFuzzyMatchesFor(new FuzzyMatchItem()).Count());
		}

		[Fact]
		public void IMatchFuzzily_Collection_Finds_All_Common_Fuzzy_Matches()
		{
			var list1 = new List<FuzzyMatchItem>(Enumerable.Repeat(new FuzzyMatchItem(), 10));
			list1.Add(new FuzzyMatchItem { AllowFuzzyMatch = true });

			var list2 = new List<FuzzyMatchItem>(Enumerable.Repeat(new FuzzyMatchItem(), 10));
			list2.Add(new FuzzyMatchItem { AllowFuzzyMatch = true });

			Assert.Single(list1.FuzzyInCommonWith(list2));
		}

		[Fact]
		public void IMatchFuzzily_Collection_Finds_Nothing_For_Distinct_Collections()
		{
			var list1 = new List<FuzzyMatchItem>(Enumerable.Repeat(new FuzzyMatchItem(), 10));

			var list2 = new List<FuzzyMatchItem>(Enumerable.Repeat(new FuzzyMatchItem(), 10));

			Assert.Empty(list1.FuzzyInCommonWith(list2));
		}

		[Fact]
		public void IMatchFuzzily_Collection_Returns_Find_In_Correct_Order()
		{
			var oldItem = new FuzzyMatchItem { AllowFuzzyMatch = true };
			var newItem = new FuzzyMatchItem { AllowFuzzyMatch = true };

			var oldList = new List<FuzzyMatchItem>();
			oldList.Add(oldItem);

			var newList = new List<FuzzyMatchItem>();
			newList.Add(newItem);

			var result = oldList.FuzzyInCommonWith(newList).First();

			Assert.Equal(oldItem, result.Item1);
			Assert.Equal(newItem, result.Item2);
		}

	}

	public class FuzzyMatchItem : IMatchFuzzily<FuzzyMatchItem>
	{
		public bool AllowFuzzyMatch { get; set; }

		public bool FuzzyMatches(FuzzyMatchItem other)
		{
			// match one item only...
			bool allow = this.AllowFuzzyMatch;

			if (allow)
			{
				this.AllowFuzzyMatch = false;
			}

			return allow;
		}
	}
}


text:
Aria.classDefinition({
    $classpath : "test.aria.widgets.container.tooltip.scrollbar.ScrollbarTooltip",
    $extends : "aria.jsunit.RobotTestCase",
    $dependencies : ["aria.templates.Layout", "aria.utils.Dom"],
    $prototype : {
        runTemplateTest : function () {
            var self = this;
            self.scrollBarWidth = aria.templates.Layout.getScrollbarsMeasuredWidth();
            self.displayAndHideTooltip("withScrollBar", function (scrollbarDisplayed) {
                self.assertEquals(scrollbarDisplayed, true);
                self.displayAndHideTooltip("withoutScrollBar", function (scrollbarDisplayed) {
                    self.assertEquals(scrollbarDisplayed, false);
                    self.end();
                });
            });
        },

        displayAndHideTooltip : function (tooltipId, cb) {
            var self = this;
            var result = null;
            var tooltipArea = self.getElementById(tooltipId + "TooltipArea");
            var nothingArea = self.getElementById("nothingHere");

            var waitForTooltipToAppear = function () {
                self.waitFor({
                    condition: function () {
                        return !!self.getElementById("testMe");
                    },
                    callback: checkScrollBar
                });
            };

            var checkScrollBar = function () {
                var element = self.getElementById("testMe").parentNode;
                var overFlowYStyle = aria.utils.Dom.getStyle(element, "overflowY");
                if (overFlowYStyle === "auto") {
                    result = true;
                } else if (overFlowYStyle === "hidden") {
                    result = false;
                }
                if (self.scrollBarWidth > 0) {
                    self.assertEquals(result, element.offsetWidth > element.clientWidth);
                }
                this.synEvent.move({
                    to : nothingArea,
                    duration : 10
                }, tooltipArea, waitForTooltipToDisappear);
            };

            var waitForTooltipToDisappear = function () {
                self.waitFor({
                    condition: function () {
                        return !self.getElementById("testMe");
                    },
                    callback: function () {
                        self.$callback(cb, result);
                    }
                });
            };

            this.synEvent.move({
                to : tooltipArea,
                duration : 10
            }, nothingArea, waitForTooltipToAppear);
        }
    }
});

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) 2012 Ecma International.  All rights reserved.
// Ecma International makes this code available under the terms and conditions set
// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
// "Use Terms").   Any redistribution of this code must retain the above
// copyright and this notice and otherwise comply with the Use Terms.

/*---
es5id: 15.2.3.6-3-40-1
description: >
    Object.defineProperty - 'Attributes' is an RegExp object that uses
    Object's [[Get]] method to access the 'enumerable' property of
    prototype object (8.10.5 step 3.a)
includes: [runTestCase.js]
---*/

function testcase() {
        var obj = {};
        var accessed = false;
        try {
            RegExp.prototype.enumerable = true;
            var regObj = new RegExp();

            Object.defineProperty(obj, "property", regObj);

            for (var prop in obj) {
                if (prop === "property") {
                    accessed = true;
                }
            }

            return accessed;
        } finally {
            delete RegExp.prototype.enumerable;
        }
    }
runTestCase(testcase);


text:
<?php

namespace Elastica\Test\Aggregation;

use Elastica\Aggregation\Sum;
use Elastica\Document;
use Elastica\Index;
use Elastica\Query;

/**
 * @internal
 */
class SumTest extends BaseAggregationTest
{
    /**
     * @group functional
     */
    public function testSumAggregation(): void
    {
        $agg = new Sum('sum');
        $agg->setField('price');

        $query = new Query();
        $query->addAggregation($agg);
        $results = $this->_getIndexForTest()->search($query)->getAggregation('sum');

        $this->assertEquals(5 + 8 + 1 + 3, $results['value']);
    }

    /**
     * @group functional
     */
    public function testSumAggregationWithMissing(): void
    {
        $agg = new Sum('sum');
        $agg->setField('price');
        $agg->setMissing(10);

        $query = new Query();
        $query->addAggregation($agg);
        $results = $this->_getIndexForTest()->search($query)->getAggregation('sum');

        $this->assertEquals(5 + 8 + 1 + 3 + 10, $results['value']);
    }

    protected function _getIndexForTest(): Index
    {
        $index = $this->_createIndex();

        $index->addDocuments([
            new Document('1', ['price' => 5]),
            new Document('2', ['price' => 8]),
            new Document('3', ['price' => 1]),
            new Document('4', ['price' => 3]),
            new Document('5', ['anything' => 'anything']),
        ]);

        $index->refresh();

        return $index;
    }
}


text:
<?php

namespace Oro\Bundle\IntegrationBundle\Provider;

use Symfony\Bridge\Doctrine\RegistryInterface;

use Doctrine\ORM\UnitOfWork;
use Doctrine\ORM\EntityManager;

use Oro\Bundle\IntegrationBundle\Exception\LogicException;
use Oro\Bundle\IntegrationBundle\Entity\Channel as Integration;
use Oro\Bundle\IntegrationBundle\Manager\TypesRegistry;
use Oro\Bundle\ImportExportBundle\Context\ContextInterface;

use Oro\Bundle\EntityConfigBundle\DependencyInjection\Utils\ServiceLink;

class ConnectorContextMediator
{
    /** @var TypesRegistry */
    protected $registry;

    /** @var RegistryInterface */
    protected $doctrineRegistry;

    /**
     * @param ServiceLink       $registryLink
     * @param RegistryInterface $doctrineRegistry
     */
    public function __construct(ServiceLink $registryLink, RegistryInterface $doctrineRegistry)
    {
        $this->registryLink     = $registryLink;
        $this->doctrineRegistry = $doctrineRegistry;
    }

    /**
     * Get prepared transport
     *
     * @param ContextInterface|Integration $source
     * @param boolean                      $markReadOnly
     *
     * @throws LogicException
     * @return TransportInterface
     */
    public function getTransport($source, $markReadOnly = false)
    {
        if ($source instanceof ContextInterface) {
            $source = $this->getChannel($source);
        } elseif (!$source instanceof Integration) {
            throw new LogicException('Expected type ContextInterface or Channel');
        }

        $transport = $source->getTransport();
        if ($markReadOnly) {
            $this->getUow()->markReadOnly($transport);
        }

        return clone $this->registryLink->getService()
            ->getTransportTypeBySettingEntity($transport, $source->getType());
    }

    /**
     * Get channel instance
     *
     * @param ContextInterface $context
     *
     * @return Integration
     */
    public function getChannel(ContextInterface $context)
    {
        $channel = $this->getEm()
            ->getRepository('OroIntegrationBundle:Channel')
            ->getOrLoadById($context->getOption('channel'));

        return $channel;
    }

    /**
     * @return UnitOfWork
     */
    private function getUow()
    {
        return $this->getEm()->getUnitOfWork();
    }

    /**
     * @return EntityManager
     */
    private function getEm()
    {
        return $this->doctrineRegistry->getManager();
    }
}


text:
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Diagnostics.Contracts;
using System;

// Disable the "this variable is not used" warning as every field would imply it.
#pragma warning disable 0414
// Disable the "this variable is never assigned to".
#pragma warning disable 0067
// Disable the "this event is never assigned to".
#pragma warning disable 0649
// Disable the "this variable is never used".
#pragma warning disable 0169
// Disable the "new keyword not required" warning.
#pragma warning disable 0109
// Disable the "extern without DllImport" warning.
#pragma warning disable 0626
// Disable the "could hide other member" warning, can happen on certain properties.
#pragma warning disable 0108

namespace System.ComponentModel
{
  public partial class ExpandableObjectConverter : TypeConverter
  {
    #region Methods and constructors
    public ExpandableObjectConverter()
    {
    }

    public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, Object value, Attribute[] attributes)
    {
      return default(PropertyDescriptorCollection);
    }

    public override bool GetPropertiesSupported(ITypeDescriptorContext context)
    {
      return default(bool);
    }
    #endregion
  }
}


text:
<?php init_head(); ?>

                            <?php if (has_permission('customers','','create')) { ?>
                            <a href="<?php echo admin_url('clients/client'); ?>" class="btn btn-info mright5 test pull-left display-block">
                                <?php echo _l('new_client'); ?>
                                <a href="<?php echo admin_url('clients/import'); ?>" class="btn btn-info pull-left display-block mright5">
                                    <?php echo _l('import_customers'); ?>
                                    <?php } ?>

                                    <div class="btn-group pull-right btn-with-tooltip-group _filter_data" data-toggle="tooltip" data-title="<?php echo _l('filter_by'); ?>">
                                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

                                        </button>

<?php echo _l('customers_sort_all'); ?>

                                            <?php if(count($groups) > 0){ ?>

                                                <?php echo _l('customer_groups'); ?>

                                                    <?php foreach($groups as $group){ ?>

<a href="#" data-cview="customer_group_<?php echo $group['id']; ?>" onclick="dt_custom_view('customer_group_<?php echo $group['id']; ?>','.table-clients','customer_group_<?php echo $group['id']; ?>'); return false;"><?php echo $group['name']; ?>

                                                    <?php } ?>

                                            <?php } ?>

                                                <?php echo _l('invoices'); ?>

                                                    <?php foreach($invoice_statuses as $status){ ?>

                                                        <a href="#" data-cview="invoices_<?php echo $status; ?>" data-cview="1" onclick="dt_custom_view('invoices_<?php echo $status; ?>','.table-clients','invoices_<?php echo $status; ?>'); return false;"><?php echo _l('customer_have_invoices_by',format_invoice_status($status,'',false)); ?>

                                                    <?php } ?>

                                                <?php echo _l('estimates'); ?>

                                                    <?php foreach($estimate_statuses as $status){ ?>

                                                        <a href="#" data-cview="estimates_<?php echo $status; ?>" onclick="dt_custom_view('estimates_<?php echo $status; ?>','.table-clients','estimates_<?php echo $status; ?>'); return false;">
                                                            <?php echo _l('customer_have_estimates_by',format_estimate_status($status,'',false)); ?>

                                                    <?php } ?>

                                                <?php echo _l('projects'); ?>

                                                    <?php foreach($project_statuses as $status){ ?>

                                                        <a href="#" data-cview="projects_<?php echo $status; ?>" onclick="dt_custom_view('projects_<?php echo $status; ?>','.table-clients','projects_<?php echo $status; ?>'); return false;">
                                                            <?php echo _l('customer_have_projects_by',_l('project_status_'.$status)); ?>

                                                    <?php } ?>

                                                <?php echo _l('proposals'); ?>

                                                    <?php foreach($proposal_statuses as $status){ ?>

                                                        <a href="#" data-cview="proposals_<?php echo $status; ?>" onclick="dt_custom_view('proposals_<?php echo $status; ?>','.table-clients','proposals_<?php echo $status; ?>'); return false;">
                                                            <?php echo _l('customer_have_proposals_by',format_proposal_status($status,'',false)); ?>

                                                    <?php } ?>

                                            <?php if(count($contract_types) > 0) { ?>

                                                <?php echo _l('contract_types'); ?>

                                                    <?php foreach($contract_types as $type){ ?>

                                                        <a href="#" data-cview="contract_type_<?php echo $type['id']; ?>" onclick="dt_custom_view('contract_type_<?php echo $type['id']; ?>','.table-clients','contract_type_<?php echo $type['id']; ?>'); return false;">
                                                            <?php echo _l('customer_have_contracts_by_type',$type['name']); ?>

                                                    <?php } ?>

                                            <?php } ?>
                                            <?php if(count($customer_admins) > 0 && (has_permission('customers','','create') || has_permission('customers','','edit'))){ ?>

                                                <?php echo _l('responsible_admin'); ?>

                                                    <?php foreach($customer_admins as $cadmin){ ?>

                                                        <a href="#" data-cview="responsible_admin_<?php echo $cadmin['staff_id']; ?>" onclick="dt_custom_view('responsible_admin_<?php echo $cadmin['staff_id']; ?>','.table-clients','responsible_admin_<?php echo $cadmin['staff_id']; ?>'); return false;">
                                                            <?php echo get_staff_full_name($cadmin['staff_id']); ?>

                                                    <?php } ?>

                                            <?php } ?>

                                <?php if(has_permission('customers','','view') || have_assigned_customers()) {
                                    $where_summary = '';
                                    if(!has_permission('customers','','view')){
                                        $where_summary = ' AND userid IN (SELECT customer_id FROM tblcustomeradmins WHERE staff_id='.get_staff_user_id().')';
                                    }
                                    ?>

<?php echo _l('customers_summary'); ?>

<?php echo total_rows('tblclients',($where_summary != '' ? substr($where_summary,5) : '')); ?>

                                            <?php echo _l('customers_summary_total'); ?>

<?php echo total_rows('tblclients','active=1'.$where_summary); ?>

                                            <?php echo _l('active_customers'); ?>

<?php echo total_rows('tblclients','active=0'.$where_summary); ?>

                                            <?php echo _l('inactive_active_customers'); ?>

<?php echo total_rows('tblcontacts','active=1'.$where_summary); ?>

                                            <?php echo _l('customers_summary_active'); ?>

<?php echo total_rows('tblcontacts','active=0'.$where_summary); ?>

                                            <?php echo _l('customers_summary_inactive'); ?>

<?php echo total_rows('tblcontacts','last_login LIKE "'.date('Y-m-d').'%"'.$where_summary); ?>

                                            <?php echo _l('customers_summary_logged_in_today'); ?>

                                    <?php } ?>

                            <?php
                             foreach($groups as $group){
                                 echo form_hidden('customer_group_'.$group['id']);
                             }
                             foreach($contract_types as $type){
                                 echo form_hidden('contract_type_'.$type['id']);
                             }
                             foreach($invoice_statuses as $status){
                                 echo form_hidden('invoices_'.$status);
                             }
                             foreach($estimate_statuses as $status){
                                 echo form_hidden('estimates_'.$status);
                             }
                             foreach($project_statuses as $status){
                                echo form_hidden('projects_'.$status);
                            }
                            foreach($proposal_statuses as $status){
                                echo form_hidden('proposals_'.$status);
                            }
                            foreach($customer_admins as $cadmin){
                                echo form_hidden('responsible_admin_'.$cadmin['staff_id']);
                            }
                            ?>

                               <?php echo _l('bulk_actions'); ?>

                                         <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

<?php echo _l('bulk_actions'); ?>

                                      <?php if(has_permission('customers','','delete')){ ?>

                                        <input type="checkbox" name="mass_delete" id="mass_delete">
                                        <?php echo _l('mass_delete'); ?>

                                    <?php } ?>

                                     <?php echo render_select('move_to_groups_customers_bulk[]',$groups,array('id','name'),'customer_groups','', array('multiple'=>true),array(),'','',false); ?>

<?php echo _l('bulk_action_customers_groups_warning'); ?>

                                 <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _l('close'); ?></button>
                                 <?php echo _l('confirm'); ?>

                 <?php
                 $table_data = array();
                 $_table_data = array(
                    _l('clients_list_company'),
                    _l('contact_primary'),
                    _l('company_primary_email'),
                    _l('clients_list_phone'),
                    _l('customer_active'),
                    _l('customer_groups'),
                    );
                 foreach($_table_data as $_t){
                    array_push($table_data,$_t);
                }
                array_unshift($table_data,' -
<input type="checkbox" id="mass_select_all" data-to-table="clients">
');

                $custom_fields = get_custom_fields('customers',array('show_on_table'=>1));
                foreach($custom_fields as $field){
                    array_push($table_data,$field['name']);
                }

                $table_data = do_action('customers_table_columns',$table_data);

                $_op = _l('options');

                array_push($table_data, $_op);
                render_datatable($table_data,'clients');
                ?>

<?php init_tail(); ?>


text:
package com.panther.dong.java8.lambda;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * Created by panther on 15-8-22.
 */
public class New {

    public static void main(String[] args) {
        List<String> nameList = Arrays.asList("panther", "peter", "lucy", "jake");
        //第一种写法
        Collections.sort(nameList, (String a, String b) -> {
            return b.compareTo(a);
        });
        //第二种写法
        Collections.sort(nameList, (a, b) -> {
            return b.compareTo(a);
        });
        //第三种写法
        Collections.sort(nameList, (a, b) -> b.compareTo(a));

        nameList.forEach(e -> System.out.println(e));
    }
}


text:
using System.Linq;
using NUnit.Framework;

namespace Tests.LINQMethods
{
    [TestFixture]
    public class Average_SelectDecimal : LINQSingularMethodTestBase<decimal>
    {
        protected override decimal GetResult(IQueryable<InventorySelect> source)
        {
            return source.Select(i => new
                {
                    Inventory = i,
                    Quantity = (decimal)i.Quantity
                }).Average(i => i.Quantity);
        }
    }
}


text:
package test.jmock.core.constraint;

import org.jmock.core.constraint.StringContains;

public class StringContainsTest extends AbstractConstraintsTest
{
    static final String EXCERPT = "EXCERPT";

    StringContains stringContains;

    public void setUp() {
        stringContains = new StringContains(EXCERPT);
    }

    public void testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() {
        assertTrue("should be true if excerpt at beginning",
                   stringContains.eval(EXCERPT + "END"));
        assertTrue("should be true if excerpt at end",
                   stringContains.eval("START" + EXCERPT));
        assertTrue("should be true if excerpt in middle",
                   stringContains.eval("START" + EXCERPT + "END"));
        assertTrue("should be true if excerpt is repeated",
                   stringContains.eval(EXCERPT + EXCERPT));

        assertFalse("should not be true if excerpt is not in string",
                    stringContains.eval("Something else"));
        assertFalse("should not be true if part of excerpt is in string",
                    stringContains.eval(EXCERPT.substring(1)));
    }

    public void testEvaluatesToTrueIfArgumentIsEqualToSubstring() {
        assertTrue("should be true if excerpt is entire string",
                   stringContains.eval(EXCERPT));
    }
}


text:
class KeywordValueParse:

    def parseline(self,line):

        import pyre.units

        uparser = pyre.units.parser()

        # print "Hello from KeywordValueParse.parseline!"

        self.keyvals[3] = False
        comment = line.find('#')
        if comment == 0: return self.keyvals
        stest = line[:comment].split('=')
        if len(stest) != 2: return self.keyvals
        key = stest[0].strip()
        rawvalue = stest[1].strip()

        try:
            uvalue = uparser.parse(rawvalue)
            value =uvalue.value
        except (NameError, AttributeError):
	    try:
                value = eval(rawvalue)
	    except (NameError):
		value = rawvalue
            except:
		return self.keyvals
            uvalue = value
        except:
            return self.keyvals

        self.keyvals[0] = key
        self.keyvals[1] = value
        self.keyvals[2] = uvalue
        self.keyvals[3] = True

        return self.keyvals

    def __init__(self):
        print ""
        print "Hello from KeywordValueParse.__init__!"
        self.keyvals = [None, None, None,None]
        return

# version
# $Id: KeywordValueParse.py,v 1.4 2005/01/06 01:45:13 willic3 Exp $

# End of file


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace HttpResponseCompression.Owin.Tests.Middleware
{
    [TestClass]
    public class ResponseCompressingMiddlewareTests
    {
    }
}


text:
<?php
namespace cii\actions;

use Yii;
use yii\base\Action;
use yii\base\InvalidValueException;
use cii\base\OrderModelInterface;
use yii\base\Exception;

class UpAction extends Action {
    public $idParam = 'id';
	public function run() {
        $model = $this->controller->findModel(Yii::$app->request->get($this->idParam));
        if(!($model instanceof OrderModelInterface)) {
            throw new InvalidValueException();
        }

        if(!$model->orderUp()) {
            throw new Exception();
        }

        return $this->controller->goBackToReferrer();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             targetNamespace="http://www.flowable.org/processdef">
    <process id="TwoTaskSubProcess" name="Two Task Inside SubProcess" isExecutable="true">
        <startEvent id="start" name="start"/>
        <sequenceFlow id="seqFlow1" sourceRef="start" targetRef="BeforeSubProcess"/>
        <userTask id="BeforeSubProcess" name="BeforeSubProcess"/>
        <sequenceFlow id="seqFlow2" sourceRef="BeforeSubProcess" targetRef="SimpleSubProcess"/>
        <subProcess id="SimpleSubProcess" name="Simple SubProcess">
            <startEvent id="subProcessStart" name="subProcessStart"/>
            <sequenceFlow id="subSeqFlow1" sourceRef="subProcessStart" targetRef="InsideSimpleSubProcess1"/>
            <userTask id="InsideSimpleSubProcess1" name="InsideSimpleSubProcess1"/>
            <sequenceFlow id="subSeqFlow2" sourceRef="InsideSimpleSubProcess1" targetRef="InsideSimpleSubProcess2"/>
            <userTask id="InsideSimpleSubProcess2" name="InsideSimpleSubProcess2"/>
            <sequenceFlow id="subSeqFlow3" sourceRef="InsideSimpleSubProcess2" targetRef="subProcessEnd"/>
            <endEvent id="subProcessEnd" name="subProcessEnd"/>
        </subProcess>
        <sequenceFlow id="seqFlow3" sourceRef="SimpleSubProcess" targetRef="AfterSubProcess"/>
        <userTask id="AfterSubProcess" name="AfterSubProcess"/>
        <sequenceFlow id="seqFlow4" sourceRef="AfterSubProcess" targetRef="end"/>
        <endEvent id="end" name="end"/>
    </process>
</definitions>


text:
/* jshint indent: 2 */

module.exports = function(sequelize, DataTypes) {
  return sequelize.define('ApiUserInfo', {
    ApiUserID: {
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true
    },
    UserName: {
      type: DataTypes.STRING,
      allowNull: false
    },
    PassWord: {
      type: DataTypes.STRING,
      allowNull: false
    },
    PlatID: {
      type: DataTypes.INTEGER,
      allowNull: false
    },
    State: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: "((1))"
    },
    PostDate: {
      type: DataTypes.DATE,
      allowNull: false
    }
  }, {
    tableName: 'ApiUserInfo'
  });
};


text:
package org.nanocontainer.remoting.jmx.mx4j;

import javax.management.MBeanInfo;

import mx4j.AbstractDynamicMBean;

/**
 * DynamicMBean implementation based on MX4J.
 * @author James Strachan
 * @author Michael Ward
 * @version $Revision$
 */
public class MX4JDynamicMBean extends AbstractDynamicMBean {

    /**
     * Construct a MBean from an instance and a MBeanInfo.
     * @param componentInstance the instance to expose.
     * @param mBeanInfo the MBeanInfo for the instance.
     */
    public MX4JDynamicMBean(Object componentInstance, MBeanInfo mBeanInfo) {
        setResource(componentInstance);
        setMBeanInfo(mBeanInfo);
    }
}


text:
package command

import (
	"fmt"
	"io/ioutil"
	"strconv"
	"strings"

	consulapi "github.com/hashicorp/consul/api"
)

type KVWriteCommand struct {
	Meta
	modifyIndex	string
	dataFlags	string
}

func (c *KVWriteCommand) Help() string {
	helpText := `
Usage: consul-cli kv-write [options] path value

  Write a value to a given path.

Options:
` + c.ConsulHelp() +
`  --modifyindex=<ModifyIndex>	Perform a Check-and-Set write.
				(default: not set)
  --flags=<number>		Integer value between 0 and 2^64 - 1
				(default: not set)
`

	return strings.TrimSpace(helpText)
}

func (c *KVWriteCommand) Run(args []string) int {
	c.AddDataCenter()
	flags := c.Meta.FlagSet()
	flags.StringVar(&c.modifyIndex, "cas", "", "")
	flags.StringVar(&c.dataFlags, "flags", "", "")
	flags.Usage = func() { c.UI.Output(c.Help()) }

	if err := flags.Parse(args); err != nil {
		return 1
	}

	extra := flags.Args()
	if len(extra) < 2 {
		c.UI.Error("Key path and value must be specified")
		c.UI.Error("")
		c.UI.Error(c.Help())
		return 1
	}

	path := extra[0]
	value := strings.Join(extra[1:], " ")

	kv := new(consulapi.KVPair)

	kv.Key = path
	if strings.HasPrefix(value, "@") {
		v, err := ioutil.ReadFile(value[1:])
		if err != nil {
			c.UI.Error(fmt.Sprintf("ReadFile error: %v", err))
			return 1
		}
		kv.Value = v
	} else {
		kv.Value = []byte(value)
	}

	// &flags=
	//
	if c.dataFlags != "" {
		f, err := strconv.ParseUint(c.dataFlags, 0, 64)
		if err != nil {
			c.UI.Error(fmt.Sprintf("Error parsing flags: %v", c.dataFlags))
			c.UI.Error("")
			return 1
		}
		kv.Flags = f
	}

	consul, err := c.Client()
	if err != nil {
		c.UI.Error(err.Error())
		return 1
	}
	client := consul.KV()

	writeOpts := c.WriteOptions()

	if c.modifyIndex == "" {
		_, err := client.Put(kv, writeOpts)
		if err != nil {
			c.UI.Error(err.Error())
			return 1
		}
	} else {
		// Check-and-Set
		i, err := strconv.ParseUint(c.modifyIndex, 0, 64)
		if err != nil {
			c.UI.Error(fmt.Sprintf("Error parsing modifyIndex: %v", c.modifyIndex))
			c.UI.Error("")
			return 1
		}
		kv.ModifyIndex = i

		success, _, err := client.CAS(kv, writeOpts)
		if err != nil {
			c.UI.Error(err.Error())
			return 1
		}

		if !success {
			return 1
		}
	}

	return 0
}

func (c *KVWriteCommand) Synopsis() string {
	return "Write a value"
}


text:
layout: global
displayTitle: Spark Overview
title: Overview
description: Apache Spark SPARK_VERSION_SHORT documentation homepage
---

Apache Spark is a fast and general-purpose cluster computing system.
It provides high-level APIs in Java, Scala, Python and R,
and an optimized engine that supports general execution graphs.
It also supports a rich set of higher-level tools including [Spark SQL](sql-programming-guide.html) for SQL and structured data processing, [MLlib](ml-guide.html) for machine learning, [GraphX](graphx-programming-guide.html) for graph processing, and [Spark Streaming](streaming-programming-guide.html).

# Downloading

Get Spark from the [downloads page](http://spark.apache.org/downloads.html) of the project website. This documentation is for Spark version {{site.SPARK_VERSION}}. Spark uses Hadoop's client libraries for HDFS and YARN. Downloads are pre-packaged for a handful of popular Hadoop versions.
Users can also download a "Hadoop free" binary and run Spark with any Hadoop version
[by augmenting Spark's classpath](hadoop-provided.html).
Scala and Java users can include Spark in their projects using its maven cooridnates and in the future Python users can also install Spark from PyPI.

If you'd like to build Spark from
source, visit [Building Spark](building-spark.html).

Spark runs on both Windows and UNIX-like systems (e.g. Linux, Mac OS). It's easy to run
locally on one machine --- all you need is to have `java` installed on your system `PATH`,
or the `JAVA_HOME` environment variable pointing to a Java installation.

Spark runs on Java 7+, Python 2.6+/3.4+ and R 3.1+. For the Scala API, Spark {{site.SPARK_VERSION}}
uses Scala {{site.SCALA_BINARY_VERSION}}. You will need to use a compatible Scala version
({{site.SCALA_BINARY_VERSION}}.x).

Note that support for Java 7 and Python 2.6 are deprecated as of Spark 2.0.0, and support for
Scala 2.10 and versions of Hadoop before 2.6 are deprecated as of Spark 2.1.0, and may be
removed in Spark 2.2.0.

# Running the Examples and Shell

Spark comes with several sample programs.  Scala, Java, Python and R examples are in the
`examples/src/main` directory. To run one of the Java or Scala sample programs, use
`bin/run-example <class> [params]` in the top-level Spark directory. (Behind the scenes, this
invokes the more general
[`spark-submit` script](submitting-applications.html) for
launching applications). For example,

    ./bin/run-example SparkPi 10

You can also run Spark interactively through a modified version of the Scala shell. This is a
great way to learn the framework.

    ./bin/spark-shell --master local[2]

The `--master` option specifies the
[master URL for a distributed cluster](submitting-applications.html#master-urls), or `local` to run
locally with one thread, or `local[N]` to run locally with N threads. You should start by using
`local` for testing. For a full list of options, run Spark shell with the `--help` option.

Spark also provides a Python API. To run Spark interactively in a Python interpreter, use
`bin/pyspark`:

    ./bin/pyspark --master local[2]

Example applications are also provided in Python. For example,

    ./bin/spark-submit examples/src/main/python/pi.py 10

Spark also provides an experimental [R API](sparkr.html) since 1.4 (only DataFrames APIs included).
To run Spark interactively in a R interpreter, use `bin/sparkR`:

    ./bin/sparkR --master local[2]

Example applications are also provided in R. For example,

    ./bin/spark-submit examples/src/main/r/dataframe.R

# Launching on a Cluster

The Spark [cluster mode overview](cluster-overview.html) explains the key concepts in running on a cluster.
Spark can run both by itself, or over several existing cluster managers. It currently provides several
options for deployment:

* [Standalone Deploy Mode](spark-standalone.html): simplest way to deploy Spark on a private cluster
* [Apache Mesos](running-on-mesos.html)
* [Hadoop YARN](running-on-yarn.html)

# Where to Go from Here

**Programming Guides:**

* [Quick Start](quick-start.html): a quick introduction to the Spark API; start here!
* [Spark Programming Guide](programming-guide.html): detailed overview of Spark
  in all supported languages (Scala, Java, Python, R)
* Modules built on Spark:
  * [Spark Streaming](streaming-programming-guide.html): processing real-time data streams
  * [Spark SQL, Datasets, and DataFrames](sql-programming-guide.html): support for structured data and relational queries
  * [MLlib](ml-guide.html): built-in machine learning library
  * [GraphX](graphx-programming-guide.html): Spark's new API for graph processing

**API Docs:**

* [Spark Scala API (Scaladoc)](api/scala/index.html#org.apache.spark.package)
* [Spark Java API (Javadoc)](api/java/index.html)
* [Spark Python API (Sphinx)](api/python/index.html)
* [Spark R API (Roxygen2)](api/R/index.html)
* [Spark SQL, Built-in Functions (MkDocs)](api/sql/index.html)

**Deployment Guides:**

* [Cluster Overview](cluster-overview.html): overview of concepts and components when running on a cluster
* [Submitting Applications](submitting-applications.html): packaging and deploying applications
* Deployment modes:
  * [Amazon EC2](https://github.com/amplab/spark-ec2): scripts that let you launch a cluster on EC2 in about 5 minutes
  * [Standalone Deploy Mode](spark-standalone.html): launch a standalone cluster quickly without a third-party cluster manager
  * [Mesos](running-on-mesos.html): deploy a private cluster using
      [Apache Mesos](http://mesos.apache.org)
  * [YARN](running-on-yarn.html): deploy Spark on top of Hadoop NextGen (YARN)

**Other Documents:**

* [Configuration](configuration.html): customize Spark via its configuration system
* [Monitoring](monitoring.html): track the behavior of your applications
* [Tuning Guide](tuning.html): best practices to optimize performance and memory use
* [Job Scheduling](job-scheduling.html): scheduling resources across and within Spark applications
* [Security](security.html): Spark security support
* [Hardware Provisioning](hardware-provisioning.html): recommendations for cluster hardware
* Integration with other storage systems:
  * [OpenStack Swift](storage-openstack-swift.html)
* [Building Spark](building-spark.html): build Spark using the Maven system
* [Contributing to Spark](http://spark.apache.org/contributing.html)
* [Third Party Projects](http://spark.apache.org/third-party-projects.html): related third party Spark projects

**External Resources:**

* [Spark Homepage](http://spark.apache.org)
* [Spark Community](http://spark.apache.org/community.html) resources, including local meetups
* [StackOverflow tag `apache-spark`](http://stackoverflow.com/questions/tagged/apache-spark)
* [Mailing Lists](http://spark.apache.org/mailing-lists.html): ask questions about Spark here
* [AMP Camps](http://ampcamp.berkeley.edu/): a series of training camps at UC Berkeley that featured talks and
  exercises about Spark, Spark Streaming, Mesos, and more. [Videos](http://ampcamp.berkeley.edu/6/),
  [slides](http://ampcamp.berkeley.edu/6/) and [exercises](http://ampcamp.berkeley.edu/6/exercises/) are
  available online for free.
* [Code Examples](http://spark.apache.org/examples.html): more are also available in the `examples` subfolder of Spark ([Scala]({{site.SPARK_GITHUB_URL}}/tree/master/examples/src/main/scala/org/apache/spark/examples),
 [Java]({{site.SPARK_GITHUB_URL}}/tree/master/examples/src/main/java/org/apache/spark/examples),
 [Python]({{site.SPARK_GITHUB_URL}}/tree/master/examples/src/main/python),
 [R]({{site.SPARK_GITHUB_URL}}/tree/master/examples/src/main/r))


text:
namespace BulgarianPressReleasesAnomalyDetection
{
    using Microsoft.ML.Data;

    public class SpikePrediction
    {
        /// <summary>
        /// Gets or sets the vector containing 3 elements:
        /// - alert (non-zero value means a spike)
        /// - raw score
        /// - p-value
        /// </summary>
        [VectorType(3)]
        public double[] Prediction { get; set; }
    }
}


text:
package com.twolattes.json;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.Map.Entry;

/**
 * JSON values.
 *
 * @see http://www.json.org
 */
public final class Json {

  /** A JSON value.
   */
  public interface Value {

    void write(Writer writer) throws IOException;

    <T> T visit(JsonVisitor<T> visitor);

  }

  /**
   * An object, i.e. {@code {"hello":"world"}}.
   */
  public interface Object extends Value {

    Json.Value put(Json.String key, Json.Value value);

    Json.Value get(Json.String key);

    boolean containsKey(Json.String key);

    Set<Json.String> keySet();

    Set<Map.Entry<Json.String, Json.Value>> entrySet();

    Collection<Json.Value> values();

    boolean isEmpty();

    int size();

  }

  /**
   * An array, i.e {@code [0, 1, 2, 3, 4, 5]}.
   */
  public interface Array extends Value, Iterable<Value> {

    void add(int index, Json.Value element);

    boolean add(Json.Value element);

    Json.Value get(int index);

    boolean isEmpty();

    int size();

    List<Json.Value> values();

  }

  /**
   * A string, i.e. {@code "hello"}.
   */
  public interface String extends Value, Comparable<Json.String> {

    java.lang.String getString();

    boolean isEmpty();

  }

  /**
   * A number, i.e. {@code 5}, {@code 78.90} or {@code 12728971932}.
   */
  public interface Number extends Value {

    BigDecimal getNumber();

  }

  /**
   * A boolean, i.e {@code true} or {@code false}.
   */
  public interface Boolean extends Value {

    boolean getBoolean();

  }

  /**
   * Null, i.e. {@code null}.
   */
  public interface Null extends Json.Array, Json.Boolean, Json.Number, Json.Object, Json.String {
  }

  private static abstract class BaseValue implements Json.Value {

    @Override
    public final java.lang.String toString() {
      StringWriter writer = new StringWriter();
      try {
        write(writer);
      } catch (IOException e) {
        // unreachable
        throw new RuntimeException(e);
      }
      return writer.toString();
    }

  }

  private static class ObjectImpl extends BaseValue implements Json.Object {

    private final Map<Json.String, Json.Value> delegate = new TreeMap<Json.String, Json.Value>();

    public void write(Writer writer) throws IOException {
      writer.append('{');
      java.lang.String separator = "";
      for (Json.String key : delegate.keySet()) {
        writer.append(separator);
        separator = ",";
        key.write(writer);
        writer.append(':');
        delegate.get(key).write(writer);
      }
      writer.append('}');
    }

    public <T> T visit(JsonVisitor<T> visitor) {
      return visitor.caseObject(this);
    }

    public void clear() {
      delegate.clear();
    }

    public boolean containsKey(java.lang.Object key) {
      return delegate.containsKey(key);
    }

    public boolean containsValue(java.lang.Object value) {
      return delegate.containsValue(value);
    }

    @Override
    public boolean equals(java.lang.Object o) {
      if (!(o instanceof Json.Object)) {
        return false;
      } else if (NULL.equals(o)) {
        return false;
      } else {
        return delegate.entrySet().equals(((Json.Object) o).entrySet());
      }
    }

    public Json.Value get(Json.String key) {
      return delegate.get(key);
    }

    public boolean containsKey(String key) {
      return delegate.containsKey(key);
    }

    @Override
    public int hashCode() {
      return delegate.hashCode();
    }

    public boolean isEmpty() {
      return delegate.isEmpty();
    }

    public Set<Json.String> keySet() {
      return delegate.keySet();
    }

    public Set<Entry<String, Value>> entrySet() {
      return delegate.entrySet();
    }

    public Json.Value put(Json.String key, Json.Value value) {
      return delegate.put(key, value);
    }

    public int size() {
      return delegate.size();
    }

    public Collection<Json.Value> values() {
      return delegate.values();
    }

  }

  private static class ArrayImpl extends BaseValue implements Json.Array {

    private final List<Json.Value> delegate = new LinkedList<Json.Value>();

    public ArrayImpl(Json.Value... values) {
      for (Json.Value value : values) {
        delegate.add(value);
      }
    }

    public void write(Writer writer) throws IOException {
      writer.append('[');
      java.lang.String separator = "";
      for (Json.Value value : delegate) {
        writer.append(separator);
        separator = ",";
        value.write(writer);
      }
      writer.append(']');
    }

    public <T> T visit(JsonVisitor<T> visitor) {
      return visitor.caseArray(this);
    }

    public List<Value> values() {
      return delegate;
    }

    public void add(int index, Json.Value element) {
      delegate.add(index, element);
    }

    public boolean add(Json.Value e) {
      return delegate.add(e);
    }

    @Override
    public boolean equals(java.lang.Object o) {
      if (!(o instanceof Json.Array)) {
        return false;
      } else if (NULL.equals(o)) {
        return false;
      } else {
        return delegate.equals(((Json.Array) o).values());
      }
    }

    public Json.Value get(int index) {
      return delegate.get(index);
    }

    @Override
    public int hashCode() {
      return delegate.hashCode();
    }

    public boolean isEmpty() {
      return delegate.isEmpty();
    }

    public int size() {
      return delegate.size();
    }

    public Iterator<Value> iterator() {
      return delegate.iterator();
    }

  }

  private static class BooleanImpl extends BaseValue implements Json.Boolean {

    private final boolean b;

    public BooleanImpl(boolean b) {
      this.b = b;
    }

    public void write(Writer writer) throws IOException {
      writer.append(java.lang.Boolean.toString(b));
    }

    public <T> T visit(JsonVisitor<T> visitor) {
      return visitor.caseBoolean(this);
    }

    @Override
    public boolean equals(java.lang.Object obj) {
      if (!(obj instanceof BooleanImpl)) {
        return false;
      } else {
        return !(this.b ^ ((BooleanImpl) obj).b);
      }
    }

    @Override
    public int hashCode() {
      if (b) {
        return 982451653;
      } else {
        return 941083987;
      }
    }

    public boolean getBoolean() {
      return b;
    }

  }

  private static abstract class NumberImpl extends BaseValue implements Json.Number {

    public <T> T visit(JsonVisitor<T> visitor) {
      return visitor.caseNumber(this);
    }

    @Override
    public boolean equals(java.lang.Object obj) {
      if (this == obj) {
        return true;
      }
      if (!(obj instanceof Json.Number)) {
        return false;
      }
      if (obj.equals(NULL)) {
        return false;
      }
      return this.getNumber().compareTo(((Json.Number) obj).getNumber()) == 0;
    }

    @Override
    public int hashCode() {
      return (int) getNumber().doubleValue();
    }

  }

  private static class NumberImplShort extends NumberImpl {

    private final short number;

    public NumberImplShort(short number) {
      this.number = number;
    }

    public void write(Writer writer) throws IOException {
      writer.append(Short.toString(number));
    }

    public BigDecimal getNumber() {
      return BigDecimal.valueOf(number);
    }

  }

  private static class NumberImplInt extends NumberImpl {

    private final int number;

    public NumberImplInt(int number) {
      this.number = number;
    }

    public void write(Writer writer) throws IOException {
      writer.append(Integer.toString(number));
    }

    public BigDecimal getNumber() {
      return BigDecimal.valueOf(number);
    }

  }

  private static class NumberImplLong extends NumberImpl {

    private final long number;

    public NumberImplLong(long number) {
      this.number = number;
    }

    public void write(Writer writer) throws IOException {
      writer.append(Long.toString(number));
    }

    public BigDecimal getNumber() {
      return BigDecimal.valueOf(number);
    }

  }

  private static class NumberImplFloat extends NumberImpl {

    private final float number;

    public NumberImplFloat(float number) {
      this.number = number;
    }

    public void write(Writer writer) throws IOException {
      writer.append(Float.toString(number));
    }

    public BigDecimal getNumber() {
      return new BigDecimal(Float.toString(number));
    }

  }

  private static class NumberImplDouble extends NumberImpl {

    private final double number;

    public NumberImplDouble(double number) {
      this.number = number;
    }

    public void write(Writer writer) throws IOException {
      writer.append(Double.toString(number));
    }

    public BigDecimal getNumber() {
      return BigDecimal.valueOf(number);
    }

  }

  private static class NumberImplBigDecimal extends NumberImpl {

    private final BigDecimal number;

    public NumberImplBigDecimal(BigDecimal number) {
      this.number = number;
    }

    public void write(Writer writer) throws IOException {
      writer.append(number.toPlainString());
    }

    public BigDecimal getNumber() {
      return number;
    }

  }

  private static class StringImpl extends BaseValue implements Json.String {

    private final java.lang.String string;

    public StringImpl(java.lang.String string) {
      this.string = string;
    }

    public void write(Writer writer) throws IOException {
      StringBuilder builder = new StringBuilder(string.length() << 1);
      builder.append('"');
      int length = string.length();
      char c;
      boolean safe = true;
      for (int i = 0; safe && i < length; i++) {
        c = string.charAt(i);
        safe = c != '"' && c != '\\' && c >= 0x20 && (c < 0x7f || c >= 0xa0);
      }
      if (safe) {
        builder.append(string);
      } else {
        for (int i = 0; i < length; i++) {
          switch (c = string.charAt(i)) {
            case '\b': builder.append("\\b"); break;
            case '\n': builder.append("\\n"); break;
            case '\f': builder.append("\\f"); break;
            case '\r': builder.append("\\r"); break;
            case '\t': builder.append("\\t"); break;
            case '"': builder.append("\\\""); break;
            case '\\': builder.append("\\\\"); break;
            default:
              if (c < 0x20 || (c >= 0x7f && c < 0xa0)) {
                builder.append(java.lang.String.format("\\u%04x", Integer.valueOf(c)));
              } else {
                builder.append(c);
              }
              break;
          }
        }
      }
      builder.append('"');
      writer.append(builder.toString());
    }

    public <T> T visit(JsonVisitor<T> visitor) {
      return visitor.caseString(this);
    }

    public int compareTo(Json.String that) {
      return this.string.compareTo(that.getString());
    }

    @Override
    public boolean equals(java.lang.Object obj) {
      if (!(obj instanceof Json.String)) {
        return false;
      } else if (NULL.equals(obj)) {
        return false;
      } else {
        return this.getString().equals(((Json.String) obj).getString());
      }
    }

    @Override
    public int hashCode() {
      return string.hashCode();
    }

    public java.lang.String getString() {
      return string;
    }

    public boolean isEmpty() {
      return string.length() == 0; // 1.5 compatible
    }

  }

  private static class NullImpl extends BaseValue implements Json.Null {

    public void write(Writer writer) throws IOException {
      writer.append("null");
    }

    public <T> T visit(JsonVisitor<T> visitor) {
      return visitor.caseNull();
    }

    @Override
    public boolean equals(java.lang.Object obj) {
      return obj instanceof Json.NullImpl;
    }

    @Override
    public int hashCode() {
      return 900772187;
    }

    public boolean getBoolean() {
      throw new NullPointerException();
    }

    public BigDecimal getNumber() {
      throw new NullPointerException();
    }

    public java.lang.String getString() {
      throw new NullPointerException();
    }

    public int compareTo(Json.String o) {
      throw new NullPointerException();
    }

    public Value get(String key) {
      throw new NullPointerException();
    }

    public boolean containsKey(String key) {
      throw new NullPointerException();
    }

    public boolean isEmpty() {
      throw new NullPointerException();
    }

    public Set<String> keySet() {
      throw new NullPointerException();
    }

    public Set<Entry<String, Value>> entrySet() {
      throw new NullPointerException();
    }

    public Value put(String key, Value value) {
      throw new NullPointerException();
    }

    public int size() {
      throw new NullPointerException();
    }

    public List<Value> values() {
      throw new NullPointerException();
    }

    public void add(int index, Value element) {
      throw new NullPointerException();
    }

    public boolean add(Value element) {
      throw new NullPointerException();
    }

    public Value get(int index) {
      throw new NullPointerException();
    }

    public Iterator<Value> iterator() {
      throw new NullPointerException();
    }

  }

  /**
   * {@code new Json.Null()}.
   */
  public static final Json.Null NULL = new Json.NullImpl();

  /**
   * {@code new Json.Boolean(true)}.
   */
  public static final Json.Boolean TRUE = new Json.BooleanImpl(true);

  /**
   * {@code new Json.Boolean(false)}.
   */
  public static final Json.Boolean FALSE = new Json.BooleanImpl(false);

  /**
   * Read a JSON value from a reader.
   */
  public static Json.Value read(Reader reader) throws IOException {
    CharStream stream = new CharStream(reader);
    return read(stream, skip(stream));
  }

  private static int skip(CharStream reader) throws IOException {
    int c;
    while (Character.isWhitespace(c = reader.read())) {
    }
    return c;
  }

  private static Json.Value read(CharStream reader, int c) throws IOException {
    StringBuilder sb;
    switch (c) {
      // null
      case 'n': {
        int u = reader.read(), l1 = reader.read(), l2 = reader.read();
        if (u == 'u' && l1 == 'l' && l2 == 'l') {
          return Json.NULL;
        } else {
          throw new IllegalArgumentException("null expected");
        }
      }

      // true
      case 't': {
        int r = reader.read(), u = reader.read(), e = reader.read();
        if (r == 'r' && u == 'u' && e == 'e') {
          return Json.TRUE;
        } else {
          throw new IllegalArgumentException("true expected");
        }
      }

      // false
      case 'f': {
        int a = reader.read(), l = reader.read(), s = reader.read(), e = reader.read();
        if (a == 'a' && l == 'l' && s == 's' && e == 'e') {
          return Json.FALSE;
        } else {
          throw new IllegalArgumentException("false expected");
        }
      }

      // object
      case '{':
        Json.ObjectImpl object = new Json.ObjectImpl();
        // Unrolling to avoid state, note that the first time around we must not
        // skip when reading the key of the object.
        c = skip(reader);
        if (c == '}') {
          return object;
        }
        Json.StringImpl key = (Json.StringImpl) read(reader, c);
        if (skip(reader) != ':') {
          throw new IllegalArgumentException(": expected");
        }
        object.put(key, read(reader, skip(reader)));
        c = skip(reader);
        do {
          if (c == '}') {
            return object;
          }
          key = (Json.StringImpl) read(reader, skip(reader));
          if (skip(reader) != ':') {
            throw new IllegalArgumentException(": expected");
          }
          object.put(key, read(reader, skip(reader)));
        } while ((c = skip(reader)) == ',' || c == '}');
        throw new IllegalArgumentException(java.lang.String.format(
            "Non terminated object literal. Last character read was %s. " +
            "Partial object literal read %s.",
            Character.toString((char) c),
            object.toString()));

      // array
      case '[':
        Json.ArrayImpl array = new Json.ArrayImpl();
        // Unrolling to avoid state, note that the first time around we must not
        // skip when reading the value added to the array.
        c = skip(reader);
        if (c == ']') {
          return array;
        }
        array.add(read(reader, c));
        c = skip(reader);
        do {
          if (c == ']') {
            return array;
          }
          array.add(read(reader, skip(reader)));
        } while ((c = skip(reader)) == ',' || c == ']');
        throw new IllegalArgumentException("non terminated array literal");

      // string
      case '"':
        sb = new StringBuilder();
        do {
          switch (c = reader.read()) {
            case '"':
              return new Json.StringImpl(sb.toString());
            case '\\':
              switch (c = reader.read()) {
                case '"':
                case '\\':
                case '/':
                  sb.append((char) c);
                  break;
                case 'b':
                  sb.append('\b');
                  break;
                case 'f':
                  sb.append('\f');
                  break;
                case 'n':
                  sb.append('\n');
                  break;
                case 'r':
                  sb.append('\r');
                  break;
                case 't':
                  sb.append('\t');
                  break;
                case 'u':
                  int h1 = reader.read(), h2 = reader.read(), h3 = reader.read(), h4 = reader.read();
                  if (('a' <= h1 && h1 <= 'f' || 'A' <= h1 && h1 <= 'F' || '0' <= h1 && h1 <= '9') &&
                      ('a' <= h2 && h2 <= 'f' || 'A' <= h2 && h2 <= 'F' || '0' <= h2 && h2 <= '9') &&
                      ('a' <= h3 && h3 <= 'f' || 'A' <= h3 && h3 <= 'F' || '0' <= h3 && h3 <= '9') &&
                      ('a' <= h4 && h4 <= 'f' || 'A' <= h4 && h4 <= 'F' || '0' <= h4 && h4 <= '9')) {
                    sb.append((char) (fromHex(h1) << 12 | fromHex(h2) << 8 | fromHex(h3) << 4 | fromHex(h4)));
                  } else {
                    throw new IllegalArgumentException("invalid hex code");
                  }
              }
              break;
            case -1:
              throw new IllegalArgumentException("non terminated string");
            default:
              sb.append((char) c);
          }
        } while (true);

      // number
      case '-':
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
        sb = new StringBuilder();
        do {
          sb.append((char) c);
        } while ((c = reader.read()) <= '9' && '0' <= c);
        switch (c) {
          case '.':
            do {
              sb.append((char) c);
            } while ((c = reader.read()) <= '9' && '0' <= c);
          case 'e':
          case 'E':
            if (c != 'e' && c != 'E') {
              reader.unread(c);
              return new Json.NumberImplBigDecimal(new BigDecimal(sb.toString()));
            }
            sb.append((char) c);
            c = reader.read();
            if (c != '+' && c != '-' && c < '0' && '9' < c) {
              reader.unread(c);
              return new Json.NumberImplBigDecimal(new BigDecimal(sb.toString()));
            }
            do {
              sb.append((char) c);
            } while ((c = reader.read()) <= '9' && '0' <= c);
          default:
            reader.unread(c);
            return new Json.NumberImplBigDecimal(new BigDecimal(sb.toString()));
        }

      // error
      default:
        throw new IllegalArgumentException("illegal character " + (char) c);
    }
  }

  /* Visible for testing. */
  static int fromHex(int codePoint) {
    // '9' = 57, 'F' = 70, 'f' = 102
    return (codePoint <= '9') ? codePoint - '0' :
        (codePoint <= 'F') ? codePoint - 'A' + 10 : codePoint - 'a' + 10;
  }

  /**
   * Create a JSON value from a string.
   */
  public static Json.Value fromString(java.lang.String input) {
    try {
      return read(new StringReader(input));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  public static Json.Array array(Json.Value... values) {
    return new Json.ArrayImpl(values);
  }

  public static Json.Object object() {
    return new Json.ObjectImpl();
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1) {
    Json.Object o = object();
    o.put(k1, v1);
    return o;
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1,
      Json.String k2, Json.Value v2) {
    Json.Object o = object(k1, v1);
    o.put(k2, v2);
    return o;
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1,
      Json.String k2, Json.Value v2,
      Json.String k3, Json.Value v3) {
    Json.Object o = object(k1, v1, k2, v2);
    o.put(k3, v3);
    return o;
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1,
      Json.String k2, Json.Value v2,
      Json.String k3, Json.Value v3,
      Json.String k4, Json.Value v4) {
    Json.Object o = object(k1, v1, k2, v2, k3, v3);
    o.put(k4, v4);
    return o;
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1,
      Json.String k2, Json.Value v2,
      Json.String k3, Json.Value v3,
      Json.String k4, Json.Value v4,
      Json.String k5, Json.Value v5) {
    Json.Object o = object(k1, v1, k2, v2, k3, v3, k4, v4);
    o.put(k5, v5);
    return o;
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1,
      Json.String k2, Json.Value v2,
      Json.String k3, Json.Value v3,
      Json.String k4, Json.Value v4,
      Json.String k5, Json.Value v5,
      Json.String k6, Json.Value v6) {
    Json.Object o = object(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5);
    o.put(k6, v6);
    return o;
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1,
      Json.String k2, Json.Value v2,
      Json.String k3, Json.Value v3,
      Json.String k4, Json.Value v4,
      Json.String k5, Json.Value v5,
      Json.String k6, Json.Value v6,
      Json.String k7, Json.Value v7) {
    Json.Object o = object(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6);
    o.put(k7, v7);
    return o;
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1,
      Json.String k2, Json.Value v2,
      Json.String k3, Json.Value v3,
      Json.String k4, Json.Value v4,
      Json.String k5, Json.Value v5,
      Json.String k6, Json.Value v6,
      Json.String k7, Json.Value v7,
      Json.String k8, Json.Value v8) {
    Json.Object o = object(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7);
    o.put(k8, v8);
    return o;
  }

  public static Json.Object object(
      Json.String k1, Json.Value v1,
      Json.String k2, Json.Value v2,
      Json.String k3, Json.Value v3,
      Json.String k4, Json.Value v4,
      Json.String k5, Json.Value v5,
      Json.String k6, Json.Value v6,
      Json.String k7, Json.Value v7,
      Json.String k8, Json.Value v8,
      Json.String k9, Json.Value v9) {
    Json.Object o = object(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5, k6, v6, k7, v7, k8, v8);
    o.put(k9, v9);
    return o;
  }

  public static Json.Object object(Json.Value... keyValuePairs) {
    if (keyValuePairs.length % 2 != 0) {
      throw new IllegalArgumentException("Number of arguments must be even");
    }
    Json.Object o = object();
    for (int i = 0; i < keyValuePairs.length; i += 2) {
      Json.Value key = keyValuePairs[i];
      if (key instanceof Json.String) {
        o.put((Json.String) key, keyValuePairs[i + 1]);
      } else {
        throw new IllegalArgumentException("Keys must be JSON strings");
      }
    }
    return o;
  }

  public static Json.Number number(short number) {
    return new Json.NumberImplShort(number);
  }

  public static Json.Number number(int number) {
    return new Json.NumberImplInt(number);
  }

  public static Json.Number number(long number) {
    return new Json.NumberImplLong(number);
  }

  public static Json.Number number(float number) {
    return new Json.NumberImplFloat(number);
  }

  public static Json.Number number(double number) {
    return new Json.NumberImplDouble(number);
  }

  public static Json.Number number(BigDecimal number) {
    return new Json.NumberImplBigDecimal(number);
  }

  public static Json.String string(java.lang.String string) {
    return new Json.StringImpl(string);
  }

  /** See {@link #TRUE}, {@link #FALSE}. */
  static Json.Boolean booleanValue(boolean b) {
    return new Json.BooleanImpl(b);
  }

  /** See {@link #NULL}. */
  static Json.Null nullValue() {
    return new Json.NullImpl();
  }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<Tokens version="1.0">
	<File path="Classes/IFlyAudioSession.html">

		<Token>
			<TokenIdentifier>//apple_ref/occ/cl/IFlyAudioSession</TokenIdentifier>
			<Abstract type="html">音频环境初始化</Abstract>
			<DeclaredIn>IFlyAudioSession.h</DeclaredIn>

			<NodeRef refid="1"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/clm/IFlyAudioSession/initPlayingAudioSession:</TokenIdentifier>
			<Abstract type="html">初始化播音环境</Abstract>
			<DeclaredIn>IFlyAudioSession.h</DeclaredIn>

			<Declaration>+ (void)initPlayingAudioSession:(BOOL)isMPCenter</Declaration>
			<Parameters>
				<Parameter>
					<Name>isMPCenter</Name>
					<Abstract type="html">是否初始化MPPlayerCenter:0不初始化,1初始化</Abstract>
				</Parameter>
			</Parameters>

			<Anchor>//api/name/initPlayingAudioSession:</Anchor>
            <NodeRef refid="1"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/clm/IFlyAudioSession/initRecordingAudioSession</TokenIdentifier>
			<Abstract type="html">初始化录音环境</Abstract>
			<DeclaredIn>IFlyAudioSession.h</DeclaredIn>

			<Declaration>+ (BOOL)initRecordingAudioSession</Declaration>

			<ReturnValue><Abstract type="html">成功返回YES,失败返回NO</Abstract></ReturnValue>
			<Anchor>//api/name/initRecordingAudioSession</Anchor>
            <NodeRef refid="1"/>
		</Token>

	</File>
</Tokens>


text:
<?php namespace Wetcat\Litterbox\Controllers;

use Wetcat\Litterbox\Requests;
use Wetcat\Litterbox\Controllers\Controller;

use Illuminate\Http\Request;
use Validator;

use Wetcat\Litterbox\Models\Currency;
use Wetcat\Litterbox\Models\Rate;

use Ramsey\Uuid\Uuid;

class RateController extends Controller {

  /**
   * Display a listing of the resource.
   *
   * @return Response
   */
  public function index(Request $request)
  {
    $rates = [];

    if ($request->has('rel')) {
      $rels = explode('_', $request->input('rel'));
      $rates = Rate::with($rels)->get();
    } else {
      $rates = Rate::all();
    }

    return response()->json([
      'status'    => 200,
      'data'      => $rates,
      'heading'   => 'Rate',
      'messages'  => null
    ], 200);
  }

  /**
   * Show the form for creating a new resource.
   *
   * @return Response
   */
  public function create()
  {
    //
  }

  /**
   * Store a newly created resource in storage.
   *
   * @return Response
   */
  public function store(Request $request)
  {
    $validator = Validator::make($request->all(), [
      'currency'  => 'required|string',
      'rate'      => 'required|regex:/^[0-9]+[.,]?[0-9]*/',
    ]);
    if ($validator->fails()) {
      $messages = [];
      foreach ($validator->errors()->all() as $message) {
        $messages[] = $message;
      }
      return response()->json([
        'status'    => 400,
        'data'      => null,
        'heading'   => 'Rate',
        'messages'  => $messages
      ], 400);
    }

    if (Uuid::isValid($request->input('currency'))) {
      $currency = Currency::where('uuid', $request->input('currency'))->first();
    } else {
      $currencyData = [
        'uuid'  => Uuid::uuid4()->toString(),
        'name'  => $request->input('currency')
      ];
      $currency = Currency::create($currencyData);
    }

    // Make sure the Rate is always using dot-notation for international purposes!
    $rate = str_replace(',', ".", $request->input('rate'));

    $rateData = [
      'uuid'  => Uuid::uuid4()->toString(),
      'rate'  => $rate
    ];

    // Create the Rate
    $rate = Rate::create($rateData);

    // Connect the rate to the currency
    $rel = $currency->rates()->save($rate);

    $out = Rate::with('currency')->where('uuid', $rate->uuid)->first();

    return response()->json([
      'status'  => 200,
      'data'    => $out,
      'heading'   => 'Rate',
      'messages' => ['Added new rate ('.$rate->rate.') to '.$currency->name]
    ], 200);
  }

  /**
   * Display the specified resource.
   *
   * @param  int  $id
   * @return Response
   */
  public function show(Request $request, $id)
  {
    if ($request->has('rel')) {
      $rate = Rate::with($rels)->where('uuid', $id)->get();
    } else {
      $rate = Rate::where('uuid', $id)->get();
    }

    return response()->json([
      'status'    => 200,
      'data'      => $rate,
      'heading'   => 'Rate',
      'messages'  => null
    ], 200);
  }

  /**
   * Show the form for editing the specified resource.
   *
   * @param  int  $id
   * @return Response
   */
  public function edit($id)
  {
    //
  }

  /**
   * Update the specified resource in storage.
   *
   * @param  int  $id
   * @return Response
   */
  public function update(Request $request, $uuid)
  {
    //
  }

  /**
   * Remove the specified resource from storage.
   *
   * @param  int  $id
   * @return Response
   */
  public function destroy($id)
  {
    //
  }

}


text:
require 'fundry/user'

module Fundry
  class User
    module Site
      USERNAME = 'fundry'

      def self.get
        User.first(username: USERNAME)
      end
    end # Site
  end # User
end # Fundry


text: looper based on bela beaglebone board


text:
package com.intellij.ui;

import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.actionSystem.EmptyAction;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.ui.JBMenuItem;
import com.intellij.openapi.ui.JBPopupMenu;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.components.JBList;
import com.intellij.ui.components.JBTextField;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.ui.JBInsets;
import com.intellij.util.ui.UIUtil;

import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.TextUI;
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

/**
 * @author max
 */
public class SearchTextField extends JPanel {

  private int myHistorySize = 5;
  private final MyModel myModel;
  private final TextFieldWithProcessing myTextField;

  private JBPopup myPopup;
  private JLabel myClearFieldLabel;
  private JLabel myToggleHistoryLabel;
  private JPopupMenu myNativeSearchPopup;
  private JMenuItem myNoItems;

  public SearchTextField() {
    this(true);
  }

  public SearchTextField(boolean historyEnabled) {
    super(new BorderLayout());

    myModel = new MyModel();

    myTextField = new TextFieldWithProcessing() {
      @Override
      public void processKeyEvent(final KeyEvent e) {
        if (preprocessEventForTextField(e)) return;
        super.processKeyEvent(e);
      }

      @Override
      public void setBackground(final Color bg) {
        super.setBackground(bg);
        if (!hasIconsOutsideOfTextField()) {
          if (myClearFieldLabel != null) {
            myClearFieldLabel.setBackground(bg);
          }
        }
        if (myToggleHistoryLabel != null) {
          myToggleHistoryLabel.setBackground(bg);
        }
      }

      @Override
      public void setUI(TextUI ui) {
        if (SystemInfo.isMac) {
          try {
            Class<?> uiClass = UIUtil.isUnderIntelliJLaF() ? Class.forName("com.intellij.ide.ui.laf.intellij.MacIntelliJTextFieldUI")
                                                           : Class.forName("com.intellij.ide.ui.laf.darcula.ui.DarculaTextFieldUI");
            Method method = ReflectionUtil.getMethod(uiClass, "createUI", JComponent.class);
            if (method != null) {
              super.setUI((TextUI)method.invoke(uiClass, this));
              Class<?> borderClass = UIUtil.isUnderIntelliJLaF() ? Class.forName("com.intellij.ide.ui.laf.intellij.MacIntelliJTextBorder")
                                                                 : Class.forName("com.intellij.ide.ui.laf.darcula.ui.DarculaTextBorder");
              setBorder((Border)ReflectionUtil.newInstance(borderClass));
              setOpaque(false);
            }
            return;
          }
          catch (Exception ignored) {
          }
        }
        super.setUI(ui);
      }
    };
    myTextField.setColumns(15);
    myTextField.addFocusListener(new FocusAdapter() {
      @Override
      public void focusLost(FocusEvent e) {
        onFocusLost();
        super.focusLost(e);
      }

      @Override
      public void focusGained(FocusEvent e) {
        onFocusGained();
        super.focusGained(e);
      }
    });
    add(myTextField, BorderLayout.CENTER);
    myTextField.addKeyListener(new KeyAdapter() {
      @Override
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_DOWN) {
          if (isSearchControlUISupported() && myNativeSearchPopup != null) {
            myNativeSearchPopup.show(myTextField, 5, myTextField.getHeight());
          } else if (myPopup == null || !myPopup.isVisible()) {
            showPopup();
          }
        }
      }
    });

    if (isSearchControlUISupported()) {
      myTextField.putClientProperty("JTextField.variant", "search");
      myTextField.putClientProperty("JTextField.Search.CancelAction", new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          myTextField.setText("");
          onFieldCleared();
        }
      });

      if (historyEnabled) {
        myNativeSearchPopup = new JBPopupMenu();
        myNoItems = new JBMenuItem("No recent searches");
        myNoItems.setEnabled(false);

        updateMenu();
        myTextField.putClientProperty("JTextField.Search.FindPopup", myNativeSearchPopup);
      }
    }
    else {
      myToggleHistoryLabel = new JLabel(AllIcons.Actions.Search);
      myToggleHistoryLabel.setOpaque(true);
      myToggleHistoryLabel.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
          togglePopup();
        }
      });
      if (historyEnabled) {
        add(myToggleHistoryLabel, BorderLayout.WEST);
      }

      myClearFieldLabel = new JLabel(UIUtil.isUnderDarcula() ? AllIcons.Actions.Clean : AllIcons.Actions.CleanLight);
      myClearFieldLabel.setOpaque(true);
      add(myClearFieldLabel, BorderLayout.EAST);
      myClearFieldLabel.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
          myTextField.setText("");
          onFieldCleared();
        }
      });

      if (!hasIconsOutsideOfTextField()) {
        final Border originalBorder;
        if (SystemInfo.isMac) {
          originalBorder = BorderFactory.createLoweredBevelBorder();
        }
        else {
          originalBorder = myTextField.getBorder();
        }

        myToggleHistoryLabel.setBackground(myTextField.getBackground());
        myClearFieldLabel.setBackground(myTextField.getBackground());

        setBorder(new CompoundBorder(IdeBorderFactory.createEmptyBorder(2, 0, 2, 0), originalBorder));

        myTextField.setOpaque(true);
        myTextField.setBorder(IdeBorderFactory.createEmptyBorder(0, 5, 0, 5));
      }
      else {
        setBorder(IdeBorderFactory.createEmptyBorder(2, 0, 2, 0));
      }
    }

    if (ApplicationManager.getApplication() != null) { //tests
      final ActionManager actionManager = ActionManager.getInstance();
      if (actionManager != null) {
        EmptyAction.registerWithShortcutSet(IdeActions.ACTION_CLEAR_TEXT, CommonShortcuts.ESCAPE, this);
      }
    }
  }

  protected void onFieldCleared() {
  }

  protected void onFocusLost() {
  }

  protected void onFocusGained() {
  }

  private void updateMenu() {
    if (myNativeSearchPopup != null) {
      myNativeSearchPopup.removeAll();
      final int itemsCount = myModel.getSize();
      if (itemsCount == 0) {
        myNativeSearchPopup.add(myNoItems);
      }
      else {
        for (int i = 0; i < itemsCount; i++) {
          final String item = myModel.getElementAt(i);
          addMenuItem(item);
        }
      }
    }
  }

  protected boolean isSearchControlUISupported() {
    return (SystemInfo.isMacOSLeopard && UIUtil.isUnderAquaLookAndFeel()) || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF();
  }

  protected boolean hasIconsOutsideOfTextField() {
    return UIUtil.isUnderGTKLookAndFeel() || UIUtil.isUnderNimbusLookAndFeel();
  }

  public void addDocumentListener(DocumentListener listener) {
    getTextEditor().getDocument().addDocumentListener(listener);
  }

  public void removeDocumentListener(DocumentListener listener) {
    getTextEditor().getDocument().removeDocumentListener(listener);
  }

  public void addKeyboardListener(final KeyListener listener) {
    getTextEditor().addKeyListener(listener);
  }

  public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);
    if (myToggleHistoryLabel != null) {
      final Color bg = enabled ? UIUtil.getTextFieldBackground() : UIUtil.getPanelBackground();
      myToggleHistoryLabel.setBackground(bg);
      myClearFieldLabel.setBackground(bg);
    }
  }

  public void setHistorySize(int historySize) {
    if (historySize <= 0) throw new IllegalArgumentException("history size must be a positive number");
    myHistorySize = historySize;
  }

  public void setHistory(List<String> aHistory) {
    myModel.setItems(aHistory);
  }

  public List<String> getHistory() {
    final int itemsCount = myModel.getSize();
    final List<String> history = new ArrayList<String>(itemsCount);
    for (int i = 0; i < itemsCount; i++) {
      history.add(myModel.getElementAt(i));
    }
    return history;
  }

  public void setText(String aText) {
    getTextEditor().setText(aText);
  }

  public String getText() {
    return getTextEditor().getText();
  }

  public void removeNotify() {
    super.removeNotify();
    hidePopup();
  }

  public void addCurrentTextToHistory() {
    if ((myNativeSearchPopup != null && myNativeSearchPopup.isVisible()) || (myPopup != null && myPopup.isVisible())) {
      return;
    }
    final String item = getText();
    myModel.addElement(item);
  }

  private void addMenuItem(final String item) {
    if (myNativeSearchPopup != null) {
      myNativeSearchPopup.remove(myNoItems);
      final JMenuItem menuItem = new JBMenuItem(item);
      myNativeSearchPopup.add(menuItem);
      menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
          myTextField.setText(item);
          addCurrentTextToHistory();
        }
      });
    }
  }

  public void selectText() {
    getTextEditor().selectAll();
  }

  public JBTextField getTextEditor() {
    return myTextField;
  }

  public boolean requestFocusInWindow() {
    return myTextField.requestFocusInWindow();
  }

  public void requestFocus() {
    getTextEditor().requestFocus();
  }

  public class MyModel extends AbstractListModel {
    private List<String> myFullList = new ArrayList<String>();

    private String mySelectedItem;

    public String getElementAt(int index) {
      return myFullList.get(index);
    }

    public int getSize() {
      return Math.min(myHistorySize, myFullList.size());
    }

    public void addElement(String item) {
      final String newItem = item.trim();
      if (newItem.isEmpty()) {
        return;
      }

      final int length = myFullList.size();
      int index = -1;
      for (int i = 0; i < length; i++) {
        if (StringUtil.equalsIgnoreCase(myFullList.get(i), newItem)) {
          index = i;
          break;
        }
      }
      if (index == 0) {
        // item is already at the top of the list
        return;
      }
      else if (index > 0) {
        // move item to top of the list
        myFullList.remove(index);
      }
      else if (myFullList.size() >= myHistorySize && myFullList.size() > 0) {
        // trim list
        myFullList.remove(myFullList.size() - 1);
      }
      insertElementAt(newItem, 0);
    }

    public void insertElementAt(String item, int index) {
      myFullList.add(index, item);
      fireContentsChanged();
    }

    public String getSelectedItem() {
      return mySelectedItem;
    }

    public void setSelectedItem(String anItem) {
      mySelectedItem = anItem;
    }

    public void fireContentsChanged() {
      fireContentsChanged(this, -1, -1);
      updateMenu();
    }

    public void setItems(List<String> aList) {
      myFullList = new ArrayList<String>(aList);
      fireContentsChanged();
    }
  }

  private void hidePopup() {
    if (myPopup != null) {
      myPopup.cancel();
      myPopup = null;
    }
  }

  @Override
  public Dimension getPreferredSize() {
    Dimension size = super.getPreferredSize();
    Border border = super.getBorder();
    if (border != null && UIUtil.isUnderAquaLookAndFeel()) {
      JBInsets.addTo(size, border.getBorderInsets(this));
    }
    return size;
  }

  protected Runnable createItemChosenCallback(final JList list) {
    return new Runnable() {
      public void run() {
        final String value = (String)list.getSelectedValue();
        getTextEditor().setText(value != null ? value : "");
        addCurrentTextToHistory();
        if (myPopup != null) {
          myPopup.cancel();
          myPopup = null;
        }
      }
    };
  }

  protected void showPopup() {
    if (myPopup == null || !myPopup.isVisible()) {
      final JList list = new JBList(myModel);
      final Runnable chooseRunnable = createItemChosenCallback(list);
      myPopup = JBPopupFactory.getInstance().createListPopupBuilder(list)
        .setMovable(false)
        .setRequestFocus(true)
        .setItemChoosenCallback(chooseRunnable).createPopup();
      if (isShowing()) {
        myPopup.showUnderneathOf(getPopupLocationComponent());
      }
    }
  }

  protected Component getPopupLocationComponent() {
    return hasIconsOutsideOfTextField() ? myToggleHistoryLabel : this;
  }

  private void togglePopup() {
    if (myPopup == null) {
      showPopup();
    }
    else {
      hidePopup();
    }
  }

  public void setSelectedItem(final String s) {
    getTextEditor().setText(s);
  }

  public int getSelectedIndex() {
    return myModel.myFullList.indexOf(getText());
  }

  protected static class TextFieldWithProcessing extends JBTextField {
    public void processKeyEvent(KeyEvent e) {
      super.processKeyEvent(e);
    }
  }

  public final void keyEventToTextField(KeyEvent e) {
    myTextField.processKeyEvent(e);
  }

  protected boolean preprocessEventForTextField(KeyEvent e) {
    return false;
  }

  public void setSearchIcon(final Icon icon) {
    if (! isSearchControlUISupported()) {
      myToggleHistoryLabel.setIcon(icon);
    }
  }
}


text:
module Reports
  class Periodic
    module Scopes

      def every(*args)
        all
      end

      def for_month(date, column='created_at')
        where(["DATE_FORMAT(#{quoted_table_name}.#{connection.quote_column_name column}, '%Y%m') = DATE_FORMAT(?, '%Y%m')", date])
      end

      def between_months(date1, date2, column='created_at')
        query = [
          "(DATE_FORMAT(#{quoted_table_name}.#{connection.quote_column_name column}, '%Y%m') >= DATE_FORMAT(?, '%Y%m'))",
          "(DATE_FORMAT(#{quoted_table_name}.#{connection.quote_column_name column}, '%Y%m') <= DATE_FORMAT(?, '%Y%m'))"
        ].join(' AND ')
        where([date1, date2].sort.unshift(query))
      end

      def year_to_date(column='created_at')
        between_months DateTime.new(Time.zone.now.year), Time.zone.now, column
      end
    end
  end
end


text:
namespace V5_WinControls {
    partial class cRichTextBox {
        /// <summary>
        /// ±ØÐèµÄÉè¼ÆÆ÷±äÁ¿¡£
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// ÇåÀíËùÓÐÕýÔÚʹÓõÄ×ÊÔ´¡£
        /// </summary>
        /// <param name="disposing">Èç¹ûÓ¦ÊÍ·ÅÍйÜ×ÊÔ´£¬Îª true£»·ñÔòΪ false¡£</param>
        protected override void Dispose(bool disposing) {
            if (disposing && (components != null)) {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region ×é¼þÉè¼ÆÆ÷Éú³ÉµÄ´úÂë

        /// <summary>
        /// Éè¼ÆÆ÷Ö§³ÖËùÐèµÄ·½·¨ - ²»Òª
        /// ʹÓôúÂë±à¼Æ÷Ð޸Ĵ˷½·¨µÄÄÚÈÝ¡£
        /// </summary>
        private void InitializeComponent() {
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.SuspendLayout();
            //
            // richTextBox1
            //
            this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.richTextBox1.Location = new System.Drawing.Point(0, 0);
            this.richTextBox1.Name = "richTextBox1";
            this.richTextBox1.Size = new System.Drawing.Size(100, 96);
            this.richTextBox1.TabIndex = 0;
            this.richTextBox1.Text = "";
            //
            // cRichTextBox
            //
            this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.RichTextBox richTextBox1;

    }
}


text:
module LtiProvider
  Config = OpenStruct.new
end


text:
package co.cask.tephra.inmemory;

import co.cask.tephra.InvalidTruncateTimeException;
import co.cask.tephra.Transaction;
import co.cask.tephra.TransactionCouldNotTakeSnapshotException;
import co.cask.tephra.TransactionNotInProgressException;
import co.cask.tephra.TransactionSystemClient;
import co.cask.tephra.TransactionType;
import co.cask.tephra.TxConstants;

import java.io.InputStream;
import java.util.Collection;
import java.util.Set;

/**
 * Dummy implementation of TxSystemClient. May be useful for perf testing.
 */
public class MinimalTxSystemClient implements TransactionSystemClient {
  private long currentTxPointer = 1;

  @Override
  public Transaction startShort() {
    long wp = currentTxPointer++;
    // NOTE: -1 here is because we have logic that uses (readpointer + 1) as a "exclusive stop key" in some datasets
    return new Transaction(
      Long.MAX_VALUE - 1, wp, new long[0], new long[0],
      Transaction.NO_TX_IN_PROGRESS, TransactionType.SHORT);
  }

  @Override
  public Transaction startShort(int timeout) {
    return startShort();
  }

  @Override
  public Transaction startLong() {
    return startShort();
  }

  @Override
  public boolean canCommit(Transaction tx, Collection<byte[]> changeIds) {
    return true;
  }

  @Override
  public boolean commit(Transaction tx) {
    return true;
  }

  @Override
  public void abort(Transaction tx) {
    // do nothing
  }

  @Override
  public boolean invalidate(long tx) {
    return true;
  }

  @Override
  public Transaction checkpoint(Transaction tx) throws TransactionNotInProgressException {
    return tx;
  }

  @Override
  public InputStream getSnapshotInputStream() throws TransactionCouldNotTakeSnapshotException {
    throw new TransactionCouldNotTakeSnapshotException("Not snapshot to take.");
  }

  @Override
  public String status() {
    return TxConstants.STATUS_OK;
  }

  @Override
  public void resetState() {
    // do nothing
  }

  @Override
  public boolean truncateInvalidTx(Set<Long> invalidTxIds) {
    return true;
  }

  @Override
  public boolean truncateInvalidTxBefore(long time) throws InvalidTruncateTimeException {
    return true;
  }

  @Override
  public int getInvalidSize() {
    return 0;
  }
}