text:
Rewrite Plugin
==============

The ``rewrite`` plugin lets you easily substitute values in your templates and
path formats. Specifically, it is intended to let you *canonicalize* names
such as artists: for example, perhaps you want albums from The Jimi Hendrix
Experience to be sorted into the same folder as solo Hendrix albums.

To use field rewriting, first enable the plugin by putting ``rewrite`` on your
``plugins`` line. Then, make a ``rewrite:`` section in your config file to
contain your rewrite rules. Each rule consists of a field name, a regular
expression pattern, and a replacement value. Rules are written ``fieldname
regex: replacement``. For example, this line implements the Jimi Hendrix
example above::

    rewrite:
        artist The Jimi Hendrix Experience: Jimi Hendrix

This will make ``$artist`` in your templates expand to "Jimi Hendrix" where it
would otherwise be "The Jimi Hendrix Experience".

The pattern is a case-insensitive regular expression. This means you can use
ordinary regular expression syntax to match multiple artists. For example, you
might use::

    rewrite:
        artist .*jimi hendrix.*: Jimi Hendrix

As a convenience, the plugin applies patterns for the ``artist`` field to the
``albumartist`` field as well. (Otherwise, you would probably want to duplicate
every rule for ``artist`` and ``albumartist``.)

Note that this plugin only applies to templating; it does not modify files'
metadata tags or the values tracked by beets' library database.

redpajama_set_name: RedPajamaGithub


text:
package com.facebook.litho.widget;

import com.facebook.litho.annotations.TestSpec;

@TestSpec(CardSpec.class)
public interface TestCardSpec {}


text:
#include <stdio.h>
#include "I_HostDB.h"

#include "diags.i"

class HostDBTest : Continuation
{
};

int
main()
{
  init_diags("net_test", nullptr);
  ink_event_system_init(EVENT_SYSTEM_MODULE_PUBLIC_VERSION);
  ink_net_init(NET_SYSTEM_MODULE_PUBLIC_VERSION);
  ink_hostdb_init(HOSTDB_MODULE_PUBLIC_VERSION);
  signal(SIGPIPE, SIG_IGN);

  eventProcessor.start(2);
  netProcessor.start();

  printf("hello world\n");

  hostDBProcessor.start();

  this_ethread()->execute();
}


text:
import { Map } from 'immutable';
import { SESSION_TRACKLIST_ID } from 'src/core/constants';
import { searchActions } from 'src/core/search';
import { userActions } from 'src/core/users';
import { tracklistActions } from './actions';
import { Tracklist } from './tracklist';
import { tracklistReducer } from './tracklist-reducer';

export const initialState = new Map({
  currentTracklistId: SESSION_TRACKLIST_ID,
  [SESSION_TRACKLIST_ID]: new Tracklist({id: SESSION_TRACKLIST_ID, isNew: false})
});

export function tracklistsReducer(state = initialState, action) {
  const { payload } = action;

  switch (action.type) {
    case tracklistActions.FETCH_TRACKS_FULFILLED:
    case tracklistActions.FETCH_TRACKS_PENDING:
      return state.set(
        payload.tracklistId,
        tracklistReducer(state.get(payload.tracklistId), action)
      );

    case tracklistActions.LOAD_FEATURED_TRACKS:
    case searchActions.LOAD_SEARCH_RESULTS:
    case userActions.LOAD_USER_LIKES:
    case userActions.LOAD_USER_TRACKS:
      return state.merge({
        currentTracklistId: payload.tracklistId,
        [payload.tracklistId]: tracklistReducer(state.get(payload.tracklistId), action)
      });

    case tracklistActions.MOUNT_TRACKLIST:
      return state.set('currentTracklistId', payload.tracklistId);

    case tracklistActions.UPDATE_PAGINATION:
      return state.set(
        state.get('currentTracklistId'),
        tracklistReducer(state.get(state.get('currentTracklistId')), action)
      );

    default:
      return state;
  }
}


text:
<!DOCTYPE html>

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

        <link href='http://fonts.googleapis.com/css?family=Jura:400,300,500,600' rel='stylesheet' type='text/css'>

        <link rel="stylesheet" href="/assets/css/normalize.css">
        <link rel="stylesheet" href="/assets/css/main.css">
        <link rel="stylesheet" href="/assets/css/jquery-ui-1.10.4.custom.min.css">
        <link rel="stylesheet" href="/assets/css/camera.css" id="camera-css" type="text/css" media="all">
        <link rel="stylesheet" href="/assets/css/ccslider.css" />
        <link rel="stylesheet" href="/assets/css/styles.css">


text:
using Stratis.SmartContracts.CLR.Serialization;
using Stratis.SmartContracts.Core.Receipts;

namespace Stratis.SmartContracts.CLR.ContractLogging
{
    /// <summary>
    /// Injected into the <see cref="SmartContract"/> class. Spends gas for logging an event
    /// before passing it into the logger that actually handles the logging.
    /// </summary>
    public class MeteredContractLogger : IContractLogger
    {
        private readonly RuntimeObserver.IGasMeter gasMeter;
        private readonly IContractLogger logger;
        private readonly IContractPrimitiveSerializer serializer;

        public MeteredContractLogger(RuntimeObserver.IGasMeter gasMeter, IContractLogger logger, IContractPrimitiveSerializer serializer)
        {
            this.gasMeter = gasMeter;
            this.logger = logger;
            this.serializer = serializer;
        }

        public void Log<T>(ISmartContractState smartContractState, T toLog) where T : struct
        {
            var rawLog = new RawLog(smartContractState.Message.ContractAddress.ToUint160(), toLog);
            Log log = rawLog.ToLog(this.serializer);
            this.gasMeter.Spend(GasPriceList.LogOperationCost(log.Topics, log.Data));

            // TODO: This is inefficient, it is deserializing the log more than once.
            this.logger.Log<T>(smartContractState, toLog);
        }
    }
}


text:
/** Demonstration of structuredata colormaker, coloring atoms by numeric property passed
 * in as colorData.atomData
 */
stage.loadFile('data://1lee.pdb').then(function (c) {
  // We might be colouring by some calculated/predicted property (e.g. ML model which outputs
  // scores/quantities for individual atoms)

  // For our example, we'll generate some random "scores" for the ligand atoms in PDB entry 1lee
  // (Ligand has hetcode R36), leaving all the protein atoms unscored

  var structure = c.structure
  var scores = []

  var ligandView = structure.getView(new NGL.Selection('R36'))

  ligandView.eachAtom(ap => {
    // We only populate scores for some of the atoms (those in the R36 residue),
    // For non-ligand atoms scores[i] will be undefined, and color will fallback to color value
    scores[ap.index] = Math.random()
  })

  c.addRepresentation('licorice', {
    color: 'structuredata',
    colorData: {atomData: scores},
    colorDomain: [0.0, 1.0], // This is the default domain
    colorScale: 'rainbow', // Any of the normal color scales are available
    colorValue: '#888' // Fallback color for atoms without data
  })
  c.autoView('R36')
})


text:
<?php
/**
 * User: Andy
 * Date: 16/01/2014
 * Time: 11:34
 */

namespace AV\Form\Tests;

use AV\Form\FormBlueprint;
use AV\Form\FormError;
use AV\Form\FormView;

class FormViewTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var FormView
     */
    private $formView;

    private $nameField;

    private $categoryField;

    public function setUp()
    {
        $this->formView = new FormView();

        $this->nameField = array (
            'name' => 'name',
            'type' => 'text',
            'options' => array (
                'label' => 'Name'
            ),
            'value' => 'Example Name'
        );

        $this->categoryField = array (
            'name' => 'category',
            'type' => 'select',
            'options' => array (
                'label' => 'Category',
                'choices' => array(
                    '1' => 'One',
                    '2' => 'Two'
                )
            )
        );
    }

    public function testGetSetField()
    {
        $fields = array(
            'name' => $this->nameField,
            'category' => $this->categoryField
        );

        $this->formView->setFields($fields);

        $this->assertTrue(isset($this->formView->name));
        $this->assertTrue(isset($this->formView->category));
        $this->assertFalse(isset($this->formView->non_existant));
        $this->assertEquals($this->nameField, $this->formView->name);
        $this->assertEquals($this->categoryField, $this->formView->category);
    }

    public function testGetNullField()
    {
        $this->assertNull($this->formView->non_existant_var);
    }

    /**
     * @dataProvider providerInvalidFieldnames
     */
    public function testInvalidFieldnameException($field_name)
    {
        $this->setExpectedException('\Exception');

        $this->formView->setFields(array(
            $field_name => array('name' => $field_name)
        ));
    }

    public function providerInvalidFieldnames()
    {
        return array(
            array('params')
        );
    }

    public function testGetSetAction()
    {
        $url = 'http://www.example.com/form.php';

        $this->formView->setAction($url);

        $this->assertEquals($url, $this->formView->getParams()['action']);
    }

    public function testGetSetMethod()
    {
        $this->formView->setMethod('GET');

        $this->assertEquals('GET', $this->formView->getParams()['method']);
    }

    public function testGetSetName()
    {
        $name = 'form_name_test';

        $this->formView->setName($name);

        $this->assertEquals($name, $this->formView->getParams()['name']);
    }

    public function testValid()
    {
        $this->formView->setValid(true);
        $this->assertTrue($this->formView->isValid());
    }

    public function testEncoding()
    {
        $set = 'multipart/form-data';

        $this->formView->setEncoding($set);
        $this->assertEquals($set, $this->formView->getParams()['encoding']);
    }

    public function testHasErrors()
    {
        $this->assertNull($this->formView->getErrors());

        $this->formView->setErrors(array(new FormError('name', 'test')));
        $this->assertTrue($this->formView->hasErrors());
    }

    public function testJsonResponse()
    {
        $this->formView->setErrors(array(new FormError('name', 'test')));

        $jsonData = $this->formView->getJsonResponseData();

        $this->assertTrue($jsonData['has_errors']);
        $this->assertCount(1, $jsonData['errors']);
    }

    public function testTranslation()
    {
        $mockTranslator = $this->getMockBuilder('\AVCMS\Core\Translation\Translator')
            ->disableOriginalConstructor()
            ->getMock();

        $expectedTranslation = array(
            'Name Translated',
            'Category Translated',
            'One Translated',
            'Submit Translated',
            'Error Translated'
        );

        $map = array(
            array('Name', array(), null, null, $expectedTranslation[0]),
            array('Category', array(), null, null, $expectedTranslation[1]),
            array("One", array(), null, null, $expectedTranslation[2]),
            array("Submit Original", array(), null, null, $expectedTranslation[3]),
            array("Example Error", array(), null, null, $expectedTranslation[4])
        );

        $mockTranslator->expects($this->any())
            ->method('trans')
            ->will($this->returnValueMap($map));

        $this->formView->setTranslator($mockTranslator);

        $fields = array(
            'name' => $this->nameField,
            'category' => $this->categoryField
        );

        $this->formView->setFields($fields);

        $this->formView->setSubmitButtonLabel('Submit Original');

        $fields = $this->formView->getFields();

        $this->assertEquals($expectedTranslation[0], $fields['name']['options']['label']);
        $this->assertEquals($expectedTranslation[1], $fields['category']['options']['label']);
        $this->assertEquals($expectedTranslation[2], $fields['category']['options']['choices'][1]);
        $this->assertEquals($expectedTranslation[3], $this->formView->getSubmitButtonLabel());

        $formErrors = array(
            new FormError('name', 'Example Error', true)
        );

        $this->formView->setErrors($formErrors);

        $translatedErrors = $this->formView->getErrors();

        $this->assertEquals($expectedTranslation[4], $translatedErrors[0]->getMessage());
    }

    public function testTranslationNoTranslator()
    {
        $error = new FormError('name', 'A {param_name} error', true, ['param_name' => 'name']);

        $this->formView->setErrors([$error]);

        $finalErrors = $this->formView->getErrors();

        $this->assertEquals('A name error', $finalErrors[0]->getMessage());
    }

    public function testSections()
    {
        $sections = array('my_section' => array('label' => 'My Section'));
        $fields = array('example_field' => array('name' => 'example_field', 'options' => array('section' => 'my_section')));

        $this->formView->setSections($sections);

        $this->formView->setFields($fields);

        $this->assertEquals($sections, $this->formView->getSections());

        $resultingFields = $this->formView->getSectionFields('my_section');

        $this->assertArrayHasKey('example_field', $resultingFields);
    }

    public function testSuccessMessage()
    {
        $formBlueprint = new FormBlueprint();
        $formBlueprint->setSuccessMessage('Form Submitted Message');

        $this->formView->setFormBlueprint($formBlueprint);
        $this->formView->setSubmitted(true);

        $this->assertEquals('Form Submitted Message', $this->formView->getSuccessMessage('Form Submitted Message'));
    }

    public function testSubmitted()
    {
        $this->formView->setSubmitted(true);

        $this->assertTrue($this->formView->isSubmitted());
    }
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DefaultReverseEngineering
{
    [Table("SalesTerritoryHistory", Schema = "Sales")]
    public partial class SalesTerritoryHistory
    {
        public int BusinessEntityID { get; set; }
        public DateTime StartDate { get; set; }
        public int TerritoryID { get; set; }
        public DateTime? EndDate { get; set; }
        public DateTime ModifiedDate { get; set; }
        public Guid rowguid { get; set; }

        [ForeignKey("BusinessEntityID")]
        [InverseProperty("SalesTerritoryHistory")]
        public virtual SalesPerson BusinessEntity { get; set; }
        [ForeignKey("TerritoryID")]
        [InverseProperty("SalesTerritoryHistory")]
        public virtual SalesTerritory Territory { get; set; }
    }
}


