text:
static const char MJReplacedKeyFromPropertyNameKey = '\0';
static const char MJReplacedKeyFromPropertyName121Key = '\0';
static const char MJNewValueFromOldValueKey = '\0';
static const char MJObjectClassInArrayKey = '\0';

static const char MJCachedPropertiesKey = '\0';

dispatch_semaphore_t mje_signalSemaphore;
dispatch_once_t mje_onceTokenSemaphore;

@implementation NSObject (Property)

+ (NSMutableDictionary *)mj_propertyDictForKey:(const void *)key
{
    static NSMutableDictionary *replacedKeyFromPropertyNameDict;
    static NSMutableDictionary *replacedKeyFromPropertyName121Dict;
    static NSMutableDictionary *newValueFromOldValueDict;
    static NSMutableDictionary *objectClassInArrayDict;
    static NSMutableDictionary *cachedPropertiesDict;

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        replacedKeyFromPropertyNameDict = [NSMutableDictionary dictionary];
        replacedKeyFromPropertyName121Dict = [NSMutableDictionary dictionary];
        newValueFromOldValueDict = [NSMutableDictionary dictionary];
        objectClassInArrayDict = [NSMutableDictionary dictionary];
        cachedPropertiesDict = [NSMutableDictionary dictionary];
    });

    if (key == &MJReplacedKeyFromPropertyNameKey) return replacedKeyFromPropertyNameDict;
    if (key == &MJReplacedKeyFromPropertyName121Key) return replacedKeyFromPropertyName121Dict;
    if (key == &MJNewValueFromOldValueKey) return newValueFromOldValueDict;
    if (key == &MJObjectClassInArrayKey) return objectClassInArrayDict;
    if (key == &MJCachedPropertiesKey) return cachedPropertiesDict;
    return nil;
}

#pragma mark - --私有方法--
+ (id)mj_propertyKey:(NSString *)propertyName
{
    MJExtensionAssertParamNotNil2(propertyName, nil);

    __block id key = nil;
    // 查看有没有需要替换的key
    if ([self respondsToSelector:@selector(mj_replacedKeyFromPropertyName121:)]) {
        key = [self mj_replacedKeyFromPropertyName121:propertyName];
    }

    // 调用block
    if (!key) {
        [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
            MJReplacedKeyFromPropertyName121 block = objc_getAssociatedObject(c, &MJReplacedKeyFromPropertyName121Key);
            if (block) {
                key = block(propertyName);
            }
            if (key) *stop = YES;
        }];
    }

    // 查看有没有需要替换的key
    if ((!key || [key isEqual:propertyName]) && [self respondsToSelector:@selector(mj_replacedKeyFromPropertyName)]) {
        key = [self mj_replacedKeyFromPropertyName][propertyName];
    }

    if (!key || [key isEqual:propertyName]) {
        [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
            NSDictionary *dict = objc_getAssociatedObject(c, &MJReplacedKeyFromPropertyNameKey);
            if (dict) {
                key = dict[propertyName];
            }
            if (key && ![key isEqual:propertyName]) *stop = YES;
        }];
    }

    // 2.用属性名作为key
    if (!key) key = propertyName;

    return key;
}

+ (Class)mj_propertyObjectClassInArray:(NSString *)propertyName
{
    __block id clazz = nil;
    if ([self respondsToSelector:@selector(mj_objectClassInArray)]) {
        clazz = [self mj_objectClassInArray][propertyName];
    }

    if (!clazz) {
        [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
            NSDictionary *dict = objc_getAssociatedObject(c, &MJObjectClassInArrayKey);
            if (dict) {
                clazz = dict[propertyName];
            }
            if (clazz) *stop = YES;
        }];
    }

    // 如果是NSString类型
    if ([clazz isKindOfClass:[NSString class]]) {
        clazz = NSClassFromString(clazz);
    }
    return clazz;
}

#pragma mark - --公共方法--
+ (void)mj_enumerateProperties:(MJPropertiesEnumeration)enumeration
{
    // 获得成员变量
    NSArray *cachedProperties = [self mj_properties];
    // 遍历成员变量
    BOOL stop = NO;
    for (MJProperty *property in cachedProperties) {
        enumeration(property, &stop);
        if (stop) break;
    }
}

#pragma mark - 公共方法
+ (NSArray *)mj_properties
{
    MJExtensionSemaphoreCreate
    MJ_LOCK(mje_signalSemaphore);
    NSMutableDictionary *cachedInfo = [self mj_propertyDictForKey:&MJCachedPropertiesKey];
    NSMutableArray *cachedProperties = cachedInfo[NSStringFromClass(self)];
    if (cachedProperties == nil) {
        cachedProperties = [NSMutableArray array];

        [self mj_enumerateClasses:^(__unsafe_unretained Class c, BOOL *stop) {
            // 1.获得所有的成员变量
            unsigned int outCount = 0;
            objc_property_t *properties = class_copyPropertyList(c, &outCount);

            // 2.遍历每一个成员变量
            for (unsigned int i = 0; i<outCount; i++) {
                MJProperty *property = [MJProperty cachedPropertyWithProperty:properties[i]];
                // 过滤掉Foundation框架类里面的属性
                if ([MJFoundation isClassFromFoundation:property.srcClass]) continue;
                // 过滤掉`hash`, `superclass`, `description`, `debugDescription`
                if ([MJFoundation isFromNSObjectProtocolProperty:property.name]) continue;

                property.srcClass = c;
                [property setOriginKey:[self mj_propertyKey:property.name] forClass:self];
                [property setObjectClassInArray:[self mj_propertyObjectClassInArray:property.name] forClass:self];
                [cachedProperties addObject:property];
            }

            // 3.释放内存
            free(properties);
        }];

        cachedInfo[NSStringFromClass(self)] = cachedProperties;
    }
    NSArray *properties = [cachedProperties copy];
    MJ_UNLOCK(mje_signalSemaphore);

    return properties;
}

#pragma mark - 新值配置
+ (void)mj_setupNewValueFromOldValue:(MJNewValueFromOldValue)newValueFormOldValue {
    MJExtensionSemaphoreCreate
    MJ_LOCK(mje_signalSemaphore);
    objc_setAssociatedObject(self, &MJNewValueFromOldValueKey, newValueFormOldValue, OBJC_ASSOCIATION_COPY_NONATOMIC);
    MJ_UNLOCK(mje_signalSemaphore);
}

+ (id)mj_getNewValueFromObject:(__unsafe_unretained id)object oldValue:(__unsafe_unretained id)oldValue property:(MJProperty *__unsafe_unretained)property{
    // 如果有实现方法
    if ([object respondsToSelector:@selector(mj_newValueFromOldValue:property:)]) {
        return [object mj_newValueFromOldValue:oldValue property:property];
    }

    MJExtensionSemaphoreCreate
    MJ_LOCK(mje_signalSemaphore);
    // 查看静态设置
    __block id newValue = oldValue;
    [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
        MJNewValueFromOldValue block = objc_getAssociatedObject(c, &MJNewValueFromOldValueKey);
        if (block) {
            newValue = block(object, oldValue, property);
            *stop = YES;
        }
    }];
    MJ_UNLOCK(mje_signalSemaphore);
    return newValue;
}

+ (void)mj_removeCachedProperties {
    MJExtensionSemaphoreCreate
    MJ_LOCK(mje_signalSemaphore);
    [[self mj_propertyDictForKey:&MJCachedPropertiesKey] removeAllObjects];
    MJ_UNLOCK(mje_signalSemaphore);
}

#pragma mark - array model class配置
+ (void)mj_setupObjectClassInArray:(MJObjectClassInArray)objectClassInArray
{
    [self mj_setupBlockReturnValue:objectClassInArray key:&MJObjectClassInArrayKey];

    [self mj_removeCachedProperties];
}

#pragma mark - key配置

+ (void)mj_setupReplacedKeyFromPropertyName:(MJReplacedKeyFromPropertyName)replacedKeyFromPropertyName {
    [self mj_setupBlockReturnValue:replacedKeyFromPropertyName key:&MJReplacedKeyFromPropertyNameKey];

    [self mj_removeCachedProperties];
}

+ (void)mj_setupReplacedKeyFromPropertyName121:(MJReplacedKeyFromPropertyName121)replacedKeyFromPropertyName121 {
    MJExtensionSemaphoreCreate
    MJ_LOCK(mje_signalSemaphore);
    objc_setAssociatedObject(self, &MJReplacedKeyFromPropertyName121Key, replacedKeyFromPropertyName121, OBJC_ASSOCIATION_COPY_NONATOMIC);

    [[self mj_propertyDictForKey:&MJCachedPropertiesKey] removeAllObjects];
    MJ_UNLOCK(mje_signalSemaphore);
}
@end
#pragma clang diagnostic pop


text:
'use babel'
// Copyright 2018 Etheratom Authors
// This file is part of Etheratom.

// Etheratom is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Etheratom is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Etheratom.  If not, see <http://www.gnu.org/licenses/>.
import { ADD_PENDING_TRANSACTION, ADD_EVENTS, SET_EVENTS, TEXT_ANALYSIS } from '../actions/types';
const INITIAL_STATE = {
    pendingTransactions: [],
    events: [],
    txAnalysis: {}
};
export default (state = INITIAL_STATE, action) => {
    switch (action.type) {
        case ADD_PENDING_TRANSACTION:
            return { ...state, pendingTransactions: [...state.pendingTransactions, action.payload] };
        case ADD_EVENTS:
            return { ...state, events: [...state.events, action.payload] };
        case SET_EVENTS:
            return { ...state, events: [] };
        case TEXT_ANALYSIS:
            return { ...state, txAnalysis: action.payload };
        default:
            return state;
    }
};

redpajama_set_name: RedPajamaGithub


text:
package concurrency.ch5;

import static org.junit.Assert.*;

import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class H20Test {
	private final int n = 5;
	private final Semaphore mutex = new Semaphore(1);
	private int oxygen = 0;
	private int hydrogen = 0;
	private final CyclicBarrier barrier = new CyclicBarrier(3);
	private final Semaphore oxyQueue = new Semaphore(0);
	private final Semaphore hydroQueue = new Semaphore(0);

	private final CountDownLatch latch = new CountDownLatch(3*n + 1);

	@Test
	public void test() throws InterruptedException {
		ExecutorService oxygenPool = Executors.newFixedThreadPool(n);
		for(int i = 0; i < n; i++){
			oxygenPool.submit(new O());
		}

		ExecutorService hydrogenPool = Executors.newFixedThreadPool(2*n);
		for(int i = 0; i < 2*n; i++){
			hydrogenPool.submit(new H());
		}

		latch.countDown();
		latch.await(5, TimeUnit.SECONDS);
	}
	private class O implements Runnable {

		public void run() {
			latch.countDown();
			try {
				mutex.acquireUninterruptibly();
				++oxygen;
				if( hydrogen >= 2 ){
					System.out.println("=====");
					hydroQueue.acquireUninterruptibly(2);
					hydrogen -= 2;
					oxyQueue.release();
					oxygen -= 1;
				}else{
					mutex.release();
				}

				oxyQueue.acquireUninterruptibly();
				System.out.println("Bond O");
				barrier.await();

				mutex.release();
			} catch (InterruptedException e) {
				e.printStackTrace();
			} catch (BrokenBarrierException e) {
				e.printStackTrace();
			}
		}

	}
	private class H implements Runnable {

		public void run() {
			latch.countDown();

			try {
				mutex.acquireUninterruptibly();
				++hydrogen;
				if(oxygen >= 1 && hydrogen >= 2){
					System.out.println("=====");
					hydroQueue.release(2);
					hydrogen -= 2;
					oxyQueue.release();
					oxygen -= 1;
				}else{
					mutex.release();
				}

				hydroQueue.acquireUninterruptibly();
				System.out.println("Bond H");
				barrier.await();
			} catch (InterruptedException e) {
				e.printStackTrace();
			} catch (BrokenBarrierException e) {
				e.printStackTrace();
			}
		}

	}
}


