text:
<configuration debug="true" scan="true">

	<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
		<encoder>
			<pattern>%date{ISO8601} [%thread] %-5level %logger{36}:%method\(%line\) - %message %exception%n</pattern>
		</encoder>
	</appender>

	<root level="INFO">
		<appender-ref ref="console"/>
	</root>
</configuration>

redpajama_set_name: RedPajamaGithub


text:
This is the Tornado portion of a [benchmarking tests suite](../../)
comparing a variety of web development platforms.

The information below is specific to Tornado. For further guidance,
review the [documentation](http://frameworkbenchmarks.readthedocs.org/en/latest/).
Also note that there is additional information that's provided in
the [Python README](../).

## Infrastructure Software

* CPython 2, 3 and PyPy
* [Tornado](https://www.tornadoweb.com/)
* [Mongodb](https://www.mongodb.org/) with [motor](http://motor.readthedocs.org/en/stable/)
* [PostgreSQL](http://www.postgresql.org/) with [momoko](http://momoko.61924.nl/en/latest/)

## Get Help

### Community

* [python-tornado Google Group](https://groups.google.com/forum/#!forum/python-tornado)

### Resources

* http://www.tornadoweb.org/en/stable/documentation.html


text:
#ifndef OPA_H
#define OPA_H

#include <stdint.h>
#include <stddef.h>

/*****************************************************************************/
#define OPA_COM_BAUDRATE       57600
#define OPA_RXBUFFER_LEN       256

/*****************************************************************************/
typedef enum{
    OPA_DISCONNECTED,
    OPA_CONNECTED,
    OPA_ENUMERATED,
}OPA_COM_STATE;

/*****************************************************************************/
typedef enum{
    OPA_STATUS                 = 0,
    OPA_NOTEON                 = 1,
    OPA_NOTEOFF                = 2,
    OPA_ALLNOTESOFF            = 3,
    OPA_ALLSOUNDSOFF           = 4,
    OPA_PROGRAMPARAMWRITE      = 5,
    OPA_PROGRAMPARAMREAD       = 6,
    OPA_GLOBALSPARAMWRITE      = 7,
    OPA_GLOBALSPARAMREAD       = 8,
    OPA_PROGRAMWRITE           = 9,
    OPA_PROGRAMREAD            = 10,
    OPA_GLOBALSWRITE           = 11,
    OPA_GLOBALSREAD            = 12,
    OPA_INTERNALSTORE          = 13,
    OPA_INTERNALLOAD           = 14,
    OPA_INTERNALWRITE          = 15,
    OPA_INTERNALREAD           = 16,
    OPA_PITCHBEND              = 17,
    OPA_KITPARAMWRITE          = 18,
    OPA_KITPARAMREAD           = 19,
    OPA_KITWRITE               = 20,
    OPA_KITREAD                = 21,
}OPA_MESSAGES;

typedef enum{
    OPA_GLOBAL_VOLUME          = 0,
    OPA_GLOBAL_COARSE          = 1,
    OPA_GLOBAL_FINE            = 2,
    OPA_GLOBAL_FLAGS           = 3,
    OPA_GLOBAL_FMVOLUME        = 4,
    OPA_GLOBAL_KITVOLUME       = 5,
    OPA_GLOBAL_RESERVED1       = 6,
    OPA_GLOBAL_RESERVED2       = 7,
}OPA_GLOBAL_PARAMS;

typedef enum{
    OPA_KIT_VOLUME             = 0,
    OPA_KIT_PANNING            = 1,
    OPA_KIT_DECAY              = 2,
    OPA_KIT_RESERVED           = 3,
}OPA_KIT_PARAMS;

typedef enum{
    OPA_CONFIG_NAME            = 0,
    OPA_CONFIG_ALGO            = 8,
    OPA_CONFIG_VOLUME          = 9,
    OPA_CONFIG_PANNING         = 10,
    OPA_CONFIG_FLAGS           = 11,
}OPA_CONFIG_PARAMS;

typedef enum{
    OPA_OP_VOLUME              = 0,
    OPA_OP_COARSE              = 1,
    OPA_OP_FINE                = 2,
    OPA_OP_ENVATTACK           = 3,
    OPA_OP_ENVDECAY            = 4,
    OPA_OP_ENVSUSTAIN_LEVEL    = 5,
    OPA_OP_ENVINIT_LEVEL       = 6,
    OPA_OP_ENVRELEASE          = 7,
    OPA_OP_LFOSPEED            = 8,
    OPA_OP_LFOAMOUNT           = 9,
    OPA_OP_FEEDBACK            = 10,
    OPA_OP_FLAGS               = 11,
    OPA_OP_RESERVED2           = 12,
    OPA_OP_RESERVED3           = 13,
    OPA_OP_RESERVED4           = 14,
    OPA_OP_RESERVED5           = 15,
}OPA_OP_PARAMS;

/*****************************************************************************/
#define OPA_ALLPROGS_ID             0xFF

#define OPA_ALGOS_OP_NB             4
#define OPA_PROGS_NB                8

#define OPA_GLOBAL_PARAMS_NB        8

#define OPA_PROGS_PARAMS_NB         12
#define OPA_PROGS_NAME_LEN          8
#define OPA_PROGS_OP_PARAMS_NB      16
#define OPA_PROGS_PARAMS_TOTAL      (OPA_PROGS_PARAMS_NB + OPA_PROGS_OP_PARAMS_NB * OPA_ALGOS_OP_NB)

#define OPA_KIT_SAMPLES_NB          32

/*****************************************************************************/
typedef enum{
    OPA_GLOBAL_PROTECT	= 1,
    OPA_GLOBAL_MUTEFM	= 2,
    OPA_GLOBAL_MUTEKIT	= 4,
    OPA_GLOBAL_DEFAULT  = OPA_GLOBAL_PROTECT,
}OPA_GLOBAL_FLAGSBITS;

typedef enum{
    OPA_PROGRAM_STEALING = 1,
    OPA_PROGRAM_MUTED    = 2,
    OPA_PROGRAM_DEFAULT  = OPA_PROGRAM_STEALING,
}OPA_PROGRAM_FLAGSBITS;

typedef enum{
    OPA_OP_ABSOLUTE     = 1,
    OPA_OP_SOFT_LOW     = 2,
    OPA_OP_HARD_LOW     = 4,
    OPA_OP_SOFT_HIGH    = 8,
    OPA_OP_HARD_HIGH    = 16,
    OPA_OP_MUTED        = 32,
    OPA_OP_DEFAULT      = 0,
}OPA_OP_FLAGSBITS;

/*****************************************************************************/
typedef struct{
    uint8_t volume;
    int8_t  coarse;
    int8_t  fine;
    uint8_t flags;
    uint8_t fmVolume;
    uint8_t kitVolume;
    uint8_t reserved1;
    uint8_t reserved2;
}OpaGlobals;

typedef struct{
    uint8_t volume;
    uint8_t panning;
    uint8_t decay;
    uint8_t reserved;
}OpaKitParams;

typedef struct{
    OpaKitParams params[OPA_KIT_SAMPLES_NB];
}OpaKit;

typedef struct{
    uint8_t name[8];
    uint8_t algorithm;
    uint8_t volume;
    uint8_t panning;
    uint8_t flags;
}OpaProgramParams;

typedef struct{
    uint8_t volume;             //ok
    uint8_t coarse;             //ok
    int8_t  fine;               //ok
    uint8_t envAttack;          //ok
    uint8_t envDecay;           //ok
    uint8_t envSusLevel;        //ok
    uint8_t envIniLevel;        //ok
    uint8_t envRelease;         //ok
    uint8_t LFOSpeed;
    uint8_t LFOAmount;
    uint8_t feedback;
    uint8_t flags;
    uint8_t reserved2;
    uint8_t reserved3;
    uint8_t reserved4;
    uint8_t reserved5;
}OpaOperatorParams;

/*****************************************************************************/
typedef struct{
    OpaProgramParams params;
    OpaOperatorParams opParams[OPA_ALGOS_OP_NB];
}OpaProgram;

/*****************************************************************************/
class Opa
{
public:
    Opa();

    void connect(int port);
    void disconnect();
    bool isConnected();

    void setEnable(bool enable);

    void update();

    void readVersion(char * version);

    void noteOn(int instrument, int note, int fraction, int nuance);
    void noteOff(int instrument, int note, int fraction, int nuance);
    void allNotesOff(int instrument);
    void allSoundsOff();

    void programParamWrite(int program, int param, int value);
    void programParamRead(int program, int param, int * value);
    void globalsParamWrite(int param, int value);
    void globalsParamRead(int param, int * value);
    void kitParamWrite(int sample, int param, int value);
    void kitParamRead(int sample, int param, int * value);

    void programWrite(int program, const OpaProgram * programData);
    void programRead(int program, OpaProgram * programData);
    void globalsWrite(const OpaGlobals * globalsData);
    void globalsRead(OpaGlobals * globalsData);
    void kitWrite(const OpaKit * kitData);
    void kitRead(OpaKit * kitData);

    void internalStore(int program, int slot);
    void internalLoad(int program, int slot);
    void internalWrite(int slot, const OpaProgram * programData);
    void internalRead(int slot, OpaProgram * programData);

    void pitchBend(int program, int coarse, int fine);

    bool isWaiting() {
        return NULL != globalsReturn ||
               NULL != programReturn ||
               NULL != kitReturn ||
               NULL != programParamReturn ||
               NULL != kitParamReturn ||
               NULL != versionReturn;
    }

public:
    static const OpaGlobals defaultGlobals;
    static const OpaProgramParams defaultProgramParams;
    static const OpaOperatorParams defaultOperatorParams;
    static const char * kitSampleNames[];
    static OpaProgram defaultProgram;
    static void initDefaultProgram();

private:
    void parseProgramParameter();
    void parseKitParameter();
    void parseProgram();
    void parseGlobals();
    void parseKit();

    int * programParamReturn;
    int programParamReturnIndex;

    int * kitParamReturn;
    int kitParamReturnIndex;

    char * versionReturn;

    volatile OpaKit * kitReturn;
    volatile OpaProgram * programReturn;
    volatile OpaGlobals * globalsReturn;
    volatile int programReturnIndex;
    volatile int kitReturnIndex;

    char rxBuffer[OPA_RXBUFFER_LEN];
    unsigned int rxLen;

    int port;
    int state;
    bool enabled;

};

#endif // OPA_H


text:
package com.vikingbrain.nmt.operations.playback;

import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Collection;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vikingbrain.nmt.responses.ResponseSimple;
import com.vikingbrain.nmt.test.util.AbstractClientMock;
import com.vikingbrain.nmt.test.util.XmlTestFiles;

/**
 *
 * @author vikingBrain
 */
@RunWith(value = Parameterized.class)
public class SetAudioVodOperationTest extends AbstractClientMock {

	/** Logger. */
	private static Logger logger = LoggerFactory.getLogger(SetAudioVodOperationTest.class);

	private String xmlFileName;

	private static final String AUDIO_VALUE_MOCK = "1";

	@Parameters(name = "{index}: {0}")
	public static Collection<Object[]> data() {
		Object[][] data = new Object[][] {
				{ XmlTestFiles.SET_AUDIO_VOD_DOCUMENTATION_EXAMPLE },
				{ XmlTestFiles.SET_AUDIO_VOD_A200 }
				};
	    return Arrays.asList(data);
	}

	public SetAudioVodOperationTest(String _xmlFileName) throws FileNotFoundException {
		xmlFileName = _xmlFileName;
	}

	@Test
	public void executeTest() throws Exception {

		//Put the expected response in the mock of the http client
		setXmlFileResponseInHttpMockClient(xmlFileName);

		SetAudioVodOperation operation = theDavidBoxClient.getModulePlayback().
				buildSetAudioVodOperation(AUDIO_VALUE_MOCK);

		//All the info for the operation
		logger.info(operation.toString());

		ResponseSimple response =  operation.execute();

        Assert.assertNotNull(response);
        Assert.assertTrue(response.isValid());
	}

}


text:
package com.penrillian.longstringloader;

import android.content.Context;
import android.os.Looper;
import android.widget.LinearLayout;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class LongStringLoaderTest
{
	private static LongStringLoadCompleteListener longStringLoadCompleteListener;
	private static LinearLayout linearLayout;
	@Mock
	private static Context context;

	@BeforeClass
	public static void setUp() {
		Looper.prepare();

		linearLayout = new LinearLayout(context);
		longStringLoadCompleteListener = new LongStringLoadCompleteListener()
		{
			@Override
			public void onLongStringLoadComplete()
			{

			}
		};
	}

	private LongStringLoader createLoaderWithSplitLength(int splitLength) throws LongStringLoaderException
	{
		return new LongStringLoader(longStringLoadCompleteListener, linearLayout);
	}

	@Test
	public void testCreateObject() throws LongStringLoaderException
	{
		LongStringLoader loader = createLoaderWithSplitLength(20);
		Assert.assertNotNull(loader);
	}

	@Test
	public void testCreateWithInvalidParamsThrowsException()
	{
		LongStringLoader loader = null;
		try
		{
			loader = new LongStringLoader(longStringLoadCompleteListener, null);
		} catch (LongStringLoaderException e)
		{
			Assert.assertNull(loader);
			return;
		}
		Assert.assertTrue(false);
	}
}


text:
local network = require('networks/network')
local MatchNet = require 'networks/mc-models/matching'
local AcrtNetwork, parent = torch.class('AcrtNetwork','MatchNet')

function AcrtNetwork:__init(self, opt, dataset)
   parent.__init(parent, self, opt, dataset)
   self.criterion = nn.BCECriterion2():cuda()
end

function AcrtNetwork:getDecisionNetwork()
   local decision = nn.Sequential()
   decision:add(nn.Reshape(self.params.bs, self.params.fm *2))
   for i = 1,self.params.l2 do
      decision:add(nn.Linear(i == 1 and 2 * self.params.fm or self.params.nh2, self.params.nh2))
      decision:add(Activation())
   end

   decision:add(nn.Linear(self.params.nh2, 1))
   decision:add(cudnn.Sigmoid(false))
   return decision
end

function AcrtNetwork:computeMatchingCost(x_batch, disp_max, directions)
   local desc_l, desc_r = self:getDescriptors(x_batch)

   -- Replace with fully convolutional network with the same weights
   local testDecision = network.getTestNetwork(self.decision)

   -- Initialize the output with the largest matching cost
   -- at each possible disparity ('1')
   local output = torch.CudaTensor(#directions, disp_max, desc_l:size(3), desc_l:size(4)):fill(1)

   local x2= torch.CudaTensor()
   collectgarbage()
   for _, direction in ipairs(directions) do
      local index = direction == -1 and 1 or 2
      for d = 1,disp_max do
         collectgarbage()
         -- Get the left and right images for this disparity
         local l = desc_l[{{1},{},{},{d,-1}}]
         local r = desc_r[{{1},{},{},{1,-d}}]
         x2:resize(2, r:size(2), r:size(3), r:size(4))
         x2[{{1}}]:copy(l)
         x2[{{2}}]:copy(r)

         -- Compute the matching score
         local score = testDecision:forward(x2)

         -- Copy to the right place in the output tensor
         output[{index,d,{},direction == -1 and {d,-1} or {1,-d}}]:copy(score[{1,1}])
      end
      -- Fix the borders of the obtained map
      network.fixBorder(output[{{index}}], direction, self.params.ws)
   end
   collectgarbage()
   return output
end

function AcrtNetwork:setBestParams(opt, dataset )
   self.params = {}
   self.n_input_plane = dataset.n_colors
   if dataset.name == 'kitti' or dataset.name == 'kitti2015' then
      self.params.at=0

      self.params.fm = opt.fm -- number of feature maps
      self.params.ks=3
      self.params.l1=4 -- number of convolutional layers
      self.params.l2=4 -- number of fully connected layers
      self.params.nh2= opt.nh2
      self.params.bs =  opt.batch_size -- batch size
      self.params.lr= 0.003
      self.params.mom=0.9
      self.params.decay=1e-4

      if dataset.name == 'kitti' then
         self.params.L1=5
         self.params.cbca_i1=2
         self.params.cbca_i2=0
         self.params.tau1=0.13
         self.params.pi1=1.32
         self.params.pi2=24.25
         self.params.sgm_i=1
         self.params.sgm_q1=3
         self.params.sgm_q2=2
         self.params.alpha1=2
         self.params.tau_so=0.08
         self.params.blur_sigma=5.99
         self.params.blur_t=6
      elseif dataset.name == 'kitti2015' then
         self.params.L1=5
         self.params.cbca_i1=2
         self.params.cbca_i2=4
         self.params.tau1=0.03
         self.params.pi1=2.3
         self.params.pi2=24.25
         self.params.sgm_i=1
         self.params.sgm_q1=3
         self.params.sgm_q2=2
         self.params.alpha1=1.75
         self.params.tau_so=0.08
         self.params.blur_sigma=5.99
         self.params.blur_t=5
      end
   elseif dataset.name == 'mb' then

      self.params.l1=5
      self.params.fm=112
      self.params.ks=3
      self.params.l2= opt.l2 or 3
      self.params.nh2=384
      self.params.lr=0.003
      self.params.bs=128
      self.params.mom=0.9

      self.params.L1=14
      self.params.tau1=0.02
      self.params.cbca_i1=2
      self.params.cbca_i2=16
      self.params.pi1=1.3
      self.params.pi2=13.9
      self.params.sgm_i=1
      self.params.sgm_q1=4.5
      self.params.sgm_q2=2
      self.params.alpha1=2.75
      self.params.tau_so=0.13
      self.params.blur_sigma=1.67
      self.params.blur_t=2
   end
end


text:
<!doctype html>

    <meta charset="utf-8">
    <title>IMA examples</title>
    <link rel="canonical" href="amps.html" >
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <link href='https://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'>

Pre-roll

        <amp-ima-video id="preroll"
            width="640" height="360" layout="responsive"
            data-tag="https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=&debug_experiment_id=1269069638"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:preroll.play">Play</button>
    <button on="tap:preroll.pause">Pause</button>
    <button on="tap:preroll.mute">Mute</button>
    <button on="tap:preroll.unmute">Unmute</button>
    <button on="tap:preroll.fullscreen">Fullscreen</button>

Skippable Pre-roll

        <amp-ima-video id="prerollskip"
            width="640" height="360" layout="responsive"
            data-tag="https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=&debug_experiment_id=1269069638"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:prerollskip.play">Play</button>
    <button on="tap:prerollskip.pause">Pause</button>
    <button on="tap:prerollskip.mute">Mute</button>
    <button on="tap:prerollskip.unmute">Unmute</button>
    <button on="tap:prerollskip.fullscreen">Fullscreen</button>

Single redirect error

        <amp-ima-video id="error"
            width="640" height="360" layout="responsive"
            data-tag="https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dredirecterror&nofb=1&correlator=&debug_experiment_id=1269069638"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:error.play">Play</button>
    <button on="tap:error.pause">Pause</button>
    <button on="tap:error.mute">Mute</button>
    <button on="tap:error.unmute">Unmute</button>
    <button on="tap:error.fullscreen">Fullscreen</button>

VMAP pre, mid post - single ads

        <amp-ima-video id="adrulessingle"
            width="640" height="360" layout="responsive"
            data-tag="https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=&debug_experiment_id=1269069638"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:adrulessingle.play">Play</button>
    <button on="tap:adrulessingle.pause">Pause</button>
    <button on="tap:adrulessingle.mute">Mute</button>
    <button on="tap:adrulessingle.unmute">Unmute</button>
    <button on="tap:adrulessingle.fullscreen">Fullscreen</button>

VMAP pre, mid pod, post + bumpers

        <amp-ima-video id="adrulespodsbumpers"
            width="640" height="360" layout="responsive"
            data-tag="https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostpodbumper&cmsid=496&vid=short_onecue&correlator=&debug_experiment_id=1269069638"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:adrulespodsbumpers.play">Play</button>
    <button on="tap:adrulespodsbumpers.pause">Pause</button>
    <button on="tap:adrulespodsbumpers.mute">Mute</button>
    <button on="tap:adrulespodsbumpers.unmute">Unmute</button>
    <button on="tap:adrulespodsbumpers.fullscreen">Fullscreen</button>

VMAP Post

        <amp-ima-video id="postroll"
            width="640" height="360" layout="responsive"
            data-tag="https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpostonly&cmsid=496&vid=short_onecue&correlator=&debug_experiment_id=1269069638"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:postroll.play">Play</button>
    <button on="tap:postroll.pause">Pause</button>
    <button on="tap:postroll.mute">Mute</button>
    <button on="tap:postroll.unmute">Unmute</button>
    <button on="tap:postroll.fullscreen">Fullscreen</button>

VPAID JS

        <amp-ima-video id="vpaidjs"
            width="640" height="360" layout="responsive"
            data-tag="https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinearvpaid2js&correlator=&debug_experiment_id=1269069638"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:vpaidjs.play">Play</button>
    <button on="tap:vpaidjs.pause">Pause</button>
    <button on="tap:vpaidjs.mute">Mute</button>
    <button on="tap:vpaidjs.unmute">Unmute</button>
    <button on="tap:vpaidjs.fullscreen">Fullscreen</button>

AdSense

        <amp-ima-video id="adsense"
            width="640" height="360" layout="responsive"
            data-tag="https://afimplex.appspot.com/nonskippable"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:adsense.play">Play</button>
    <button on="tap:adsense.pause">Pause</button>
    <button on="tap:adsense.mute">Mute</button>
    <button on="tap:adsense.unmute">Unmute</button>
    <button on="tap:adsense.fullscreen">Fullscreen</button>

AdSense Skippable

        <amp-ima-video id="adsenseskippable"
            width="640" height="360" layout="responsive"
            data-tag="https://afimplex.appspot.com/skippable_ad_green"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Actions

    <button on="tap:adsenseskippable.play">Play</button>
    <button on="tap:adsenseskippable.pause">Pause</button>
    <button on="tap:adsenseskippable.mute">Mute</button>
    <button on="tap:adsenseskippable.unmute">Unmute</button>
    <button on="tap:adsenseskippable.fullscreen">Fullscreen</button>

In Carousel

    <amp-carousel layout="responsive" width="640" height="360" type="slides">
        <amp-ima-video id="adsense"
            width="640" height="360" layout="responsive"
            data-tag="https://afimplex.appspot.com/nonskippable"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>

Slide 2

        <amp-ima-video id="adsense"
            width="640" height="360" layout="responsive"
            data-tag="https://afimplex.appspot.com/nonskippable"
            data-poster="/examples/img/ima-poster.png">
            <source src="https://s0.2mdn.net/4253510/google_ddm_animation_480P.mp4" type="video/mp4">
        </amp-ima-video>
    </amp-carousel>


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('core', '0002_userprofile'),
    ]

    operations = [
        migrations.AddField(
            model_name='game',
            name='description',
            field=models.TextField(default='Not specified'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='game',
            name='summary',
            field=models.CharField(default='Unknown unknowns', max_length=140),
            preserve_default=False,
        ),
    ]


text:
const lifts = require('../lifts');

lifts('crystal-mountain', 'json', {
  'Mt. Rainier Gondola': 'closed',
  'Chinook Express': 'open',
  'Discovery': 'open',
  'Forest Queen': 'open',
  'Gold Hills': 'closed',
  'Green Valley': 'open',
  'Chair 6': 'closed',
  'Northway': 'closed',
  'Quicksilver': 'open',
  'Rainier Express': 'open'
});


text:
package org.onosproject.athena.feature;

import org.onosproject.net.provider.ProviderRegistry;

/**
 * Created by seunghyeon on 8/26/15.
 */
public interface FeatureCollectorProviderRegistry
        extends ProviderRegistry<FeatureCollectorProvider, FeatureCollectorProviderService> {
}


text:
#include "InputTranslator.h"

#include <Input/InputEvents.h>
#include <Input/InputDevice.h>
#include <Input/ControlLayout.h>
#include <Events/Subscription.h>
#include <Core/Application.h>

namespace Input
{

CInputTranslator::CInputTranslator(CStrID UserID)
	: _UserID(UserID)
{
	Contexts.SetKeepOrder(true);
}
//---------------------------------------------------------------------

CInputTranslator::~CInputTranslator()
{
	Clear();
}
//---------------------------------------------------------------------

void CInputTranslator::Clear()
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
		if (Contexts[i].pLayout) n_delete(Contexts[i].pLayout);
	Contexts.Clear();
	DeviceSubs.Clear();
	EventQueue.Clear();
}
//---------------------------------------------------------------------

// Doesn't remove contexts but overrides existing ones
bool CInputTranslator::LoadSettings(const Data::CParams& Desc)
{
	for (UPTR i = 0; i < Desc.GetCount(); ++i)
	{
		const Data::CParam& Prm = Desc.Get(i);

		CStrID ContextID = Prm.GetName();
		CreateContext(ContextID);

		const auto& ContextLayoutDesc = *Prm.GetValue<Data::PParams>().Get();
		CControlLayout* pLayout = GetContextLayout(ContextID);
		if (!pLayout || !pLayout->Initialize(ContextLayoutDesc)) FAIL;
	}

	OK;
}
//---------------------------------------------------------------------

bool CInputTranslator::UpdateParams(const DEM::Core::CApplication& App, std::set<std::string>* pOutParams)
{
	auto ParamGetter = [&App, UserID = _UserID](const char* pKey) -> std::string
	{
		CString Value = App.GetStringSetting(pKey, CString::Empty, UserID);
		return Value.IsValid() ? Value.CStr() : "";
	};

	bool Result = true;

	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
	{
		if (auto pLayout = Contexts[i].pLayout)
		{
			for (auto& Pair : pLayout->States)
				Result &= Pair.second->UpdateParams(ParamGetter, pOutParams);

			for (auto& Rec : pLayout->Events)
				Result &= Rec.Event->UpdateParams(ParamGetter, pOutParams);
		}
	}

	return Result;
}
//---------------------------------------------------------------------

bool CInputTranslator::CreateContext(CStrID ID, bool Bypass)
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
		if (Contexts[i].ID == ID) FAIL;
	CInputContext& NewCtx = *Contexts.Add();
	NewCtx.ID = ID;
	NewCtx.Enabled = false;
	NewCtx.pLayout = Bypass ? nullptr : n_new(CControlLayout);
	OK;
}
//---------------------------------------------------------------------

void CInputTranslator::DestroyContext(CStrID ID)
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
		if (Contexts[i].ID == ID)
		{
			n_delete(Contexts[i].pLayout);
			Contexts.RemoveAt(i);
			break;
		}
}
//---------------------------------------------------------------------

bool CInputTranslator::HasContext(CStrID ID) const
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
		if (Contexts[i].ID == ID)
			return true;

	return false;
}
//---------------------------------------------------------------------

CControlLayout* CInputTranslator::GetContextLayout(CStrID ID)
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
		if (Contexts[i].ID == ID) return Contexts[i].pLayout;
	return nullptr;
}
//---------------------------------------------------------------------

void CInputTranslator::EnableContext(CStrID ID)
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
		if (Contexts[i].ID == ID)
		{
			Contexts[i].Enabled = true;
			break;
		}
}
//---------------------------------------------------------------------

void CInputTranslator::DisableContext(CStrID ID)
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
		if (Contexts[i].ID == ID)
		{
			Contexts[i].Enabled = false;
			if (Contexts[i].pLayout)
				Contexts[i].pLayout->Reset();
			break;
		}
}
//---------------------------------------------------------------------

