text:
"""
The MIT License (MIT)

Copyright (c) 2015-2019 Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

import inspect
import copy
from ._types import _BaseCommand

__all__ = (
    'CogMeta',
    'Cog',
)

class CogMeta(type):
    """A metaclass for defining a cog.

    Note that you should probably not use this directly. It is exposed
    purely for documentation purposes along with making custom metaclasses to intermix
    with other metaclasses such as the :class:`abc.ABCMeta` metaclass.

    For example, to create an abstract cog mixin class, the following would be done.

    .. code-block:: python3

        import abc

        class CogABCMeta(commands.CogMeta, abc.ABCMeta):
            pass

        class SomeMixin(metaclass=abc.ABCMeta):
            pass

        class SomeCogMixin(SomeMixin, commands.Cog, metaclass=CogABCMeta):
            pass

    .. note::

        When passing an attribute of a metaclass that is documented below, note
        that you must pass it as a keyword-only argument to the class creation
        like the following example:

        .. code-block:: python3

            class MyCog(commands.Cog, name='My Cog'):
                pass

    Attributes
    -----------
    name: :class:`str`
        The cog name. By default, it is the name of the class with no modification.
    command_attrs: :class:`dict`
        A list of attributes to apply to every command inside this cog. The dictionary
        is passed into the :class:`Command` (or its subclass) options at ``__init__``.
        If you specify attributes inside the command attribute in the class, it will
        override the one specified inside this attribute. For example:

        .. code-block:: python3

            class MyCog(commands.Cog, command_attrs=dict(hidden=True)):
                @commands.command()
                async def foo(self, ctx):
                    pass # hidden -> True

                @commands.command(hidden=False)
                async def bar(self, ctx):
                    pass # hidden -> False
    """

    def __new__(cls, *args, **kwargs):
        name, bases, attrs = args
        attrs['__cog_name__'] = kwargs.pop('name', name)
        attrs['__cog_settings__'] = command_attrs = kwargs.pop('command_attrs', {})

        commands = {}
        listeners = {}
        no_bot_cog = 'Commands or listeners must not start with cog_ or bot_ (in method {0.__name__}.{1})'

        new_cls = super().__new__(cls, name, bases, attrs, **kwargs)
        for base in reversed(new_cls.__mro__):
            for elem, value in base.__dict__.items():
                if elem in commands:
                    del commands[elem]
                if elem in listeners:
                    del listeners[elem]

                is_static_method = isinstance(value, staticmethod)
                if is_static_method:
                    value = value.__func__
                if isinstance(value, _BaseCommand):
                    if is_static_method:
                        raise TypeError('Command in method {0}.{1!r} must not be staticmethod.'.format(base, elem))
                    if elem.startswith(('cog_', 'bot_')):
                        raise TypeError(no_bot_cog.format(base, elem))
                    commands[elem] = value
                elif inspect.iscoroutinefunction(value):
                    try:
                        is_listener = getattr(value, '__cog_listener__')
                    except AttributeError:
                        continue
                    else:
                        if elem.startswith(('cog_', 'bot_')):
                            raise TypeError(no_bot_cog.format(base, elem))
                        listeners[elem] = value

        new_cls.__cog_commands__ = list(commands.values()) # this will be copied in Cog.__new__

        listeners_as_list = []
        for listener in listeners.values():
            for listener_name in listener.__cog_listener_names__:
                # I use __name__ instead of just storing the value so I can inject
                # the self attribute when the time comes to add them to the bot
                listeners_as_list.append((listener_name, listener.__name__))

        new_cls.__cog_listeners__ = listeners_as_list
        return new_cls

    def __init__(self, *args, **kwargs):
        super().__init__(*args)

    @classmethod
    def qualified_name(cls):
        return cls.__cog_name__

def _cog_special_method(func):
    func.__cog_special_method__ = None
    return func

class Cog(metaclass=CogMeta):
    """The base class that all cogs must inherit from.

    A cog is a collection of commands, listeners, and optional state to
    help group commands together. More information on them can be found on
    the :ref:`ext_commands_cogs` page.

    When inheriting from this class, the options shown in :class:`CogMeta`
    are equally valid here.
    """

    def __new__(cls, *args, **kwargs):
        # For issue 426, we need to store a copy of the command objects
        # since we modify them to inject `self` to them.
        # To do this, we need to interfere with the Cog creation process.
        self = super().__new__(cls)
        cmd_attrs = cls.__cog_settings__

        # Either update the command with the cog provided defaults or copy it.
        self.__cog_commands__ = tuple(c._update_copy(cmd_attrs) for c in cls.__cog_commands__)

        lookup = {
            cmd.qualified_name: cmd
            for cmd in self.__cog_commands__
        }

        # Update the Command instances dynamically as well
        for command in self.__cog_commands__:
            setattr(self, command.callback.__name__, command)
            parent = command.parent
            if parent is not None:
                # Get the latest parent reference
                parent = lookup[parent.qualified_name]

                # Update our parent's reference to our self
                removed = parent.remove_command(command.name)
                parent.add_command(command)

        return self

    def get_commands(self):
        r"""Returns a :class:`list` of :class:`.Command`\s that are
        defined inside this cog.

        .. note::

            This does not include subcommands.
        """
        return [c for c in self.__cog_commands__ if c.parent is None]

    @property
    def qualified_name(self):
        """:class:`str`: Returns the cog's specified name, not the class name."""
        return self.__cog_name__

    @property
    def description(self):
        """:class:`str`: Returns the cog's description, typically the cleaned docstring."""
        try:
            return self.__cog_cleaned_doc__
        except AttributeError:
            self.__cog_cleaned_doc__ = cleaned = inspect.getdoc(self)
            return cleaned

    def walk_commands(self):
        """An iterator that recursively walks through this cog's commands and subcommands."""
        from .core import GroupMixin
        for command in self.__cog_commands__:
            if command.parent is None:
                yield command
                if isinstance(command, GroupMixin):
                    yield from command.walk_commands()

    def get_listeners(self):
        """Returns a :class:`list` of (name, function) listener pairs that are defined in this cog."""
        return [(name, getattr(self, method_name)) for name, method_name in self.__cog_listeners__]

    @classmethod
    def _get_overridden_method(cls, method):
        """Return None if the method is not overridden. Otherwise returns the overridden method."""
        return getattr(method.__func__, '__cog_special_method__', method)

    @classmethod
    def listener(cls, name=None):
        """A decorator that marks a function as a listener.

        This is the cog equivalent of :meth:`.Bot.listen`.

        Parameters
        ------------
        name: :class:`str`
            The name of the event being listened to. If not provided, it
            defaults to the function's name.

        Raises
        --------
        TypeError
            The function is not a coroutine function or a string was not passed as
            the name.
        """

        if name is not None and not isinstance(name, str):
            raise TypeError('Cog.listener expected str but received {0.__class__.__name__!r} instead.'.format(name))

        def decorator(func):
            actual = func
            if isinstance(actual, staticmethod):
                actual = actual.__func__
            if not inspect.iscoroutinefunction(actual):
                raise TypeError('Listener function must be a coroutine function.')
            actual.__cog_listener__ = True
            to_assign = name or actual.__name__
            try:
                actual.__cog_listener_names__.append(to_assign)
            except AttributeError:
                actual.__cog_listener_names__ = [to_assign]
            # we have to return `func` instead of `actual` because
            # we need the type to be `staticmethod` for the metaclass
            # to pick it up but the metaclass unfurls the function and
            # thus the assignments need to be on the actual function
            return func
        return decorator

    @_cog_special_method
    def cog_unload(self):
        """A special method that is called when the cog gets removed.

        This function **cannot** be a coroutine. It must be a regular
        function.

        Subclasses must replace this if they want special unloading behaviour.
        """
        pass

    @_cog_special_method
    def bot_check_once(self, ctx):
        """A special method that registers as a :meth:`.Bot.check_once`
        check.

        This function **can** be a coroutine and must take a sole parameter,
        ``ctx``, to represent the :class:`.Context`.
        """
        return True

    @_cog_special_method
    def bot_check(self, ctx):
        """A special method that registers as a :meth:`.Bot.check`
        check.

        This function **can** be a coroutine and must take a sole parameter,
        ``ctx``, to represent the :class:`.Context`.
        """
        return True

    @_cog_special_method
    def cog_check(self, ctx):
        """A special method that registers as a :func:`commands.check`
        for every command and subcommand in this cog.

        This function **can** be a coroutine and must take a sole parameter,
        ``ctx``, to represent the :class:`.Context`.
        """
        return True

    @_cog_special_method
    def cog_command_error(self, ctx, error):
        """A special method that is called whenever an error
        is dispatched inside this cog.

        This is similar to :func:`.on_command_error` except only applying
        to the commands inside this cog.

        This function **can** be a coroutine.

        Parameters
        -----------
        ctx: :class:`.Context`
            The invocation context where the error happened.
        error: :class:`CommandError`
            The error that happened.
        """
        pass

    @_cog_special_method
    async def cog_before_invoke(self, ctx):
        """A special method that acts as a cog local pre-invoke hook.

        This is similar to :meth:`.Command.before_invoke`.

        This **must** be a coroutine.

        Parameters
        -----------
        ctx: :class:`.Context`
            The invocation context.
        """
        pass

    @_cog_special_method
    async def cog_after_invoke(self, ctx):
        """A special method that acts as a cog local post-invoke hook.

        This is similar to :meth:`.Command.after_invoke`.

        This **must** be a coroutine.

        Parameters
        -----------
        ctx: :class:`.Context`
            The invocation context.
        """
        pass

    def _inject(self, bot):
        cls = self.__class__

        # realistically, the only thing that can cause loading errors
        # is essentially just the command loading, which raises if there are
        # duplicates. When this condition is met, we want to undo all what
        # we've added so far for some form of atomic loading.
        for index, command in enumerate(self.__cog_commands__):
            command.cog = self
            if command.parent is None:
                try:
                    bot.add_command(command)
                except Exception as e:
                    # undo our additions
                    for to_undo in self.__cog_commands__[:index]:
                        bot.remove_command(to_undo)
                    raise e

        # check if we're overriding the default
        if cls.bot_check is not Cog.bot_check:
            bot.add_check(self.bot_check)

        if cls.bot_check_once is not Cog.bot_check_once:
            bot.add_check(self.bot_check_once, call_once=True)

        # while Bot.add_listener can raise if it's not a coroutine,
        # this precondition is already met by the listener decorator
        # already, thus this should never raise.
        # Outside of, memory errors and the like...
        for name, method_name in self.__cog_listeners__:
            bot.add_listener(getattr(self, method_name), name)

        return self

    def _eject(self, bot):
        cls = self.__class__

        try:
            for command in self.__cog_commands__:
                if command.parent is None:
                    bot.remove_command(command.name)

            for _, method_name in self.__cog_listeners__:
                bot.remove_listener(getattr(self, method_name))

            if cls.bot_check is not Cog.bot_check:
                bot.remove_check(self.bot_check)

            if cls.bot_check_once is not Cog.bot_check_once:
                bot.remove_check(self.bot_check_once, call_once=True)
        finally:
            self.cog_unload()