text:
package shapeless
package syntax

/**
 * Carrier for `Nat` operations.
 *
 * @author Dale Wijnand
 */
final class NatOps[N <: Nat](val n: N) extends AnyVal with Serializable {
  import ops.nat._

  /**
   * Returns the int value of this `Nat`.
   */
  def toInt(implicit toIntN: ToInt[n.N]): Int = Nat.toInt(n)
}


text:
<bill session="111" type="h" number="314" updated="2009-03-07T10:24:26-05:00">
	<status><introduced date="1231390800" datetime="2009-01-08"/></status>

	<introduced date="1231390800" datetime="2009-01-08"/>
	<titles>
		<title type="short" as="introduced">Federal Criminal Immigration Courts Act of 2009</title>
		<title type="official" as="introduced">To increase the number of Federal judgeships in certain judicial districts with heavy caseloads of criminal immigration cases.</title>
	</titles>
	<sponsor id="400657"/>
	<cosponsors>

	</cosponsors>
	<actions>
		<action date="1231390800" datetime="2009-01-08"><text>Referred to the House Committee on the Judiciary.</text></action>
		<action date="1234155600" datetime="2009-02-09"><text>Referred to the Subcommittee on Courts, the Internet, and Intellectual Property.</text></action>
	</actions>
	<committees>
		<committee name="House Judiciary" subcommittee="" activity="Referral, In Committee" />
		<committee name="House Judiciary" subcommittee="Courts, the Internet, and Intellectual Property" activity="Referral" />
	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>
		<term name="Law"/>
		<term name="Arizona"/>
		<term name="Border security and unlawful immigration"/>
		<term name="Federal district courts"/>
		<term name="Judges"/>
		<term name="New Mexico"/>
		<term name="Texas"/>
	</subjects>
	<amendments>

	</amendments>

	1/8/2009--Introduced.
Federal Criminal Immigration Courts Act of 2009 - Directs the President to appoint, by and with the advice and consent of the Senate, the following permanent judgeships: (1) four additional district judges for the district of Arizona; (2) one additional district judge for the district of New Mexico; (3) two additional district judges for the southern district of Texas; and (4) one additional district judge for the western district of Texas. Directs the President to appoint, by and with the advice and consent of the Senate, the following temporary judgeships: (1) one additional district judge for the district of Arizona; and (2) one additional district judge for the district of New Mexico. Provides that, for each of the judicial districts named in this Act, the first vacancy arising on the district court 10 years or more after a judge is first confirmed to fill the temporary district judgeship created by this Act shall not be filled.

</bill>


text:
<!doctype html>

    <title>Quechua, Northern Conchucos Ancash</title>

KAYMI KAN LLAPAN MUNDUCHAW IMANAW KAQ RUNAKUNAPAPIS DIRICHUNKUNA

QALLANAN KAQ

Musyantsikmi kaynaw kanqanta: Imanaw kaq runakunapis runam kayan. Llapantsik iwal kashqaqa iwalrni dirichuntsikkuna kapamantsik. Y tsaynaw kaptinmi trankilu, libri, kawashun dirichuntsikkunawan.

Y dirichukunata mana kasukurninpis mana alli runakunam allaapa ultrahayarqan wakin runakunata. Y tsaynaw ultrahayanqanta musyar llapan munduchaw runakuna llakikur rabiyakuyarqan. Y yapay mana tsaynaw kananpaqmi munantsik kay mundu kaynaw kananta:

Parlayta rnunashqaqa llapan yarpanqantsiknaw parlashwan llapantsik runakuna. Kriyinqantsikmannawrni irnarnanpis kriyirnin kashwan llapantsik runakuna. Ni pipis mantsakutsuntsu ni imapitapis faltapukuq kanmantsu. Mana runakuna wanayananpaq shariyta allaapa mana alli awturidakunapaq kuntran, kay paapil willamañtsik y difyindimantsik. Y tsaynaw manana kananpaq willakun llapan runakunata dirichunkunata y liyninkunata y tsaynaw shurnaq takunantsikpaq.

Kada bis mas shumaq pasakuychaw llapan nasyunkuna huknin hukninwanpis kayananmi, nir willakun.

Nasyunis Unidas qurikayanqanchaw nasyunkunawan kunstitusyunchaw akwirduta yapay rurayarqan kaynaw runakunapa dirichunkuna kananpaq. Llapan imananaw kaq runapapis dirichunkuna kanman. Kada runaqa runanawmi rispitaadu kanman. Y runa karninmi baluryuq. Ullqupis warmipis dirichunkunachawqa iwalmi kayanman. Kada nasyunchaw adilantu kananpaqmi y kada runa mas shumaq libri kawarnin pasakunanpaqmi Nasyunis Unidas yanapamantsik.

Nasyunis Unidas qurikayanqan kaq nasyunkunam kumprumi tikuyashqa tsay urganisasyunwan kaynaw rurananpaq. Kada nasyunchawmi llapan runakunata yachatsikuyan runakunapa dirichunkunata rispi tarnin kayananpaq.

Tsay kumprumitikuyanqanta kumpliyananpaqmi kada nasyunchaw kay dirichukunata runakuna iwal kayananpaqmi willakun. Y tsaynaw kaptinmi la asimbliya giniralchaw kanan pruklamayamun Dirichus Humanusta. Kay diklarasyunchawmi llapan munduchaw imanaw kaq runakunapapis dirichunkuna kan. Y maytsay markachawpis llapan runakuna kawayananpaq kay dirichukuna kaykanqanmannaw. Ni pi runapis ni gubyirnupis kay dirichukunata yarparnin imanawpapis runakunata yachatsikuyanman kumpliyananpaq. Y may nasyunchawpis llapan runakuna kay dirichukunata musyayananpaqmi kikin nasyunninchaw y hinantin nasyunkunachawpis tukuylayapa willakuyanman. Y Nasyunis Unidaschaw kaq nasyunkunapis y tsay nasyunkunapa pudirnin kaq nasyunkunachawpis tsaynaw rurayanman.

Artikulu Huk (1)

Mayqan runapis manam pipa isklabun kananpaqtsu yurishqa. Y runa karninmi llapan runakuna iwal kayanman dirichunkunachawpis. Y yarpayta yacharninmi y allita mana allita shunqunkunachaw makurninmi runakuna huknin hukninta rispitanakur kayanman.

Artikulu Ishkay (2)

Kay diklarasyun chaw dirichukunaqa llapan runakunapaqmi kanqa imanaw kaq rasa runakunapaqpis, imanaw kaq kulur runakunapis, warmikunapaqpis, ullqukunapaqpis, imanaw kaq idyumata parlaq runakunapaqpis, ima riligyunyuq kaq runakunapaqpis, ima pulitikaman kriyiq runakunapaqpis, imaman kriyikuq runakunapaqpis, may markayuq runakunapaqpis, waktsa runakunapaqpis, y kapuqyuq runakunapaqpis, y imanaw kaq yurishqa runakunapaqpis.

Llapan runakunapa dirichunkunapis iwalmi kanman awnki nasyunninkunapa gubyirnun kaykaptinpis; u huk nasyunpa pudirninchaw markankuna kaykaptinpis, u imanaw huk nasyunpa mandadunchaw markankuna kaykaptinpis.

Artikulu Kimsa (3)

Kada runapa dirichunmi kan kawananpaq, y libri purikunanpaq, y mana pipis paykunata ultrahananpaq.

Artikulu Chusku (4)

Manam mayqan runapis pipa isklaabun sirwiqnin kanmantsu. Manam mayqan runatapis isklaabun kananpaq ni imanawpa rantishqan kanmantsu.

Artikulu Pitsqa (5)

Manam ni mayqan runata imayka watatanaw maqashwantsu mana kunsiyinsiyannaq maqarnin rurayanmantsu pitapis.

Artikulu Suqta (6)

Llapan runakunapa dirichunkunam kan may markachawpis liykuna kanqanmannaw hustisyankuna kananpaq.

Artikulu Qanchis (7)

Hustisyankunachawmi llapan runakuna iwal kayanman. Mayqan runa kaptinpis iwalmi liykuna payta tsapanman. Y si huk awturida ninqa mayqan runatapis kaynaw ninqa: - Qampaqqa manam dirichuyki kantsu hustisyachaw. U kaynaw ninqa: - Kay runapaqqa manam hustisya kanqatsu - nishpa. Tsaynaw niptinpis llapan runakunapaqmi iwal dirichunkuna. Y tsaynaw nirninqa kay diklarasyunchaw ninqanta manam kasukuyantsu.

Artikulu Pusaq (8)

May nasyunchawpis kunstitusyun kaq liykunata u mayqan liykunatapis mana kasurnin huk runa abusakunqa runa mahinta. Tsay abusuta chaskiq runaqa dimandakunmanmi alli kaq awturidaman y tsay awturidaqa rispitatsinan dimandakuq runapa dirichunta.

Artikulu Isqun (9)

Manam ni pi awturidakuna munayninta rurarninqa huk runapa mana rasunpa kulpan kaykaptinpis tsay runata ni pwistuman ni karsilman qaykutsiyanmantsu ni nasyunninpita qarquyanmantsu.

Artikulu Chunka (10)

Llapan runakunapa dirichunkunam kanman dimandadu kayanqanta alli kaq fwischaw llapanpa puntanchaw allitsinanpaq. Y rasunpa huk runa kulpayuq kaptinqa mana alli ruranqanpita liykuna kanqanman kastigun kanman.

Artikulu Chunka Huk (11)

Dimandadu karninqa huk runa inusintillaraq asta hutsanta fwis tarinqanyaq. Y llapan puntanchaw hustisyata fwis ruranqanchawmi tsay runapa dirichun kanman huk musyaq runa payta difindirnin parlakapunanpaq.

