text:
#ifndef __USBAUDIO_H__
#define __USBAUDIO_H__

//*****************************************************************************
//
// Standard Audio descriptor sub types.
//
//*****************************************************************************
#define USB_AI_UNDEFINED        0
#define USB_AI_HEADER           1
#define USB_AI_INPUT_TERMINAL   2
#define USB_AI_OUTPUT_TERMINAL  3
#define USB_AI_MIXER_UNIT       4
#define USB_AI_SELECTOR_UNIT    5
#define USB_AI_FEATURE_UNIT     6
#define USB_AI_PROCESSING_UNIT  7
#define USB_AI_EXTENSION_UNIT   8

//*****************************************************************************
//
// Standard Audio Streaming Interface descriptor types.
//
//*****************************************************************************
#define USB_AS_UNDEFINED        0
#define USB_AS_GENERAL          1
#define USB_AS_FORMAT_TYPE      2
#define USB_AS_FORMAT_SPECIFIC  3

//*****************************************************************************
//
// Standard USB terminal types used with audio terminal descriptors.  These
// are defined in the "Universal Serial Bus Device Class Definition for
// Terminal Types" version 1.0 released March 18, 1998.
//
//*****************************************************************************
#define USB_TTYPE_UNDEFINED     0x0100
#define USB_TTYPE_STREAMING     0x0101
#define USB_TTYPE_VENDOR        0x01ff

#define USB_TTYPE_OUT_UNDEF     0x0300
#define USB_TTYPE_OUT_SPEAKER   0x0301
#define USB_TTYPE_OUT_HEADPHONE 0x0302
#define USB_TTYPE_OUT_DESK_SPKR 0x0304
#define USB_TTYPE_OUT_ROOM_SPKR 0x0305
#define USB_TTYPE_OUT_COMM_SPKR 0x0306
#define USB_TTYPE_OUT_LFE       0x0307

#define USB_TTYPE_EXT_UNDEF     0x0600
#define USB_TTYPE_EXT_ANALOG    0x0601
#define USB_TTYPE_EXT_DIGITAL   0x0602
#define USB_TTYPE_EXT_LINE      0x0603
#define USB_TTYPE_EXT_LEGACY    0x0604
#define USB_TTYPE_EXT_SPDIF     0x0605
#define USB_TTYPE_EXT_1394_DA   0x0606
#define USB_TTYPE_EXT_1394_DV   0x0607

//*****************************************************************************
//
// Audio Interface Subclass Codes
//
//*****************************************************************************
#define USB_ASC_UNDEFINED       0x00
#define USB_ASC_AUDIO_CONTROL   0x01
#define USB_ASC_AUDIO_STREAMING 0x02
#define USB_ASC_MIDI_STREAMING  0x03

//*****************************************************************************
//
// Audio Class-Specific Descriptor Types
// (Table A-4)
//
//*****************************************************************************
#define USB_ACSDT_UNDEFINED     0x20
#define USB_ACSDT_DEVICE        0x21
#define USB_ACSDT_CONFIGURATION 0x22
#define USB_ACSDT_STRING        0x23
#define USB_ACSDT_INTERFACE     0x24
#define USB_ACSDT_ENDPOINT      0x25

//*****************************************************************************
//
// Audio Class-Specific AC Interface Descriptor Subtypes
// (Table A-5)
//
//*****************************************************************************
#define USB_ACDSTYPE_UNDEFINED       0x00
#define USB_ACDSTYPE_HEADER          0x01
#define USB_ACDSTYPE_IN_TERMINAL     0x02
#define USB_ACDSTYPE_OUT_TERMINAL    0x03
#define USB_ACDSTYPE_MIXER_UNIT      0x04
#define USB_ACDSTYPE_SELECTOR_UNIT   0x05
#define USB_ACDSTYPE_FEATURE_UNIT    0x06
#define USB_ACDSTYPE_PROCESSING_UNIT 0x07
#define USB_ACDSTYPE_EXTENSION_UNIT  0x08

//*****************************************************************************
//
// Audio Class-Specific AS Interface Descriptor Subtypes
// (Table A-6)
//
//*****************************************************************************
#define USB_ASDSTYPE_UNDEFINED          0x00
#define USB_ASDSTYPE_GENERAL            0x01
#define USB_ASDSTYPE_FORMAT_TYPE        0x02
#define USB_ASDSTYPE_FORMAT_SPECIFIC    0x03

//*****************************************************************************
//
// Audio Data Format Type I Codes.
//
//*****************************************************************************
#define USB_ADF_UNDEFINED       0x0000
#define USB_ADF_PCM             0x0001
#define USB_ADF_PCM8            0x0002
#define USB_ADF_IEEE_FLOAT      0x0003
#define USB_ADF_ALAW            0x0004
#define USB_ADF_MULAW           0x0005

//*****************************************************************************
//
// Audio Format Type Codes
//
//*****************************************************************************
#define USB_AF_TYPE_UNDEFINED   0x00
#define USB_AF_TYPE_TYPE_I      0x01
#define USB_AF_TYPE_TYPE_II     0x02
#define USB_AF_TYPE_TYPE_III    0x03

//*****************************************************************************
//
// Audio Class-Specific controls used with bmaControls values.
//
//*****************************************************************************
#define USB_ACONTROL_MUTE       0x0001  // Mute
#define USB_ACONTROL_VOLUME     0x0002  // Volume
#define USB_ACONTROL_BASS       0x0004  // Bass
#define USB_ACONTROL_MID        0x0008  // Mid
#define USB_ACONTROL_TREBLE     0x0010  // Treble
#define USB_ACONTROL_EQ         0x0020  // Graphic Equalizer
#define USB_ACONTROL_AGC        0x0040  // Automatic Gain
#define USB_ACONTROL_DELAY      0x0080  // Delay
#define USB_ACONTROL_BASS_BOOST 0x0100  // Bass Boost
#define USB_ACONTROL_LOUD       0x0200  // Loudness

//*****************************************************************************
//
// Audio Class-Specific Output terminal types.
//
//*****************************************************************************
#define USB_ATTYPE_UNDEFINED    0x0300  // Output Terminal, undefined Type.
#define USB_ATTYPE_SPEAKER      0x0301  // A generic speaker.
#define USB_ATTYPE_HEADPHONES   0x0302  // A head-mounted audio output device.
#define USB_ATTYPE_HMD          0x0303  // The audio part of a VR head mounted
                                        // display.
#define USB_ATTYPE_SPEAKER_DT   0x0304  // Desktop or Monitor speaker(s).
#define USB_ATTYPE_SPEAKER_RM   0x0305  // Larger room speaker(s).
#define USB_ATTYPE_SPEAKER_COM  0x0306  // Communications Speaker (phone).
#define USB_ATTYPE_SPEAKER_LFE  0x0307  // Speaker designed for low
                                        // frequencies.

//*****************************************************************************
//
// USB Audio channel configuration bits for wChannelConfig values.
// wChannelConfig: a bit field that indicates which spatial locations are
// present in the cluster. The bit allocations are as follows:
//
//*****************************************************************************
#define USB_CHANNEL_L           0x0001  // Left Front (L)
#define USB_CHANNEL_R           0x0002  // Right Front (R)
#define USB_CHANNEL_C           0x0004  // Center Front (C)
#define USB_CHANNEL_LFE         0x0008  // Low Frequency Enhancement (LFE)
#define USB_CHANNEL_LS          0x0010  // Left Surround (LS)
#define USB_CHANNEL_RS          0x0020  // Right Surround (RS)
#define USB_CHANNEL_LC          0x0040  // Left of Center (LC)
#define USB_CHANNEL_RC          0x0080  // Right of Center (RC)
#define USB_CHANNEL_S           0x0100  // Surround (S)
#define USB_CHANNEL_SL          0x0200  // Side Left (SL)
#define USB_CHANNEL_SR          0x0400  // Side Right (SR)
#define USB_CHANNEL_T           0x0800  // Top (T)

//*****************************************************************************
//
// Endpoint attributes for Audio Class General type.
//
//*****************************************************************************
#define USB_EP_ATTR_ACG_SAMPLING    0x01    // Sampling Frequency
#define USB_EP_ATTR_ACG_PITCH       0x02    // Pitch
#define USB_EP_ATTR_ACG_MAXPACKET   0x80    // MaxPacketsOnly

//*****************************************************************************
//
// Indicates the units used for the wLockDelay field for Audio Class General
// type.
//
//*****************************************************************************
#define USB_EP_LOCKDELAY_UNDEF  0x00    // Undefined
#define USB_EP_LOCKDELAY_MS     0x01    // Milliseconds
#define USB_EP_LOCKDELAY_PCM    0x02    // Decoded PCM samples

//*****************************************************************************
//
// Audio Class-Specific Request Codes
//
//*****************************************************************************
#define USB_AC_SET_CUR          0x01
#define USB_AC_SET_MIN          0x02
#define USB_AC_SET_MAX          0x03
#define USB_AC_SET_RES          0x04
#define USB_AC_SET_MEM          0x05
#define USB_AC_GET_CUR          0x81
#define USB_AC_GET_MIN          0x82
#define USB_AC_GET_MAX          0x83
#define USB_AC_GET_RES          0x84
#define USB_AC_GET_MEM          0x85
#define USB_AC_GET_STAT         0xff

#define USB_CS_CONTROL_M        0xff00
#define USB_CS_CHANNEL_M        0x00ff

//*****************************************************************************
//
// Endpoint Control Selectors
//
//*****************************************************************************
#define EP_CONTROL_UNDEFINED    0x0000
#define SAMPLING_FREQ_CONTROL   0x0100
#define PITCH_CONTROL           0x0200

//*****************************************************************************
//
// Feature Unit Control Selectors
//
//*****************************************************************************
#define FU_CONTROL_UNDEFINED    0x0000
#define MUTE_CONTROL            0x0100
#define VOLUME_CONTROL          0x0200
#define BASS_CONTROL            0x0300
#define MID_CONTROL             0x0400
#define TREBLE_CONTROL          0x0500
#define EQUALIZER_CONTROL       0x0600
#define AUTOMATIC_GAIN_CONTROL  0x0700
#define DELAY_CONTROL           0x0800
#define BASS_BOOST_CONTROL      0x0900
#define LOUDNESS_CONTROL        0x0A00

//*****************************************************************************
//
// All structures defined in this section of the header require byte packing of
// fields.  This is usually accomplished using the PACKED macro but, for IAR
// Embedded Workbench, this requires a pragma.
//
//*****************************************************************************
#ifdef ewarm
#pragma pack(1)
#endif

//*****************************************************************************
//
//! This structure describes the Class-Specific Audio Class Interface Header
//! Descriptor as defined in Universal Serial Bus Device Class Definition
//! for Audio Devices Release 1.0.
//
//*****************************************************************************
typedef struct
{
    //
    //! The length of this descriptor in bytes.
    //
    uint8_t bLength;

    //
    //! The type of the descriptor.  For an interface descriptor, this will
    //! be USB_DTYPE_CS_INTERFACE (36).
    //
    uint8_t bDescriptorType;

    //
    //! This will be USB_DSUBTYPE_HEADER for the header.
    //
    uint8_t bDescriptorSubtype;

    //
    //! Audio Device Class Specification Release Number in Binary-Coded
    //! Decimal.
    //
    uint16_t bcdADC;

    //
    //! Total number of bytes returned for the class-specific AudioControl
    //! interface descriptor. Includes the combined length of this descriptor
    //! header and all Unit and Terminal descriptors.
    //
    uint16_t wTotai32Length;

    //
    //! The number of AudioStreaming and MIDIStreaming interfaces in the Audio
    //! Interface Collection to which this AudioControl interface belongs.
    //
    uint8_t bInCollection;

    //
    //! Interface number of the first AudioStreaming or MIDIStreaming interface
    //! in the Collection.
    //
    uint8_t baInterfaceNr;
}
PACKED tACHeader;

