text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->
<configuration>
    <property>
        <name>yarn.scheduler.capacity.root.default.maximum-am-resource-percent
        </name>
        <value>1.0</value>
        <final>false</final>
        <source>programmatically</source>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.default.capacity</name>
        <value>100.000</value>
        <final>false</final>
        <source>programmatically</source>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.default.ordering-policy</name>
        <value>fair</value>
        <final>false</final>
        <source>programmatically</source>
    </property>

    <!-- the next property is not accepted by CS -->
    <property>
        <name>
            yarn.scheduler.capacity.root.default.auto-create-child-queue.enabled
        </name>
        <value>true</value>
        <final>false</final>
        <source>programmatically</source>
    </property>

    <property>
        <name>yarn.scheduler.capacity.root.maximum-am-resource-percent</name>
        <value>1.0</value>
        <final>false</final>
        <source>programmatically</source>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.queues</name>
        <value>default</value>
        <final>false</final>
        <source>programmatically</source>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.auto-create-child-queue.enabled
        </name>
        <value>true</value>
        <final>false</final>
        <source>programmatically</source>
    </property>
    <property>
        <name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
        <value>-1.0</value>
        <final>false</final>
        <source>programmatically</source>
    </property>
</configuration>


text:
using namespace ci;

class Box {
private:
    Rectf   bounds;
    b2Body* body;
    Vec2f   position;
    float   angle;

public:
    Box(){}
    Box(b2World* world, float x, float y, float sizeX, float sizeY): bounds( -sizeX/2.0f, -sizeY/2.0f, sizeX/2.0f, sizeY/2.0f ) {
        b2BodyDef bodyDef;
        bodyDef.type = b2_dynamicBody;
        bodyDef.position.Set( Conversions::toPhysics(x), Conversions::toPhysics(y) );
        body = world->CreateBody(&bodyDef);

        b2PolygonShape dynamicBox;
        b2Vec2 boxSize = Conversions::toPhysics( Vec2f(sizeX / 2.0f, sizeY / 2.0f) );
        dynamicBox.SetAsBox(boxSize.x, boxSize.y);

        b2FixtureDef fixtureDef;
        fixtureDef.shape = &dynamicBox;
        fixtureDef.density = 1.0f;
        fixtureDef.friction = 0.3f;

        body->CreateFixture(&fixtureDef);
    }

    void update(b2World * world);
    void draw() const;
    bool isDead();
    b2Body* getBody();
};

#endif

redpajama_set_name: RedPajamaGithub


text:
FactoryBot.define do
  factory :system_email do
    sequence(:name) { |n| "Awesome Email #{n}" }
  end
end


text:
/**********************************************************************
* ? 2005 Microchip Technology Inc.
*
* FileName:        spi1Drv.c
* Dependencies:    Header (.h) files if applicable, see below
* Processor:       dsPIC33Fxxxx/PIC24Hxxxx
* Compiler:        MPLAB? C30 v3.00 or higher
* Tested On:	   dsPIC33FJ256GP710
*
* SOFTWARE LICENSE AGREEMENT:
* Microchip Technology Incorporated ("Microchip") retains all ownership and
* intellectual property rights in the code accompanying this message and in all
* derivatives hereto.  You may use this code, and any derivatives created by
* any person or entity by or on your behalf, exclusively with Microchip's
* proprietary products.  Your acceptance and/or use of this code constitutes
* agreement to the terms and conditions of this notice.
*
* CODE ACCOMPANYING THIS MESSAGE IS SUPPLIED BY MICROCHIP "AS IS".  NO
* WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS CODE, ITS INTERACTION WITH MICROCHIP'S
* PRODUCTS, COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
*
* YOU ACKNOWLEDGE AND AGREE THAT, IN NO EVENT, SHALL MICROCHIP BE LIABLE, WHETHER
* IN CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR BREACH OF STATUTORY DUTY),
* STRICT LIABILITY, INDEMNITY, CONTRIBUTION, OR OTHERWISE, FOR ANY INDIRECT, SPECIAL,
* PUNITIVE, EXEMPLARY, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, FOR COST OR EXPENSE OF
* ANY KIND WHATSOEVER RELATED TO THE CODE, HOWSOEVER CAUSED, EVEN IF MICROCHIP HAS BEEN
* ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE FULLEST EXTENT
* ALLOWABLE BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO
* THIS CODE, SHALL NOT EXCEED THE PRICE YOU PAID DIRECTLY TO MICROCHIP SPECIFICALLY TO
* HAVE THIS CODE DEVELOPED.
*
* You agree that you are solely responsible for testing the code and
* determining its suitability.  Microchip has no obligation to modify, test,
* certify, or support the code.
*
* REVISION HISTORY:
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Author            Date      Comments on this revision
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* RK	          04/06/06 	  First release of source file
*
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ADDITIONAL NOTES.
**********************************************************************/

#include "setup.h"
#include "ethercat_hw.h"
#include "ethercat.h"

void cfgDma0SpiTx(void);
void cfgDma1SpiRx(void);

unsigned char Spi1RxBuffA[128] __attribute__((space(dma)));
unsigned int Spi1TxBuffA[128] __attribute__((space(dma)));

//unsigned int Spi1TxBuffB[2] __attribute__((space(dma)));
/*=============================================================================
_DMA0Init(): Initialise DMA0 for SPI Data Transmission
=============================================================================*/
// DMA0 configuration
// Direction: Read from DMA RAM and write to SPI buffer
// AMODE: Register Indirect with Post-Increment mode
// MODE: Continuous, Ping-Pong Enabled
// IRQ: SPI

void cfgDma0SpiTx(void)
{

	DMA0CON = 0x2001;

	DMA0CNT = 0;
	DMA0REQ = 0x00A;

	DMA0PAD = (volatile unsigned int) &SPI1BUF;
	DMA0STA= __builtin_dmaoffset(Spi1TxBuffA);

	DMA1CONbits.SIZE = 1;			// 8-bit
	IFS0bits.DMA0IF  = 0;			// Clear DMA interrupt
	IEC0bits.DMA0IE  = 1;			// Enable DMA interrupt
	DMA0CONbits.CHEN = 0;			// Enable DMA Channel

}

// DMA1 configuration
// Direction: Read from SPI buffer and write to DMA RAM
// AMODE: Register Indirect with Post-Increment mode
// MODE: Continuous, Ping-Pong Enabled
// IRQ: SPI
void cfgDma1SpiRx(void)
{

	DMA1CON = 0x0001;
	DMA1CNT = 0;
	DMA1REQ = 0x00A;

	DMA1PAD = (volatile unsigned int) &SPI1BUF;
	DMA1STA= __builtin_dmaoffset(Spi1RxBuffA);

	DMA1CONbits.SIZE = 1;			// 8-bit
	IFS0bits.DMA1IF  = 0;			// Clear DMA interrupt
	DMA1CONbits.CHEN = 0;			// Enable DMA Channel
	IEC0bits.DMA1IE = 0;
}

void ResetDMATx(void)
{
	DMA0STA= __builtin_dmaoffset(Spi1TxBuffA);

	DMA1STA= __builtin_dmaoffset(Spi1RxBuffA);

	DMA1CONbits.CHEN = 1; // Enable DMA0 Channel
	DMA0CONbits.CHEN = 1; // Enable DMA0 Channel
}

/*=============================================================================
Interrupt Service Routines.
=============================================================================*/

void __attribute__((interrupt, no_auto_psv)) _DMA0Interrupt(void)
{
      DMA0CONbits.CHEN = 0; // Enable DMA0 Channel
      IFS0bits.DMA0IF = 0;		// Clear the DMA0 Interrupt Flag;

}

unsigned char GetRxBufIdx(int idx)
{

    return (unsigned char)Spi1RxBuffA[idx];

}

void __attribute__((interrupt, no_auto_psv)) _DMA1Interrupt(void)
{
    int i;

    DMA1CONbits.CHEN = 0; // Enable DMA0 Channel
    IFS0bits.DMA1IF = 0;
    IEC0bits.DMA1IE  = 0;			// Enable DMA interrupt

    if (did_rx)
    {

        did_rx = 0;

        SPI_SEL = SPI_DEACTIVE;
        //IFS0bits.DMA1IF = 0;
        //IEC0bits.DMA1IE  = 0;			// Enable DMA interrupt

        memcpy((unsigned char *)&ec_cmd, &Spi1RxBuffA[2],sizeof(ec_cmd_t));
        if (!do_tx)
        {
            //ClrHeartbeatLED;
            ENABLE_AL_EVENT_INT;
        }
    }

    if (did_tx)
    {
        did_tx = 0;

        SPI_SEL = SPI_DEACTIVE;

        //IFS0bits.DMA1IF = 0;
        //IEC0bits.DMA1IE  = 0;			// Enable DMA interrupt

        //ClrHeartbeatLED;

        ENABLE_AL_EVENT_INT;

    }

    if (do_tx)
    {
        do_tx = 0;
        isr_update_inputs();
        SPI_SEL = SPI_ACTIVE;
        ISR_StartDMA();

    }

}


text:
package com.java110.fee.bmo.feeCollectionOrder.impl;

import com.java110.dto.feeCollectionOrder.FeeCollectionOrderDto;
import com.java110.fee.bmo.feeCollectionOrder.IGetFeeCollectionOrderBMO;
import com.java110.intf.fee.IFeeCollectionOrderInnerServiceSMO;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service("getFeeCollectionOrderBMOImpl")
public class GetFeeCollectionOrderBMOImpl implements IGetFeeCollectionOrderBMO {

    @Autowired
    private IFeeCollectionOrderInnerServiceSMO feeCollectionOrderInnerServiceSMOImpl;

    /**
     * @param feeCollectionOrderDto
     * @return 订单服务能够接受的报文
     */
    public ResponseEntity<String> get(FeeCollectionOrderDto feeCollectionOrderDto) {

        int count = feeCollectionOrderInnerServiceSMOImpl.queryFeeCollectionOrdersCount(feeCollectionOrderDto);

        List<FeeCollectionOrderDto> feeCollectionOrderDtos = null;
        if (count > 0) {
            feeCollectionOrderDtos = feeCollectionOrderInnerServiceSMOImpl.queryFeeCollectionOrders(feeCollectionOrderDto);
        } else {
            feeCollectionOrderDtos = new ArrayList<>();
        }

        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) feeCollectionOrderDto.getRow()), count, feeCollectionOrderDtos);

        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);

        return responseEntity;
    }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OR-Tools: HeldWolfeCrowderEvaluator< CostType, CostFunction ></title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="styleSheet.tmp.css" rel="stylesheet" type="text/css"/>

OR-Tools
    9.4

Public Member Functions |
List of all members

HeldWolfeCrowderEvaluator< CostType, CostFunction >

Detailed Description

template<typename CostType, typename CostFunction>

class operations_research::HeldWolfeCrowderEvaluator< CostType, CostFunction >

Definition at line 210 of file one_tree_lower_bound.h.

Public Member Functions

 	HeldWolfeCrowderEvaluator (int number_of_nodes, const CostFunction &cost)

bool 	Next ()

double 	GetStep () const

void 	OnOneTree (CostType one_tree_cost, double w, const std::vector< int > &degrees)

void 	OnNewWMax (CostType one_tree_cost)

Constructor & Destructor Documentation

◆ HeldWolfeCrowderEvaluator()

          HeldWolfeCrowderEvaluator
          (
          int
          number_of_nodes,

          const CostFunction &
          cost

          )

inline

Definition at line 212 of file one_tree_lower_bound.h.

Member Function Documentation

◆ GetStep()

          double GetStep
          (
          	)
           const

inline

Definition at line 238 of file one_tree_lower_bound.h.