Huk runa imatapis ruranqa; y tsaynaw ruranqanta manana rurananpaqqa huk mushuq liy kikinpa nasyunninchaw u llapan patsachaw karninqa. Tsay runaqa ruranqanpita manam hutsasapayuqtsu kanman. Mana allita ruranqanpita ichiklla kastiguchawmi huk runa kanman; tsaynaw ruranqanpita mas atska kastigu kananpaq huk mushuq liy karninqa tsay atska kaq kastigutaqa manam tsay runa chaskinmantsu.

Artikulu Chunka Ishkay (12)

Mana imapis kaykaptinqa runa mahinpa kaway bidanman, ni ayllunman, ni mayqan runa manam hatikanmantsu, ni wahinman abusakurnin yaykunmantsu, ni kartanta pakayllapa liyikunmantsu. Y ullqurkurninqa runakunapa hananchaw runapa washan manam rimanmantsu. Tsaynaw abusupita runakuna tsapashqa kananpaqmi liykuna kanman.

Artikulu Chunka Kimsa (13)

May nasyunchaw kaykarninmi mayqan runapapis dirichun kan maykunachawpis purikuyananpaq, y munanqan markakunachaw takuyananpaq.

May nasyunpita u kikinpa nasyunninpita yarqusha karninpis mayqan runapapis dirichunmi kan nasyunninman kutikunanpaq.

Artikulu Chunka Chusku (14)

Kikinpa nasyuninchaw qisatash y maqasha chikiqninkunapaq kaptinqa mayqan runapapis dirichunmi kanman huk nasyunman patsakunanpaq mana pipis chikishqa takunanpaq.

Nasyunis Unidas diklarasyunchaw ninqankunata u nasyunninpa liyninkunata mana kasukuq runapa dirichunkuna manam kanmantsu huk nasyunman qishpir aywakunanpaq.

Artikulu Chunka Pitsqa (15)

Llapan runakunapapis dirichun kanmi nasyunpa syudadanun kananpaq.

Mana imapis kaykaptinqa ni pipis huk runata syudadanu kaykaptin: - Manam kay nasyunpa syudadanuntsu kanki - nintsikmantsu. Y manam michaayanmantsu huk nasyunpa syudadanun huk runa kananta.

Artikulu Chunka Suqta (16)

Imalaya runakunapis, mayqan nasyunpis, ima riligyunin kaptinpis, ulíqupis, warmipis, llapan runakuna kasakuy idaman chariyaptinqa dirichunkunam kan kasarakurnin ayllunkuna kayapunanpaq. Warmipaqpis ullqupaqpis iwalmi dirichunkuna kan kasarakuyananpaq. Y kasarasha kaykar rakikaskiyaptinpis dirichunkunaqa kaykan siyimpri.

Ishkankuna warmi ullqu munanakurninmi kasarakuyanman. Manan ni pipis mandanmantsu mana munanqanwan kasarananpaqqa.

Mayqan qurikashqa grupupitapis mas impurtantim warmi ullqu wamrankunawan allyu kayan. Tsaynaw kanapaqmi Dyus Yaya dispunishqa. Y tsaynaw mas impurtanti kaptinmi kada nasyunchaw allyupa favurnin liykunata kriyanman gubyirnukuna, y llapan runakuna rispitayanman.

Artikulu Chunka Qanchis (17)

Mayqan runapapis dirichunmi kan imachawpis prupyataryu kananpaq, hapallan u huk susiyu runakunawan.

Mana imapis kaptinqa ni pi runapis prupyidaninpita runa mahinta amalas qarqunmantsu.

Artikulu Chunka Pusaq (18)

Mayqan runapapis dirichunmi kanman imanawpis yarpakunananpaq, kunsiyinsiyan kanqanmannaw rurananpaq y ima riligyunman kriyinanpaq. Y tsay dirichum pirmitinman riligyun kaykanqanpita huk riligyunman y mayqan kriyinsyanchaw kaykanqanpita huk kriyinsyaman kambiyananpaq, y ima riligyunchaw ima kriyinsyachaw kaykanqanta hapallanpis, wakin runakunawanpis, kallichawpis, u wahi rurinchawpis yachatsikurnin, imanawpapis rurarnin, imanawpa adurarnin, y riligyunpa liyninkunata qatirnin kananpaq.

Artikulu Chunka Isqun (19)

Mayqan runapapis dirichunmi kanman yarpanqannaw parlananpaq. Y manam ni pipis tsay yarpanqanta piñapanmantsu. Y ima kriyinsya imanaw kanqanta musyayta munarninmi mayqan runapis istudiyayta pwidinman, y mayqan kriyinsyapaq willakuykunata chaskiyta pwidinman, y kikinpa kriyinsiyantapis yachatsikuyta pwidinman radyupapis piryudikupapis y tukuylaya muduspapis kikinpa nacyunninchawpis y huklaa nasyunkunachawpis.

Artikulu Ishkay Chunka (20)

Mayqan runakunapapis dirichunmi kanman imapaqpis qurikayananpaq y ima huntakayanqanchaw susiyu kayananpaq. Y tsay qurikayanqanqa kanman manam pipa kuntran sharkuyananpaqtsu.

Manam ni pipis ubligadutsu kanman qurikayanqanchaw susiyu kananpaq.

Artikulu Ishkay Chunka Huk (21)

Mayqan runakunapapis dirichunmi kanman diputadu karninpis nasyunninkunapa gubyirnunchaw awturida kayananpaq. Kikinkunalla u paykuna akrayashqan riprisintanti runakuna yaykuyanman.

Iwalmi llapan runakunapa dirichun kanman ima ubra publikutapis gubyirnu ruranqanta rurayananpaq.

Mayqan nasyunchawpis runakunapa munayninchaw kaykarninmi gubyirnu pudiryuq kananpaq. Y kada bis rasunpa kaq ilisksyun kaptinmi runakuna munayanqanta niyanman gubyirnu rurananpaq. Y iliksyunchawqa llapan runakunam butayanman warmipis, uliqupis, y imanaw kaq runakunapis. Y manam ni pipis musyanmantsu mayqanpaq butun kanqanta.

Artikulu Ishkay Chunka Ishkay (22)

Llapan runakuna kay patsachaw kawarnin kayaptinmi dirichun kanman siguuru susyalninkuna kananpaq. Y tsaynaw kananpaqmi mas kapuqyuq nacyunkuna yanapayaptin kada nasyun gubyirnu kapuqyuq kanqanmannaw ruranman. Y tsaynaw gubyirnu ruraptinmi llapan rurakuna kada bis mas shumaq pasakuycbaw, saluryuq kawayanan, y pwidiyanqanman ima prufisyunyuqpis kayanman.

Artikulu Ishkay Chunka Kimsa (23)

Llapan runakunapa dirichunmi kanman aruyyuq kayananpaq. Y munayanqan aruyta akrayanman. Y aruyanqanchaw mana rurayta pwidinqantaqa ni swiildunta uqrananpaqqa manamruranmantsu. Y kada nasyunchawmi liykuna kanman runakuna mana aruynaq kayananpaq.

Iwal aruychaw kayaptinqa iwalmi hurnalninkuna kanman mayqan runakunapapis.

Mayqan aruq runapapis dirichunmi kanman sigun imachawpis arun kanqanmannaw paqun kananpaq. Y tsay pagunmi paqtanan kikin, warmin, y tsurinkuna alli pasakuychaw kawayananpaq. Y tsay gananqan mana paqtaptinqa nasyunninpa gubyirnunmi imawanpis ayudanman tsay runata.

Y mayqan aruq runakunapapis dirichunmi kanman sindikatu di aruyta furmayananpaq, u sindikatu kaptin tsayman qurikayananpaq. Y tsay sindikatuqa imapis. kaptin aruchaw runakunata difyindinanpaq.

Artikulu Ishkay Chunka Chusku (24)

Mayqan runapapis dirichuyuqmi kanan aruy uurata kumplirskirqa shuntakunanpaq. Y tsay aruy uuraqa huk hunaq kumplitullam kanman. Y bakasyunninpis sigun tyimpu arunqanmanmi pagaadu kanman.

Artikulu Ishkay Chunka Pitsqa (25)

Mayqan runapapis hurnalninmi paqtan kanman alli pasakuychaw kikin, warmin, y tsurinkuna kawayananpaq. Y hurnal gananqanmi paqtanman mikuyninkunapaqpis, llatapankunapaqpis, wahinpaqpis, y qishyarnin hampitsikuyananpaqwan y sirbisiyuy publikuta pagananpaqwan. Y arun mana kaptinqa u qishyaptinpis, u inbaalidu tikraskiptinqa, u byuda kaptinqa, u awkisyaptinqa, u imanawpapis mana aruyta pwidiptinqa mayqan runapapis dirichunmí kanman siguuru susyalnin mantininanpaq.

Wawayuq byuda warmikunapaq y waktsa wamrakunapaq nasyunninchaw gubyirnupa liyninkuna kanman wanayanqanmannaw yanapananpaq. Lihitimu wamra kaptin u mana lihitimu wamra kaptinpis llapan wamrakunapapis dirichunkuna iwalmi kanman.

Artikulu Ishkay Chunka Suqta (26)

Mayqan runakunapapis dirichunmi kanman istudyayananpaq. Y istudyuqa dimbaldillam kanman asta primaryata ushyanqanyaq. Y llapan wamrakuna primaryata istudyayananpaqqa ubligaturyum kanan. Sinuuqa multadum kanman. Ima prufisyunpaq istudyayananpaqqa llapan runakunapapis iwalmi dirichun kanman. Y sigundaryachaw u unibirsidachaw istudyuqa mayqan runapaqpis sigun yachaynin kanqanmannawmj kanman.

Y istudyukunaqa kanman runakuna kada bis mas imatapis yachakurnin rurarnin kayananpaq, y runa mahinpa dirichunkunata kada bis mas rispitarnin kayananpaq. Y tsaynaw yachakushqa karninmi mayqan nasyun runakunapa, mayqan rasa runakunapa, mayqan riligyunyuq runakunapa kustumbrinkunata kumprindirnin mana chikinakushpa kuyanakur llapan runakuna pasakuyanman. Y tsaynaw shumaq pasakuychaw kaykarninqa Nasyunis Unidaswan kada nasyunmi yanapanakuyanman llapan munduchaw nasyunkuna huknin hukninwan mana chikinakur trankilu kayananpaq.

Papaninkunapa dirichunmí kanman tsurinkunapa istudiyunkunata akrananpaq.

Artikulu Ishkay Chunka Qanchis (27)

Mayqan runapapis dirichunmi kanman viladachaw ima tushukuna, musikukuna kaptin tsaychaw kayananpaq. Y syintifikukuna imatapis rurayanqakunatam mayqan runakunapis aprubichayanman.

Mayqan runapis diskuta, libruta, imatapis invintakurnin ruraptinqa liykunam kanan tsay ruranqanpita pursintahi pagayananpaq, y rasunpa pay rurashqa kanqanta llapan runakuna musyarnin rispitayananpaq.

Artikulu Ishkay Chunka Pusaq (28)

Llapan mundu nasyunkunachawmi kay diklarasyunchaw dirichukuna patsakashqa kanqa llapan runakunapapis kay diklarasyunchaw dirichunkuna ninqannaw kawayananpaq.

Artikulu Ishkay Chunka Isqun (29)

Runa mahinkunapa dirichunkunata rispitananpaqqa mayqan runapapis dibirnin kan. Y tsay dibirninkunata kumplirninmi rasunpa alli runa kayta yachakushqa kanman.