//*****************************************************************************
//
// These are the possible bits set in the tACInputTerminal.wChannelConfig
// value.
//
//*****************************************************************************
#define USB_AC_CC_LEFT          0x0001
#define USB_AC_CC_RIGHT         0x0002
#define USB_AC_CC_CENTER        0x0004
#define USB_AC_CC_LFE           0x0008
#define USB_AC_CC_LEFTSURROUND  0x0010
#define USB_AC_CC_RIGHTSURROUND 0x0020
#define USB_AC_CC_LEFT_CENTER   0x0040
#define USB_AC_CC_RIGHT_CENTER  0x0080
#define USB_AC_CC_SURROUND      0x0100
#define USB_AC_CC_SIDE_LEFT     0x0200
#define USB_AC_CC_SIDE_RIGHT    0x0400
#define USB_AC_CC_TOP           0x0800

//*****************************************************************************
//
//! This structure describes the Feature Unit Descriptor as defined in
//! Universal Serial Bus Device Class Definition for Audio Devices Release 1.0.
//
//*****************************************************************************
typedef struct
{
    //
    //! The length of this descriptor in bytes.
    //
    uint8_t bLength;

    //
    //! The type of the descriptor.  For an interface descriptor, this will
    //! be USB_DTYPE_CS_INTERFACE (36).
    //
    uint8_t bDescriptorType;

    //
    //! This will be USB_DSUBTYPE_IN_TERM for the header.
    //
    uint8_t bDescriptorSubtype;

    //
    //! Constant uniquely identifying the Unit within the audio function. This
    //! value is used in all requests to address this Unit.
    //
    uint8_t bUnitID;

    //
    //! ID of the Unit or Terminal to which this Feature Unit is connected.
    //
    uint8_t bSourceID;

    //
    //! ID of the Output Terminal to which this Input Terminal is associated.
    //
    uint8_t bControlSize;

    //
    //! A bit set to 1 indicates that the mentioned Control is supported for
    //! a given channel.  See the USB_FU_* defines for the bit definitions.
    //! This actually an array of elements of size bControlSize so be
    //! careful when using this value directly.
    //
    uint16_t bmaControls;
}
PACKED tACFeatureUnit;

//*****************************************************************************
//
//! This structure describes the Output Terminal Descriptor as defined in
//! Universal Serial Bus Device Class Definition for Audio Devices Release 1.0.
//
//*****************************************************************************
typedef struct
{
    //
    //! The length of this descriptor in bytes.
    //
    uint8_t bLength;

    //
    //! The type of the descriptor.  For an interface descriptor, this will
    //! be USB_DTYPE_CS_INTERFACE (36).
    //
    uint8_t bDescriptorType;

    //
    //! This will be USB_DSUBTYPE_OUT_TERM for the header.
    //
    uint8_t bDescriptorSubtype;

    //
    //! Constant uniquely identifying the Terminal within the audio function.
    //! This value is used in all requests to address this Terminal.
    //
    uint8_t bTerminalID;

    //
    //! Constant characterizing the type of Terminal. See USB Audio Terminal
    //! Types.
    //
    uint16_t wTerminalType;

    //
    //! Constant, identifying the Input Terminal to which this Output Terminal
    //! is associated.
    //
    uint8_t bAssocTerminal;

    //
    //! ID of the Unit or Terminal to which this Terminal is connected.
    //
    uint8_t bSourceID;

    //
    //! Index of a string descriptor, describing the Output Terminal.
    //
    uint8_t iTerminal;
}
PACKED tACOutputTerminal;

//*****************************************************************************
//
//! This structure describes the Input Terminal Descriptor as defined in
//! Universal Serial Bus Device Class Definition for Audio Devices Release 1.0.
//
//*****************************************************************************
typedef struct
{
    //
    //! The length of this descriptor in bytes.
    //
    uint8_t bLength;

    //
    //! The type of the descriptor.  For an interface descriptor, this will
    //! be USB_DTYPE_CS_INTERFACE (36).
    //
    uint8_t bDescriptorType;

    //
    //! This will be USB_DSUBTYPE_OUT_TERM for the header.
    //
    uint8_t bDescriptorSubtype;

    //
    //! Constant uniquely identifying the Terminal within the audio function.
    //! This value is used in all requests to address this Terminal.
    //
    uint8_t bTerminalID;

    //
    //! Constant characterizing the type of Terminal. See USB Audio Terminal
    //! Types.
    //
    uint16_t wTerminalType;

    //
    //! Constant, identifying the Input Terminal to which this Output Terminal
    //! is associated.
    //
    uint8_t bAssocTerminal;

    //
    //! Number of logical output channels in the Terminal's output audio
    //! channel cluster.
    //
    uint8_t bNrChannels;

    //
    //! Describes the spatial location of the logical channels.
    //
    uint16_t wChannelConfig;

    //
    //! Index of a string descriptor, describing the name of the first logical
    //! channel.
    //
    uint8_t iChannelNames;

    //
    //! Index of a string descriptor, describing the Output Terminal.
    //
    uint8_t iTerminal;
}
PACKED tACInputTerminal;

//*****************************************************************************
//
//! This structure describes the Mixer Descriptor as defined in Universal
//! Serial Bus Device Class Definition for Audio Devices Release 1.0.
//
//*****************************************************************************
typedef struct
{
    //
    //! The length of this descriptor in bytes.
    //
    uint8_t bLength;

    //
    //! The type of the descriptor.  For an interface descriptor, this will
    //! be USB_DTYPE_CS_INTERFACE (36).
    //
    uint8_t bDescriptorType;

    //
    //! This will be USB_AI_MIXER_UNIT for the header.
    //
    uint8_t bDescriptorSubtype;

    //
    //! Constant uniquely identifying the Unit within the audio function. This
    //! value is used in all requests to address this Unit.
    //
    uint8_t bUnitID;

    //
    //! Number of Input Pins of this Unit.
    //
    uint8_t bNrInPins;

    //
    //! ID of the Unit or Terminal to which the first Input Pin of this Mixer
    //! Unit is connected.
    //
    uint8_t baSourceID;
}
PACKED tACMixer;

//*****************************************************************************
//
//! This structure describes the Selector Descriptor as defined in Universal
//! Serial Bus Device Class Definition for Audio Devices Release 1.0.
//
//*****************************************************************************
typedef struct
{
    //
    //! The length of this descriptor in bytes.
    //
    uint8_t bLength;

    //
    //! The type of the descriptor.  For an interface descriptor, this will
    //! be USB_DTYPE_CS_INTERFACE (36).
    //
    uint8_t bDescriptorType;

    //
    //! This will be USB_AI_MIXER_UNIT for the header.
    //
    uint8_t bDescriptorSubtype;

    //
    //! Constant uniquely identifying the Unit within the audio function. This
    //! value is used in all requests to address this Unit.
    //
    uint8_t bUnitID;

    //
    //! Number of Input Pins of this Unit.
    //
    uint8_t bNrInPins;

    //
    //! ID of the Unit or Terminal to which the first Input Pin of this Mixer
    //! Unit is connected.
    //
    uint8_t baSourceID;
}
PACKED tACSelector;

//*****************************************************************************
//
//! This structure describes the Output Terminal Descriptor as defined in
//! Universal Serial Bus Device Class Definition for Audio Devices Release 1.0.
//
//*****************************************************************************
typedef struct
{
    //
    //! The length of this descriptor in bytes.
    //
    uint8_t bLength;

    //
    //! The type of the descriptor.  For an interface descriptor, this will
    //! be USB_DTYPE_CS_INTERFACE (36).
    //
    uint8_t bDescriptorType;

    //
    //! This will be USB_DSUBTYPE_GENERAL for the header.
    //
    uint8_t bDescriptorSubtype;

    //
    //! The Terminal ID of the Terminal to which the endpoint of this
    //! interface is connected.
    //
    uint8_t bTerminalLink;

    //
    //! Delay introduced by the data path. Expressed in number of frames.
    //
    uint8_t bDelay;

    //
    //! The Audio Data Format that has to be used to communicate with this
    //! interface.
    //
    uint16_t wFormatTag;
}
PACKED tACGeneral;

//*****************************************************************************
//
//! This structure describes the Type I Audio format descriptors defined in
//! USB Audio Devices Release 1.0.
//
//*****************************************************************************
typedef struct
{
    //
    //! The length of this descriptor in bytes.
    //
    uint8_t bLength;

    //
    //! The type of the descriptor.  For an interface descriptor, this will
    //! be USB_DTYPE_CS_INTERFACE (36).
    //
    uint8_t bDescriptorType;

    //
    //! This will be USB_AS_FORMAT_TYPE.
    //
    uint8_t bDescriptorSubtype;

    //
    //! This will be USB_AS_FORMAT_TYPE_I.
    //
    uint8_t bFormatType;

    //
    //! Number of channels on this streaming interface.
    //
    uint8_t bNrChannels;

    //
    //! Number of bytes per audio sub-frame or channel.
    //
    uint8_t bSubFrameSize;

    //
    //! Number of bits per sample.
    //
    uint8_t bBitResolution;

    //
    //! Number of sample rates that are supported.
    //
    uint8_t bSamFreqType;

    //
    //! Number of bits per sample.
    //
    uint8_t tSamFreq;
}
PACKED tASFormat;

//*****************************************************************************
//
// Return to default packing when using the IAR Embedded Workbench compiler.
//
//*****************************************************************************
#ifdef ewarm
#pragma pack()
#endif

#endif


text:
package com.alibaba.dubbo.remoting;

import java.io.Serializable;

/**
 * RpcResult.
 *
 * @author qian.lei
 */

public class Bean implements Serializable
{
    private static final long serialVersionUID = -5418914174335569349L;

    private int id;

    public Bean() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + id;
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Bean other = (Bean) obj;
        if (id != other.id)
            return false;
        return true;
    }

}

redpajama_set_name: RedPajamaGithub


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

namespace Keeper.Warm
{
    public interface ICodeGenerator
    {
        void Emit(Opcode opcode);
        void Emit(Opcode opcode, int argument);
        void Emit(Opcode opcode, FunctorDescriptor functor);
        void Emit(Opcode opcode, Label label);
        void Emit(Opcode opcode, Local local);
        Label DefineLabel();
        void MarkLabel(Label label);
        Local DefineLocal();
    }

    public class Local
    {
        internal Local(int index)
        {
            this.Index = index;
        }

        internal int Index
        {
            get;
            private set;
        }
    }

    public class Label
    {
        internal Label()
        {
        }
    }