text:
using Kubeless.Core.Interfaces;
using System.IO;

namespace Kubeless.Core.Models
{
    public class BinaryContent : IFileContent<byte[]>
    {
        public string FilePath { get; }
        public byte[] Content { get; private set; }
        public bool Exists { get; private set; }

        public BinaryContent(string filePath)
        {
            this.FilePath = filePath;
            if (File.Exists(filePath))
            {
                this.Content = File.ReadAllBytes(filePath);
                Exists = true;
            }
            else
            {
                Exists = false;
            }
        }
    }
}


text: groovy src/main/groovy/usergrid/ApiDocGenerator.groovy


text:
from tartist import random
from tartist.core.utils.cache import cached_property
import numpy as np
import collections

__all__ = [
    'RLEnvironBase', 'SimpleRLEnvironBase', 'ProxyRLEnvironBase',
    'ActionSpaceBase', 'DiscreteActionSpace', 'ContinuousActionSpace'
]

class RLEnvironBase(object):
    def __init__(self):
        self._stats = collections.defaultdict(list)

    @property
    def stats(self):
        return self._stats

    def append_stat(self, name, value):
        self._stats[name].append(value)
        return self

    def clear_stats(self):
        self._stats = collections.defaultdict(list)
        return self

    @cached_property
    def action_space(self):
        return self._get_action_space()

    @property
    def current_state(self):
        return self._get_current_state()

    def action(self, action):
        return self._action(action)

    def restart(self, *args, **kwargs):
        return self._restart(*args, **kwargs)

    def finish(self, *args, **kwargs):
        return self._finish(*args, **kwargs)

    def play_one_episode(self, func, ret_states=False, ret_actions=False, restart_kwargs=None, finish_kwargs=None):
        states = []
        actions = []

        self.restart(**(restart_kwargs or {}))
        while True:
            state = self.current_state
            action = func(state)
            r, is_over = self.action(action)
            if ret_actions:
                actions.append(action)
            if ret_states:
                states.append(state)
            if is_over:
                self.finish(**(finish_kwargs or {}))
                break

        if ret_states:
            states.append(self.current_state)

        returns = []
        if ret_states:
            returns.append(states)
        if ret_actions:
            returns.append(actions)
        return returns[0] if len(returns) == 1 else tuple(returns)

    def _get_action_space(self):
        return None

    def _get_current_state(self):
        return None

    def _action(self, action):
        raise NotImplementedError()

    def _restart(self, *args, **kwargs):
        raise NotImplementedError()

    def _finish(self, *args, **kwargs):
        pass

    @property
    def unwrapped(self):
        return self

    def evaluate_one_episode(self, func):
        self.play_one_episode(func)
        score = self.stats['score'][-1]
        self.clear_stats()
        return score

class SimpleRLEnvironBase(RLEnvironBase):
    _current_state = None

    def __init__(self):
        super().__init__()
        self._reward_history = []

    def _get_current_state(self):
        return self._current_state

    def _set_current_state(self, state):
        self._current_state = state

    def action(self, action):
        r, is_over = self._action(action)
        self._reward_history.append(r)
        return r, is_over

    def restart(self, *args, **kwargs):
        rc = self._restart(*args, **kwargs)
        self._reward_history = []
        return rc

    def finish(self, *args, **kwargs):
        rc = self._finish(*args, **kwargs)
        self.append_stat('score', sum(self._reward_history))
        self.append_stat('length', len(self._reward_history))
        return rc

class ProxyRLEnvironBase(RLEnvironBase):
    def __init__(self, other):
        super().__init__()
        self.__proxy = other

    @property
    def proxy(self):
        return self.__proxy

    @property
    def stats(self):
        return self.__proxy.stats

    def append_stat(self, name, value):
        self.__proxy.append_stat(name)
        return self

    def clear_stats(self):
        self.__proxy.clear_stats()
        return self

    # MJY(20170623): REMOVED. Originally, directly override the action_space to disable cache.
    # @property
    # def action_space(self):
    #     return self.__proxy.action_space

    def _get_action_space(self):
        return self.__proxy.action_space

    def _get_current_state(self):
        return self.__proxy.current_state

    def _action(self, action):
        return self.__proxy.action(action)

    def _restart(self, *args, **kwargs):
        return self.__proxy.restart(*args, **kwargs)

    def _finish(self, *args, **kwargs):
        return self.__proxy.finish(*args, **kwargs)

    @property
    def unwrapped(self):
        return self.proxy.unwrapped

class ActionSpaceBase(object):
    def __init__(self, action_meanings=None):
        self.__rng = random.gen_rng()
        self._action_meanings = action_meanings

    @property
    def rng(self):
        return self.__rng

    @property
    def action_meanings(self):
        return self._action_meanings

    def sample(self, theta=None):
        return self._sample(theta)

    def _sample(self, theta=None):
        return None

class DiscreteActionSpace(ActionSpaceBase):
    def __init__(self, nr_actions, action_meanings=None):
        super().__init__(action_meanings=action_meanings)
        self._nr_actions = nr_actions

    @property
    def nr_actions(self):
        return self._nr_actions

    def _sample(self, theta=None):
        if theta is None:
            return self.rng.choice(self._nr_actions)
        return self.rng.choice(self._nr_actions, p=theta)

class ContinuousActionSpace(ActionSpaceBase):
    @staticmethod
    def __canonize_bound(v, shape):
        if type(v) is np.ndarray:
            assert v.shape == shape, 'Invalid shape for bound value: expect {}, got {}.'.format(
                    shape, v.shape)
            return v

        assert type(v) in (int, float), 'Invalid type for bound value.'
        return np.ones(shape=shape, dtype='float32') * v

    def __init__(self, low, high=None, shape=None, action_meanings=None):
        super().__init__(action_meanings=action_meanings)

        if high is None:
            low, high = -low, low

        if shape is None:
            assert low is not None and high is not None, 'Must provide low and high.'
            low, high = np.array(low), np.array(high)
            assert low.shape == high.shape, 'Low and high must have same shape, got: {} and {}.'.format(
                    low.shape, high.shape)

            self._low = low
            self._high = high
            self._shape = low.shape
        else:
            self._low = self.__canonize_bound(low, shape)
            self._high = self.__canonize_bound(high, shape)
            self._shape = shape

    @property
    def low(self):
        return self._low

    @property
    def high(self):
        return self._high

    @property
    def shape(self):
        return self._shape

    def _sample(self, theta=None):
        if theta is not None:
            mu, std = theta
            return self.rng.randn(*self.shape) * std + mu
        return self.rng.uniform(self._low, self._high)


text:
use strict;
use CGI;

my $cgi = new CGI;

# Passing semicolons through the url to this script is problematic. The raw
# form truncates the input and the %-encoded form isn't being decoded. Hence
# this set of hard-coded headers.
if ($cgi->param('disable-protection')) {
    print "X-XSS-Protection: 0\n";
}
if ($cgi->param('enable-full-block')) {
    print "X-XSS-Protection: 1; mode=block\n";
}
if ($cgi->param('enable-report')) {
    print "X-XSS-Protection: 1; report=/security/contentSecurityPolicy/resources/save-report.php?test=" . $cgi->param('test') . "\n";
}
if ($cgi->param('enable-full-block-report')) {
    print "X-XSS-Protection: 1; mode=block; report=/security/contentSecurityPolicy/resources/save-report.php?test=" . $cgi->param('test') . "\n";
}

if ($cgi->param('valid-header')) {
    if ($cgi->param('valid-header') == 1) {
        print "X-XSS-Protection:   1  ;MoDe =  bLocK   \n";
    }
    if ($cgi->param('valid-header') == 2) {
        print "X-XSS-Protection: 1; \n";
    }
    if ($cgi->param('valid-header') == 3) {
        print "X-XSS-Protection: 1; mode=block; \n";
    }
    if ($cgi->param('valid-header') == 4) {
        print "X-XSS-Protection: 1; report=/security/contentSecurityPolicy/resources/nonesuch.php; mode=block; \n";
    }
}

if ($cgi->param('malformed-header')) {
    if ($cgi->param('malformed-header') == 1) {
        print "X-XSS-Protection: 12345678901234567\n";
    }
    if ($cgi->param('malformed-header') == 2) {
        print "X-XSS-Protection: red\n";
    }
    if ($cgi->param('malformed-header') == 3) {
        print "X-XSS-Protection: 1; mode=purple\n";
    }
    if ($cgi->param('malformed-header') == 4) {
        print "X-XSS-Protection: 1; mode=block-a-block-block\n";
    }
    if ($cgi->param('malformed-header') == 5) {
        print "X-XSS-Protection: 1; mode=block; report\n";
    }
    if ($cgi->param('malformed-header') == 6) {
        print "X-XSS-Protection: 1; report= ;\n";
    }
    if ($cgi->param('malformed-header') == 7) {
        print "X-XSS-Protection: 1; red\n";
    }
    if ($cgi->param('malformed-header') == 8) {
        print "X-XSS-Protection: 1; mode=block; report=/fail; mode=block;\n";
    }
    if ($cgi->param('malformed-header') == 9) {
        print "X-XSS-Protection: 1; mode=block; report=/fail; report=/fail;\n";
    }
}

if ($cgi->param('csp') eq '_empty_') {
    print "Content-Security-Policy: reflected-xss\n";
} elsif ($cgi->param('csp')) {
    print "Content-Security-Policy: reflected-xss " . $cgi->param('csp') . "\n";
}

print "Content-Type: text/html; charset=";
print $cgi->param('charset') ? $cgi->param('charset') : "UTF-8";
print "\n\n";

print "<!DOCTYPE html>\n";
print "\n";
if ($cgi->param('wait-for-load')) {
    print "\n";
}
if ($cgi->param('inHead')) {
    print "\n";
} else {
    print "\n";
}
if ($cgi->param('replaceState')) {
    print "\n";
}
my $reflection = $cgi->param('q');
my $pattern = "\xfe";
my $replacement = "?";
$reflection =~ s/$pattern/$replacement/g;  # pretend server translates high character 0xfe into literal "?".
print $reflection; # XSS reflected here.
if ($cgi->param('script-expression-follows')) {
    print "\n \n";
}
if ($cgi->param('clutter')) {
    print $cgi->param('clutter');
}
if ($cgi->param('q2')) {
    print $cgi->param('q2');
}
if ($cgi->param('showAction')) {
    print "\n";
}
if ($cgi->param('showFormaction')) {
    print "\n";
}
if ($cgi->param('dumpElementBySelector')) {
    print "

\n";
    print "\n";
}
if ($cgi->param('notifyDone')) {
    print "\n";
}
if ($cgi->param('enable-full-block') || $cgi->param('enable-full-block-report')) {
    print "
If you see this message then the test FAILED.
\n";
}
if ($cgi->param('alert-cookie')) {
    print "\n";
}
if ($cgi->param('echo-report')) {
    print "\n";
}
print "Page rendered here.\n";
if ($cgi->param('inHead')) {
    print "\n";
} else {
    print "\n";
}
print "\n";


text:
package main

import (
	"os"
	"strings"
	"log"
	"path/filepath"
	"flag"
	"io/ioutil"
	"path"
	"unicode"
	"github.com/foolin/gocsv"
	"encoding/json"
)

var csvpath = flag.String("csv", "", "exmaple: xxx/data/demo.csv or dir: xxx/data")
var outpath = flag.String("out", "", "exmaple: xxx/data/demo.json or dir: xxx/out")