◆ Next()

          bool Next
          (
          	)

inline

Definition at line 225 of file one_tree_lower_bound.h.

◆ OnNewWMax()

          void OnNewWMax
          (
          CostType
          one_tree_cost	)

inline

Definition at line 250 of file one_tree_lower_bound.h.

◆ OnOneTree()

          void OnOneTree
          (
          CostType
          one_tree_cost,

          double
          w,

          const std::vector< int > &
          degrees

          )

inline

Definition at line 240 of file one_tree_lower_bound.h.

The documentation for this class was generated from the following file:

one_tree_lower_bound.h

operations_research

HeldWolfeCrowderEvaluator

Generated by

     1.9.4


text: require('./stylesheets/bubble-map.demo.scss');


text:
package org.apache.taverna.baclava;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.List;

import javax.xml.bind.JAXBException;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

public class TestExample1 {

	private static DataThingMapType dt;

	private static String[] expectedKeys = new String[] {"status", "proteinIDs", "output"};

	private static String[] expectedMimeTypes = new String[] {"text/plain", "text/plain", "application/octet-stream"};

	@BeforeClass
	public static void setUpClass() throws FileNotFoundException, JAXBException {
		ClassLoader classLoader = TestExample1.class.getClassLoader();
		File file = new File(classLoader.getResource("example1.xml").getFile());
		dt = BaclavaReader.readBaclava(new FileReader(file));
	}

	@Test
	public void checkRead() {
		Assert.assertNotNull("Unable to parse example1.xml", dt);
	}

	@Test
	public void checkNumberOfDataThings() {
		Assert.assertEquals("There should be three data things", 3, dt.getDataThing().size());
	}

	@Test
	public void checkDataThingKeys() {
		for (String k : expectedKeys) {
			Assert.assertNotNull(k + " should be there", getDataThingTypeByKey(k));
		}
	}

	@Test
	public void checkDataThingMimeTypes() {
		for (int i = 0; i < expectedKeys.length; i++) {
			String k = expectedKeys[i];
			DataThingType d = getDataThingTypeByKey(k);
			MyGridDataDocumentType doc = d.getMyGridDataDocument();
			Assert.assertNotNull("myGridDataDocument of " + k + " is missing", doc);
			MetadataType meta = doc.getMetadata();
			Assert.assertNotNull("metadata of " + k + " is missing", meta);
			MimeTypesType types = meta.getMimeTypes();
			Assert.assertNotNull("mimetypes of " + k + " is missing", types);
			List<String> mimeTypes = types.getMimeType();
			Assert.assertNotNull("mimetypes of " + k + " is null", mimeTypes);
			Assert.assertNotEquals("mimetypes of " + k + " is empty", 0, mimeTypes);
			String firstMimeType = mimeTypes.get(0);
			Assert.assertEquals("mimetype of " + k + " is wrong", expectedMimeTypes[i], firstMimeType);
		}
	}

	private DataThingType getDataThingTypeByKey(String key) {
		DataThingType result = null;
		for (DataThingType d : dt.getDataThing()) {
			if (d.getKey().equals(key)) {
				result = d;
				break;
			}
		}
		return result;
	}
}


text:
'use strict';

const validator = require('email-validator');

const validators = {
	v: {
		required: true,
		// termPattern: /^v$/,
		description: 'Protocol version',
		validate(term, value) {
			if (value !== 'DMARC1') {
				throw new Error(`Invalid DMARC version: '${value}'`);
			}
		}
	},
	fo: {
		// termPattern: /^fo$/,
		description: 'Forensic reporting options. Possible values: "0" to generate reports if all underlying authentication mechanisms fail to produce a DMARC pass result, "1" to generate reports if any mechanisms fail, "d" to generate report if DKIM signature failed to verify, "s" if SPF failed.',
		validate(term, value) {
			if (!/^([01ds])$/i.test(value)) {
				throw new Error(`Invalid value for '${term}': '${value}', must be one of: 0, 1, d, s`);
			}
		}
	},
	p: {
		description: 'Policy to apply to email that fails the DMARC check. Can be "none", "quarantine", or "reject". "none" is used to collect feedback and gain visibility into email streams without impacting existing flows.',
		validate(term, value) {
			if (!/^(none|quarantine|reject)$/i.test(value)) {
				throw new Error(`Invalid value for '${term}': '${value}', must be one of: none, quarantine, reject`);
			}
		}
	},
	pct: {
		description: `Percentage of messages from the Domain Owner's mail stream to which the DMARC policy is to be applied.`,
		validate(term, value) {
			if (!/^\d+$/.test(value)) {
				throw new Error(`Invalid value for '${term}': ${value}, must be a positive integer`);
			}
			else if (parseInt(value, 10) > 100 || parseInt(value, 10) < 0) {
				throw new Error(`Invalid value for '${term}': ${value}, must be an integer between 0 and 100`);
			}
		}
	},
	rf: {
		description: `Format to be used for message-specific failure reports (colon-separated plain-text list of values)`,
		validate(term, value) {
			// The RFC says the values are colon-separated but a lot of examples/docs around the net show commas... so we'll do both
			let values = value.split(/,|:/).map(x => x.trim());

			for (let val of values) {
				if (!/^(afrf|iodef)$/i.test(val)) {
					throw new Error(`Invalid value for '${term}': '${value}', must be one or more of these values: afrf, iodef. Multiple values must be separated by a comma or colon`);
				}
			}
		}
	},
	ri: {
		description: 'Interval (in seconds) requested between aggregate reports (plain-text 32-bit unsigned integer; default is 86400)',
		validate(term, value) {
			if (!/^\d+$/.test(value)) {
				throw new Error(`Invalid value for '${term}': ${value}, must be an unsigned integer`);
			}
		}
	},
	rua: {
		description: 'Addresses to which aggregate feedback is to be sent (comma-separated plain-text list of DMARC URIs',
		validate(term, value) {
			let values = value.split(/,/).map(x => x.trim());

			for (let val of values) {
				let matches = val.match(/^mailto:(.+)$/i);
				if (!matches) {
					throw new Error(`Invalid value for '${term}': ${value}, must be a list of DMARC URIs such as 'mailto:some.email@somedomain.com'`);
				}
				let email = matches[1];
				const limitRE = /!(.+)$/;
				const index = email.indexOf('@');
				if (index !== -1) {
					const limitMatch = email.substring(index + 1).match(limitRE);
					if (limitMatch) {
						const sizeLimit = limitMatch[0];
						email = email.replace(sizeLimit, '');
					}
				}
				if (!validator.validate(email)) {
					throw new Error(`Invalid email address in '${term}': '${email}'`);
				}
			}
		}
	},
	ruf: {
		description: 'Addresses to which message-specific failure information is to be reported (comma-separated plain-text list of DMARC URIs)',
		validate(term, value) {
			let values = value.split(/,/).map(x => x.trim());

			for (let val of values) {
				let matches = val.match(/^mailto:(.+)$/i);
				if (!matches) {
					throw new Error(`Invalid value for '${term}': ${value}, must be a list of DMARC URIs such as 'mailto:some.email@somedomain.com'`);
				}
				let email = matches[1];
				const limitRE = /!(.+)$/;
				const index = email.indexOf('@');
				if (index !== -1) {
					const limitMatch = email.substring(index + 1).match(limitRE);
					if (limitMatch) {
						const sizeLimit = limitMatch[0];
						email = email.replace(sizeLimit, '');
					}
				}
				if (!validator.validate(email)) {
					throw new Error(`Invalid email address in '${term}': '${email}'`);
				}
			}
		}
	},
	sp: {
		description: 'Requested Mail Receiver policy for all subdomains. Can be "none", "quarantine", or "reject".',
		validate(term, value) {
			if (!/^(none|quarantine|reject)$/i.test(value)) {
				throw new Error(`Invalid value for '${term}': '${value}', must be one of: none, quarantine, reject`);
			}
		}
	},
	aspf: {
		description: 'SPF Alignment mode. Can be "s" or "r".',
		validate(term, value) {
			if (!/^(s|r)$/i.test(value)) {
				throw new Error(`Invalid value for '${term}': '${value}', must be one of: s, r`);
			}
		}
	},
	adkim: {
		description: 'DKIM Alignment mode. Can be "s" or "r".',
		validate(term, value) {
			if (!/^(s|r)$/i.test(value)) {
				throw new Error(`Invalid value for '${term}': '${value}', must be one of: s, r`);
			}
		}
	}
};

function parse(policy) {
  // Steps
  // 1. Split policy string on semicolons into term pairs
  // 2. Process and validate each term pair

	let terms = policy.split(/;/)
								.map(t => t.trim()) // Trim surrounding whitespace
								.filter(x => x !== ''); // Ignore empty tags

	let rules = terms.map(
    x => x.split(/[=]/)
          .map(p => p.trim())
  );

	let retval = {
		tags: {},
		messages: []
	};

	// Make sure `v` is the first tag
	if (!/^v$/i.test(rules[0][0])) {
		retval.messages.push(`First tag in a DMARC policy must be 'v', but found: '${rules[0][0]}'`);
		return retval;
	}

	for (let rule of rules) {
		let term = rule[0];
		let value = rule[1];

		let found = false;

		for (let validatorTerm of Object.keys(validators)) {
			let settings = validators[validatorTerm];

			// Term matches validaor
			let termRegex = new RegExp(`^${validatorTerm}$`, 'i');
			if (termRegex.test(term)) {
				found = true;

				let tag = {
					// tag: term,
					description: settings.description
				};

				if (settings.validate) {
					// eslint-disable-next-line max-depth
					try {
						settings.validate.call(settings, term, value);
						tag.value = value;
						retval.tags[term] = tag;
					}
					catch (err) {
						retval.messages.push(err.message);
					}
				}

				break;
			}
		}

		if (!found) {
			retval.messages.push(`Unknown tag '${term}'`);
		}
	}

	// Remove "messages"
	if (retval.messages.length === 0) {
		delete retval.messages;
	}

	return retval;
}

module.exports = parse;


text:
package jsprit.core.algorithm.recreate;

import jsprit.core.algorithm.recreate.listener.VehicleSwitchedListener;
import jsprit.core.problem.solution.route.VehicleRoute;
import jsprit.core.problem.vehicle.Vehicle;
import jsprit.core.problem.vehicle.VehicleFleetManager;

public class VehicleSwitched implements VehicleSwitchedListener{

	private VehicleFleetManager fleetManager;

	public VehicleSwitched(VehicleFleetManager fleetManager){
		this.fleetManager = fleetManager;
	}

	@Override
	public void vehicleSwitched(VehicleRoute vehicleRoute, Vehicle oldVehicle, Vehicle newVehicle) {
		fleetManager.unlock(oldVehicle);
		fleetManager.lock(newVehicle);
	}

}


text:
import React, { Component } from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    TouchableHighlight,
    TouchableOpacity,
    TouchableWithoutFeedback,
    NativeModules,
    SectionList,
    AsyncStorage
} from 'react-native';

import ViewPager from 'react-native-viewpager'

var Dimensions = require('Dimensions'); // 获取屏幕的宽高
var ScreenWidth = Dimensions.get('window').width;
var ScreenHeight = Dimensions.get('window').height;

const BANNER_IMGS = [
    require('./../imgs/ads_sports.png'),
    require('./../imgs/ads_weather.png'),
];

export default class DiscoveryPage extends Component {
    constructor(props) {
        super(props);
        // 构建DataSource对象
        var dataSource = new ViewPager.DataSource({
            pageHasChanged:(p1, p2) => p1 !== p2,
        });
        this.state = {
            dataSource: dataSource.cloneWithPages(BANNER_IMGS),
            griddataSource: [], // 表格数据
        }
        // this._onPageClick = this._listHeaderComponent.bind(this);
    }