Kay diklarasyunchaw dirichukuna ninqannaw kawaykarninmj llapan runakuna ubidisikuyanan nasyunninchaw liykuna kanqanta. Y wakin runakunapa dirichunkunata rispitananpaqmi, shumaq pasakur runakuna kawayananpaqmi, urdin publikuta wardananpaqmi, y allaapa mana allita runakuna mana rurayananpaqmi tsay liykunata gubyirnu rurashqa.

Kay diklarasyunchaw Nasyunis Unidas nishqa dirichukunapa kuntraqa huklaayapa ni pi runapis manam rurayanmantsu.

Artikulu Kimsa Chunka (30)

Kay diklarasyunchawqa manam ni imapis kantsu mayqan nasyunpis mayqan grupu runakunapis ni mayqan runapis runa mahinkunapa dirichunkunata mana micharnin kayananpaq.


text:
set -o nounset
set -o errexit

cd "$(dirname "$0")"

cp $BIN_DIR/robots-pioneer-kit.dll                                    $PWD/../data/
cp $BIN_DIR/plugins/editors/pioneerMetamodel.dll                      $PWD/../data/plugins/editors/
cp $BIN_DIR/plugins/tools/kitPlugins/robots-pioneer-interpreter.dll   $PWD/../data/plugins/tools/kitPlugins/
cp $BIN_DIR/plugins/tools/kitPlugins/robots-pioneer-lua-generator.dll $PWD/../data/plugins/tools/kitPlugins/

cp $BIN_DIR/pioneerStartStop.bat	$PWD/../data/
cp $BIN_DIR/pioneerUpload.bat		$PWD/../data/
cp $BIN_DIR/controller.exe		$PWD/../data/

mkdir -p $PWD/../data/luac/real

cp $BIN_DIR/luac/real/luac.exe $PWD/../data/luac/real/


text:
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Microsoft.Research.Tools
{
    /// <summary>
    /// A data grid that filters the contents.
    /// </summary>
    public partial class FilteredDataGridView : UserControl
    {
        IDGVData data;
        /// <summary>
        /// If true apply the complement of the current filter.
        /// </summary>
        bool complementFilter;

        /// <summary>
        /// Create a filtered data
        /// </summary>
        public FilteredDataGridView()
        {
            this.complementFilter = false;
            this.InitializeComponent();
            ToolTip tip = new ToolTip();
            tip.SetToolTip(this.button_drop, "Remove the rows matching the filter string");
            tip.SetToolTip(this.button_filter, "Keep the rows matching the filter string");
            tip.SetToolTip(this.button_X, "Remove all applied filters");
            tip.SetToolTip(this.textBox_filter, "String to perform filtering on");
        }

        /// <summary>
        /// Bind to the data source.
        /// </summary>
        /// <param name="dataSource">Value to set data to.</param>
        public void SetDataSource(IDGVData dataSource)
        {
            this.data = dataSource;
            this.dataGridView.DataSource = dataSource.VisibleItems;
            this.ApplyFilter(this.complementFilter, false);
            this.data.ItemsChanged += this.ItemsChanged;
            this.data.ItemAppended += this.ItemAdded;
        }

        /// <summary>
        /// Delegate called by DGV then a new item is added.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Unused.</param>
        public void ItemAdded(object sender, EventArgs e)
        {
            this.ApplyFilter(this.complementFilter, true);
        }

        /// <summary>
        /// Delegate called by DGV when the items change.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Unused.</param>
        public void ItemsChanged(object sender, EventArgs e)
        {
            this.ApplyFilter(this.complementFilter, false);
        }

        /// <summary>
        /// Handle to the datagridview in the form.
        /// </summary>
        public DataGridView DataGridView { get { return this.dataGridView; } }

        /// <summary>
        /// Used clicked the button to filter the data displayed.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Unused.</param>
        private void button_filter_Click(object sender, EventArgs e)
        {
            this.complementFilter = false;
            this.ApplyFilter(false, false);
        }

        /// <summary>
        /// Used clicked button to remove filter.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Unused.</param>
        private void button_X_Click(object sender, EventArgs e)
        {
            this.textBox_filter.Text = "";
            this.complementFilter = false;
            this.data.RemoveFilter();
            if (this.ViewChanged != null)
                this.ViewChanged(this, EventArgs.Empty);
        }

        /// <summary>
        /// Apply the current filter.
        /// <param name="complement">If true, complement the selection.</param>
        /// <param name="lastOnly">Only filter the last value.</param>
        /// </summary>
        public void ApplyFilter(bool complement, bool lastOnly)
        {
            int firstIndex = lastOnly ? this.DataGridView.Rows.Count - 1 : 0;
            int lastIndex = this.DataGridView.Rows.Count;
            this.data.Filter(this.textBox_filter.Text, this.DataGridView, firstIndex, lastIndex, complement);
            if (this.ViewChanged != null)
                this.ViewChanged(this, EventArgs.Empty);
        }

        /// <summary>
        /// User pressed a key in the filter textbox.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Key description.</param>
        private void textBox_filter_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                this.ApplyFilter(false, false);
        }

        /// <summary>
        /// Invoked when a cell needs to be formatted.
        /// </summary>
        public event DataGridViewCellFormattingEventHandler CellFormatting;
        /// <summary>
        /// Invoked when a cell has been double-clicked.
        /// </summary>
        public event DataGridViewCellMouseEventHandler CellMouseDoubleClick;
        /// <summary>
        /// Invoked when the view has been changed.
        /// </summary>
        public event EventHandler ViewChanged;

        private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (this.CellFormatting != null)
                this.CellFormatting(sender, e);
        }

        private void dataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (this.CellMouseDoubleClick != null)
                this.CellMouseDoubleClick(sender, e);
        }

        /// <summary>
        /// Right mouse button clicked in a row of the datagrid.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Event describing the mouse click.</param>
        private void dataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && e.ColumnIndex >= 0 && e.RowIndex >= 0)
            {
                if (this.DataGridView.Rows[e.RowIndex].Selected == false)
                {
                    this.DataGridView.ClearSelection();
                    this.DataGridView.Rows[e.RowIndex].Selected = true;
                }
                this.DataGridView.CurrentCell = this.DataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex];
            }
        }

        /// <summary>
        /// Redo the last sort; return true if there was a last sort.
        /// </summary>
        /// <returns>False if the data was never sorted.</returns>
        public bool RedoSort()
        {
            bool sorted = this.data.RedoSort();
            if (this.ViewChanged != null)
                this.ViewChanged(this, EventArgs.Empty);
            return sorted;
        }

        /// <summary>
        /// Drop the text from the grid.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Unused.</param>
        private void button_drop_Click(object sender, EventArgs e)
        {
            this.complementFilter = true;
            this.ApplyFilter(true, false);
        }
    }

    /// <summary>
    /// Untyped interface for data bound to a filtered data grid view.
    /// </summary>
    public interface IDGVData
    {
        /// <summary>
        /// Items to display; should be a BindingList.
        /// </summary>
        object VisibleItems { get; }
        /// <summary>
        /// Perform filtering with this text.
        /// </summary>
        /// <param name="text">Text to find.</param>
        /// <param name="grid">Data grid where text is sought.</param>
        /// <returns>Number of matches.</returns>
        /// <param name="complement">If true then complement the selection.</param>
        /// <param name="endIndex">Last index to filter.</param>
        /// <param name="startIndex">First index to filter.</param>
        int Filter(string text, DataGridView grid, int startIndex, int endIndex, bool complement);
        /// <summary>
        /// Remove any filter applied.
        /// </summary>
        /// <returns>The number of items.</returns>
        int RemoveFilter();
        /// <summary>
        /// Event raised when the list changes.
        /// </summary>
        event EventHandler ItemsChanged;
        /// <summary>
        /// An item has been added.
        /// </summary>
        event EventHandler ItemAppended;
        /// <summary>
        /// Redo the sort as done the last time.
        /// Return true if there was a previous sort.
        /// </summary>
        bool RedoSort();
    }

    /// <summary>
    /// Data for a filtered data grid view; can't have a type parameter in a form, so we segregate it here.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class DGVData<T> : IDGVData
    {
        /// <summary>
        /// Data items which are filtered.
        /// </summary>
        List<T> dataItems;
        /// <summary>
        /// Items displayed.
        /// </summary>
        BindingListSortable<T> visibleItems;

        /// <summary>
        /// If true filtering is case sensitive.
        /// </summary>
        public bool CaseSensitive { get; set; }

        /// <summary>
        /// Number of visible items.
        /// </summary>
        public int VisibleItemCount { get { return this.visibleItems.Count; } }

        /// <summary>
        /// Items that are visible: a binding list sortable.
        /// </summary>
        public object VisibleItems { get { return this.visibleItems;  } }

        /// <summary>
        /// Clear the contents.
        /// </summary>
        public void Clear()
        {
            this.visibleItems.Clear();
            this.dataItems.Clear();
        }

        /// <summary>
        /// Delegate called when the items change.
        /// </summary>
        public event EventHandler ItemsChanged;
        /// <summary>
        /// Delegate called when an item is added.
        /// </summary>
        public event EventHandler ItemAppended;

        /// <summary>
        /// Raise the changed event if required.
        /// </summary>
        private void OnChanged()
        {
            if (this.ItemsChanged != null)
                this.ItemsChanged(this, EventArgs.Empty);
        }

        /// <summary>
        /// Raise the changed event if required.
        /// </summary>
        private void OnItemAppended()
        {
            if (this.ItemAppended != null)
                this.ItemAppended(this, EventArgs.Empty);
        }

        /// <summary>
        /// Create an empty DGVData object.
        /// </summary>
        public DGVData()
        {
            this.visibleItems = new BindingListSortable<T>();
            this.dataItems = new List<T>();
            this.OnChanged();
        }

        /// <summary>
        /// Redo the last sorting operation.
        /// </summary>
        public bool RedoSort()
        {
            return this.visibleItems.RedoSort();
        }

        /// <summary>
        /// Set the items to display.
        /// </summary>
        /// <param name="items">Collection of items to display.</param>
        public void SetItems(IEnumerable<T> items)
        {
            this.Clear();
            this.dataItems.AddRange(items);
            this.RemoveFilter();
            this.OnChanged();
        }

        /// <summary>
        /// True if the text is found in any cell of the row.
        /// </summary>
        /// <param name="tofind">Text to search.</param>
        /// <param name="row">A datagridview row with arbitrary contents.</param>
        /// <returns>True if any cell contains the text.</returns>
        /// <param name="caseSensitive">If true, do a case-sensitive match.</param>
        private static bool DataGridViewRowMatches(string tofind, DataGridViewRow row, bool caseSensitive)
        {
            for (int i = 0; i < row.Cells.Count; i++)
            {
                var cell = row.Cells[i];
                if (!cell.Visible) continue;
                object inside = cell.FormattedValue;
                string text = inside as string;
                if (text == null)
                    continue;
                if (!caseSensitive)
                    text = text.ToLower();
                if (text.Contains(tofind))
                    return true;
            }
            return false;
        }

        /// <summary>
        /// Return the list of all indices of rows matching a specified string.
        /// </summary>
        /// <param name="tofind">String to find in a datagridview.</param>
        /// <param name="grid">Datagrid view to search.</param>
        /// <returns>A list with all matching row indices.</returns>
        /// <param name="caseSensitive">If true do a case-sensitive match.</param>
        /// <param name="exclusive">If true, return the complement of the set.</param>
        public static List<int> DataGridViewRowIndicesMatching(string tofind, DataGridView grid, bool caseSensitive, bool exclusive, int startIndex, int endIndex)
        {
            if (!caseSensitive)
                tofind = tofind.ToLower();

            List<int> retval = new List<int>();
            for (int i = Math.Max(0, startIndex); i < Math.Min(grid.Rows.Count, endIndex); i++)
            {
                var row = grid.Rows[i];
                bool matches = DataGridViewRowMatches(tofind, row, caseSensitive);
                if (matches ^ exclusive)
                    retval.Add(i);
            }
            return retval;
        }

        /// <summary>
        /// Return the list of all indices of rows matching a specified string.
        /// </summary>
        /// <param name="tofind">String to find in a datagridview.</param>
        /// <param name="grid">Datagrid view to search.</param>
        /// <returns>A list with all matching row indices.</returns>
        /// <param name="caseSensitive">If true do a case-sensitive match.</param>
        /// <param name="exclusive">If true, return the complement of the set.</param>
        public static List<int> DataGridViewRowIndicesMatching(string tofind, DataGridView grid, bool caseSensitive, bool exclusive)
        {
            return DataGridViewRowIndicesMatching(tofind, grid, caseSensitive, exclusive, 0, grid.Rows.Count);
        }

        /// <summary>
        /// Stop filtering jobs; return number of jobs.
        /// </summary>
        public int RemoveFilter()
        {
            if (this.dataItems == null)
                return 0;
            this.visibleItems.RaiseListChangedEvents = false;
            this.visibleItems.Clear();
            foreach (var ji in this.dataItems)
                this.visibleItems.Add(ji);
            this.visibleItems.RaiseListChangedEvents = true;
            this.visibleItems.RedoSort();
            this.visibleItems.ResetBindings();
            return this.dataItems.Count;
        }

        /// <summary>
        /// Apply the filter.  Return the number of matches.  If the filter is empty do not do anything.
        /// <param name="datagrid">Data grid to filter.</param>
        /// <param name="filter">Text to fine.</param>
        /// <param name="complement">If true complement the selection.</param>
        /// <param name="startIndex">First index to filter.</param>
        /// <param name="endIndex">Last index to filter.</param>
        /// </summary>
        public int Filter(string filter, DataGridView datagrid, int startIndex, int endIndex, bool complement)
        {
            int matches = datagrid.Rows.Count;
            if (filter == "")
                this.RemoveFilter();

            List<int> toRemove = DataGridViewRowIndicesMatching(filter, datagrid, this.CaseSensitive, !complement, startIndex, endIndex);
            matches -= toRemove.Count;
            this.visibleItems.RaiseListChangedEvents = false;
            toRemove.Sort();
            toRemove.Reverse(); // do it backwards to keep indices unchanged
            foreach (int index in toRemove)
            {
                this.visibleItems.RemoveAt(index);
            }
            this.visibleItems.RaiseListChangedEvents = true;
            this.visibleItems.ResetBindings();
            return matches;
        }

        /// <summary>
        /// Add a new item to the data grid view.
        /// </summary>
        /// <param name="item">Item to add.</param>
        public void AddItem(T item)
        {
            this.dataItems.Add(item);
            this.OnItemAppended();
        }
    }
}