    public class CodeGenerator
        : ICodeGenerator
    {
        private class LabelInfo
        {
            public List<int> References = new List<int>();
            public int? Mark;
        }

        private List<int> code = new List<int>();
        private Stack<Dictionary<Label, LabelInfo>> contexts = new Stack<Dictionary<Label, LabelInfo>>();
        private Func<string, int, int> rulePointerLookup;
        private Func<FunctorDescriptor, int> functorLookup;
        private int nextFreeLocal;
        private int argumentCount;

        public CodeGenerator(int argumentCount, Func<string, int, int> rulePointerLookup, Func<FunctorDescriptor, int> functorLookup)
        {
            this.argumentCount = argumentCount;
            this.rulePointerLookup = rulePointerLookup;
            this.functorLookup = functorLookup;

            this.contexts.Push(new Dictionary<Label, LabelInfo>());
        }

        public void Emit(Opcode opcode)
        {
            this.code.Add((int)opcode);
        }

        public void Emit(Opcode opcode, int argument)
        {
            this.code.Add((int)opcode);
            this.code.Add(argument);
        }

        public void Emit(Opcode opcode, FunctorDescriptor functor)
        {
            this.code.Add((int)opcode);
            if (opcode.HasFlag(Opcode.RulePointerOperand))
            {
                this.code.Add(rulePointerLookup(functor.Name, functor.Arity));
            }
            else
            {
                this.code.Add(functorLookup(functor));
            }
        }

        public void Emit(Opcode opcode, Label label)
        {
            this.code.Add((int)opcode);

            var context = this.contexts.Peek();

            var info = context[label];

            info.References.Add(this.code.Count);

            this.code.Add(0);
        }

        public void Emit(Opcode opcode, Local local)
        {
            this.code.Add((int)opcode);
            this.code.Add(local.Index);
        }

        public Label DefineLabel()
        {
            var result = new Label();

            var context = this.contexts.Peek();

            context.Add(result, new LabelInfo());

            return result;
        }

        public void MarkLabel(Label label)
        {
            var context = this.contexts.Peek();

            var info = context[label];

            info.Mark = this.code.Count;
        }

        public IEnumerable<int> Generate()
        {
            yield return (int)Opcode.Allocate;
            yield return this.nextFreeLocal;

            this.ApplyLabelsForCurrentContext();

            foreach (var item in this.code)
            {
                yield return item;
            }

            yield return (int)Opcode.Deallocate;
            yield return this.argumentCount;
            yield return (int)Opcode.Proceed;
        }

        private void ApplyLabelsForCurrentContext()
        {
            foreach (var label in this.contexts.Peek().Values)
            {
                foreach (int referencePointer in label.References)
                {
                    this.code[referencePointer] = label.Mark.Value - (referencePointer - 1);
                }
            }
        }

        public Local DefineLocal()
        {
            return new Local(this.nextFreeLocal++);
        }
    }
}


text:
layout: post
title: What is the Maximum Attachment Size I can Send?
date: 2014-12-03 10:06:21.000000000 +02:00
type: post
published: true
status: publish
categories:
- Features & Usability
tags: []
meta: /maximum-attachment-size-blue-mail/
---

BlueMail itself does not have a size limit on your attachments. However, most email providers have some limit on the overall size of a single mail they allow to send to their servers. It is typically in the 10-25MB range, please consult your provider for more details.


text:
package net.violet.platform.datamodel.factories.mock;

import net.violet.db.records.Record.RecordWalker;
import net.violet.db.records.factories.RecordFactoryMock;
import net.violet.platform.datamodel.Application;
import net.violet.platform.datamodel.VAction;
import net.violet.platform.datamodel.factories.ServiceFactory;
import net.violet.platform.datamodel.factories.VActionFactory;
import net.violet.platform.datamodel.mock.VActionMock;

public class VActionFactoryMock extends RecordFactoryMock<VAction, VActionMock> implements VActionFactory {

	VActionFactoryMock() {
		super(VActionMock.class);
	}

	public int walk(RecordWalker<VAction> inWalker) {
		return 0;
	}

	public VAction findByUrl(String url) {
		for (final VAction theAction : findAll()) {
			if (theAction.getUrl().equals(url)) {
				return theAction;
			}
		}
		return null;
	}

	public VAction createNewVAction(int inLangId, String inUrl, ServiceFactory.SERVICE inService, String inAccess_right, Application inApplication) {
		return new VActionMock(0, inLangId, inUrl, inService, inAccess_right, inApplication);
	}

	public VAction findFirstByUrlAndService(String url, ServiceFactory.SERVICE inService) {
		for (final VAction action : findAll()) {
			if (action.getUrl().equals(url) && action.getService().equals(inService.getService())) {
				return action;
			}
		}
		return null;
	}

	public VAction findByApplication(Application inApplication) {
		for (final VAction theAction : findAll()) {
			if (theAction.getApplicationId() == inApplication.getId().longValue()) {
				return theAction;
			}
		}
		return null;
	}

	public VAction create(String inURL, int inLangId, String inAcces, Application inApplication, String inTypeName) {
		ServiceFactory.SERVICE theService = ServiceFactory.SERVICE.PODCAST;
		if (ServiceFactory.SERVICE.RSS.getLabel().equals(inTypeName)) {
			theService = ServiceFactory.SERVICE.RSS;
		}
		return new VActionMock(0, inLangId, inURL, theService, inAcces, inApplication);
	}
}


text:
package com.google.code.validationframework.swing.resulthandler.bool;

import com.google.code.validationframework.swing.resulthandler.AbstractComponentResultHandler;

import java.awt.Component;

/**
 * Result handler enabling (respectively disabling) one or several components when the result is valid (respectively
 * invalid).
 */
public class ComponentEnablingBooleanResultHandler extends AbstractComponentResultHandler<Boolean> {

    /**
     * @see AbstractComponentResultHandler#AbstractComponentResultHandler()
     */
    public ComponentEnablingBooleanResultHandler() {
        super();
    }

    /**
     * @see AbstractComponentResultHandler#AbstractComponentResultHandler(Component...)
     */
    public ComponentEnablingBooleanResultHandler(final Component... components) {
        super(components);
    }

    /**
     * @see AbstractComponentResultHandler#handleResult(Object)
     */
    @Override
    public void handleResult(final Boolean result) {
        boolean enabled = false;
        if (result != null) {
            enabled = result;
        }

        for (final Component component : components) {
            component.setEnabled(enabled);
        }
    }
}


text:
package org.msgpack.rpc.loop.netty;

import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.msgpack.rpc.transport.RpcMessageHandler;
import org.msgpack.type.Value;

class MessageHandler extends SimpleChannelUpstreamHandler {
    private RpcMessageHandler handler;
    private ChannelAdaptor adaptor;

    MessageHandler(RpcMessageHandler handler) {
        this.handler = handler;
    }

    @Override
    public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
            throws Exception {
        this.adaptor = new ChannelAdaptor(e.getChannel());
        ctx.sendUpstream(e);
    }

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
        Object m = e.getMessage();
        if (!(m instanceof Value)) {
            ctx.sendUpstream(e);
            return;
        }

        Value msg = (Value) m;
        handler.handleMessage(adaptor, msg);
    }
}


text:
'use strict';

module.exports = {
	method : "GET",
	url : ["/signup/facebook/"],
	desc : "get : social signup - facebook",
	passport : {
		strategy : 'facebook',
		callbackURL : "/signup/tumblr/callback/"
	},
	handler : function(req, res, next) {
		req._passport.instance.authenticate('facebook', { callbackURL: '/signup/facebook/callback/' }, function(err, user, info) {
			if (!info || !info.profile) {
				return res.redirect('/signup/');
			}

			req.app.db.models.User.findOne({ 'facebook.id': info.profile.id }, function(err, user) {
				if (err) {
					return next(err);
				}
				if (!user) {
					req.session.socialProfile = info.profile;
					res.render('signup/social', { email: info.profile.emails && info.profile.emails[0].value || '' });
				}
				else {
					res.render('signup/index', {
						oauthMessage: 'We found a user linked to your Facebook account.',
						oauthTwitter: !!req.app.config.oauth.twitter.key,
						oauthGitHub: !!req.app.config.oauth.github.key,
						oauthFacebook: !!req.app.config.oauth.facebook.key,
						oauthGoogle: !!req.app.config.oauth.google.key,
						oauthTumblr: !!req.app.config.oauth.tumblr.key
					});
				}
			});
		})(req, res, next);
	}
};


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;

using DigitalPlatform.Core;
using DigitalPlatform.Xml;

namespace dp2Circulation
{
    /// <summary>
    /// 用 XML 文件保存程序的各种配置信息
    /// </summary>
    public class NewApplicationInfo : IApplicationInfo
    {
        // public XmlDocument dom = new XmlDocument();

        ConfigSetting _config = null;   // 引用

        // public string PureFileName = "";
        // public string CurrentDirectory = "";
        // public string FileName = "";

        Hashtable titleTable = null;

        // bool m_bFirstMdiOpened = false;

        public event EventHandler LoadMdiLayout = null;
        public event EventHandler SaveMdiLayout = null;

        // 2017/12/20
        public event AppInfoChangedEventHandler AppInfoChanged = null;

        public NewApplicationInfo()
        {
        }

        /*
        public bool FirstMdiOpened
        {
            get
            {
                return m_bFirstMdiOpened;
            }
            set
            {
                m_bFirstMdiOpened = value;
            }
        }*/

        // 构造函数
        // 本函数将XML文件中的内容装入内存。
        // parameters:
        //		strPureFileName	要打开的XML文件名,注意这是一个纯文件名,不包含路径部分。本函数自动从模块的当前目录中装载此文件。
        public NewApplicationInfo(ConfigSetting config)
        {
            this._config = config;
            /*
            PrepareFileName(strPureFileName);

            string strErrorInfo;
            int nRet = Load(out strErrorInfo);
            if (nRet < 0)
            {
                CreateBlank();
            }
            */
        }

        // 将内存中的内容保存回XML文件
        public void Save()
        {
            /*
            if (FileName != "")
            {
                Save(out string strErrorInfo);
            }
            */
        }

#if REMOVED

        // parameters:
        //      strFileName 文件名字符串。如果是纯文件名,则自动按照 ClickOnce 安装和绿色安装获得数据目录;如果是全路径,则直接使用这个路径
        public void PrepareFileName(string strFileName)
        {
            string strPureName = Path.GetFileName(strFileName);
            if (strPureName.ToUpper() != strFileName.ToUpper())
            {
                this.PureFileName = strPureName;
                this.FileName = strFileName;
            }
            else
            {
                this.PureFileName = strFileName;

                if (ApplicationDeployment.IsNetworkDeployed == true)
                {
                    this.CurrentDirectory = Application.LocalUserAppDataPath;
                }
                else
                {
                    this.CurrentDirectory = Environment.CurrentDirectory;
                }

                this.FileName = Path.Combine(this.CurrentDirectory, PureFileName);
            }
        }

        // 从文件中装载信息
        public int Load(out string strErrorInfo)
        {
            this.dom.PreserveWhitespace = true;

            strErrorInfo = "";

            if (FileName == "")
            {
                strErrorInfo = "FileName为空...";
                return -1;
            }

            try
            {
                dom.Load(FileName);
            }
            catch (FileNotFoundException ex)
            {
                strErrorInfo = "文件没有找到: " + ex.Message;
                return -2;
            }
            catch (XmlException ex)
            {
                strErrorInfo = "装载文件 " + FileName + "时出错:" + ex.Message;
                return -1;
            }

            return 0;
        }

        public int CreateBlank()
        {
            dom.LoadXml("<?xml version='1.0' encoding='utf-8' ?><root/>");
            return 0;
        }

        public int Save(out string strErrorInfo)
        {
            strErrorInfo = "";

            if (string.IsNullOrEmpty(FileName) == true)
            {
                strErrorInfo = "FileName为空...";
                return -1;
            }

            // 2018/6/25
            // 先把以前的文件改名作为备份保存
            string strTempFileName = FileName + ".save";
            FileInfo fi = new FileInfo(FileName);
            if (File.Exists(FileName) && fi.Length != 0)
                File.Copy(FileName, strTempFileName, true);

            dom.Save(FileName);
            return 0;
        }

#endif

        // Hashtable _cacheTable = new Hashtable();    // path --> string value

