text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.billing.models;

import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;

/** Defines values for AutoRenew. */
public final class AutoRenew extends ExpandableStringEnum<AutoRenew> {
    /** Static value Off for AutoRenew. */
    public static final AutoRenew OFF = fromString("Off");

    /** Static value On for AutoRenew. */
    public static final AutoRenew ON = fromString("On");

    /**
     * Creates or finds a AutoRenew from its string representation.
     *
     * @param name a name to look for.
     * @return the corresponding AutoRenew.
     */
    @JsonCreator
    public static AutoRenew fromString(String name) {
        return fromString(name, AutoRenew.class);
    }

    /** @return known AutoRenew values. */
    public static Collection<AutoRenew> values() {
        return values(AutoRenew.class);
    }
}

redpajama_set_name: RedPajamaGithub


text:
#pragma execution_character_set("utf-8")

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QTranslator qtTranslator;
    qtTranslator.load(":/translations/translations/qt_" + QLocale().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    a.installTranslator(&qtTranslator);
    MainWindow w;
    w.show();

    return a.exec();
}


text:
package edu.gemini.itc.gems;

import edu.gemini.itc.base.ITCConstants;
import edu.gemini.itc.base.TransmissionElement;

/**
 * The GemsTransmissionVisitor is designed to adjust the SED for the
 * Tranmsission of the Gems optics.
 */
public final class GemsTransmissionVisitor extends TransmissionElement {

    /**
     * The GemsTrans constructor
     */
    public GemsTransmissionVisitor() {

        super(Gems.GEMS_LIB + "/" +
                Gems.GEMS_PREFIX +
                Gems.GEMS_TRANSMISSION_FILENAME +
                ITCConstants.DATA_SUFFIX);
    }

    public String toString() {
        return ("GemsTransmissionVisitor");
    }
}


text:
import sys

from numpy.testing import *
set_package_path()
import numpy.lib;reload(numpy.lib);reload(numpy.lib.type_check)
from numpy.lib import *
from numpy.core import *
restore_path()

def assert_all(x):
    assert(all(x)), x

class TestMintypecode(NumpyTestCase):

    def check_default_1(self):
        for itype in '1bcsuwil':
            assert_equal(mintypecode(itype),'d')
        assert_equal(mintypecode('f'),'f')
        assert_equal(mintypecode('d'),'d')
        assert_equal(mintypecode('F'),'F')
        assert_equal(mintypecode('D'),'D')

    def check_default_2(self):
        for itype in '1bcsuwil':
            assert_equal(mintypecode(itype+'f'),'f')
            assert_equal(mintypecode(itype+'d'),'d')
            assert_equal(mintypecode(itype+'F'),'F')
            assert_equal(mintypecode(itype+'D'),'D')
        assert_equal(mintypecode('ff'),'f')
        assert_equal(mintypecode('fd'),'d')
        assert_equal(mintypecode('fF'),'F')
        assert_equal(mintypecode('fD'),'D')
        assert_equal(mintypecode('df'),'d')
        assert_equal(mintypecode('dd'),'d')
        #assert_equal(mintypecode('dF',savespace=1),'F')
        assert_equal(mintypecode('dF'),'D')
        assert_equal(mintypecode('dD'),'D')
        assert_equal(mintypecode('Ff'),'F')
        #assert_equal(mintypecode('Fd',savespace=1),'F')
        assert_equal(mintypecode('Fd'),'D')
        assert_equal(mintypecode('FF'),'F')
        assert_equal(mintypecode('FD'),'D')
        assert_equal(mintypecode('Df'),'D')
        assert_equal(mintypecode('Dd'),'D')
        assert_equal(mintypecode('DF'),'D')
        assert_equal(mintypecode('DD'),'D')

    def check_default_3(self):
        assert_equal(mintypecode('fdF'),'D')
        #assert_equal(mintypecode('fdF',savespace=1),'F')
        assert_equal(mintypecode('fdD'),'D')
        assert_equal(mintypecode('fFD'),'D')
        assert_equal(mintypecode('dFD'),'D')

        assert_equal(mintypecode('ifd'),'d')
        assert_equal(mintypecode('ifF'),'F')
        assert_equal(mintypecode('ifD'),'D')
        assert_equal(mintypecode('idF'),'D')
        #assert_equal(mintypecode('idF',savespace=1),'F')
        assert_equal(mintypecode('idD'),'D')

class TestIsscalar(NumpyTestCase):
    def check_basic(self):
        assert(isscalar(3))
        assert(not isscalar([3]))
        assert(not isscalar((3,)))
        assert(isscalar(3j))
        assert(isscalar(10L))
        assert(isscalar(4.0))

class TestReal(NumpyTestCase):
    def check_real(self):
        y = rand(10,)
        assert_array_equal(y,real(y))

    def check_cmplx(self):
        y = rand(10,)+1j*rand(10,)
        assert_array_equal(y.real,real(y))

class TestImag(NumpyTestCase):
    def check_real(self):
        y = rand(10,)
        assert_array_equal(0,imag(y))

    def check_cmplx(self):
        y = rand(10,)+1j*rand(10,)
        assert_array_equal(y.imag,imag(y))

class TestIscomplex(NumpyTestCase):
    def check_fail(self):
        z = array([-1,0,1])
        res = iscomplex(z)
        assert(not sometrue(res,axis=0))
    def check_pass(self):
        z = array([-1j,1,0])
        res = iscomplex(z)
        assert_array_equal(res,[1,0,0])

class TestIsreal(NumpyTestCase):
    def check_pass(self):
        z = array([-1,0,1j])
        res = isreal(z)
        assert_array_equal(res,[1,1,0])
    def check_fail(self):
        z = array([-1j,1,0])
        res = isreal(z)
        assert_array_equal(res,[0,1,1])

class TestIscomplexobj(NumpyTestCase):
    def check_basic(self):
        z = array([-1,0,1])
        assert(not iscomplexobj(z))
        z = array([-1j,0,-1])
        assert(iscomplexobj(z))

class TestIsrealobj(NumpyTestCase):
    def check_basic(self):
        z = array([-1,0,1])
        assert(isrealobj(z))
        z = array([-1j,0,-1])
        assert(not isrealobj(z))

class TestIsnan(NumpyTestCase):
    def check_goodvalues(self):
        z = array((-1.,0.,1.))
        res = isnan(z) == 0
        assert_all(alltrue(res,axis=0))
    def check_posinf(self):
        olderr = seterr(divide='ignore')
        assert_all(isnan(array((1.,))/0.) == 0)
        seterr(**olderr)
    def check_neginf(self):
        olderr = seterr(divide='ignore')
        assert_all(isnan(array((-1.,))/0.) == 0)
        seterr(**olderr)
    def check_ind(self):
        olderr = seterr(divide='ignore', invalid='ignore')
        assert_all(isnan(array((0.,))/0.) == 1)
        seterr(**olderr)
    #def check_qnan(self):             log(-1) return pi*j now
    #    assert_all(isnan(log(-1.)) == 1)
    def check_integer(self):
        assert_all(isnan(1) == 0)
    def check_complex(self):
        assert_all(isnan(1+1j) == 0)
    def check_complex1(self):
        olderr = seterr(divide='ignore', invalid='ignore')
        assert_all(isnan(array(0+0j)/0.) == 1)
        seterr(**olderr)

class TestIsfinite(NumpyTestCase):
    def check_goodvalues(self):
        z = array((-1.,0.,1.))
        res = isfinite(z) == 1
        assert_all(alltrue(res,axis=0))
    def check_posinf(self):
        olderr = seterr(divide='ignore')
        assert_all(isfinite(array((1.,))/0.) == 0)
        seterr(**olderr)
    def check_neginf(self):
        olderr = seterr(divide='ignore')
        assert_all(isfinite(array((-1.,))/0.) == 0)
        seterr(**olderr)
    def check_ind(self):
        olderr = seterr(divide='ignore', invalid='ignore')
        assert_all(isfinite(array((0.,))/0.) == 0)
        seterr(**olderr)
    #def check_qnan(self):
    #    assert_all(isfinite(log(-1.)) == 0)
    def check_integer(self):
        assert_all(isfinite(1) == 1)
    def check_complex(self):
        assert_all(isfinite(1+1j) == 1)
    def check_complex1(self):
        olderr = seterr(divide='ignore', invalid='ignore')
        assert_all(isfinite(array(1+1j)/0.) == 0)
        seterr(**olderr)

class TestIsinf(NumpyTestCase):
    def check_goodvalues(self):
        z = array((-1.,0.,1.))
        res = isinf(z) == 0
        assert_all(alltrue(res,axis=0))
    def check_posinf(self):
        olderr = seterr(divide='ignore')
        assert_all(isinf(array((1.,))/0.) == 1)
        seterr(**olderr)
    def check_posinf_scalar(self):
        olderr = seterr(divide='ignore')
        assert_all(isinf(array(1.,)/0.) == 1)
        seterr(**olderr)
    def check_neginf(self):
        olderr = seterr(divide='ignore')
        assert_all(isinf(array((-1.,))/0.) == 1)
        seterr(**olderr)
    def check_neginf_scalar(self):
        olderr = seterr(divide='ignore')
        assert_all(isinf(array(-1.)/0.) == 1)
        seterr(**olderr)
    def check_ind(self):
        olderr = seterr(divide='ignore', invalid='ignore')
        assert_all(isinf(array((0.,))/0.) == 0)
        seterr(**olderr)
    #def check_qnan(self):
    #    assert_all(isinf(log(-1.)) == 0)
    #    assert_all(isnan(log(-1.)) == 1)

class TestIsposinf(NumpyTestCase):
    def check_generic(self):
        olderr = seterr(divide='ignore', invalid='ignore')
        vals = isposinf(array((-1.,0,1))/0.)
        seterr(**olderr)
        assert(vals[0] == 0)
        assert(vals[1] == 0)
        assert(vals[2] == 1)