text:
module Graphiti
  class Resource
    module Persistence
      extend ActiveSupport::Concern

      class_methods do
        def before_attributes(method = nil, only: [:create, :update], &blk)
          add_callback(:attributes, :before, method, only, &blk)
        end

        def after_attributes(method = nil, only: [:create, :update], &blk)
          add_callback(:attributes, :after, method, only, &blk)
        end

        def before_save(method = nil, only: [:create, :update], &blk)
          add_callback(:save, :before, method, only, &blk)
        end

        def after_save(method = nil, only: [:create, :update], &blk)
          add_callback(:save, :after, method, only, &blk)
        end

        def before_destroy(method = nil, &blk)
          add_callback(:destroy, :before, method, [:destroy], &blk)
        end

        def after_destroy(method = nil, &blk)
          add_callback(:destroy, :after, method, [:destroy], &blk)
        end

        def around_attributes(method = nil, only: [:create, :update], &blk)
          if blk
            raise Errors::AroundCallbackProc.new(self, "around_attributes")
          else
            add_callback(:attributes, :around, method, only, &blk)
          end
        end

        def around_save(method = nil, only: [:create, :update], &blk)
          if blk
            raise Errors::AroundCallbackProc.new(self, "around_save")
          else
            add_callback(:save, :around, method, only, &blk)
          end
        end

        def around_persistence(method = nil, only: [:create, :update], &blk)
          if blk
            raise Errors::AroundCallbackProc.new(self, "around_persistence")
          else
            add_callback(:persistence, :around, method, only, &blk)
          end
        end

        def around_destroy(method = nil, &blk)
          if blk
            raise Errors::AroundCallbackProc.new(self, "around_destroy")
          else
            add_callback(:destroy, :around, method, [:destroy], &blk)
          end
        end

        private

        def add_callback(kind, lifecycle, method, only, &blk)
          config[:callbacks][kind] ||= {}
          config[:callbacks][kind][lifecycle] ||= []
          config[:callbacks][kind][lifecycle] << {callback: (method || blk), only: Array(only)}
        end
      end

      def create(create_params, meta = nil)
        model_instance = nil

        run_callbacks :persistence, :create, create_params, meta do
          run_callbacks :attributes, :create, create_params, meta do |params|
            model_instance = call_with_meta(:build, model, meta)
            call_with_meta(:assign_attributes, model_instance, params, meta)
            model_instance
          end

          run_callbacks :save, :create, model_instance, meta do
            model_instance = call_with_meta(:save, model_instance, meta)
          end

          model_instance
        end
      end

      def update(update_params, meta = nil)
        model_instance = nil
        id = update_params[:id]
        update_params = update_params.except(:id)

        run_callbacks :persistence, :update, update_params, meta do
          run_callbacks :attributes, :update, update_params, meta do |params|
            model_instance = self.class._find(id: id).data
            call_with_meta(:assign_attributes, model_instance, params, meta)
            model_instance
          end

          run_callbacks :save, :update, model_instance, meta do
            model_instance = call_with_meta(:save, model_instance, meta)
          end
        end

        model_instance
      end

      def destroy(id, meta = nil)
        model_instance = self.class._find(id: id).data
        run_callbacks :destroy, :destroy, model_instance, meta do
          call_with_meta(:delete, model_instance, meta)
        end
        model_instance
      end

      def build(model, meta = nil)
        adapter.build(model)
      end

      def assign_attributes(model_instance, update_params, meta = nil)
        adapter.assign_attributes(model_instance, update_params)
      end

      def save(model_instance, meta = nil)
        adapter.save(model_instance)
      end

      def delete(model_instance, meta = nil)
        adapter.destroy(model_instance)
      end

      private

      def run_callbacks(kind, action, *args)
        fire_around_callbacks(kind, action, *args) do |*yieldargs|
          fire_callbacks(kind, :before, action, *yieldargs)
          result = yield(*yieldargs)
          fire_callbacks(kind, :after, action, result, args.last)
          result
        end
      end

      def fire_callbacks(kind, lifecycle, action, *args)
        if (callbacks = self.class.config[:callbacks][kind])
          callbacks = callbacks[lifecycle] || []
          callbacks.each do |config|
            callback = config[:callback]
            next unless config[:only].include?(action)
            call_with_meta(callback, *args)
          end
        end
      end

      # Convenience for calling a method or proc
      # while taking into account 'meta' is an optional argument
      def call_with_meta(callback, *args)
        if callback.respond_to?(:call)
          instance_exec(*args, &callback)
        else
          arity = method(callback).arity
          args = args[0..0] if arity == 1
          args = args[0..1] if arity == 2
          send(callback, *args)
        end
      end

      def fire_around_callbacks(kind, action, *args, &blk)
        callbacks = self.class.config[:callbacks][kind].try(:[], :around) || []
        callbacks = callbacks.select { |cb| cb[:only].include?(action) }
        if callbacks.length.zero?
          yield(*args)
        else
          prc = around_callback_proc(callbacks, 0, *args, &blk)
          instance_exec(*args, &prc)
        end
      end

      # The tricky thing here is we need to yield to the next around callback
      # until there are no more callbacks, then we want to call the original block
      # Also keep in mind each callback needs to yield to the next
      def around_callback_proc(callbacks, index, *args, &blk)
        method_name = callbacks[index][:callback]

        if callbacks[index + 1]
          proc do
            r = nil
            args = args[0..0] if method(method_name).arity == 1
            send(method_name, *args) do |r2|
              wrapped = around_callback_proc(callbacks, index + 1, r2, &blk)
              r = instance_exec(r2, &wrapped)
            end
            r
          end
        else
          proc do |*args2|
            r = nil
            args2 = args2[0..0] if method(callbacks[index][:callback]).arity == 1
            send(callbacks[index][:callback], *args2) do |r2|
              r = instance_exec(r2, &blk)
            end
            r
          end
        end
      end
    end
  end
end


text:
package org.nyjsl.library.ptr;

import android.support.v7.widget.RecyclerView;

import org.nyjsl.library.ptr.adapter.RecyclerArrayAdapter;

public class EasyDataObserver extends RecyclerView.AdapterDataObserver {
    private EasyRecyclerView recyclerView;
    private RecyclerArrayAdapter adapter;

    public EasyDataObserver(EasyRecyclerView recyclerView) {
        this.recyclerView = recyclerView;
        if (recyclerView.getAdapter() instanceof RecyclerArrayAdapter) {
            adapter = (RecyclerArrayAdapter) recyclerView.getAdapter();
        }
    }

    private boolean isHeaderFooter(int position) {
        return adapter != null && (position < adapter.getHeaderCount() || position >= adapter.getHeaderCount() + adapter.getCount());
    }

    @Override
    public void onItemRangeChanged(int positionStart, int itemCount) {
        super.onItemRangeChanged(positionStart, itemCount);
        if (!isHeaderFooter(positionStart)) {
            update();
        }
    }

    @Override
    public void onItemRangeInserted(int positionStart, int itemCount) {
        super.onItemRangeInserted(positionStart, itemCount);
        if (!isHeaderFooter(positionStart)) {
            update();
        }
    }

    @Override
    public void onItemRangeRemoved(int positionStart, int itemCount) {
        super.onItemRangeRemoved(positionStart, itemCount);
        if (!isHeaderFooter(positionStart)) {
            update();
        }
    }

    @Override
    public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) {
        super.onItemRangeMoved(fromPosition, toPosition, itemCount);
        update();//header&footer不会有移动操作
    }

    @Override
    public void onChanged() {
        super.onChanged();
        update();//header&footer不会引起changed
    }

    //自动更改Container的样式
    private void update() {
        int count;
        if (recyclerView.getAdapter() instanceof RecyclerArrayAdapter) {
            count = ((RecyclerArrayAdapter) recyclerView.getAdapter()).getCount();
        } else {
            count = recyclerView.getAdapter().getItemCount();
        }
        if (count == 0) {
            recyclerView.showEmpty();
        } else {
            recyclerView.showRecycler();
        }
    }
}


text:
/*
 * Created by IntelliJ IDEA.
 * User: max
 * Date: May 27, 2002
 * Time: 2:57:13 PM
 * To change template for new class use
 * Code Style | Class Templates options (Tools | IDE Options).
 */
package com.intellij.codeInspection.ex;

import com.intellij.ExtensionPoints;
import com.intellij.codeInspection.reference.*;
import com.intellij.codeInspection.util.SpecialAnnotationsUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.ExtensionPointListener;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.PluginDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.*;
import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.psi.PsiManager;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.util.*;

@State(
    name = "EntryPointsManager",
    storages = {@Storage(id = "default", file = "$PROJECT_FILE$")}
)
public class EntryPointsManagerImpl implements PersistentStateComponent<Element>, EntryPointsManager {
  @NonNls private static final String[] STANDARD_ANNOS = {
    "javax.ws.rs.*",
    "javax.annotation.Resource",
    "javax.xml.ws.WebServiceRef",
    "javax.persistence.PersistenceContext",
    "javax.persistence.PersistenceUnit",
    "javax.persistence.GeneratedValue"
  };