        // 获得一个布尔值
        // parameters:
        //		strPath	参数路径
        //		strName	参数名
        //		bDefault	缺省值
        // return:
        //		所获得的布尔值
        public bool GetBoolean(string strPath,
            string strName,
            bool bDefault)
        {
            string value = GetString(strPath,
strName,
null);
            if (value == null)
                return bDefault;

            if (String.Compare(value, "true", true) == 0)
                return true;

            if (String.Compare(value, "false", true) == 0)
                return false;

            return false;
        }

        // 写入一个布尔值
        // parameters:
        //		strPath	参数路径
        //		strName	参数名
        //		bValue	要写入的布尔值
        public void SetBoolean(string strPath,
            string strName,
            bool bValue)
        {
            SetString(strPath,
strName,
(bValue == true ? "true" : "false"));
        }

        /*
        //
        static string GetSectionPath(string strPath)
        {
            if (string.IsNullOrEmpty(strPath) == true)
                throw new ArgumentException("strPath 参数值不应为空");
            if (char.IsDigit(strPath[0]) == true)
                return "/root/n_" + strPath;
            return "/root/" + strPath;
        }
        */

        // 获得一个整数值
        // parameters:
        //		strPath	参数路径
        //		strName	参数名
        //		nDefault	缺省值
        // return:
        //		所获得的整数值
        public int GetInt(string strPath,
            string strName,
            int nDefault)
        {
            string value = GetString(strPath,
            strName,
            null);
            if (value == null)
                return nDefault;
            return Convert.ToInt32(value);
        }

        // 写入一个整数值
        // parameters:
        //		strPath	参数路径
        //		strName	参数名
        //		nValue	要写入的整数值
        public void SetInt(string strPath,
            string strName,
            int nValue)
        {
            SetString(strPath,
strName,
Convert.ToString(nValue));
        }

        // 获得一个字符串
        // parameters:
        //		strPath	参数路径
        //		strName	参数名
        //		strDefalt	缺省值
        // return:
        //		要获得的字符串
        public string GetString(string strPath,
            string strName,
            string strDefault)
        {
            return _config.Get(strPath, strName, strDefault);
            /*
            strPath = GetSectionPath(strPath);

            XmlNode node = null;

            try
            {
                node = dom.SelectSingleNode(strPath);
            }
            catch (Exception ex)
            {
                throw new Exception("strPath 名称 '" + strPath + "' 不合法。应符合 XML 元素命名规则", ex);
            }

            if (node == null)
                return strDefault;

            return DomUtil.GetAttrOrDefault(node, strName, strDefault);
            */
        }

        // 设置一个字符串
        // parameters:
        //		strPath	参数路径
        //		strName	参数名
        //		strValue	要设置的字符串,如果为null,表示删除这个事项
        public void SetString(string strPathParam,
            string strName,
            string strValue)
        {
            string oldValue = _config.Get(strPathParam, strName, null);
            _config.Set(strPathParam, strName, strValue);

            var handler = this.AppInfoChanged;
            if (handler != null)
            {
                AppInfoChangedEventArgs e = new AppInfoChangedEventArgs
                {
                    Path = strPathParam,
                    Name = strName,
                    Value = strValue,
                    OldValue = oldValue
                };
                handler(this, e);
            }
            /*
            string strPath = GetSectionPath(strPathParam);

            string[] aPath = strPath.Split(new char[] { '/' });
            XmlNode node = DomUtil.CreateNode(dom, aPath);

            if (node == null)
            {
                throw (new Exception("SetString() error ..."));
            }

            string oldValue = DomUtil.GetAttr(node, strName);

            DomUtil.SetAttr(node,
                strName,
                strValue);

            var handler = this.AppInfoChanged;
            if (handler != null)
            {
                AppInfoChangedEventArgs e = new AppInfoChangedEventArgs
                {
                    Path = strPathParam,
                    Name = strName,
                    Value = strValue,
                    OldValue = oldValue
                };
                handler(this, e);
            }
            */
        }

        ////
        // 获得一个浮点数
        // parameters:
        //		strPath	参数路径
        //		strName	参数名
        //		fDefault	缺省值
        // return:
        //		要获得的字符串
        public float GetFloat(string strPath,
            string strName,
            float fDefault)
        {
            string value = GetString(strPath,
strName,
null);
            if (value == null)
                return fDefault;

            try
            {
                return (float)Convert.ToDouble(value);
            }
            catch
            {
                return fDefault;
            }
        }

        // 设置一个浮点数
        // parameters:
        //		strPath	参数路径
        //		strName	参数名
        //		fValue	要设置的字符串
        public void SetFloat(string strPath,
            string strName,
            float fValue)
        {
            SetString(strPath,
            strName,
            fValue.ToString());
        }

        // 包装后的版本
        public void LoadFormStates(Form form,
            string strCfgTitle)
        {
            LoadFormStates(form, strCfgTitle, FormWindowState.Normal);
        }

        // 从ApplicationInfo中读取信息,设置form尺寸位置状态
        // parameters:
        //		form	Form对象
        //		strCfgTitle	配置信息路径。本函数将用此值作为GetString()或GetInt()的strPath参数使用
        public void LoadFormStates(Form form,
            string strCfgTitle,
            FormWindowState default_state)
        {
            // 为了优化视觉效果
            bool bVisible = form.Visible;

            if (bVisible == true)
                form.Visible = false;

            form.Width = this.GetInt(
                strCfgTitle, "width", form.Width);
            form.Height = this.GetInt(
                strCfgTitle, "height", form.Height);

            form.Location = new Point(
                this.GetInt(strCfgTitle, "x", form.Location.X),
                this.GetInt(strCfgTitle, "y", form.Location.Y));

            string strState = this.GetString(
                strCfgTitle,
                "window_state",
                "");
            if (String.IsNullOrEmpty(strState) == true)
            {
                form.WindowState = default_state;
            }
            else
            {
                form.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState),
                    strState);
            }

            if (bVisible == true)
                form.Visible = true;

            /// form.Update();  // 2007/4/8
        }

        // 装载MDI子窗口的最大化特性。需要在至少一个MDI子窗口打开后调用
        public void LoadFormMdiChildStates(Form form,
            string strCfgTitle)
        {
            if (form.ActiveMdiChild == null)
                return;

            string strState = this.GetString(
                strCfgTitle,
                "mdi_child_window_state",
                "");
            if (String.IsNullOrEmpty(strState) == false)
            {
                form.ActiveMdiChild.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState),
                    strState);
            }
        }

        public void LoadMdiChildFormStates(Form form,
            string strCfgTitle)
        {
            LoadMdiChildFormStates(form,
                strCfgTitle,
                SizeStyle.All);
        }

        // 包装后的版本
        public void LoadMdiChildFormStates(Form form,
            string strCfgTitle,
            SizeStyle style)
        {
            // 默认值可以按照屏幕分辨率估算
            int nDefaultWidth = (int)(((double)Screen.PrimaryScreen.WorkingArea.Width) * 0.5);
            int nDefaultHeight = (int)(((double)Screen.PrimaryScreen.WorkingArea.Height) * 0.7);

            LoadMdiChildFormStates(form,
                strCfgTitle,
                style,
                nDefaultWidth,  // 600,
                nDefaultHeight  // 400
                );
        }

        // http://blogs.msdn.com/b/rprabhu/archive/2005/11/28/497792.aspx
        // 2015/10/12 优化
        // 从ApplicationInfo中读取信息,设置MDI Child form尺寸位置状态
        // 和一般Form的区别是,不修改x,y信息
        // parameters:
        //		form	Form对象
        //		strCfgTitle	配置信息路径。本函数将用此值作为GetString()或GetInt()的strPath参数使用
        //      strStyle    size/layout 之一或者组合
        public void LoadMdiChildFormStates(Form form,
            string strCfgTitle,
            SizeStyle style,
            int nDefaultWidth,
            int nDefaultHeight)
        {
            if ((style & SizeStyle.Size) != 0)
            {
                form.Size = new Size(this.GetInt(
                    strCfgTitle, "width", nDefaultWidth),
                    this.GetInt(
                    strCfgTitle, "height", nDefaultHeight));
            }

            if ((style & SizeStyle.Layout) != 0)
            {
                if (this.LoadMdiLayout != null)
                    this.LoadMdiLayout(form, null);
            }
        }

        public void SaveMdiChildFormStates(Form form,
            string strCfgTitle)
        {
            SaveMdiChildFormStates(form,
                strCfgTitle,
                SizeStyle.All);
        }
        // 保存Mdi Child form尺寸位置状态到ApplicationInfo中
        // parameters:
        //		form	Form对象
        //		strCfgTitle	配置信息路径。本函数将用此值作为SetString()或SetInt()的strPath参数使用
        public void SaveMdiChildFormStates(Form form,
            string strCfgTitle,
            SizeStyle style)
        {
            if ((style & SizeStyle.Size) != 0)
            {
                FormWindowState savestate = form.WindowState;

                Size size = form.Size;
                Point location = form.Location;

                if (form.WindowState != FormWindowState.Normal)
                {
                    size = form.RestoreBounds.Size;
                    location = form.RestoreBounds.Location;
                }

                this.SetInt(strCfgTitle, "width", size.Width);
                this.SetInt(strCfgTitle, "height", size.Height);

                this.SetInt(strCfgTitle, "x", location.X);
                this.SetInt(strCfgTitle, "y", location.Y);
            }

            if ((style & SizeStyle.Layout) != 0)
            {
                if (this.SaveMdiLayout != null)
                    this.SaveMdiLayout(form, null);
            }
        }

        // 保存form尺寸位置状态到ApplicationInfo中
        // parameters:
        //		form	Form对象
        //		strCfgTitle	配置信息路径。本函数将用此值作为SetString()或SetInt()的strPath参数使用
        public void SaveFormStates(Form form,
            string strCfgTitle)
        {
            // 保存窗口状态
            this.SetString(
                strCfgTitle, "window_state",
                Enum.GetName(typeof(FormWindowState),
                form.WindowState));

            Size size = form.Size;
            Point location = form.Location;

            if (form.WindowState != FormWindowState.Normal)
            {
                size = form.RestoreBounds.Size;
                location = form.RestoreBounds.Location;
            }

#if NO
            // 尺寸
            form.WindowState = FormWindowState.Normal;	// 是否先隐藏窗口?
#endif

            this.SetInt(
                strCfgTitle, "width", size.Width);  // form.Width
            this.SetInt(
                strCfgTitle, "height", size.Height);    // form.Height

            this.SetInt(strCfgTitle, "x", location.X); // form.Location.X
            this.SetInt(strCfgTitle, "y", location.Y); // form.Location.Y

            // 保存MDI窗口状态 -- 是否最大化?
            if (form.ActiveMdiChild != null)
            {
                if (form.ActiveMdiChild.WindowState == FormWindowState.Minimized)
                    this.SetString(
                        strCfgTitle,
                        "mdi_child_window_state",
                        Enum.GetName(typeof(FormWindowState),
                        FormWindowState.Normal));
                else
                    this.SetString(
                        strCfgTitle,
                        "mdi_child_window_state",
                        Enum.GetName(typeof(FormWindowState),
                        form.ActiveMdiChild.WindowState));
            }
            else
            {
                this.SetString(
                    strCfgTitle,
                    "mdi_child_window_state",
                    "");
            }
        }

        // 将本对象和Form建立联系,当Form Load和Closed阶段,会自动触发本类
        // 的相关事件函数,恢复和保存Form尺寸位置等状态。
        // parameters:
        //		form	Form对象
        //		strCfgTitle	配置信息路径。本函数将用此值作为相关GetString()或GetInt()的strPath参数使用
        public void LinkFormState(Form form,
            string strCfgTitle)
        {
            if (titleTable == null)
                titleTable = new Hashtable();

            // titleTable.Add(form, strCfgTitle);
            titleTable[form] = strCfgTitle; // 重复加入不会抛出异常

            form.Load += new System.EventHandler(this.FormLoad);
            form.Closed += new System.EventHandler(this.FormClosed);
        }

        // 原来外部主动调用一次本函数的做法没有必要了。正确的做法是,调用 LinkFormState() 即可,对话框关闭时会自动保存好尺寸
        public void UnlinkFormState(Form form)
        {
            if (titleTable == null)
                return;

            titleTable.Remove(form);
            // If the Hashtable does not contain an element with the specified key,
            // the Hashtable remains unchanged. No exception is thrown.

            // 2015/6/5
            form.Load -= new System.EventHandler(this.FormLoad);
            form.Closed -= new System.EventHandler(this.FormClosed);
        }

        private void FormLoad(object sender, System.EventArgs e)
        {
            Debug.Assert(sender != null, "sender不能为null");
            Debug.Assert(sender is Form, "sender应为Form对象");

            Debug.Assert(titleTable != null, "titleTable应当已经被LinkFromState()初始化");

            string strCfgTitle = (string)titleTable[sender];
            Debug.Assert(strCfgTitle != null, "strCfgTitle不能为null");

            this.LoadFormStates((Form)sender, strCfgTitle);
        }

        private void FormClosed(object sender, System.EventArgs e)
        {
            Debug.Assert(sender != null, "sender不能为null");
            Debug.Assert(sender is Form, "sender应为Form对象");

            Debug.Assert(titleTable != null, "titleTable应当已经被LinkFromState()初始化");

            string strCfgTitle = (string)titleTable[sender];
            if (string.IsNullOrEmpty(strCfgTitle) == true)
                return;

            Debug.Assert(strCfgTitle != null, "strCfgTitle不能为null");

            this.SaveFormStates((Form)sender, strCfgTitle);

            this.Save();
            this.UnlinkFormState((Form)sender);
        }
    }

}