func main() {
	//abs, err := filepath.Abs("./../")
	//log.Printf(filepath.Base(abs))
	flag.Parse()
	if *csvpath == "" {
		flag.Usage()
		return
	}
	fileInfo, err := os.Stat(*csvpath)
	if err != nil {
		log.Panic(err)
		return
	}
	isOutOneFile := false
	if *outpath != "" && (strings.ToLower(filepath.Ext(*outpath)) == ".json" || strings.ToLower(filepath.Ext(*outpath)) == ".cson") {
		isOutOneFile = true
	}
	if *outpath == "" {
		*outpath = *csvpath
	}

	mapAllList := make(map[string][][]string, 0)
	if fileInfo.IsDir() {
		infos, err := ioutil.ReadDir(*csvpath)
		if err != nil {
			log.Panic(err)
			return
		}
		if *outpath == "" {
			*outpath = *csvpath
		}
		for _, info := range infos {
			ext := filepath.Ext(info.Name())
			if ext != ".csv" {
				continue
			}

			name := filename(info.Name());
			list, err := gocsv.ReadLines(path.Join(*csvpath, info.Name()), true)
			if err != nil {
				log.Fatalf("read csv: %v, error: %v", info.Name(), err)
				return
			}
			if isOutOneFile {
				mapAllList[name] = list
			} else {
				jsonfile := strings.Replace(info.Name(), ".csv", ".json", -1)
				outFile := path.Join(*outpath, jsonfile)
				err = writeJsonFile(outFile, list)
				if err != nil {
					log.Fatalf("write file: %v error: %v", outFile, err)
					return
				}
				log.Printf("write file: %v", outFile)
			}

		}

	} else {
		name := upper(filename(fileInfo.Name()));
		list, err := gocsv.ReadLines(path.Join(*csvpath, fileInfo.Name()), true)
		if err != nil {
			log.Fatalf("read csv error: %v", err)
			return
		}
		if isOutOneFile {
			mapAllList[name] = list
		} else {
			jsonfile := strings.Replace(fileInfo.Name(), ".csv", ".json", -1)
			outFile := path.Join(*outpath, jsonfile)
			err = writeJsonFile(outFile, list)
			if err != nil {
				log.Fatalf("write file: %v error: %v", outFile, err)
				return
			}
			log.Printf("write file: %v", outFile)
		}
	}

	if isOutOneFile {
		outFile := *outpath
		err = writeJsonFile(outFile, mapAllList)
		if err != nil {
			log.Fatalf("write file: %v error: %v", outFile, err)
			return
		}
		log.Printf("write file: %v", outFile)
	}

	log.Print("generator done!")
}

func writeJsonFile(outFile string, data interface{}) error {
	//mkdir
	outAbs, _ := filepath.Abs(outFile)
	outDir := filepath.Dir(outAbs)
	err := os.MkdirAll(outDir, 0755)
	if err != nil {
		return err
	}
	jsonContent, err := json.Marshal(data)
	if err != nil {
		return err
	}
	//write file
	err = ioutil.WriteFile(outFile, jsonContent, 0755)
	if err != nil {
		return err
	}
	return nil
}

func upper(str string) string {
	if str == "" {
		return str
	}
	ret := make([]rune, 0)
	isNeedUpper := true        //首字母大写
	for _, c := range str {
		//log.Printf("%#v\n", c)
		if c == '_' {
			isNeedUpper = true        //下划线大写
			continue
		}
		if isNeedUpper {
			ret = append(ret, unicode.ToUpper(c))
		} else {
			ret = append(ret, c)
		}
		isNeedUpper = false
	}
	return string(ret)
}

func filename(filename string) string {
	name := filepath.Base(filename)
	return strings.TrimSuffix(name, filepath.Ext(filename))
}


text:
//
//  TableViewController.m
//  PullToRefresh
//
//  Created by Kuan-Wei Lin on 9/18/16.
//  Copyright © 2016 Kuan-Wei Lin. All rights reserved.
//

#import "TableViewController.h"

@interface TableViewController ()

@property (strong, nonatomic) NSArray *dataArray;
@property (strong, nonatomic) NSArray *refreshArray;

@end

@implementation TableViewController

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.dataArray = @[@"🤗🤗🤗🤗🤗", @"😅😅😅😅😅", @"😆😆😆😆😆"];
    self.refreshArray = @[@"🏃🏃🏃🏃🏃", @"💩💩💩💩💩", @"👸👸👸👸👸", @"🤗🤗🤗🤗🤗", @"😅😅😅😅😅", @"😆😆😆😆😆"];

    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl addTarget:self action:@selector(refreshTable) forControlEvents:UIControlEventValueChanged];
    self.refreshControl = refreshControl;
    self.refreshControl.backgroundColor = [UIColor colorWithRed:0.113 green:0.113 blue:0.145 alpha:1];

    NSDate *date = [[NSDate alloc] init];
    NSString *str = [NSString stringWithFormat:@"Last updated on: %@", date];
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
    NSDictionary *attributedDict = @{NSForegroundColorAttributeName: [UIColor whiteColor]};
    NSRange fullRange = NSMakeRange(0, [attributedString length]);
    [attributedString setAttributes:attributedDict range:fullRange];

    self.refreshControl.attributedTitle = attributedString;
    self.refreshControl.tintColor = [UIColor whiteColor];
    self.title = @"emoji";

}

- (void)refreshTable
{
    self.dataArray = self.refreshArray;
    [self.tableView reloadData];
    [self.refreshControl endRefreshing];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];

    // Configure the cell...
    cell.textLabel.text = self.dataArray[indexPath.row];
    cell.textLabel.textAlignment = NSTextAlignmentCenter;
    cell.textLabel.font = [UIFont systemFontOfSize:50];
    cell.backgroundColor = [UIColor clearColor];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 100;
}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
apt-get -y update && apt-get install -y \
    git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools \
    libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev \
    libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev \
    autoconf automake libtool curl wget unzip rpl systemtap-sdt-dev \
    tzdata rsync python3 libpython3-dev


text:
'use strict'

import React from 'react';
import store from '../store';

const ClickCount = React.createClass({
  propTypes: {
    numClicks: React.PropTypes.number.isRequired
  },

  render: function() {
    return (

The other page has been clicked {this.props.numClicks} times.

    );
  }
});

export default ClickCount;


text:
package thosakwe.fray.lang;

public class FrayFunctionParameter {
    private final String name;
    private FrayType expectedType = FrayType.OBJECT;

    public FrayFunctionParameter(String name) {
        this.name = name;
    }

    public FrayType getExpectedType() {
        return expectedType;
    }

    public void setExpectedType(FrayType expectedType) {
        this.expectedType = expectedType;
    }

    public String getName() {
        return name;
    }

    boolean check(FrayDatum arg) {
        FrayType inputType = arg.getType();
        return inputType.isAssignableTo(expectedType);
    }
}


text:
title: "Start-up ton univers HappyToyable"
date:  2018-02-18 17:43
layout: post
category: ["Magazine"]
tags: ["Chief Happyness Officer", "MinuteBuzz"]
#embed_youtube:
illustration: /images/society-happytoyable.jpg
---

Society consacre dans son numéro n°73 daté de janvier/février 2018 un dossier aux modes de managements dans les start-ups et notamment à la mode des Chief Happyness Officers. Le dossier se penche également sur Maxime Barbier, le patron de Minute Buzz, un portrait au vitriol qui permet de relativiser la sincérité du PDG pour les entreprises libérées.


text:
#pragma once
#ifndef __ENGINE_UTILCLASSES_H__
#define __ENGINE_UTILCLASSES_H__

/// @addtogroup docCommon
/// @{

/// @addtogroup docCommon_Utility
/// @{

/// @addtogroup docCommon_Utility_Classes
/// @{

/**
 * Derive from this class to prohibit copy construction and copy assignment.
 */
template< typename tT >
class NonCopyable
{
protected:

    NonCopyable() noexcept
    {
    }

    ~NonCopyable()
    {
    }

private:

    NonCopyable &operator=(const NonCopyable &);
    NonCopyable(const NonCopyable &);
};

/**
 * Derive from this class to prohibit copy assignment.
 */

template< typename tT >
class NonAssignable
{
private:

    NonAssignable &operator=(const NonAssignable &);
};

/// @}

/// @}

/// @}

#endif


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
@HelpSetRegistration(helpSet = "core-hs.xml", position = 3998)
package mars.core.docs;

import org.netbeans.api.javahelp.HelpSetRegistration;


text:
// -*- C++ -*-
// $Id: trading_serv_export.h 14 2007-02-01 15:49:12Z mitza $
// Definition for Win32 Export directives.
// This file is generated automatically by generate_export_file.pl
// ------------------------------
#ifndef TAO_TRADING_SERV_EXPORT_H
#define TAO_TRADING_SERV_EXPORT_H

#include "ace/config-all.h"

#if defined (TAO_AS_STATIC_LIBS)
#  if !defined (TAO_TRADING_SERV_HAS_DLL)
#    define TAO_TRADING_SERV_HAS_DLL 0
#  endif /* ! TAO_TRADING_SERV_HAS_DLL */
#else
#  if !defined (TAO_TRADING_SERV_HAS_DLL)
#    define TAO_TRADING_SERV_HAS_DLL 1
#  endif /* ! TAO_TRADING_SERV_HAS_DLL */
#endif

#if defined (TAO_TRADING_SERV_HAS_DLL) && (TAO_TRADING_SERV_HAS_DLL == 1)
#  if defined (TAO_TRADING_SERV_BUILD_DLL)
#    define TAO_Trading_Serv_Export ACE_Proper_Export_Flag
#    define TAO_TRADING_SERV_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
#    define TAO_TRADING_SERV_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#  else /* TAO_TRADING_SERV_BUILD_DLL */
#    define TAO_Trading_Serv_Export ACE_Proper_Import_Flag
#    define TAO_TRADING_SERV_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
#    define TAO_TRADING_SERV_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#  endif /* TAO_TRADING_SERV_BUILD_DLL */
#else /* TAO_TRADING_SERV_HAS_DLL == 1 */
#  define TAO_Trading_Serv_Export
#  define TAO_TRADING_SERV_SINGLETON_DECLARATION(T)
#  define TAO_TRADING_SERV_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* TAO_TRADING_SERV_HAS_DLL == 1 */

#endif /* TAO_TRADING_SERV_EXPORT_H */

// End of auto generated file.


text:
<?php

declare(strict_types=1);

namespace App\Controller\Frontend\PublicPages;

use App\Entity;
use App\Exception\StationNotFoundException;
use App\Http\Response;
use App\Http\ServerRequest;
use Psr\Http\Message\ResponseInterface;

class HistoryAction
{
    public function __invoke(
        ServerRequest $request,
        Response $response,
        Entity\ApiGenerator\NowPlayingApiGenerator $npApiGenerator
    ): ResponseInterface {
        // Override system-wide iframe refusal
        $response = $response->withHeader('X-Frame-Options', '*');

        $station = $request->getStation();

        if (!$station->getEnablePublicPage()) {
            throw new StationNotFoundException();
        }

        $np = $npApiGenerator->currentOrEmpty($station);
        $np->resolveUrls($request->getRouter()->getBaseUrl());

        $customization = $request->getCustomization();
        $router = $request->getRouter();

        $useNChan = $customization->useWebSocketsForNowPlaying();

        return $request->getView()->renderVuePage(
            response: $response,
            component: 'Vue_PublicHistory',
            id: 'song-history',
            layout: 'minimal',
            title: __('History') . ' - ' . $station->getName(),
            layoutParams: [
                'page_class' => 'embed station-' . $station->getShortName(),
                'hide_footer' => true,
            ],
            props: [
                'initialNowPlaying' => $np,
                'showAlbumArt' => !$customization->hideAlbumArt(),
                'useNchan' => $useNChan,
                'nowPlayingUri' => $useNChan
                    ? '/api/live/nowplaying/' . urlencode($station->getShortName())
                    : (string)$router->named('api:nowplaying:index', ['station_id' => $station->getId()]),
            ],
        );
    }
}