redpajama_set_name: RedPajamaGithub


text:
struct SyscallHookTarget {
	void* handler;               // An address of a hook handler
	bool hooked;
};

////////////////////////////////////////////////////////////////////////////////
//
// prototypes
//

////////////////////////////////////////////////////////////////////////////////
//
// variables
//

////////////////////////////////////////////////////////////////////////////////
//
// implementations
//

#endif //DDIMON_SYSCALL_HOOK_H_


text:
package pot.dao.web;

import net.sf.json.JSONArray;
import pot.util.DBConnection;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created by lvsijian8 on 2017/6/6.
 */
public class chartGroupDaoWeb {
    public JSONArray findchartGroup(int user_id, int group_id) {
        Connection con = null;
        PreparedStatement prepstmt = null;
        ResultSet rs = null;
        JSONArray array = new JSONArray();
        Map hands = new HashMap();
        ArrayList<Integer> group_ids = new ArrayList<Integer>();
        ArrayList<String> group_names = new ArrayList<String>();
        String sqlFindGroud = "SELECT group_id,group_name FROM groups WHERE user_id=?;";
        String sqlFindPots = "SELECT pot_id,flower_name FROM pot WHERE group_id=?;";
        ArrayList<Integer> pot_ids = null;
        String sqlFindWaterFertilizer = "SELECT now_water,now_bottle FROM pot WHERE pot_id=?;";
        ArrayList<Map> potsdata = new ArrayList<Map>();
        try {
            con = DBConnection.getDBConnection();
            prepstmt = con.prepareStatement(sqlFindGroud);
            prepstmt.setInt(1, user_id);
            rs = prepstmt.executeQuery();
            while (rs.next()) {
                int g_id = rs.getInt("group_id");
                String g_name = rs.getString("group_name");
                if (group_id == -1)
                    group_id = g_id;
                if (g_id == group_id)
                    hands.put("top_name", g_name);
                group_ids.add(g_id);
                group_names.add(g_name);
            }
            hands.put("group_ids", group_ids);
            hands.put("group_names", group_names);
            prepstmt = con.prepareStatement(sqlFindPots);
            for (int i = 0; i < group_ids.size(); i++) {
                prepstmt.setInt(1, group_ids.get(i));
                rs = prepstmt.executeQuery();
                ArrayList<Integer> p_ids = new ArrayList<Integer>();
                ArrayList<String> p_names = new ArrayList<String>();
                while (rs.next()) {
                    p_ids.add(rs.getInt("pot_id"));
                    p_names.add(rs.getString("flower_name"));
                }
                hands.put(group_names.get(i) + "_ids", p_ids);
                hands.put(group_names.get(i) + "_names", p_names);
                if (group_id == group_ids.get(i)) {
                    pot_ids = p_ids;
                }
            }
            array.add(hands);//将下拉列表的groud pot 的id name存入hands
            for (int i = 0; i < pot_ids.size(); i++) {
                Map pots = new HashMap();
                prepstmt = con.prepareStatement(sqlFindWaterFertilizer);
                prepstmt.setInt(1, pot_ids.get(i));
                rs = prepstmt.executeQuery();
                while (rs.next()) {
                    pots.put("water", rs.getInt("now_water"));
                    pots.put("fertilizer", rs.getInt("now_bottle"));
                }
                array.add(pots);
            }
            for (int i = 0; i < pot_ids.size(); i++) {
                DateFormat dateFormaty = new SimpleDateFormat("yyyy-MM-dd");
                ArrayList<Integer> humidity = new ArrayList<Integer>();//湿度
                ArrayList<Integer> temperature = new ArrayList<Integer>();//温度
                ArrayList<String> days = new ArrayList<String>();//日期
                String sqlFdata = "SELECT time,out_temperature,out_humidity FROM pot_" + pot_ids.get(i) + " ORDER BY time DESC limit 0,720";
                prepstmt = con.prepareStatement(sqlFdata);
                rs = prepstmt.executeQuery();
                int outT[] = new int[30];
                int outH[] = new int[30];
                String time[] = new String[30];
                humidity.clear();
                temperature.clear();
                days.clear();
                String thisDay = "时间";
                for (int j = 0, d = 0; rs.next() && j < 30; d++) {//近30天的数据
                    Date date = rs.getDate(1);
                    if (j == 0 && d == 0) {
                        days.add(dateFormaty.format(date));
                    }
                    if (rs.isLast() || !dateFormaty.format(date).equals(days.get(j))) {
                        j++;
                        days.add(dateFormaty.format(date));
                        if (j >= 30)
                            break;
                        int oT = 0, oH = 0;
                        for (int k = 0; k < d; k++) {//取出今天的所有数据并平均值
                            oT += outT[k];
                            outT[k] = 0;
                            oH += outH[k];
                            outH[k] = 0;
                        }
                        humidity.add(oH / d);
                        temperature.add(oT / d);
                        d = 0;
                    }
                    outT[d] = rs.getInt(2);
                    outH[d] = rs.getInt(3);
                }
                Map potdata = new HashMap();
                Collections.reverse(humidity);
                Collections.reverse(temperature);
                Collections.reverse(days);
                potdata.put("humidity", humidity);
                potdata.put("temperature", temperature);
                potdata.put("days", days);
                //if (!days.isEmpty())
                    potsdata.add(potdata);//将查询的未处理的数据存至数据结构
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DBConnection.closeDB(con, prepstmt, rs);
        }
        ArrayList<Map> potsEndData = new ArrayList<Map>();//建一个相同的数据结构存储处理后的数据
        ArrayList<String> EndDays = new ArrayList<String>();//日期//索引0存唯一日期
        Map potEndDate = new HashMap();
        potEndDate.put("EndDays", EndDays);
        potsEndData.add(potEndDate);
        for (int i = 0; i < potsdata.size(); i++) {//索引1~n存1~n个植物的温度和湿度
            Map potEndData = new HashMap();
            ArrayList<Integer> humidity = new ArrayList<Integer>();//湿度
            ArrayList<Integer> temperature = new ArrayList<Integer>();//温度
            potEndData.put("humidity", humidity);
            potEndData.put("temperature", temperature);
            potsEndData.add(potEndData);
        }
        while (!potsdata.isEmpty()) {
            int minIndex = -1;
            String minDate = "9999-99-99";
            for (int i = 0; i < potsdata.size(); i++) {
                if (((ArrayList<Integer>) potsdata.get(i).get("days")).isEmpty()) {
                    potsdata.remove(i);
                    continue;
                }
                if (minDate.compareTo(((ArrayList<String>) potsdata.get(i).get("days")).get(0)) > 0) {//获取全部数据中最小的日期的位置和值
                    minDate = ((ArrayList<String>) potsdata.get(i).get("days")).get(0);
                    minIndex = i;
                }
            }
            if (minIndex==-1){
                continue;
            }
            if (((ArrayList<String>) potsEndData.get(0).get("EndDays")).isEmpty() || !(((ArrayList<String>) potsEndData.get(0).get("EndDays")).get(((ArrayList<String>) potsEndData.get(0).get("EndDays")).size() - 1)).equals(minDate)) {
                ((ArrayList<String>) potsEndData.get(0).get("EndDays")).add(minDate);//当最终结果中无日期,或和最小日期不一样时,添加日期,并从原本的数据结构中移除
                ((ArrayList<String>) potsdata.get(minIndex).get("days")).remove(0);
                for (int i = 1; i < potsEndData.size(); i++) {
                    ((ArrayList<Integer>) potsEndData.get(i).get("humidity")).add(-9999);//添加时间日期对应的位置占位符
                    ((ArrayList<Integer>) potsEndData.get(i).get("temperature")).add(-9999);
                }
            }
            else if ((((ArrayList<String>) potsEndData.get(0).get("EndDays")).get(((ArrayList<String>) potsEndData.get(0).get("EndDays")).size() - 1)).equals(minDate)){
                ((ArrayList<String>) potsdata.get(minIndex).get("days")).remove(0);
            }
            ((ArrayList<Integer>) potsEndData.get(minIndex + 1).get("humidity")).set(((ArrayList<Integer>) potsEndData.get(minIndex + 1).get("humidity")).size() - 1, ((ArrayList<Integer>) potsdata.get(minIndex).get("humidity")).get(0));
            ((ArrayList<Integer>) potsEndData.get(minIndex + 1).get("temperature")).set(((ArrayList<Integer>) potsEndData.get(minIndex + 1).get("temperature")).size() - 1, ((ArrayList<Integer>) potsdata.get(minIndex).get("temperature")).get(0));
            ((ArrayList<Integer>) potsdata.get(minIndex).get("temperature")).remove(0);
            ((ArrayList<Integer>) potsdata.get(minIndex).get("humidity")).remove(0);
            if (((ArrayList<Integer>) potsdata.get(minIndex).get("humidity")).isEmpty()) {
                potsdata.remove(minIndex);
            }
        }
        Map potsEndDatajson = new HashMap();
        potsEndDatajson.put("potsEndDatajson",potsEndData);
        array.add(potsEndDatajson);
        return array;
    }
}


text:
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
NODE_MODULES=`readlink -f $SCRIPTPATH/../node_modules`

cd $NODE_MODULES

# Gulp Files
.bin/gulp
# Building bundle.js
.bin/gulp package
# Browserify
.bin/gulp browserify


text:
<?php
/**
 * Shop System SDK:
 * - Terms of Use can be found under:
 * https://github.com/wirecard/paymentSDK-php/blob/master/_TERMS_OF_USE
 * - License can be found under:
 * https://github.com/wirecard/paymentSDK-php/blob/master/LICENSE
 */

// # Payment after a reservation

// Enter the ID of the successful reserve transaction and start a pay transaction with it.

// ## Required objects

// To include the necessary files, use the composer for PSR-4 autoloading.
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../inc/common.php';
require __DIR__ . '/../../configuration/config.php';

require __DIR__ . '/../../inc/header.php';

use Wirecard\PaymentSdk\Response\FailureResponse;
use Wirecard\PaymentSdk\Response\SuccessResponse;
use Wirecard\PaymentSdk\Transaction\MasterpassTransaction;
use Wirecard\PaymentSdk\TransactionService;

// ### Transaction

$transaction = new MasterpassTransaction();
$transaction->setParentTransactionId($_POST['parentTransactionId']);

// ### Transaction Service
// The _TransactionService_ is used to generate the request data needed for the generation of the UI.
$transactionService = new TransactionService($config);
$response = $transactionService->pay($transaction);

// ## Response handling

// The response from the service can be used for disambiguation.
// In case of a successful transaction, a `SuccessResponse` object is returned.
if ($response instanceof SuccessResponse) {
    echo 'Payment successfully completed.
';
    echo getTransactionLink($baseUrl, $response);
    ?>

    <form action="cancel.php" method="post">
        <input type="hidden" name="parentTransactionId" value="<?= $response->getTransactionId() ?>"/>
        <button type="submit" class="btn btn-primary">Cancel the capture</button>
    </form>
    <?php
// In case of a failed transaction, a `FailureResponse` object is returned.
} elseif ($response instanceof FailureResponse) {
    // In our example we iterate over all errors and echo them out.
    // You should display them as error, warning or information based on the given severity.
    foreach ($response->getStatusCollection() as $status) {
        /**
         * @var $status \Wirecard\PaymentSdk\Entity\Status
         */
        $severity = ucfirst($status->getSeverity());
        $code = $status->getCode();
        $description = $status->getDescription();
        echo sprintf('%s with code %s and message "%s" occurred.
', $severity, $code, $description);
    }
}

require __DIR__ . '/../../inc/footer.php';


text:
__author__ = 'neon'
import sys
example_text =("committee_name=sexit\n"
                "ou=sexit\n"
                "display_name=sexIT\n"
                "start_gid_number=5076\n"
                "committee_type=Committee\n"
                "11\n"
                "mgustav\n"
                "warvik\n"
                "paulae\n"
                "gaband\n"
                "sjoanna\n"
                "oskarmo\n"
                "marhult\n"
                "10\n"
                "egero\n"
                "printz\n"
                "fionar\n"
                "jesande\n"
                "adamsc\n"
                "wdaniel\n"
                "09\n"
                "farnstra\n"
                "careng\n"
                "rydback\n"
                "lofw\n"
                "jstrom\n"
                "olape\n"
                "juliaad\n"
                "soderbem\n")

def make_diff_file(file_name,output_file_name):
    f = open(output_file_name,'w')

    ldap_diff = _generate_ldap_diff_from_file(file_name)
    f.write(ldap_diff)
    f.close()

def generate_example_input_file(file_name):
    f = open(file_name,'w')
    f.write(example_text)
    f.close()

def _generate_ldap_diff_from_file(file_name):
    f = open(file_name,'r')

    # The following calls have to be made in this order because of how the script
    # expects the input file to look
    committee_name = _get_committee(f)
    ou = _get_ou(f)
    display_name = _get_display_name(f)
    start_gid_number = _get_start_gid_number(f)
    committee_type = _get_committee_type(f)
    years_cid_map = _get_years_cid_map(f)

    f.close()

    complete_ldap_diff = generate_ldap_diff(years_cid_map,committee_name,display_name,ou,committee_type,start_gid_number)
    return complete_ldap_diff

def _get_years_cid_map(f):
    years_cid_map = {}
    cids = []
    year = -1

    for line in f:
        text = line.replace('\n', "")
        if _is_a_year(text):
            if year != -1:
                years_cid_map[year] = cids
                cids = []
            year = int(text)
        else:
            cids.append(text)

    years_cid_map[year] = cids
    return years_cid_map

def _get_committee_type(f):
    committee_type = f.readline()
    return committee_type.replace('\n', "").replace('committee_type=', "")

def _get_start_gid_number(f):
    start_gid_number = f.readline()
    return int(start_gid_number.replace('\n', "").replace('start_gid_number=', ""))

def _get_display_name(f):
    display_name = f.readline()
    return display_name.replace('\n', "").replace('display_name=', "")

def _get_ou(f):
    ou = f.readline()
    return ou.replace('\n', "").replace('ou=', "")

def _get_committee(f):
    committee_name = f.readline()
    return committee_name.replace('\n', "").replace('committee_name=', "")

##
# This function generates an ldap diff file for a specific committees earlier
# @param years_cids_map a dictionary containing the years as keys and a list of cids (strings) as value
# e.g. cids_each_year = {'10':["horv","harv","herv"],'09':["kek","neon","maxim"]}
# @param committee_name in lower case, as the node looks in ldap
# e.g. styrit, prit
# @param display_name how the name should look in the frontend
# e.g. digIT, P.R.I.T. snIT
# @param ou_node
# @param committee_type what type of association it is, a committee, union, board etc
# @start_gidnumber IMPORTANT, check what the next gidnumber is by trying to create a new child entry in ldap,
# then use that number, eg 5135
def generate_ldap_diff(year_cids_map, committee_name, display_name, ou_node,committee_type, start_gidnumber):
    gid_number = start_gidnumber
    ldap_diff = ""

    for year in year_cids_map:
        cids = year_cids_map[year]
        ldap_diff += _create_ldap_diff(year, cids, committee_name, display_name,committee_type, gid_number, ou_node)
        # increase the gid for next node
        gid_number += 1

    return ldap_diff

def _create_ldap_diff(year, cids, committee_name, display_name,committee_type, gid_number, ou_node):
    complete_ldap_diff = ""
    complete_ldap_diff += _create_committee_specific_part(committee_name, display_name, gid_number, ou_node, year)
    complete_ldap_diff += _create_all_members(cids)
    complete_ldap_diff += _create_closing_part(committee_type)
    complete_ldap_diff += '\n'
    return complete_ldap_diff

def _create_committee_specific_part(committee_name, display_name, gid_number, ou_node, year):
    ldap_diff = ("\n"
                  "dn: cn={committee_name}{year},ou={ou_node},ou=fkit,ou=groups,dc=chalmers,dc=it\n"
                  "changetype: add\n"
                  "cn: {committee_name}{year}\n"
                  "description: All members of {display_name} 20{year}\n"
                  "displayname: {display_name} 20{year}\n"
                  "gidnumber: {gid}")

    # Fill in the correct information
    year_string = _create_appropiate_string(year)
    ldap_diff = ldap_diff\
        .replace('{committee_name}', committee_name) \
        .replace('{year}', year_string) \
        .replace('{display_name}', display_name) \
        .replace('{ou_node}', ou_node) \
        .replace('{gid}', str(gid_number))
    return ldap_diff

def _create_appropiate_string(year):
    year_string = str(year)
    if (year < 10):
        year_string = "0" + year_string
    return year_string

def _create_all_members(cids):
    all_members = ""
    for cid in cids:
        all_members += "\nmember: uid=%s,ou=people,dc=chalmers,dc=it" % cid
    return all_members

def _create_closing_part(committee_type):
    return ("\n"
            "objectclass: posixGroup\n"
            "objectclass: groupOfNames\n"
            "objectclass: itGroup\n"
            "objectclass: top\n"
            "type: {committee_type}").replace('{committee_type}',committee_type)

def _is_a_year(s):
    try:
        int(s)
        return True
    except ValueError:
        return False

# Start of program
if len(sys.argv)==3:
    make_diff_file(sys.argv[1],sys.argv[2])
    print "ldapdif created as",sys.argv[2]
else:
    print "This is a script that can be used to generate diff files for ldap."
    generate_example_input_file("example_input_text_sexit.txt")
    print "Generated example_input_text_sexit.txt"
    print "Expecting two arguements, first the input file, second the output file"


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>程序包 org.kymjs.kjframe.bitmap的使用</title>
<meta name="date" content="2014-12-17">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

您的浏览器已禁用 JavaScript。

跳过导航链接

概览

程序包

类

使用

树

已过时

索引

帮助

上一个

下一个

框架

无框架

所有类

程序包的使用
org.kymjs.kjframe.bitmap

使用org.kymjs.kjframe.bitmap的程序包

程序包
说明

org.kymjs.kjframe

org.kymjs.kjframe.bitmap

org.kymjs.kjframe使用的org.kymjs.kjframe.bitmap中的类

类和说明

BitmapCallBack

BitmapLibrary中的回调方法

BitmapConfig

org.kymjs.kjframe.bitmap使用的org.kymjs.kjframe.bitmap中的类

类和说明

BitmapCallBack

BitmapLibrary中的回调方法

BitmapConfig

I_ImageLoader

图片加载器接口协议

跳过导航链接

概览

程序包

类

使用

树

已过时

索引

帮助

上一个

下一个

框架

无框架

所有类


text:
package org.quartzsource.meutrino

import java.io.File

import org.junit.Assert._
import org.junit.Test

@Test
class BasicRepositoryTest extends AbstractRepositoryTest {

  @Test
  def testRepositoryRoot {
    val path = repo.root()
    assertEquals(path.getCanonicalPath(), new File(".").getCanonicalPath())
  }

  @Test
  def testRepositoryStatus {
    val list: List[(QStatus, QPath)] = repo.status().toList
    //list.foreach(println(_))
  }

  @Test
  def testRepositoryAddEmpty {
    val done = repo.add(Nil)
    assertTrue(done)
  }

  @Test
  def testRepositoryAddNonExisting {
    assertFalse(repo.add(List(new QPath("src/newName.scala"))))
  }

  @Test
  def testRepositoryAddExisting {
    val done = repo.add(List(QPath(".hgignore")))
    assertTrue(done)
  }

  @Test
  def testRepositoryAddRemove {
    repo.addRemove(Nil, 100)
  }

  @Test
  def testRepositoryCat {
    val data: String = repo.cat(QPath(".hgignore"))
    assertTrue(data, data.contains("syntax: regexp"))
  }
}


text:
var app = app || {};

var TodoList = Backbone.Collection.extend({
	model: app.Todo,
	url: '/app_dev.php/api/todos',
	completed: function() {
		return this.filter(function(todo){
			return todo.get('completed');
		});
	},
	remaining: function() {
		return this.without.apply(this, this.completed());
	},
	nextOrder: function() {
		if(!this.length) {
			return 1;
		}

		return this.last().get('order') + 1;
	},
	comparator: function(todo) {
		return todo.get('order');
	}
});

app.Todos = new TodoList();


text:
package org.apache.druid.query.groupby.epinephelinae.vector;

import org.apache.datasketches.memory.WritableMemory;
import org.apache.druid.query.groupby.ResultRow;
import org.apache.druid.query.groupby.epinephelinae.collection.MemoryPointer;

/**
 * Treats all rows as null.
 */
public class NilGroupByVectorColumnSelector implements GroupByVectorColumnSelector
{
  public static final NilGroupByVectorColumnSelector INSTANCE = new NilGroupByVectorColumnSelector();

  private NilGroupByVectorColumnSelector()
  {
    // Singleton.
  }

  @Override
  public int getGroupingKeySize()
  {
    return 0;
  }

  @Override
  public int writeKeys(WritableMemory keySpace, int keySize, int keyOffset, int startRow, int endRow)
  {
    // Nothing to do.
    return 0;
  }

  @Override
  public void writeKeyToResultRow(MemoryPointer keyMemory, int keyOffset, ResultRow resultRow, int resultRowPosition)
  {
    resultRow.set(resultRowPosition, null);
  }

  @Override
  public void reset()
  {
    // Nothing to do.
  }
}


text:
package contagionJVM.Event;

import contagionJVM.Constants;
import contagionJVM.GameObject.PlayerGO;
import contagionJVM.IScriptEventHandler;
import org.nwnx.nwnx2.jvm.NWObject;
import org.nwnx.nwnx2.jvm.NWScript;

@SuppressWarnings("UnusedDeclaration")
public class Module_OnClientLeaving implements IScriptEventHandler {
    @Override
    public void runScript(NWObject objSelf) {

    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="../bootstrap.css">
    <script type="text/javascript" src="../bootstrap.js"></script>
</head>
<body class="x-border-box"></body>
</html>


text:
module Cheetah
  # Cheetah version (uses [semantic versioning](http://semver.org/)).
  VERSION = File.read("#{File.dirname(__FILE__)}/../../VERSION").strip
end


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<declare-styleable name="FloatingMenuButton">
		<attr name="animationType" format="string"/>
		<attr name="dispositionStartAngle" format="integer"/>
		<attr name="dispositionEndAngle" format="integer"/>
		<attr name="subActionButtonRadius" format="integer"/>
		<attr name="anchored" format="boolean"/>
	</declare-styleable>
</resources>


text:
package org.elasticsearch.cloud.aws;

import com.amazonaws.Protocol;
import com.amazonaws.services.ec2.AmazonEC2;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.function.Function;

public interface AwsEc2Service {
    Setting<Boolean> AUTO_ATTRIBUTE_SETTING = Setting.boolSetting("cloud.node.auto_attributes", false, false, Setting.Scope.CLUSTER);

    // Global AWS settings (shared between discovery-ec2 and repository-s3)
    // Each setting starting with `cloud.aws` also exists in repository-s3 project. Don't forget to update
    // the code there if you change anything here.
    Setting<String> KEY_SETTING = Setting.simpleString("cloud.aws.access_key", false, Setting.Scope.CLUSTER);
    Setting<String> SECRET_SETTING = Setting.simpleString("cloud.aws.secret_key", false, Setting.Scope.CLUSTER);
    Setting<Protocol> PROTOCOL_SETTING = new Setting<>("cloud.aws.protocol", "https", s -> Protocol.valueOf(s.toUpperCase(Locale.ROOT)),
        false, Setting.Scope.CLUSTER);
    Setting<String> PROXY_HOST_SETTING = Setting.simpleString("cloud.aws.proxy.host", false, Setting.Scope.CLUSTER);
    Setting<Integer> PROXY_PORT_SETTING = Setting.intSetting("cloud.aws.proxy.port", 80, 0, 1<<16, false, Setting.Scope.CLUSTER);
    Setting<String> PROXY_USERNAME_SETTING = Setting.simpleString("cloud.aws.proxy.username", false, Setting.Scope.CLUSTER);
    Setting<String> PROXY_PASSWORD_SETTING = Setting.simpleString("cloud.aws.proxy.password", false, Setting.Scope.CLUSTER);
    Setting<String> SIGNER_SETTING = Setting.simpleString("cloud.aws.signer", false, Setting.Scope.CLUSTER);
    Setting<String> REGION_SETTING = new Setting<>("cloud.aws.region", "", s -> s.toLowerCase(Locale.ROOT), false, Setting.Scope.CLUSTER);

    interface CLOUD_EC2 {
        Setting<String> KEY_SETTING = new Setting<>("cloud.aws.ec2.access_key", AwsEc2Service.KEY_SETTING, Function.identity(), false,
            Setting.Scope.CLUSTER);
        Setting<String> SECRET_SETTING = new Setting<>("cloud.aws.ec2.secret_key", AwsEc2Service.SECRET_SETTING, Function.identity(), false,
            Setting.Scope.CLUSTER);
        Setting<Protocol> PROTOCOL_SETTING = new Setting<>("cloud.aws.ec2.protocol", AwsEc2Service.PROTOCOL_SETTING,
            s -> Protocol.valueOf(s.toUpperCase(Locale.ROOT)), false, Setting.Scope.CLUSTER);
        Setting<String> PROXY_HOST_SETTING = new Setting<>("cloud.aws.ec2.proxy.host", AwsEc2Service.PROXY_HOST_SETTING,
            Function.identity(), false, Setting.Scope.CLUSTER);
        Setting<Integer> PROXY_PORT_SETTING = new Setting<>("cloud.aws.ec2.proxy.port", AwsEc2Service.PROXY_PORT_SETTING,
            s -> Setting.parseInt(s, 0, 1<<16, "cloud.aws.ec2.proxy.port"), false, Setting.Scope.CLUSTER);
        Setting<String> PROXY_USERNAME_SETTING = new Setting<>("cloud.aws.ec2.proxy.username", AwsEc2Service.PROXY_USERNAME_SETTING,
            Function.identity(), false, Setting.Scope.CLUSTER);
        Setting<String> PROXY_PASSWORD_SETTING = new Setting<>("cloud.aws.ec2.proxy.password", AwsEc2Service.PROXY_PASSWORD_SETTING,
            Function.identity(), false, Setting.Scope.CLUSTER);
        Setting<String> SIGNER_SETTING = new Setting<>("cloud.aws.ec2.signer", AwsEc2Service.SIGNER_SETTING, Function.identity(),
            false, Setting.Scope.CLUSTER);
        Setting<String> REGION_SETTING = new Setting<>("cloud.aws.ec2.region", AwsEc2Service.REGION_SETTING,
            s -> s.toLowerCase(Locale.ROOT), false, Setting.Scope.CLUSTER);
        Setting<String> ENDPOINT_SETTING = Setting.simpleString("cloud.aws.ec2.endpoint", false, Setting.Scope.CLUSTER);
    }

    interface DISCOVERY_EC2 {
        enum HostType {
            PRIVATE_IP,
            PUBLIC_IP,
            PRIVATE_DNS,
            PUBLIC_DNS
        }

        Setting<HostType> HOST_TYPE_SETTING =
            new Setting<>("discovery.ec2.host_type", HostType.PRIVATE_IP.name(), s -> HostType.valueOf(s.toUpperCase(Locale.ROOT)), false,
                Setting.Scope.CLUSTER);
        Setting<Boolean> ANY_GROUP_SETTING =
            Setting.boolSetting("discovery.ec2.any_group", true, false, Setting.Scope.CLUSTER);
        Setting<List<String>> GROUPS_SETTING =
            Setting.listSetting("discovery.ec2.groups", new ArrayList<>(), s -> s.toString(), false, Setting.Scope.CLUSTER);
        Setting<List<String>> AVAILABILITY_ZONES_SETTING =
            Setting.listSetting("discovery.ec2.availability_zones", Collections.emptyList(), s -> s.toString(), false,
                Setting.Scope.CLUSTER);
        Setting<TimeValue> NODE_CACHE_TIME_SETTING =
            Setting.timeSetting("discovery.ec2.node_cache_time", TimeValue.timeValueSeconds(10), false, Setting.Scope.CLUSTER);

        Setting<Settings> TAG_SETTING = Setting.groupSetting("discovery.ec2.tag.", false,Setting.Scope.CLUSTER);
    }

    AmazonEC2 client();
}


text:
/*
 * System Hierarchy Partition Chart
 */

var SYSTEM_CHART = true;

(function(d3, undefined) {
  var MIN_ELEMENT_HEIGHT = 40;
  var COLLAPSED_SIZE_PIXELS = 10; // size in pixels of collapsed partition
  var DEFAULT_TRANSITION_DURATION = 500; // transition duration millis
  var ROOT_ELEMENT_MAX_FONT_SIZE = 32;
  var MIN_FONT_SIZE = 14;
  var WIDTH_RATIO_ALONE = 0.984;
  var WIDTH_RATIO_COMBINED = 0.885;

  var cw;
  var ch;
  var rangeX;
  var rangeY;
  // matches only a trailing string of alphanumeric characters
  // (includng the underscore character)
  var removeParentNamesRegex = /\w*$/;
  // matches trailing elipsis
  var elipsisRegex = /\.\.\.$/;
  var focusedDatum = null;
  var svg;
  var rootDatum;
  var colors = {
    root: 'rgb(240, 190, 190)',
    group: 'rgb(240, 180, 180)',
    component: 'rgb(180, 180, 240)',
    variable: 'rgb(210, 210, 225)',
    state: 'rgb(210, 240, 180)' // state var and its parent
  };

  window.addEventListener('load', function() {
    var container = document.getElementById('container');

    if (typeof(DEPENDENCIES_CHART) !== 'undefined') {
      cw = window.innerWidth * WIDTH_RATIO_COMBINED;
    } else {
      cw = window.innerWidth * WIDTH_RATIO_ALONE;
    }
    ch = window.innerHeight;
    rangeX = d3.scale.linear().range([0, cw]);
    rangeY = d3.scale.linear().range([0, ch]);

    // create an svg element and append to the container div
    svg = d3.select('#system-hierarchy-chart').append('svg')
      .attr('width', cw)
      .attr('height', ch);

    // create a partition layout and set the getChildren and getValue funcs
    var partition = d3.layout.partition()
      .children(getChildren)
      .sort(function(a, b) {
        return a.siblingOrder - b.siblingOrder;
      })
      // calculates weighted width of a leaf
      // always return 1 so the leaves are all the same size
      .value(function(d) {
        return 1;
      });

    // create svg group elements that correspond to the data nodes
    // and append them to the svg.
    var groups = svg.selectAll('g').data(partition(d3.entries(data.systemHierarchy)[0]))
      .enter().append('g')
      // set the functions that handle resizing and repositioning partitions
      // for zooming, expading, and collapsing
      .attr('x', deltaX)
      .attr('y', deltaY)
      .attr('width', deltaWidth)
      .attr('height', deltaHeight)
      // give each data node a reference to its corresponding svg group
      .each(function(d) {
        d.element = this;
      });

    // set the rootDatum variable
    groups.filter(function(d) {
      return d.parent == null;
    }).each(function(d) {
      rootDatum = d;
    });

    console.log(rootDatum);

    var jsonLowestPlainObjs = (function getLow(data, keyin, out) {
      var hasChildObj = false;
      for (var key in data) {
        if (data[key].constructor.name === 'Object') {
          out = getLow(data[key], key, out);
          hasChildObj = true;
        }
      }
      if (hasChildObj === false) {
        out[keyin] = data;
      }
      return out;
    }(data.systemHierarchy, 'root', {}));

    if (typeof(DEPENDENCIES_CHART) !== 'undefined') {
      var leaf = getDataLeaves(rootDatum)[0];
      ch = leaf.dx * cw * (leaf.depth + 1);
      svg.attr('height', ch);
      rangeY = d3.scale.linear().range([0, ch]);
      transitionAll(10);
    }

    // assign leaves their attribute values from json data
    getDataLeaves(rootDatum).forEach(function(d, i, arr) {
      for (var key in jsonLowestPlainObjs[d.key]) {
        d[key] = jsonLowestPlainObjs[d.key][key];
      }
    });

    // create and append a visible rect for each svg group
    var rects = groups.append('rect')
      .attr('x', deltaX)
      .attr('y', deltaY)
      .attr('width', deltaWidth)
      .attr('height', deltaHeight)
      // colors rects
      .attr('fill', function(d) {
        // root color index is 0 and group color index is 1
        var name = (d.depth === 'group') ? 'root' : 'group';

        // component color index is 2
        if (d.children != null && d.children[0].children == null) {
          name = 'component';
        }

        // variable color index is 3
        if (d.children == null) {
          name = 'variable';
        }

        // state vars and components with state vars color index is 4
        if (d.state != null) {
          name = 'state';
        }
        if (d.children != null) {
          d.children.forEach(function(d, i, arr) {
            if (d.state != null) {
              name = 'state';
            }
          });
        }

        return colors[name];
      });

    // create and append tooltip popup elements
    var titles = groups.append('title');

    // create and append a svg text element for each group
    var texts = groups.append('text')
      .attr('font-size', deltaText)
      // gets the text of a text elementproperty of a data node
      // returns the key
      .text(function(d) {
        return removeParentNamesRegex.exec(d.key);
      })
      // x and y attrs must be last so they run
      // after the bouding box has been computed
      .attr('x', deltaX)
      .attr('y', deltaY)
      .each(handleTextAndTooltips);

    // set row order of data nodes by their screen x position
    var depth = 1;
    var row = getDataByDepth(depth);
    while (row.length > 0) {
      row.sort(function(a, b) {
          return a.x - b.x;
        })
        .forEach(function(ele, i, arr) {
          ele.rowOrder = i;
        });
      row = getDataByDepth(++depth);
    }

    // Set event handlers. Events to communicate outside of system hierarchy chart
    // are emitted from within the handlers.
    svg.selectAll('g').on('click', click);
    svg.selectAll('g').on('contextmenu', click);
    // sets focusedDatum variable to the datum whose svg element has focus
    svg.selectAll('g').on('focus', function(d) {
      focusedDatum = d;
    });

    // Help items
    var helpIconElements = document.getElementsByClassName('help-icon');
    var helpDiv = document.getElementById('help');
    var closeHelpButton = document.getElementById('close-help-button');

    for (var i = 0; i < helpIconElements.length; ++i) {
      helpIconElements.item(i).onclick = function(event) {
        helpDiv.style.display = 'inline-block';
        for (var i = 0; i < helpIconElements.length; ++i) {
          helpIconElements.item(i).style.display = 'none';
        }
        return false;
      };
    }
    closeHelpButton.addEventListener('click', function(event) {
      for (var i = 0; i < helpIconElements.length; ++i) {
        helpIconElements.item(i).style.display = 'block';
      }
      helpDiv.style.display = 'none';
      return false;
    });
  });

  window.addEventListener('resize', function() {
    var container = document.getElementById('container');
    if (container.classList.contains('central-with-sidebar')) {
      cw = window.innerWidth * WIDTH_RATIO_COMBINED;
    } else {
      cw = window.innerWidth * WIDTH_RATIO_ALONE;
    }
    svg.attr('width', cw);
    rangeX.range([0, cw]);

    svg.selectAll('.collapsed').each(function(d) {
      d.dx = (d.dx === 0) ? 0 : COLLAPSED_SIZE_PIXELS / cw;
      deltaWidth.call(this, d);
    });

    setExpandingDx();
    setAllRowPositions();
    transitionAll(10);
  });

  window.addEventListener('zoom', function(event) {
    var detail = event.detail;

    if (detail.rootId === 'system-hierarchy-chart') {
      zoom(detail.datum);

    } else if (detail.secondary === true) {
      var datum = getDataLeaves(rootDatum)[detail.columns[0]];

      while (datum.parent.parent != null && (focusedDatum == null || focusedDatum !== datum.parent)) {
        datum = datum.parent;
      }
      focusedDatum = datum;
      zoom(datum);

      var leaves = getDataLeaves(rootDatum);
      var datumLeaves = getDataLeaves(datum);
      var startIndex = leaves.indexOf(datumLeaves[0]);
      var lastIndex = startIndex + datumLeaves.length;
      var columns = [startIndex, lastIndex];
      // Trigger global event
      var newEvent = new CustomEvent('zoom', {
        detail: {
          rootId: svg[0][0].parentNode.getAttribute('id'),
          root: rootDatum,
          datum: datum,
          element: datum.element,
          rows: [datum.depth, datum.depth + 1],
          columns: columns,
          button: event.button,
          secondary: true
        },
        bubbles: true
      });

      datum.element.dispatchEvent(newEvent);
    }
  });

  window.addEventListener('collapse', function(event) {
    if (event.detail.secondary === true) {
      return;
    }
    var detail = event.detail;
    var datum;

    if (detail.root === rootDatum) {
      datum = detail.datum;
    } else {
      var leaves = getDataLeaves(rootDatum);
      datum = leaves[detail.columns[0]];
    }

    var parent = datum.parent;
    var origDatum = datum;
    while (parent != null) {
      var numExpandedChildren = parent.children.filter(function(d, i, arr) {
        return !d.element.classList.contains('collapsed');
      }).length;

      if (numExpandedChildren === 1) {
        // if parent has no more expanded children, then it becomes the
        // root of the collapse
        datum = parent;
      }
      parent = parent.parent;
    }

    // trigger secondary collapse event if root of the collapse has changed
    if (datum !== origDatum) {
      var leaves = getDataLeaves(rootDatum);
      var datumLeaves = getDataLeaves(datum);
      var startIndex = leaves.indexOf(datumLeaves[0]);
      var lastIndex = startIndex + datumLeaves.length;
      var columns = [startIndex, lastIndex];
      var event = new CustomEvent('collapse', {
        detail: {
          rootId: svg[0][0].parentNode.getAttribute('id'),
          root: rootDatum,
          datum: datum,
          element: datum.element,
          rows: [datum.depth, datum.depth + 1],
          columns: columns,
          secondary: true
        },
        bubbles: true
      });
      datum.element.dispatchEvent(event);
    }

    collapse(datum);
  });

  window.addEventListener('expand', function(event) {
    var detail = event.detail;

    if (event.detail.id === svg[0][0].parentNode.getAttribute('id')) {
      expand(detail.datum);

    } else {
      var leaves = getDataLeaves(rootDatum);
      var columns = detail.columns;

      for (var i = columns[0]; i < columns[1]; ++i) {
        expand(leaves[i]);
      }
    }
  });

  // initiates zooming, collapsing, and expanding
  // emmits the zoom, collapse, and expand events
  function click(datum) {
    var button = d3.event.button;
    var eventType = null;

    // zoom
    if (button === 0 && !datum.element.classList.contains('collapsed')) {
      eventType = 'zoom';

      // expand/collapse
    } else if (button > 0) {
      if (this.classList.contains('collapsed')) {
        eventType = 'expand';

      } else {
        eventType = 'collapse';

        var parent = datum.parent;
        while (parent != null) {
          var numExpandedChildren = parent.children.filter(function(d, i, arr) {
            return !d.element.classList.contains('collapsed');
          }).length;

          if (numExpandedChildren === 1) {
            // if parent has no more expanded children, then it becomes the
            // root of the collapse
            datum = parent;
          }
          parent = parent.parent;
        }
      }
    }

    if (eventType != null) {
      // Trigger global event
      var columns;
      var leaves = getDataLeaves(rootDatum);
      var eleLeaves = getDataLeaves(datum);
      if (eleLeaves.length === 1) {
        if (eleLeaves[0] === datum) {
          columns = [leaves.indexOf(datum), leaves.indexOf(datum) + 1];
        } else {
          columns = [leaves.indexOf(datum.children[0]), leaves.indexOf(datum.children[0]) + 1];
        }
      } else {
        var startIndex = leaves.indexOf(eleLeaves[0]);
        var endIndex = startIndex + eleLeaves.length;
        columns = [startIndex, endIndex];
      }

      var event = new CustomEvent(eventType, {
        detail: {
          rootId: svg[0][0].parentNode.getAttribute('id'),
          root: rootDatum,
          datum: datum,
          element: datum.element,
          rows: [datum.depth, datum.depth + 1],
          columns: columns,
          secondary: false
        },
        bubbles: true
      });
      datum.element.dispatchEvent(event);
    }

    d3.event.preventDefault();
  }

  function zoom(datum) {
    rangeX.domain([datum.x, datum.x + datum.dx]);
    rangeY.domain([datum.y, 1]).range([datum.y ? 20 : 0, ch]);
    transitionAll();
    return datum;
  }

  // determines which elements need to be collapsed and collapses them.
  // repositions the rest of the elements as necessary
  function collapse(datum) {
    if (datum === rootDatum) {
      return;
    }

    var numNotCollapsed = getDataByDepth(datum.depth).filter(function(d, i, arr) {
      return !d.element.classList.contains('collapsed');
    }).length;

    if (numNotCollapsed === 1) {
      return;
    }

    datum.element.classList.add('collapsed');
    var collapsing = d3.select(datum.element)
      .datumDescendantElements(datum)
      .classed('collapsed', true);

    collapsing.each(function(d) {
      if (this.nodeName === 'text') {
        this.style.visibility = 'hidden';
      }

      d.dx = 0;
      var parent = datum;
      while (parent.element.classList.contains('collapsed')) {
        parent.dx = COLLAPSED_SIZE_PIXELS / cw;
        parent = parent.parent;
      }

      d.x = datum.x;
    });

    var child = datum;
    while (child.children != null) {
      var stateVar = null;

      for (var i = 0, len = child.children.length; i < len; ++i) {
        if (child.children[i].state != null) {
          stateVar = child.children[i];
          stateVar.dx = COLLAPSED_SIZE_PIXELS / cw;
          break;
        }
      }

      child.children.forEach(function(d, i, arr) {
        if (stateVar == null && i === 0) {
          d.dx = COLLAPSED_SIZE_PIXELS / cw;

        } else if (d !== stateVar) {
          d.dx = 0;
          d3.select(d.element).datumDescendantElements(d).each(function(d) {
            d.dx = 0;
          });
        }
      });

      child = child.children[0];
    }

    setExpandingDx();
    setAllRowPositions();
    transitionAll();

    return datum;
  }

  // determines which elements need to be expanded and expands them
  // repositions the rest of the elements as necessary
  function expand(datum) {
    d3.select(datum.element)
      .datumChildrenElements(datum)
      .datumDescendantElements(datum)
      .classed('collapsed', false);

    var rootExpansionDatum = (function traverseAncestors(d) {
      var parent = d.parent;
      var parentSelection = d3.select(parent.element);

      if (!parentSelection.classed('collapsed')) {
        return d;
      }

      parentSelection.classed('collapsed', false);

      var numExpandedChildren = parent.children.filter(function(d, i, arr) {
        return !d.element.classList.contains('collapsed');
      }).length;

      if (numExpandedChildren === 1) {
        parent.children.forEach(function(d, i, arr) {
          d3.select(d.element).datumDescendantElements(d).classed('collapsed', false);
        });
      }

      return traverseAncestors(parent);
    }(datum));

    setExpandingDx();
    setAllRowPositions();
    transitionAll();

    return rootExpansionDatum;
  }

  // Set the new size of expanding or resizing elements
  function setExpandingDx() {
    var expanding = svg.selectAll('g').filter(function(d) {
      return !this.classList.contains('collapsed');
    });
    var leaves = getDataLeaves();
    var numExpandedLeaves = 0;
    var numCollapsedAreas = 0;

    leaves.forEach(function(d) {
      if (d.element.classList.contains('collapsed')) {
        if (d.dx !== 0) {
          ++numCollapsedAreas;
        }
      } else {
        ++numExpandedLeaves;
      }
    });

    var unCollapsedArea = cw - numCollapsedAreas * COLLAPSED_SIZE_PIXELS;
    var leafdx = 1 / numExpandedLeaves * unCollapsedArea / cw;

    expanding.each(function(d) {
      if (d.parent == null) {
        return;
      }

      var leaves = getDataLeaves(d);
      var numExpandedLeaves = leaves.filter(function(d, i, arr) {
        return !d.element.classList.contains('collapsed');
      }).length;

      var numCollapsedAreas = 0;

      (function findCollapsedDescendantAreas(d) {
        var children = d.children;

        if (d.children == null) {
          return;

        } else {
          children.forEach(function(child, i, arr) {
            if (child.element.classList.contains('collapsed')) {
              ++numCollapsedAreas;
            } else {
              findCollapsedDescendantAreas(child);
            }
          });
        }
      }(d));

      d.dx = leafdx * numExpandedLeaves + numCollapsedAreas * COLLAPSED_SIZE_PIXELS / cw;
    });
  }

  // sets the x position of all elements
  function setAllRowPositions() {
    svg.selectAll('g').each(function(d) {
      if (d.parent == null) {
        return;
      }
      var laterals = getDataByDepth(d.depth);

      d.newX = 0;
      for (var i = 0, pos = laterals.indexOf(d); i < pos; ++i) {
        d.newX += laterals[i].dx;
      }

    }).each(function(d) {
      if (d.parent == null) {
        return;
      }
      d.x = d.newX;
      delete d.newX;
    });
  }

  // triggers a transition to new sizes and positions
  function transitionAll(duration) {
    duration = duration || DEFAULT_TRANSITION_DURATION;

    svg.selectAll('g, rect, text').transition()
      .duration(duration)
      .attr('x', deltaX)
      .attr('y', deltaY)
      .attr('width', deltaWidth)
      .attr('height', deltaHeight)
      .filter('text')
      .attr('font-size', deltaText)
      .each('end', handleTextAndTooltips);
    logged = false;
  }

  // calculates a change in x position
  function deltaX(d) {
    var newX = 0;

    if (this.nodeName === 'text') {
      var bb = this.getBBox();
      newX = rangeX(d.x) + deltaWidth(d) / 2 - bb.width / 2;

    } else {
      newX = rangeX(d.x);
    }

    return newX;
  }

  // calculates a change in y position
  function deltaY(d) {
    var newY = 0;

    if (this.nodeName === 'text') {
      var bb = this.getBBox();
      newY = rangeY(d.y) + bb.height;

    } else {
      newY = rangeY(d.y);
    }

    return newY;
  }

  // calculates a change in width
  function deltaWidth(d) {
    return rangeX(d.x + d.dx) - rangeX(d.x);
  }

  // calculates a change in height
  function deltaHeight(d) {
    return rangeY(d.y + d.dy) - rangeY(d.y);
  }

  // calculates a change in font size
  function deltaText(d) {
    var height = rootDatum.element.getElementsByTagName('rect')[0].getAttribute('height');
    var rootFontSize = (height * 0.8 > ROOT_ELEMENT_MAX_FONT_SIZE) ? ROOT_ELEMENT_MAX_FONT_SIZE : height * 0.8;
    var newSize = rootFontSize - 0.15 * rootFontSize * d.depth;
    newSize = (newSize < MIN_FONT_SIZE) ? MIN_FONT_SIZE : newSize;

    return newSize;
  }

  // hides a text element that is larger than the rect it lives on
  function handleTextAndTooltips(d) {
    this.innerHTML = removeParentNamesRegex.exec(d.key);

    var gw = this.parentNode.getAttribute('width');
    var tw = this.getBBox().width;
    var siblings = this.parentNode.childNodes;
    var tooltip;
    for (var i = 0; i < siblings.length; ++i) {
      if (siblings.item(i).nodeName === 'title') {
        tooltip = siblings.item(i);
        break;
      }
    }

    if (tw > gw - 10) {
      if (this.parentNode.classList.contains('collapsed')) {
        this.style.visibility = 'hidden';
        tooltip.innerHTML = d.key;
      } else {
        this.style.visibility = 'visible';
        tooltip.innerHTML = '';

        if (elipsisRegex.test(this.innerHTML) === false) {
          this.innerHTML += '...';
        }

        var textLength = this.innerHTML.length - 3;
        while (this.getBBox().width > parseInt(this.parentNode.getAttribute('width')) - 10) {
          if (textLength < 1) {
            this.innerHTML = '...';
            break;
          } else {
            this.innerHTML = this.innerHTML.substr(0, --textLength) + '...';
          }
        }

        if (this.innerHTML.length < 3) {
          this.innerHTML = '';
        }
        var px = parseInt(this.parentNode.getAttribute('x'));
        var pw = parseInt(this.parentNode.getAttribute('width'));
        tw = this.getBBox().width;

        this.setAttribute('x', px + (pw / 2 - tw / 2));
      }
    } else {
      if (this.parentNode.classList.contains('collapsed')) {
        this.style.visibility = 'hidden';
        tooltip.innerHTML = d.key;
      } else {
        this.style.visibility = 'visible';
        tooltip.innerHTML = '';
      }

      if (elipsisRegex.test(this.innerHTML) === true) {
        this.innerHTML = removeParentNamesRegex.exec(d.key);
      }

      var px = parseInt(this.parentNode.getAttribute('x'));
      var pw = parseInt(this.parentNode.getAttribute('width'));
      tw = this.getBBox().width;

      this.setAttribute('x', px + (pw / 2 - tw / 2));
    }
  }

  // algorithm that populates the data graph
  // openmdao system variables are not included in the graph
  function getChildren(d) {
    var vals = d3.entries(d.value);

    vals.forEach(function(ele, i, arr) {
      ele.siblingOrder = i;
    });

    return vals.filter(function(d, i, arr) {
      return d.value.constructor.name === 'Object';
    });
  }

  // returns all data at a particular depth in row order by screen x position
  function getDataByDepth(depth) {
    var data = [];

    svg.selectAll('g').each(function(d) {
      if (d.depth === depth) {
        data.push(d);
      }
    }).sort(function(a, b) {
      return a.rowOrder - b.rowOrder;
    });

    return data;
  }

  // gets all leaves that are decendants of datum
  // !IMPORTANT: This function guarantees leaves are returned in row order,
  // and code that uses this funciton depends on that!
  function getDataLeaves(datum) {
    var leaves = [];
    var selection;

    if (datum == null) {
      selection = svg.selectAll('g');

    } else {
      selection = d3.select(datum.element);
      selection = selection.datumDescendantElements(datum)
        .filter(function(d) {
          return this.nodeName === 'g';
        });
    }

    selection.each(function(d) {
      if (d.children == null) {
        leaves.push(d);
      }
    });

    return leaves;
  }

  // Adds svg elements of a datum's childrewindow.outerWidthn to the selection
  d3.selection.prototype.datumChildrenElements = function(datum) {
    var children = datum.element.children;

    if (children != null) {
      for (var i = 0; i < children.length; ++i) {
        this[0].push(children.item(i));
      }
    }

    return this;
  };

  // adds svg elements of a datum's ancestors to the selection
  d3.selection.prototype.datumAncestorElements = function(datum) {
    while (datum.parent != null) {
      this[0].push(datum.parent.element);
      datum = datum.parent;
    }

    return this;
  };

  // adds svg elements of a datum's descendants to the selection
  d3.selection.prototype.datumDescendantElements = function(datum) {
    (function _pushd(d) {
      var children = d.children;

      if (children != null) {
        for (var i = 0; i < children.length; ++i) {
          this[0].push(children[i].element);
          _pushd.call(this, children[i]);
        }
      }
    }).call(this, datum);

    return this;
  };

  // adds svg elements of a datum's siblings to the selection
  d3.selection.prototype.datumSiblingElements = function(datum) {
    if (datum.parent != null) {
      datum.parent.children.forEach(function(d, i, arr) {
        if (d.element !== datum.element) {
          this[0].push(d.element);
        }
      }, this);
    }
    return this;
  };

}(d3));


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MultiChainLib
{
    public class TxOutSetInfoResponse
    {
        [JsonProperty("height")]
        public int Height { get; set; }

        [JsonProperty("bestblock")]
        public string BestBlock { get; set; }

        [JsonProperty("transactions")]
        public int Transactions { get; set; }

        [JsonProperty("txouts")]
        public int TxOuts { get; set; }

        [JsonProperty("bytes_serialized")]
        public long BytesSerialized { get; set; }

        [JsonProperty("hash_serialized")]
        public string HashSerialized { get; set; }

        [JsonProperty("total_amount")]
        public decimal TotalAmount { get; set; }
    }
}


text:
using System.Configuration;
using Microsoft.Owin;
using Microsoft.Owin.Security.ActiveDirectory;
using Owin;
using SFA.DAS.EmployerFinance.Api;

[assembly: OwinStartup(typeof(Startup))]

namespace SFA.DAS.EmployerFinance.Api
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            _ = app.UseWindowsAzureActiveDirectoryBearerAuthentication(new WindowsAzureActiveDirectoryBearerAuthenticationOptions
            {
                Tenant = ConfigurationManager.AppSettings["idaTenant"],
                TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters
                {
                    RoleClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role",
                    ValidAudiences = ConfigurationManager.AppSettings["FinanceApiIdaAudience"].ToString().Split(',')
                }
            });
        }
    }
}


text:
package com.frameworkset.odbc;

import java.sql.SQLException;
import java.util.List;

import org.junit.Test;

import com.frameworkset.common.poolman.DBUtil;
import com.frameworkset.common.poolman.SQLExecutor;

public class OdbcTest {
	@Test
	public void selectSql()
	{
		try {
			DBUtil.startPoolFromConf("com/frameworkset/odbc/odbc.xml");
			String file = SQLExecutor.queryField("select LOG_FIELD from testlog2_2 where LOG_FIELD is not null");
			System.out.println(file);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Test
	public void selectSqlList()
	{
		try {
			DBUtil.startPoolFromConf("com/frameworkset/odbc/odbc.xml");
			List<TransLogTableModel> files = SQLExecutor.queryList(TransLogTableModel.class,"select LOG_FIELD from testlog2_2 where LOG_FIELD is not null");
			for(TransLogTableModel f:files)
			{
				System.out.println(f.getLOG_FIELD());
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}


text:
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Http\Requests\LoginRequest;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * The number of minutes to throttle for.
     *
     * @return int
     */
    protected $decayMinutes = 60 * 3;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest', ['except' => 'logout']);
    }

    /**
     * Get the login username to be used by the controller.
     *
     * @return string
     */
    public function username()
    {
        return 'name';
    }
}


text:
#ifndef HL_CNN_H_
#define HL_CNN_H_

#include "hl_base.h"

/**
 * @brief   Shrink column to feature.
 *
 * @param[in]   dataCol     expand data.
 * @param[in]   channels    number of channel.
 * @param[in]   height      image height.
 * @param[in]   width       image width.
 * @param[in]   blockH      filter height.
 * @param[in]   blockW      filter width.
 * @param[in]   strideH     stride height.
 * @param[in]   strideW     stride width.
 * @param[in]   paddingH    padding height.
 * @param[in]   paddingW    padding width.
 * @param[in]   outputH     output height.
 * @param[in]   outputW     output width.
 * @param[out]  dataIm      output image data.
 * @param[in]   alpha
 * @param[in]   beta
 */
extern void hl_shrink_col2feature(const real* dataCol,
                                  size_t channels,
                                  size_t height,
                                  size_t width,
                                  size_t blockH,
                                  size_t blockW,
                                  size_t strideH,
                                  size_t strideW,
                                  size_t paddingH,
                                  size_t paddingW,
                                  size_t outputH,
                                  size_t outputW,
                                  real* dataIm,
                                  real alpha = 1.0f,
                                  real beta = 0.0f);

/**
 * @brief   Expand feature to column.
 *
 * @param[in]   dataIm      input image data.
 * @param[in]   channels    number of channel.
 * @param[in]   height      image height.
 * @param[in]   width       image width.
 * @param[in]   blockH      filter height.
 * @param[in]   blockW      filter width.
 * @param[in]   strideH     stride height.
 * @param[in]   strideW     stride width.
 * @param[in]   paddingH    padding height.
 * @param[in]   paddingW    padding width.
 * @param[in]   outputH     output height.
 * @param[in]   outputW     output width.
 * @param[out]  dataCol     expand data.
 *
 */
extern void hl_expand_feature2col(const real* dataIm,
                                  size_t channels,
                                  size_t height,
                                  size_t width,
                                  size_t blockH,
                                  size_t blockW,
                                  size_t strideH,
                                  size_t strideW,
                                  size_t paddingH,
                                  size_t paddingW,
                                  size_t outputH,
                                  size_t outputW,
                                  real* dataCol);

/**
 * @brief   Maximum pool forward.
 *
 * @param[in]   frameCnt    batch size of input image.
 * @param[in]   inputData   input data.
 * @param[in]   channels    number of channel.
 * @param[in]   height      image height.
 * @param[in]   width       image width.
 * @param[in]   pooledH     output image height.
 * @param[in]   pooledW     output image width.
 * @param[in]   sizeX       width of pooling window.
 * @param[in]   sizeY       height of pooling window.
 * @param[in]   strideH     pooling stride height.
 * @param[in]   strideW     pooling stride width.
 * @param[in]   paddingH    padding height.
 * @param[in]   paddingW    padding width.
 * @param[out]  tgtData     output data.
 * @param[in]   tgtStride   stride between output data samples.
 *
 */
extern void hl_maxpool_forward(const int frameCnt,
                               const real* inputData,
                               const int channels,
                               const int height,
                               const int width,
                               const int pooledH,
                               const int pooledW,
                               const int sizeX,
                               const int sizeY,
                               const int strideH,
                               const int strideW,
                               const int paddingH,
                               const int paddingW,
                               real* tgtData,
                               const int tgtStride);

/**
 * @brief   Maximum pool backward.
 *
 * @param[in]   frameCnt    batch size of input image.
 * @param[in]   inputData   input data.
 * @param[out]  outData     output data.
 * @param[out]  outGrad     output grad data.
 * @param[in]   channels    number of channel.
 * @param[in]   height      image height.
 * @param[in]   width       image width.
 * @param[in]   pooledH     output image height.
 * @param[in]   pooledW     output image width.
 * @param[in]   sizeX       width of pooling window.
 * @param[in]   sizeY       height of pooling window.
 * @param[in]   strideH     pooling stride height.
 * @param[in]   strideW     pooling stride width.
 * @param[in]   scaleA      scale.
 * @param[in]   scaleB      scale.
 * @param[in]   paddingH    padding height.
 * @param[in]   paddingW    padding width.
 * @param[out]  targetGrad  output grad.
 * @param[in]   outStride   stride between output data samples.
 *
 */
extern void hl_maxpool_backward(const int frameCnt,
                                const real* inputData,
                                const real* outData,
                                const real* outGrad,
                                const int channels,
                                const int height,
                                const int width,
                                const int pooledH,
                                const int pooledW,
                                const int sizeX,
                                const int sizeY,
                                const int strideH,
                                const int strideW,
                                const int paddingH,
                                const int paddingW,
                                real scaleA,
                                real scaleB,
                                real* targetGrad,
                                const int outStride);

/**
 * @brief   Averge pool forward.
 *
 * @param[in]   frameCnt    batch size of input image.
 * @param[in]   inputData   input data.
 * @param[in]   channels    number of channel.
 * @param[in]   height      image height.
 * @param[in]   width       image width.
 * @param[in]   pooledH     output image height.
 * @param[in]   pooledW     output image width.
 * @param[in]   sizeX       width of pooling window.
 * @param[in]   sizeY       height of pooling window.
 * @param[in]   strideH     pooling stride height.
 * @param[in]   strideW     pooling stride width.
 * @param[in]   paddingH    padding height.
 * @param[in]   paddingW    padding width.
 * @param[out]  tgtData     output data.
 * @param[in]   tgtStride   stride between output data samples.
 *
 */
extern void hl_avgpool_forward(const int frameCnt,
                               const real* inputData,
                               const int channels,
                               const int height,
                               const int width,
                               const int pooledH,
                               const int pooledW,
                               const int sizeX,
                               const int sizeY,
                               const int strideH,
                               const int strideW,
                               const int paddingH,
                               const int paddingW,
                               real* tgtData,
                               const int tgtStride);

/**
 * @brief   Maximum pool backward.
 *
 * @param[in]   frameCnt    batch size of input image.
 * @param[in]   outGrad     output grad data.
 * @param[in]   channels    number of channel.
 * @param[in]   height      image height.
 * @param[in]   width       image width.
 * @param[in]   pooledH     output image height.
 * @param[in]   pooledW     output image width.
 * @param[in]   sizeX       width of pooling window.
 * @param[in]   sizeY       height of pooling window.
 * @param[in]   strideH     pooling stride height.
 * @param[in]   strideW     pooling stride width.
 * @param[in]   paddingH    padding height.
 * @param[in]   paddingW    padding width.
 * @param[in]   scaleA      scale.
 * @param[in]   scaleB      scale.
 * @param[out]  backGrad    output grad.
 * @param[in]   outStride   stride between output data samples.
 *
 */
extern void hl_avgpool_backward(const int frameCnt,
                                const real* outGrad,
                                const int channels,
                                const int height,
                                const int width,
                                const int pooledH,
                                const int pooledW,
                                const int sizeX,
                                const int sizeY,
                                const int strideH,
                                const int strideW,
                                int paddingH,
                                int paddingW,
                                real scaleA,
                                real scaleB,
                                real* backGrad,
                                const int outStride);

/**
 * @brief   Bilinear interpolation forward.
 *
 * @param[in]   inData      input value.
 * @param[in]   inImgH      input image height.
 * @param[in]   inImgW      input image width.
 * @param[in]   inputH      input batchSize.
 * @param[in]   inputW      input image data dim.
 * @param[out]  outData     output value.
 * @param[in]   outImgH     output image height.
 * @param[in]   outImgW     output image width.
 * @param[in]   outputH     output batchSize.
 * @param[in]   outputW     output image data dim.
 * @param[in]   numChannels number of channels.
 * @param[in]   ratioH      inImgH / outImgH.
 * @param[in]   ratioW      inImgW / outImgW.
 *
 */
extern void hl_bilinear_forward(const real* inData,
                                const size_t inImgH,
                                const size_t inImgW,
                                const size_t inputH,
                                const size_t inputW,
                                real* outData,
                                const size_t outImgH,
                                const size_t outImgW,
                                const size_t outputH,
                                const size_t outputW,
                                const size_t numChannels,
                                const real ratioH,
                                const real ratioW);

/**
* @brief   Bilinear interpolation backward.
*
* @param[out]  inGrad      input gradient.
* @param[in]   inImgH      input image height.
* @param[in]   inImgW      input image width.
* @param[in]   inputH      input batchSize.
* @param[in]   inputW      input image data dim.
* @param[in]   outGrad     output gradient.
* @param[in]   outImgH     output image height.
* @param[in]   outImgW     output image width.
* @param[in]   outputH     output batchSize.
* @param[in]   outputW     output image data dim.
* @param[in]   numChannels number of channels.
* @param[in]   ratioH      inImgH / outImgH.
* @param[in]   ratioW      inImgW / outImgW.
*
*/
extern void hl_bilinear_backward(real* inGrad,
                                 const size_t inImgH,
                                 const size_t inImgW,
                                 const size_t inputH,
                                 const size_t inputW,
                                 const real* outGrad,
                                 const size_t outImgH,
                                 const size_t outImgW,
                                 const size_t outputH,
                                 const size_t outputW,
                                 const size_t numChannels,
                                 const real ratioH,
                                 const real ratioW);

/**
 * @brief   MaxOut forward.
 *
 * @param[in]   inData      input data.
 * @param[out]  outData     output data.
 * @param[out]  idData      output maxId.
 * @param[in]   batchSize   batchSize.
 * @param[in]   size        number of channels * image height * image width.
 * @param[in]   featLen     feature length = image height * image width.
 * @param[in]   groups      number of groups.
 */
extern void hl_maxout_forward(const real* inData,
                              real* outData,
                              int* idData,
                              size_t batchSize,
                              size_t size,
                              size_t featLen,
                              size_t groups);

/**
 * @brief   MaxOut backward.
 *
 * @param[out]  inGrad      input grad data.
 * @param[in]   outGrad     output grad data.
 * @param[in]   idData      output maxId.
 * @param[in]   batchSize   batchSize.
 * @param[in]   size        number of channels * image height * image width.
 * @param[in]   featLen     feature length = image height * image width.
 * @param[in]   groups      number of groups.
 */
extern void hl_maxout_backward(real* inGrad,
                               const real* outGrad,
                               const int* idData,
                               size_t batchSize,
                               size_t size,
                               size_t featLen,
                               size_t groups);

#endif /* HL_CNN_H_ */