class TestIsneginf(NumpyTestCase):
    def check_generic(self):
        olderr = seterr(divide='ignore', invalid='ignore')
        vals = isneginf(array((-1.,0,1))/0.)
        seterr(**olderr)
        assert(vals[0] == 1)
        assert(vals[1] == 0)
        assert(vals[2] == 0)

class TestNanToNum(NumpyTestCase):
    def check_generic(self):
        olderr = seterr(divide='ignore', invalid='ignore')
        vals = nan_to_num(array((-1.,0,1))/0.)
        seterr(**olderr)
        assert_all(vals[0] < -1e10) and assert_all(isfinite(vals[0]))
        assert(vals[1] == 0)
        assert_all(vals[2] > 1e10) and assert_all(isfinite(vals[2]))
    def check_integer(self):
        vals = nan_to_num(1)
        assert_all(vals == 1)
    def check_complex_good(self):
        vals = nan_to_num(1+1j)
        assert_all(vals == 1+1j)
    def check_complex_bad(self):
        v = 1+1j
        olderr = seterr(divide='ignore', invalid='ignore')
        v += array(0+1.j)/0.
        seterr(**olderr)
        vals = nan_to_num(v)
        # !! This is actually (unexpectedly) zero
        assert_all(isfinite(vals))
    def check_complex_bad2(self):
        v = 1+1j
        olderr = seterr(divide='ignore', invalid='ignore')
        v += array(-1+1.j)/0.
        seterr(**olderr)
        vals = nan_to_num(v)
        assert_all(isfinite(vals))
        #assert_all(vals.imag > 1e10)  and assert_all(isfinite(vals))
        # !! This is actually (unexpectedly) positive
        # !! inf.  Comment out for now, and see if it
        # !! changes
        #assert_all(vals.real < -1e10) and assert_all(isfinite(vals))

class TestRealIfClose(NumpyTestCase):
    def check_basic(self):
        a = rand(10)
        b = real_if_close(a+1e-15j)
        assert_all(isrealobj(b))
        assert_array_equal(a,b)
        b = real_if_close(a+1e-7j)
        assert_all(iscomplexobj(b))
        b = real_if_close(a+1e-7j,tol=1e-6)
        assert_all(isrealobj(b))

class TestArrayConversion(NumpyTestCase):
    def check_asfarray(self):
        a = asfarray(array([1,2,3]))
        assert_equal(a.__class__,ndarray)
        assert issubdtype(a.dtype,float)

if __name__ == "__main__":
    NumpyTest().run()


text:
package org.binave.common.util;

import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 一些字符处理的工具
 *
 * @author bin jin
 * @since 1.8
 */
public class CharUtil {

    /* ******** format ******** */

    /**
     * 将字符串中指定占位符包含的部分,替换成传入的参数
     *
     * \@param allowPlaceholderTextSurplus 允许占位符中有其他字符
     * @param allowParametersSurplus    允许传入参数剩余
     * @param allowPlaceholderSurplus   允许占位符剩余
     * @param prefixSeparator           前占位符
     * @param suffixSeparator           后占位符
     * @param format                    带占位符的格式化字符
     */
    public static String resolvePlaceholders(/*boolean allowPlaceholderTextSurplus,*/
                                             boolean allowParametersSurplus, boolean allowPlaceholderSurplus,
                                             String prefixSeparator, String suffixSeparator, String format, Object... args) {

        if (prefixSeparator == null || suffixSeparator == null || format == null || args == null)
            throw new IllegalArgumentException(
                    replacePlaceholders("?",
                            "argument: prefixSeparator=?, suffixSeparator=?, format=?, args=?",
                            prefixSeparator, suffixSeparator, format, Arrays.toString(args))
            );

        StringBuilder sb = new StringBuilder(format);
        int argsIndex = 0;
        int prefixIndex = sb.indexOf(prefixSeparator);

        while (prefixIndex != -1) {
            int suffixIndex = sb.indexOf(suffixSeparator, prefixIndex + prefixSeparator.length());
            if (suffixIndex != -1 && argsIndex < args.length) {

                /*
                if (!allowPlaceholderTextSurplus &&
                        sb.substring(prefixIndex + prefixSeparator.length(), suffixIndex).length() > 0)
                    throw new IllegalArgumentException(
                            exceptionText("Placeholder have text", prefixSeparator, suffixSeparator, format, args)
                    );
                */

                String arg = args[argsIndex] != null ? args[argsIndex].toString() : "NULL";
                sb.replace(prefixIndex, suffixIndex + suffixSeparator.length(), arg);
                prefixIndex = sb.indexOf(prefixSeparator, prefixIndex + arg.length());
                ++argsIndex;

            } else if (!allowPlaceholderSurplus && argsIndex >= args.length)
                throw new IllegalArgumentException(
                        exceptionText("Placeholder surplus", prefixSeparator, suffixSeparator, format, args)
                );
            else prefixIndex = -1;

        }

        if (!allowParametersSurplus && argsIndex < args.length)
            throw new IllegalArgumentException(
                    exceptionText("Parameters surplus", prefixSeparator, suffixSeparator, format, args)
            );

        return sb.toString();
    }

    /**
     * 将字符串中指定占位符包含的部分,替换成传入的参数
     *
     * @param prefixSeparator           前占位符
     * @param suffixSeparator           后占位符
     * @param format                    带占位符的格式化字符
     */
    public static String resolvePlaceholders(String prefixSeparator, String suffixSeparator, String format, Object... args) {
        return resolvePlaceholders(/*true,*/ false, false, prefixSeparator,
                suffixSeparator, format, args);
    }

    private static String exceptionText(String subject, String prefixSeparator, String suffixSeparator,
                                        String format, Object... args) {
        return replacePlaceholders("?", "?: prefixSeparator=?, suffixSeparator=?, format=?, args=?",
                subject, prefixSeparator, suffixSeparator, format, Arrays.toString(args));
    }

    /**
     * 替换字符串中的占位符为数组元素
     *
     * @param allowParametersSurplus 允许传入参数剩余
     * @param allowPlaceholderSurplus 允许占位符剩余
     * @param separator 占位符
     * @param format 带占位符的格式化字符
     */
    public static String replacePlaceholders(boolean allowParametersSurplus, boolean allowPlaceholderSurplus,
                                             String separator, String format, Object... args) {
        if (separator == null || format == null || args == null)
            throw new IllegalArgumentException(
                    exceptionText("argument", separator, format, args)
            );

        StringBuilder sb = new StringBuilder(format);
        int argsIndex = 0;
        int placeIndex = sb.indexOf(separator);

        while (placeIndex != -1) {
            if (argsIndex < args.length) {
                String arg = args[argsIndex] != null ? args[argsIndex].toString() : "NULL";
                sb.replace(placeIndex, placeIndex + separator.length(), arg);
                placeIndex = sb.indexOf(separator, placeIndex + arg.length());
                ++argsIndex;

            } else if (!allowPlaceholderSurplus && argsIndex >= args.length)
                throw new IllegalArgumentException(
                        exceptionText("Placeholder surplus", separator, format, args)
                );

            else placeIndex = -1;
        }

        if (!allowParametersSurplus && argsIndex < args.length)
            throw new IllegalArgumentException(
                    exceptionText("Parameters surplus", separator, format, args)
            );
        return sb.toString();
    }

    /**
     * 将字符串中指定占位符,替换成参数。
     * 占位符数量与参数数量不许一致
     *
     * @param separator 占位符
     * @param format    包含占位符的字符串
     */
    public static String replacePlaceholders(String separator, String format, Object... args) {
        return replacePlaceholders(false, false, separator, format, args);
    }

    private static final String DEFAULT_SEPARATOR = "{}";

    /**
     * 将字符串中的 {} 替换成参数
     *
     * @see java.text.MessageFormat#subformat
     *
     * @param format    包含占位符 {} 的字符串
     * @param args      {@link Object#toString()}
     */
    public static String format(String format, Object... args) {
        return replacePlaceholders(false, true, DEFAULT_SEPARATOR, format, args);
    }

    /**
     * @param subject 主题
     */
    private static String exceptionText(String subject, String separator, String format, Object... args) {
        return replacePlaceholders("?", "?: separator=?, format=?, args=?",
                subject, separator, format, Arrays.toString(args));
    }

    /**
     * 使用指定分隔符,拼接重复字符
     * @param separator 分隔符
     * @param text      字符
     * @param count     数量
     */
    public static String join(String separator, Object text, int count) {
        int iMax = count - 1;
        if (text == null || iMax <= -1) return null;

        StringBuilder b = new StringBuilder();
//        b.append(' ');
        for (int i = 0; ; i++) {
            b.append(text);
            if (i == iMax) return b.toString();
            b.append(separator);
        }
    }

    public static String join(String separator, Object[] a) {
        return join(separator, null, a, null);
    }

    /**
     * @see Arrays#toString
     */
    public static String join(String separator, String prefix, Object[] a, String suffix) {
        if (a == null) return null;
        int iMax = a.length - 1;

        separator = separator == null ? "" : separator;
        prefix = prefix == null ? "" : prefix;
        suffix = suffix == null ? "" : suffix;

        if (iMax == -1) return null;

        StringBuilder b = new StringBuilder();
//        b.append(' ');
        for (int i = 0; ; i++) {
            b.append(prefix).append(a[i]).append(suffix);
            if (i == iMax) return b.toString();
            b.append(separator);
        }
    }

    public static String join(String separator, String prefix, Collection c, String suffix) {
        if (c == null || c.size() == 0)
            return null;

        separator = separator == null ? "" : separator;
        prefix = prefix == null ? "" : prefix;
        suffix = suffix == null ? "" : suffix;

        StringBuilder b = new StringBuilder();

        Iterator i = c.iterator();
        b.append(prefix).append(i.next()).append(suffix);
        while (i.hasNext()) b.append(separator).
                append(prefix).append(i.next()).append(suffix);
        return b.toString();
    }

    /* ******** read ******** */