text:
package org.apereo.cas.config;

import org.apereo.cas.authentication.AuthenticationEventExecutionPlanConfigurer;
import org.apereo.cas.authentication.AuthenticationHandler;
import org.apereo.cas.authentication.CoreAuthenticationUtils;
import org.apereo.cas.authentication.principal.PrincipalFactory;
import org.apereo.cas.authentication.principal.PrincipalFactoryUtils;
import org.apereo.cas.authentication.principal.PrincipalNameTransformerUtils;
import org.apereo.cas.authentication.principal.PrincipalResolver;
import org.apereo.cas.authentication.support.password.PasswordEncoderUtils;
import org.apereo.cas.authentication.support.password.PasswordPolicyConfiguration;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.services.ServicesManager;
import org.apereo.cas.syncope.authentication.SyncopeAuthenticationHandler;

import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * This is {@link SyncopeAuthenticationConfiguration}.
 *
 * @author Misagh Moayyed
 * @since 5.3.0
 */
@Configuration("syncopeAuthenticationConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class SyncopeAuthenticationConfiguration {
    @Autowired
    private CasConfigurationProperties casProperties;

    @Autowired
    @Qualifier("servicesManager")
    private ObjectProvider<ServicesManager> servicesManager;

    @Autowired
    @Qualifier("defaultPrincipalResolver")
    private ObjectProvider<PrincipalResolver> defaultPrincipalResolver;

    @ConditionalOnMissingBean(name = "syncopePrincipalFactory")
    @Bean
    public PrincipalFactory syncopePrincipalFactory() {
        return PrincipalFactoryUtils.newPrincipalFactory();
    }

    @ConditionalOnMissingBean(name = "syncopeAuthenticationHandler")
    @Bean
    public AuthenticationHandler syncopeAuthenticationHandler() {
        val syncope = casProperties.getAuthn().getSyncope();
        if (StringUtils.isBlank(syncope.getUrl())) {
            throw new BeanCreationException("Syncope URL must be defined");
        }
        val h = new SyncopeAuthenticationHandler(syncope.getName(), servicesManager.getIfAvailable(),
            syncopePrincipalFactory(), syncope.getUrl(), syncope.getDomain());

        h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(syncope.getPasswordEncoder()));
        h.setPasswordPolicyConfiguration(syncopePasswordPolicyConfiguration());
        h.setCredentialSelectionPredicate(CoreAuthenticationUtils.newCredentialSelectionPredicate(syncope.getCredentialCriteria()));
        h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(syncope.getPrincipalTransformation()));

        return h;
    }

    @ConditionalOnMissingBean(name = "syncopeAuthenticationEventExecutionPlanConfigurer")
    @Bean
    public AuthenticationEventExecutionPlanConfigurer syncopeAuthenticationEventExecutionPlanConfigurer() {
        return plan -> plan.registerAuthenticationHandlerWithPrincipalResolver(syncopeAuthenticationHandler(), defaultPrincipalResolver.getIfAvailable());
    }

    @ConditionalOnMissingBean(name = "syncopePasswordPolicyConfiguration")
    @Bean
    public PasswordPolicyConfiguration syncopePasswordPolicyConfiguration() {
        return new PasswordPolicyConfiguration();
    }
}


text:
IRsend::IRsend(uint16_t IRsendPin, bool inverted, bool use_modulation)
    : IRpin(IRsendPin), periodOffset(kPeriodOffset) {
  if (inverted) {
    outputOn = LOW;
    outputOff = HIGH;
  } else {
    outputOn = HIGH;
    outputOff = LOW;
  }
  modulation = use_modulation;
  if (modulation)
    _dutycycle = kDutyDefault;
  else
    _dutycycle = kDutyMax;
}

// Enable the pin for output.
void IRsend::begin() {
#ifndef UNIT_TEST
  pinMode(IRpin, OUTPUT);
#endif
  ledOff();  // Ensure the LED is in a known safe state when we start.
}

// Turn off the IR LED.
void IRsend::ledOff() {
#ifndef UNIT_TEST
  digitalWrite(IRpin, outputOff);
#endif
}

// Turn on the IR LED.
void IRsend::ledOn() {
#ifndef UNIT_TEST
  digitalWrite(IRpin, outputOn);
#endif
}

// Calculate the period for a given frequency. (T = 1/f)
//
// Args:
//   freq: Frequency in Hz.
//   use_offset: Should we use the calculated offset or not?
// Returns:
//   nr. of uSeconds.
uint32_t IRsend::calcUSecPeriod(uint32_t hz, bool use_offset) {
  if (hz == 0) hz = 1;  // Avoid Zero hz. Divide by Zero is nasty.
  uint32_t period =
      (1000000UL + hz / 2) / hz;  // The equiv of round(1000000/hz).
  // Apply the offset and ensure we don't result in a <= 0 value.
  if (use_offset)
    return std::max((uint32_t)1, period + periodOffset);
  else
    return std::max((uint32_t)1, period);
}

// Set the output frequency modulation and duty cycle.
//
// Args:
//   freq: The freq we want to modulate at. Assumes < 1000 means kHz else Hz.
//   duty: Percentage duty cycle of the LED. e.g. 25 = 25% = 1/4 on, 3/4 off.
//         This is ignored if modulation is disabled at object instantiation.
//
// Note:
//   Integer timing functions & math mean we can't do fractions of
//   microseconds timing. Thus minor changes to the freq & duty values may have
//   limited effect. You've been warned.
void IRsend::enableIROut(uint32_t freq, uint8_t duty) {
  // Set the duty cycle to use if we want freq. modulation.
  if (modulation) {
    _dutycycle = std::min(duty, kDutyMax);
  } else {
    _dutycycle = kDutyMax;
  }
  if (freq < 1000)  // Were we given kHz? Supports the old call usage.
    freq *= 1000;
#ifdef UNIT_TEST
  _freq_unittest = freq;
#endif  // UNIT_TEST
  uint32_t period = calcUSecPeriod(freq);
  // Nr. of uSeconds the LED will be on per pulse.
  onTimePeriod = (period * _dutycycle) / kDutyMax;
  // Nr. of uSeconds the LED will be off per pulse.
  offTimePeriod = period - onTimePeriod;
}

#if ALLOW_DELAY_CALLS
// An ESP8266 RTOS watch-dog timer friendly version of delayMicroseconds().
// Args:
//   usec: Nr. of uSeconds to delay for.
void IRsend::_delayMicroseconds(uint32_t usec) {
  // delayMicroseconds() is only accurate to 16383us.
  // Ref: https://www.arduino.cc/en/Reference/delayMicroseconds
  if (usec <= kMaxAccurateUsecDelay) {
#ifndef UNIT_TEST
    delayMicroseconds(usec);
#endif
  } else {
#ifndef UNIT_TEST
    // Invoke a delay(), where possible, to avoid triggering the WDT.
    delay(usec / 1000UL);  // Delay for as many whole milliseconds as we can.
    // Delay the remaining sub-millisecond.
    delayMicroseconds(static_cast<uint16_t>(usec % 1000UL));
#endif
  }
}
#else  // ALLOW_DELAY_CALLS
// A version of delayMicroseconds() that handles large values and does NOT use
// the watch-dog friendly delay() calls where appropriate.
// Args:
//   usec: Nr. of uSeconds to delay for.
//
// NOTE: Use this only if you know what you are doing as it may cause the WDT
//       to reset the ESP8266.
void IRsend::_delayMicroseconds(uint32_t usec) {
  for (; usec > kMaxAccurateUsecDelay; usec -= kMaxAccurateUsecDelay)
#ifndef UNIT_TEST
    delayMicroseconds(kMaxAccurateUsecDelay);
  delayMicroseconds(static_cast<uint16_t>(usec));
#endif  // UNIT_TEST
}
#endif  // ALLOW_DELAY_CALLS

// Modulate the IR LED for the given period (usec) and at the duty cycle set.
//
// Args:
//   usec: The period of time to modulate the IR LED for, in microseconds.
// Returns:
//   Nr. of pulses actually sent.
//
// Note:
//   The ESP8266 has no good way to do hardware PWM, so we have to do it all
//   in software. There is a horrible kludge/brilliant hack to use the second
//   serial TX line to do fairly accurate hardware PWM, but it is only
//   available on a single specific GPIO and only available on some modules.
//   e.g. It's not available on the ESP-01 module.
//   Hence, for greater compatibility & choice, we don't use that method.
// Ref:
//   https://www.analysir.com/blog/2017/01/29/updated-esp8266-nodemcu-backdoor-upwm-hack-for-ir-signals/
uint16_t IRsend::mark(uint16_t usec) {
  // Handle the simple case of no required frequency modulation.
  if (!modulation || _dutycycle >= 100) {
    ledOn();
    _delayMicroseconds(usec);
    ledOff();
    return 1;
  }

  // Not simple, so do it assuming frequency modulation.
  uint16_t counter = 0;
  IRtimer usecTimer = IRtimer();
  // Cache the time taken so far. This saves us calling time, and we can be
  // assured that we can't have odd math problems. i.e. unsigned under/overflow.
  uint32_t elapsed = usecTimer.elapsed();

  while (elapsed < usec) {  // Loop until we've met/exceeded our required time.
    ledOn();
    // Calculate how long we should pulse on for.
    // e.g. Are we to close to the end of our requested mark time (usec)?
    _delayMicroseconds(std::min((uint32_t)onTimePeriod, usec - elapsed));
    ledOff();
    counter++;
    if (elapsed + onTimePeriod >= usec)
      return counter;  // LED is now off & we've passed our allotted time.
    // Wait for the lesser of the rest of the duty cycle, or the time remaining.
    _delayMicroseconds(
        std::min(usec - elapsed - onTimePeriod, (uint32_t)offTimePeriod));
    elapsed = usecTimer.elapsed();  // Update & recache the actual elapsed time.
  }
  return counter;
}

// Turn the pin (LED) off for a given time.
// Sends an IR space for the specified number of microseconds.
// A space is no output, so the PWM output is disabled.
//
// Args:
//   time: Time in microseconds (us).
void IRsend::space(uint32_t time) {
  ledOff();
  if (time == 0) return;
  _delayMicroseconds(time);
}

// Calculate & set any offsets to account for execution times.
//
// Args:
//   hz: The frequency to calibrate at >= 1000Hz. Default is 38000Hz.
//
// Returns:
//   The calculated period offset (in uSeconds) which is now in use. e.g. -5.
//
// Status:  Stable / Working.
//
// NOTE:
//   This will generate an 65535us mark() IR LED signal.
//   This only needs to be called once, if at all.
int8_t IRsend::calibrate(uint16_t hz) {
  if (hz < 1000)  // Were we given kHz? Supports the old call usage.
    hz *= 1000;
  periodOffset = 0;  // Turn off any existing offset while we calibrate.
  enableIROut(hz);
  IRtimer usecTimer = IRtimer();  // Start a timer *just* before we do the call.
  uint16_t pulses = mark(UINT16_MAX);  // Generate a PWM of 65,535 us. (Max.)
  uint32_t timeTaken = usecTimer.elapsed();  // Record the time it took.
  // While it shouldn't be necessary, assume at least 1 pulse, to avoid a
  // divide by 0 situation.
  pulses = std::max(pulses, (uint16_t)1U);
  uint32_t calcPeriod = calcUSecPeriod(hz);  // e.g. @38kHz it should be 26us.
  // Assuming 38kHz for the example calculations:
  // In a 65535us pulse, we should have 2520.5769 pulses @ 26us periods.
  // e.g. 65535.0us / 26us = 2520.5769
  // This should have caused approx 2520 loops through the main loop in mark().
  // The average over that many interations should give us a reasonable
  // approximation at what offset we need to use to account for instruction
  // execution times.
  //
  // Calculate the actual period from the actual time & the actual pulses
  // generated.
  double_t actualPeriod = (double_t)timeTaken / (double_t)pulses;
  // Store the difference between the actual time per period vs. calculated.
  periodOffset = (int8_t)((double_t)calcPeriod - actualPeriod);
  return periodOffset;
}