    componentWillMount() {
        // console.log("componentWillMount");
        var commonNativeModule = NativeModules.RNCommonModule;
        commonNativeModule.setAllowGotoWebview(true);
    }
    // Component挂载完毕后调用
    componentDidMount() {
        // console.log("componentDidMount");
        let datas = [];
        let pics = [];
        let picitem = {unitIcon3x: require('./../imgs/ic_search_nearby.png'), unitName: '周边足球场'};
        pics.push(picitem);
        picitem = {unitIcon3x: require('./../imgs/ic_customize_race.png'), unitName: '自定义赛程'};
        pics.push(picitem);
        picitem = {unitIcon3x: require('./../imgs/ic_soccer_game.png'), unitName: '点球游戏'};
        pics.push(picitem);

        let item = {data: [pics], key: '尝鲜'};
        datas.push(item);
        this.setState({griddataSource:datas});
    }

    _handleJson(json) {
        let datas = [];
        var allData ={}
        for (i = 0; i < json.blockList.length; i++ ) {
            var object = json.blockList[i];
            let b = object.discoverUnitList;
            let count = 9;

            if (i === 0) {
                //截掉头三个放到发现页的头部
                this.setState({
                    headData:b.splice(0,3)
                });
                if (b.length > count) {
                    b = b.slice(0, count - 1);
                    //更多
                    let more = { unitIcon3x: 'bg_home_second', unitName: '更多' };
                    b.push(more);
                }
            }
            let a = { data: [b], key: object.blockTitle };
            datas.push(a);
        }
        this.allData = allData;
        return datas;
    }

    _renderPage(data, pageID) {
        return(
            <TouchableOpacity style={styles.touchpage} onPress={() => this._onPageClick(pageID)} underlayColor="transparent">
                <Image style={styles.page} source={data}/>
            </TouchableOpacity>
        );
    }

    _onPageClick(pageID) {
        var discoveryNativeModule = NativeModules.RNDiscoveryReactModule;
        if (pageID === '0') {
            discoveryNativeModule.gotoNewsPage();
        } else if (pageID === '1') {
            discoveryNativeModule.gotoWeatherRecomm();
        }
    }

    // list里的单个行
    _renderItem = ({item, index}) => {
        return (
            <View style={styles.list}>
                {item.map( (ite, i) => this.renderExpenseItem(ite, i) )}
            </View>
            // <View style={{width: 50, height: 50, backgroundColor: '#FF0000'}} />

        )
    }

    // list单个行里的单个项目
    renderExpenseItem(item, i) {
        return(
            // <Image source={require('./../imgs/ic_search_nearby.png')} style={{ width: 30, height: 30, marginBottom: 12}} />
            <TouchableOpacity key={i} onPress={() => this._pressRow(item)} underlayColor="transparent">
                <View style={styles.row}>
                    <Image source={item.unitIcon3x} style={{ width: 30, height: 30, marginBottom: 12}} />
                    <Text style={{ fontSize: 13, color: '#333333' }}>{item.unitName}</Text>
                </View>
            </TouchableOpacity>
        );
    }

    _pressRow(item) {
        var discoveryNativeModule = NativeModules.RNDiscoveryReactModule;
        if (item.unitName === '周边足球场') {
            discoveryNativeModule.gotoSearchNearby();
        } else if (item.unitName === '自定义赛程') {
            discoveryNativeModule.gotoCustomizeRacePage();
        } else if (item.unitName === '点球游戏') {
            discoveryNativeModule.gotoUSoccerGame();
        }
    }

    _renderSectionHeader = ({ section }) => {
        var key = section;
        return (
            <View style={styles.sectionHeader}>
                <View style={{ width: 3, height: 14, backgroundColor: '#cd8c00' }}></View>
                <Text style={{ fontSize: 15, color: '#333333', marginLeft: 12 }}>尝鲜功能</Text>
            </View>
        );
    }

    _extraUniqueKey(item, index) {
        return "index" + index + item;
    }

    /**
        dataSource: 提供页面数据,
        renderPage: 用于渲染页面视图,
        autoPlay: 为true 将自动播放,
        isLoop: 为true支持循环播放,
        locked: 为true禁止触摸滚动,
        onChangePage: 页面变化的回调,
        renderPageIndicator: 渲染自定义的 ViewPager indicator.
    */
    render() {
        return (
            <View style={styles.parent}>
                <View style={styles.viewpagecontainer}>
                    <ViewPager
                        style={{height:130}}
                        dataSource={this.state.dataSource}
                        renderPage={this._renderPage.bind(this)}
                        isLoop={true}
                        autoPlay={true} />
                </View>
                <View style={{flex: 1, width: ScreenWidth, height: ScreenHeight, backgroundColor: '#FFFFFF'}}>
                    <SectionList
                        renderItem = {this._renderItem}
                        //pageSize={3}  // 配置pageSize确认网格数量
                        //contentContainerStyle={styles.list}
                        renderSectionHeader={this._renderSectionHeader}
                        keyExtractor={this._extraUniqueKey} // 每个item的key
                        sections={this.state.griddataSource}
                    />
                </View>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    flex: {
        flex: 1
    },
    parent: {
        flex: 1,
        flexDirection: 'column',
        backgroundColor: '#FFFFFF',
    },
    parentstyle: {
        flexDirection: 'column',
        flex: 1,
        backgroundColor: 'white',
    },
    viewpagecontainer: {
        height: 130,
        flexDirection: 'row',
        alignItems: 'flex-start',
        backgroundColor: '#999999',
    },
    touchpage: {
        width: ScreenWidth,
        flex: 1,
        height: 130,
    },
    page: {
        width: ScreenWidth,
        flex: 1,
        height: 130,
        resizeMode: 'stretch'
    },
    list: {
        //justifyContent: 'space-around',
        flexDirection: 'row',
        flexWrap: 'wrap', // 设置换行显示
        alignItems: 'flex-start',
        backgroundColor: '#FFFFFF'
    },
    row: {
        backgroundColor: '#FFFFFF',
        justifyContent: 'center',
        width: (ScreenWidth) / 3,
        height: (ScreenWidth) / 3 * 98/125,
        alignItems: 'center',
        //borderWidth: 0.5,
        borderRightWidth: 0.6,
        borderBottomWidth: 0.6,
        // borderRadius: 5,
        borderColor: '#E8E8E8'
    },
    icon: {
        width: 130,
        height: 130,
    },
    sectionHeader: {
        flexDirection: 'row',
        flex: 1,
        height: 35,
        backgroundColor: '#f2f2f2',
        alignItems: 'center',
        //borderTopWidth: 0.4,
        //borderBottomWidth: 1,
        borderColor: '#E8E8E8'
    },
});


text:
package scala.collection.immutable

import org.junit.Assert.{assertEquals, assertFalse, assertSame, assertTrue}
import org.junit.{Assert, Test}

object ChampMapSmokeTest {

  private def emptyMap[K, V]: HashMap[K, V] =
    HashMap.empty[K, V]

  private def mapOf[K, V](keyValuePairs: (K, V)*): HashMap[K, V] = {
    val builder = HashMap.newBuilder[K, V]
    keyValuePairs.foreach(builder.addOne)
    builder.result()
  }

  def mkTuple[KV](keyValue: KV): (KV, KV) = keyValue -> keyValue

  def mkTuple[K, V](key: K, value: V): (K, V) = key -> value

  def mkValue(value: Int) = new CustomHashInt(value, value)

  def mkValue(value: Int, hash: Int) = new CustomHashInt(value, hash)

}

class ChampMapSmokeTest {

  import ChampMapSmokeTest._

  val v11h1 = mkValue(11, 1)
  val v12h1 = mkValue(12, 1)

  val v1h1 = mkValue(1, 1)
  val v5h5 = mkValue(5, 5)

  val v32769 = mkValue(32769, 32769)
  val v32769a = mkValue(32769*10+1, 32769)
  val v32769b = mkValue(32769*10+2, 32769)

  @Test def testCheckPrefixConstruction(): Unit = {
    val map: HashMap[Int, Int] = emptyMap

    val res1 = map + mkTuple(63) + mkTuple(64) + mkTuple(32768) + mkTuple(2147483647) + mkTuple(65536)
    assert(res1.contains(63))
    assert(res1.contains(64))
    assert(res1.contains(32768))
    assert(res1.contains(65536))
    assert(res1.contains(2147483647))

    val res2 = map + mkTuple(2147483647) + mkTuple(32768) + mkTuple(63) + mkTuple(64) + mkTuple(65536)
    assert(res2.contains(63))
    assert(res2.contains(64))
    assert(res2.contains(32768))
    assert(res2.contains(65536))
    assert(res2.contains(2147483647))

    assert(res1 == res2)
  }

  @Test def testCheckCompactionFromBeginUponDelete(): Unit = {
    val map: HashMap[Int, Int] = emptyMap
    val res1 = map + mkTuple(1) + mkTuple(2)
    @annotation.unused val res2 = res1 + mkTuple(32769) - 2
    /* should trigger assertion in data structure if not compacting */
  }

  @Test def testCheckCompactionFromMiddleUponDelete(): Unit = {
    val map: HashMap[Int, Int] = emptyMap
    val res1 = map + mkTuple(1) + mkTuple(2) + mkTuple(65) + mkTuple(66)
    val res2 = res1 + mkTuple(32769) - 66
    assert(!(res1 == res2))
  }

  @Test def testCheckCompactionFromBeginUponDelete_HashCollisionNode1(): Unit = {
    val map: HashMap[CustomHashInt, CustomHashInt] = emptyMap

    val res1 = map + mkTuple(v11h1) + mkTuple(v12h1)
    assertTrue(res1.contains(v11h1))
    assertTrue(res1.contains(v12h1))

    val res2 = res1 - v12h1
    assertTrue(res2.contains(v11h1))
    assertEquals(mapOf() + mkTuple(v11h1), res2)

    val res3 = res1 - v11h1
    assertTrue(res3.contains(v12h1))
    assertEquals(mapOf() + mkTuple(v12h1, v12h1), res3)

    val resX = res1 + mkTuple(v32769) - v12h1
    assertTrue(resX.contains(v11h1))
    assertTrue(resX.contains(v32769))
    assert(!(res1 == resX))
  }

  @Test def testCheckCompactionFromBeginUponDelete_HashCollisionNode2(): Unit = {
    val map: HashMap[CustomHashInt, CustomHashInt] = emptyMap

    val res1 = map + mkTuple(v32769a) + mkTuple(v32769b)
    assertEquals(2, res1.size)
    assertTrue(res1.contains(v32769a))
    assertTrue(res1.contains(v32769b))

    val res2 = res1 + mkTuple(v1h1)
    assertEquals(3, res2.size)
    assertTrue(res2.contains(v1h1))
    assertTrue(res2.contains(v32769a))
    assertTrue(res2.contains(v32769b))

    val res3 = res2 - v32769b
    assertEquals(2, res3.size)
    assertTrue(res3.contains(v1h1))
    assertTrue(res3.contains(v32769a))
    println(scala.runtime.ScalaRunTime.getClass.getProtectionDomain.getCodeSource)
    val expected = mapOf(mkTuple(v1h1), mkTuple(v32769a))
    assertEquals(expected, res3)
  }