text:
angular.module('orkaApp', [
    'ui.bootstrap',
    'anol.layerswitcher', 'anol.permalink',
    'orka.config', 'orka.print', 'orka.featurelist', 'orka.layertree', 'orka.featurepopup', 'orka.mouseposition', 'orka.locations'
])

.config(['ConfigServiceProvider', function(ConfigServiceProvider) {
    ConfigServiceProvider.setConfig(orkaAppConfig);
}])

.config(['ConfigServiceProvider', 'MapServiceProvider', function(ConfigServiceProvider, MapServiceProvider) {
    MapServiceProvider.addView(new ol.View({
        projection: ConfigServiceProvider.config.map.projection,
        center: ConfigServiceProvider.config.map.center,
        resolutions: ConfigServiceProvider.config.map.resolutions,
        zoom: ConfigServiceProvider.config.map.zoom
    }));
}])

.config(['ControlsServiceProvider', function(ControlsServiceProvider) {
    ControlsServiceProvider.setControls([
        new ol.control.Zoom(),
        new ol.control.Rotate(),
        new ol.control.Attribution({
            collapsed: false,
            collapsible: false
        }),
        new ol.control.ZoomSlider()
    ]);
}])

.config(['ConfigServiceProvider', 'PermalinkServiceProvider', function(ConfigServiceProvider, PermalinkServiceProvider) {
    PermalinkServiceProvider.setUrlCrs(ConfigServiceProvider.config.map.projection.getCode());
}])

.config(['ConfigServiceProvider', 'LayersFactoryProvider', 'LayersServiceProvider', function(ConfigServiceProvider, LayersFactoryProvider, LayersServiceProvider) {
    var layers = [];
    angular.forEach(ConfigServiceProvider.config.backgroundLayer, function(backgroundLayer) {
        var layer = LayersFactoryProvider.newTMS({
            projection: ConfigServiceProvider.config.map.projection,
            resolutions: ConfigServiceProvider.config.map.resolutions,
            extent: ConfigServiceProvider.config.map.extent,
            format: backgroundLayer.format,
            baseURL: backgroundLayer.baseURL,
            layer: backgroundLayer.layer,
            title: backgroundLayer.title,
            shortcut: backgroundLayer.shortcut,
            isBackground: true,
            attributions: backgroundLayer.attributions
        });
        layer.set('printLayer', backgroundLayer.printLayer);
        layers.push(layer);
    });
    LayersServiceProvider.setLayers(layers);
}])

.config(['ConfigServiceProvider', 'LayersFactoryProvider', 'LayersServiceProvider', 'LayertreeServiceProvider', function(ConfigServiceProvider, LayersFactoryProvider, LayersServiceProvider, LayertreeServiceProvider) {
    if(ConfigServiceProvider.config.poi !== undefined && ConfigServiceProvider.config.track !== undefined) {
        var poiLayer = LayersFactoryProvider.newDynamicGeoJSON({
            projection: ConfigServiceProvider.config.map.projection,
            url: ConfigServiceProvider.config.poi.layerURL,
            title: 'POI Layer',
            layer: ConfigServiceProvider.config.poi.layerName,
            visible: false,
            displayInLayerswitcher: false,
            additionalParameters: LayertreeServiceProvider.getAdditionalPoiParametersCallback(),
        });
        var trackLayer = LayersFactoryProvider.newSingleTileWMS({
            extent: ConfigServiceProvider.config.map.extent,
            url: ConfigServiceProvider.config.track.layerURL,
            title: 'Track Layer',
            layer: ConfigServiceProvider.config.track.layerName,
            visible: false,
            displayInLayerswitcher: false,
            params: {
                'LAYERS': ConfigServiceProvider.config.track.layerName,
                'TRANSPARENT': true,
                'SRS': ConfigServiceProvider.config.map.projection.getCode()
            }
        });

        LayertreeServiceProvider.setPoiLayer(poiLayer);
        LayertreeServiceProvider.setTrackLayer(trackLayer);
        LayertreeServiceProvider.setPoiLegendUrl(ConfigServiceProvider.config.poi.legendURL);
        LayertreeServiceProvider.setTrackLegendUrl(ConfigServiceProvider.config.track.legendURL);
        LayertreeServiceProvider.setIconBaseUrl(ConfigServiceProvider.config.poi.iconBaseURL);

        LayersServiceProvider.setLayers([
            trackLayer,
            poiLayer
        ]);
    }
}])

.config(['ConfigServiceProvider', 'PrintPageServiceProvider', 'PrintServiceProvider', function(ConfigServiceProvider, PrintPageServiceProvider, PrintServiceProvider) {
    if(ConfigServiceProvider.config.print !== undefined) {
        PrintPageServiceProvider.setPageSizes(ConfigServiceProvider.config.print.pageSizes);
        PrintPageServiceProvider.setOutputFormats(ConfigServiceProvider.config.print.outputFormats);
        PrintPageServiceProvider.setDefaultScale(ConfigServiceProvider.config.print.defaultScale);
        PrintPageServiceProvider.setStyle(new ol.style.Style({
            fill: new ol.style.Fill({
                color: ConfigServiceProvider.config.print.style.fillColor
            }),
            stroke: new ol.style.Stroke({
                color: ConfigServiceProvider.config.print.style.strokeColor,
                width: ConfigServiceProvider.config.print.style.strokeWidth
            }),
            image: new ol.style.Circle({
                radius: ConfigServiceProvider.config.print.style.pointRadius,
                cursor: ConfigServiceProvider.config.print.style.pointCursor,
                fill: new ol.style.Fill({
                    color: ConfigServiceProvider.config.print.style.pointFillColor
                }),
                stroke: new ol.style.Stroke({
                    color: ConfigServiceProvider.config.print.style.pointStrokeColor,
                    width: ConfigServiceProvider.config.print.style.pointStrokeWidth
                })
            })
        }));

        PrintServiceProvider.setCreateDownloadUrl(ConfigServiceProvider.config.print.createURL);
        PrintServiceProvider.setCheckDownloadUrl(ConfigServiceProvider.config.print.checkURL);
        PrintServiceProvider.setCheckDownloadDelay(ConfigServiceProvider.config.print.checkDelay);
        PrintServiceProvider.setDownloadUrl(ConfigServiceProvider.config.print.downloadURL);
    }
}])

// need to start PermalinkService, can be removed if app using PermalinkDirective (when exist)
.run(['PermalinkService', function(PermalinkService) {}]);


text:
import requests
import argparse
import sys
import time
from datetime import date
import os
import json
import subprocess
import re

url = 'http://scorer.nmt-benchmark.net'

def main(args):
    scriptpath=os.path.dirname(os.path.realpath(__file__))

    parser = argparse.ArgumentParser(description='Benchmark test download')
    parser.add_argument('--apikey', help='Your API key',required=True)
    parser.add_argument('--src', help='Source language',required=True)
    parser.add_argument('--tgt', help='Target language',required=True)
    parser.add_argument('--basedir', default='.',
                        help='Directory to download the tests to - will create a directory')

    args = parser.parse_args(args)

    assert len(args.src)==2 and len(args.tgt)==2, "invalid langugage pair"
    assert len(args.apikey)==20, "invalid api key"
    assert os.path.isdir(args.basedir), "invalid directory"

    today = date.today()
    testdir = "benchmark-nmt-test-"+args.src+args.tgt+"-"+today.isoformat()
    pathtestdir = os.path.join(args.basedir,testdir)

    assert not os.path.exists(pathtestdir), "directory ["+pathtestdir+"] already exists"

    response = requests.get(url + '/test/list/' + args.apikey + '?src=' + args.src + '&tgt=' + args.tgt)
    if response.status_code != requests.codes.ok:
        response.raise_for_status()
        sys.exit(1)

    R=response.json()

    if len(R)==0:
        print 'no testset available for '+args.src+'>'+args.tgt
        sys.exit(0)
    else:
        print str(len(R))+' testset(s) available for '+args.src+'>'+args.tgt

    os.mkdir(pathtestdir)

    for r in R:
        print "downloading - "+r['source']['fileName']+" into "+pathtestdir
        response = requests.get(url + '/test/download/' + args.apikey + '?fileId=' + r['_id'])
        if response.status_code != requests.codes.ok:
            response.raise_for_status()
            os.exit(1)
        with open(os.path.join(pathtestdir,r['source']['fileName']+".info"), "wb") as testinfo:
            testinfo.write(json.dumps(r,indent=True))
        with open(os.path.join(pathtestdir,r['source']['fileName']+".org"), "wb") as test:
            test.write(response.content)
        testtxt = open(os.path.join(pathtestdir,r['source']['fileName']+".txt"), "wb")
        if re.search(r"\.(sgm|sgml|xml)$",r['source']['fileName']):
            p = subprocess.Popen(["perl",scriptpath+"/3rdParty/input-from-sgm.perl"],stdin=subprocess.PIPE,stdout=testtxt)
            p.stdin.write(response.content)
            p.communicate()
        else:
            testtxt.write(response.content)
        print "--> text version available: ",os.path.join(pathtestdir,r['source']['fileName']+".txt")
        testtxt.close()

if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))


text:
package com.github.zarena.utils;

import java.io.*;

import net.minecraft.server.v1_7_R1.*;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.util.Vector;

import com.github.zarena.ZArena;