// Generic method for sending data that is common to most protocols.
// Will send leading or trailing 0's if the nbits is larger than the number
// of bits in data.
//
// Args:
//   onemark:    Nr. of usecs for the led to be pulsed for a '1' bit.
//   onespace:   Nr. of usecs for the led to be fully off for a '1' bit.
//   zeromark:   Nr. of usecs for the led to be pulsed for a '0' bit.
//   zerospace:  Nr. of usecs for the led to be fully off for a '0' bit.
//   data:       The data to be transmitted.
//   nbits:      Nr. of bits of data to be sent.
//   MSBfirst:   Flag for bit transmission order. Defaults to MSB->LSB order.
void IRsend::sendData(uint16_t onemark, uint32_t onespace, uint16_t zeromark,
                      uint32_t zerospace, uint64_t data, uint16_t nbits,
                      bool MSBfirst) {
  if (nbits == 0)  // If we are asked to send nothing, just return.
    return;
  if (MSBfirst) {  // Send the MSB first.
    // Send 0's until we get down to a bit size we can actually manage.
    while (nbits > sizeof(data) * 8) {
      mark(zeromark);
      space(zerospace);
      nbits--;
    }
    // Send the supplied data.
    for (uint64_t mask = 1ULL << (nbits - 1); mask; mask >>= 1)
      if (data & mask) {  // Send a 1
        mark(onemark);
        space(onespace);
      } else {  // Send a 0
        mark(zeromark);
        space(zerospace);
      }
  } else {  // Send the Least Significant Bit (LSB) first / MSB last.
    for (uint16_t bit = 0; bit < nbits; bit++, data >>= 1)
      if (data & 1) {  // Send a 1
        mark(onemark);
        space(onespace);
      } else {  // Send a 0
        mark(zeromark);
        space(zerospace);
      }
  }
}

// Generic method for sending simple protocol messages.
// Will send leading or trailing 0's if the nbits is larger than the number
// of bits in data.
//
// Args:
//   headermark:  Nr. of usecs for the led to be pulsed for the header mark.
//                A value of 0 means no header mark.
//   headerspace: Nr. of usecs for the led to be off after the header mark.
//                A value of 0 means no header space.
//   onemark:     Nr. of usecs for the led to be pulsed for a '1' bit.
//   onespace:    Nr. of usecs for the led to be fully off for a '1' bit.
//   zeromark:    Nr. of usecs for the led to be pulsed for a '0' bit.
//   zerospace:   Nr. of usecs for the led to be fully off for a '0' bit.
//   footermark:  Nr. of usecs for the led to be pulsed for the footer mark.
//                A value of 0 means no footer mark.
//   gap:         Nr. of usecs for the led to be off after the footer mark.
//                This is effectively the gap between messages.
//                A value of 0 means no gap space.
//   data:        The data to be transmitted.
//   nbits:       Nr. of bits of data to be sent.
//   frequency:   The frequency we want to modulate at.
//                Assumes < 1000 means kHz otherwise it is in Hz.
//                Most common value is 38000 or 38, for 38kHz.
//   MSBfirst:    Flag for bit transmission order. Defaults to MSB->LSB order.
//   repeat:      Nr. of extra times the message will be sent.
//                e.g. 0 = 1 message sent, 1 = 1 initial + 1 repeat = 2 messages
//   dutycycle:   Percentage duty cycle of the LED.
//                e.g. 25 = 25% = 1/4 on, 3/4 off.
//                If you are not sure, try 50 percent.
void IRsend::sendGeneric(const uint16_t headermark, const uint32_t headerspace,
                         const uint16_t onemark, const uint32_t onespace,
                         const uint16_t zeromark, const uint32_t zerospace,
                         const uint16_t footermark, const uint32_t gap,
                         const uint64_t data, const uint16_t nbits,
                         const uint16_t frequency, const bool MSBfirst,
                         const uint16_t repeat, const uint8_t dutycycle) {
  sendGeneric(headermark, headerspace, onemark, onespace, zeromark, zerospace,
              footermark, gap, 0U, data, nbits, frequency, MSBfirst, repeat,
              dutycycle);
}

// Generic method for sending simple protocol messages.
// Will send leading or trailing 0's if the nbits is larger than the number
// of bits in data.
//
// Args:
//   headermark:  Nr. of usecs for the led to be pulsed for the header mark.
//                A value of 0 means no header mark.
//   headerspace: Nr. of usecs for the led to be off after the header mark.
//                A value of 0 means no header space.
//   onemark:     Nr. of usecs for the led to be pulsed for a '1' bit.
//   onespace:    Nr. of usecs for the led to be fully off for a '1' bit.
//   zeromark:    Nr. of usecs for the led to be pulsed for a '0' bit.
//   zerospace:   Nr. of usecs for the led to be fully off for a '0' bit.
//   footermark:  Nr. of usecs for the led to be pulsed for the footer mark.
//                A value of 0 means no footer mark.
//   gap:         Min. nr. of usecs for the led to be off after the footer mark.
//                This is effectively the absolute minimum gap between messages.
//   mesgtime:    Min. nr. of usecs a single message needs to be.
//                This is effectively the min. total length of a single message.
//   data:        The data to be transmitted.
//   nbits:       Nr. of bits of data to be sent.
//   frequency:   The frequency we want to modulate at.
//                Assumes < 1000 means kHz otherwise it is in Hz.
//                Most common value is 38000 or 38, for 38kHz.
//   MSBfirst:    Flag for bit transmission order. Defaults to MSB->LSB order.
//   repeat:      Nr. of extra times the message will be sent.
//                e.g. 0 = 1 message sent, 1 = 1 initial + 1 repeat = 2 messages
//   dutycycle:   Percentage duty cycle of the LED.
//                e.g. 25 = 25% = 1/4 on, 3/4 off.
//                If you are not sure, try 50 percent.
void IRsend::sendGeneric(const uint16_t headermark, const uint32_t headerspace,
                         const uint16_t onemark, const uint32_t onespace,
                         const uint16_t zeromark, const uint32_t zerospace,
                         const uint16_t footermark, const uint32_t gap,
                         const uint32_t mesgtime, const uint64_t data,
                         const uint16_t nbits, const uint16_t frequency,
                         const bool MSBfirst, const uint16_t repeat,
                         const uint8_t dutycycle) {
  // Setup
  enableIROut(frequency, dutycycle);
  IRtimer usecs = IRtimer();

  // We always send a message, even for repeat=0, hence '<= repeat'.
  for (uint16_t r = 0; r <= repeat; r++) {
    usecs.reset();

    // Header
    if (headermark) mark(headermark);
    if (headerspace) space(headerspace);

    // Data
    sendData(onemark, onespace, zeromark, zerospace, data, nbits, MSBfirst);

    // Footer
    if (footermark) mark(footermark);
    uint32_t elapsed = usecs.elapsed();
    // Avoid potential unsigned integer underflow. e.g. when mesgtime is 0.
    if (elapsed >= mesgtime)
      space(gap);
    else
      space(std::max(gap, mesgtime - elapsed));
  }
}

// Generic method for sending simple protocol messages.
//
// Args:
//   headermark:  Nr. of usecs for the led to be pulsed for the header mark.
//                A value of 0 means no header mark.
//   headerspace: Nr. of usecs for the led to be off after the header mark.
//                A value of 0 means no header space.
//   onemark:     Nr. of usecs for the led to be pulsed for a '1' bit.
//   onespace:    Nr. of usecs for the led to be fully off for a '1' bit.
//   zeromark:    Nr. of usecs for the led to be pulsed for a '0' bit.
//   zerospace:   Nr. of usecs for the led to be fully off for a '0' bit.
//   footermark:  Nr. of usecs for the led to be pulsed for the footer mark.
//                A value of 0 means no footer mark.
//   gap:         Nr. of usecs for the led to be off after the footer mark.
//                This is effectively the gap between messages.
//                A value of 0 means no gap space.
//   dataptr:     Pointer to the data to be transmitted.
//   nbytes:      Nr. of bytes of data to be sent.
//   frequency:   The frequency we want to modulate at.
//                Assumes < 1000 means kHz otherwise it is in Hz.
//                Most common value is 38000 or 38, for 38kHz.
//   MSBfirst:    Flag for bit transmission order. Defaults to MSB->LSB order.
//   repeat:      Nr. of extra times the message will be sent.
//                e.g. 0 = 1 message sent, 1 = 1 initial + 1 repeat = 2 messages
//   dutycycle:   Percentage duty cycle of the LED.
//                e.g. 25 = 25% = 1/4 on, 3/4 off.
//                If you are not sure, try 50 percent.
void IRsend::sendGeneric(const uint16_t headermark, const uint32_t headerspace,
                         const uint16_t onemark, const uint32_t onespace,
                         const uint16_t zeromark, const uint32_t zerospace,
                         const uint16_t footermark, const uint32_t gap,
                         const uint8_t *dataptr, const uint16_t nbytes,
                         const uint16_t frequency, const bool MSBfirst,
                         const uint16_t repeat, const uint8_t dutycycle) {
  // Setup
  enableIROut(frequency, dutycycle);
  // We always send a message, even for repeat=0, hence '<= repeat'.
  for (uint16_t r = 0; r <= repeat; r++) {
    // Header
    if (headermark) mark(headermark);
    if (headerspace) space(headerspace);

    // Data
    for (uint16_t i = 0; i < nbytes; i++)
      sendData(onemark, onespace, zeromark, zerospace, *(dataptr + i), 8,
               MSBfirst);

    // Footer
    if (footermark) mark(footermark);
    space(gap);
  }
}

// Generic method for sending Manchester code data.
// Will send leading or trailing 0's if the nbits is larger than the number
// of bits in data.
//
// Args:
//   half_period: Nr. of uSeconds for half the clock's period. (1/2 wavelength)
//   data:        The data to be transmitted.
//   nbits:       Nr. of bits of data to be sent.
//   MSBfirst:    Flag for bit transmission order. Defaults to MSB->LSB order.
//   GEThomas:    Use G.E. Thomas (true/default) or IEEE 802.3 (false).
void IRsend::sendManchesterData(const uint16_t half_period,
                                const uint64_t data,
                                const uint16_t nbits, const bool MSBfirst,
                                const bool GEThomas) {
  if (nbits == 0) return;  // Nothing to send.
  uint16_t bits = nbits;
  uint64_t copy = (GEThomas) ? data : ~data;

  if (MSBfirst) {  // Send the MSB first.
    // Send 0's until we get down to a bit size we can actually manage.
    if (bits > (sizeof(data) * 8)) {
      sendManchesterData(half_period, 0ULL, bits - sizeof(data) * 8, MSBfirst,
                         GEThomas);
      bits = sizeof(data) * 8;
    }
    // Send the supplied data.
    for (uint64_t mask = 1ULL << (bits - 1); mask; mask >>= 1)
      if (copy & mask) {
        mark(half_period);
        space(half_period);
      } else {
        space(half_period);
        mark(half_period);
      }
  } else {  // Send the Least Significant Bit (LSB) first / MSB last.
    for (bits = 0; bits < nbits; bits++, copy >>= 1)
      if (copy & 1) {
        mark(half_period);
        space(half_period);
      } else {
        space(half_period);
        mark(half_period);
      }
  }
}