  @Test def testCheckCompactionFromBeginUponDelete_HashCollisionNode3(): Unit = {
    val map: HashMap[CustomHashInt, CustomHashInt] = emptyMap
    val res1 = map + mkTuple(v32769a) + mkTuple(v32769b)
    assertEquals(2, res1.size)
    assertTrue(res1.contains(v32769a))
    assertTrue(res1.contains(v32769b))

    val res2 = res1 + mkTuple(v1h1)
    assertEquals(3, res2.size)
    assertTrue(res2.contains(v1h1))
    assertTrue(res2.contains(v32769a))
    assertTrue(res2.contains(v32769b))

    val res3 = res2 - v1h1
    assertEquals(2, res3.size)
    assertTrue(res3.contains(v32769a))
    assertTrue(res3.contains(v32769b))
    assertEquals(res1, res3)
  }

  @Test def testCheckCompactionFromBeginUponDelete_HashCollisionNode4(): Unit = {
    val map: HashMap[CustomHashInt, CustomHashInt] = emptyMap
    val res1 = map + mkTuple(v32769a) + mkTuple(v32769b)
    assertEquals(2, res1.size)
    assertTrue(res1.contains(v32769a))
    assertTrue(res1.contains(v32769b))

    val res2 = res1 + mkTuple(v5h5)
    assertEquals(3, res2.size)
    assertTrue(res2.contains(v5h5))
    assertTrue(res2.contains(v32769a))
    assertTrue(res2.contains(v32769b))

    val res3 = res2 - v5h5
    assertEquals(2, res3.size)
    assertTrue(res3.contains(v32769a))
    assertTrue(res3.contains(v32769b))
    assertEquals(res1, res3)
  }

  @Test def testCreateSingletonWithFactoryMethod(): Unit = {
    val map: HashMap[Int, Int] = emptyMap + mkTuple(63, 65)
    assertTrue(map.contains(63))
    assertEquals(65, map.get(63).get)
  }

  @Test def testRemoveFromSingleton(): Unit = {
    val map: HashMap[Int, Int] = emptyMap + mkTuple(63, 65)
    val res = map - 63
    assertTrue(res.isEmpty)
    assertFalse(res.contains(63))
    assertEquals(emptyMap, res)
  }

  object O1 { override def hashCode = 1 ; override def toString = "O1"}
  class C(val i: Int) { override def hashCode = i % 4 ; override def toString = s"C($i)" }
  val cs = Array.tabulate(4096)(new C(_))

  private def assertSameEqHash(expected: HashMap[Any, Any], actual: HashMap[Any, Any]) = {
    assertEquals(List.from(actual).size, actual.size)
    assertEquals(expected.size, actual.size)
    assertEquals(expected.rootNode.cachedJavaKeySetHashCode, actual.rootNode.cachedJavaKeySetHashCode)
    assertEquals(expected.hashCode(), actual.hashCode())
  }

  private def value(i: Int) = new String("" + i)

  @Test def testCachedSizeAndHashCode(): Unit = {
    var map: HashMap[Any, Any] = emptyMap + mkTuple(O1, "O1_V1")
    assertEquals(1, map.size)
    map = map + mkTuple(O1, "O1_V2")
    val expected: HashMap[Any, Any] = emptyMap + mkTuple(O1, "O1_V2")
    assertSameEqHash(expected, map)
  }

  @Test def testCachedSizeAndHashCodeCollision(): Unit = {
    var map: HashMap[Any, Any] = emptyMap
    for (c <- cs)
      map = map.updated(c, value(c.i))
    var map1 = map
    for (c <- cs) {
      map1 = map1.updated(c, value(c.i))
      assertEquals(map.rootNode.cachedJavaKeySetHashCode, map1.rootNode.cachedJavaKeySetHashCode)
      if (c.i % 41 == 0)
        assertEquals(map, map1)
    }
    assertEquals(map, map1)
    assertSameEqHash(map1, map)

    var map2 = map + mkTuple(O1, "O1_V2")
    map2 = map2 +  mkTuple(O1, "O1_V2")
    assertSameEqHash(map1 + mkTuple(O1, "O1_V2"), map2)
  }

  @Test def replacedValue(): Unit = {
    val s1, s2 = new String("s") // equals, but distinct references,
    val key = "k"
    var map = emptyMap[Any, Any].updated(key, s1).updated(key, s2)
    Assert.assertSame(s2, map.apply(key))
    class collision() { override def hashCode = key.hashCode}
    for (i <- (0 to 1024)) map = map.updated(new collision(), "")
    Assert.assertSame(s1, map.updated(key, s1).apply(key))
  }

  @Test def replacedValueIdentical(): Unit = {
    case class A(a: Int)
    val map = emptyMap[Any, Any]
    val a = A(1)
    val map1 = map.updated(1, a)
    val map2 = map1.updated(1, a)
    assertSame(map1, map2)
  }

  @Test def replacedValueIdenticalCollision(): Unit = {
    val k0 = new C(0)
    val k1 = new C(4)
    assertEquals(k0.hashCode, k1.hashCode)
    val map = emptyMap[Any, Any].updated(k0, 0)
    val v1 = "v1"
    val map1 = map.updated(k1, v1)
    val map2 = map1.updated(k1, v1)
    assertSame(map1, map2)
  }

  @Test def nullValue(): Unit = {
    val map = emptyMap[Any, Any]
    assertEquals(Some(null), map.updated("", null).get(""))
  }

  @Test def nullValueCollision(): Unit = {
    val k0 = new C(0)
    val k1 = new C(4)
    assertEquals(k0.hashCode, k1.hashCode)
    val map = emptyMap[Any, Any].updated(k0, 0).updated(k1, null)
    assertEquals(Some(null), map.get(k1))
  }

  @Test def hashCodeCheck(): Unit = {
    assertEquals(2098967416, collection.immutable.HashMap(1 -> 2).hashCode())
  }
}


text:
/*
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.comcast.cdn.traffic_control.traffic_router.core.ds;

import com.comcast.cdn.traffic_control.traffic_router.core.cache.CacheRegister;
import com.comcast.cdn.traffic_control.traffic_router.core.util.AbstractResourceWatcher;
import org.apache.log4j.Logger;

import java.util.ArrayList;
import java.util.List;

public class SteeringWatcher extends AbstractResourceWatcher {
	private static final Logger LOGGER = Logger.getLogger(SteeringWatcher.class);
	private SteeringRegistry steeringRegistry;
	private CacheRegister cacheRegister;

	public static final String DEFAULT_STEERING_DATA_URL = "https://${toHostname}/internal/api/1.2/steering.json";

	public SteeringWatcher() {
		setDatabaseUrl(DEFAULT_STEERING_DATA_URL);
	}

	public void setCacheRegister(final CacheRegister cacheRegister) {
		this.cacheRegister = cacheRegister;
	}

	@Override
	public boolean useData(final String data) {
		try {
			steeringRegistry.update(data);
			if (cacheRegister != null) {
				final List<String> invalidOnes = new ArrayList<String>();

				for (final Steering steering : steeringRegistry.getAll()) {
					if (cacheRegister.getDeliveryService(steering.getDeliveryService()) == null) {
						LOGGER.warn("Steering data from " + dataBaseURL + " contains delivery service id reference '" + steering.getDeliveryService() + "' that's not in cr-config");
						invalidOnes.add(steering.getDeliveryService());
					}
				}

				steeringRegistry.removeAll(invalidOnes);
			}

			return true;
		} catch (Exception e) {
			LOGGER.warn("Failed updating steering registry with data from " + dataBaseURL);
		}

		return false;
	}

	@Override
	protected boolean verifyData(final String data) {
		try {
			return steeringRegistry.verify(data);
		} catch (Exception e) {
			LOGGER.warn("Failed to build steering data while verifying");
		}

		return false;
	}

	@Override
	public String getWatcherConfigPrefix() {
		return "steeringmapping";
	}

	public void setSteeringRegistry(final SteeringRegistry steeringRegistry) {
		this.steeringRegistry = steeringRegistry;
	}
}


text:
var config = require('../../config');
var fromYear = parseInt(config.crawlFromYear);
var toYear = parseInt(config.crawlToYear);

async function start() {
  for (var i = fromYear; i <= toYear; i++) {
    var year = i;
    console.log("Start crawling " + year + " year.");

    var pageCrawler = require('./pagecrawler.js');
    var resultPageCrawler = require('./resultpagecrawler.js');
    var resultCrawler = require('./resultcrawler.js');
    var saveToDB = require('./saveToDB.js');

    var pageCrawlerResult;

    await pageCrawler.start(year).then(function(result) {
        console.log("Crawled " + result.length + " cyclists for year " + year);
        pageCrawlerResult = result;
        if (result.length == 0) {
          console.log("End as no result could be crawled.");
          process.exit();
        }
        return resultPageCrawler.start(result, year);
      })
      .then(function(result) {
        console.log("Crawled " + result.length + " result pages for year " + year);
        return resultCrawler.start(result, pageCrawlerResult, year);
      })
      .then(function(result) {
        console.log("Crawled " + result.length + " results for year " + year);
        return saveToDB.start(result, year);
      });

    console.log("Finished crawling " + year + " year.");
  }
  console.log("Complete crawling finished - uff ;)...");
  process.exit();
}

start();

process.stdin.resume(); //so the program will not close instantly

function exitHandler(options, exitCode) {
  if (options.cleanup) console.log('clean');
  if (exitCode || exitCode === 0) console.log(exitCode);
  if (options.exit) process.exit();
}

//do something when app is closing
process.on('exit', exitHandler.bind(null, {
  cleanup: true
}));

//catches ctrl+c event
process.on('SIGINT', exitHandler.bind(null, {
  exit: true
}));

// catches "kill pid" (for example: nodemon restart)
process.on('SIGUSR1', exitHandler.bind(null, {
  exit: true
}));
process.on('SIGUSR2', exitHandler.bind(null, {
  exit: true
}));

//catches uncaught exceptions
process.on('uncaughtException', function(err) {
  console.error((new Date).toUTCString() + ' uncaughtException:', err.message)
  console.error(err.stack)
  //process.exit(1)
});

process.on('unhandledRejection', (reason, p) => {
  console.log("Unhandled Rejection at: Promise ", p, " reason: ", reason);
  // application specific logging, throwing an error, or other logic here
});


text:
<?php

namespace League\Markdown\Reference;

/**
 * A collection of references, indexed by label
 */
class ReferenceMap
{
    /**
     * @var Reference[]
     */
    protected $references = array();

    /**
     * @param Reference $reference
     *
     * @return $this
     */
    public function addReference(Reference $reference)
    {
        $key = Reference::normalizeReference($reference->getLabel());
        $this->references[$key] = $reference;

        return $this;
    }

    /**
     * @param string $label
     *
     * @return bool
     */
    public function contains($label)
    {
        $label = Reference::normalizeReference($label);

        return isset($this->references[$label]);
    }

    /**
     * @param string $label
     *
     * @return Reference|null
     */
    public function getReference($label)
    {
        $label = Reference::normalizeReference($label);

        if (isset($this->references[$label])) {
            return $this->references[$label];
        } else {
            return null;
        }
    }
}


text:
package jsonrpc

import (
	"context"
	"net/http"
)

// HandlerFunc provides basic JSON-RPC handling.
func HandlerFunc(w http.ResponseWriter, r *http.Request) {

	rs, batch, err := ParseRequest(r)
	if err != nil {
		SendResponse(w, []*Response{
			{
				Version: Version,
				Error:   err,
			},
		}, false)
		return
	}

	c := r.Context()
	resp := make([]*Response, len(rs))
	for i := range rs {
		resp[i] = invokeMethod(c, rs[i])
	}

	if err := SendResponse(w, resp, batch); err != nil {
		w.WriteHeader(http.StatusInternalServerError)
	}
}

func invokeMethod(c context.Context, r *Request) *Response {
	var h Handler
	res := NewResponse(r)
	h, res.Error = TakeMethod(r)
	if res.Error != nil {
		return res
	}
	res.Result, res.Error = h.ServeJSONRPC(WithRequestID(c, r.ID), r.Params)
	if res.Error != nil {
		res.Result = nil
	}
	return res
}


text:
package org.teatrove.teaadmin.viewer;

public interface TemplateViewerContext {