    /**
     * 从文件读取全部文本内容
     */
    public static String readText(String path) {
        try {
            return readText(new FileInputStream(path));
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * 从文件读取全部文本内容
     */
    public static String readText(File file) {
        try {
            return readText(new FileInputStream(file));
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    private static String readText(InputStream in) {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(in))) {
            StringBuilder sb = new StringBuilder();
            String line;
            while ((line = br.readLine()) != null) sb.append(line);
            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    /* ******** sub ******** */

    /**
     * 获得匹配的第一个标签内容(不含属性)
     *
     * @param xml xml 文本内容
     * @param tag 标签名称
     * @return 标签体内容
     */
    public static List<String> getLabelText(String xml, String tag) {
        Matcher matcher = Pattern.compile("(?<=<" + tag + "([^<]+)?>).*?(?=</" + tag + ")").
                matcher(xml);
        List<String> bodyList = new ArrayList<>();
        while (matcher.find()) bodyList.add(matcher.group());
        return bodyList.size() == 0 ? new ArrayList<>(0) : bodyList;
    }

    /**
     * 获得文本中的 10 进制数字
     * 支持负数
     * 支持从后向前查询
     *
     * e.g.
     *      getInteger("100_20_3", -2, -1) == 20
     *      getInteger("100_20_3", 0, 1) == 20
     *      getInteger("100_20_3", 3, 0) == 20
     *
     * @param fromIndex     指定字符串初始下标 0 ~ -1
     * @param numberIndex   数字下标 0 ~ -1
     */
    public static int getInteger(String context, int fromIndex, int numberIndex) {

        int offset;

        // 计算开始坐标
        fromIndex = fromIndex >= 0 ? fromIndex : context.length() + fromIndex;

        if (numberIndex >= 0) {
            int number = 0; // 要拿到的数字
            int position = context.length(); // 缓存位置,每次数字字符都要执行,用于判断上一次字符类型
            offset = -1; // 从左向右第几个连续数字
            boolean negative = false; // 是否时负数

            for (int i = fromIndex; i < context.length(); i++) {
                int c = context.charAt(i);
                if (c >= '0' && c <= '9') {
                    if (i - position == 1) {// 上次还是数字
                        if (offset == numberIndex) {
                            number *= 10;
                            number += c - '0';
                        }
                    } else { // 上次是非数字字符,这次是数字字符
                        negative = i > 0 && c != '0' && context.charAt(i - 1) == '-';
                        ++offset; // 找的第几个连续数字字符
                        number = c - '0';
                    }
                    position = i;
                } else if (offset == numberIndex && i - position == 1) {
                    // 说明上一次是数字字符,这次是非数字字符
                    return negative ? number * -1 : number;
                }
            }

            if (offset == numberIndex) return negative ? number * -1 : number;

        } else {
            // 从右向左遍历
            int number = 0; // 要拿到的数字
            int position = 0; // 缓存位置,每次数字字符都要执行,用于判断上一次字符类型
            offset = 0; // 从右向左第几个连续数字
            int power = 1;

            for (int i = fromIndex; i >= 0; i--) { // 从后向前遍历
                int c = context.charAt(i);
                if (c >= '0' && c <= '9') {
                    // 是数字字符
                    if (position - i == 1) { // 上次还是数字
                        if (offset == numberIndex) {
                            power *= 10;
                            number += (c - '0') * power;
                        }
                    } else { // 上次是非数字字符,这次是数字字符
                        --offset; // 找的第几个连续数字字符
                        power = 1; // 初始化幂运算
                        number = c - '0';
                    }
                    position = i;
                } else if (offset == numberIndex && position - i == 1) {
                    // 说明上一次是数字字符,这次是非数字字符
                    if (c == '-' && context.charAt(i + 1) != '0') number *= -1;
                    // 如果匹配
                    return number;
                }
            }
            if (offset == numberIndex) return number;
        }

        // 没找到
        throw new IllegalArgumentException("no number found, max offset=" + offset);

    }

    /**
     * 获得文本中的 10 进制数字
     * 不支持指定字符串初始下标
     */
    public static int getInteger(String context, int numberIndex) {
        return getInteger(context, numberIndex < 0 ? -1 : 0, numberIndex);
    }

    /* ******** other ******** */

    /**
     * 获得 uri 包含的参数列表,相同的 key,会被忽略
     * 注意:不支持编码后的字符
     */
    public static Map<String, String> getParameterMap(String url) {
        Map<String, String> map = new HashMap<>();
        StringBuilder context = new StringBuilder(url);
        int splitIndex;
        int borderIndex = context.indexOf("?");
        map.put("", context.substring(0, borderIndex));  // 不带参数的 uri 本身,被空字符标记
        while (borderIndex != -1) {
            splitIndex = context.indexOf("=", borderIndex);
            if (splitIndex != -1) {
                String key = context.substring(borderIndex + 1, splitIndex);
                borderIndex = context.indexOf("&", splitIndex);
                map.put(key, context.substring(splitIndex + 1, borderIndex != -1 ? borderIndex : url.length()));
            }
        }

        if (map.isEmpty()) throw new IllegalArgumentException("not have parameter");
        return map;
    }

    /**
     * 获得 uri 包含的参数列表
     * 注意:不支持编码后的字符
     */
    public static Map<String, List<String>> getParametersMapList(String url) {
        Map<String, List<String>> map = new HashMap<>();
        StringBuilder context = new StringBuilder(url);
        int splitIndex;
        int borderIndex = context.indexOf("?");
        while (borderIndex != -1) {
            splitIndex = context.indexOf("=", borderIndex);
            if (splitIndex != -1) {
                String key = context.substring(borderIndex + 1, splitIndex);
                borderIndex = context.indexOf("&", splitIndex);
                String value = context.substring(splitIndex + 1, borderIndex != -1 ? borderIndex : url.length());
                if (!map.containsKey(key)) {
                    List<String> valueList = new ArrayList<>();
                    valueList.add(value);
                    map.put(key, valueList);
                } else map.get(key).add(value);
            }
        }
        return map.isEmpty() ? null : map;
    }

    /**
     * 获得文件名,会剔除路径以及后缀
     * 等价于 batch 的 %~n1
     */
    public static String getNameWithoutSuffix(String path) {
        if (path == null || path.isEmpty())
            throw new IllegalArgumentException();

        int leftIndex = Math.max(path.lastIndexOf('\\'), path.lastIndexOf('/'));
        int rightIndex = path.lastIndexOf(".");

        return path.substring(leftIndex < 0 ? 0 : leftIndex + 1, rightIndex);
    }

    /**
     * 打印对象 {@link #toString()} 方法的 byte[]
     */
    public static byte[] toBytes(Object source) {
        return String.valueOf(source).getBytes(Charset.forName("UTF-8"));
    }

}


text:
Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.

Follow up: Could you implement a solution using only O(1) extra space complexity and O(n) runtime complexity?

### Example 1

```
Input: [3,0,1]
Output: 2
Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it does not appear in nums.
```

### Example 2:

```
Input: nums = [0,1]
Output: 2
Explanation: n = 2 since there are 2 numbers, so all numbers are in the range [0,2]. 2 is the missing number in the range since it does not appear in nums.
```

### Example 3:

```
Input: nums = [9,6,4,2,3,5,7,0,1]
Output: 8
Explanation: n = 9 since there are 9 numbers, so all numbers are in the range [0,9]. 8 is the missing number in the range since it does not appear in nums.
```

### Example 4:

```
Input: nums = [0]
Output: 1
Explanation: n = 1 since there is 1 number, so all numbers are in the range [0,1]. 1 is the missing number in the range since it does not appear in nums.
```

### Constraints:

- n == nums.length
- 1 <= n <= 10^4
- 0 <= nums[i] <= n
- All the numbers of nums are unique.

## Solution

Two different O(1) space complexity approaches

1. XOR all the indices [0..n-1] and numbers and the number n, all the matches will even out and the missing number will leave at the end.
2. Sum all the numbers up, the missing number is (n)\*(n+1)/2 - sum.

#FB #MSFT #BBG

#Array #Math #Bit Manipulation


text:
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="90">
  <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
    <logicalFolder name="HeaderFiles"
                   displayName="Header Files"
                   projectFiles="true">
      <itemPath>svmlight/kernel.h</itemPath>
      <itemPath>libsvm/libsvm.h</itemPath>
      <itemPath>libsvm/svm.h</itemPath>
      <itemPath>svmlight/svm_common.h</itemPath>
      <itemPath>svmlight/svm_learn.h</itemPath>
      <itemPath>svmlight/svmlight.h</itemPath>
    </logicalFolder>
    <logicalFolder name="ResourceFiles"
                   displayName="Resource Files"
                   projectFiles="true">
      <itemPath>ApacheLicense2.txt</itemPath>
      <itemPath>Readme.md</itemPath>
    </logicalFolder>
    <logicalFolder name="SourceFiles"
                   displayName="Source Files"
                   projectFiles="true">
      <logicalFolder name="f2" displayName="genfiles" projectFiles="true">
      </logicalFolder>
      <logicalFolder name="libsvm" displayName="libsvm" projectFiles="true">
        <itemPath>libsvm/svm.cpp</itemPath>
      </logicalFolder>
      <logicalFolder name="svmlight" displayName="svmlight" projectFiles="true">
        <itemPath>svmlight/svm_common.c</itemPath>
        <itemPath>svmlight/svm_hideo.c</itemPath>
        <itemPath>svmlight/svm_learn.c</itemPath>
      </logicalFolder>
      <itemPath>main.cpp</itemPath>
    </logicalFolder>
    <logicalFolder name="TestFiles"
                   displayName="Test Files"
                   projectFiles="false"
                   kind="TEST_LOGICAL_FOLDER">
    </logicalFolder>
    <logicalFolder name="ExternalFiles"
                   displayName="Important Files"
                   projectFiles="false"
                   kind="IMPORTANT_FILES_FOLDER">
      <itemPath>Makefile</itemPath>
    </logicalFolder>
  </logicalFolder>
  <sourceRootList>
    <Elem>.</Elem>
  </sourceRootList>
  <projectmakefile>Makefile</projectmakefile>
  <confs>
    <conf name="Debug" type="1">
      <toolsSet>
        <compilerSet>default</compilerSet>
        <dependencyChecking>true</dependencyChecking>
        <rebuildPropChanged>false</rebuildPropChanged>
      </toolsSet>
      <compileType>
        <ccTool>
          <commandLine>`pkg-config --cflags opencv`</commandLine>
          <useLinkerLibraries>false</useLinkerLibraries>
        </ccTool>
        <linkerTool>
          <output>opencvhogtrainer</output>
          <linkerLibItems>
            <linkerOptionItem>`pkg-config --libs opencv`</linkerOptionItem>
          </linkerLibItems>
        </linkerTool>
      </compileType>
      <item path="ApacheLicense2.txt" ex="false" tool="3" flavor2="0">
      </item>
      <item path="Readme.md" ex="false" tool="3" flavor2="0">
      </item>
      <item path="libsvm/libsvm.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="libsvm/svm.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="libsvm/svm.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="main.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="svmlight/kernel.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="svmlight/svm_common.c" ex="false" tool="0" flavor2="0">
      </item>
      <item path="svmlight/svm_common.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="svmlight/svm_hideo.c" ex="false" tool="0" flavor2="0">
      </item>
      <item path="svmlight/svm_learn.c" ex="false" tool="0" flavor2="0">
      </item>
      <item path="svmlight/svm_learn.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="svmlight/svmlight.h" ex="false" tool="3" flavor2="0">
      </item>
    </conf>
    <conf name="Release" type="1">
      <toolsSet>
        <compilerSet>default</compilerSet>
        <dependencyChecking>true</dependencyChecking>
        <rebuildPropChanged>false</rebuildPropChanged>
      </toolsSet>
      <compileType>
        <cTool>
          <developmentMode>5</developmentMode>
        </cTool>
        <ccTool>
          <developmentMode>5</developmentMode>
          <incDir>
            <pElem>/usr/local/include/opencv2</pElem>
          </incDir>
        </ccTool>
        <fortranCompilerTool>
          <developmentMode>5</developmentMode>
        </fortranCompilerTool>
        <asmTool>
          <developmentMode>5</developmentMode>
        </asmTool>
        <linkerTool>
          <linkerLibItems>
            <linkerLibLibItem>opencv_calib3d</linkerLibLibItem>
            <linkerLibLibItem>opencv_contrib</linkerLibLibItem>
            <linkerLibLibItem>opencv_core</linkerLibLibItem>
            <linkerLibLibItem>opencv_features2d</linkerLibLibItem>
            <linkerLibLibItem>opencv_flann</linkerLibLibItem>
            <linkerLibLibItem>opencv_gpu</linkerLibLibItem>
            <linkerLibLibItem>opencv_highgui</linkerLibLibItem>
            <linkerLibLibItem>opencv_imgproc</linkerLibLibItem>
            <linkerLibLibItem>opencv_legacy</linkerLibLibItem>
            <linkerLibLibItem>opencv_ml</linkerLibLibItem>
            <linkerLibLibItem>opencv_objdetect</linkerLibLibItem>
            <linkerLibLibItem>opencv_ts</linkerLibLibItem>
            <linkerLibLibItem>opencv_video</linkerLibLibItem>
          </linkerLibItems>
        </linkerTool>
      </compileType>
      <item path="ApacheLicense2.txt" ex="false" tool="3" flavor2="0">
      </item>
      <item path="Readme.md" ex="false" tool="3" flavor2="0">
      </item>
      <item path="libsvm/libsvm.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="libsvm/svm.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="libsvm/svm.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="main.cpp" ex="false" tool="1" flavor2="0">
      </item>
      <item path="svmlight/kernel.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="svmlight/svm_common.c" ex="false" tool="0" flavor2="0">
      </item>
      <item path="svmlight/svm_common.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="svmlight/svm_hideo.c" ex="false" tool="0" flavor2="0">
      </item>
      <item path="svmlight/svm_learn.c" ex="false" tool="0" flavor2="0">
      </item>
      <item path="svmlight/svm_learn.h" ex="false" tool="3" flavor2="0">
      </item>
      <item path="svmlight/svmlight.h" ex="false" tool="3" flavor2="0">
      </item>
    </conf>
  </confs>
</configurationDescriptor>


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="pl.edu.agh.marims.demo">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name="pl.edu.agh.marims.demo.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar"
            android:windowSoftInputMode="stateHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
module.exports = publish

var npm = require("./npm.js")
  , registry = require("./utils/npm-registry-client/index.js")
  , log = require("./utils/log.js")
  , tar = require("./utils/tar.js")
  , sha = require("./utils/sha.js")
  , path = require("path")
  , readJson = require("./utils/read-json.js")
  , fs = require("graceful-fs")
  , lifecycle = require("./utils/lifecycle.js")
  , chain = require("slide").chain

publish.usage = "npm publish <tarball>"
              + "\nnpm publish <folder>"
              + "\n\nPublishes '.' if no argument supplied"

publish.completion = function (opts, cb) {
  // publish can complete to a folder with a package.json
  // or a tarball, or a tarball url.
  // for now, not yet implemented.
  return cb()
}

function publish (args, isRetry, cb) {
  if (typeof cb !== "function") cb = isRetry, isRetry = false
  if (args.length === 0) args = ["."]
  if (args.length !== 1) return cb(publish.usage)
  log.verbose(args, "publish")
  var arg = args[0]
  // if it's a local folder, then run the prepublish there, first.
  readJson(path.resolve(arg, "package.json"), function (er, data) {
    // error is ok.  could be publishing a url or tarball
    if (er) return cacheAddPublish(arg, false, isRetry, cb)
    lifecycle(data, "prepublish", arg, function (er) {
      if (er) return cb(er)
      cacheAddPublish(arg, true, isRetry, cb)
    })
  })
}

function cacheAddPublish (arg, didPre, isRetry, cb) {
  npm.commands.cache.add(arg, function (er, data) {
    if (er) return cb(er)
    log.silly(data, "publish")
    var cachedir = path.resolve( npm.cache
                               , data.name
                               , data.version
                               , "package" )
    chain
      ( [ !didPre && [lifecycle, data, "prepublish", cachedir]
        , [publish_, arg, data, isRetry, cachedir]
        , [lifecycle, data, "publish", cachedir]
        , [lifecycle, data, "postpublish", cachedir] ]
      , cb )
  })
}

function publish_ (arg, data, isRetry, cachedir, cb) {
  if (!data) return cb(new Error("no package.json file found"))

  // check for publishConfig hash
  if (data.publishConfig) {
    Object.keys(data.publishConfig).forEach(function (k) {
      log.info(k + "=" + data.publishConfig[k], "publishConfig")
      npm.config.set(k, data.publishConfig[k])
    })
  }

  delete data.modules
  if (data.private) return cb(new Error
    ("This package has been marked as private\n"
    +"Remove the 'private' field from the package.json to publish it."))

  // pre-build
  var bd = data.scripts
           && ( data.scripts.preinstall
             || data.scripts.install
             || data.scripts.postinstall )
           && npm.config.get("bindist")
           && npm.config.get("bin-publish")
  preBuild(data, bd, function (er, tb) {
    if (er) return cb(er)
    return regPublish(data, tb, isRetry, arg, cachedir, cb)
  })
}

function preBuild (data, bd, cb) {
  if (!bd) return cb()
  // unpack to cache/n/v/build
  // build there
  // pack to cache/package-<bd>.tgz
  var cf = path.resolve(npm.cache, data.name, data.version)
  var pb = path.resolve(cf, "build")
    , buildTarget = path.resolve(pb, "node_modules", data.name)
    , tb = path.resolve(cf, "package-"+bd+".tgz")
    , sourceBall = path.resolve(cf, "package.tgz")

  log.verbose("about to cache unpack")
  log.verbose(sourceBall, "the tarball")
  npm.commands.install(pb, sourceBall, function (er) {
    log.info(data._id, "prebuild done")
    // build failure just means that we can't prebuild
    if (er) {
      log.warn(er.message, "prebuild failed "+bd)
      return cb()
    }
    // now strip the preinstall/install scripts
    // they've already been run.
    var pbj = path.resolve(buildTarget, "package.json")
    readJson(pbj, function (er, pbo) {
      if (er) return cb(er)
      if (pbo.scripts) {
        delete pbo.scripts.preinstall
        delete pbo.scripts.install
        delete pbo.scripts.postinstall
      }
      pbo.prebuilt = bd
      pbo.files = pbo.files || []
      pbo.files.push("build")
      pbo.files.push("build/")
      pbo.files.push("*.node")
      pbo.files.push("*.js")
      fs.writeFile(pbj, JSON.stringify(pbo, null, 2), function (er) {
        if (er) return cb(er)
        tar.pack(tb, buildTarget, pbo, true, function (er) {
          if (er) return cb(er)
          // try to validate the shasum, too
          sha.get(tb, function (er, shasum) {
            if (er) return cb(er)
            // binary distribution requires shasum checking.
            if (!shasum) return cb()
            data.dist.bin = data.dist.bin || {}
            data.dist.bin[bd] = data.dist.bin[bd] || {}
            data.dist.bin[bd].shasum = shasum
            return cb(null, tb)
          })
        })
      })
    })
  })
}

function regPublish (data, prebuilt, isRetry, arg, cachedir, cb) {
  // check to see if there's a README.md in there.
  var readme = path.resolve(cachedir, "README.md")
  fs.readFile(readme, function (er, readme) {
    // ignore error.  it's an optional feature
    registry.publish(data, prebuilt, readme, function (er) {
      if (er && er.errno === npm.EPUBLISHCONFLICT
          && npm.config.get("force") && !isRetry) {
        log.warn("Forced publish over "+data._id, "publish")
        return npm.commands.unpublish([data._id], function (er) {
          // ignore errors.  Use the force.  Reach out with your feelings.
          publish([arg], true, cb)
        })
      }
      cb(er)
    })
  })
}


text: <ng-include src="'plugins/mortuary/manage-body.html'"></ng-include>


text:
package org.cukesalad.juggler;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.cukesalad.context.ContextHook;
import org.cukesalad.context.CukeSaladContext;
import org.cukesalad.context.TestUtil;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import cucumber.api.DataTable;
import cucumber.api.java.en.Given;

public class ContextJugglerTest {

  TestUtil testutil;

  @BeforeClass
  public static void setUpBeforeClass() throws Exception {}

  @AfterClass
  public static void tearDownAfterClass() throws Exception {}

  @Before
  public void setUp() throws Exception {
    testutil = new TestUtil();
    ContextHook hook = new ContextHook();
    hook.beforeHook();
  }

  @After
  public void tearDown() throws Exception {
    ContextHook hook = new ContextHook();
    hook.afterHook();

  }

  @Test
  public void testJuggle() {
    CukeSaladContext.addToContext("status", String.class, "working");
    //CukeSaladContext.getCurrentContext().setVariable("status", new ExpressionFactoryImpl().createValueExpression("working", String.class));
    testutil.test("aspect is ${status}");
  }

  @Test
  public void testJuggleDataTable() {
    //setting context
    List<Map<String, String>> contextObject = new ArrayList<Map<String,String>>();
    Map<String, String> character = new HashMap<String, String>();
    character.put("name", "Ned");
    character.put("house", "Stark");
    character.put("place", "winterfell");
    contextObject.add(character);
    character = new HashMap<String, String>();
    character.put("name", "Tyrion");
    character.put("house", "Lanister");
    character.put("place", "casterly rock");
    contextObject.add(character);
    character = new HashMap<String, String>();
    character.put("name", "Drogo");
    character.put("house", "Dothraki");
    character.put("place", "vas dothrak");
    contextObject.add(character);
    character = new HashMap<String, String>();
    character.put("name", "Robert");
    character.put("house", "Baratheon");
    character.put("place", "storms end");
    contextObject.add(character);
    CukeSaladContext.addToContext("characters", List.class, contextObject);

    List<List<String>> raw = new ArrayList<List<String>>();
    raw.add(Arrays.asList("name","house","place"));
    raw.add(Arrays.asList("${characters[0].name}","${characters[0].house}","${characters[0].place}"));
    raw.add(Arrays.asList("${characters[1].name}","${characters[1].house}","${characters[1].place}"));
    raw.add(Arrays.asList("${characters[2].name}","${characters[2].house}","${characters[2].place}"));
    raw.add(Arrays.asList("${characters[3].name}","${characters[3].house}","${characters[3].place}"));
    DataTable actual = DataTable.create(raw );

    testutil.testDataTable(actual);
  }

}


text:
<?php

function flash($title=null, $message=null, $level='info')
{
    $flash = app('App\Http\Flash');

    if (func_num_args() == 0) {
        return $flash;
    }

    return $flash->info($title,$message);
}


text:
span.sf-sub-indicator { padding-left: 2px; }
div#header { z-index: 2; position: relative; }
div#featured-slider { z-index: 1; position: relative; }
span.feat-overlay { cursor: pointer; }
div#main-area div#from-blog div.content { height: 1%; }
div#from-blog div.content div.post { position: relative !important; }
div#footer-widget-area  div.project-popup a { cursor: pointer; }
div#main-area-wrap { display: block; height: 35px; zoom: 1; padding: 0px; }
div.footer-widget a { color:#A6AEB4 !important; }
div.footer-widget a:hover { color: #ffffff !important; }
div#main-area a.readmore span, div#footer-widget-area a.readmore span, a.comment-reply-link { display: inline-block; padding:3px 12px 5px 0; cursor: pointer; }
div#main-area div#from-blog ul.control li.ui-state-active a { background: url(images/active-bg.jpg) repeat-x left bottom; }
.js #featured-slider, .js div#recent-projects, .js div#from-blog div.content {display: block;}
#main .wp-pagenavi span.pages { display: inline-block; }
div.cat-meta-top { margin-bottom: -8px; }
div.comment-body { overflow:hidden !important; height: 1%; }

#main ol.commentlist ul.children { margin-left: 83px; }


text:
#ifndef ZEPHYR_INCLUDE_DRIVERS_PCIE_MSI_H_
#define ZEPHYR_INCLUDE_DRIVERS_PCIE_MSI_H_

#include <kernel.h>
#include <zephyr/types.h>
#include <stdbool.h>

#include <drivers/pcie/pcie.h>

#ifdef __cplusplus
extern "C" {
#endif

struct msix_vector {
	uint32_t msg_addr;
	uint32_t msg_up_addr;
	uint32_t msg_data;
	uint32_t vector_ctrl;
};

struct msi_vector {
	pcie_bdf_t bdf;
	arch_msi_vector_t arch;
#ifdef CONFIG_PCIE_MSI_X
	struct msix_vector *msix_vector;
	bool msix;
#endif /* CONFIG_PCIE_MSI_X */
};

typedef struct msi_vector msi_vector_t;

#ifdef CONFIG_PCIE_MSI_MULTI_VECTOR

/**
 * @brief Allocate vector(s) for the endpoint MSI message(s)
 *
 * @param bdf the target PCI endpoint
 * @param priority the MSI vectors base interrupt priority
 * @param vectors an array for storing allocated MSI vectors
 * @param n_vector the size of the MSI vectors array
 *
 * @return the number of allocated MSI vectors.
 */
extern uint8_t pcie_msi_vectors_allocate(pcie_bdf_t bdf,
					 unsigned int priority,
					 msi_vector_t *vectors,
					 uint8_t n_vector);

/**
 * @brief Connect the MSI vector to the handler
 *
 * @param bdf the target PCI endpoint
 * @param vector the MSI vector to connect
 * @param routine Interrupt service routine
 * @param parameter ISR parameter
 * @param flags Arch-specific IRQ configuration flag
 *
 * @return True on success, false otherwise
 */
extern bool pcie_msi_vector_connect(pcie_bdf_t bdf,
				    msi_vector_t *vector,
				    void (*routine)(const void *parameter),
				    const void *parameter,
				    uint32_t flags);

#endif /* CONFIG_PCIE_MSI_MULTI_VECTOR */

/**
 * @brief Compute the target address for an MSI posted write.
 *
 * This function is exported by the arch, board or SoC code.
 *
 * @param irq The IRQ we wish to trigger via MSI.
 * @param vector The vector for which you want the address (or NULL)
 * @return A (32-bit) value for the MSI MAP register.
 */
extern uint32_t pcie_msi_map(unsigned int irq,
			     msi_vector_t *vector);

/**
 * @brief Compute the data for an MSI posted write.
 *
 * This function is exported by the arch, board or SoC code.
 *
 * @param irq The IRQ we wish to trigger via MSI.
 * @param vector The vector for which you want the data (or NULL)
 * @return A (16-bit) value for MSI MDR register.
 */
extern uint16_t pcie_msi_mdr(unsigned int irq,
			     msi_vector_t *vector);

/**
 * @brief Configure the given PCI endpoint to generate MSIs.
 *
 * @param bdf the target PCI endpoint
 * @param vectors an array of allocated vector(s)
 * @param n_vector the size of the vector array
 * @return true if the endpoint supports MSI, false otherwise.
 */
extern bool pcie_msi_enable(pcie_bdf_t bdf,
			    msi_vector_t *vectors,
			    uint8_t n_vector);

/*
 * MSI capability IDs in the PCI configuration capability list.
 */

#define PCIE_MSI_CAP_ID		0x05U
#define PCIE_MSIX_CAP_ID	0x11U

/*
 * The first word of the MSI capability is shared with the
 * capability ID and list link.  The high 16 bits are the MCR.
 */

#define PCIE_MSI_MCR		0U

#define PCIE_MSI_MCR_EN		0x00010000U  /* enable MSI */
#define PCIE_MSI_MCR_MMC	0x000E0000U  /* Multi Messages Capable mask */
#define PCIE_MSI_MCR_MMC_SHIFT	17
#define PCIE_MSI_MCR_MME	0x00700000U  /* mask of # of enabled IRQs */
#define PCIE_MSI_MCR_MME_SHIFT	20
#define PCIE_MSI_MCR_64		0x00800000U  /* 64-bit MSI */

/*
 * The MAP follows the MCR. If PCIE_MSI_MCR_64, then the MAP
 * is two words long. The MDR follows immediately after the MAP.
 */

#define PCIE_MSI_MAP0		1U
#define PCIE_MSI_MAP1_64	2U
#define PCIE_MSI_MDR_32		2U
#define PCIE_MSI_MDR_64		3U

/*
 * As for MSI, he first word of the MSI-X capability is shared
 * with the capability ID and list link.  The high 16 bits are the MCR.
 */

#define PCIE_MSIX_MCR			0U

#define PCIE_MSIX_MCR_EN		0x80000000U /* Enable MSI-X */
#define PCIE_MSIX_MCR_FMASK		0x40000000U /* Function Mask */
#define PCIE_MSIX_MCR_TSIZE		0x07FF0000U /* Table size mask */
#define PCIE_MSIX_MCR_TSIZE_SHIFT	16
#define PCIE_MSIR_TABLE_ENTRY_SIZE	16

#define PCIE_MSIX_TR			1U
#define PCIE_MSIX_TR_BIR		0x00000007U /* BIR mask */
#define PCIE_MSIX_TR_OFFSET		0xFFFFFFF8U /* Offset mask */

#define PCIE_VTBL_MA			0U /* Msg Address offset */
#define PCIE_VTBL_MUA			4U /* Msg Upper Address offset */
#define PCIE_VTBL_MD			8U /* Msg Data offset */
#define PCIE_VTBL_VCTRL			12U /* Vector control offset */

#ifdef __cplusplus
}
#endif

#endif /* ZEPHYR_INCLUDE_DRIVERS_PCIE_MSI_H_ */


text:
'use strict';

const {tokenize} = require('../lib/parser');
const Interaction = require('../lib/interaction');

module.exports = async (ctx, bot, message) => {
  // avoid getting caught in bot spam loops
  if (message.author.bot) return;
  // don't accept multi-line input, only the first one counts
  const [content] = message.content.split('\n');
  // only respond to commands using the configured prefix
  if (content.indexOf(bot.prefix) !== 0) return;
  // the first token (sans prefix) should map to a command
  const argv = tokenize(content.slice(bot.prefix.length));
  const alias = argv.shift().toLowerCase();
  const command = bot.commands.get(alias) || bot.commands.get(bot.aliases.get(alias));
  if (!command) return;

  const interaction = await Interaction.record(ctx, message, command, alias);
  const result = {};
  try {
    let output = await command.run(ctx, bot, message, argv) || {};
    if (typeof output === 'object' && !Array.isArray(output)) {
      Object.assign(result, JSON.parse(JSON.stringify(output)));
    } else {
      result.output = output;
    }
  } catch (err) {
    ctx.log(`Encountered an error while running ${command.help.name}.`, 'error', err);
    result.error = err.toString().slice(0, 256);
  }
  await interaction.update({properties: result});
};


text:
using GalaSoft.MvvmLight;

namespace HeroesMatchTracker.Core.Models.GraphSummaryModels
{
    public abstract class GraphSummaryBase : ObservableObject
    {
        public string GraphTeam1Title { get; private set; } = "Team 1";
        public string GraphTeam2Title { get; private set; } = "Team 2";

        public abstract void Dispose();

        protected void SetWinner(bool isTeam1Winner)
        {
            if (isTeam1Winner)
                GraphTeam1Title = "Team 1 (WINNER)";
            else
                GraphTeam2Title = "Team 2 (WINNER)";
        }

        protected void ClearWinner()
        {
            GraphTeam1Title = "Team 1";
            GraphTeam2Title = "Team 2";
        }
    }
}


text:
package net.cattaka.util.cathandsgendroid.accessor;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import android.content.ContentValues;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * The collections of standard accessors.
 *
 * @author cattaka
 */
public class Accessors {
    /**
     * The accessor for byte.
     */
    public static class PrimitiveByteAccessor implements IAccessor<Byte> {
        static PrimitiveByteAccessor instance;

        public static IAccessor<Byte> createAccessor(Class<Byte> clazz) {
            if (instance == null) {
                instance = new PrimitiveByteAccessor();
            }
            return instance;
        }

        @Override
        public Byte readFromStream(DataInputStream in) throws IOException {
            return in.readByte();
        }

        @Override
        public void writeToStream(DataOutputStream out, Byte value) throws IOException {
            out.writeByte(value);
        }

        @Override
        public Byte readFromParcel(Parcel p) {
            return p.readByte();
        }

        @Override
        public void writeToParcel(Parcel p, Byte value) {
            p.writeByte(value);
        }

        @Override
        public Byte readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : (byte)c.getShort(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Byte value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Byte value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for short.
     */
    public static class PrimitiveShortAccessor implements IAccessor<Short> {
        static PrimitiveShortAccessor instance;

        public static IAccessor<Short> createAccessor(Class<Short> clazz) {
            if (instance == null) {
                instance = new PrimitiveShortAccessor();
            }
            return instance;
        }

        @Override
        public Short readFromStream(DataInputStream in) throws IOException {
            return (short)in.readInt();
        }

        @Override
        public void writeToStream(DataOutputStream out, Short value) throws IOException {
            out.writeInt(value);
        }

        @Override
        public Short readFromParcel(Parcel p) {
            return (short)p.readInt();
        }

        @Override
        public void writeToParcel(Parcel p, Short value) {
            p.writeInt(value);
        }

        @Override
        public Short readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getShort(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Short value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Short value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for int.
     */
    public static class PrimitiveIntegerAccessor implements IAccessor<Integer> {
        static PrimitiveIntegerAccessor instance;

        public static IAccessor<Integer> createAccessor(Class<Integer> clazz) {
            if (instance == null) {
                instance = new PrimitiveIntegerAccessor();
            }
            return instance;
        }

        @Override
        public Integer readFromStream(DataInputStream in) throws IOException {
            return in.readInt();
        };

        @Override
        public void writeToStream(DataOutputStream out, Integer value) throws IOException {
            out.writeInt(value);
        }

        @Override
        public Integer readFromParcel(Parcel p) {
            return p.readInt();
        }

        @Override
        public void writeToParcel(Parcel p, Integer value) {
            p.writeInt(value);
        }

        @Override
        public Integer readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getInt(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Integer value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Integer value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for long.
     */
    public static class PrimitiveLongAccessor implements IAccessor<Long> {
        static PrimitiveLongAccessor instance;

        public static IAccessor<Long> createAccessor(Class<Long> clazz) {
            if (instance == null) {
                instance = new PrimitiveLongAccessor();
            }
            return instance;
        }

        @Override
        public Long readFromStream(DataInputStream in) throws IOException {
            return in.readLong();
        }

        @Override
        public void writeToStream(DataOutputStream out, Long value) throws IOException {
            out.writeLong(value);
        }

        @Override
        public Long readFromParcel(Parcel p) {
            return p.readLong();
        }

        @Override
        public void writeToParcel(Parcel p, Long value) {
            p.writeLong(value);
        }

        @Override
        public Long readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getLong(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Long value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Long value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for float.
     */
    public static class PrimitiveFloatAccessor implements IAccessor<Float> {
        static PrimitiveFloatAccessor instance;

        public static IAccessor<Float> createAccessor(Class<Float> clazz) {
            if (instance == null) {
                instance = new PrimitiveFloatAccessor();
            }
            return instance;
        }

        @Override
        public Float readFromStream(DataInputStream in) throws IOException {
            return in.readFloat();
        }

        @Override
        public void writeToStream(DataOutputStream out, Float value) throws IOException {
            out.writeFloat(value);
        }

        @Override
        public Float readFromParcel(Parcel p) {
            return p.readFloat();
        }

        @Override
        public void writeToParcel(Parcel p, Float value) {
            p.writeFloat(value);
        }

        @Override
        public Float readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getFloat(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Float value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Float value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for double.
     */
    public static class PrimitiveDoubleAccessor implements IAccessor<Double> {
        static PrimitiveDoubleAccessor instance;

        public static IAccessor<Double> createAccessor(Class<Double> clazz) {
            if (instance == null) {
                instance = new PrimitiveDoubleAccessor();
            }
            return instance;
        }

        @Override
        public Double readFromStream(DataInputStream in) throws IOException {
            return in.readDouble();
        }

        @Override
        public void writeToStream(DataOutputStream out, Double value) throws IOException {
            out.writeDouble(value);
        }

        @Override
        public Double readFromParcel(Parcel p) {
            return p.readDouble();
        }

        @Override
        public void writeToParcel(Parcel p, Double value) {
            p.writeDouble(value);
        }

        @Override
        public Double readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getDouble(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Double value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Double value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for char.
     */
    public static class PrimitiveCharacterAccessor implements IAccessor<Character> {
        static PrimitiveCharacterAccessor instance;

        public static IAccessor<Character> createAccessor(Class<Character> clazz) {
            if (instance == null) {
                instance = new PrimitiveCharacterAccessor();
            }
            return instance;
        }

        @Override
        public Character readFromStream(DataInputStream in) throws IOException {
            return in.readChar();
        }

        @Override
        public void writeToStream(DataOutputStream out, Character value) throws IOException {
            out.writeChar(value);
        }

        @Override
        public Character readFromParcel(Parcel p) {
            return (char)p.readInt();
        }

        @Override
        public void writeToParcel(Parcel p, Character value) {
            p.writeInt(value);
        }

        @Override
        public Character readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : (char)c.getShort(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Character value) {
            values.put(columnName, (value != null) ? (short)value.charValue() : null);
        }

        @Override
        public String stringValue(Character value) {
            return (value != null) ? String.valueOf((short)value.charValue()) : null;
        };
    };

    /**
     * The accessor for boolean.
     */
    public static class PrimitiveBooleanAccessor implements IAccessor<Boolean> {
        static PrimitiveBooleanAccessor instance;

        public static IAccessor<Boolean> createAccessor(Class<Boolean> clazz) {
            if (instance == null) {
                instance = new PrimitiveBooleanAccessor();
            }
            return instance;
        }

        @Override
        public Boolean readFromStream(DataInputStream in) throws IOException {
            return in.readBoolean();
        }

        @Override
        public void writeToStream(DataOutputStream out, Boolean value) throws IOException {
            out.writeBoolean(value);
        }

        @Override
        public Boolean readFromParcel(Parcel p) {
            return p.readByte() != 0;
        }

        @Override
        public void writeToParcel(Parcel p, Boolean value) {
            p.writeByte(value ? (byte)1 : 0);
        }

        @Override
        public Boolean readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : (c.getShort(idx) != 0));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Boolean value) {
            values.put(columnName, (value != null) ? (short)(value ? 1 : 0) : null);
        }

        @Override
        public String stringValue(Boolean value) {
            return (value != null) ? String.valueOf(value ? 1 : 0) : null;
        };
    };

    /**
     * The accessor for {@link Byte}.
     */
    public static class ByteAccessor implements IAccessor<Byte> {
        static ByteAccessor instance;

        public static IAccessor<Byte> createAccessor(Class<Byte> clazz) {
            if (instance == null) {
                instance = new ByteAccessor();
            }
            return instance;
        }

        @Override
        public Byte readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readByte() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Byte value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeByte(value);
            }
        }

        @Override
        public Byte readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? p.readByte() : null;
        }

        @Override
        public void writeToParcel(Parcel p, Byte value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeByte(value);
            }
        }

        @Override
        public Byte readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : (byte)c.getInt(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Byte value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Byte value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for {@link Short}.
     */
    public static class ShortAccessor implements IAccessor<Short> {
        static ShortAccessor instance;

        public static IAccessor<Short> createAccessor(Class<Short> clazz) {
            if (instance == null) {
                instance = new ShortAccessor();
            }
            return instance;
        }

        @Override
        public Short readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readShort() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Short value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeShort(value);
            }
        }

        @Override
        public Short readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? (short)p.readInt() : null;
        }

        @Override
        public void writeToParcel(Parcel p, Short value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeInt(value);
            }
        }

        @Override
        public Short readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx)) ? null : c.getShort(idx);
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Short value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Short value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for {@link Integer}.
     */
    public static class IntegerAccessor implements IAccessor<Integer> {
        static IntegerAccessor instance;

        public static IAccessor<Integer> createAccessor(Class<Integer> clazz) {
            if (instance == null) {
                instance = new IntegerAccessor();
            }
            return instance;
        }

        @Override
        public Integer readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readInt() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Integer value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeInt(value);
            }
        }

        @Override
        public Integer readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? p.readInt() : null;
        }

        @Override
        public void writeToParcel(Parcel p, Integer value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeInt(value);
            }
        }

        @Override
        public Integer readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getInt(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Integer value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Integer value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for {@link Long}.
     */
    public static class LongAccessor implements IAccessor<Long> {
        static LongAccessor instance;

        public static IAccessor<Long> createAccessor(Class<Long> clazz) {
            if (instance == null) {
                instance = new LongAccessor();
            }
            return instance;
        }

        @Override
        public Long readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readLong() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Long value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeLong(value);
            }
        }

        @Override
        public Long readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? p.readLong() : null;
        }

        @Override
        public void writeToParcel(Parcel p, Long value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeLong(value);
            }
        }

        @Override
        public Long readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getLong(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Long value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Long value) {
            return (value != null) ? String.valueOf(value) : null;
        };
    };

    /**
     * The accessor for {@link Float}.
     */
    public static class FloatAccessor implements IAccessor<Float> {
        static FloatAccessor instance;

        public static IAccessor<Float> createAccessor(Class<Float> clazz) {
            if (instance == null) {
                instance = new FloatAccessor();
            }
            return instance;
        }

        @Override
        public Float readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readFloat() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Float value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeFloat(value);
            }
        }

        @Override
        public Float readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? p.readFloat() : null;
        }

        @Override
        public void writeToParcel(Parcel p, Float value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeFloat(value);
            }
        }