// Generic method for sending Manchester code messages.
// Will send leading or trailing 0's if the nbits is larger than the number
// of bits in data.
//
// Args:
//   headermark:  Nr. of usecs for the led to be pulsed for the header mark.
//                A value of 0 means no header mark.
//   headerspace: Nr. of usecs for the led to be off after the header mark.
//                A value of 0 means no header space.
//   half_period: Nr. of uSeconds for half the clock's period. (1/2 wavelength)
//   footermark:  Nr. of usecs for the led to be pulsed for the footer mark.
//                A value of 0 means no footer mark.
//   gap:         Min. nr. of usecs for the led to be off after the footer mark.
//                This is effectively the absolute minimum gap between messages.
//   data:        The data to be transmitted.
//   nbits:       Nr. of bits of data to be sent.
//   frequency:   The frequency we want to modulate at.
//                Assumes < 1000 means kHz otherwise it is in Hz.
//                Most common value is 38000 or 38, for 38kHz.
//   MSBfirst:    Flag for bit transmission order. Defaults to MSB->LSB order.
//   repeat:      Nr. of extra times the message will be sent.
//                e.g. 0 = 1 message sent, 1 = 1 initial + 1 repeat = 2 messages
//   dutycycle:   Percentage duty cycle of the LED.
//                e.g. 25 = 25% = 1/4 on, 3/4 off.
//                If you are not sure, try 50 percent.
//   GEThomas:    Use G.E. Thomas (true/default) or IEEE 802.3 (false).
void IRsend::sendManchester(const uint16_t headermark,
                            const uint32_t headerspace,
                            const uint16_t half_period,
                            const uint16_t footermark, const uint32_t gap,
                            const uint64_t data, const uint16_t nbits,
                            const uint16_t frequency, const bool MSBfirst,
                            const uint16_t repeat, const uint8_t dutycycle,
                            const bool GEThomas) {
  // Setup
  enableIROut(frequency, dutycycle);

  // We always send a message, even for repeat=0, hence '<= repeat'.
  for (uint16_t r = 0; r <= repeat; r++) {
    // Header
    if (headermark) mark(headermark);
    if (headerspace) space(headerspace);
    // Data Marker/sync
    // This guarantees a double width half_period. i.e. a Period or T2.
    sendManchesterData(half_period, 0b01, 2, true, GEThomas);
    // Data
    sendManchesterData(half_period, data, nbits, MSBfirst, GEThomas);
    // Footer
    if (footermark) mark(footermark);
    if (gap) space(gap);
  }
}

#if SEND_RAW
// Send a raw IRremote message.
//
// Args:
//   buf: An array of uint16_t's that has microseconds elements.
//   len: Nr. of elements in the buf[] array.
//   hz:  Frequency to send the message at. (kHz < 1000; Hz >= 1000)
//
// Status: STABLE / Known working.
//
// Notes:
//   Even elements are Mark times (On), Odd elements are Space times (Off).
//
// Ref:
//   examples/IRrecvDumpV2/IRrecvDumpV2.ino
void IRsend::sendRaw(const uint16_t buf[], const uint16_t len,
                     const uint16_t hz) {
  // Set IR carrier frequency
  enableIROut(hz);
  for (uint16_t i = 0; i < len; i++) {
    if (i & 1) {  // Odd bit.
      space(buf[i]);
    } else {  // Even bit.
      mark(buf[i]);
    }
  }
  ledOff();  // We potentially have ended with a mark(), so turn of the LED.
}
#endif  // SEND_RAW

// Get the minimum number of repeats for a given protocol.
// Args:
//   protocol:  Protocol number/type of the message you want to send.
// Returns:
//   int16_t:  The number of repeats required.
uint16_t IRsend::minRepeats(const decode_type_t protocol) {
  switch (protocol) {
    // Single repeats
    case AIWA_RC_T501:
    case AMCOR:
    case COOLIX:
    case GICABLE:
    case INAX:
    case MITSUBISHI:
    case MITSUBISHI2:
    case MITSUBISHI_AC:
    case MULTIBRACKETS:
    case SHERWOOD:
    case TOSHIBA_AC:
      return kSingleRepeat;
    // Special
    case AIRWELL:
      return kAirwellMinRepeats;
    case CARRIER_AC40:
      return kCarrierAc40MinRepeat;
    case DISH:
      return kDishMinRepeat;
    case EPSON:
      return kEpsonMinRepeat;
    case SONY:
      return kSonyMinRepeat;
    case SONY_38K:
      return kSonyMinRepeat + 1;
    case SYMPHONY:
      return kSymphonyDefaultRepeat;
    default:
      return kNoRepeat;
  }
}

// Get the default number of bits for a given protocol.
// Args:
//   protocol:  Protocol number/type you want the default nr. of bits for.
// Returns:
//   int16_t:  The number of bits.
uint16_t IRsend::defaultBits(const decode_type_t protocol) {
  switch (protocol) {
    case MULTIBRACKETS:
      return 8;
    case RC5:
    case SYMPHONY:
      return 12;
    case LASERTAG:
    case RC5X:
      return 13;
    case AIWA_RC_T501:
    case DENON:
    case SHARP:
      return 15;
    case DISH:
    case GICABLE:
    case JVC:
    case LEGOPF:
    case MITSUBISHI:
    case MITSUBISHI2:
      return 16;
    case RC6:
    case SONY:
    case SONY_38K:
      return 20;
    case COOLIX:
    case INAX:
    case NIKAI:
    case RCMM:
      return 24;
    case LG:
    case LG2:
      return 28;
    case AIRWELL:
    case CARRIER_AC:
    case EPSON:
    case NEC:
    case NEC_LIKE:
    case SAMSUNG:
    case SHERWOOD:
    case WHYNTER:
      return 32;
    case LUTRON:
    case TECO:
      return 35;
    case SAMSUNG36:
      return 36;
    case CARRIER_AC40:
      return kCarrierAc40Bits;  // 40
    case DOSHISHA:
      return kDoshishaBits;  // 40
    case SANYO_LC7461:
      return kSanyoLC7461Bits;  // 42
    case GOODWEATHER:
    case MIDEA:
    case PANASONIC:
      return 48;
    case MAGIQUEST:
    case VESTEL_AC:
      return 56;
    case AMCOR:
    case CARRIER_AC64:
    case DELONGHI_AC:
    case PIONEER:
      return 64;
    case ARGO:
      return kArgoBits;
    case DAIKIN:
      return kDaikinBits;
    case DAIKIN128:
      return kDaikin128Bits;
    case DAIKIN152:
      return kDaikin152Bits;
    case DAIKIN160:
      return kDaikin160Bits;
    case DAIKIN176:
      return kDaikin176Bits;
    case DAIKIN2:
      return kDaikin2Bits;
    case DAIKIN216:
      return kDaikin216Bits;
    case DAIKIN64:
      return kDaikin64Bits;
    case ELECTRA_AC:
      return kElectraAcBits;
    case GREE:
      return kGreeBits;
    case HAIER_AC:
      return kHaierACBits;
    case HAIER_AC_YRW02:
      return kHaierACYRW02Bits;
    case HITACHI_AC:
      return kHitachiAcBits;
    case HITACHI_AC1:
      return kHitachiAc1Bits;
    case HITACHI_AC2:
      return kHitachiAc2Bits;
    case HITACHI_AC3:
      return kHitachiAc3Bits;
    case HITACHI_AC424:
      return kHitachiAc424Bits;
    case KELVINATOR:
      return kKelvinatorBits;
    case MITSUBISHI_AC:
      return kMitsubishiACBits;
    case MITSUBISHI136:
      return kMitsubishi136Bits;
    case MITSUBISHI112:
      return kMitsubishi112Bits;
    case MITSUBISHI_HEAVY_152:
      return kMitsubishiHeavy152Bits;
    case MITSUBISHI_HEAVY_88:
      return kMitsubishiHeavy88Bits;
    case NEOCLIMA:
      return kNeoclimaBits;
    case PANASONIC_AC:
      return kNeoclimaBits;
    case SAMSUNG_AC:
      return kSamsungAcBits;
    case SHARP_AC:
      return kSharpAcBits;
    case TCL112AC:
      return kTcl112AcBits;
    case TOSHIBA_AC:
      return kToshibaACBits;
    case TROTEC:
      return kTrotecBits;
    case WHIRLPOOL_AC:
      return kWhirlpoolAcBits;
    // No default amount of bits.
    case FUJITSU_AC:
    case MWM:
    default:
      return 0;
  }
}