    String[] findTemplates(String term);

    Parent[] getParents(String parent);

    TemplateView[] getTemplateViews();

    void resetTemplateViews();

    boolean resetTemplateView(String name);

    TemplateView getTemplateView(String parent, String name)
        throws Exception;
}


text:
package dab.server.world.zone;

import dab.server.Server;
import dab.server.world.tile.TileLocation;
/**
 * initializes blocks and teleporters for
 * the start zone extending abstract zone class
 *
 * @author Cristopher Huerta
 */
public class StartZone extends Zone
{
	/**
	* constructor handles initialization of zone
	 */
	public StartZone()
	{
		super();

		setID("dab:zone:start");//set id of zone

		// add ground and top layer
		for (int x = 0; x < 32; ++x)
		{
			addTile(Server.getTileRegistry().get("dab:tile:solid"), x, 0);
			addTile(Server.getTileRegistry().get("dab:tile:solid"), x, 24);
		}

		//add telporter to left size cave zone
		TileLocation leftSideDest = new TileLocation("dab:zone:cave", 11, 1);
		for (int y = 0; y < 24; ++y)
		{
			addTile(Server.getTileRegistry().get("dab:tile:teleporter"), -1, y);
			addTeleporter(new TileLocation(getID(), -1, y), leftSideDest);
		}

		//add telporter to right night zone
		TileLocation rightSideDest = new TileLocation("dab:zone:night", 0, 1);
		for (int y = 0; y < 24; ++y)
		{
			addTile(Server.getTileRegistry().get("dab:tile:teleporter"), 32, y);
			addTeleporter(new TileLocation(getID(), 32, y), rightSideDest);
		}
	}
}


text: My Rainmeter themes repository.


text:
var definitions, handler, mutate, on_action, utils;

on_action = function({config}) {
  if (config.egrep != null) {
    throw Error('Deprecated config `egrep`');
  }
};

// ## Schema definitions
definitions = {
  config: {
    type: 'object',
    properties: {
      'admin': {
        type: 'object',
        properties: {
          'realm': {
            type: 'string',
            description: `The realm the principal belongs to.`
          },
          'principal': {
            type: 'string',
            description: `KAdmin principal name unless \`kadmin.local\` is used.`
          },
          'server': {
            type: 'string',
            description: `Address of the kadmin server; optional, use "kadmin.local" if
missing.`
          },
          'password': {
            type: 'string',
            description: `Password associated to the KAdmin principal.`
          }
        }
      },
      'command': {
        type: 'string',
        description: `            `
      },
      'grep': {
        oneOf: [
          {
            type: 'string'
          },
          {
            instanceof: 'RegExp'
          }
        ],
        description: `Ensure the execute output match a string or a regular expression.`
      }
    },
    required: ['admin', 'command']
  }
};

// ## Handler
handler = async function({config}) {
  var realm, stdout;
  realm = config.admin.realm ? `-r ${config.admin.realm}` : '';
  ({stdout} = (await this.execute({
    command: config.admin.principal ? `kadmin ${realm} -p ${config.admin.principal} -s ${config.admin.server} -w ${config.admin.password} -q '${config.command}'` : `kadmin.local ${realm} -q '${config.command}'`
  })));
  if (config.grep && typeof config.grep === 'string') {
    return {
      stdout: stdout,
      $status: stdout.split('\n').some(function(line) {
        return line === config.grep;
      })
    };
  }
  if (config.grep && utils.regexp.is(config.grep)) {
    return {
      stdout: stdout,
      $status: stdout.split('\n').some(function(line) {
        return config.grep.test(line);
      })
    };
  }
  return {
    $status: true,
    stdout: stdout
  };
};

// ## Exports
module.exports = {
  handler: handler,
  hooks: {
    on_action: on_action
  },
  metadata: {
    global: 'krb5',
    definitions: definitions
  }
};

// ## Dependencies
({mutate} = require('mixme'));

utils = require('@nikitajs/core/lib/utils');


text:
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.javascript;

/**
 * This class implements the Number native object.
 *
 * See ECMA 15.7.
 *
 * @author Norris Boyd
 */
final class NativeNumber extends IdScriptableObject
{
    static final long serialVersionUID = 3504516769741512101L;

    private static final Object NUMBER_TAG = "Number";

    private static final int MAX_PRECISION = 100;
    private static final double MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
    private static final double MIN_SAFE_INTEGER = -MAX_SAFE_INTEGER;

    static void init(Scriptable scope, boolean sealed)
    {
        NativeNumber obj = new NativeNumber(0.0);
        obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
    }

    NativeNumber(double number)
    {
        doubleValue = number;
    }

    @Override
    public String getClassName()
    {
        return "Number";
    }

    @Override
    protected void fillConstructorProperties(IdFunctionObject ctor)
    {
        final int attr = ScriptableObject.DONTENUM |
                         ScriptableObject.PERMANENT |
                         ScriptableObject.READONLY;

        ctor.defineProperty("NaN", ScriptRuntime.NaNobj, attr);
        ctor.defineProperty("POSITIVE_INFINITY",
                            ScriptRuntime.wrapNumber(Double.POSITIVE_INFINITY),
                            attr);
        ctor.defineProperty("NEGATIVE_INFINITY",
                            ScriptRuntime.wrapNumber(Double.NEGATIVE_INFINITY),
                            attr);
        ctor.defineProperty("MAX_VALUE",
                            ScriptRuntime.wrapNumber(Double.MAX_VALUE),
                            attr);
        ctor.defineProperty("MIN_VALUE",
                            ScriptRuntime.wrapNumber(Double.MIN_VALUE),
                            attr);
        ctor.defineProperty("MAX_SAFE_INTEGER",
                            ScriptRuntime.wrapNumber(MAX_SAFE_INTEGER),
                            attr);
        ctor.defineProperty("MIN_SAFE_INTEGER",
                            ScriptRuntime.wrapNumber(MIN_SAFE_INTEGER),
                            attr);

        addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_isFinite, "isFinite", 1);
        addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_isNaN, "isNaN", 1);
        addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_isInteger, "isInteger", 1);
        addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_isSafeInteger, "isSafeInteger", 1);
        addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_parseFloat, "parseFloat", 1);
        addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_parseInt, "parseInt", 1);

        super.fillConstructorProperties(ctor);
    }

    @Override
    protected void initPrototypeId(int id)
    {
        String s;
        int arity;
        switch (id) {
          case Id_constructor:    arity=1; s="constructor";    break;
          case Id_toString:       arity=1; s="toString";       break;
          case Id_toLocaleString: arity=1; s="toLocaleString"; break;
          case Id_toSource:       arity=0; s="toSource";       break;
          case Id_valueOf:        arity=0; s="valueOf";        break;
          case Id_toFixed:        arity=1; s="toFixed";        break;
          case Id_toExponential:  arity=1; s="toExponential";  break;
          case Id_toPrecision:    arity=1; s="toPrecision";    break;
          default: throw new IllegalArgumentException(String.valueOf(id));
        }
        initPrototypeMethod(NUMBER_TAG, id, s, arity);
    }

    @Override
    public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope,
                             Scriptable thisObj, Object[] args)
    {
        if (!f.hasTag(NUMBER_TAG)) {
            return super.execIdCall(f, cx, scope, thisObj, args);
        }
        int id = f.methodId();
        if (id == Id_constructor) {
            double val = (args.length >= 1)
                ? ScriptRuntime.toNumber(args[0]) : 0.0;
            if (thisObj == null) {
                // new Number(val) creates a new Number object.
                return new NativeNumber(val);
            }
            // Number(val) converts val to a number value.
            return ScriptRuntime.wrapNumber(val);

        } else if (id < Id_constructor) {
            return execConstructorCall(id, args);
        }

        // The rest of Number.prototype methods require thisObj to be Number

        if (!(thisObj instanceof NativeNumber))
            throw incompatibleCallError(f);
        double value = ((NativeNumber)thisObj).doubleValue;

        switch (id) {

          case Id_toString:
          case Id_toLocaleString:
            {
                // toLocaleString is just an alias for toString for now
                int base = (args.length == 0 || args[0] == Undefined.instance)
                    ? 10 : ScriptRuntime.toInt32(args[0]);
                return ScriptRuntime.numberToString(value, base);
            }

          case Id_toSource:
            return "(new Number("+ScriptRuntime.toString(value)+"))";

          case Id_valueOf:
            return ScriptRuntime.wrapNumber(value);

          case Id_toFixed:
            return num_to(value, args, DToA.DTOSTR_FIXED,
                          DToA.DTOSTR_FIXED, -20, 0);

          case Id_toExponential: {
              // Handle special values before range check
              if(Double.isNaN(value)) {
                  return "NaN";
              }
              if(Double.isInfinite(value)) {
                  if(value >= 0) {
                      return "Infinity";
                  }
                  else {
                      return "-Infinity";
                  }
              }
              // General case
              return num_to(value, args, DToA.DTOSTR_STANDARD_EXPONENTIAL,
                      DToA.DTOSTR_EXPONENTIAL, 0, 1);
          }

          case Id_toPrecision: {
              // Undefined precision, fall back to ToString()
              if(args.length == 0 || args[0] == Undefined.instance) {
                  return ScriptRuntime.numberToString(value, 10);
              }
              // Handle special values before range check
              if(Double.isNaN(value)) {
                  return "NaN";
              }
              if(Double.isInfinite(value)) {
                  if(value >= 0) {
                      return "Infinity";
                  }
                  else {
                      return "-Infinity";
                  }
              }
              return num_to(value, args, DToA.DTOSTR_STANDARD,
                      DToA.DTOSTR_PRECISION, 1, 0);
          }

          default: throw new IllegalArgumentException(String.valueOf(id));
        }
    }

    private Object execConstructorCall(int id, Object[] args)
    {
        switch (id) {
        case ConstructorId_isFinite:
            if ((args.length == 0) || (Undefined.instance == args[0])) {
                return false;
            }
            if (args[0] instanceof Number) {
                // Match ES6 polyfill, which only works for "number" types
                return isFinite(args[0]);
            }
            return false;

        case ConstructorId_isNaN:
            if ((args.length == 0) || (Undefined.instance == args[0])) {
                return false;
            }
            if (args[0] instanceof Number) {
                return isNaN((Number)args[0]);
            }
            return false;

        case ConstructorId_isInteger:
            if ((args.length == 0) || (Undefined.instance == args[0])) {
                return false;
            }
            if (args[0] instanceof Number) {
                return isInteger((Number)args[0]);
            }
            return false;

        case ConstructorId_isSafeInteger:
            if ((args.length == 0) || (Undefined.instance == args[0])) {
                return false;
            }
            if (args[0] instanceof Number) {
                return isSafeInteger((Number)args[0]);
            }
            return false;

        case ConstructorId_parseFloat:
            return NativeGlobal.js_parseFloat(args);

        case ConstructorId_parseInt:
            return NativeGlobal.js_parseInt(args);

        default:
            throw new IllegalArgumentException(String.valueOf(id));
        }
    }

    @Override
    public String toString() {
        return ScriptRuntime.numberToString(doubleValue, 10);
    }

    private static String num_to(double val,
                                 Object[] args,
                                 int zeroArgMode, int oneArgMode,
                                 int precisionMin, int precisionOffset)
    {
        int precision;
        if (args.length == 0) {
            precision = 0;
            oneArgMode = zeroArgMode;
        } else {
            /* We allow a larger range of precision than
               ECMA requires; this is permitted by ECMA. */
            double p = ScriptRuntime.toInteger(args[0]);
            if (p < precisionMin || p > MAX_PRECISION) {
                String msg = ScriptRuntime.getMessage1(
                    "msg.bad.precision", ScriptRuntime.toString(args[0]));
                throw ScriptRuntime.constructError("RangeError", msg);
            }
            precision = ScriptRuntime.toInt32(p);
        }
        StringBuilder sb = new StringBuilder();
        DToA.JS_dtostr(sb, oneArgMode, precision + precisionOffset, val);
        return sb.toString();
    }

    static Object isFinite(Object val)
    {
        double d = ScriptRuntime.toNumber(val);
        Double nd = Double.valueOf(d);
        return ScriptRuntime.wrapBoolean(!nd.isInfinite() && !nd.isNaN());
    }

    private Object isNaN(Number val)
    {
        Double nd = doubleVal(val);
        return ScriptRuntime.toBoolean(isDoubleNan(nd));
    }

    private boolean isDoubleNan(Double d)
    {
        return d.isNaN();
    }

    private boolean isInteger(Number val)
    {
        Double nd = doubleVal(val);
        return ScriptRuntime.toBoolean(isDoubleInteger(nd));
    }

    private boolean isDoubleInteger(Double d)
    {
        return (!d.isInfinite() && !d.isNaN() &&
                (Math.floor(d.doubleValue()) == d.doubleValue()));
    }

    private boolean isSafeInteger(Number val)
    {
        Double nd = doubleVal(val);
        return ScriptRuntime.toBoolean(isDoubleSafeInteger(nd));
    }

    private boolean isDoubleSafeInteger(Double d)
    {
        return (isDoubleInteger(d) &&
                (d.doubleValue() <= MAX_SAFE_INTEGER) &&
                (d.doubleValue() >= MIN_SAFE_INTEGER));
    }

    private Double doubleVal(Number val)
    {
        if (val instanceof Double) {
            return (Double)val;
        } else {
            double d = val.doubleValue();
            return Double.valueOf(d);
        }
    }