public class Utils
{
	/**
	 * Checks if two text files contain the same contents.
	 * @param file1	first file being compared
	 * @param file2	second file being compared
	 * @return		whether or not the two files contain the same contents
	 */
	public static boolean fileEquals(File file1, File file2)
	{
		if(!file1.exists() || !file2.exists())
			return false;
		try
		{
			new BufferedReader(new InputStreamReader(System.in));
			String s1 = "";
			String s2 = "";
			String y, z;

			BufferedReader bfr1 = new BufferedReader(new FileReader(file1));

			BufferedReader bfr2 = new BufferedReader(new FileReader(file2));

			while ((y = bfr1.readLine()) != null)
				s1 += y;

			while ((z = bfr2.readLine()) != null)
				s2 += z;

			bfr1.close();
			bfr2.close();

			if (s2.equals(s1))
				return true;
		} catch (IOException e)
		{
			e.printStackTrace();
		}
		return false;
	}

	/**
	 * Gets the armor of the player
	 * @param player the player who's armor is being gotten
	 * @return armor points of the player
	 */
	public static int getArmor(Player player)
	{
		PlayerInventory pi = player.getInventory();
		ItemStack helm = null;
		ItemStack chest = null;
		ItemStack pants = null;
		ItemStack boots = null;
		if(pi.getHelmet() != null)
			helm = player.getInventory().getHelmet();
		if(pi.getChestplate() != null)
			chest = player.getInventory().getChestplate();
		if(pi.getLeggings() != null)
			pants= player.getInventory().getLeggings();
		if(pi.getBoots() != null)
			boots = player.getInventory().getBoots();
		int armor = 0;
		if(helm != null) {
			switch (helm.getType())
			{
			case DIAMOND_HELMET:  armor = armor + 3;
			break;
			case IRON_HELMET:  armor = armor + 2;
			break;
			case CHAINMAIL_HELMET:  armor = armor + 2;
			break;
			case GOLD_HELMET:  armor = armor + 2;
			break;
			case LEATHER_HELMET:  armor = armor + 1;
			break;
			default:
				break;
			}
		}
		if(chest != null) {
			switch (chest.getType())
			{
			case DIAMOND_CHESTPLATE:  armor = armor + 8;
			break;
			case IRON_CHESTPLATE:  armor = armor + 6;
			break;
			case CHAINMAIL_CHESTPLATE:  armor = armor + 5;
			break;
			case GOLD_CHESTPLATE:  armor = armor + 5;
			break;
			case LEATHER_CHESTPLATE:  armor = armor + 3;
			break;
			default:
				break;
			}
		}
		if(pants != null) {
			switch (pants.getType())
			{
			case DIAMOND_LEGGINGS:  armor = armor + 6;
			break;
			case IRON_LEGGINGS:  armor = armor + 5;
			break;
			case CHAINMAIL_LEGGINGS:  armor = armor + 4;
			break;
			case GOLD_LEGGINGS:  armor = armor + 3;
			break;
			case LEATHER_LEGGINGS:  armor = armor + 2;
			break;
			default:
				break;
			}
		}
		if(boots != null) {
			switch (boots.getType())
			{
			case DIAMOND_BOOTS:  armor = armor + 3;
			break;
			case IRON_BOOTS:  armor = armor + 2;
			break;
			case CHAINMAIL_BOOTS:  armor = armor + 1;
			break;
			case GOLD_BOOTS:  armor = armor + 1;
			break;
			case LEATHER_BOOTS:  armor = armor + 1;
			break;
			default:
				break;
			}
		}
		return armor;
	}

	public static int getWeaponCount(PlayerInventory pm)
	{
		int weapons = 0;
		for(ItemStack i: pm.getContents())
		{
			Material m = null;
			try
			{
				m = i.getType();
			} catch(NullPointerException e)
			{
			}
			if(m != null)
			{
				switch(m)
				{
				case WOOD_SWORD:
				case STONE_SWORD:
				case GOLD_SWORD:
				case IRON_SWORD:
				case DIAMOND_SWORD:
				case WOOD_AXE:
				case STONE_AXE:
				case GOLD_AXE:
				case IRON_AXE:
				case DIAMOND_AXE:
				case BOW:
					weapons++;
					break;
				default:
					break;
				}
			}
		}
		return weapons;
	}

	//I suspect the verticalModifier isn't working...
	public static void knockBack(LivingEntity entity, Location source, double horizontalModifier, double verticalModifier)
	{
		if(((CraftLivingEntity) entity).getHandle().hurtTicks < 0)
			return;
		Location playerLocation = entity.getLocation();
		double xPower = source.getX() - playerLocation.getX();
		double yPower = 0.4D;
		double zPower;

        for (zPower = source.getZ() - playerLocation.getZ(); xPower * xPower + zPower * zPower < 1.0E-4D; zPower = (Math.random() - Math.random()) * 0.01D)
        {
        	xPower = (Math.random() - Math.random()) * 0.01D;
        }

		if (yPower > 0.4000000059604645)
        {
			yPower = 0.4000000059604645;
        }

		Vector v = entity.getVelocity();
		double motionX = v.getX();
		double motionY = v.getY();
		double motionZ = v.getZ();
		double horizontal = MathHelper.sqrt(xPower * xPower + zPower * zPower);
		double vertical = yPower;
		motionX /= 2.0D;
		motionY /= 2.0D;
		motionZ /= 2.0D;
		motionX -= xPower / horizontal * vertical;
		motionY += vertical;
		motionZ -= zPower / horizontal * vertical;

		motionX *= horizontalModifier;
		motionY *= verticalModifier;
		motionZ *= horizontalModifier;

		entity.setVelocity(new Vector(motionX, motionY, motionZ));
	}

	/**
	 * Ease of use method for extracting a File from the plugin .jar file to a specified directory.
	 * @param dir	    directory to extract to
	 * @param fileName	name of file being extracted
     * @param override  whether or not to override if the file already exists
	 * @return	        file that was moved, or file that was already there if there was one, or null if the file is null
	 * @throws IOException
	 */
	public static File extractFromJar(File dir, String fileName, boolean override) throws IOException
	{
        if (!dir.exists())	//Make directory if it doesn't exist
        	dir.mkdirs();

        File file = new File(dir, fileName);

        if (file.exists() && !override)
        	return file;

        InputStream in = ZArena.class.getResourceAsStream("/"+fileName);	//Get inputstream from base folder
        if (in == null)
        	throw new FileNotFoundException(fileName+" could not be found from the base folder.");

        FileOutputStream out = new FileOutputStream(file);
        byte[] buffer = new byte[1024];	//Create a buffer

        //Have the inputstream read the buffer and write it to it's new directory
        int read;
        while ((read = in.read(buffer)) > 0)
        	out.write(buffer, 0, read);

        //Close up everything
        in.close();
        out.flush();
        out.close();

        return file;
	}

    /**
     * Ease of use method for extracting a File from the plugin .jar file to a specified directory.
     * @param dir	directory to extract to
     * @param fileName	name of file being extracted
     * @return	file that was moved, or file that was already there if there was one, or null if the file is null
     * @throws IOException
     */
    public static File extractFromJar(File dir, String fileName) throws IOException
    {
        return extractFromJar(dir, fileName, false);
    }

	/**
	 * Parse a String to a int
	 * @param toParse	string to be parsed
	 * @param defaultValue	default value to return if 'toParse' is not parsable
	 * @return	int value of 'toParse', or 'defaultValue' if it is not parsable
	 */
	public static int parseInt(String toParse, int defaultValue)
	{
		try
		{
			return Integer.parseInt(toParse);
		} catch(NumberFormatException e)
		{
			return defaultValue;
		}
	}

	/**
	 * Parse a String to a double
	 * @param toParse	string to be parsed
	 * @param defaultValue	default value to return if 'toParse' is not parsable
	 * @return	double value of 'toParse', or 'defaultValue' if it is not parsable
	 */
	public static double parseDouble(String toParse, double defaultValue)
	{
		try
		{
			return Double.parseDouble(toParse);
		} catch(NumberFormatException e)
		{
			return defaultValue;
		}
	}

	/**
	 * Get arguments from a String gotten from a YAMLConfiguration entry, split by commas.
	 * @param regex	the String to get the arguments from
	 * @return		array of arguments
	 */
	public static String[] getConfigArgs(String regex)
	{
		String[] args = new String[0];
		if(regex.contains(" "))
		{
			String argsNotArray = regex.split("\\s")[1];
			args = argsNotArray.split(",");
		}
		return args;
	}