// Send a simple (up to 64 bits) IR message of a given type.
// An unknown/unsupported type will do nothing.
// Args:
//   type:  Protocol number/type of the message you want to send.
//   data:  The data you want to send (up to 64 bits).
//   nbits: How many bits long the message is to be.
//   repeat: How many repeats to do?
// Returns:
//   bool: True if it is a type we can attempt to send, false if not.
bool IRsend::send(const decode_type_t type, const uint64_t data,
                  const uint16_t nbits, const uint16_t repeat) {
  uint16_t min_repeat = std::max(IRsend::minRepeats(type), repeat);
  switch (type) {
#if SEND_AIRWELL
    case AIRWELL:
      sendAirwell(data, nbits, min_repeat);
      break;
#endif
#if SEND_AIWA_RC_T501
    case AIWA_RC_T501:
      sendAiwaRCT501(data, nbits, min_repeat);
      break;
#endif
#if SEND_CARRIER_AC
    case CARRIER_AC:
      sendCarrierAC(data, nbits, min_repeat);
      break;
#endif
#if SEND_CARRIER_AC40
    case CARRIER_AC40:
      sendCarrierAC40(data, nbits, min_repeat);
      break;
#endif  // SEND_CARRIER_AC40
#if SEND_CARRIER_AC64
    case CARRIER_AC64:
      sendCarrierAC64(data, nbits, min_repeat);
      break;
#endif  // SEND_CARRIER_AC64
#if SEND_COOLIX
    case COOLIX:
      sendCOOLIX(data, nbits, min_repeat);
      break;
#endif
#if SEND_DAIKIN64
    case DAIKIN64:
      sendDaikin64(data, nbits, min_repeat);
      break;
#endif
#if SEND_DELONGHI_AC
    case DELONGHI_AC:
      sendDelonghiAc(data, nbits, min_repeat);
      break;
#endif
#if SEND_DENON
    case DENON:
      sendDenon(data, nbits, min_repeat);
      break;
#endif
#if SEND_DISH
    case DISH:
      sendDISH(data, nbits, min_repeat);
      break;
#endif
#if SEND_DOSHISHA
    case DOSHISHA:
      sendDoshisha(data, nbits, min_repeat);
      break;
#endif
#if SEND_EPSON
    case EPSON:
      sendEpson(data, nbits, min_repeat);
      break;
#endif
#if SEND_GICABLE
    case GICABLE:
      sendGICable(data, nbits, min_repeat);
      break;
#endif
#if SEND_GOODWEATHER
    case GOODWEATHER:
      sendGoodweather(data, nbits, min_repeat);
      break;
#endif
#if SEND_GREE
    case GREE:
      sendGree(data, nbits, min_repeat);
      break;
#endif
#if SEND_INAX
    case INAX:
      sendInax(data, nbits, min_repeat);
      break;
#endif  // SEND_INAX
#if SEND_JVC
    case JVC:
      sendJVC(data, nbits, min_repeat);
      break;
#endif
#if SEND_LASERTAG
    case LASERTAG:
      sendLasertag(data, nbits, min_repeat);
      break;
#endif
#if SEND_LEGOPF
    case LEGOPF:
      sendLegoPf(data, nbits, min_repeat);
      break;
#endif
#if SEND_LG
    case LG:
      sendLG(data, nbits, min_repeat);
      break;
    case LG2:
      sendLG2(data, nbits, min_repeat);
      break;
#endif
#if SEND_LUTRON
    case LUTRON:
      sendLutron(data, nbits, min_repeat);
      break;
#endif
#if SEND_MAGIQUEST
    case MAGIQUEST:
      sendMagiQuest(data, nbits, min_repeat);
      break;
#endif
#if SEND_MIDEA
    case MIDEA:
      sendMidea(data, nbits, min_repeat);
      break;
#endif
#if SEND_MITSUBISHI
    case MITSUBISHI:
      sendMitsubishi(data, nbits, min_repeat);
      break;
#endif
#if SEND_MITSUBISHI2
    case MITSUBISHI2:
      sendMitsubishi2(data, nbits, min_repeat);
      break;
#endif
#if SEND_MULTIBRACKETS
    case MULTIBRACKETS:
      sendMultibrackets(data, nbits, min_repeat);
      break;
#endif
#if SEND_NIKAI
    case NIKAI:
      sendNikai(data, nbits, min_repeat);
      break;
#endif
#if SEND_NEC
    case NEC:
    case NEC_LIKE:
      sendNEC(data, nbits, min_repeat);
      break;
#endif
#if SEND_PANASONIC
    case PANASONIC:
      sendPanasonic64(data, nbits, min_repeat);
      break;
#endif
#if SEND_PIONEER
    case PIONEER:
      sendPioneer(data, nbits, min_repeat);
      break;
#endif
#if SEND_RC5
    case RC5:
    case RC5X:
      sendRC5(data, nbits, min_repeat);
      break;
#endif
#if SEND_RC6
    case RC6:
      sendRC6(data, nbits, min_repeat);
      break;
#endif
#if SEND_RCMM
    case RCMM:
      sendRCMM(data, nbits, min_repeat);
      break;
#endif
#if SEND_SAMSUNG
    case SAMSUNG:
      sendSAMSUNG(data, nbits, min_repeat);
      break;
#endif
#if SEND_SAMSUNG36
    case SAMSUNG36:
      sendSamsung36(data, nbits, min_repeat);
      break;
#endif
#if SEND_SANYO
    case SANYO_LC7461:
      sendSanyoLC7461(data, nbits, min_repeat);
      break;
#endif
#if SEND_SHARP
    case SHARP:
      sendSharpRaw(data, nbits, min_repeat);
      break;
#endif
#if SEND_SHERWOOD
    case SHERWOOD:
      sendSherwood(data, nbits, min_repeat);
      break;
#endif
#if SEND_SONY
    case SONY:
      sendSony(data, nbits, min_repeat);
      break;
    case SONY_38K:
      sendSony38(data, nbits, min_repeat);
      break;
#endif
#if SEND_SYMPHONY
    case SYMPHONY:
      sendSymphony(data, nbits, min_repeat);
      break;
#endif
#if SEND_TECO
    case TECO:
      sendTeco(data, nbits, min_repeat);
      break;
#endif
#if SEND_VESTEL_AC
    case VESTEL_AC:
      sendVestelAc(data, nbits, min_repeat);
      break;
#endif
#if SEND_WHYNTER
    case WHYNTER:
      sendWhynter(data, nbits, min_repeat);
      break;
#endif
    default:
      return false;
  }
  return true;
}

// Send a complex (>= 64 bits) IR message of a given type.
// An unknown/unsupported type will do nothing.
// Args:
//   type:   Protocol number/type of the message you want to send.
//   state:  A pointer to the array of bytes that make up the state[].
//   nbytes: How many bytes are in the state.
// Returns:
//   bool: True if it is a type we can attempt to send, false if not.
bool IRsend::send(const decode_type_t type, const unsigned char *state,
                  const uint16_t nbytes) {
  switch (type) {
#if SEND_AMCOR
    case AMCOR:
      sendAmcor(state, nbytes);
      break;
#endif
#if SEND_ARGO
    case ARGO:
      sendArgo(state, nbytes);
      break;
#endif  // SEND_ARGO
#if SEND_DAIKIN
    case DAIKIN:
      sendDaikin(state, nbytes);
      break;
#endif  // SEND_DAIKIN
#if SEND_DAIKIN128
    case DAIKIN128:
        sendDaikin128(state, nbytes);
        break;
#endif  // SEND_DAIKIN128
#if SEND_DAIKIN152
    case DAIKIN152:
        sendDaikin152(state, nbytes);
        break;
#endif  // SEND_DAIKIN152
#if SEND_DAIKIN160
    case DAIKIN160:
      sendDaikin160(state, nbytes);
      break;
#endif  // SEND_DAIKIN160
#if SEND_DAIKIN176
    case DAIKIN176:
      sendDaikin176(state, nbytes);
      break;
#endif  // SEND_DAIKIN176
#if SEND_DAIKIN2
    case DAIKIN2:
      sendDaikin2(state, nbytes);
      break;
#endif  // SEND_DAIKIN2
#if SEND_DAIKIN216
    case DAIKIN216:
      sendDaikin216(state, nbytes);
      break;
#endif  // SEND_DAIKIN216
#if SEND_ELECTRA_AC
    case ELECTRA_AC:
      sendElectraAC(state, nbytes);
      break;
#endif  // SEND_ELECTRA_AC
#if SEND_FUJITSU_AC
    case FUJITSU_AC:
      sendFujitsuAC(state, nbytes);
      break;
#endif  // SEND_FUJITSU_AC
#if SEND_GREE
    case GREE:
      sendGree(state, nbytes);
      break;
#endif  // SEND_GREE
#if SEND_HAIER_AC
    case HAIER_AC:
      sendHaierAC(state, nbytes);
      break;
#endif  // SEND_HAIER_AC
#if SEND_HAIER_AC_YRW02
    case HAIER_AC_YRW02:
      sendHaierACYRW02(state, nbytes);
      break;
#endif  // SEND_HAIER_AC_YRW02
#if SEND_HITACHI_AC
    case HITACHI_AC:
      sendHitachiAC(state, nbytes);
      break;
#endif  // SEND_HITACHI_AC
#if SEND_HITACHI_AC1
    case HITACHI_AC1:
      sendHitachiAC1(state, nbytes);
      break;
#endif  // SEND_HITACHI_AC1
#if SEND_HITACHI_AC2
    case HITACHI_AC2:
      sendHitachiAC2(state, nbytes);
      break;
#endif  // SEND_HITACHI_AC2
#if SEND_HITACHI_AC3
    case HITACHI_AC3:
      sendHitachiAc3(state, nbytes);
      break;
#endif  // SEND_HITACHI_AC3
#if SEND_HITACHI_AC424
    case HITACHI_AC424:
      sendHitachiAc424(state, nbytes);
      break;
#endif  // SEND_HITACHI_AC424
#if SEND_KELVINATOR
    case KELVINATOR:
      sendKelvinator(state, nbytes);
      break;
#endif  // SEND_KELVINATOR
#if SEND_MITSUBISHI_AC
    case MITSUBISHI_AC:
      sendMitsubishiAC(state, nbytes);
      break;
#endif  // SEND_MITSUBISHI_AC
#if SEND_MITSUBISHI136
    case MITSUBISHI136:
      sendMitsubishi136(state, nbytes);
      break;
#endif  // SEND_MITSUBISHI136
#if SEND_MITSUBISHI112
    case MITSUBISHI112:
      sendMitsubishi112(state, nbytes);
      break;
#endif  // SEND_MITSUBISHI112
#if SEND_MITSUBISHIHEAVY
    case MITSUBISHI_HEAVY_88:
      sendMitsubishiHeavy88(state, nbytes);
      break;
    case MITSUBISHI_HEAVY_152:
      sendMitsubishiHeavy152(state, nbytes);
      break;
#endif  // SEND_MITSUBISHIHEAVY
#if SEND_MWM
    case MWM:
      sendMWM(state, nbytes);
      break;
#endif  // SEND_MWM
#if SEND_NEOCLIMA
    case NEOCLIMA:
      sendNeoclima(state, nbytes);
      break;
#endif  // SEND_NEOCLIMA
#if SEND_PANASONIC_AC
    case PANASONIC_AC:
      sendPanasonicAC(state, nbytes);
      break;
#endif  // SEND_PANASONIC_AC
#if SEND_SAMSUNG_AC
    case SAMSUNG_AC:
      sendSamsungAC(state, nbytes);
      break;
#endif  // SEND_SAMSUNG_AC
#if SEND_SHARP_AC
    case SHARP_AC:
      sendSharpAc(state, nbytes);
      break;
#endif  // SEND_SHARP_AC
#if SEND_TCL112AC
    case TCL112AC:
      sendTcl112Ac(state, nbytes);
      break;
#endif  // SEND_TCL112AC
#if SEND_TOSHIBA_AC
    case TOSHIBA_AC:
      sendToshibaAC(state, nbytes);
      break;
#endif  // SEND_TOSHIBA_AC
#if SEND_TROTEC
    case TROTEC:
      sendTrotec(state, nbytes);
      break;
#endif  // SEND_TROTEC
#if SEND_WHIRLPOOL_AC
    case WHIRLPOOL_AC:
      sendWhirlpoolAC(state, nbytes);
      break;
#endif  // SEND_WHIRLPOOL_AC
    default:
      return false;
  }
  return true;
}


text:
var not=false;document.getElementById("notificat").style.display="none";
document.getElementById("notification").onclick=function(){if(not==false)
{document.getElementById("notificat").style.display="block";not=true;}
else {
	document.getElementById("notificat").style.display="none";
	not=false;
}}


text:
"""Data classes used in jenkins_job_linter."""
from configparser import SectionProxy
from typing import Iterable
from xml.etree import ElementTree

class LintContext:
    """
    The context in which a linter should run.

    This contains all of the information about the object under test, and the
    environment in which the linter is running.
    """

    def __init__(self,
                 config: SectionProxy,
                 run_ctx: 'RunContext',
                 tree: ElementTree.ElementTree,
                 ) -> None:
        """
        Create a LintContext.

        :param config:
            The configparser.SectionProxy of the parsed configuration for this
            particular linter.
        :param tree:
            A Jenkins XML file parsed in to an ElementTree.
        """
        self.config = config
        self.run_ctx = run_ctx
        self.tree = tree

class RunContext:
    """Run-level data to be passed around and to linters."""

    def __init__(self, object_names: Iterable[str]) -> None:
        """
        Create a RunContext.

        :param object_names:
            An iterable containing the names of Jenkins objects that this run
            is operating against.
        """
        self.object_names = object_names


text:
<?php
namespace EventEspresso\core\exceptions;

if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
	exit( 'No direct script access allowed' );
}

/**
 * Class SendMessageException
 * Thrown when a message is unsuccessfully sent and cannot be retried.
 *
 * @package       Event Espresso
 * @author        Darren Ethier
 * @since         4.9.11.rc.001
 */
class SendMessageException extends \RuntimeException  {}
// End of file SendMessageException.php


text:
class Struct; module For_Pairs

  module ClassMethods

    # @param [Hash, Struct, #each_pair] pairs - nameA => valueX
    # @return [Struct] new instance
    def for_pairs(pairs)
      new(*pairs.keys.map(&:to_sym)).for_pairs pairs
    end
    alias_method :from_pairs, :for_pairs

    private

    def inherited(cls)
      super
      cls.extend For_Pairs::SubclassClassMethods
    end

  end