// #string_id_map#

    @Override
    protected int findPrototypeId(String s)
    {
        int id;
// #generated# Last update: 2007-05-09 08:15:50 EDT
        L0: { id = 0; String X = null; int c;
            L: switch (s.length()) {
            case 7: c=s.charAt(0);
                if (c=='t') { X="toFixed";id=Id_toFixed; }
                else if (c=='v') { X="valueOf";id=Id_valueOf; }
                break L;
            case 8: c=s.charAt(3);
                if (c=='o') { X="toSource";id=Id_toSource; }
                else if (c=='t') { X="toString";id=Id_toString; }
                break L;
            case 11: c=s.charAt(0);
                if (c=='c') { X="constructor";id=Id_constructor; }
                else if (c=='t') { X="toPrecision";id=Id_toPrecision; }
                break L;
            case 13: X="toExponential";id=Id_toExponential; break L;
            case 14: X="toLocaleString";id=Id_toLocaleString; break L;
            }
            if (X!=null && X!=s && !X.equals(s)) id = 0;
            break L0;
        }
// #/generated#
        return id;
    }

    private static final int
        ConstructorId_isFinite       = -1,
        ConstructorId_isNaN          = -2,
        ConstructorId_isInteger      = -3,
        ConstructorId_isSafeInteger  = -4,
        ConstructorId_parseFloat     = -5,
        ConstructorId_parseInt       = -6,

        Id_constructor           = 1,
        Id_toString              = 2,
        Id_toLocaleString        = 3,
        Id_toSource              = 4,
        Id_valueOf               = 5,
        Id_toFixed               = 6,
        Id_toExponential         = 7,
        Id_toPrecision           = 8,
        MAX_PROTOTYPE_ID         = 8;

// #/string_id_map#

    private double doubleValue;
}


text:
New-Grid -Columns ('Auto', '1*') -Rows ('1*','Auto') -Resource @{
    'Import-ModuleData' = {
        $modules = @(Get-Module) + @(Get-Module -ListAvailable) |
            Select-Object Name, Path, ExportedCommands -Unique |
            Sort-Object Name
        foreach ($m in $modules) {
            New-TreeViewItem -Header $m.Name -DataContext $m -ItemsSource @(
                $m.ExportedCommands.Values | Sort-Object Name
            )
        }
    }
} {
    New-TreeView -FontSize 24 -Name ModuleTree -On_loaded {
        ${Import-ModuleData} | Add-ChildControl -parent $this -Clear
    } -On_SelectedItemChanged {
        $remove.IsEnabled = -not ($this.SelectedItem -is [Management.Automation.CommandInfo])
        $ShowHelp.IsEnabled = ($this.SelectedItem -is [Management.Automation.CommandInfo])
    }
    New-UniformGrid -Row 1 -ColumnSpan 2 -Columns 3 {
        New-Button -FontSize 18 -Row 1 -Name "Import" "_Import-Module" -On_Click {
            $name = $moduleTree.SelectedItem.Header
            Import-Module $name -Force -Global
            $null = $moduleTree.Items.Clear()
            ${Import-ModuleData} | Add-ChildControl -parent $moduleTree -Clear
        }
        New-Button -FontSize 18 -Row 1 -Column 1 -Name "Remove" "_Remove-Module" -On_Click {
            $name = $moduleTree.SelectedItem.Header
            Remove-Module $name -Force
            ${Import-ModuleData} | Add-ChildControl -parent $moduleTree -Clear
        }
        New-Button -FontSize 18 -Row 1 -Column 2 -Name "ShowHelp" "Get-_Help" -On_Click {

            $name = $moduleTree.SelectedItem.Name
            $helpContainer.Child = Show-Help $name
        }
    }

    New-Border -Name HelpContainer -Column 1
} -show


text:
/*
 * PlotterDB.java
 *
 * Created on June 15, 2006, 2:58 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.opensim.plotter;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import javax.swing.JFrame;
import org.opensim.utils.DialogUtils;
import org.opensim.view.motions.MotionsDB;
import org.opensim.view.pub.OpenSimDB;

/**
 *
 * @author Ayman
 *
 * Registry of opened Plotter windows so scripting users can access these windows
 * from Script to add or modify curves.
 */
public class PlotterDB {

    static PlotterDB instance;

    static ArrayList<JPlotterPanel>  plotters = new ArrayList<JPlotterPanel>();

    /** Creates a new instance of OpenSimDB */
    private PlotterDB() {
        instance = this;
    }

    public static synchronized PlotterDB getInstance() {
        if (instance == null) {
             instance = new PlotterDB();

        }
        return instance;
    }

    public void registerPlotterPanel(JPlotterPanel newPanel){
        plotters.add(newPanel);
    }

    public void unRegisterPlotterPanel(JPlotterPanel newPanel){
        plotters.remove(newPanel);
    }

    public JPlotterPanel getLastPlotterPanel() {
        if (plotters.size()>0) return plotters.get(plotters.size()-1);
        return null;
    }
    public JPlotterPanel createPlotterWindow() {
        final JPlotterPanel plotterPanel = new JPlotterPanel();

        JFrame f= DialogUtils.createFrameForPanel(plotterPanel, "Plotter");
        plotterPanel.setFrame(f);
        f.pack();
        f.setVisible(true);
        //registerPlotterPanel(plotterPanel);

        f.addWindowListener(new WindowAdapter(){
            @Override
           public void windowOpened(WindowEvent e) {
              MotionsDB.getInstance().addObserver(plotterPanel);
              OpenSimDB.getInstance().addObserver(plotterPanel);   // Make sure current model does not change under us
           }

            @Override
           public void windowClosing(WindowEvent e) {
              MotionsDB.getInstance().deleteObserver(plotterPanel);
              OpenSimDB.getInstance().deleteObserver(plotterPanel);
              unRegisterPlotterPanel(plotterPanel);
              plotterPanel.cleanup();
           }

            @Override
           public void windowClosed(WindowEvent e) {
              MotionsDB.getInstance().deleteObserver(plotterPanel);
              OpenSimDB.getInstance().deleteObserver(plotterPanel);
              unRegisterPlotterPanel(plotterPanel);
              plotterPanel.cleanup();
          }

      });
      return  plotterPanel;
    }
 }


text:
<?php

namespace App\PageBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * Page
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="App\PageBundle\Entity\PageRepository")
 */
class Page
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
    * @ORM\Column(name="name", type="text")
    *
    */
    private $name;

    /**
    * @ORM\OneToOne(targetEntity="App\SubsectionBundle\Entity\Box3", cascade={"persist"})
    * @ORM\JoinColumn(nullable=true)
    */
    private $main;

    /**
    * @ORM\OneToOne(targetEntity="App\SubsectionBundle\Entity\Box5", cascade={"persist"})
    * @ORM\JoinColumn(nullable=true)
    */
    private $sidebox;

    /**
     * @Gedmo\Slug(fields={"name"})
     * @ORM\Column(length=128, unique=true)
     */
    private $slug;

    /**
     * @var boolean
     *
     * @ORM\Column(name="active", type="boolean")
     */
    private $active;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set slug
     *
     * @param string $slug
     * @return Page
     */
    public function setSlug($slug)
    {
        $this->slug = $slug;

        return $this;
    }

    /**
     * Get slug
     *
     * @return string
     */
    public function getSlug()
    {
        return $this->slug;
    }

    /**
     * Set active
     *
     * @param boolean $active
     * @return Page
     */
    public function setActive($active)
    {
        $this->active = $active;

        return $this;
    }

    /**
     * Get active
     *
     * @return boolean
     */
    public function getActive()
    {
        return $this->active;
    }

    /**
     * Set main
     *
     * @param \App\SubsectionBundle\Entity\Box3 $main
     * @return Page
     */
    public function setMain(\App\SubsectionBundle\Entity\Box3 $main = null)
    {
        $this->main = $main;

        return $this;
    }

    /**
     * Get main
     *
     * @return \App\SubsectionBundle\Entity\Box3
     */
    public function getMain()
    {
        return $this->main;
    }

    /**
     * Set sidebox
     *
     * @param \App\SubsectionBundle\Entity\Box5 $sidebox
     * @return Page
     */
    public function setSidebox(\App\SubsectionBundle\Entity\Box5 $sidebox = null)
    {
        $this->sidebox = $sidebox;

        return $this;
    }

    /**
     * Get sidebox
     *
     * @return \App\SubsectionBundle\Entity\Box5
     */
    public function getSidebox()
    {
        return $this->sidebox;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Page
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
}


text:
using System;
namespace CompareFloats
{
    class CompareFloats
    {
        static void Main()
        {
            double a = double.Parse(Console.ReadLine());
            double b = double.Parse(Console.ReadLine());
            double eps = 0.000001;
            if (Math.Abs(a - b) < eps)
            {
                Console.WriteLine("true");
            }
            else
            {
                Console.WriteLine("false");
            }
        }
    }
}


text:
package org.osehra.vista.soa.rpc.codec;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelEvent;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;