void CInputTranslator::ConnectToDevice(IInputDevice* pDevice, U16 Priority)
{
	if (!pDevice || IsConnectedToDevice(pDevice)) return;

	if (pDevice->GetAxisCount() > 0)
		DeviceSubs.Add(pDevice->Subscribe(&Event::AxisMove::RTTI, this, &CInputTranslator::OnAxisMove));

	if (pDevice->GetButtonCount() > 0)
	{
		DeviceSubs.Add(pDevice->Subscribe(&Event::ButtonDown::RTTI, this, &CInputTranslator::OnButtonDown));
		DeviceSubs.Add(pDevice->Subscribe(&Event::ButtonUp::RTTI, this, &CInputTranslator::OnButtonUp));
	}

	if (pDevice->CanInputText())
		DeviceSubs.Add(pDevice->Subscribe(&Event::TextInput::RTTI, this, &CInputTranslator::OnTextInput));
}
//---------------------------------------------------------------------

void CInputTranslator::DisconnectFromDevice(const IInputDevice* pDevice)
{
	for (UPTR i = 0; i < DeviceSubs.GetCount(); )
	{
		if (DeviceSubs[i]->GetDispatcher() == pDevice)
			DeviceSubs.RemoveAt(i);
		else ++i;
	}
}
//---------------------------------------------------------------------