end; end


text:
package org.jetbrains.plugins.scala.lang.resolve;

import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScClass;
import org.jetbrains.plugins.scala.util.TestUtils;

/**
 * User: Alexander Podkhalyuzin
 * Date: 01.11.11
 */
public class ResolveClassDependentTest extends ScalaResolveTestCase {
  public String folderPath() {
    return super.folderPath() + "resolve/class/dependent/";
  }

  public void testMainXMLExporter() throws Exception {
    PsiReference ref = findReferenceAtCaret();
    PsiElement resolved = ref.resolve();
    assertTrue(resolved instanceof ScClass);
  }
}


text:
<?php

/*
 * This file is part of the BeSimpleSoapClient.
 *
 * (c) Christian Kerl <christian-kerl@web.de>
 * (c) Francis Besset <francis.besset@gmail.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace BeSimple\SoapClient\Tests;

use BeSimple\SoapClient\WsdlDownloader;
use BeSimple\SoapCommon\Cache;
use BeSimple\SoapClient\Curl;
use Symfony\Component\Filesystem\Filesystem;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamWrapper;

/**
 * @author Andreas Schamberger <mail@andreass.net>
 * @author Francis Besset <francis.bessset@gmail.com>
 */
class WsdlDownloaderTest extends AbstractWebserverTest
{
    static protected $filesystem;

    static protected $fixturesPath;

    /**
     * @dataProvider provideDownload
     */
    public function testDownload($source, $regexp, $nbDownloads)
    {
        $wsdlCacheDir = vfsStream::setup('wsdl');
        $wsdlCacheUrl = $wsdlCacheDir->url('wsdl');

        Cache::setEnabled(Cache::ENABLED);
        Cache::setDirectory($wsdlCacheUrl);
        $cacheDirForRegExp = preg_quote($wsdlCacheUrl, '#');

        $wsdlDownloader = new WsdlDownloader(new Curl());
        $this->assertCount(0, $wsdlCacheDir->getChildren());

        $cacheFileName = $wsdlDownloader->download($source);
        $this->assertCount($nbDownloads, $wsdlCacheDir->getChildren());

        $this->assertRegExp('#'.sprintf($regexp, $cacheDirForRegExp).'#', file_get_contents($cacheFileName));
    }

    public function provideDownload()
    {
        return array(
            array(
                __DIR__.DIRECTORY_SEPARATOR.'Fixtures/build_include/xsdinctest_absolute.xml',
                '%s/wsdl_[a-f0-9]{32}\.cache',
                2,
            ),
            array(
                __DIR__.DIRECTORY_SEPARATOR.'Fixtures/xsdinclude/xsdinctest_relative.xml',
                '\.\./type_include\.xsd',
                1,
            ),
            array(
                sprintf('http://localhost:%d/build_include/xsdinctest_absolute.xml', WEBSERVER_PORT),
                '%s/wsdl_[a-f0-9]{32}\.cache',
                2,
            ),
            array(
                sprintf('http://localhost:%d/xsdinclude/xsdinctest_relative.xml', WEBSERVER_PORT),
                '%s/wsdl_[a-f0-9]{32}\.cache',
                2,
            ),
        );
    }

    public function testIsRemoteFile()
    {
        $wsdlDownloader = new WsdlDownloader(new Curl());

        $r = new \ReflectionClass($wsdlDownloader);
        $m = $r->getMethod('isRemoteFile');
        $m->setAccessible(true);

        $this->assertTrue($m->invoke($wsdlDownloader, 'http://www.php.net/'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'http://localhost/'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'http://mylocaldomain/'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'http://www.php.net/dir/test.html'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'http://localhost/dir/test.html'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'http://mylocaldomain/dir/test.html'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'https://www.php.net/'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'https://localhost/'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'https://mylocaldomain/'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'https://www.php.net/dir/test.html'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'https://localhost/dir/test.html'));
        $this->assertTrue($m->invoke($wsdlDownloader, 'https://mylocaldomain/dir/test.html'));
        $this->assertFalse($m->invoke($wsdlDownloader, 'c:/dir/test.html'));
        $this->assertFalse($m->invoke($wsdlDownloader, '/dir/test.html'));
        $this->assertFalse($m->invoke($wsdlDownloader, '../dir/test.html'));
    }

    /**
     * @dataProvider provideResolveWsdlIncludes
     */
    public function testResolveWsdlIncludes($source, $cacheFile, $remoteParentUrl, $regexp, $nbDownloads)
    {
        $wsdlCacheDir = vfsStream::setup('wsdl');
        $wsdlCacheUrl = $wsdlCacheDir->url('wsdl');

        Cache::setEnabled(Cache::ENABLED);
        Cache::setDirectory($wsdlCacheUrl);
        $cacheDirForRegExp = preg_quote($wsdlCacheUrl, '#');

        $wsdlDownloader = new WsdlDownloader(new Curl());
        $r = new \ReflectionClass($wsdlDownloader);
        $m = $r->getMethod('resolveRemoteIncludes');
        $m->setAccessible(true);

        $this->assertCount(0, $wsdlCacheDir->getChildren());

        $cacheFile = sprintf($cacheFile, $wsdlCacheUrl);
        $m->invoke($wsdlDownloader, file_get_contents($source), $cacheFile, $remoteParentUrl);
        $this->assertCount($nbDownloads, $wsdlCacheDir->getChildren());

        $this->assertRegExp('#'.sprintf($regexp, $cacheDirForRegExp).'#', file_get_contents($cacheFile));
    }

    public function provideResolveWsdlIncludes()
    {
        $remoteUrlAbsolute = sprintf('http://localhost:%d/build_include/wsdlinctest_absolute.xml', WEBSERVER_PORT);
        $remoteUrlRelative = sprintf('http://localhost:%d/wsdlinclude/wsdlinctest_relative.xml', WEBSERVER_PORT);

        return array(
            array(
                __DIR__.DIRECTORY_SEPARATOR.'Fixtures/build_include/wsdlinctest_absolute.xml',
                '%s/cache_local_absolute.xml',
                null,
                '%s/wsdl_[a-f0-9]{32}.cache',
                2,
            ),
            array(
                __DIR__.DIRECTORY_SEPARATOR.'Fixtures/wsdlinclude/wsdlinctest_relative.xml',
                '%s/cache_local_relative.xml',
                null,
                '\.\./wsdl_include\.wsdl',
                1,
            ),
            array(
                $remoteUrlAbsolute,
                '%s/cache_remote_absolute.xml',
                $remoteUrlAbsolute,
                '%s/wsdl_[a-f0-9]{32}\.cache',
                2,
            ),
            array(
                $remoteUrlRelative,
                '%s/cache_remote_relative.xml',
                $remoteUrlRelative,
                '%s/wsdl_[a-f0-9]{32}\.cache',
                2
            ),
        );
    }

    /**
     * @dataProvider provideResolveXsdIncludes
     */
    public function testResolveXsdIncludes($source, $cacheFile, $remoteParentUrl, $regexp, $nbDownloads)
    {
        $wsdlCacheDir = vfsStream::setup('wsdl');
        $wsdlCacheUrl = $wsdlCacheDir->url('wsdl');

        Cache::setEnabled(Cache::ENABLED);
        Cache::setDirectory($wsdlCacheUrl);
        $cacheDirForRegExp = preg_quote($wsdlCacheUrl, '#');

        $wsdlDownloader = new WsdlDownloader(new Curl());
        $r = new \ReflectionClass($wsdlDownloader);
        $m = $r->getMethod('resolveRemoteIncludes');
        $m->setAccessible(true);

        $this->assertCount(0, $wsdlCacheDir->getChildren());

        $cacheFile = sprintf($cacheFile, $wsdlCacheUrl);
        $m->invoke($wsdlDownloader, file_get_contents($source), $cacheFile, $remoteParentUrl);
        $this->assertCount($nbDownloads, $wsdlCacheDir->getChildren());

        $this->assertRegExp('#'.sprintf($regexp, $cacheDirForRegExp).'#', file_get_contents($cacheFile));
    }

    public function provideResolveXsdIncludes()
    {
        $remoteUrlAbsolute = sprintf('http://localhost:%d/build_include/xsdinctest_absolute.xml', WEBSERVER_PORT);
        $remoteUrlRelative = sprintf('http://localhost:%d/xsdinclude/xsdinctest_relative.xml', WEBSERVER_PORT);

        return array(
            array(
                __DIR__.DIRECTORY_SEPARATOR.'Fixtures/build_include/xsdinctest_absolute.xml',
                '%s/cache_local_absolute.xml',
                null,
                '%s/wsdl_[a-f0-9]{32}\.cache',
                2,
            ),
            array(
                __DIR__.DIRECTORY_SEPARATOR.'Fixtures/xsdinclude/xsdinctest_relative.xml',
                '%s/cache_local_relative.xml',
                null,
                '\.\./type_include\.xsd',
                1,
            ),
            array(
                $remoteUrlAbsolute,
                '%s/cache_remote_absolute.xml',
                $remoteUrlAbsolute,
                '%s/wsdl_[a-f0-9]{32}\.cache',
                2,
            ),
            array(
                $remoteUrlRelative,
                '%s/cache_remote_relative.xml',
                $remoteUrlRelative,
                '%s/wsdl_[a-f0-9]{32}\.cache',
                2,
            ),
        );
    }

    public function testResolveRelativePathInUrl()
    {
        $wsdlDownloader = new WsdlDownloader(new Curl());

        $r = new \ReflectionClass($wsdlDownloader);
        $m = $r->getMethod('resolveRelativePathInUrl');
        $m->setAccessible(true);

        $this->assertEquals('http://localhost:8080/test', $m->invoke($wsdlDownloader, 'http://localhost:8080/sub', '/test'));
        $this->assertEquals('http://localhost:8080/test', $m->invoke($wsdlDownloader, 'http://localhost:8080/sub/', '/test'));

        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub', '/test'));
        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/', '/test'));

        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost', './test'));
        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/', './test'));

        $this->assertEquals('http://localhost/sub/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub', './test'));
        $this->assertEquals('http://localhost/sub/sub/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/', './test'));

        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub', '../test'));
        $this->assertEquals('http://localhost/sub/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/', '../test'));

        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/sub', '../../test'));
        $this->assertEquals('http://localhost/sub/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/sub/', '../../test'));

        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/sub/sub', '../../../test'));
        $this->assertEquals('http://localhost/sub/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/sub/sub/', '../../../test'));

        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/sub', '../../../test'));
        $this->assertEquals('http://localhost/test', $m->invoke($wsdlDownloader, 'http://localhost/sub/sub/sub/', '../../../test'));
    }

    public static function setUpBeforeClass()
    {
        parent::setUpBeforeClass();

        self::$filesystem  = new Filesystem();
        self::$fixturesPath = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR;
        self::$filesystem->mkdir(self::$fixturesPath.'build_include');

        foreach (array('wsdlinclude/wsdlinctest_absolute.xml', 'xsdinclude/xsdinctest_absolute.xml') as $file) {
            $content = file_get_contents(self::$fixturesPath.$file);
            $content = preg_replace('#'.preg_quote('%location%').'#', sprintf('localhost:%d', WEBSERVER_PORT), $content);

            self::$filesystem->dumpFile(self::$fixturesPath.'build_include'.DIRECTORY_SEPARATOR.pathinfo($file, PATHINFO_BASENAME), $content);
        }
    }

    public static function tearDownAfterClass()
    {
        parent::tearDownAfterClass();

        self::$filesystem->remove(self::$fixturesPath.'build_include');
    }
}