        @Override
        public Float readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getFloat(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Float value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Float value) {
            return String.valueOf(value);
        };
    };

    /**
     * The accessor for {@link Double}.
     */
    public static class DoubleAccessor implements IAccessor<Double> {
        static DoubleAccessor instance;

        public static IAccessor<Double> createAccessor(Class<Double> clazz) {
            if (instance == null) {
                instance = new DoubleAccessor();
            }
            return instance;
        }

        @Override
        public Double readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readDouble() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Double value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeDouble(value);
            }
        }

        @Override
        public Double readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? p.readDouble() : null;
        }

        @Override
        public void writeToParcel(Parcel p, Double value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeDouble(value);
            }
        }

        @Override
        public Double readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : c.getDouble(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Double value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(Double value) {
            return String.valueOf(value);
        };
    };

    /**
     * The accessor for {@link Character}.
     */
    public static class CharacterAccessor implements IAccessor<Character> {
        static CharacterAccessor instance;

        public static IAccessor<Character> createAccessor(Class<Character> clazz) {
            if (instance == null) {
                instance = new CharacterAccessor();
            }
            return instance;
        }

        @Override
        public Character readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readChar() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Character value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeChar(value);
            }
        }

        @Override
        public Character readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? (char)p.readInt() : null;
        }

        @Override
        public void writeToParcel(Parcel p, Character value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeInt(value);
            }
        }

        @Override
        public Character readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : (char)c.getShort(idx));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Character value) {
            values.put(columnName, (value != null) ? (short)value.charValue() : null);
        }

        @Override
        public String stringValue(Character value) {
            return (value != null) ? String.valueOf((short)value.charValue()) : null;
        };
    };

    /**
     * The accessor for {@link Boolean}.
     */
    public static class BooleanAccessor implements IAccessor<Boolean> {
        static BooleanAccessor instance;

        public static IAccessor<Boolean> createAccessor(Class<Boolean> clazz) {
            if (instance == null) {
                instance = new BooleanAccessor();
            }
            return instance;
        }

        @Override
        public Boolean readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readBoolean() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Boolean value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeBoolean(value);
            }
        }

        @Override
        public Boolean readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? (p.readByte() != 0) : null;
        }

        @Override
        public void writeToParcel(Parcel p, Boolean value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeByte(value ? (byte)1 : 0);
            }
        }

        @Override
        public Boolean readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : (c.getShort(idx) != 0));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Boolean value) {
            values.put(columnName, (value != null) ? (short)(value ? 1 : 0) : null);
        }

        @Override
        public String stringValue(Boolean value) {
            return (value != null) ? String.valueOf(value ? 1 : 0) : null;
        };
    };

    /**
     * The accessor for {@link String}.
     */
    public static class StringAccessor implements IAccessor<String> {
        static StringAccessor instance;

        public static IAccessor<String> createAccessor(Class<String> clazz) {
            if (instance == null) {
                instance = new StringAccessor();
            }
            return instance;
        }

        @Override
        public String readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? in.readUTF() : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, String value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeUTF(value);
            }
        }

        @Override
        public String readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? p.readString() : null;
        }

        @Override
        public void writeToParcel(Parcel p, String value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeString(value);
            }
        }

        @Override
        public String readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : (c.getString(idx)));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, String value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(String value) {
            return (value != null) ? value : null;
        };
    };

    /**
     * The accessor for byte[].
     */
    public static class BlobAccessor implements IAccessor<byte[]> {
        static BlobAccessor instance;

        public static IAccessor<byte[]> createAccessor(Class<byte[]> clazz) {
            if (instance == null) {
                instance = new BlobAccessor();
            }
            return instance;
        }

        @Override
        public byte[] readFromStream(DataInputStream in) throws IOException {
            int n = in.readInt();
            if (n >= 0) {
                byte[] bs = new byte[n];
                in.read(bs, 0, n);
                return bs;
            } else {
                return null;
            }
        }

        @Override
        public void writeToStream(DataOutputStream out, byte[] value) throws IOException {
            if (value != null) {
                out.writeInt(value.length);
                out.write(value);
            } else {
                out.writeInt(-1);
            }
        }

        @Override
        public byte[] readFromParcel(Parcel p) {
            int n = p.readInt();
            if (n >= 0) {
                byte[] bs = new byte[n];
                p.readByteArray(bs);
                return bs;
            } else {
                return null;
            }
        }

        @Override
        public void writeToParcel(Parcel p, byte[] value) {
            if (value != null) {
                p.writeInt(value.length);
                p.writeByteArray(value);
            } else {
                p.writeInt(-1);
            }
        }

        @Override
        public byte[] readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : (c.getBlob(idx)));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, byte[] value) {
            values.put(columnName, value);
        }

        @Override
        public String stringValue(byte[] value) {
            if (value == null) {
                return null;
            } else {
                StringBuilder sb = new StringBuilder();
                for (byte b : value) {
                    if (0 <= b && b < 0x10) {
                        sb.append('0');
                    }
                    sb.append(Integer.toHexString(b));
                }
                return sb.toString();
            }
        };
    };

    /**
     * The accessor for {@link Bundle}.
     */
    public static class BundleAccessor implements IAccessor<Bundle> {
        static BundleAccessor instance;

        public static IAccessor<Bundle> createAccessor(Class<Bundle> clazz) {
            if (instance == null) {
                instance = new BundleAccessor();
            }
            return instance;
        }

        @Override
        public Bundle readFromStream(DataInputStream in) throws IOException {
            return (Bundle)ParcelableAccessor.createAccessor(Parcelable.class).readFromStream(in);
        }

        @Override
        public void writeToStream(DataOutputStream out, Bundle value) throws IOException {
            ParcelableAccessor.createAccessor(Parcelable.class).writeToStream(out, value);
        }

        @Override
        public Bundle readFromParcel(Parcel p) {
            if (p.readByte() != 0) {
                return p.readBundle(Accessors.class.getClassLoader());
            } else {
                return null;
            }
        }

        @Override
        public void writeToParcel(Parcel p, Bundle value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeBundle(value);
            }
        }

        @Override
        public Bundle readFromCursor(Cursor c, int idx) {
            return (Bundle)ParcelableAccessor.createAccessor(Parcelable.class).readFromCursor(c,
                    idx);
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Bundle value) {
            ParcelableAccessor.createAccessor(Parcelable.class).putToContentValues(values,
                    columnName, value);
        }

        @Override
        public String stringValue(Bundle value) {
            return (value != null) ? value.toString() : null;
        }
    };

    /**
     * The accessor for {@link Date}.
     */
    public static class DateAccessor implements IAccessor<Date> {
        static DateAccessor instance;

        public static IAccessor<Date> createAccessor(Class<Date> clazz) {
            if (instance == null) {
                instance = new DateAccessor();
            }
            return instance;
        }

        @Override
        public Date readFromStream(DataInputStream in) throws IOException {
            return (in.readBoolean()) ? new Date(in.readLong()) : null;
        }

        @Override
        public void writeToStream(DataOutputStream out, Date value) throws IOException {
            out.writeBoolean(value != null);
            if (value != null) {
                out.writeLong(value.getTime());
            }
        }

        @Override
        public Date readFromParcel(Parcel p) {
            return (p.readByte() != 0) ? new Date(p.readLong()) : null;
        }

        @Override
        public void writeToParcel(Parcel p, Date value) {
            p.writeByte(value != null ? (byte)1 : 0);
            if (value != null) {
                p.writeLong(value.getTime());
            }
        }

        @Override
        public Date readFromCursor(Cursor c, int idx) {
            return (c.isNull(idx) ? null : new Date(c.getLong(idx)));
        }

        @Override
        public void putToContentValues(ContentValues values, String columnName, Date value) {
            values.put(columnName, (value != null) ? value.getTime() : null);
        }

        @Override
        public String stringValue(Date value) {
            return (value != null) ? String.valueOf(value.getTime()) : null;
        }
    };

    /**
     * Create the accessor for {@link List}.
     *
     * @param child accessor for inherited datatype.
     * @return created accessor
     */
    public static <T> IAccessor<List<T>> createListAccessor(final IAccessor<T> child) {
        return new IAccessor<List<T>>() {
            @Override
            public List<T> readFromStream(DataInputStream in) throws IOException {
                int n = in.readInt();
                if (n >= 0) {
                    List<T> list = new ArrayList<T>();
                    for (int i = 0; i < n; i++) {
                        list.add(child.readFromStream(in));
                    }
                    return list;
                } else {
                    return null;
                }
            }

            @Override
            public void writeToStream(DataOutputStream out, List<T> value) throws IOException {
                if (value != null) {
                    out.writeInt(value.size());
                    for (T v : value) {
                        child.writeToStream(out, v);
                    }
                } else {
                    out.writeInt(-1);
                }
            }

            @Override
            public List<T> readFromParcel(Parcel p) {
                int n = p.readInt();
                if (n >= 0) {
                    List<T> list = new ArrayList<T>();
                    for (int i = 0; i < n; i++) {
                        list.add(child.readFromParcel(p));
                    }
                    return list;
                } else {
                    return null;
                }
            }

            @Override
            public void writeToParcel(Parcel p, List<T> value) {
                if (value != null) {
                    p.writeInt(value.size());
                    for (T v : value) {
                        child.writeToParcel(p, v);
                    }
                } else {
                    p.writeInt(-1);
                }
            }

            @Override
            public List<T> readFromCursor(Cursor c, int idx) {
                byte[] bs = BlobAccessor.createAccessor(byte[].class).readFromCursor(c, idx);
                if (bs != null) {
                    try {
                        DataInputStream din = new DataInputStream(new ByteArrayInputStream(bs));
                        return readFromStream(din);
                    } catch (IOException e) {
                        return null;
                    }
                } else {
                    return null;
                }
            }

            @Override
            public void putToContentValues(ContentValues values, String columnName, List<T> value) {
                byte[] bs = null;
                if (value != null) {
                    try {
                        ByteArrayOutputStream bout = new ByteArrayOutputStream();
                        DataOutputStream dout = new DataOutputStream(bout);
                        writeToStream(dout, value);
                        dout.flush();
                        bs = bout.toByteArray();
                    } catch (IOException e) {
                        // ignore
                    }
                }
                values.put(columnName, bs);
            }

            @Override
            public String stringValue(List<T> value) {
                return value != null ? String.valueOf(value) : null;
            }
        };
    }

    /**
     * Create the accessor for {@link Set}.
     *
     * @param child accessor for inherited datatype.
     * @return created accessor
     */
    public static <T> IAccessor<Set<T>> createSetAccessor(final IAccessor<T> child) {
        return new IAccessor<Set<T>>() {
            @Override
            public Set<T> readFromStream(DataInputStream in) throws IOException {
                int n = in.readInt();
                if (n >= 0) {
                    Set<T> set = new HashSet<T>();
                    for (int i = 0; i < n; i++) {
                        set.add(child.readFromStream(in));
                    }
                    return set;
                } else {
                    return null;
                }
            }

            @Override
            public void writeToStream(DataOutputStream out, Set<T> value) throws IOException {
                if (value != null) {
                    out.writeInt(value.size());
                    for (T v : value) {
                        child.writeToStream(out, v);
                    }
                } else {
                    out.writeInt(-1);
                }
            }

            @Override
            public Set<T> readFromParcel(Parcel p) {
                int n = p.readInt();
                if (n >= 0) {
                    Set<T> set = new HashSet<T>();
                    for (int i = 0; i < n; i++) {
                        set.add(child.readFromParcel(p));
                    }
                    return set;
                } else {
                    return null;
                }
            }

            @Override
            public void writeToParcel(Parcel p, Set<T> value) {
                if (value != null) {
                    p.writeInt(value.size());
                    for (T v : value) {
                        child.writeToParcel(p, v);
                    }
                } else {
                    p.writeInt(-1);
                }
            }

            @Override
            public Set<T> readFromCursor(Cursor c, int idx) {
                byte[] bs = BlobAccessor.createAccessor(byte[].class).readFromCursor(c, idx);
                if (bs != null) {
                    try {
                        DataInputStream din = new DataInputStream(new ByteArrayInputStream(bs));
                        return readFromStream(din);
                    } catch (IOException e) {
                        return null;
                    }
                } else {
                    return null;
                }
            }

            @Override
            public void putToContentValues(ContentValues values, String columnName, Set<T> value) {
                byte[] bs = null;
                if (value != null) {
                    try {
                        ByteArrayOutputStream bout = new ByteArrayOutputStream();
                        DataOutputStream dout = new DataOutputStream(bout);
                        writeToStream(dout, value);
                        dout.flush();
                        bs = bout.toByteArray();
                    } catch (IOException e) {
                        // ignore
                    }
                }
                values.put(columnName, bs);
            }

            @Override
            public String stringValue(Set<T> value) {
                return value != null ? String.valueOf(value) : null;
            }
        };
    }

    /**
     * Create the accessor for array.
     *
     * @param child accessor for inherited datatype.
     * @return created accessor
     */
    public static <T> IAccessor<T[]> createArrayAccessor(final IAccessor<T> child,
            final Class<T> cls) {
        return new IAccessor<T[]>() {
            @Override
            public T[] readFromStream(DataInputStream in) throws IOException {
                int n = in.readInt();
                if (n >= 0) {
                    @SuppressWarnings("unchecked")
                    T[] list = (T[])Array.newInstance(cls, n);
                    for (int i = 0; i < n; i++) {
                        list[i] = child.readFromStream(in);
                    }
                    return list;
                } else {
                    return null;
                }
            }

            @Override
            public void writeToStream(DataOutputStream out, T[] value) throws IOException {
                if (value != null) {
                    out.writeInt(value.length);
                    for (T v : value) {
                        child.writeToStream(out, v);
                    }
                } else {
                    out.writeInt(-1);
                }
            }

            @Override
            public T[] readFromParcel(Parcel p) {
                int n = p.readInt();
                if (n >= 0) {
                    @SuppressWarnings("unchecked")
                    T[] list = (T[])Array.newInstance(cls, n);
                    for (int i = 0; i < n; i++) {
                        list[i] = child.readFromParcel(p);
                    }
                    return list;
                } else {
                    return null;
                }
            }

            @Override
            public void writeToParcel(Parcel p, T[] value) {
                if (value != null) {
                    p.writeInt(value.length);
                    for (T v : value) {
                        child.writeToParcel(p, v);
                    }
                } else {
                    p.writeInt(-1);
                }
            }

            @Override
            public T[] readFromCursor(Cursor c, int idx) {
                byte[] bs = BlobAccessor.createAccessor(byte[].class).readFromCursor(c, idx);
                if (bs != null) {
                    try {
                        DataInputStream din = new DataInputStream(new ByteArrayInputStream(bs));
                        return readFromStream(din);
                    } catch (IOException e) {
                        return null;
                    }
                } else {
                    return null;
                }
            }

            @Override
            public void putToContentValues(ContentValues values, String columnName, T[] value) {
                byte[] bs = null;
                if (value != null) {
                    try {
                        ByteArrayOutputStream bout = new ByteArrayOutputStream();
                        DataOutputStream dout = new DataOutputStream(bout);
                        writeToStream(dout, value);
                        dout.flush();
                        bs = bout.toByteArray();
                    } catch (IOException e) {
                        // ignore
                    }
                }
                values.put(columnName, bs);
            }

            @Override
            public String stringValue(T[] value) {
                return value != null ? String.valueOf(value) : null;
            }
        };
    }

    static byte[] toByteArray(Serializable src) {
        if (src == null) {
            return null;
        }
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutput out = null;
        try {
            out = new ObjectOutputStream(bos);
            out.writeObject(src);
            out.flush();
            return bos.toByteArray();
        } catch (IOException ex) {
            // ignore close exception
            return null;
        } finally {
            try {
                if (out != null) {
                    out.close();
                }
            } catch (IOException ex) {
                // ignore close exception
            }
            try {
                bos.close();
            } catch (IOException ex) {
                // ignore close exception
            }
        }
    }
}