UPTR CInputTranslator::GetConnectedDevices(CArray<IInputDevice*>& OutDevices) const
{
	const UPTR PrevCount = OutDevices.GetCount();
	for (const auto& Sub : DeviceSubs)
	{
		auto pDevice = static_cast<IInputDevice*>(Sub->GetDispatcher());
		if (!OutDevices.Contains(pDevice))
			OutDevices.Add(pDevice);
	}
	return OutDevices.GetCount() - PrevCount;
}
//---------------------------------------------------------------------

bool CInputTranslator::IsConnectedToDevice(const IInputDevice* pDevice) const
{
	for (const auto& Sub : DeviceSubs)
		if (Sub->GetDispatcher() == pDevice)
			return true;

	return false;
}
//---------------------------------------------------------------------

void CInputTranslator::TransferAllDevices(CInputTranslator* pNewOwner)
{
	if (pNewOwner)
	{
		for (const auto& Sub : DeviceSubs)
			pNewOwner->ConnectToDevice(static_cast<IInputDevice*>(Sub->GetDispatcher()));
	}

	DeviceSubs.Clear();
}
//---------------------------------------------------------------------

bool CInputTranslator::OnAxisMove(Events::CEventDispatcher* pDispatcher, const Events::CEventBase& Event)
{
	const Event::AxisMove& Ev = static_cast<const Event::AxisMove&>(Event);

	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
	{
		CInputContext& Ctx = Contexts[i];
		if (!Ctx.Enabled) continue;

		if (auto pLayout = Ctx.pLayout)
		{
			for (auto& Pair : pLayout->States)
				Pair.second->OnAxisMove(Ev.Device, Ev);

			for (auto& Rec : pLayout->Events)
			{
				if (Rec.Event->OnAxisMove(Ev.Device, Ev))
				{
					Events::CEvent& NewEvent = *EventQueue.Add();
					NewEvent.ID = Rec.OutEventID;
					NewEvent.Params = n_new(Data::CParams(1));
					NewEvent.Params->Set<float>(CStrID("Amount"), Ev.Amount);
					if (FireEvent(NewEvent, Events::Event_TermOnHandled) > 0) OK;
				}
			}
		}
		else
		{
			// Bypass context
			Event::AxisMove BypassEvent(Ev.Device, Ev.Code, Ev.Amount, _UserID);
			if (FireEvent(BypassEvent, Events::Event_TermOnHandled) > 0) OK;
		}
	}

	FAIL;
}
//---------------------------------------------------------------------

bool CInputTranslator::OnButtonDown(Events::CEventDispatcher* pDispatcher, const Events::CEventBase& Event)
{
	const Event::ButtonDown& Ev = static_cast<const Event::ButtonDown&>(Event);

	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
	{
		CInputContext& Ctx = Contexts[i];
		if (!Ctx.Enabled) continue;

		if (auto pLayout = Ctx.pLayout)
		{
			for (auto& Pair : pLayout->States)
				Pair.second->OnButtonDown(Ev.Device, Ev);

			for (auto& Rec : pLayout->Events)
			{
				if (Rec.Event->OnButtonDown(Ev.Device, Ev))
				{
					Events::CEvent& NewEvent = *EventQueue.Add();
					NewEvent.ID = Rec.OutEventID;
					if (FireEvent(NewEvent, Events::Event_TermOnHandled) > 0) OK;
				}
			}
		}
		else
		{
			// Bypass context
			Event::ButtonDown BypassEvent(Ev.Device, Ev.Code, _UserID);
			if (FireEvent(BypassEvent, Events::Event_TermOnHandled) > 0) OK;
		}
	}

	FAIL;
}
//---------------------------------------------------------------------

bool CInputTranslator::OnButtonUp(Events::CEventDispatcher* pDispatcher, const Events::CEventBase& Event)
{
	const Event::ButtonUp& Ev = static_cast<const Event::ButtonUp&>(Event);

	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
	{
		CInputContext& Ctx = Contexts[i];
		if (!Ctx.Enabled) continue;

		if (auto pLayout = Ctx.pLayout)
		{
			for (auto& Pair : pLayout->States)
				Pair.second->OnButtonUp(Ev.Device, Ev);

			for (auto& Rec : pLayout->Events)
			{
				if (Rec.Event->OnButtonUp(Ev.Device, Ev))
				{
					Events::CEvent& NewEvent = *EventQueue.Add();
					NewEvent.ID = Rec.OutEventID;
					if (FireEvent(NewEvent, Events::Event_TermOnHandled) > 0) OK;
				}
			}
		}
		else
		{
			// Bypass context
			Event::ButtonUp BypassEvent(Ev.Device, Ev.Code, _UserID);
			if (FireEvent(BypassEvent, Events::Event_TermOnHandled) > 0) OK;
		}
	}

	FAIL;
}
//---------------------------------------------------------------------

bool CInputTranslator::OnTextInput(Events::CEventDispatcher* pDispatcher, const Events::CEventBase& Event)
{
	const Event::TextInput& Ev = static_cast<const Event::TextInput&>(Event);

	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
	{
		CInputContext& Ctx = Contexts[i];
		if (!Ctx.Enabled) continue;

		if (auto pLayout = Ctx.pLayout)
		{
			for (auto& Pair : pLayout->States)
				Pair.second->OnTextInput(Ev.Device, Ev);

			for (auto& Rec : pLayout->Events)
			{
				if (Rec.Event->OnTextInput(Ev.Device, Ev))
				{
					Events::CEvent& NewEvent = *EventQueue.Add();
					NewEvent.ID = Rec.OutEventID;
					if (FireEvent(NewEvent, Events::Event_TermOnHandled) > 0) OK;
				}
			}
		}
		else
		{
			// Bypass context
			Event::TextInput BypassEvent(Ev.Device, Ev.Text, Ev.CaseSensitive, _UserID);
			if (FireEvent(BypassEvent, Events::Event_TermOnHandled) > 0) OK;
		}
	}

	FAIL;
}
//---------------------------------------------------------------------