  // null means uninitialized
  private volatile List<String> ADDITIONAL_ANNOS;

  public Collection<String> getAdditionalAnnotations() {
    List<String> annos = ADDITIONAL_ANNOS;
    if (annos == null) {
      annos = new ArrayList<String>();
      Collections.addAll(annos, STANDARD_ANNOS);
      final EntryPoint[] extensions = Extensions.getExtensions(ExtensionPoints.DEAD_CODE_TOOL, null);
      for (EntryPoint extension : extensions) {
        final String[] ignoredAnnotations = extension.getIgnoreAnnotations();
        if (ignoredAnnotations != null) {
          ContainerUtil.addAll(annos, ignoredAnnotations);
        }
      }
      ADDITIONAL_ANNOS = annos = Collections.unmodifiableList(annos);
    }
    return annos;
  }
  public JDOMExternalizableStringList ADDITIONAL_ANNOTATIONS = new JDOMExternalizableStringList();
  private final Map<String, SmartRefElementPointer> myPersistentEntryPoints;
  private final Set<RefElement> myTemporaryEntryPoints;
  private static final String VERSION = "2.0";
  @NonNls private static final String VERSION_ATTR = "version";
  @NonNls private static final String ENTRY_POINT_ATTR = "entry_point";
  private boolean myAddNonJavaEntries = true;
  private boolean myResolved = false;
  private final Project myProject;
  private long myLastModificationCount = -1;

  public EntryPointsManagerImpl(Project project) {
    myProject = project;
    myTemporaryEntryPoints = new HashSet<RefElement>();
    myPersistentEntryPoints =
        new LinkedHashMap<String, SmartRefElementPointer>(); // To keep the order between readExternal to writeExternal
    Disposer.register(project, this);
    final ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ExtensionPoints.DEAD_CODE_TOOL);
    point.addExtensionPointListener(new ExtensionPointListener<EntryPoint>() {
      @Override
      public void extensionAdded(@NotNull EntryPoint extension, @Nullable PluginDescriptor pluginDescriptor) {
        extensionRemoved(extension, pluginDescriptor);
      }

      @Override
      public void extensionRemoved(@NotNull EntryPoint extension, @Nullable PluginDescriptor pluginDescriptor) {
        if (ADDITIONAL_ANNOS != null) {
          ADDITIONAL_ANNOS = null;
          UIUtil.invokeLaterIfNeeded(new Runnable() {
            @Override
            public void run() {
              if (ApplicationManager.getApplication().isDisposed()) return;
              InspectionProfileManager.getInstance().fireProfileChanged(null);
            }
          });
        }
      }
    }, this);
  }

  public static EntryPointsManagerImpl getInstance(Project project) {
    return ServiceManager.getService(project, EntryPointsManagerImpl.class);
  }

  @SuppressWarnings({"HardCodedStringLiteral"})
  public void loadState(Element element) {
    Element entryPointsElement = element.getChild("entry_points");
    if (entryPointsElement != null) {
      final String version = entryPointsElement.getAttributeValue(VERSION_ATTR);
      if (!Comparing.strEqual(version, VERSION)) {
        convert(entryPointsElement, myPersistentEntryPoints);
      }
      else {
        List content = entryPointsElement.getChildren();
        for (final Object aContent : content) {
          Element entryElement = (Element)aContent;
          if (ENTRY_POINT_ATTR.equals(entryElement.getName())) {
            SmartRefElementPointerImpl entryPoint = new SmartRefElementPointerImpl(entryElement);
            myPersistentEntryPoints.put(entryPoint.getFQName(), entryPoint);
          }
        }
      }
    }
    try {
      ADDITIONAL_ANNOTATIONS.readExternal(element);
    }
    catch (InvalidDataException ignored) {
    }
  }

  @SuppressWarnings({"HardCodedStringLiteral"})
  public Element getState()  {
    Element element = new Element("state");
    writeExternal(element, myPersistentEntryPoints, ADDITIONAL_ANNOTATIONS);
    return element;
  }

  @SuppressWarnings({"HardCodedStringLiteral"})
  public static void writeExternal(final Element element,
                            final Map<String, SmartRefElementPointer> persistentEntryPoints,
                            final JDOMExternalizableStringList additional_annotations) {
    Element entryPointsElement = new Element("entry_points");
    entryPointsElement.setAttribute(VERSION_ATTR, VERSION);
    for (SmartRefElementPointer entryPoint : persistentEntryPoints.values()) {
      assert entryPoint.isPersistent();
      entryPoint.writeExternal(entryPointsElement);
    }

    element.addContent(entryPointsElement);
    if (!additional_annotations.isEmpty()) {
      try {
        additional_annotations.writeExternal(element);
      }
      catch (WriteExternalException ignored) {
      }
    }
  }

  public void resolveEntryPoints(final RefManager manager) {
    if (!myResolved) {
      myResolved = true;
      validateEntryPoints();

      ApplicationManager.getApplication().runReadAction(new Runnable() {
        public void run() {
          for (SmartRefElementPointer entryPoint : myPersistentEntryPoints.values()) {
            if (entryPoint.resolve(manager)) {
              RefEntity refElement = entryPoint.getRefElement();
              ((RefElementImpl)refElement).setEntry(true);
              ((RefElementImpl)refElement).setPermanentEntry(entryPoint.isPersistent());
            }
          }
        }
      });
    }
  }

  private void purgeTemporaryEntryPoints() {
    for (RefElement entryPoint : myTemporaryEntryPoints) {
      ((RefElementImpl)entryPoint).setEntry(false);
    }

    myTemporaryEntryPoints.clear();
  }

  public void addEntryPoint(RefElement newEntryPoint, boolean isPersistent) {
    if (!newEntryPoint.isValid()) return;
    if (newEntryPoint instanceof RefClass) {
      RefClass refClass = (RefClass)newEntryPoint;

      if (refClass.isAnonymous()) {
        // Anonymous class cannot be an entry point.
        return;
      }

      ArrayList<RefMethod> refConstructors = refClass.getConstructors();
      if (refConstructors.size() == 1) {
        addEntryPoint(refConstructors.get(0), isPersistent);
        return;
      }
      else if (refConstructors.size() > 1) {
        // Many constructors here. Need to ask user which ones are used
        for (int i = 0; i < refConstructors.size(); i++) {
          addEntryPoint((RefMethod)((ArrayList)refConstructors).get(i), isPersistent);
        }

        return;
      }
    }

    if (isPersistent) {
      myTemporaryEntryPoints.add(newEntryPoint);
      ((RefElementImpl)newEntryPoint).setEntry(true);
    }
    else {
      if (myPersistentEntryPoints.get(newEntryPoint.getExternalName()) == null) {
        final SmartRefElementPointerImpl entry = new SmartRefElementPointerImpl(newEntryPoint, true);
        myPersistentEntryPoints.put(entry.getFQName(), entry);
        ((RefElementImpl)newEntryPoint).setEntry(true);
        ((RefElementImpl)newEntryPoint).setPermanentEntry(true);
        if (entry.isPersistent()) { //do save entry points
          final EntryPointsManagerImpl entryPointsManager = getInstance(newEntryPoint.getElement().getProject());
          if (this != entryPointsManager) {
            entryPointsManager.addEntryPoint(newEntryPoint, true);
          }
        }
      }
    }
  }

  public void removeEntryPoint(RefElement anEntryPoint) {
    if (anEntryPoint instanceof RefClass) {
      RefClass refClass = (RefClass)anEntryPoint;
      if (!refClass.isInterface()) {
        anEntryPoint = refClass.getDefaultConstructor();
      }
    }

    if (anEntryPoint == null) return;

    myTemporaryEntryPoints.remove(anEntryPoint);

    Set<Map.Entry<String, SmartRefElementPointer>> set = myPersistentEntryPoints.entrySet();
    String key = null;
    for (Map.Entry<String, SmartRefElementPointer> entry : set) {
      SmartRefElementPointer value = entry.getValue();
      if (value.getRefElement() == anEntryPoint) {
        key = entry.getKey();
        break;
      }
    }

    if (key != null) {
      myPersistentEntryPoints.remove(key);
      ((RefElementImpl)anEntryPoint).setEntry(false);
    }

    if (anEntryPoint.isPermanentEntry() && anEntryPoint.isValid()) {
      final Project project = anEntryPoint.getElement().getProject();
      final EntryPointsManagerImpl entryPointsManager = getInstance(project);
      if (this != entryPointsManager) {
        entryPointsManager.removeEntryPoint(anEntryPoint);
      }
    }
  }

  public RefElement[] getEntryPoints() {
    validateEntryPoints();
    List<RefElement> entries = new ArrayList<RefElement>();
    Collection<SmartRefElementPointer> collection = myPersistentEntryPoints.values();
    for (SmartRefElementPointer refElementPointer : collection) {
      final RefEntity elt = refElementPointer.getRefElement();
      if (elt instanceof RefElement) {
        entries.add((RefElement)elt);
      }
    }
    entries.addAll(myTemporaryEntryPoints);

    return entries.toArray(new RefElement[entries.size()]);
  }

  public void dispose() {
    cleanup();
  }

  private void validateEntryPoints() {
    long count = PsiManager.getInstance(myProject).getModificationTracker().getModificationCount();
    if (count != myLastModificationCount) {
      myLastModificationCount = count;
      Collection<SmartRefElementPointer> collection = myPersistentEntryPoints.values();
      SmartRefElementPointer[] entries = collection.toArray(new SmartRefElementPointer[collection.size()]);
      for (SmartRefElementPointer entry : entries) {
        RefElement refElement = (RefElement)entry.getRefElement();
        if (refElement != null && !refElement.isValid()) {
          myPersistentEntryPoints.remove(entry.getFQName());
        }
      }

      final Iterator<RefElement> it = myTemporaryEntryPoints.iterator();
      while (it.hasNext()) {
        RefElement refElement = it.next();
        if (!refElement.isValid()) {
          it.remove();
        }
      }
    }
  }

  public void cleanup() {
    purgeTemporaryEntryPoints();
    Collection<SmartRefElementPointer> entries = myPersistentEntryPoints.values();
    for (SmartRefElementPointer entry : entries) {
      entry.freeReference();
    }
  }

  public boolean isAddNonJavaEntries() {
    return myAddNonJavaEntries;
  }

  @Override
  public void configureAnnotations() {
    final JPanel listPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(ADDITIONAL_ANNOTATIONS, "Do not check if annotated by", true);
    new DialogWrapper(myProject) {
      {
        init();
        setTitle("Configure annotations");
      }

      @Override
      protected JComponent createCenterPanel() {
        return listPanel;
      }
    }.show();
  }

  public void addAllPersistentEntries(EntryPointsManagerImpl manager) {
    myPersistentEntryPoints.putAll(manager.myPersistentEntryPoints);
  }

  public static void convert(Element element, final Map<String, SmartRefElementPointer> persistentEntryPoints) {
    List content = element.getChildren();
    for (final Object aContent : content) {
      Element entryElement = (Element)aContent;
      if (ENTRY_POINT_ATTR.equals(entryElement.getName())) {
        String fqName = entryElement.getAttributeValue(SmartRefElementPointerImpl.FQNAME_ATTR);
        final String type = entryElement.getAttributeValue(SmartRefElementPointerImpl.TYPE_ATTR);
        if (Comparing.strEqual(type, RefJavaManager.METHOD)) {

          int spaceIdx = fqName.indexOf(' ');
          int lastDotIdx = fqName.lastIndexOf('.');

          int parenIndex = fqName.indexOf('(');

          while (lastDotIdx > parenIndex) lastDotIdx = fqName.lastIndexOf('.', lastDotIdx - 1);

          boolean notype = false;
          if (spaceIdx < 0 || spaceIdx + 1 > lastDotIdx || spaceIdx > parenIndex) {
            notype = true;
          }

          final String className = fqName.substring(notype ? 0 : spaceIdx + 1, lastDotIdx);
          final String methodSignature =
              notype ? fqName.substring(lastDotIdx + 1) : fqName.substring(0, spaceIdx) + ' ' + fqName.substring(lastDotIdx + 1);

          fqName = className + " " + methodSignature;
        }
        else if (Comparing.strEqual(type, RefJavaManager.FIELD)) {
          final int lastDotIdx = fqName.lastIndexOf('.');
          if (lastDotIdx > 0 && lastDotIdx < fqName.length() - 2) {
            String className = fqName.substring(0, lastDotIdx);
            String fieldName = fqName.substring(lastDotIdx + 1);
            fqName = className + " " + fieldName;
          }
          else {
            continue;
          }
        }
        SmartRefElementPointerImpl entryPoint = new SmartRefElementPointerImpl(type, fqName);
        persistentEntryPoints.put(entryPoint.getFQName(), entryPoint);
      }
    }
  }

  public void setAddNonJavaEntries(final boolean addNonJavaEntries) {
    myAddNonJavaEntries = addNonJavaEntries;
  }
}