import org.osehra.vista.soa.rpc.RpcResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RpcClientHandler extends SimpleChannelUpstreamHandler {
    private final static Logger LOG = LoggerFactory.getLogger(RpcClientHandler.class);

    private final BlockingQueue<RpcResponse> replies = new LinkedBlockingQueue<RpcResponse>();
    protected volatile Channel channel;

    public BlockingQueue<RpcResponse> getReplies() {
        return replies;
    }

    @Override
    public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
        if (e instanceof ChannelStateEvent) {
            LOG.debug(e.toString());
        }
        super.handleUpstream(ctx, e);
    }

    @Override
    public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        LOG.debug("Channel connected");
        super.channelConnected(ctx, e);
    }

    @Override
    public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        LOG.debug("Channel disconnected");
        super.channelConnected(ctx, e);
    }

    @Override
    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        LOG.debug("Channel open");
        channel = e.getChannel();
        super.channelOpen(ctx, e);
    }

    @Override
    public void messageReceived(ChannelHandlerContext ctx, final MessageEvent e) {
        LOG.debug("message received '{}'", e.getMessage());
/*
        // Offer the answer after closing the connection.
        e.getChannel().close().addListener(new ChannelFutureListener() {
            public void operationComplete(ChannelFuture future) {
                storeResponse(e);
            }
        });
*/
        storeResponse(e);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
        LOG.warn("Unexpected exception from downstream.", e.getCause());
        e.getChannel().close();
    }

    private void storeResponse(final MessageEvent e) {
        replies.offer((RpcResponse)e.getMessage());
    }
}


text:
#ifndef DC_TEST_FUNCINFO_H
#define DC_TEST_FUNCINFO_H

#include "../../dyncall/dyncall_signature.h"

struct funcinfo
{
  DCpointer        funcptr;
  const DCsigchar* sig;
};

extern funcinfo gFuncInfos[];

#endif /* DC_TEST_FUNCINFO_H */


text:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview
 * Functions related to controlling the modal UI state of the app. UI states
 * are expressed as HTML attributes with a dotted hierarchy. For example, the
 * string 'host.shared' will match any elements with an associated attribute
 * of 'host' or 'host.shared', showing those elements and hiding all others.
 * Elements with no associated attribute are ignored.
 */

'use strict';

/** @suppress {duplicate} */
var remoting = remoting || {};

/** @enum {string} */
// TODO(jamiewalch): Move 'in-session' to a separate web-page so that the
// 'home' state applies to all elements and can be removed.
remoting.AppMode = {
  HOME: 'home',
    TOKEN_REFRESH_FAILED: 'home.token-refresh-failed',
    HOST: 'home.host',
      HOST_WAITING_FOR_CODE: 'home.host.waiting-for-code',
      HOST_WAITING_FOR_CONNECTION: 'home.host.waiting-for-connection',
      HOST_SHARED: 'home.host.shared',
      HOST_SHARE_FAILED: 'home.host.share-failed',
      HOST_SHARE_FINISHED: 'home.host.share-finished',
    CLIENT: 'home.client',
      CLIENT_UNCONNECTED: 'home.client.unconnected',
      CLIENT_PIN_PROMPT: 'home.client.pin-prompt',
      CLIENT_THIRD_PARTY_AUTH: 'home.client.third-party-auth',
      CLIENT_CONNECTING: 'home.client.connecting',
      CLIENT_CONNECT_FAILED_IT2ME: 'home.client.connect-failed.it2me',
      CLIENT_CONNECT_FAILED_ME2ME: 'home.client.connect-failed.me2me',
      CLIENT_SESSION_FINISHED_IT2ME: 'home.client.session-finished.it2me',
      CLIENT_SESSION_FINISHED_ME2ME: 'home.client.session-finished.me2me',
      CLIENT_HOST_NEEDS_UPGRADE: 'home.client.host-needs-upgrade',
    HISTORY: 'home.history',
    CONFIRM_HOST_DELETE: 'home.confirm-host-delete',
    HOST_SETUP: 'home.host-setup',
      HOST_SETUP_INSTALL: 'home.host-setup.install',
      HOST_SETUP_INSTALL_PENDING: 'home.host-setup.install-pending',
      HOST_SETUP_ASK_PIN: 'home.host-setup.ask-pin',
      HOST_SETUP_PROCESSING: 'home.host-setup.processing',
      HOST_SETUP_DONE: 'home.host-setup.done',
      HOST_SETUP_ERROR: 'home.host-setup.error',
  IN_SESSION: 'in-session'
};

/**
 * @param {Element} element The element to check.
 * @param {string} attrName The attribute on the element to check.
 * @param {Array.<string>} modes The modes to check for.
 * @return {boolean} True if any mode in |modes| is found within the attribute.
 */
remoting.hasModeAttribute = function(element, attrName, modes) {
  var attr = element.getAttribute(attrName);
  for (var i = 0; i < modes.length; ++i) {
    if (attr.match(new RegExp('(\\s|^)' + modes[i] + '(\\s|$)')) != null) {
      return true;
    }
  }
  return false;
};

/**
 * Update the DOM by showing or hiding elements based on whether or not they
 * have an attribute matching the specified name.
 * @param {string} mode The value against which to match the attribute.
 * @param {string} attr The attribute name to match.
 * @return {void} Nothing.
 */
remoting.updateModalUi = function(mode, attr) {
  var modes = mode.split('.');
  for (var i = 1; i < modes.length; ++i)
    modes[i] = modes[i - 1] + '.' + modes[i];
  var elements = document.querySelectorAll('[' + attr + ']');
  // Hide elements first so that we don't end up trying to show two modal
  // dialogs at once (which would break keyboard-navigation confinement).
  for (var i = 0; i < elements.length; ++i) {
    var element = /** @type {Element} */ elements[i];
    if (!remoting.hasModeAttribute(element, attr, modes)) {
      element.hidden = true;
    }
  }
  for (var i = 0; i < elements.length; ++i) {
    var element = /** @type {Element} */ elements[i];
    if (remoting.hasModeAttribute(element, attr, modes)) {
      element.hidden = false;
      var autofocusNode = element.querySelector('[autofocus]');
      if (autofocusNode) {
        autofocusNode.focus();
      }
    }
  }
};

/**
 * @type {remoting.AppMode} The current app mode
 */
remoting.currentMode = remoting.AppMode.HOME;

/**
 * Change the app's modal state to |mode|, determined by the data-ui-mode
 * attribute.
 *
 * @param {remoting.AppMode} mode The new modal state.
 */
remoting.setMode = function(mode) {
  remoting.updateModalUi(mode, 'data-ui-mode');
  console.log('App mode: ' + mode);
  remoting.currentMode = mode;
  if (mode == remoting.AppMode.IN_SESSION) {
    document.removeEventListener('keydown', remoting.ConnectionStats.onKeydown,
                                 false);
    document.addEventListener('webkitvisibilitychange',
                              remoting.onVisibilityChanged, false);
  } else {
    document.addEventListener('keydown', remoting.ConnectionStats.onKeydown,
                              false);
    document.removeEventListener('webkitvisibilitychange',
                                 remoting.onVisibilityChanged, false);
  }
};

/**
 * Get the major mode that the app is running in.
 * @return {string} The app's current major mode.
 */
remoting.getMajorMode = function() {
  return remoting.currentMode.split('.')[0];
};

/**
 * Helper function for showing or hiding the infographic UI based on
 * whether or not the user has already dismissed it.
 *
 * @param {string} mode
 * @param {!Object} items
 */
remoting.showOrHideCallback = function(mode, items) {
  // Get the first element of a dictionary or array, without needing to know
  // the key.
  /** @type {string} */
  var key = Object.keys(items)[0];
  var visited = !!items[key];
  document.getElementById(mode + '-first-run').hidden = visited;
  document.getElementById(mode + '-content').hidden = !visited;
};

remoting.showOrHideIT2MeUi = function() {
  remoting.storage.local.get('it2me-visited',
                             remoting.showOrHideCallback.bind(null, 'it2me'));
};

remoting.showOrHideMe2MeUi = function() {
  remoting.storage.local.get('me2me-visited',
                             remoting.showOrHideCallback.bind(null, 'me2me'));
};

remoting.showIT2MeUiAndSave = function() {
  var items = {};
  items['it2me-visited'] = true;
  remoting.storage.local.set(items);
  remoting.showOrHideCallback('it2me', [true]);
};

remoting.showMe2MeUiAndSave = function() {
  var items = {};
  items['me2me-visited'] = true;
  remoting.storage.local.set(items);
  remoting.showOrHideCallback('me2me', [true]);
};

remoting.resetInfographics = function() {
  remoting.storage.local.remove('it2me-visited');
  remoting.storage.local.remove('me2me-visited');
  remoting.showOrHideCallback('it2me', [false]);
  remoting.showOrHideCallback('me2me', [false]);
}

/**
 * Initialize all modal dialogs (class kd-modaldialog), adding event handlers
 * to confine keyboard navigation to child controls of the dialog when it is
 * shown and restore keyboard navigation when it is hidden.
 */
remoting.initModalDialogs = function() {
  var dialogs = document.querySelectorAll('.kd-modaldialog');
  var observer = new WebKitMutationObserver(confineOrRestoreFocus_);
  var options = {
    subtree: false,
    attributes: true
  };
  for (var i = 0; i < dialogs.length; ++i) {
    observer.observe(dialogs[i], options);
  }
};

/**
 * @param {Array.<MutationRecord>} mutations The set of mutations affecting
 *     an observed node.
 */
function confineOrRestoreFocus_(mutations) {
  // The list of mutations can include duplicates, so reduce it to a canonical
  // show/hide list.
  /** @type {Array.<Element>} */
  var shown = [];
  /** @type {Array.<Element>} */
  var hidden = [];
  for (var i = 0; i < mutations.length; ++i) {
    var mutation = mutations[i];
    if (mutation.type == 'attributes' &&
        mutation.attributeName == 'hidden') {
      var node = mutation.target;
      if (node.hidden && hidden.indexOf(node) == -1) {
        hidden.push(node);
      } else if (!node.hidden && shown.indexOf(node) == -1) {
        shown.push(node);
      }
    }
  }
  var kSavedAttributeName = 'data-saved-tab-index';
  // If any dialogs have been dismissed, restore all the tabIndex attributes.
  if (hidden.length != 0) {
    var elements = document.querySelectorAll('[' + kSavedAttributeName + ']');
    for (var i = 0 ; i < elements.length; ++i) {
      var element = /** @type {Element} */ elements[i];
      element.tabIndex = element.getAttribute(kSavedAttributeName);
      element.removeAttribute(kSavedAttributeName);
    }
  }
  // If any dialogs have been shown, confine keyboard navigation to the first
  // one. We don't have nested modal dialogs, so this will suffice for now.
  if (shown.length != 0) {
    var selector = '[tabIndex],a,area,button,input,select,textarea';
    var disable = document.querySelectorAll(selector);
    var except = shown[0].querySelectorAll(selector);
    for (var i = 0; i < disable.length; ++i) {
      var element = /** @type {Element} */ disable[i];
      var removeFromKeyboardNavigation = true;
      for (var j = 0; j < except.length; ++j) {  // No indexOf on NodeList
        if (element == except[j]) {
          removeFromKeyboardNavigation = false;
          break;
        }
      }
      if (removeFromKeyboardNavigation) {
        element.setAttribute(kSavedAttributeName, element.tabIndex);
        element.tabIndex = -1;
      }
    }
  }
}


text:
package org.springframework.richclient.application.event;

import org.springframework.context.ApplicationEvent;
import org.springframework.core.style.ToStringCreator;

/**
 * Application event that communicates lifecycle changes in application objects.
 *
 * @author Keith Donald
 */
public class LifecycleApplicationEvent extends ApplicationEvent {
    private String eventType;

    public static final String CREATED = "lifecycleEvent.created";

    public static final String MODIFIED = "lifecycleEvent.modified";

    public static final String DELETED = "lifecycleEvent.deleted";

    public LifecycleApplicationEvent(String eventType, Object source) {
        super(source);
        this.eventType = eventType;
    }

    public Object getObject() {
        return getSource();
    }

    public boolean objectIs(Class clazz) {
        if (clazz.isAssignableFrom(getSource().getClass()))
            return true;

        return false;
    }