void CInputTranslator::UpdateTime(float ElapsedTime)
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
	{
		CInputContext& Ctx = Contexts[i];
		if (!Ctx.Enabled) continue;

		if (auto pLayout = Ctx.pLayout)
		{
			for (auto& Pair : pLayout->States)
				Pair.second->OnTimeElapsed(ElapsedTime);

			for (auto& Rec : pLayout->Events)
			{
				if (Rec.Event->OnTimeElapsed(ElapsedTime))
				{
					Events::CEvent& NewEvent = *EventQueue.Add();
					NewEvent.ID = Rec.OutEventID;
					FireEvent(NewEvent, Events::Event_TermOnHandled);
				}
			}
		}
	}
}
//---------------------------------------------------------------------

void CInputTranslator::FireQueuedEvents(/*max count*/)
{
	for (UPTR i = 0; i < EventQueue.GetCount(); ++i)
		FireEvent(EventQueue[i]);
	EventQueue.Clear();
}
//---------------------------------------------------------------------

bool CInputTranslator::CheckState(CStrID StateID) const
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
	{
		const CInputContext& Ctx = Contexts[i];
		if (!Ctx.Enabled) continue;

		if (auto pLayout = Ctx.pLayout)
		{
			auto It = pLayout->States.find(StateID);
			if (It != pLayout->States.cend() && It->second->IsOn()) OK;
		}
	}

	FAIL;
}
//---------------------------------------------------------------------

void CInputTranslator::Reset(/*device type*/)
{
	for (UPTR i = 0; i < Contexts.GetCount(); ++i)
		if (Contexts[i].Enabled && Contexts[i].pLayout)
			Contexts[i].pLayout->Reset();
}
//---------------------------------------------------------------------

}


text:
<html>
    <head>
        <title>Agenda do presidente do STF, ministro Ricardo Lewandowski, para esta quinta-feira (16) Interactions</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    </head>
    <body>14h - Sessão Plenária</body>
</html>


text:
package org.bonitasoft.chain;

import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;

import com.chain.api.Account;
import com.chain.api.Asset;
import com.chain.api.Balance;
import com.chain.api.MockHsm;
import com.chain.api.Transaction;
import com.chain.api.Transaction.SubmitResponse;
import com.chain.exception.BuildException;
import com.chain.exception.BuildException.ActionError;
import com.chain.exception.ChainException;
import com.chain.http.Client;
import com.chain.signing.HsmSigner;

public class ChainUtils {

    private static ChainUtils instance;

    public static ChainUtils getInstance() {
        if (instance == null) {
            instance = new ChainUtils();
        }
        return instance;
    }

    private ChainUtils() {
    }

    public MockHsm.Key createKey(Client client, String alias) throws ChainException {
        return MockHsm.Key.create(client, alias);
    }

    public MockHsm.Key getKey(Client client, String alias) throws ChainException {
        MockHsm.Key.Items items =
                new MockHsm.Key.QueryBuilder().setAliases(Arrays.asList(alias)).execute(client);
        return items.next();
    }

    public Account createAccount(Client client, String alias, MockHsm.Key key,
            Map<String, String> tags) throws ChainException {
        Account.Builder accountBuilder =
                new Account.Builder().setAlias(alias).addRootXpub(key.xpub).setQuorum(1);
        if (tags != null) {
            for (Entry<String, String> e : tags.entrySet()) {
                accountBuilder.addTag(e.getKey(), e.getValue());
            }
        }
        return accountBuilder.create(client);
    }

    public Account getAccount(Client client, String alias) throws ChainException {
        Account.Items accounts = new Account.QueryBuilder().setFilter("alias=$1")
                .addFilterParameter(alias).execute(client);
        return accounts.next();
    }

    public Asset createAsset(Client client, String alias, MockHsm.Key key,
            Map<String, String> parameters) throws ChainException {
        Asset.Builder assetBuilder =
                new Asset.Builder().setAlias(alias).addRootXpub(key.xpub).setQuorum(1);
        if (parameters != null) {
            for (Entry<String, String> e : parameters.entrySet()) {
                assetBuilder.addDefinitionField(e.getKey(), e.getValue());
            }
        }
        return assetBuilder.create(client);
    }

    public Asset getAsset(Client client, String alias) throws ChainException {
        Asset.Items items = new Asset.QueryBuilder().setFilter("alias=$1").addFilterParameter(alias)
                .execute(client);
        return items.next();
    }

    public Transaction.Items listTransactions(Client client, String accountAlias)
            throws ChainException {
        return new Transaction.QueryBuilder()
                .setFilter("inputs(account_alias=$1) AND outputs(account_alias=$1)")
                .addFilterParameter(accountAlias).execute(client);

    }

    public Balance.Items getBalance(Client client, String assetAlias, String accountAlias)
            throws ChainException {
        Balance.Items items = new Balance.QueryBuilder()
                .setFilter("account_alias=$1 AND asset_alias=$2").addFilterParameter(accountAlias)
                .addFilterParameter(assetAlias).execute(client);
        return items;
    }

    public void issueNewAsset(Client client, String accountAlias, String assetAlias, int amount)
            throws ChainException {

        Transaction.Template issueTransaction = new Transaction.Builder()
                .addAction(
                        new Transaction.Action.Issue().setAssetAlias(assetAlias).setAmount(amount))
                .addAction(new Transaction.Action.ControlWithAccount().setAccountAlias(accountAlias)
                        .setAssetAlias(assetAlias).setAmount(amount))
                .build(client);

        Transaction.Template signedIssuance = HsmSigner.sign(issueTransaction);
        Transaction.submit(client, signedIssuance);
    }

    public TransactionResponse spendAsset(Client client, String accountFromAlias, String accountToAlias,
            String assetAlias, int amount) throws ChainException {
        Transaction.Template issueTransaction = null;
        try {
            issueTransaction = new Transaction.Builder()
                    .addAction(new Transaction.Action.SpendFromAccount()
                            .setAccountAlias(accountFromAlias).setAssetAlias(assetAlias)
                            .setAmount(amount))
                    .addAction(new Transaction.Action.ControlWithAccount()
                            .setAccountAlias(accountToAlias).setAssetAlias(assetAlias)
                            .setAmount(amount))
                    .build(client);
        } catch (ChainException ex) {
            if(ex instanceof BuildException) {
                BuildException buildEx = (BuildException) ex;
               return new TransactionResponse(buildEx.code , dataErrorsToString(buildEx));
            }
            else {
                throw ex;
            }
        }

        Transaction.Template signedIssuance = HsmSigner.sign(issueTransaction);

        SubmitResponse response = Transaction.submit(client, signedIssuance);
        return new TransactionResponse(response.id);
    }

    private String dataErrorsToString(BuildException buildEx) {

        if (buildEx.data == null || buildEx.data.actionErrors.size() == 0) {
            return buildEx.detail;
        }

        StringBuilder builder = new StringBuilder();
        for (ActionError error : buildEx.data.actionErrors) {
            builder.append(error.chainMessage);
        }
        return builder.toString();

    }

}


text:
package org.wisdom.i18n;

import com.google.common.collect.Iterators;
import org.assertj.core.data.MapEntry;
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.wisdom.api.i18n.InternationalizationService;

import java.util.*;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * Check the internationalization service implementation.
 */
public class InternationalizationServiceSingletonTest {

    private InternationalizationServiceSingleton svc;

    @Before
    public void setUp() {
        svc = new InternationalizationServiceSingleton(null);
    }

    @Test
    public void addBundle() {
        Bundle bundle = getMockBundle();

        List<I18nExtension> extensions = svc.addingBundle(bundle, null);
        assertThat(extensions.size()).isEqualTo(2);

        assertThat(svc.getAllMessages(Locale.FRENCH)).containsKeys("lang", "welcome", "autre");
        assertThat(svc.get(Locale.FRENCH, "lang")).isEqualTo("français");

        // When the locale is not supported, return default.
        assertThat(svc.get(Locale.CHINA, "lang")).isEqualTo("english");
    }

    @Test
    public void testGetAllMessages() {
        Bundle bundle = getMockBundle();

        List<I18nExtension> extensions = svc.addingBundle(bundle, null);
        assertThat(extensions).isNotEmpty();

        Map<String, String> messages = svc.getAllMessages(Locale.FRENCH);
        assertThat(messages).contains(
                MapEntry.entry("welcome", "bonjour"),
                MapEntry.entry("lang", "français"),
                MapEntry.entry("autre", "autre"),
                MapEntry.entry("extra", "extra")
        );

        messages = svc.getAllMessages(Locale.CHINA);
        assertThat(messages).contains(
                MapEntry.entry("welcome", "hello"),
                MapEntry.entry("lang", "english"),
                MapEntry.entry("extra", "extra")
        );
        assertThat(messages).doesNotContainKey("autre");
    }

    @Test
    public void addBundleAndRemoveIt() throws Exception {
        Bundle bundle = getMockBundle();

        List<I18nExtension> extensions = svc.addingBundle(bundle, null);
        assertThat(extensions.size()).isEqualTo(2);
        assertThat(svc.getAllMessages(Locale.FRENCH)).hasSize(5);
        String etag = svc.etag(Locale.FRENCH);
        assertThat(etag).isNotNull().isNotEqualTo("0");

		// Wait one second to be sure timestamps are different.
		Thread.sleep(1000);
        svc.removedBundle(bundle, null, extensions);
        assertThat(svc.getAllMessages(Locale.FRENCH)).hasSize(0);
        String etag2 = svc.etag(Locale.FRENCH);
        assertThat(etag2).isNotNull()
                .isNotEmpty()
                .isNotEqualTo(etag)
                .isNotEqualTo("0");
    }

    @Test
    public void testGetMessagesOnAnOrderedSetOfLocales() {
        Bundle bundle = getMockBundle();

        List<I18nExtension> extensions = svc.addingBundle(bundle, null);
        assertThat(extensions).isNotEmpty();

        String value = svc.get(new Locale[] {Locale.FRENCH}, "welcome");
        assertThat(value).isEqualTo("bonjour");

        value = svc.get(new Locale[] {Locale.ENGLISH}, "welcome");
        assertThat(value).isEqualTo("hello");

        value = svc.get(new Locale[] {InternationalizationService.DEFAULT_LOCALE}, "welcome");
        assertThat(value).isEqualTo("hello");

        value = svc.get(new Locale[] {Locale.FRENCH, Locale.ENGLISH}, "extra");
        assertThat(value).isEqualTo("extra");

        value = svc.get(new Locale[] {Locale.ENGLISH, Locale.FRENCH}, "autre");
        assertThat(value).isEqualTo("autre");
    }

    public static Bundle getMockBundle() {
        List<String> structure = Arrays.asList(
                "/i18n/messages.properties",
                "/i18n/messages_fr.properties"
        );
        Enumeration<String> paths = Iterators.asEnumeration(structure.iterator());
        Bundle bundle = mock(Bundle.class);
        when(bundle.getEntryPaths(anyString())).thenReturn(paths);
        when(bundle.getEntry("/i18n/messages.properties"))
                .thenReturn(InternationalizationServiceSingletonTest.class.getClassLoader()
                        .getResource("i18n/messages.properties"));
        when(bundle.getEntry("/i18n/messages_fr.properties"))
                .thenReturn(InternationalizationServiceSingletonTest.class.getClassLoader()
                        .getResource("i18n/messages_fr.properties"));
        return bundle;
    }

}


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import SwipeableViews from 'react-swipeable-views';

import HeightUpdater from './HeightUpdater';
import ScrollToTop from './ScrollToTop';

class SwipeableBottomSheet extends Component {