text:
require 'spec_helper'

# Tests for the env script management based on parameters
describe 'aem::crx::package::file' do

  let(:facts) do
    {
      kernel: 'Linux'
    }
  end

  let(:title) do
    'aem'
  end

  let(:default_params) do
    {
      ensure: 'present',
      group: 'aem',
      home: '/opt/aem',
      source: '/path/to/file.zip',
      user: 'aem'
    }
  end

  let(:inst_dir) { '/opt/aem/crx-quickstart/install' }

  describe 'creates the file' do
    let(:params) { default_params }

    context 'mode' do
      it { is_expected.to contain_file("#{inst_dir}/file.zip").with_mode('0664') }
    end

    context 'group' do
      context 'default' do
        it { is_expected.to contain_file("#{inst_dir}/file.zip").with_group('aem') }
      end

      context 'specified group' do
        let(:params) do
          default_params.merge(group: 'vagrant')
        end
        it { is_expected.to contain_file("#{inst_dir}/file.zip").with_group('vagrant') }
      end
    end

    context 'user' do
      context 'default' do
        it { is_expected.to contain_file("#{inst_dir}/file.zip").with_owner('aem') }
      end

      context 'specified user' do
        let(:params) do
          default_params.merge(user: 'vagrant')
        end
        it { is_expected.to contain_file("#{inst_dir}/file.zip").with_owner('vagrant') }
      end
    end

    context 'source' do
      it { is_expected.to contain_file("#{inst_dir}/file.zip").with_source('/path/to/file.zip') }
    end
  end

  describe 'requires home directory' do
    let(:pre_condition) { 'file { "/opt/aem" : }' }

    let(:params) do
      default_params
    end

    context 'default' do
      it { is_expected.to contain_file("#{inst_dir}/file.zip").that_requires('File[/opt/aem]') }
    end
  end

end


text:
"use strict";

import React from 'react';
import { render } from 'react-dom';
import App from '../components/App.js';
import request from 'superagent';

// TODO: remove me → for testing
//window.request = request;

render(<App/>, document.getElementById('app'));


text:
<?php

namespace app\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\filters\VerbFilter;
use app\models\LoginForm;
use app\models\ContactForm;