    public String getEventType() {
        return eventType;
    }

    public String toString() {
        return new ToStringCreator(this).toString();
    }
}


text:
package wtwire

import (
	"bytes"
	"encoding/binary"
	"fmt"
	"io"
)

// MaxMessagePayload is the maximum bytes a message can be regardless of other
// individual limits imposed by messages themselves.
const MaxMessagePayload = 65535 // 65KB

// MessageType is the unique 2 byte big-endian integer that indicates the type
// of message on the wire. All messages have a very simple header which
// consists simply of 2-byte message type. We omit a length field, and checksum
// as the Watchtower Protocol is intended to be encapsulated within a
// confidential+authenticated cryptographic messaging protocol.
type MessageType uint16

// The currently defined message types within this current version of the
// Watchtower protocol.
const (
	// MsgInit identifies an encoded Init message.
	MsgInit MessageType = 600

	// MsgError identifies an encoded Error message.
	MsgError MessageType = 601

	// MsgCreateSession identifies an encoded CreateSession message.
	MsgCreateSession MessageType = 602

	// MsgCreateSessionReply identifies an encoded CreateSessionReply message.
	MsgCreateSessionReply MessageType = 603

	// MsgStateUpdate identifies an encoded StateUpdate message.
	MsgStateUpdate MessageType = 604

	// MsgStateUpdateReply identifies an encoded StateUpdateReply message.
	MsgStateUpdateReply MessageType = 605

	// MsgDeleteSession identifies an encoded DeleteSession message.
	MsgDeleteSession MessageType = 606

	// MsgDeleteSessionReply identifies an encoded DeleteSessionReply
	// message.
	MsgDeleteSessionReply MessageType = 607
)

// String returns a human readable description of the message type.
func (m MessageType) String() string {
	switch m {
	case MsgInit:
		return "Init"
	case MsgCreateSession:
		return "MsgCreateSession"
	case MsgCreateSessionReply:
		return "MsgCreateSessionReply"
	case MsgStateUpdate:
		return "MsgStateUpdate"
	case MsgStateUpdateReply:
		return "MsgStateUpdateReply"
	case MsgDeleteSession:
		return "MsgDeleteSession"
	case MsgDeleteSessionReply:
		return "MsgDeleteSessionReply"
	case MsgError:
		return "Error"
	default:
		return "<unknown>"
	}
}

// Serializable is an interface which defines a lightning wire serializable
// object.
type Serializable interface {
	// Decode reads the bytes stream and converts it to the object.
	Decode(io.Reader, uint32) error

	// Encode converts object to the bytes stream and write it into the
	// write buffer.
	Encode(io.Writer, uint32) error
}

// Message is an interface that defines a lightning wire protocol message. The
// interface is general in order to allow implementing types full control over
// the representation of its data.
type Message interface {
	Serializable

	// MsgType returns a MessageType that uniquely identifies the message to
	// be encoded.
	MsgType() MessageType

	// MaxMessagePayload is the maximum serialized length that a particular
	// message type can take.
	MaxPayloadLength(uint32) uint32
}

// makeEmptyMessage creates a new empty message of the proper concrete type
// based on the passed message type.
func makeEmptyMessage(msgType MessageType) (Message, error) {
	var msg Message

	switch msgType {
	case MsgInit:
		msg = &Init{}
	case MsgCreateSession:
		msg = &CreateSession{}
	case MsgCreateSessionReply:
		msg = &CreateSessionReply{}
	case MsgStateUpdate:
		msg = &StateUpdate{}
	case MsgStateUpdateReply:
		msg = &StateUpdateReply{}
	case MsgDeleteSession:
		msg = &DeleteSession{}
	case MsgDeleteSessionReply:
		msg = &DeleteSessionReply{}
	case MsgError:
		msg = &Error{}
	default:
		return nil, fmt.Errorf("unknown message type [%d]", msgType)
	}

	return msg, nil
}

// WriteMessage writes a lightning Message to w including the necessary header
// information and returns the number of bytes written.
func WriteMessage(w io.Writer, msg Message, pver uint32) (int, error) {
	totalBytes := 0

	// Encode the message payload itself into a temporary buffer.
	// TODO(roasbeef): create buffer pool
	var bw bytes.Buffer
	if err := msg.Encode(&bw, pver); err != nil {
		return totalBytes, err
	}
	payload := bw.Bytes()
	lenp := len(payload)

	// Enforce maximum overall message payload.
	if lenp > MaxMessagePayload {
		return totalBytes, fmt.Errorf("message payload is too large - "+
			"encoded %d bytes, but maximum message payload is %d bytes",
			lenp, MaxMessagePayload)
	}

	// Enforce maximum message payload on the message type.
	mpl := msg.MaxPayloadLength(pver)
	if uint32(lenp) > mpl {
		return totalBytes, fmt.Errorf("message payload is too large - "+
			"encoded %d bytes, but maximum message payload of "+
			"type %v is %d bytes", lenp, msg.MsgType(), mpl)
	}

	// With the initial sanity checks complete, we'll now write out the
	// message type itself.
	var mType [2]byte
	binary.BigEndian.PutUint16(mType[:], uint16(msg.MsgType()))
	n, err := w.Write(mType[:])
	totalBytes += n
	if err != nil {
		return totalBytes, err
	}

	// With the message type written, we'll now write out the raw payload
	// itself.
	n, err = w.Write(payload)
	totalBytes += n

	return totalBytes, err
}

// ReadMessage reads, validates, and parses the next Watchtower message from r
// for the provided protocol version.
func ReadMessage(r io.Reader, pver uint32) (Message, error) {
	// First, we'll read out the first two bytes of the message so we can
	// create the proper empty message.
	var mType [2]byte
	if _, err := io.ReadFull(r, mType[:]); err != nil {
		return nil, err
	}

	msgType := MessageType(binary.BigEndian.Uint16(mType[:]))

	// Now that we know the target message type, we can create the proper
	// empty message type and decode the message into it.
	msg, err := makeEmptyMessage(msgType)
	if err != nil {
		return nil, err
	}
	if err := msg.Decode(r, pver); err != nil {
		return nil, err
	}

	return msg, nil
}


text:
package breeze.stats
package distributions

import org.apache.commons.math3.distribution.{HypergeometricDistribution => ApacheHypergeometricDistribution}

/**
 * The Hypergeometric-distribution - ratio of two scaled chi^2 variables
 *
 * @author stucchio
 */
class HypergeometricDistribution(populationSize: Int, numberOfSuccesses: Int, sampleSize: Int)
    extends ApacheDiscreteDistribution {
  protected final val inner = new ApacheHypergeometricDistribution(populationSize, numberOfSuccesses, sampleSize)
}

object HypergeometricDistribution


text:
package edu.uan.fis.jeesample.dao;

import edu.uan.fis.jeesample.dto.Product;
import java.util.List;

public interface ProductDao {

    /**
     * Creates a new product.
     * @param product
     * @return
     */
    Product create(Product product);

    /**
     * Updates an existing product. Product id can't be modified.
     * @param product
     * @return
     */
    Product update(Product product);

    /**
     * Deletes an existing product
     * @param product
     */
    void delete(Product product);

    /**
     * Find a product by id
     * @param productId
     * @return
     */
    Product findById(Integer productId);

    /**
     * Returns all the products in the database
     * @return
     */
    List<Product> findAll();
}


text:
"""
Library to manage everything related to stroing information.
I/O can be file or wiki page.
"""

__version__ = "1.0.1"
__author__ = "Sorawee Porncharoenwase"

import sys, os
import preload
from lib import re2

def extract(key, text):
    """
    Extract key from text. Note that both key and text must be enunicode
    strings.
    """
    if key:
        try:
            dat = preload.enunicode(re2.find(u"(?m)^\* " + re2.escape(key) +
                                    u": (.*?)$", text, 1))
        except AttributeError:
            dat = None
    else:
        lines = text.strip().split(u"\n")
        dat = {}
        for line in lines:
            key, value = line.split(u": ")
            dat[key] = value

    return dat

def changeValue(key, value, text):
    """
    Return text which value of given key is changed.
    """
    text = text.strip()
    text, changes = re2.subn(u"(?m)^\* %s: (.*?)$" % re2.escape(key),
                            u"* %s: %s" % (re2.escape(key), value),
                            text)
    # don't check that newtext is equal to oldtext because if newvalue is
    # equal oldvalue, it will duplicate that key.
    if changes == 0:
        if text:
            text = text + u"\n* " + key + u": " + value
        else:
            text = u"* " + key + u": " + value

    return text

def getdat(key=None, filename=None, wikipage=None):
    """
    Return value of given key, but if key is not given, return dict instead.
    This function will look at file first, but if file doesn't exist,
    it will look at wiki page later.
    """
    key = preload.enunicode(key)
    if filename:
        fullfilename = os.path.join(preload.dirname, filename + ".cfg")
        if os.path.exists(fullfilename):
            with open(fullfilename, "r") as f:
                text = preload.enunicode(f.read())

            xdata = extract(key, text)
            if xdata:
                return xdata

    if wikipage and wikipage.exists():
        return extract(key, wikipage.get())

def putdat(key, value, filename=None, wikipage=None):
    """
    Save value of given key. Saving will be operated with any I/O methods
    which are given
    """
    key = preload.enunicode(key)
    value = preload.enunicode(value)

    if filename:
        fullfilename = os.path.join(preload.dirname, filename + ".cfg")
        text = u""
        try:
            with open(fullfilename, "r") as f:
                text = preload.enunicode(f.read())
        except IOError:
            pass

        with open(fullfilename, "w") as f:
            f.write(preload.deunicode(changeValue(key, value, text)))

    if wikipage:
        wikipage.put(changeValue(key, value, wikipage.get()), u"ปรับปรุงข้อมูล")


text:
import os

SITE_ID = 1
DEBUG = True

MEDIA_ROOT = os.path.normcase(os.path.dirname(os.path.abspath(__file__)))
MEDIA_URL = '/media/'

DATABASE_ENGINE = 'sqlite3'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'drf_example',
    }
}

INSTALLED_APPS = [
    'django.contrib.contenttypes',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'django.contrib.sessions',
    'django.contrib.auth',
    'django.contrib.admin',
    'rest_framework',
    'example',
]

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            # insert your TEMPLATE_DIRS here
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
                # list if you haven't customized them:
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

STATIC_URL = '/static/'

ROOT_URLCONF = 'example.urls'

SECRET_KEY = 'abc123'

PASSWORD_HASHERS = ('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher', )

MIDDLEWARE_CLASSES = ()

JSON_API_FORMAT_KEYS = 'camelize'
JSON_API_FORMAT_TYPES = 'camelize'
JSON_API_FILTER_KEYWORD = 'filter\[(?P<field>\w+)\]'

REST_FRAMEWORK = {
    'PAGE_SIZE': 5,
    'EXCEPTION_HANDLER': 'rest_framework_json_api.exceptions.exception_handler',
    'DEFAULT_PAGINATION_CLASS':
        'rest_framework_json_api.pagination.PageNumberPagination',
    'DEFAULT_PARSER_CLASSES': (
        'rest_framework_json_api.parsers.JSONParser',
        'rest_framework.parsers.FormParser',
        'rest_framework.parsers.MultiPartParser'
    ),
    'DEFAULT_RENDERER_CLASSES': (
        'rest_framework_json_api.renderers.JSONRenderer',
        'rest_framework.renderers.BrowsableAPIRenderer',
    ),
    'DEFAULT_METADATA_CLASS': 'rest_framework_json_api.metadata.JSONAPIMetadata',
    'DEFAULT_FILTER_BACKENDS': (
        'rest_framework_json_api.filters.JsonApiFilterBackend',
    )

}