	constructor(props){
		super(props);

		this.onHeightChange = this.onHeightChange.bind(this);
		this.onChangeIndex = this.onChangeIndex.bind(this);
		this.onTransitionEnd = this.onTransitionEnd.bind(this);

		this.state = {
			open: props.defaultOpen,
			height: window.innerHeight
		};
	};

	onHeightChange(height){
		this.setState({ height });
	}

	onChangeIndex(index){
		const open = index === 1;
		if(this.props.open === undefined){
			this.setState({ open });
		}
		if(this.props.onChange !== undefined){
			this.props.onChange(open);
		}
	};

	onTransitionEnd(){
		const { overflowHeight, swipeableViewsProps } = this.props;
		if(overflowHeight === 0){
			this.bodyElt.scrollTop = 0;
		}
		if(swipeableViewsProps.onTransitionEnd){
			swipeableViewsProps.onTransitionEnd();
		}
	};

	render() {

		const {
			overflowHeight,
			fullScreen,
			marginTop,
			open,
			topShadow,
			shadowTip,
			overlay,
			swipeableViewsProps,
			scrollTopAtClose
		} = this.props;

		const hiddenWhenClosed = overflowHeight === 0;
		const isControlled = open !== undefined;
		const isOpen = isControlled ? open : this.state.open;
		const hideShadows = hiddenWhenClosed && !isOpen;
		const index = isOpen ? 1 : 0;
		const maxHeight = this.state.height - marginTop;

		const styles = {
			root:{
				height: overflowHeight,
				position: 'fixed',
				bottom: 0,
				right: 0,
				left: 0,
				...this.props.style
			},
			swiper:{
				root:{
					overflowY: 'initial',
					boxSizing: 'border-box',
					...swipeableViewsProps.style
				},
				container: {
					boxSizing: 'border-box',
					...topShadow && !hideShadows && {
						boxShadow: 'rgba(0, 0, 0, 0.156863) 0px -6px 5px',
					},
					...swipeableViewsProps.containerStyle
				},
				slide:{
					boxSizing: 'border-box',
					overflow: 'visible',
					marginBottom: -overflowHeight,
					...swipeableViewsProps.slideStyle
				},
				bottomSlide:{
					marginBottom: overflowHeight,
				},
				body:{
					overflow: isOpen ? 'auto' : 'hidden',
					backgroundColor: 'white',
					height: fullScreen ? maxHeight : 'initial',
					maxHeight: maxHeight,
					...this.props.bodyStyle
				}
			},
			overlay:{
				position: 'fixed',
				top: 0,
				right: 0,
				left: 0,
				height: this.state.height,
				transition: 'opacity 450ms',
				pointerEvents: 'none',
				backgroundColor: 'black',
				opacity: 0,
				...isOpen && {
					opacity: 0.54,
					pointerEvents: 'auto',
				},
				...this.props.overlayStyle
			},
			shadowTip:{
				position: 'fixed',
				height: 60,
				width: '200%',
				bottom: -60,
				left: '-50%',
				boxShadow: 'rgba(0, 0, 0, 0.7) 0px 0px 30px',
				transition: 'transform 450ms',
				transform: isOpen ? 'translateY(50px)' : 'translateY(0)'
			}
		};

		return (

				<HeightUpdater
					height={this.state.height}
					onHeightChange={this.onHeightChange}
				/>
				{overlay &&

 this.onChangeIndex(0)}/>
				}
				<SwipeableViews
					index={index}
					axis="y"
					enableMouseEvents
					onChangeIndex={this.onChangeIndex}
					{...this.props.swipeableViewsProps}
					onTransitionEnd={this.onTransitionEnd}
					style={styles.swiper.root}
					containerStyle={styles.swiper.container}
					slideStyle={styles.swiper.slide}
				>

 this.bodyElt = elt}
						style={styles.swiper.body}
						className={`ReactSwipeableBottomSheet--${isOpen ? 'open' : 'closed'}`}
					>
						{this.props.children}

				</SwipeableViews>
				{shadowTip && !hideShadows &&

				}
				{!isOpen && scrollTopAtClose && !hiddenWhenClosed &&
					<ScrollToTop element={() => this.bodyElt}/>
				}

		);
	}
};

SwipeableBottomSheet.propTypes = {
	bodyStyle: PropTypes.object,
	children: PropTypes.node.isRequired,
	defaultOpen: PropTypes.bool,
	fullScreen: PropTypes.bool,
	marginTop: PropTypes.number,
	onChange: PropTypes.func,
	onTransitionEnd: PropTypes.func,
	open: PropTypes.bool,
	overflowHeight: PropTypes.number,
	overlay: PropTypes.bool,
	overlayStyle: PropTypes.object,
	scrollTopAtClose: PropTypes.bool,
	shadowTip: PropTypes.bool,
	style: PropTypes.object,
	swipeableViewsProps: PropTypes.object,
	topShadow: PropTypes.bool
};

SwipeableBottomSheet.defaultProps = {
	defaultOpen: false,
	fullScreen: false,
	marginTop: 0,
	overflowHeight: 0,
	overlay: true,
	scrollTopAtClose: true,
	shadowTip: true,
  	swipeableViewsProps: {},
  	topShadow: true
};

export default SwipeableBottomSheet;