class SiteController extends Controller
{
    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::className(),
                'only' => ['logout'],
                'rules' => [
                    [
                        'actions' => ['logout'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                ],
            ],
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'logout' => ['post'],
                ],
            ],
        ];
    }

    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
            'captcha' => [
                'class' => 'yii\captcha\CaptchaAction',
                'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
            ],
        ];
    }

    public function actionIndex()
    {
        return $this->render('index');
    }

    public function actionLogin()
    {
        if (!\Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        }
        return $this->render('login', [
            'model' => $model,
        ]);
    }

    public function actionLogout()
    {
        Yii::$app->user->logout();

        return $this->goHome();
    }

    public function actionAbout()
    {
        return $this->render('about');
    }
	public function actionAdd_user_form(){
		return $this->renderPartial('add_user_form');
	}
	public function actionGet_users(){
		$allUsers = Yii::$app->db->createCommand('SELECT cu.id, cu.lastname, cu.firstname, cu.login, cr.title role, cu.user_card FROM crm_users cu
		LEFT JOIN crm_roles cr ON cu.role = cr.id
		ORDER BY cu.id DESC limit 10
		')
            ->queryAll();
		$count = Yii::$app->db->createCommand('SELECT count(id) amount FROM crm_users')->queryAll();

		//var_dump($allUsers); exit;
		return $this->renderPartial('get_users',[
			'users' => $allUsers,
			'amount' => $count['0']['amount']
		]);
	}
	public function actionAdd_users(){
		$post = $_POST;
		$data = [];
		foreach($post['arrayOfData'] as $val){
			$data[$val['0']] = $val['1'];
		}

		$query = Yii::$app->db->createCommand()->insert('crm_users',[
			'lastname' => $data['lastname'],
			'firstname' => $data['firstname'],
			'login' => $data['login'],
			'password' => $data['password'],
			'role' => $data['role']
		])->execute();
	}
	public function actionGet_user_card(){
		$post = $_POST;
		if($post['id']){
			$id = $post['id'];
			$user_id = $post['user_id'];
			$query = Yii::$app->db->createCommand("
			SELECT * FROM crm_user_card WHERE id = $id
			")->queryAll();
			$user_info = Yii::$app->db->createCommand("
			SELECT lastname, firstname, role FROM crm_users WHERE id = $user_id
			")->queryAll();
			return $this->renderPartial('get_user_card',[
				'user_card' => $query['0'],
				'user_info' => $user_info['0']
			]);
		}else{
			return $this->renderPartial('add_user_card');
		}
	}
}


text:
<?php
namespace OAuth2Renap\Server\Controllers;

use Silex\Application;

class Token {
	public static function addRoutes($routing) {
		$routing->post('/token', array(new self(), 'token'))->bind('grant');
	}

	public function token(Application $app) {
		$server = $app['oauth_server'];
		$response = $app['oauth_response'];
		return $server->handleTokenRequest($app['request'], $response);
	}
}


text:
package tv.interactivefishing.footer;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;

import javax.imageio.ImageIO;

import tv.interactivefishing.context.Settings;

/**
 * Датчик пульса в нижнем колонтитуле
 * @author ilya
 *
 */
public class Pulse {

	/**
	 * Значение пульса ударов/минуту
	 */
	public double pulse;

	/**
	 * Буфферизированный бэкгроунда сканера пульса
	 */
	private BufferedImage image;

	/**
	 * Координата X левого верхнего угла сканера пульса
	 */
	public int pulse_x;

	/**
	 * Координата Y левого верхнего угла сканера пульса
	 */
	public int pulse_y;

	/**
	 * Интернационализированная строка
	 */
	public String i18n_pulse;

	/**
	 * Ширина сканера пульса
	 */
	public int pulse_width;

	/**
	 * Высота сканера пульса
	 */
	public int pulse_height;

	/**
	 * Координата X текста сканера
	 */
	public int pulse_text_x;

	/**
	 * Координата Y текста сканера
	 */
	public int pulse_text_y;
	/**
	 * Конструктор
	 */
	public Pulse()
	{
		try
		{
			try
			{
				URL url = new URL(Settings.settings.get("pulse_image"));
				image = ImageIO.read(url);
			}
			catch(Exception e)
			{
				e.printStackTrace();
				image = ImageIO.read(new File("C:/Users/ilya/workspace/youfishing/images/pulse.png"));
			}

		}
		catch(IOException e)
		{
			e.printStackTrace();
		}

		pulse = Integer.parseInt(Settings.settings.get("pulse"));
		i18n_pulse = Settings.settings.get("i18n_pulse");
		pulse_x = Integer.parseInt(Settings.settings.get("pulse_x"));
		pulse_y = Integer.parseInt(Settings.settings.get("pulse_y"));

		pulse_text_x = Integer.parseInt(Settings.settings.get("pulse_text_x"));
		pulse_text_y = Integer.parseInt(Settings.settings.get("pulse_text_y"));

		pulse_width = Integer.parseInt(Settings.settings.get("pulse_width"));
		pulse_height = Integer.parseInt(Settings.settings.get("pulse_height"));
	}

	/**
	 * Отрисовка сканера пульса
	 * @param g
	 */
	public void paintComponent(Graphics g)
	{
		StringBuffer sb = new StringBuffer();
		sb.append(pulse).append(" ").append(i18n_pulse);

		g.drawImage(image, pulse_x, pulse_y, pulse_x + pulse_width, pulse_y + pulse_height, 0, 0, image.getWidth(), image.getHeight(), null);
		g.drawString(sb.toString(), pulse_text_x, pulse_text_y);
	}
}


text:
#import <Foundation/Foundation.h>
#import "ASPObject.h"

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

@protocol ASPJfifData
@end

@interface ASPJfifData : ASPObject

@property(nonatomic) NSString* densityUnits;

@property(nonatomic) NSNumber* version;

@property(nonatomic) NSNumber* xDensity;

@property(nonatomic) NSNumber* yDensity;

@end


text:
/**
 * The type of Redux action which sets the noSrcDataNotificationUid state representing the UID of the previous
 * no data from source notification. Used to check if such a notification was previously displayed.
 *
 * {
 *     type: SET_NO_SRC_DATA_NOTIFICATION_UID,
 *     uid: ?number
 * }
 */
export const SET_NO_SRC_DATA_NOTIFICATION_UID = 'SET_NO_SRC_DATA_NOTIFICATION_UID';

/**
 * The type of redux action dispatched to disable screensharing or to start the
 * flow for enabling screenshare.
 *
 * {
 *     type: TOGGLE_SCREENSHARING
 * }
 */
export const TOGGLE_SCREENSHARING = 'TOGGLE_SCREENSHARING';

/**
 * The type of redux action dispatched when a track has been (locally or
 * remotely) added to the conference.
 *
 * {
 *     type: TRACK_ADDED,
 *     track: Track
 * }
 */
export const TRACK_ADDED = 'TRACK_ADDED';

/**
 * The type of redux action dispatched when a canceled {@code getUserMedia}
 * process completes either successfully or with an error (the error is ignored
 * and the track is immediately disposed if it has been created).
 *
 * {
 *     type: TRACK_CREATE_CANCELED,
 *     trackType: MEDIA_TYPE
 * }
 */
export const TRACK_CREATE_CANCELED = 'TRACK_CREATE_CANCELED';

/**
 * The type of redux action dispatched when {@code getUserMedia} fails with an
 * error (such as permission denied).
 *
 * {
 *     type: TRACK_CREATE_ERROR,
 *     permissionDenied: Boolean,
 *     trackType: MEDIA_TYPE
 * }
 */
export const TRACK_CREATE_ERROR = 'TRACK_CREATE_ERROR';

/**
 * The type of redux action dispatched when the track mute/unmute operation fails at the conference level. This could
 * happen because of {@code getUserMedia} errors during unmute or replace track errors at the peerconnection level.
 *
 * {
 *     type: TRACK_MUTE_UNMUTE_FAILED,
 *     track: Track,
 *     wasMuting: Boolean
 * }
 */
export const TRACK_MUTE_UNMUTE_FAILED = 'TRACK_MUTE_UNMUTE_FAILED';

/**
 * The type of redux action dispatched when a track has triggered no data from source event.
 *
 * {
 *     type: TRACK_NO_DATA_FROM_SOURCE,
 *     track: Track
 * }
 */
export const TRACK_NO_DATA_FROM_SOURCE = 'TRACK_NO_DATA_FROM_SOURCE';

/**
 * The type of redux action dispatched when a track has been (locally or
 * remotely) removed from the conference.
 *
 * {
 *     type: TRACK_REMOVED,
 *     track: Track
 * }
 */
export const TRACK_REMOVED = 'TRACK_REMOVED';

/**
 * The type of redux action dispatched when a track has stopped.
 *
 * {
 *      type: TRACK_STOPPED,
 *      track: Track
 * }
 */
export const TRACK_STOPPED = 'TRACK_STOPPED';

/**
 * The type of redux action dispatched when a track's properties were updated.
 *
 * {
 *     type: TRACK_UPDATED,
 *     track: Track
 * }
 */
export const TRACK_UPDATED = 'TRACK_UPDATED';

/**
 * The type of redux action dispatched when a screenshare track's muted property were updated.
 *
 * {
 *     type: SCREENSHARE_TRACK_MUTED_UPDATED,
 *     track: Track,
 *     muted: Boolean
 *
 * }
 */
 export const SCREENSHARE_TRACK_MUTED_UPDATED = 'SCREENSHARE_TRACK_MUTED_UPDATED';

/**
 * The type of redux action dispatched when a local track starts being created
 * via a WebRTC {@code getUserMedia} call. The action's payload includes an
 * extra {@code gumProcess} property which is a {@code Promise} with an extra
 * {@code cancel} method which can be used to cancel the process. Canceling will
 * result in disposing any {@code JitsiLocalTrack} returned by the
 * {@code getUserMedia} callback. There will be a {@code TRACK_CREATE_CANCELED}
 * action instead of a {@code TRACK_ADDED} or {@code TRACK_CREATE_ERROR} action.
 *
 * {
 *     type: TRACK_WILL_CREATE
 *     track: {
 *         gumProcess: Promise with a `cancel` method to cancel the process,
 *         local: true,
 *         mediaType: MEDIA_TYPE
 *     }
 * }
 */
export const TRACK_WILL_CREATE = 'TRACK_WILL_CREATE';

/**
 * Action to update the redux store with the current media event name of the video track.
 *
 * @returns {{
 *     type: TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT,
 *     track: Track,
 *     name: string
 * }}
 */
export const TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT = 'TRACK_UPDATE_LAST_VIDEO_MEDIA_EVENT';


text:
django-page-cms
===============

.. image:: https://pypip.in/d/django-page-cms/badge.png
.. image:: https://api.travis-ci.org/batiste/django-page-cms.png

`View on Travis CI <https://travis-ci.org/batiste/django-page-cms>`_

This Django CMS enables you to create and administrate hierarchical pages in a simple and powerful way.

Django page CMS is based around a placeholders concept. Placeholder is a special template tag that
you use in your page templates. Every time you add a placeholder in your template such field
dynamically appears in the page admin interface.

Each page can have a different template with different placeholders.

.. image:: https://github.com/batiste/django-page-cms/raw/master/doc/admin-screenshot1.png

Documentation
-------------

For more information about the product:

http://pythonhosted.org/django-page-cms/


text:
require 'spec_helper'

describe CanvasCc::CanvasCC::AssignmentWriter do
  subject { CanvasCc::CanvasCC::AssignmentWriter.new(work_dir, assignment) }
  let(:work_dir) { Dir.mktmpdir }
  let(:assignment) { CanvasCc::CanvasCC::Models::Assignment.new }

  after(:each) do
    FileUtils.rm_r work_dir
  end

  it 'creates the assignment settings xml' do
    assignment.identifier = 'assignment_id'
    assignment.title = 'Assignment Title'
    assignment.due_at = Time.parse('Sat, 08 Feb 2014 16:00:00 GMT')
    assignment.lock_at = Time.parse('Sat, 08 Feb 2014 17:00:00 GMT')
    assignment.unlock_at = Time.parse('Sat, 08 Feb 2014 18:00:00 GMT')
    assignment.peer_reviews_due_at = Time.parse('Sat, 08 Feb 2014 19:00:00 GMT')
    assignment.all_day_date = Time.parse('Sat, 08 Feb 2014 00:00:00 GMT')
    assignment.assignment_group_identifier_ref = 'assignment_group_id'
    assignment.workflow_state = 'active'
    assignment.points_possible = '30'
    assignment.grading_type = 'points'
    assignment.all_day = 'true'
    assignment.submission_types = %w(online_text_entry online_url online_upload)
    assignment.position = '2'
    assignment.peer_review_count = '0'
    assignment.peer_reviews_assigned = 'false'
    assignment.peer_reviews = 'false'
    assignment.automatic_peer_reviews = 'true'
    assignment.grade_group_students_individually = 'false'
    assignment.muted = true
    assignment.quiz_identifierref = 'abc'

    subject.write
    xml = Nokogiri::XML(File.read(File.join(work_dir, assignment.assignment_resource.files.select{ |f| f.split(//).last(4).join("").to_s == '.xml'}.first)))
    expect(xml.at_xpath('xmlns:assignment/@identifier').value).to eq('assignment_id')
    expect(xml.%('assignment/title').text).to eq 'Assignment Title'
    expect(xml.%('assignment/due_at').text).to eq '2014-02-08T16:00:00'
    expect(xml.%('assignment/lock_at').text).to eq '2014-02-08T17:00:00'
    expect(xml.%('assignment/unlock_at').text).to eq '2014-02-08T18:00:00'
    expect(xml.%('assignment/all_day_date').text).to eq '2014-02-08T00:00:00'
    expect(xml.%('assignment/peer_reviews_due_at').text).to eq '2014-02-08T19:00:00'
    expect(xml.%('assignment/assignment_group_identifierref').text).to eq 'assignment_group_id'
    expect(xml.%('assignment/workflow_state').text).to eq 'active'
    expect(xml.%('assignment/points_possible').text).to eq '30'
    expect(xml.%('assignment/grading_type').text).to eq 'points'
    expect(xml.%('assignment/all_day').text).to eq 'true'
    expect(xml.%('assignment/submission_types').text).to eq 'online_text_entry,online_url,online_upload'
    expect(xml.%('assignment/position').text).to eq '2'
    expect(xml.%('assignment/peer_review_count').text).to eq '0'
    expect(xml.%('assignment/peer_reviews_assigned').text).to eq 'false'
    expect(xml.%('assignment/peer_reviews').text).to eq 'false'
    expect(xml.%('assignment/automatic_peer_reviews').text).to eq 'true'
    expect(xml.%('assignment/grade_group_students_individually').text).to eq 'false'
    expect(xml.%('assignment/muted').text).to eq 'true'
    expect(xml.%('assignment/quiz_identifierref').text).to eq 'abc'

  end

  it 'creates the assignment html' do
    assignment.identifier = 'assignment_id'
    assignment.title = 'Assignment Title'
    assignment.body = '
My Body Content
'

    subject.write
    html = Nokogiri::HTML(File.read(File.join(work_dir, assignment.assignment_resource.href)))

    expect(html.at_css('meta[http-equiv]')[:'http-equiv']).to eq 'Content-Type'
    expect(html.at_css('meta[http-equiv]')[:content]).to eq 'text/html; charset=utf-8'
    expect(html.at_css('title').text).to eq 'Assignment: Assignment Title'
    expect(html.at_css('body').inner_html.to_s).to eq '
My Body Content
'

  end

end


text:
#ifndef BEGINSESSIONPACKET_H
#define BEGINSESSIONPACKET_H

// Heimdall
#include "SessionSetupPacket.h"

namespace Heimdall
{
	class BeginSessionPacket : public SessionSetupPacket
	{
		public:

			BeginSessionPacket() : SessionSetupPacket(SessionSetupPacket::kBeginSession)
			{
			}
	};
}

#endif


text:
@interface PodsDummy_GoogleToolboxForMac : NSObject
@end
@implementation PodsDummy_GoogleToolboxForMac
@end


text:
title: Font Categories
module: topic-10
permalink: /topic-10/font-categories/
---

Licensing has a lot to do with how you'll select your fonts. In no way is every font available to every user - in fact, we're actually quite limited on what fonts platforms share:

In other words, "Calabri" will appear for Windows users accessing the site, but perhaps not for Mac users. The browser will then request a fallback or default font to render for those users, which may or may not look as the dev intended.

System Fonts

Web Fonts

Web-Safe Fonts

System fonts are those already installed on your local device and system. These are available to you and most programs you use, but are not necessarily to the web (usually due to licensing).

You may have never second-guessed your use of system fonts, because you often select them with the intent to print. But most system fonts are not set up for the web, and should be limited to usage in logos and other branding. This is because they must be exported as images, affecting both assistive technologies and search engine indexing.

Font: "Bakery"

Fonts: "Fresh Marker" and "Armegeda Wide"

Font: "Maybe Maybe Not"

NOTE: If you try to select one the fake brand names above, you'll see that your cursor grabs an image, and cannot highlight text (because there is none to do so). This is why text-images should be used sparingly.

Web fonts are custom fonts hosted on a server. They do not have to be available on the user's device to appear, but require certain elements to get called up correctly.

65% of websites currently use web fonts. These fonts are optimized for performing on the web, but are not full-proof. You should take into consideration browser compatibility, rendering speeds, and availability when selecting these fonts.

This site uses the web fonts:

Ubuntu

Menlo (with fallbacks)

Common repositories for utilizing fonts in this way are Google Fonts, Font Squirrel, and Adobe Typekit.

Fonts that developers can count on being available by the system are known as "web-safe" fonts. These include font families that both Windows and Mac should have (see the graphic above).

Web-safe fonts include:

Arial

Georgia

Times New Roman

...as well as these other web safe fonts

The advantage of using fonts from this list is that the client computer will already have the font. This reduces load times and may increase performance.


text:
Cloud Execution

Works with:

* [OSRAM LIGHTIFY Dimming Switch](https://support.smartthings.com/hc/en-us/articles/115000236823-SYLVANIA-Dimming-Switch)
* [Iris Smart Button](https://support.smartthings.com/hc/en-us/articles/115000190186-Iris-Smart-Button)
* [Iris KeyFob](https://support.smartthings.com/hc/en-us/articles/217409686-Iris-Smart-Fob)

## Table of contents

* [Capabilities](#capabilities)
* [Health](#device-health)
* [Troubleshooting](#troubleshooting)

## Capabilities

* **Actuator** - It represents that a device has commands.
* **Battery** - It defines that the device has a battery
* **Button** - It defines that a device has one or more buttons
* **Holdable Button** - It defines that a device has one or more holdable buttons
* **Configuration** - _configure()_ command called when device is installed or device preferences updated
* **Refresh** - _refresh()_ command for status updates
* **Sensor** - it represents that a Device has attributes.
* **Health Check** - indicates ability to get device health notifications

## Device Health

ZigBee Button is marked offline only in the case when Hub is offline.

## Troubleshooting

If the device doesn't pair when trying from the SmartThings mobile app, it is possible that the device is out of range.
Pairing needs to be tried again by placing the device closer to the hub.
It may also happen that you need to reset the device.
Instructions related to pairing, resetting and removing the device from SmartThings can be found in the following link:
* [OSRAM LIGHTIFY Dimming Switch Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/115000236823-SYLVANIA-Dimming-Switch)
* [Iris Smart Button Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/115000190186-Iris-Smart-Button)
* [Iris KeyFob Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/217409686-Iris-Smart-Fob)


text:
class Ranking < ActiveRecord::Base
	belongs_to :stance, :class_name => "Stance", :foreign_key => "stance_id"
end