text:
require 'mongo/operation/remove_user/command'
require 'mongo/operation/remove_user/op_msg'

module Mongo
  module Operation

    # A MongoDB removeuser operation.
    #
    # @api private
    #
    # @since 2.0.0
    class RemoveUser
      include Specifiable
      include OpMsgOrCommand
    end
  end
end


text:
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("ACT.SpecialSpellTimer")]
[assembly: AssemblyDescription("https://github.com/anoyetta/ACT.SpecialSpellTimer")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("anoyetta")]
[assembly: AssemblyProduct("ACT.SpecialSpellTimer")]
[assembly: AssemblyCopyright("Copyright © 2014-2018, anoyetta")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("ccf72089-92fa-4afb-bde7-869ca0e394f9")]
[assembly: AssemblyVersion("2.6.0.8")]
[assembly: AssemblyFileVersion("2.6.0.8")]


text:
package hiprus

import (
	"github.com/Sirupsen/logrus"
)

var AllLevels = []logrus.Level{
	logrus.DebugLevel,
	logrus.InfoLevel,
	logrus.WarnLevel,
	logrus.ErrorLevel,
	logrus.FatalLevel,
	logrus.PanicLevel,
}

// Returns every logging level above and including the given parameter.
func LevelThreshold(l logrus.Level) []logrus.Level {
	for i := range AllLevels {
		if AllLevels[i] == l {
			return AllLevels[i:]
		}
	}
	return []logrus.Level{}
}


text:
package nats_test

import (
	"reflect"
	"testing"
)

func assertNoError(tb testing.TB, actual error) {
	if actual != nil {
		tb.Errorf("expected no error, got %v", actual)
	}
}

func assertEqual(tb testing.TB, expected, actual interface{}) {
	if !reflect.DeepEqual(expected, actual) {
		tb.Errorf("expected %v, got %v", expected, actual)
	}
}