text:
describe('validate', function() {
  it('should return an empty array if the patch is valid', function() {
    var patch = [
      {
        op: 'test',
        path: '/a/b/c',
        value: 'foo'
      },
      {
        op: 'remove',
        path: '/a/b/c'
      },
      {
        op: 'add',
        path: '/a/b/c',
        value: ['foo', 'bar']
      },
      {
        op: 'replace',
        path: '/a/b/c',
        value: 42
      },
      {
        op: 'move',
        from: '/a/b/c',
        path: '/a/b/d'
      },
      {
        op: 'copy',
        from: '/a/b/d',
        path: '/a/b/e'
      }
    ];
    var error = jsonpatch.validate(patch);
    expect(error).toBeUndefined();
  });

  it('should return an error if the patch is not an array', function() {
    var error = jsonpatch.validate({});
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('SEQUENCE_NOT_AN_ARRAY');
    expect(error.message).toBe('Patch sequence must be an array');
  });

  it('should return an empty array if the operation is a valid object', function() {
    var error = jsonpatch.validate([
      {
        op: 'add',
        value: 'foo',
        path: '/bar'
      }
    ]);
    expect(error).toBeUndefined();
  });

  it('should return an error if the operation is null', function() {
    var error = jsonpatch.validate([null]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_NOT_AN_OBJECT');
  });

  it('should return an error which is instance of Error and jsonpatch.JsonPatchError', function() {
    var error = jsonpatch.validate({});
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error instanceof Error).toBe(true);
    expect(error.name).toBe('SEQUENCE_NOT_AN_ARRAY');
  });

  it('should return an error that contains the patch and the patched object', function() {
    var tree = {
      name: 'Elvis',
      cars: []
    };
    var sequence = [
      {
        op: 'remove',
        path: '/name/first'
      }
    ];
    var error = jsonpatch.validate(sequence, tree);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.operation).toBe(sequence[0]);
    expect(JSON.stringify(error.tree)).toBe(JSON.stringify(tree));
    expect(error.name).toBe('OPERATION_PATH_UNRESOLVABLE');
  });

  it('should return an error if the operation is undefined', function() {
    var error = jsonpatch.validate([undefined]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_NOT_AN_OBJECT');
  });

  it('should return an error if the operation is an array', function() {
    var error = jsonpatch.validate([[]]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_NOT_AN_OBJECT');
  });

  it('should return an error if the operation "op" property is not a string', function() {
    var error = jsonpatch.validate([
      {
        path: '/a/b/c'
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_OP_INVALID');
  });

  it('should return an error if the operation "path" property is not a string', function() {
    var error = jsonpatch.validate([
      {
        op: 'remove',
        value: 'foo'
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_PATH_INVALID');
  });

  it('should return an error if an "add" operation is missing "value" property', function() {
    var error = jsonpatch.validate([
      {
        op: 'add',
        path: '/a/b/c'
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_REQUIRED');
  });

  it('should return an error if an "add" operation "value" property is "undefined"', function() {
    var error = jsonpatch.validate([
      {
        op: 'add',
        path: '/a/b/c',
        value: undefined
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_REQUIRED');
  });

  it('should return an error if a "replace" operation is missing "value" property', function() {
    var error = jsonpatch.validate([
      {
        op: 'replace',
        path: '/a/b/c'
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_REQUIRED');
  });

  it('should return an error if a "replace" operation "value" property is "undefined"', function() {
    var error = jsonpatch.validate([
      {
        op: 'replace',
        path: '/a/b/c',
        value: undefined
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_REQUIRED');
  });

  it('should return an error if a "test" operation is missing "value" property', function() {
    var error = jsonpatch.validate([
      {
        op: 'test',
        path: '/a/b/c'
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_REQUIRED');
  });

  it('should return an error if a "test" operation "value" property is "undefined"', function() {
    var error = jsonpatch.validate([
      {
        op: 'test',
        path: '/a/b/c',
        value: undefined
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_REQUIRED');
  });

  it('should return an error if an "add" operation "value" contains "undefined"', function() {
    var error = jsonpatch.validate([
      {
        op: 'add',
        path: '/a/b/c',
        value: {
          foo: undefined
        }
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED');
  });

  it('should return an error if a "replace" operation "value" contains "undefined"', function() {
    var error = jsonpatch.validate([
      {
        op: 'replace',
        path: '/a/b/c',
        value: {
          foos: [undefined]
        }
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED');
  });

  it('should return an error if a "test" operation "value" contains "undefined"', function() {
    var error = jsonpatch.validate([
      {
        op: 'test',
        path: '/a/b/c',
        value: {
          foo: {
            bars: [undefined]
          }
        }
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED');
  });

  it('should return an error if a "move" operation is missing "from" property', function() {
    var error = jsonpatch.validate([
      {
        op: 'move',
        path: '/a/b/c'
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_FROM_REQUIRED');
  });

  it('should return an error if a "copy" operation is missing "from" property', function() {
    var error = jsonpatch.validate([
      {
        op: 'copy',
        path: '/a/b/c'
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_FROM_REQUIRED');
  });

  it('should return an error if the "op" property is invalid', function() {
    var error = jsonpatch.validate([
      {
        op: 'foobar',
        path: '/a/b/c'
      }
    ]);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_OP_INVALID');
  });

  it('should return error replacing an unexisting path', function() {
    var sequence,
      error,
      tree = {
        '': 'empty string is a valid key',
        name: 'Elvis',
        cars: [
          {
            brand: 'Jaguar'
          }
        ],
        address: {}
      };

    sequence = [
      {
        op: 'replace',
        path: '/name/first',
        value: ''
      }
    ];
    error = jsonpatch.validate(sequence, tree);
    expect(error.name).toBe('OPERATION_PATH_UNRESOLVABLE');

    sequence = [
      {
        op: 'replace',
        path: '/firstName',
        value: ''
      }
    ];
    error = jsonpatch.validate(sequence, tree);
    expect(error.name).toBe('OPERATION_PATH_UNRESOLVABLE');

    sequence = [
      {
        op: 'replace',
        path: '/cars/0/name',
        value: ''
      }
    ];
    error = jsonpatch.validate(sequence, tree);
    expect(error.name).toBe('OPERATION_PATH_UNRESOLVABLE');
  });

  it('should return error removing an unexisting path', function() {
    var tree = {
      name: 'Elvis',
      cars: []
    };
    var sequence = [
      {
        op: 'remove',
        path: '/name/first'
      }
    ];
    var error = jsonpatch.validate(sequence, tree);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_PATH_UNRESOLVABLE');
  });

  it('should allow adding property "b" in "a"', function() {
    var tree = {
      a: {
        foo: 1
      }
    };
    var sequence = [
      {
        op: 'add',
        path: '/a/b',
        value: 'sample'
      }
    ];

    var error = jsonpatch.validate(sequence, tree);
    expect(error).toBeUndefined();
  });

  it('should report error because "a" does not exist', function() {
    var tree = {
      q: {
        bar: 2
      }
    };
    var sequence = [
      {
        op: 'add',
        path: '/a/b',
        value: 'sample'
      }
    ];

    var error = jsonpatch.validate(sequence, tree);
    expect(error instanceof jsonpatch.JsonPatchError).toBe(true);
    expect(error.name).toBe('OPERATION_PATH_CANNOT_ADD');
  });

  it('should return error when replacing a removed path', function() {
    var tree = {
      name: 'Elvis'
    };
    var sequence = [
      {
        op: 'remove',
        path: '/name'
      },
      {
        op: 'replace',
        path: '/name',
        value: 'Freddie'
      }
    ];
    var error = jsonpatch.validate(sequence, tree);
    expect(error.name).toBe('OPERATION_PATH_UNRESOLVABLE');
  });

  it('should allow to override validator to add custom validation', function() {
    var tree = {
      password: 'Elvis'
    };
    var sequence = [
      {
        op: 'replace',
        path: '/password',
        value: 'Elvis123'
      },
      {
        op: 'replace',
        path: '/password',
        value: 'Presley123'
      },
      {
        op: 'replace',
        path: '/password'
      }
    ];

    const validator = function(operation, index, tree, existingPath) {
      throw new jsonpatch.JsonPatchError(
            'Operation `value` property must not contain the old value',
            'OPERATION_VALUE_MUST_NOT_CONTAIN_OLD_VALUE',
            index,
            operation,
            tree
          );
        }
    var customError = jsonpatch.validate(sequence, tree, validator);
    expect(customError.index).toBe(0);
    expect(customError.name).toBe('OPERATION_VALUE_MUST_NOT_CONTAIN_OLD_VALUE');
  });

  it('should pass replacing the tree root', function() {
    var tree = {
      password: 'Elvis'
    };
    var sequence = [
      {
        op: 'replace',
        path: '',
        value: {}
      }
    ];

    var error = jsonpatch.validate(sequence, tree);
    expect(error).toBeUndefined();
  });

  it('should return error moving from an unexisting path', function() {
    var tree = {
      name: 'Elvis'
    };
    var sequence = [
      {
        op: 'move',
        from: '/a/b/c',
        path: '/name'
      }
    ];
    var error = jsonpatch.validate(sequence, tree);
    expect(error.name).toBe('OPERATION_FROM_UNRESOLVABLE');
  });

  it('should return error copying from an unexisting path', function() {
    var tree = {
      name: 'Elvis'
    };
    var sequence = [
      {
        op: 'copy',
        from: '/a/b/c',
        path: '/name'
      }
    ];
    var error = jsonpatch.validate(sequence, tree);
    expect(error.name).toBe('OPERATION_FROM_UNRESOLVABLE');
  });

  it('using deprecated apply, should throw OPERATION_PATH_INVALID when applying patch without path, and throw a warning', function() {
    spyOn(console, 'warn');

    var a = {};
    var ex = null;

    try {
      jsonpatch.apply(
        a,
        [
          {
            op: 'replace',
            value: ''
          }
        ],
        true
      );
    } catch (e) {
      ex = e;
    }

    expect(ex.name).toBe('OPERATION_PATH_INVALID');
    expect(console.warn).toHaveBeenCalled();
  });

  it('should throw OPERATION_PATH_INVALID when applying patch without path', function() {
    var a = {};
    var ex = null;

    try {
      jsonpatch.applyPatch(
        a,
        [
          {
            op: 'replace',
            value: ''
          }
        ],
        true
      );
    } catch (e) {
      ex = e;
    }

    expect(ex.name).toBe('OPERATION_PATH_INVALID');
  });

  it('should throw OPERATION_PATH_INVALID when applying patch with an invalid path. Issue #77.', function() {
    var a = {};
    var ex = null;

    try {
      jsonpatch.applyPatch(
        a,
        [
          {
            op: 'replace',
            value: '',
            path: 'foo' // no preceding "/"
          }
        ],
        true
      );
    } catch (e) {
      ex = e;
    }
    expect(ex.name).toBe('OPERATION_PATH_INVALID');
  });

  it('should throw OPERATION_OP_INVALID when applying patch without operation', function() {
    var a = {};
    var ex = null;

    try {
      jsonpatch.applyPatch(
        a,
        [
          {
            path: '/foo',
            value: ''
          }
        ],
        true
      );
    } catch (e) {
      ex = e;
    }

    expect(ex.name).toBe('OPERATION_OP_INVALID');
  });

  it('should throw OPERATION_VALUE_REQUIRED when applying patch without value', function() {
    var a = {};
    var ex = null;

    try {
      jsonpatch.applyPatch(
        a,
        [
          {
            path: '/foo',
            op: 'add'
          }
        ],
        true
      );
    } catch (e) {
      ex = e;
    }

    expect(ex.name).toBe('OPERATION_VALUE_REQUIRED');
  });
});


text:
/*!
 *
 * @file virtual_camera.h
 *
 * @author
 *
 * @version
 *
 * @date Jul-20-2010
 *
 * @brief The file contains Macro's and functions required for Virtual Camera
 *        Loopback Application
 *
 *****************************************************************************/

#ifndef _VIRTUAL_CAMERA_H
#define _VIRTUAL_CAMERA_H

#include "types.h"
#include "user_config.h"

/******************************************************************************
 * Constants - None
 *****************************************************************************/

/******************************************************************************
 * Macro's
 *****************************************************************************/
#define  CONTROLLER_ID      (0)   /* ID to identify USB CONTROLLER */

#define  KBI_STAT_MASK      (0x0F)

#define VIDEO_CLASS      0
#define MSD_CLASS        1

/*****************************************************************************
 * Global variables
 *****************************************************************************/

/*****************************************************************************
 * Global Functions
 *****************************************************************************/
extern void TestApp_Init(void);

#define HEADER_PACKET_SIZE 12

#endif


text:
module.exports = {
  description: 'Install toastr.js from npm',

  // prevent complaining
  normalizeEntityName: function() {
  },

  // locals: function(options) {
  //   // Return custom template variables here.
  //   return {
  //     foo: options.entity.options.foo
  //   };
  // }

  afterInstall: function() {
    return this.addPackageToProject('toastr');
  }
};


text:
'use strict'

import {List, Record} from 'immutable'

export const Scene = new Record({
  id: undefined,
  events: List([])
})


text:
Attribute (Directive)
=====================

This allow you to dynamically be able to add or change attribute values for an element. There are a 2 different formats the this object can be formatted in.

The first format if where the key hass both the attribute name and value separated by a double colon (::) and the value is the conditional that determines whether or not this attribute/value value should be on the element. This format is good for an attribute that will allows have one value and eiher should or should not be there.

The second format is good for attribute that should always be on the element but you want to be able to toggle the value of the attribute. In the second format, the key of the object is the name of the attribute and the value is another object. That object value with have multiple properties with the name if the value for the attribute and the value is the consitional to check to see if that should be the value of the attribute.

HTML Attributes
===============

* nag-attribute - Object mapping attributes and value to conditional to check to determine if/what value as attribute should have. Read the description above to see the different format this can be structured in.

Example Code
============

Javascript
```javascript
angular.module('docs.attribute', [])
.controller('AttributeCtrl', ['$scope', function($scope) {
  $scope.customAttribute = false;
    $scope.customAttribute2 = false;
    $scope.customAttribute3 = false;
    $scope.customAttribute4 = false;

    $scope.customFunction = function() {
      $scope.customAttribute3 = !$scope.customAttribute3;
      $scope.customAttribute4 = !$scope.customAttribute4;
    }
}]);
```

HTML
```html
<div style="cursor: pointer" nag-attribute="{'data-test::on': customAttribute}" ng-click="customAttribute = !customAttribute">
  Click on me to toggle my data-test attribute on/off
</div>
<div style="cursor: pointer" nag-attribute="{'data-test': {'value1': customAttribute2, 'value2': !customAttribute2}}" ng-click="customAttribute2 = !customAttribute2">
  Click on me to toggle my data-test attribute value
</div>
<div style="cursor: pointer" nag-attribute="{'data-test::on': customAttribute3, 'data-test2': {'value1': customAttribute4, 'value2': !customAttribute4}}" ng-click="customFunction()">
  Click on me to toggle my data-test attribute on/off and data-test2 attribute value
</div>
```


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Pomaderris argyrophylla subsp. graniticola N.G.Walsh & Coates

### Remarks
null


text:
/*
* cgeSprite3d.cpp
*
*  Created on: 2014-10-16
*      Author: Wang Yang
*        Mail: admin@wysaid.org
*/

#ifndef _CGE_ONLY_FILTERS_

#include "cgeSprite3d.h"

static CGEConstString s_vshSprite3dTest = CGE_SHADER_STRING(
attribute vec4 v4Position;
uniform mat4 mvp;
varying vec3 color;

void main()
{
	gl_Position = mvp * v4Position;
	color = abs(gl_Position.zzz);
});

static CGEConstString s_fshSprite3dTest = CGE_SHADER_STRING_PRECISION_M(

varying vec3 color;

void main()
{
	gl_FragColor = vec4(color, 1.0);
});

namespace CGE
{
	CGEConstString SpriteInterface3d::paramAttribPositionName = "v4Position";

	SpriteInterface3d::SpriteInterface3d() : m_pos(0.0f, 0.0f, 0.0f), m_scaling(1.0f, 1.0f, 1.0f), m_hotspot(0.0f, 0.0f, 0.0f), m_rotation(Mat3::makeIdentity()), m_alpha(1.0f), m_zIndex(0.0f) {}

	//////////////////////////////////////////////////////////////////////////

    Sprite3d::~Sprite3d()
    {

    }

    void Sprite3d::_bindProgramLocations()
    {
        m_program.bindAttribLocation(paramAttribPositionName, 0);
    }

    bool Sprite3d::_initProgram(CGEConstString vsh, CGEConstString fsh)
    {
        _bindProgramLocations();

        if(!m_program.initWithShaderStrings(vsh, fsh))
        {
            CGE_LOG_ERROR("Sprite3dExt::_initProgram Failed!");
            return false;
        }
        _initProgramUniforms();
        return true;
    }

    //////////////////////////////////////////////////////////////////////////

	Sprite3dExt::~Sprite3dExt()
	{
		glDeleteBuffers(1, &m_vertBuffer.bufferID);
		glDeleteBuffers(1, &m_vertElementBuffer.bufferID);
	}

	bool Sprite3dExt::init(const ArrayBufferComponent& vertexBuffer, const ArrayBufferComponent& vertexElementArrayBuffer, GLenum drawFunc)
	{
		m_vertBuffer = vertexBuffer;
		m_vertElementBuffer = vertexElementArrayBuffer;

		if(m_vertBuffer.bufferID == 0)
		{
			m_vertBuffer.bufferID = genBufferWithComponent(m_vertBuffer);
		}

		if(vertexElementArrayBuffer.bufferID == 0)
		{
			m_vertElementBuffer.bufferID = genBufferWithComponent(m_vertElementBuffer);
		}

		cgeCheckGLError("Sprite3d::init");
		m_vertBuffer.bufferData = nullptr;
		m_vertElementBuffer.bufferData = nullptr;
		m_drawFunc = drawFunc;
		return _initProgram(s_vshSprite3dTest, s_fshSprite3dTest);
	}

	void Sprite3dExt::renderWithMat(const Mat4& modelViewProjectionMatrix)
	{
        const Mat4& mvp = modelViewProjectionMatrix * _calcMat();
//        modelViewProjectionMatrix * (Mat4(m_scaling[0], 0.0f, 0.0f, 0.0f,
//			0.0f, m_scaling[1], 0.0f, 0.0f,
//			0.0f, 0.0f, m_scaling[2], 0.0f,
//			m_pos[0], m_pos[1], m_pos[2], 1.0f) * m_rotation);

		m_program.bind();
		glUniformMatrix4fv(m_mvpLocation, 1, GL_FALSE, mvp[0]);
		glBindBuffer(m_vertBuffer.bufferKind, m_vertBuffer.bufferID);
		glEnableVertexAttribArray(0);
		glVertexAttribPointer(0, m_vertBuffer.componentSize, m_vertBuffer.bufferDataKind, GL_FALSE, m_vertBuffer.bufferStride, 0);

		glBindBuffer(m_vertElementBuffer.bufferKind, m_vertElementBuffer.bufferID);

		glDrawElements(m_drawFunc, m_vertElementBuffer.elementCnt, m_vertElementBuffer.bufferDataKind, 0);

        CGE_LOG_CODE
        (
        cgeCheckGLError("Sprite3dExt::renderWithMat");
        )
	}

    void Sprite3dExt::_initProgramUniforms()
    {
        m_program.bind();
        m_mvpLocation = m_program.uniformLocation("mvp");
    }

}

#endif


text:
//
//  LCHttpClient.h
//  LCMogoWeiboDemo
//
//  Created by 李策 on 16/4/17.
//  Copyright © 2016年 李策. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "LCRequsestBase.h"
#import "LCResponse.h"
typedef void(^Success)(LCResponse *response);
typedef void(^Failure)(LCResponse *response);
@interface LCHttpClient : NSObject
/**
 *  请求方式/参数/URL设置的类
 */
@property (nonatomic , copy) LCRequsestBase *request;
/**
 *  成功的block
 */
@property (nonatomic , copy) Success requsetSuccess;
/**
 *  失败的block
 */
@property (nonatomic , copy) Failure requsetFailure;
/**
 *  开始网络请求
 *
 *  @param requester      请求参数设置
 *  @param requestSuccess 成功的block
 *  @param requestFailure 失败的block
 */
- (void)requestWithRequester:(LCRequsestBase *)requester success:(Success)requestSuccess failure:(Failure)requestFailure;
/**
 *  关闭所有请求
 */
- (void)cancel;
@end


text:
(function( $ ){
 	var defaultOptions  = {
		tab : null,
		tabActiveClass : 'active',
		tabHandler : null,
		tabHandlerActiveClass : 'active',
		bindingHandler : false, //直接调用methods方法,这里需要指定为false
		effect : 'slide',
		beforeActive : null,
		afterActive : null,
		activeIndex : 0,
		effectSpeed : 300,
		callback : function(){}
	},

	currentHandler = null,

	methods = {
		init : function(options) {
			//not binding elements;
			if(this === methods) {
				return false;
			}

			var tabHandler = $(this);

			options = methods.getOptions(options);
			options.tabHandler = tabHandler;
			options.bindingHandler = true;
			tabHandler.data("evaTabOpt", options);

			tabHandler.live("click", methods.events.onClickTabhandler);

			return false;
		},

		getTab : function(options){
			if(options.tab) {
				return $(options.tab);
			}

			return $("#" + options.tipId);

		},

		getTabHandler : function(){
			return currentHandler;
		},

		getOptions : function(options){
			var defaultOpt = $.extend({}, defaultOptions);
			return $.extend(defaultOpt, options);
		},

		active : function(options) {
			if(options.bindingHandler === false) {
				options = methods.getOptions(options);
			}

			if(typeof options.beforeActive == 'function'){
				options.beforeActive(currentHandler, options);
			}
			var effect = options.effect;
			if(methods.effects[effect]) {
				methods.effects[effect](options);
			} else {
				methods.effects.noEffect(options);
			}
		},

		effects : {
			noEffect : function(options){
				var tab = options.tab;
				var currentTab = tab.eq(options.activeIndex);

				tab.filter(":visible").hide(options.effectSpeed);

				if(currentTab.attr("data-tab") && !currentTab.data("evaTabAjaxLoad")) {
					$.ajax({
						url: currentTab.attr("data-tab"),
						success: function(htm){
							currentTab.html(htm);
							currentTab.data("evaTabAjaxLoad", true);

							currentTab.show(options.effectSpeed, function(){
								if(typeof options.afterActive == 'function'){
									options.afterActive(currentTab);
								}
							});
						}
					});
				} else {
					currentTab.show(options.effectSpeed, function(){
						if(typeof options.afterActive == 'function'){
							options.afterActive(currentTab);
						}
					});
				}

				options.tabHandler.removeClass("active");
				currentHandler.addClass('active');
			},
			slide : function(options){
				var tab = options.tab;
				var currentTab = tab.eq(options.activeIndex);

				tab.filter(":visible").slideUp(options.effectSpeed);

				if(currentTab.attr("data-tab") && !currentTab.data("evaTabAjaxLoad")) {
					$.ajax({
						url: currentTab.attr("data-tab"),
						success: function(htm){
							currentTab.html(htm);
							currentTab.data("evaTabAjaxLoad", true);

							currentTab.slideDown(options.effectSpeed, function(){
								if(typeof options.afterActive == 'function'){
									options.afterActive(currentTab);
								}
							});
						}
					});
				} else {
					currentTab.slideDown(options.effectSpeed, function(){
						if(typeof options.afterActive == 'function'){
							options.afterActive(currentTab);
						}
					});
				}

				options.tabHandler.removeClass("active");
				currentHandler.addClass('active');
			},
			fade : function(options){
				var tab = options.tab;
				var currentTab = tab.eq(options.activeIndex);

				tab.filter(":visible").fadeOut(options.effectSpeed);

				if(currentTab.attr("data-tab") && !currentTab.data("evaTabAjaxLoad")) {
					$.ajax({
						url: currentTab.attr("data-tab"),
						success: function(htm){
							currentTab.html(htm);
							currentTab.data("evaTabAjaxLoad", true);

							currentTab.fadeIn(options.effectSpeed, function(){
								if(typeof options.afterActive == 'function'){
									options.afterActive(currentTab);
								}
							});
						}
					});
				} else {
					currentTab.fadeIn(options.effectSpeed, function(){
						if(typeof options.afterActive == 'function'){
							options.afterActive(currentTab);
						}
					});
				}

				options.tabHandler.removeClass("active");
				currentHandler.addClass('active');
			}
		},
		events : {
			onClickTabhandler : function(){
				currentHandler = $(this);

				var options = currentHandler.data("evaTabOpt");
				options.activeIndex = currentHandler.index();

				if(typeof options.beforeActive == "function") {
					options.beforeActive(currentHandler, options);
				}
				methods.active(options);
				return false;
			}

		}
	};

	$.fn.evaTab = function( method ) {
		if ( methods[method] ) {
			methods.init();
			return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
		} else if ( typeof method === 'object' || ! method ) {
			return methods.init.apply(this, arguments);
		} else {
			$.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );
		}

		return false;
	};

	$.evaTab = methods;
})( jQuery );


text:
using EmpMan.Data.Infrastructure;
using EmpMan.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EmpMan.Data.Repositories
{
    public interface IEmpOnsiteRepository : IRepository<EmpOnsite>
    {

    }

    public class EmpOnsiteRepository : RepositoryBase<EmpOnsite>, IEmpOnsiteRepository
    {
        public EmpOnsiteRepository(IDbFactory dbFactory) : base(dbFactory)
        {

        }
    }
}


text:
package com.planet_ink.coffee_mud.WebMacros;

import com.planet_ink.coffee_web.interfaces.*;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

public class SystemInfo extends StdWebMacro
{
	@Override
	public String name()
	{
		return "SystemInfo";
	}

	@Override
	public boolean isAdminMacro()
	{
		return true;
	}

	@Override
	public String runMacro(final HTTPRequest httpReq, final String parm, final HTTPResponse httpResp)
	{
		final StringBuffer str=new StringBuffer("");
		final java.util.Map<String,String> parms=parseParms(parm);
		for(final String key : parms.keySet())
		{
			if(key.length()>0)
			{
				String answer=CMLib.threads().getTickInfoReport(key);
				if(answer.length()==0)
					answer=CMLib.threads().getSystemReport(key);
				str.append(answer+", ");
			}
		}
		String strstr=str.toString();
		if(strstr.endsWith(", "))
			strstr=strstr.substring(0,strstr.length()-2);
		return clearWebMacros(strstr);
	}
}


text:
package org.apache.phoenix.mapreduce.bulkload;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Assert;
import org.junit.Test;

/**
 * Tests for {@linkplain TableRowkeyPair}
 */
public class TestTableRowkeyPair {

    @Test
    public void testRowkeyPair() throws IOException {
        testsRowsKeys("first", "aa", "first", "aa", 0);
        testsRowsKeys("first", "aa", "first", "ab", -1);
        testsRowsKeys("second", "aa", "first", "aa", 1);
        testsRowsKeys("first", "aa", "first", "aaa", -1);
        testsRowsKeys("first","bb", "first", "aaaa", 1);
    }

    private void testsRowsKeys(String aTable, String akey, String bTable, String bkey, int expectedSignum) throws IOException {

        final ImmutableBytesWritable arowkey = new ImmutableBytesWritable(Bytes.toBytes(akey));
        TableRowkeyPair pair1 = new TableRowkeyPair(aTable, arowkey);

        ImmutableBytesWritable browkey = new ImmutableBytesWritable(Bytes.toBytes(bkey));
        TableRowkeyPair pair2 = new TableRowkeyPair(bTable, browkey);

        TableRowkeyPair.Comparator comparator = new TableRowkeyPair.Comparator();
        try( ByteArrayOutputStream baosA = new ByteArrayOutputStream();
             ByteArrayOutputStream baosB = new ByteArrayOutputStream()) {

            pair1.write(new DataOutputStream(baosA));
            pair2.write(new DataOutputStream(baosB));
            Assert.assertEquals(expectedSignum , signum(pair1.compareTo(pair2)));
            Assert.assertEquals(expectedSignum , signum(comparator.compare(baosA.toByteArray(), 0, baosA.size(), baosB.toByteArray(), 0, baosB.size())));
            Assert.assertEquals(expectedSignum, -signum(comparator.compare(baosB.toByteArray(), 0, baosB.size(), baosA.toByteArray(), 0, baosA.size())));
        }

    }

    private int signum(int i) {
        return i > 0 ? 1: (i == 0 ? 0: -1);
    }
}


text:
<!-- Copyright 2015 The Chromium Authors. All rights reserved.
     Use of this source code is governed by a BSD-style license that can be
     found in the LICENSE file.
-->

# Telemetry: Run Benchmarks Locally

## Set Up

If you just want Telemetry, cloning
[catapult](https://github.com/catapult-project/catapult) repository should be
enough. If you also want the Chrome benchmarks built with Telemetry, get the
[latest Chromium checkout](https://www.chromium.org/developers/how-tos/get-the-code).
If you're running on Mac OS X, you're all set! For Windows, Linux, Android, or
Chrome OS, read on.

#### Windows

Some benchmarks require you to have
[pywin32](http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/).
Be sure to install a version that matches the version and bitness of the Python
you have installed.

#### Linux

Telemetry on Linux tries to scan for attached Android devices with
[adb](https://developer.android.com/tools/help/adb.html).
The included adb binary is 32-bit. On 64-bit machines, you need to install the
libstdc++6:i386 package.

#### Android

Running on Android is supported with a Linux host. Windows and Mac OS X are not
yet supported. There are also a few additional steps to set up:

  1. Telemetry requires [adb](http://developer.android.com/tools/help/adb.html).
     If you're running from the zip archive, adb is already included. But if
     you're running with a Chromium checkout, ensure your .gclient file contains
     target\_os = ['android'], then resync your code.
  2. Telemetry only supports devices with ADB Daemon running as root.
     First, you need to install a "userdebug" build of Android on your device.
     Then run `adb root`. Sometimes you may also need to run `adb remount`.
     If you are unable to install "userdebug" build of Android, you can try
     running benchmarks with `--compatibility-mode=dont-require-rooted-device`
     switch, however this configuration may not be supported and you may run
     into errors.
  3. Enable [debugging over USB](http://developer.android.com/tools/device.html)
     on your device.
  4. You can get the name of your device with `adb devices` and use it with
     Telemetry via --device=<device\_name>.

#### Chrome OS

See [Running Telemetry on Chrome OS](https://chromium.googlesource.com/chromiumos/docs/+/master/cros_vm.md#Run-telemetry-unit-tests).

## Benchmark Commands

Telemetry benchmarks can be run with run\_benchmark.

In the Chromium source tree, this is located at `src/tools/perf/run_benchmark`.

#### Running a benchmark

List the available benchmarks with `telemetry/run_benchmark list`.

Here's an example for running a particular benchmark:

`src/tools/perf/run_benchmark blink_perf.css --browser=stable`

#### Running on another browser

To list available browsers, use:

`src/tools/perf/run_benchmark --browser=list`

For ease of use, you can use default system browsers on desktop:

`src/tools/perf/run_benchmark blink_perf.css --browser=system`

and on Android:

`src/tools/perf/run_benchmark blink_perf.css --browser=android-system-chrome`

If you're running telemetry from within a Chromium checkout, the release and
debug browsers are what's built in out/Release and out/Debug, respectively.

To run a specific browser executable:

`src/tools/perf/run_benchmark blink_perf.css --browser=exact --browser-executable=/path/to/binary`

To run on a Chromebook:

`src/tools/perf/run_benchmark blink_perf.css --browser=cros-chrome --remote=[ip_address]`

#### Options

To see all options, run:

`src/tools/perf/run_benchmark run --help`

Use --pageset-repeat to run the benchmark repeatedly. For example:

`src/tools/perf/run_benchmark blink_perf.css --pageset-repeat=30`

Use --run-abridged-story-set to run a shortened version of a benchmark with a
representative subset of the stories included (Note that some benchmarks do not
have an abridged version yet. Instructions for abridging a benchmark are
[here](https://docs.google.com/document/d/1GOl4QiOQ0hjwBa0xzvIkgp5wmepqdNpQ6iBybvKENIE/edit#heading=h.x7s3eoyaqdu)). Example:

`src/tools/perf/run_benchmark rendering.desktop --run-abridged-story-set`

If you want to re-generate HTML results and add label, you can do this locally
by using the parameters `--reset-results --results-label="foo"`

`src/tools/perf/run_benchmark blink_perf.css --reset-results --results-label="foo"`

#### Comparing Two Runs

`src/tools/perf/run_benchmark some_benchmark --browser-executable=path/to/version/1
--reset-results --results-label="Version 1"`

`src/tools/perf/run_benchmark some_benchmark --browser-executable=path/to/version/2
--results-label="Version 2"`

The results will be written to in the `results.html` file in the same location
of the `run_benchmark` script.


text:
NSString *const TDTZDecompressorException = @"TDTZDecompressorException";
NSString *const TDTZDecompressorExceptionCodeKey = @"TDTZDecompressorExceptionCodeKey";
static const NSInteger OutBufferChunkSizeDefault = 2048;
static const NSInteger ReadChunkSize = 4096; // in bytes

@interface TDTZDecompressor ()

@property (nonatomic) NSMutableData *outBuffer;
@property (nonatomic) TDTCompressionFormat compressionFormat;
@property (nonatomic) z_streamp zStream;
@property (nonatomic) BOOL isZStreamInitialized;

@end

@implementation TDTZDecompressor

+ (NSException *)exceptionWithCode:(int)code msg:(const char *)msg {
  return [NSException exceptionWithName:TDTZDecompressorException
                                 reason:@(msg)
                               userInfo:@{TDTZDecompressorExceptionCodeKey: @(code)}];
}

- (instancetype)initWithCompressionFormat:(TDTCompressionFormat)compressionFormat {
  self = [super init];
  if (self) {
    _isZStreamInitialized = NO;
    _compressionFormat = compressionFormat;
    _outBufferChunkSize = OutBufferChunkSizeDefault;
    _copyOutputData = YES;
    z_streamp zStream = _zStream = (z_streamp)malloc(sizeof(z_stream));
    zStream->zalloc = Z_NULL;
    zStream->zfree = Z_NULL;
    zStream->opaque = NULL;
    zStream->avail_in = 0;
    zStream->next_in = Z_NULL;
    _windowSize = 15;
  }
  return self;
}

- (void)dealloc {
  if (_isZStreamInitialized) {
    inflateEnd(_zStream);
  }
  free(_zStream);
}

- (void)initializeZStream {
  int windowBits = (self.compressionFormat == TDTCompressionFormatDeflate) ? self.windowSize : (self.windowSize + 16);
  int result = inflateInit2(self.zStream, windowBits);
  if (result != Z_OK) {
    @throw [[self class] exceptionWithCode : result msg : self.zStream->msg];
  }
  self.isZStreamInitialized = YES;
}

- (NSData *)decompressFlush:(int)flush {
  z_streamp zStream = self.zStream;
  unsigned int outBufferChunkSize = self.outBufferChunkSize;
  zStream->next_out = [self.outBuffer mutableBytes];
  zStream->avail_out = outBufferChunkSize;
  NSUInteger bytesDecompressed = 0;
  int result;
  do {
    if (zStream->avail_out == 0) {
      // insufficient output -- increase size of output buffer
      NSUInteger previousLength = [self.outBuffer length];
      [self.outBuffer increaseLengthBy:outBufferChunkSize];
      zStream->next_out = [self.outBuffer mutableBytes] + previousLength;
      zStream->avail_out = outBufferChunkSize;
    }
    result = inflate(zStream, flush);
    if (result != Z_OK && result != Z_STREAM_END  && result != Z_BUF_ERROR) {
      @throw [[self class] exceptionWithCode : result msg : zStream->msg];
    }
    bytesDecompressed += (outBufferChunkSize - zStream->avail_out);
  } while (zStream->avail_out == 0);
  if (self.copyOutputData) {
    return [NSData dataWithBytes:[self.outBuffer mutableBytes] length:bytesDecompressed];
  } else {
    return [NSData dataWithBytesNoCopy:[self.outBuffer mutableBytes] length:bytesDecompressed freeWhenDone:NO];
  }
}

- (NSData *)decompressData:(NSData *)data flush:(int)flush {
  // This assertion is added because zStream can be sent at most UINT_MAX bytes at a time
  NSAssert((data == nil) || [data length] <= UINT_MAX, @"data length exceeds UINT_MAX: %lu", (unsigned long)[data length]);
  if (!self.isZStreamInitialized) {
    [self initializeZStream];
  }
  self.outBuffer = [NSMutableData dataWithLength:self.outBufferChunkSize];
  if (data != nil) {
    z_streamp zStream = self.zStream;
    zStream->next_in = (Bytef *)[data bytes];
    zStream->avail_in = (unsigned int)[data length];
  }
  return [self decompressFlush:flush];
}

- (NSData *)decompressData:(NSData *)data {
  return [self decompressData:data flush:Z_NO_FLUSH];
}

- (NSData *)flushData:(NSData *)data {
  NSData *output = [self decompressData:data flush:Z_SYNC_FLUSH];
  return output;
}

- (NSData *)finishData:(NSData *)data {
  NSData *output = [self decompressData:data flush:Z_FINISH];
  int result = inflateEnd(self.zStream);
  if (result != Z_OK) {
    @throw [[self class] exceptionWithCode : result msg : self.zStream->msg];
  }
  return output;
}

- (NSData *)decompressFile:(NSString *)path error:(NSError **)error {
  NSInputStream *inStream = [NSInputStream inputStreamWithFileAtPath:path];
  [inStream open];
  uint8_t inBuffer[ReadChunkSize];
  NSData *inData;
  NSMutableData *outData = [NSMutableData data];
  do {
    NSInteger length = [inStream read:inBuffer maxLength:ReadChunkSize];
    if (length < 0) {
      // Some error with reading data
      if (error != NULL) {
        *error = [inStream streamError];
      }
      return nil;
    } else {
      inData = [NSData dataWithBytes:inBuffer length:(NSUInteger)length];
      if ([inData length] > 0) {
        [outData appendData:[self decompressData:inData]];
      }
    }
  } while ([inStream hasBytesAvailable]);
  [inStream close];
  [outData appendData:[self finishData:nil]];
  return outData;
}

@end


text:
require "alerty/plugin/mail/version"

require 'alerty'
require 'mail'

class Alerty
  class Plugin
    class Mail
      def initialize(config)
        raise ConfigError.new('mail: send_from is not configured') unless config.send_from
        raise ConfigError.new('mail: send_to is not configured') unless config.send_to
        delivery_method = config.delivery_method.to_sym || :sendmail
        delivery_settings = config.delivery_settings
        num_retries = config.num_retries || 3

        @mail = ::Mail.new do
          from    config.send_from
          to      config.send_to
        end
        if delivery_settings
          @mail.delivery_method(delivery_method, delivery_settings.map {|k, v| [k.to_sym, v] }.to_h)
        else
          @mail.delivery_method(delivery_method)
        end
        @num_retries = num_retries
        @subject = config.subject
      end

      def alert(record)
        subject = expand_placeholder(@subject, record) if @subject
        message = record[:output]
        retries = 0
        begin
          @mail.subject = subject if @subject
          @mail.body = message
          @mail.deliver!
        rescue => e
          retries += 1
          sleep 1
          if retries <= @num_retries
            retry
          else
            raise e
          end
        end
      end

      private

      def expand_placeholder(str, record)
        str.gsub('${hostname}', record[:hostname]).gsub!('${command}', record[:command])
      end
    end
  end
end


text:
exports = module.exports = {
	send: require('./send'),
	Receiver: require('./receive'),
};


text:
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <arrow-glib/data-type.hpp>
#include <arrow-glib/uint32-data-type.h>

G_BEGIN_DECLS

/**
 * SECTION: uint32-data-type
 * @short_description: 32-bit unsigned integer data type
 *
 * #GArrowUInt32DataType is a class for 32-bit unsigned integer data type.
 */

G_DEFINE_TYPE(GArrowUInt32DataType,                \
              garrow_uint32_data_type,             \
              GARROW_TYPE_DATA_TYPE)

static void
garrow_uint32_data_type_init(GArrowUInt32DataType *object)
{
}

static void
garrow_uint32_data_type_class_init(GArrowUInt32DataTypeClass *klass)
{
}

/**
 * garrow_uint32_data_type_new:
 *
 * Returns: The newly created 32-bit unsigned integer data type.
 */
GArrowUInt32DataType *
garrow_uint32_data_type_new(void)
{
  auto arrow_data_type = arrow::uint32();

  GArrowUInt32DataType *data_type =
    GARROW_UINT32_DATA_TYPE(g_object_new(GARROW_TYPE_UINT32_DATA_TYPE,
                                         "data-type", &arrow_data_type,
                                         NULL));
  return data_type;
}

G_END_DECLS