	/**
	 * Convert to the new config setup
	 * @param oldConfig old config
	 * @param newConfig new config
	 */
	public static void convertToNewConfig(Configuration newConfig, Configuration oldConfig)
	{
		newConfig.set(ConfigEnum.AUTOSTART.toString(), oldConfig.getBoolean("Options.Auto-Start"));
		newConfig.set(ConfigEnum.AUTORUN.toString(), oldConfig.getBoolean("Options.Auto-Run"));
		newConfig.set(ConfigEnum.AUTOJOIN.toString(), oldConfig.getBoolean("Options.Auto-Join"));
		newConfig.set(ConfigEnum.PLAYER_LIMIT.toString(), oldConfig.getInt("Options.Player Limit"));
		if(oldConfig.contains("Entities.Mob Cap"))
			newConfig.set(ConfigEnum.MOB_CAP.toString(), oldConfig.getInt("Entities.Mob Cap"));
		newConfig.set(ConfigEnum.VOTING_LENGTH.toString(), oldConfig.getInt("Options.Voting Length"));
		newConfig.set(ConfigEnum.WAVE_DELAY.toString(), oldConfig.getInt("Options.Wave Start Delay"));
		newConfig.set(ConfigEnum.WORLD_EXCLUSIVE.toString(), oldConfig.getBoolean("Options.World Exclusive"));
		newConfig.set(ConfigEnum.DISABLE_HUNGER.toString(), oldConfig.getBoolean("Options.Disable Hunger"));
		newConfig.set(ConfigEnum.RESPAWN_EVERY_WAVES.toString(), oldConfig.getInt("Options.Respawn Every X Waves (0 to disable)"));
		if(oldConfig.contains("Options.Respawn Every X Minutes (0 to disable)"))
			newConfig.set(ConfigEnum.RESPAWN_EVERY_TIME.toString(), oldConfig.getInt("Options.Respawn Every X Minutes (0 to disable)"));
		newConfig.set(ConfigEnum.START_ITEMS.toString(), oldConfig.getStringList("Options.Start Items"));
		newConfig.set(ConfigEnum.KILL_MONEY.toString(), oldConfig.getInt("Stats.Money on Kill"));
		newConfig.set(ConfigEnum.MONEY_LOST.toString(), oldConfig.getDouble("Stats.Money Percent Lost on Death"));
		if(oldConfig.contains("Stats.Use Vault Economy"))
			newConfig.set(ConfigEnum.USE_VAULT.toString(), oldConfig.getBoolean("Stats.Use Vault Economy"));

		newConfig.set(ConfigEnum.HEALTH_STARTING.toString(), oldConfig.getDoubleList("Zombies.Health.Coefficients").get(2));
		newConfig.set(ConfigEnum.HEALTH_INCREASE.toString(), oldConfig.getDoubleList("Zombies.Health.Coefficients").get(1));
		String formulaType = oldConfig.getString("Zombies.Health.Formula Type [Quadratic|Logistic|Logarithmic]");
		if(formulaType.equalsIgnoreCase("Logarithmic"))
			newConfig.set(ConfigEnum.HEALTH_EXPOTENTIAL_INCREASE.toString(), 0.5);
		else
			newConfig.set(ConfigEnum.HEALTH_EXPOTENTIAL_INCREASE.toString(), oldConfig.getDoubleList("Zombies.Health.Coefficients").get(0));
		if(formulaType.equalsIgnoreCase("Logistic"))
		{
			newConfig.set(ConfigEnum.HEALTH_LIMIT.toString(), oldConfig.getInt("Zombies.Health.Limit (Only applicaple for Logistic Forumula)"));
			newConfig.set(ConfigEnum.HEALTH_SOFT_LIMIT.toString(), true);
		} else
		{
			newConfig.set(ConfigEnum.HEALTH_LIMIT.toString(), 0);
			newConfig.set(ConfigEnum.HEALTH_SOFT_LIMIT.toString(), false);
		}

		newConfig.set(ConfigEnum.QUANTITY_STARTING.toString(), oldConfig.getDoubleList("Zombies.Quantity.Coefficients").get(2));
		newConfig.set(ConfigEnum.QUANTITY_INCREASE.toString(), oldConfig.getDoubleList("Zombies.Quantity.Coefficients").get(1));
		formulaType = oldConfig.getString("Zombies.Quantity.Formula Type [Quadratic|Logistic|Logarithmic]");
		if(formulaType.equalsIgnoreCase("Logarithmic"))
			newConfig.set(ConfigEnum.QUANTITY_EXPOTENTIAL_INCREASE.toString(), 0.5);
		else
			newConfig.set(ConfigEnum.QUANTITY_EXPOTENTIAL_INCREASE.toString(), oldConfig.getDoubleList("Zombies.Quantity.Coefficients").get(0));
		if(formulaType.equalsIgnoreCase("Logistic"))
		{
			newConfig.set(ConfigEnum.QUANTITY_LIMIT.toString(), oldConfig.getInt("Zombies.Quantity.Limit (Only applicaple for Logistic Forumula)"));
			newConfig.set(ConfigEnum.QUANTITY_SOFT_LIMIT.toString(), true);
		} else
		{
			newConfig.set(ConfigEnum.QUANTITY_LIMIT.toString(), 0);
			newConfig.set(ConfigEnum.QUANTITY_SOFT_LIMIT.toString(), false);
		}

		if(oldConfig.contains("Donator.Start Money"))
		{
			newConfig.set("Donator.Start Money", null);
			for(String nodeName : oldConfig.getConfigurationSection("Donator.Start Money").getKeys(false))
			{
				ConfigurationSection node = oldConfig.getConfigurationSection("Donator.Start Money." + nodeName);
				for(String key : node.getKeys(false))
					newConfig.set(ConfigEnum.START_MONEY.toString()+"."+node.getName()+"."+key, node.get(key));
			}
		}
		if(oldConfig.contains("Donator.Extra Votes"))
		{
			newConfig.set("Donator.Extra Votes", null);
			for(String nodeName : oldConfig.getConfigurationSection("Donator.Extra Votes").getKeys(false))
			{
				ConfigurationSection node = oldConfig.getConfigurationSection("Donator.Extra Votes." + nodeName);
				for(String key : node.getKeys(false))
					newConfig.set(ConfigEnum.EXTRA_VOTES.toString()+"."+node.getName()+"."+key, node.get(key));
			}
		}
		if(oldConfig.contains("SignCustomItems"))
		{
			newConfig.set("SignCustomItems", null);
			for(String nodeName : oldConfig.getConfigurationSection("SignCustomItems").getKeys(false))
			{
				ConfigurationSection node = oldConfig.getConfigurationSection("SignCustomItems." + nodeName);
				for(String key : node.getKeys(false))
					newConfig.set(ConfigEnum.CUSTOM_ITEMS.toString()+"."+node.getName()+"."+key, node.get(key));
			}
		}

		newConfig.set(ConfigEnum.ALWAYS_NIGHT.toString(), oldConfig.getBoolean("Options.Always Night"));
		newConfig.set(ConfigEnum.QUANTITY_ADJUST.toString(), oldConfig.getBoolean("Options.Adjust Quantity Based on Player Amount"));
		newConfig.set(ConfigEnum.SEPERATE_INVENTORY.toString(), oldConfig.getBoolean("Options.Seperate Inventory"));
		newConfig.set(ConfigEnum.DISABLE_JOIN_WITH_INV.toString(), oldConfig.getBoolean("Options.Disable Joining Game With Inventory"));
		newConfig.set(ConfigEnum.SAVE_POSITION.toString(), oldConfig.getBoolean("Options.Save Position on Game Join"));
		newConfig.set(ConfigEnum.GAME_LEAVE_WORLD.toString(), oldConfig.getString("Options.Game Leave World"));
		newConfig.set(ConfigEnum.GAME_LEAVE_LOCATION.toString(), oldConfig.getDoubleList("Options.Game Leave Location"));
		newConfig.set(ConfigEnum.XP_BAR_IS_MONEY.toString(), oldConfig.getBoolean("Options.XP Bar Shows Money"));
		newConfig.set(ConfigEnum.BROADCAST_ALL.toString(), oldConfig.getBoolean("Options.Broadcast To All"));
		newConfig.set(ConfigEnum.DISABLE_NON_ZA.toString(), oldConfig.getBoolean("Options.Disable Non ZArena Commands In Game"));
		newConfig.set(ConfigEnum.ENABLE_KILLCOUNTER.toString(), oldConfig.getBoolean("Options.Enable Killcounter"));
		if(oldConfig.contains("Options.Set AFK Players as Dead"))
			newConfig.set(ConfigEnum.ENABLE_AFKKICKER.toString(), oldConfig.getBoolean("Options.Set AFK Players as Dead"));
		if(oldConfig.contains("Options.Respawn Reminder Delay (Seconds)"))
			newConfig.set(ConfigEnum.RESPAWN_REMINDER_DELAY.toString(), oldConfig.getInt("Options.Respawn Reminder Delay (Seconds)"));
		newConfig.set(ConfigEnum.SHOP_HEADER.toString(), oldConfig.getString("Options.Shop Sign Header"));
		newConfig.set(ConfigEnum.TOLL_HEADER.toString(), oldConfig.getString("Options.Toll Sign Header"));
		newConfig.set(ConfigEnum.WOLF_PERCENT_SPAWN.toString(), oldConfig.getDouble("Entities.Wolf Spawn Chance"));
		newConfig.set(ConfigEnum.SKELETON_PERCENT_SPAWN.toString(), oldConfig.getDouble("Entities.Skeleton Spawn Chance"));
		newConfig.set(ConfigEnum.WOLF_WAVE_PERCENT_OCCUR.toString(), oldConfig.getDouble("Entities.Wolf Wave Chance"));
		newConfig.set(ConfigEnum.SKELETON_WAVE_PERCENT_OCCUR.toString(), oldConfig.getDouble("Entities.Skeleton Wave Chance"));
		newConfig.set(ConfigEnum.WOLF_WAVE_PERCENT_SPAWN.toString(), oldConfig.getDouble("Entities.Wolf Spawn Chance During Wolf Wave"));
		newConfig.set(ConfigEnum.SKELETON_WAVE_PERCENT_SPAWN.toString(), oldConfig.getDouble("Entities.Skeleton Spawn Chance During Wolf Wave"));
		newConfig.set(ConfigEnum.DEFAULT_ZOMBIE.toString(), oldConfig.getString("Entities.Default Entity File Name"));
		newConfig.set(ConfigEnum.DEFAULT_SKELETON.toString(), oldConfig.getString("Entities.Default Skeleton File Name"));
		newConfig.set(ConfigEnum.DEFAULT_WOLF.toString(), oldConfig.getString("Entities.Default Wolf File Name"));
		newConfig.set(ConfigEnum.DEFAULT_GAMEMODE.toString(), oldConfig.getString("Gamemodes.Default Gamemode File Name"));
	}

	public static CraftInventoryPlayer loadOfflinePlayerInventory(String playerName) throws IOException
	{
		NBTTagList list = (NBTTagList) getOfflinePlayerTagValue(playerName, "Inventory");
		net.minecraft.server.v1_7_R1.PlayerInventory pi = new net.minecraft.server.v1_7_R1.PlayerInventory(null);
		pi.b(list);
		return new CraftInventoryPlayer(pi);
	}

	public static void saveOfflinePlayerInventory(String playerName, CraftInventoryPlayer ci) throws IOException
	{
		setOfflinePlayerTagValue(playerName, "Inventory", ci.getInventory().a(new NBTTagList()));
	}

	public static Object getOfflinePlayerTagValue(String playerName, String tagName) throws IOException
	{
		String pathToPlayerFile = "world"+File.separator+"players"+File.separator+playerName+".dat";
		FileInputStream is = null;
		try
		{
			is = new FileInputStream(pathToPlayerFile);
			NBTTagCompound compound = NBTCompressedStreamTools.a(is);

			switch(compound.get(tagName).getTypeId())
			{
				case 0: return null;
				case 1: return compound.getByte(tagName);
				case 2: return compound.getShort(tagName);
				case 3: return compound.getInt(tagName);
				case 4: return compound.getLong(tagName);
				case 5: return compound.getFloat(tagName);
				case 6: return compound.getDouble(tagName);
				case 7: return compound.getByteArray(tagName);
				case 8: return compound.getString(tagName);
				case 9: return compound.getList(tagName, 10);
				case 10: return compound.getCompound(tagName);
				case 11: return compound.getIntArray(tagName);
				default: return null;
			}
		} finally
		{
			if(is != null)
				is.close();
		}
	}

	public static void setOfflinePlayerTagValue(String playerName, String tagName, Object tagValue) throws IOException
	{
		String pathToPlayerFile = "world"+File.separator+"players"+File.separator+playerName+".dat";
		FileInputStream is = null;
		FileOutputStream os = null;
		try
		{
			is = new FileInputStream(pathToPlayerFile);
			NBTTagCompound compound = NBTCompressedStreamTools.a(is);

			if(tagValue instanceof Boolean || tagValue.getClass().isAssignableFrom(boolean.class))
				compound.setBoolean(tagName, (Boolean) tagValue);
			else if(tagValue instanceof Byte || tagValue.getClass().isAssignableFrom(byte.class))
				compound.setByte(tagName, (Byte) tagValue);
			else if(tagValue instanceof Short || tagValue.getClass().isAssignableFrom(short.class))
				compound.setShort(tagName, (Short) tagValue);
			else if(tagValue instanceof Integer || tagValue.getClass().isAssignableFrom(int.class))
				compound.setInt(tagName, (Integer) tagValue);
			else if(tagValue instanceof Long || tagValue.getClass().isAssignableFrom(long.class))
				compound.setLong(tagName, (Long) tagValue);
			else if(tagValue instanceof Float || tagValue.getClass().isAssignableFrom(float.class))
				compound.setFloat(tagName, (Float) tagValue);
			else if(tagValue instanceof Double || tagValue.getClass().isAssignableFrom(double.class))
				compound.setDouble(tagName, (Double) tagValue);
			else if(tagValue instanceof byte[])
				compound.setByteArray(tagName, (byte[]) tagValue);
			else if(tagValue instanceof String)
				compound.setString(tagName, (String) tagValue);
			else if(tagValue instanceof int[])
				compound.setIntArray(tagName, (int[]) tagValue);
			else if(tagValue instanceof NBTBase)
				compound.set(tagName, (NBTBase) tagValue);
			else
				throw new IllegalArgumentException("The type of the new value must be an NBT supported type.");
			os = new FileOutputStream(pathToPlayerFile);
			NBTCompressedStreamTools.a(compound, os);
		} finally
		{
			if(is != null)
				is.close();
			if(os != null)
				os.close();
		}
	}
}


text:
import _ from 'lodash';
import Promise from 'bluebird';
import Joi from 'joi';
import getClusterStatus from '../../../lib/get_cluster_status';
import getNodeSummary from '../../../lib/get_node_summary';
import getMetrics from '../../../lib/get_metrics';
import getListing from '../../../lib/get_listing_nodes';
import getShardStats from '../../../lib/get_shard_stats';
import getShardAllocation from '../../../lib/get_shard_allocation';
import calculateIndices from '../../../lib/calculate_indices';
import calculateClusterShards from '../../../lib/elasticsearch/calculate_cluster_shards';
import calculateNodeType from '../../../lib/calculate_node_type';
import getLastState from '../../../lib/get_last_state';
import getDefaultNodeFromId from '../../../lib/get_default_node_from_id';
import lookups from '../../../lib/lookups';
import handleError from '../../../lib/handle_error';

export default function nodesRoutes(server) {
  const config = server.config();
  const esIndexPattern = config.get('xpack.monitoring.elasticsearch.index_pattern');

  function getNodeTypeClassLabel(node) {
    const nodeType = (node.master && 'master') || node.type;
    const typeClassLabel = {
      nodeType,
      nodeTypeLabel: _.get(lookups, `nodeTypeLabel['${nodeType}']`),
      nodeTypeClass: _.get(lookups, `nodeTypeClass['${nodeType}']`)
    };
    return typeClassLabel;
  }

  server.route({
    method: 'POST',
    path: '/api/monitoring/v1/clusters/{clusterUuid}/elasticsearch/nodes',
    config: {
      validate: {
        params: Joi.object({
          clusterUuid: Joi.string().required()
        }),
        payload: Joi.object({
          timeRange: Joi.object({
            min: Joi.date().required(),
            max: Joi.date().required()
          }).required(),
          listingMetrics: Joi.array().required()
        })
      }
    },
    handler: (req, reply) => {
      const start = req.payload.timeRange.min;
      const end = req.payload.timeRange.max;

      calculateIndices(req, start, end, esIndexPattern)
      .then(indices => {
        return getLastState(req, indices)
        .then(lastState => {
          return Promise.props({
            clusterStatus: getClusterStatus(req, indices, lastState),
            listing: getListing(req, indices),
            shardStats: getShardStats(req, indices, lastState),
            clusterState: lastState
          });
        });
      })
      // Add the index status to each index from the shardStats
      .then((body) => {
        body.nodes = body.listing.nodes;
        body.rows = body.listing.rows;
        const clusterState = body.clusterState && body.clusterState.cluster_state || { nodes: {} };
        body.rows.forEach((row) => {
          const resolver = row.name;
          const shardStats = body.shardStats.nodes[resolver];
          let node = body.nodes[resolver];

          // Add some extra metrics
          row.metrics.shard_count = shardStats && shardStats.shardCount || 0;
          row.metrics.index_count = shardStats && shardStats.indexCount || 0;

          // copy some things over from nodes to row
          row.resolver = resolver;
          row.online = !_.isUndefined(clusterState.nodes[row.resolver]);
          if (!node) {
            // workaround for node indexed with legacy agent
            node = getDefaultNodeFromId(resolver);
          }
          node.type = calculateNodeType(node, clusterState);
          row.node = node;
          delete row.name;

          // set type for labeling / iconography
          const { nodeType, nodeTypeLabel, nodeTypeClass } = getNodeTypeClassLabel(row.node);
          row.node.type = nodeType;
          row.node.nodeTypeLabel = nodeTypeLabel;
          row.node.nodeTypeClass = nodeTypeClass;
        });
        delete body.listing;
        delete body.clusterState;
        return body;
      })
      // Send the response
      .then(calculateClusterShards)
      .then(reply)
      .catch(err => reply(handleError(err, req)));
    }
  });

  server.route({
    method: 'POST',
    path: '/api/monitoring/v1/clusters/{clusterUuid}/elasticsearch/nodes/{resolver}',
    config: {
      validate: {
        params: Joi.object({
          clusterUuid: Joi.string().required(),
          resolver: Joi.string().required()
        }),
        payload: Joi.object({
          timeRange: Joi.object({
            min: Joi.date().required(),
            max: Joi.date().required()
          }).required(),
          metrics: Joi.array().required()
        })
      }
    },
    handler: (req, reply) => {
      const resolver = req.params.resolver;
      const start = req.payload.timeRange.min;
      const end = req.payload.timeRange.max;
      calculateIndices(req, start, end, esIndexPattern)
      .then(indices => {
        return getLastState(req, indices)
        .then(lastState => {
          const configResolver = `source_node.${config.get('xpack.monitoring.node_resolver')}`;
          return Promise.props({
            clusterStatus: getClusterStatus(req, indices, lastState),
            nodeSummary: getNodeSummary(req, indices),
            metrics: getMetrics(req, indices, [{ term: { [configResolver]: resolver } }]),
            shards: getShardAllocation(req, indices, [{ term: { [configResolver]: resolver } }], lastState),
            shardStats: getShardStats(req, indices, lastState),
            nodes: {},
            clusterState: lastState
          });
        });
      })
      .then(calculateClusterShards)
      .then(body => {
        const clusterState = body.clusterState && body.clusterState.cluster_state || { nodes: {} };
        let nodeDetail = body.nodeSummary.node;
        if (!nodeDetail) {
          // workaround for node indexed with legacy agent
          nodeDetail = getDefaultNodeFromId(resolver);
        }
        nodeDetail.type = calculateNodeType(nodeDetail, clusterState);
        body.nodes[resolver] = nodeDetail;

        // set type for labeling / iconography
        const { nodeType, nodeTypeLabel, nodeTypeClass } = getNodeTypeClassLabel(nodeDetail);
        nodeDetail.type = nodeType;
        nodeDetail.nodeTypeLabel = nodeTypeLabel;
        nodeDetail.nodeTypeClass = nodeTypeClass;

        body.nodeSummary.totalShards = _.get(body, `shardStats.nodes['${resolver}'].shardCount`);
        body.nodeSummary.indexCount = _.get(body, `shardStats.nodes['${resolver}'].indexCount`);

        // combine data from different sources into 1 object
        body.nodeSummary = _.merge(body.nodeSummary, nodeDetail);

        body.nodeSummary.status = 'Online';
        // If this node is down
        if (!clusterState.nodes[body.nodeSummary.resolver]) {
          body.nodeSummary.documents = 'N/A';
          body.nodeSummary.dataSize = 'N/A';
          body.nodeSummary.freeSpace = 'N/A';
          body.nodeSummary.documents = 'N/A';
          body.nodeSummary.indexCount = 'N/A';
          body.nodeSummary.totalShards = 'N/A';
          body.nodeSummary.status = 'Offline';
        }
        delete body.clusterState;
        return body;
      })
      .then(reply)
      .catch(err => reply(handleError(err, req)));
    }
  });

};


text:
<packager-module version="1.0">
  <property name="name" value="${ivy.packager.module}"/>
  <property name="revision" value="${ivy.packager.revision}"/>
  <property name="organisation" value="${ivy.packager.organisation}"/>

  <m2resource
      groupId="${organisation}" artifactId="${name}"
      version="${revision}" repo="https://repo1.maven.org/maven2">

    <artifact tofile="artifacts/jars/${name}.jar"
        sha1="e0b2ed8fac32ad6469d75d034e759f1969db8dda"/>
    <artifact tofile="artifacts/sources/${name}.jar" classifier="sources"
        sha1="12517867d09f09a4e829b80bfc958f69d883fc11"/>
    <artifact tofile="artifacts/javadocs/${name}.jar" classifier="javadoc"
        sha1="e98057b148ed3ab6a1b57ce16cf3b940fa61c25c"/>
  </m2resource>
</packager-module>


text:
<!DOCTYPE html>

    <title>CSS Image Fallbacks and Annotations: the 'image()' notation</title>
    <link rel="author" title="Hirokazu Egashira" href="mailto:yo9ega@aol.com">
    <link rel="help" href="https://www.w3.org/TR/css-images-3/#image-values">
    <link rel="match" href="css-image-fallbacks-and-annotations-ref.html">
    <meta name="assert" content="The rule below would tell the UA to load The first file if it can; failing that to load The second file.">

Test passes if background is green and no red.


text:
namespace Euler
{
    partial class Inicio
    {
        /// <summary>
        /// Variable del diseñador necesaria.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Limpiar los recursos que se estén usando.
        /// </summary>
        /// <param name="disposing">true si los recursos administrados se deben desechar; false en caso contrario.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Código generado por el Diseñador de Windows Forms

        /// <summary>
        /// Método necesario para admitir el Diseñador. No se puede modificar
        /// el contenido de este método con el editor de código.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Inicio));
            this.label1 = new System.Windows.Forms.Label();
            this.btn_PrimerGrado = new System.Windows.Forms.Button();
            this.btn_SegundoGrado = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // label1
            //
            resources.ApplyResources(this.label1, "label1");
            this.label1.Name = "label1";
            //
            // btn_PrimerGrado
            //
            resources.ApplyResources(this.btn_PrimerGrado, "btn_PrimerGrado");
            this.btn_PrimerGrado.Name = "btn_PrimerGrado";
            this.btn_PrimerGrado.UseVisualStyleBackColor = true;
            this.btn_PrimerGrado.Click += new System.EventHandler(this.btn_PrimerGrado_Click);
            //
            // btn_SegundoGrado
            //
            resources.ApplyResources(this.btn_SegundoGrado, "btn_SegundoGrado");
            this.btn_SegundoGrado.Name = "btn_SegundoGrado";
            this.btn_SegundoGrado.UseVisualStyleBackColor = true;
            this.btn_SegundoGrado.Click += new System.EventHandler(this.btn_SegundoGrado_Click);
            //
            // Inicio
            //
            resources.ApplyResources(this, "$this");
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.btn_SegundoGrado);
            this.Controls.Add(this.btn_PrimerGrado);
            this.Controls.Add(this.label1);
            this.MaximizeBox = false;
            this.Name = "Inicio";
            this.Load += new System.EventHandler(this.Inicio_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btn_PrimerGrado;
        private System.Windows.Forms.Button btn_SegundoGrado;
    }
}


text:
package jdk.internal.jimage;

import java.nio.ByteBuffer;

/**
 * @implNote This class needs to maintain JDK 8 source compatibility.
 *
 * It is used internally in the JDK to implement jimage/jrtfs access,
 * but also compiled and delivered as part of the jrtfs.jar to support access
 * to the jimage file provided by the shipped JDK by tools running on JDK 8.
 */
@SuppressWarnings("removal")
class NativeImageBuffer {
    static {
        java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                        System.loadLibrary("jimage");
                        return null;
                    }
                });
    }

    native static ByteBuffer getNativeMap(String imagePath);
}


text:
package org.kie.api.concurrent;

import java.util.concurrent.CompletionService;
import java.util.concurrent.Executor;

import org.kie.api.Service;

public interface KieExecutors extends Service {

    Executor getExecutor();

    <T> CompletionService<T> getCompletionService();
}


text:
<!--
  Copyright 2014 Google Inc. All rights reserved.

  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.
  -->

<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar_actionbar"
    style="?actionbarHeaderStyle"
    android:layout_width="match_parent"
    android:layout_height="?actionBarSize"
    app:contentInsetStart="?actionBarInsetStart"
    app:popupTheme="@style/ActionBarPopupThemeOverlay"
    app:theme="?toolbarTheme"
    app:titleTextAppearance="?toolbarTextAppearance">

</androidx.appcompat.widget.Toolbar>


text:
package org.tigris.subversion.javahl;

import java.io.IOException;

/**
 * Interface for data to be received from subversion
 * used for SVNAdmin.load and SVNAdmin.dump
 */
public interface InputInterface
{
    /**
     * read the number of data.length bytes from input.
     * @param data          array to store the read bytes.
     * @throws IOException  throw in case of problems.
     */
    public int read(byte [] data) throws IOException;

    /**
     * close the input
     * @throws IOException throw in case of problems.
     */
    public void close() throws IOException;
}