text:
/**
 * left,top是这个框的坐标
 * current是鼠标的坐标,因为我们用e.clientX来记录鼠标的位置,每次鼠标点击拖拽的时候
 * 坐标都不一致
 * 我们的算法就是,通过current字段与clientX的偏移量计算,再加之left, top赋给target.style.left(top)来实现框的移动
 */

let params = {
    flag: false,
    left: 0,
    top: 0,
    currentX: 0,
    currentY: 0
}

function getCss (target, key) {
    return target.currentStyle ? target.currentStyle[key] : document.defaultView.getComputedStyle(target, false)[key];
}

function startDrag (bar, target, callback) {
    if (getCss(target, 'left') !== 'auto') {
        params.left = getCss(target, 'left');
    }

    if (getCss(target, 'top') !== auto) {
        params.top = getCss(target, 'top');
    }

    bar.onmousedown = function(event) {
        if (!event) {
            event = window.event;
        }

        params.flag = true;
        params.currentX = event.clientX;
        params.currentY = event.clientY;
    }

    document.onmouseup = function(event) {
        if (!event) {
            event = window.event;
        }

        /**
         * 抬起鼠标,则重置现在框的位置
         */
        if(getCss(target, "left") !== "auto"){
            params.left = getCss(target, "left");
        }
        if(getCss(target, "top") !== "auto"){
            params.top = getCss(target, "top");
        }

    }

    document.onmousemove = function(event) {
        let e = event ? event : window.event;
        if(params.flag){
            var nowX = e.clientX, nowY = e.clientY;
            var disX = nowX - params.currentX, disY = nowY - params.currentY;
            target.style.left = parseInt(params.left) + disX + "px";
            target.style.top = parseInt(params.top) + disY + "px";
            if (event.preventDefault) {
                event.preventDefault();
            }
            return false;
        }

        if (typeof callback == "function") {
            callback(parseInt(params.left) + disX, parseInt(params.top) + disY);
        }
    }

    let div = document.getElementsByClassName('test-box')[0];
    startDrag(div, div, console.log('MOVED!'));
}


text:
using Citicon.Data;
using System.Windows;

namespace Citicon.DesktopClient.QuotationApproval.Views
{
    public delegate void ClientDisplayNextButtonClickEventHandler(object sender, ClientDisplayNextButtonClickEventArgs e);

    public class ClientDisplayNextButtonClickEventArgs : RoutedEventArgs
    {
        public ClientDisplayNextButtonClickEventArgs(Client selectedClient)
        {
            SelectedClient = selectedClient;
        }

        public Client SelectedClient { get; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// TNT Basic
// CForStatement.cpp
// © Mark Tully 1999
// 26/12/99
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ

/*
	Implements a for loop.
		FOR x = start TO end [STEP y]
			.
			.
		NEXT x

	The loop terminates as soon as x is past end. To decide this the test must know in which direction the loop is proceeding
	only then can it tell which side of end it's on and hence whether it has moved past it. There are several ways of deciding
	this (bearing in mind that start, end and y can all be expressions which can be assigned during the loop)

		1) Look at the step and see if it's + or -
		2) Look at the start and end and see what direction x must move in
		3) Look at what side of end x starts on and break when it changes what side it's on
		4) Break when it exits the range *start-end (where *start is the EVALUATED value of start rather than the expression)

	Without a good spec of exactly how a for loop should behave it's impossible to choose. I would say the one least likely
	to produce unexected behaviour is option 4. This allows end and step to vary wildly but a solid constraint will still
	apply.

	To achieve this the CForStatement creates two new statements, one is a statement which evaluates whether the for loop
	should run. This is placed as the first statement in the sub statements. If it decides it shouldn't run it breaks the
	loop. The other alters the value of the induction var and then performs an unconditional branch back to the first
	statement of the sub statements, the test.

	The CForStatement itself assigns the correct initial value to induction variable.
*/

#include		"CForStatement.h"
#include		"CProgram.h"
#include		"Integer_Storage.h"
#include		"CArithExpression.h"

// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ CForStatement::Constructor									/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// This is called to create a for statement, it requires the statement block to be set using SetSubStatements.
// inStep may be nil in which case a step value of 1 is used.
CForStatement::CForStatement(
	CIntegerStorage		*inIndex,
	CArithExpression	*inStart,
	CArithExpression	*inEnd,
	CArithExpression	*inStep) :
	CStatementBlock(true,0),
	mIndex(inIndex),
	mStart(inStart),
	mEnd(inEnd),
	mStep(inStep),
	mForTestStatement(0)
{
}

// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ CForStatement::SetSubStatements									/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Override which appends a for test statement and an incremenet statement
void CForStatement::SetSubStatements(
	CVariableSymbolTable	&inCurrScope,
	CStatement			*inSubStatements)
{
	// Construct the two control statements the test and increment
	mForTestStatement=new CForTestStatement(inCurrScope,mIndex,mEnd.Get());
	UTBException::ThrowIfNoParserMemory(mForTestStatement);

	mForTestStatement->Append(inSubStatements);

	CStatement		*step=new CForNextStatement(mIndex,mStep.Get(),mForTestStatement);
	if (!step)
		delete mForTestStatement;
	UTBException::ThrowIfNoParserMemory(step);

	mForTestStatement->Append(step);

	// Install the sub statements
	CStatementBlock::SetSubStatements(mForTestStatement);
}

// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ CForStatement::ExecuteSelf									/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Assigns a start value to the index var and also records what this value was in the test statement giving a testing range
void CForStatement::ExecuteSelf(
	CProgram			&ioState)
{
	TTBInteger				start=mStart->EvaluateInt(ioState);

	mIndex->SetValue(ioState,start);
	mForTestStatement->FixStartValue(ioState,start);
}

// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ CForTestStatement::Constructor
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Enters a symbol for storing the evaluated start value for the for loop
CForTestStatement::CForTestStatement(
	CVariableSymbolTable	&inScope,
	CIntegerStorage		*inSymbol,
	CArithExpression	*inEndValue) :
	mIndex(inSymbol),
	mEndRange(inEndValue)
{
	mSymbol=(CIntegerSymbol*)inScope.EnterTemporary(CVariableSymbol::kInteger);
}

// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ CForTestStatement::FixStartValue
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
void CForTestStatement::FixStartValue(
	CProgram			&ioState,
	TTBInteger			inValue)
{
	mSymbol->SetValue(ioState,inValue);
}

// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ CForTestStatement::ExecuteSelf								/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// breaks the loop if the induction var is out of the range of start to end
void CForTestStatement::ExecuteSelf(
	CProgram		&ioState)
{
	TTBInteger				end=mEndRange->EvaluateInt(ioState);
	TTBInteger				curr=mIndex->GetValue(ioState);
	TTBInteger				startVal=mSymbol->GetValue(ioState);

	if (((startVal<=end) && (curr<startVal || curr>end)) || ((startVal>end) && (curr>startVal || curr<end)))
	{
		// break condition - move PC to after the for loop
		ioState.SetPC(mContainerBlock->GetNextStatement());	// NB : mContainer is the CForStatement
	}
}

// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ CForNextStatement::ExecuteSelf								/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Increments the induction var by step and branches back to the test statement
void CForNextStatement::ExecuteSelf(
	CProgram		&ioState)
{
	TTBInteger				curr=mIndex->GetValue(ioState);

	if (mStep)
		curr+=mStep->EvaluateInt(ioState);
	else
		curr++;

	mIndex->SetValue(ioState,curr);

	ioState.SetPC(mTest);
}


text:
"use strict";
var ngModule = angular.module('app.property', ['app.common']);
require("./controllers/property-list-ctrl")(ngModule);
require("./controllers/property-create-ctrl")(ngModule);
require("./controllers/property-edit-ctrl")(ngModule);
require("./services/property-service")(ngModule);
require("./filters/property-type-filter")(ngModule);
// require("./filters/dealer-status-filter")(ngModule);
ngModule.config(function ($stateProvider) {
    $stateProvider
    .state('app.property', {
        abstract: true
    })
    .state('app.property.list', {
        url: '/property',
        views: {
          '@': {
            template: require('./templates/property-list.jade'),
            controller: 'PropertyListCtrl as vm'
          }
        }
    })
    .state('app.property.create', {
        url: '/property/create',
        views: {
          '@': {
            template: require('./templates/property-create.jade'),
            controller: 'PropertyCreateCtrl as vm'
          }
        },
        resolve: {
          parents: function(PropertyService, Loader) {
            Loader.show();
            return PropertyService.list().then(function(data) {
              Loader.hide();
              return data.response.data.data;
            });
          }
        }
    })
    .state('app.property.edit', {
      url: '/property/:id/edit',
      views: {
        '@': {
            template: require('./templates/property-edit.jade'),
            controller: 'PropertyEditCtrl as vm'
          }
        },
        resolve: {
            property: function (PropertyService, $stateParams, Loader) {
                Loader.show();
                return PropertyService.view($stateParams.id).then(function (data) {
                    Loader.hide();
                    return data.response.data;
                });
            },
            parents: function(PropertyService, Loader) {
              Loader.show();
              return PropertyService.list().then(function(data) {
                Loader.hide();
                return data.response.data.data;
              });
            }
        },
    });
});


text:
package main

const USER_ENV_NAME = "USERNAME"
const HOME_ENV_NAME = "USERPROFILE"


text:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>
    <class name="org.mifos.accounts.fees.business.FeePaymentEntity" table="fee_payment">
        <id name="id" column="fee_payment_id" type="short">
            <generator class="native"/>
        </id>
		 <many-to-one name="lookUpValue" column="fee_payment_lookup_id" class="org.mifos.application.master.business.LookUpValueEntity"
    			cascade="none" update="false" unique="true"/>
    </class>
</hibernate-mapping>


text:
const moment               = require('moment');
const HighchartUI          = require('./charts/highchart.ui');
const requireHighstock     = require('./common').requireHighstock;
const countDecimalPlaces   = require('./common_independent').countDecimalPlaces;
const Reset                = require('./reset');
const getUnderlyingPipSize = require('./symbols').getUnderlyingPipSize;
const Tick                 = require('./tick');
const updatePurchaseStatus = require('./update_values').updatePurchaseStatus;
const ViewPopupUI          = require('../user/view_popup/view_popup.ui');
const BinarySocket         = require('../../base/socket');
const ChartSettings        = require('../../common/chart_settings');
const addComma             = require('../../../_common/base/currency_base').addComma;
const CommonFunctions      = require('../../../_common/common_functions');
const localize             = require('../../../_common/localize').localize;
const getPropertyValue     = require('../../../_common/utility').getPropertyValue;

const TickDisplay = (() => {
    let number_of_ticks,
        display_symbol,
        contract_start_ms,
        contract_category,
        should_set_barrier,
        barrier,
        display_decimals,
        show_contract_result,
        price,
        payout,
        ticks_needed,
        x_indicators,
        chart,
        Highcharts,
        applicable_ticks,
        contract_start_moment,
        counter,
        spots_list,
        tick_init,
        reset_spot_plotted,
        response_id,
        contract,
        selected_tick;

    let id_render = 'tick_chart';

    const winning_color = 'rgba(46, 136, 54, 0.2)';
    const losing_color  = 'rgba(204, 0, 0, 0.1)';

    const color  = 'orange';
    const marker = {
        fillColor: color,
        lineColor: color,
        lineWidth: 3,
        radius   : 4,
        states   : { hover: { fillColor: color, lineColor: color, lineWidth: 3, radius: 4 } },
    };

    const initialize = (data, options) => {
        // setting up globals
        applicable_ticks     = [];
        number_of_ticks      = parseInt(data.number_of_ticks);
        display_symbol       = data.display_symbol;
        contract_start_ms    = parseInt(data.contract_start) * 1000;
        contract_category    = data.contract_category;
        should_set_barrier   = !contract_category.match('digits|runs');
        display_decimals     = data.display_decimals || 2;
        show_contract_result = data.show_contract_result;
        reset_spot_plotted   = false;
        barrier              = data.barrier || undefined;

        if (data.id_render) {
            id_render = data.id_render;
        }

        if (data.show_contract_result) {
            price  = parseFloat(data.price);
            payout = parseFloat(data.payout);
        }

        selected_tick = '';
        if (/^(tickhigh|ticklow)_/i.test(data.shortcode)) {
            const arr_shortcode = data.shortcode.split('_');
            selected_tick = arr_shortcode[arr_shortcode.length - 1];
        }

        setXIndicators();
        requireHighstock((Highstock) => {
            Highcharts = Highstock;
            const is_small_width     = window.innerWidth < 480;
            const overlay_margin_top = is_small_width ? 70 : 40;
            const overlay_height     = is_small_width ? 200 : 170;
            initializeChart({
                display_decimals,
                data         : [],
                el           : id_render,
                events       : { load: () => { plot(); } },
                margin_top   : show_contract_result ? overlay_margin_top : null,
                has_animation: show_contract_result,
                height       : show_contract_result ? overlay_height : null,
                radius       : 4,
                title        : show_contract_result ? '' : display_symbol,
                tooltip      : {
                    formatter() {
                        const new_y = addComma(this.y.toFixed(display_decimals));
                        const mom   = moment.utc(applicable_ticks[this.x].epoch * 1000).format('dddd, MMM D, HH:mm:ss');
                        return `<div class='tooltip-body'>${mom}<br/>${display_symbol} ${new_y}</div>`;
                    },
                },
                type  : 'line',
                width : data.width ? data.width : (show_contract_result ? 394 : null),
                x_axis: { labels: { enabled: false }, ...(show_contract_result ? { max: number_of_ticks + 1, min: 0, type: 'linear' } : {}) },
            }, options);
        });
    };

    const setXIndicators = () => {
        const exit_tick_index = number_of_ticks - 1;
        if (contract_category.match('asian')) {
            ticks_needed = number_of_ticks;
            x_indicators = {
                _0: { label: localize('Entry Spot'), id: 'start_tick' },
            };
            x_indicators[`_${exit_tick_index}`] = {
                label    : localize('Exit Spot'),
                id       : 'exit_tick',
                dashStyle: 'Dash',
            };
        } else if (contract_category.match(/callput|reset/i)) {
            ticks_needed = number_of_ticks + 1;
            x_indicators = {
                _0: { label: localize('Entry Spot'), id: 'entry_tick' },
            };
            x_indicators[`_${number_of_ticks}`] = {
                label    : localize('Exit Spot'),
                id       : 'exit_tick',
                dashStyle: 'Dash',
            };
            if (contract_category.match('reset')) {
                const reset_time_index = Math.floor(number_of_ticks / 2); // use index to draw ticks reset_time
                x_indicators[`_${reset_time_index}`] = {
                    index: reset_time_index,
                    label: localize('Reset Time'),
                    id   : 'reset_tick',
                    color: '#000',
                };
            }
        } else if (contract_category.match('touchnotouch')) {
            ticks_needed = number_of_ticks + 1;
            x_indicators = {
                _0: { label: localize('Entry Spot'), id: 'entry_tick' },
            };
        } else if (contract_category.match('highlowticks')) {
            ticks_needed = number_of_ticks;
            x_indicators = {
                _0: { label: localize('Entry Spot'), id: 'start_tick' },
            };
        } else if (contract_category.match('runs')) {
            ticks_needed = number_of_ticks + 1;
            x_indicators = {
                _0: { label: localize('Entry Spot'), id: 'entry_tick' },
            };
        } else {
            x_indicators = {};
        }
    };

    const initializeChart = (config, data) => {
        const has_reset_barrier = contract.entry_spot && contract.barrier &&
            Reset.isReset(contract_category) && Reset.isNewBarrier(contract.entry_spot, contract.barrier);
        Highcharts.setOptions({
            lang: { thousandsSep: ',' },
        });
        ChartSettings.setChartOptions(config);
        chart = new Highcharts.Chart(ChartSettings.getChartOptions());
        HighchartUI.updateLabels(chart, {
            contract_type   : contract_category,
            has_barrier     : should_set_barrier && contract_category !== 'highlowticks',
            is_reset_barrier: has_reset_barrier,
            is_tick_trade   : true,
            shortcode       : contract.shortcode,
            show_end_time   : true,
        });
        if (data) {
            dispatch(data);
        }
        let resize_timeout;
        const el_chart_container = CommonFunctions.getElementById(id_render);
        window.addEventListener('resize', (e) => {
            e.stopPropagation();
            if (!CommonFunctions.isVisible(el_chart_container)) return;
            clearTimeout(resize_timeout);
            resize_timeout = setTimeout(() => {
                const { offsetWidth, offsetHeight } = el_chart_container;
                chart.setSize(offsetWidth, offsetHeight);
            }, 250);
        });
    };

    const isRelativeBarrier = (barrier_str) => (/\+|-/.test(barrier_str));

    const addBarrier = () => {
        if (!should_set_barrier) {
            return;
        }

        const barrier_type = /^(asian|highlowticks)$/.test(contract_category) ? contract_category : 'static';

        let calculated_barrier = '';

        if (barrier_type === 'static') {
            const first_quote = applicable_ticks[0].quote;
            let barrier_quote = first_quote;
            if (barrier) {
                let final_barrier = Number(barrier).toFixed(parseInt(display_decimals));
                if (isRelativeBarrier(barrier)) {
                    // sometimes due to rounding issues, result is 1.009999 while it should be 1.01
                    final_barrier = Number(`${Math.round(`${barrier_quote + parseFloat(barrier)}e${display_decimals}`)}e-${display_decimals}`);
                }
                barrier_quote = final_barrier;
            } else if (contract && contract.barrier) {
                barrier_quote = parseFloat(contract.barrier);
            }

            chart.yAxis[0].addPlotLine({
                id   : 'tick-barrier',
                value: barrier_quote,
                label: {
                    text : `${localize('Barrier')} (${addComma(barrier_quote)})`,
                    align: Reset.isReset(contract_category) ? 'right' : 'center',
                    x    : Reset.isReset(contract_category) ? -60 : 0,
                },
                color : 'green',
                width : 2,
                zIndex: 2,
            });
            calculated_barrier = addComma(barrier_quote, parseInt(display_decimals));
            should_set_barrier = false;
        }

        if (barrier_type === 'asian') {
            const decimal_places = parseInt(display_decimals) + 1;
            let total = 0;
            for (let i = 0; i < applicable_ticks.length; i++) {
                total += parseFloat(applicable_ticks[i].quote);
            }
            // round calculated barrier
            const calc_barrier = (total / applicable_ticks.length).toFixed(decimal_places);

            chart.yAxis[0].removePlotLine('tick-barrier');
            chart.yAxis[0].addPlotLine({
                id   : 'tick-barrier',
                value: calc_barrier,
                color: 'green',
                label: {
                    text : `${localize('Average')} (${addComma(calc_barrier)})`,
                    align: 'center',
                },
                width : 2,
                zIndex: 2,
            });
            calculated_barrier = addComma(calc_barrier, decimal_places);
        }

        if (calculated_barrier) {
            CommonFunctions.elementInnerHtml(CommonFunctions.getElementById('contract_purchase_barrier'), `${localize('Barrier')}: ${calculated_barrier}`);
        }
    };

    const add = (indicator) => {
        chart.xAxis[0].addPlotLine({
            value    : indicator.index,
            id       : indicator.id,
            label    : { text: indicator.label, x: /start_tick|entry_tick/.test(indicator.id) ? -15 : 5 },
            color    : indicator.color || '#e98024',
            width    : 2,
            zIndex   : 2,
            dashStyle: indicator.dashStyle || '',
        });
    };

    const evaluateContractOutcome = () => {
        if (contract.status && contract.status !== 'open') {
            if (contract.status === 'won') {
                if (show_contract_result) {
                    $(`#${id_render}`).css('background-color', winning_color);
                    updatePurchaseStatus(payout, price, contract.profit, localize('This contract won'));
                }
            } else if (contract.status === 'lost') {
                if (show_contract_result) {
                    $(`#${id_render}`).css('background-color', losing_color);
                    updatePurchaseStatus(0, -price, contract.profit, localize('This contract lost'));
                }
            }

            addExitSpot();
        }

        if (Reset.isReset(contract_category) && Reset.isNewBarrier(contract.entry_spot, contract.barrier)) {
            plotResetSpot(+contract.barrier);
        }
    };

    const plot = () => {
        contract_start_moment = moment(contract_start_ms).utc();
        counter               = 0;
        applicable_ticks      = [];
    };

    const dispatch = async (data) => {
        const tick_chart = CommonFunctions.getElementById(id_render);

        if (!CommonFunctions.isVisible(tick_chart) || !data || (!data.tick && !data.history)) {
            return;
        }

        if (getPropertyValue(data, ['tick', 'id']) && document.getElementById('sell_content_wrapper')) {
            response_id = data.tick.id;
            ViewPopupUI.storeSubscriptionID(response_id);
        }

        let epoches,
            spots2,
            chart_display_decimals;

        if (document.getElementById('sell_content_wrapper')) {
            if (!chart_display_decimals) {
                // We're getting the pip size based on standard `display_value` provided by API
                const {
                    entry_spot_display_value,
                    entry_tick_display_value,
                    exit_tick_display_value,
                    sell_spot_display_value,
                } = contract;
                const available_display_value = entry_spot_display_value
                    || entry_tick_display_value
                    || exit_tick_display_value
                    || sell_spot_display_value;
                const available_underlying = data.echo_req.ticks_history || data.echo_req.ticks || data.tick.symbol;
                chart_display_decimals = countDecimalPlaces(available_display_value)
                    || await getUnderlyingPipSize(available_underlying)
                    || Tick.pipSize();
            }
            if (data.tick) {
                Tick.details(data);
            }
            if (!tick_init && contract) {
                let category = 'callput';
                if (/asian/i.test(contract.shortcode)) {
                    category = 'asian';
                } else if (/touch/i.test(contract.shortcode)) {
                    category = 'touchnotouch';
                } else if (/reset/i.test(contract.shortcode)) {
                    category = 'reset';
                } else if (/^(tickhigh|ticklow)_/i.test(contract.shortcode)) {
                    category = 'highlowticks';
                } else if (/^(runhigh|runlow)/i.test(contract.shortcode)) {
                    category = 'runs';
                }

                initialize({
                    barrier,
                    symbol              : contract.underlying,
                    number_of_ticks     : contract.tick_count,
                    contract_category   : category,
                    longcode            : contract.longcode,
                    display_symbol      : contract.display_name,
                    contract_start      : contract.date_start,
                    display_decimals    : chart_display_decimals,
                    shortcode           : contract.shortcode,
                    show_contract_result: 0,
                }, data);
                spots_list = {};
                tick_init  = 'initialized';
                return;
            }
        }

        if (data.tick) {
            spots2  = Tick.spots();
            epoches = Object.keys(spots2).sort((a, b) => a - b);
        } else if (data.history) {
            epoches = data.history.times;
        }

        let has_finished = applicable_ticks && ticks_needed && applicable_ticks.length >= ticks_needed;
        if (contract_category.match('runs')) {
            has_finished = (applicable_ticks.length && contract.exit_tick_time) || false;
        }
        const has_sold = contract && contract.exit_tick_time && applicable_ticks
            && applicable_ticks.find(({ epoch }) => +epoch === +contract.exit_tick_time) !== undefined;

        if (!has_finished && !has_sold && (!data.tick || !contract.status || contract.status === 'open')) {
            for (let d = 0; d < epoches.length; d++) {
                let tick;
                if (data.tick) {
                    tick = {
                        epoch: parseInt(epoches[d]),
                        quote: parseFloat(spots2[epoches[d]]),
                    };
                } else if (data.history) {
                    tick = {
                        epoch: parseInt(data.history.times[d]),
                        quote: parseFloat(data.history.prices[d]),
                    };
                }

                const current_tick_count = applicable_ticks.length + 1;

                if (contract_start_moment && tick.epoch > contract_start_moment.unix() && !spots_list[tick.epoch]) {
                    if (!chart || !chart.series) return;
                    chart.series[0].addPoint([counter, tick.quote], true, false);

                    if (+selected_tick === current_tick_count) {
                        const points = chart.series[0].points;
                        points[points.length - 1].update({ marker });
                    }

                    applicable_ticks.push(tick);
                    spots_list[tick.epoch] = tick.quote;
                    const indicator_key    = `_${counter}`;

                    if (!x_indicators[indicator_key] && tick.epoch === +contract.exit_tick_time) {
                        x_indicators[indicator_key] = {
                            index    : counter,
                            label    : localize('Exit Spot'),
                            dashStyle: 'Dash',
                        };
                    } else if (current_tick_count === ticks_needed) {
                        HighchartUI.updateLabels(chart, {
                            contract_type   : contract_category,
                            has_barrier     : false,
                            is_reset_barrier: false,
                            is_tick_trade   : true,
                            shortcode       : contract.shortcode,
                            show_end_time   : true,
                        });
                    }

                    if (typeof x_indicators[indicator_key] !== 'undefined') {
                        x_indicators[indicator_key].index = counter;
                        add(x_indicators[indicator_key]);
                    }

                    addBarrier();
                    counter++;
                }
            }
            if (Reset.isReset(contract_category) && data.history) {
                plotResetSpot();
            }
        }
    };

    const removePlotLine = (id, type = 'y') => {
        if (!chart) return;
        chart[(`${type}Axis`)][0].removePlotLine(id);
    };

    const plotResetSpot = (r_barrier) => {
        if (reset_spot_plotted || !chart || !Reset.isReset(contract.contract_type)) return;

        const is_resetcall  = contract.contract_type === 'RESETCALL';
        const entry_barrier = contract.entry_spot;
        const reset_barrier = r_barrier || contract.barrier;

        if (!+entry_barrier || !+reset_barrier) return;

        if (+entry_barrier !== +reset_barrier) {
            removePlotLine('tick-barrier', 'y');

            chart.yAxis[0].addPlotLine({
                id    : 'tick-reset-barrier',
                value : +reset_barrier,
                label : { text: `${localize('Reset Barrier')} (${addComma(reset_barrier)})`, align: 'right', x: -60, y: is_resetcall ? 15 : -5 },
                color : 'green',
                width : 2,
                zIndex: 3,
            });
            chart.yAxis[0].addPlotLine({
                id       : 'tick-barrier',
                value    : +entry_barrier,
                label    : { text: `${localize('Barrier')} (${addComma(entry_barrier)})`,    align: 'right', x: -60, y: is_resetcall ? -5 : 15 },
                color    : 'green',
                width    : 2,
                zIndex   : 3,
                dashStyle: 'dot',
            });

            CommonFunctions.elementInnerHtml(CommonFunctions.getElementById('contract_purchase_barrier'), `${localize('Reset Barrier')}: ${addComma(reset_barrier, parseInt(display_decimals))}`);
            reset_spot_plotted = true;
            HighchartUI.updateLabels(chart, {
                contract_type   : contract_category,
                has_barrier     : true,
                is_reset_barrier: true,
                is_tick_trade   : true,
                shortcode       : contract.shortcode,
                show_end_time   : true,
            });
        }

        evaluateContractOutcome();
    };

    const addExitSpot = () => {
        if (!applicable_ticks || !contract) return;

        const index = applicable_ticks.findIndex(({ epoch }) => epoch === +contract.exit_tick_time);

        if (index === -1) return;

        const indicator_key = `_${index}`;

        if (x_indicators[indicator_key]) return;

        x_indicators[indicator_key] = {
            index,
            label    : localize('Exit Spot'),
            dashStyle: 'Dash',
        };

        add(x_indicators[indicator_key]);
    };

    const updateContract = (proposal_open_contract) => {
        contract = proposal_open_contract;
    };

    const updateChart = (data, proposal_open_contract) => {
        if (proposal_open_contract) {
            updateContract(proposal_open_contract);
        }

        if (data.is_sold) {
            addExitSpot();
        } else if (proposal_open_contract) {
            if (data.id_render) {
                id_render = data.id_render;
            }

            const request = {
                end          : contract.exit_tick_time || 'latest',
                start        : contract.date_start,
                ticks_history: contract.underlying,
                ...(!contract.exit_tick_time && { subscribe: 1 }),
            };

            if (data.request_ticks) { // we shouldn't send this multiple times on every update
                tick_init = '';
                BinarySocket.send(request, { callback: dispatch });
            }
        } else {
            dispatch(data);
        }
    };

    return {
        plotResetSpot,
        updateChart,
        init      : initialize,
        resetSpots: () => { spots_list = {}; updateContract({}); $(`#${id_render}`).css('background-color', '#F2F2F2'); },
        setStatus : (proposal_open_contract) => {
            updateContract(proposal_open_contract);
            evaluateContractOutcome();
        },
    };
})();

module.exports = TickDisplay;


text:
/*
 * Oldalbeallitas_dlg.java
 *
 * Created on 2005. április 15., 18:58
 */

package hu.wfs.vonalkod.gui.oldalbeallitas;

import hu.wfs.vonalkod.modell.Oldalbeallitas;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

/**
 *
 * @author  Béci
 */
public class Oldalbeallitas_dlg extends javax.swing.JDialog implements ActionListener {

	public static final int BEZÁRÁSIOPCIÓ_OK=1;
	private int bezárásiOpció=-1;

	private Oldalbeallitas_tlp panel;

	private final static int MIN_ABL_MAG=490;
	private final static int MIN_ABL_SZEL=467;

	/** Creates new form Oldalbeallitas_dlg */
	public Oldalbeallitas_dlg(java.awt.Frame parent, boolean modal) {
		super(parent, modal);
		initComponents();
		panel=new Oldalbeallitas_tlp();
		panel.addActionListener(this);
		getContentPane().add(panel);
		addComponentListener(new ComponentAdapter(){
			public void componentResized(ComponentEvent e) {
				int szel=getWidth();
				int mag=getHeight();
				if (getWidth()<MIN_ABL_SZEL)
					szel=MIN_ABL_SZEL;
				if (getHeight()<MIN_ABL_MAG)
					mag=MIN_ABL_MAG;
				setSize(szel, mag);
			}
		});
		setSize(MIN_ABL_SZEL, MIN_ABL_MAG);
	}

	public void actionPerformed(ActionEvent e) {
		if (e.getActionCommand().equalsIgnoreCase("Rendben"))
			bezárásiOpció=BEZÁRÁSIOPCIÓ_OK;
		setVisible(false);
		dispose();
	}

	public void setOldalbeállítás(Oldalbeallitas oldalbeállítás) {
		panel.setOldalbeállítás(oldalbeállítás);
	}

	public Oldalbeallitas getOldalbeállítás()  {
		return panel.getOldalbeállítás();
	}

	public int showDialógus() {
		super.show();
		return bezárásiOpció;
	}

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
    private void initComponents() {//GEN-BEGIN:initComponents

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    }//GEN-END:initComponents

	/**
	 * @param args the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new Oldalbeallitas_dlg(new javax.swing.JFrame(), true).setVisible(true);
			}
		});
	}

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}


text:
package com.ibm.common.activitystreams.legacy;

import java.io.ObjectStreamException;

import com.ibm.common.activitystreams.ASObject;

/**
 * The legacy "bookmark" objectType
 * @author james
 */
public class Bookmark
  extends ASObject {

  public static final class Builder
    extends ASObject.AbstractBuilder<Bookmark, Builder> {

    Builder() {
      objectType("bookmark");
    }

    /**
     * Set the targetUrl property
     * @param url String
     * @return Builder
     */
    public Builder targetUrl(String url) {
      return set("targetUrl", url);
    }

    /**
     * Get the built Bookmark object
     */
    public Bookmark get() {
      return new Bookmark(this);
    }

  }

  private Bookmark(Builder builder) {
    super(builder);
  }

  /**
   * Get the targetUrl property
   * @return String
   */
  public String targetUrl() {
    return getString("targetUrl");
  }

  // Java Serialization Support

  Object writeReplace() throws java.io.ObjectStreamException {
    return new SerializedForm(this);
  }

  private static class SerializedForm
    extends AbstractSerializedForm<Bookmark> {
    private static final long serialVersionUID = -2060301713159936285L;
    protected SerializedForm(Bookmark obj) {
      super(obj);
    }
    Object readResolve() throws ObjectStreamException {
      return super.doReadResolve();
    }
    protected Bookmark.Builder builder() {
      return new Builder();
    }
  }
}


text:
* [#437](https://github.com/onelogin/ruby-saml/issues/437) Creating AuthRequests/LogoutRequests/LogoutResponses with nil RelayState should not send empty RelayState URL param
* [#454](https://github.com/onelogin/ruby-saml/pull/454) Added Response available options
* [#453](https://github.com/onelogin/ruby-saml/pull/453) Raise a more descriptive exception if idp_sso_target_url is missing
* [#452](https://github.com/onelogin/ruby-saml/pull/452) Fix behavior of skip_conditions flag on Response
* [#449](https://github.com/onelogin/ruby-saml/pull/449) Add ability to skip authnstatement validation
* Clear cached values to be able to use IdpMetadataParser more than once
* Updated invalid audience error message

### 1.7.2 (Feb 28, 2018)
* [#446](https://github.com/onelogin/ruby-saml/pull/446) Normalize text returned by OneLogin::RubySaml::Utils.element_text

### 1.7.1 (Feb 28, 2018)
* [#444](https://github.com/onelogin/ruby-saml/pull/444) Fix audience validation for empty audience restriction

### 1.7.0 (Feb 27, 2018)
* Fix vulnerability CVE-2017-11428. Process text of nodes properly, ignoring comments

### 1.6.1 (January 15, 2018)
* [#428](https://github.com/onelogin/ruby-saml/issues/428) Fix a bug on IdPMetadataParser when parsing certificates
* [#426](https://github.com/onelogin/ruby-saml/pull/426) Ensure `Rails` responds to `logger`

### 1.6.0 (November 27, 2017)
* [#418](https://github.com/onelogin/ruby-saml/pull/418) Improve SAML message signature validation using original encoded parameters instead decoded in order to avoid conflicts (URL-encoding is not canonical, reported issues with ADFS)
* [#420](https://github.com/onelogin/ruby-saml/pull/420) Expose NameID Format on SloLogoutrequest
* [#423](https://github.com/onelogin/ruby-saml/pull/423) Allow format_cert to work with chained certificates
* [#422](https://github.com/onelogin/ruby-saml/pull/422) Use to_s for requested attribute value

### 1.5.0 (August 31, 2017)
* [#400](https://github.com/onelogin/ruby-saml/pull/400) When validating Signature use stored IdP certficate if Signature contains no info about Certificate
* [#402](https://github.com/onelogin/ruby-saml/pull/402)  Fix validate_response_state method that rejected SAMLResponses when using idp_cert_multi and idp_cert and idp_cert_fingerprint were not provided.
* [#411](https://github.com/onelogin/ruby-saml/pull/411) Allow space in Base64 string
* [#407](https://github.com/onelogin/ruby-saml/issues/407) Improve IdpMetadataParser raising an ArgumentError when parser method receive a metadata string with no IDPSSODescriptor element.
* [#374](https://github.com/onelogin/ruby-saml/issues/374) Support more than one level of StatusCode
* [#405](https://github.com/onelogin/ruby-saml/pull/405) Support ADFS encrypted key (Accept KeyInfo nodes with no ds namespace)

### 1.4.3 (May 18, 2017)
* Added SubjectConfirmation Recipient validation
* [#393](https://github.com/onelogin/ruby-saml/pull/393) Implement IdpMetadataParser#parse_to_hash
* Adapt IdP XML metadata parser to take care of multiple IdP certificates and be able to inject the data obtained on the settings.
* Improve binding detection on idp metadata parser
* [#373](https://github.com/onelogin/ruby-saml/pull/373) Allow metadata to be retrieved from source containing data for multiple entities
* Be able to register future SP x509cert on the settings and publish it on SP metadata
* Be able to register more than 1 Identity Provider x509cert, linked with an specific use (signing or encryption.
* Improve regex to detect base64 encoded messages
* Fix binding configuration example in README.md
* Add Fix SLO request. Correct NameQualifier/SPNameQualifier values.
* Validate serial number as string to work around libxml2 limitation
* Propagate isRequired on md:RequestedAttribute when generating SP metadata

### 1.4.2 (January 11, 2017)
* Improve tests format
* Fix nokogiri requirements based on ruby version
* Only publish `KeyDescriptor[use="encryption"]` at SP metadata if `security[:want_assertions_encrypted]` is true
* Be able to skip destination validation
* Improved inResponse validation on SAMLResponses and LogoutResponses
* [#354](https://github.com/onelogin/ruby-saml/pull/354) Allow scheme and domain to match ignoring case
* [#363](https://github.com/onelogin/ruby-saml/pull/363) Add support for multiple requested attributes

### 1.4.1 (October 19, 2016)
* [#357](https://github.com/onelogin/ruby-saml/pull/357) Add EncryptedAttribute support. Improve decrypt method
* Allow multiple authn_context_decl_ref in settings
* Allow options[:settings] to be an hash for Settings overrides in IdpMetadataParser#parse
* Recover issuers method

### 1.4.0 (October 13, 2016)
* Several security improvements:
  * Conditions element required and unique.
  * AuthnStatement element required and unique.
  * SPNameQualifier must math the SP EntityID
  * Reject saml:Attribute element with same "Name" attribute
  * Reject empty nameID
  * Require Issuer element. (Must match IdP EntityID).
  * Destination value can't be blank (if present must match ACS URL).
  * Check that the EncryptedAssertion element only contains 1 Assertion element.

* [#335](https://github.com/onelogin/ruby-saml/pull/335) Explicitly parse as XML and fix setting of Nokogiri options.
* [#345](https://github.com/onelogin/ruby-saml/pull/345)Support multiple settings.auth_context
* More tests to prevent XML Signature Wrapping
* [#342](https://github.com/onelogin/ruby-saml/pull/342) Correct the usage of Mutex
* [352](https://github.com/onelogin/ruby-saml/pull/352) Support multiple AttributeStatement tags

### 1.3.1 (July 10, 2016)
* Fix response_test.rb of gem 1.3.0
* Add reference to Security Guidelines
* Update License
* [#334](https://github.com/onelogin/ruby-saml/pull/334) Keep API backward-compatibility on IdpMetadataParser fingerprint method.

### 1.3.0 (June 24, 2016)
* [Security Fix](https://github.com/onelogin/ruby-saml/commit/a571f52171e6bfd87db59822d1d9e8c38fb3b995) Add extra validations to prevent Signature wrapping attacks
* Fix XMLSecurity SHA256 and SHA512 uris
* [#326](https://github.com/onelogin/ruby-saml/pull/326) Fix Destination validation

### 1.2.0 (April 29, 2016)
* [#269](https://github.com/onelogin/ruby-saml/pull/269) Refactor error handling; allow collect error messages when soft=true (normal validation stop after find first error)
* [#289](https://github.com/onelogin/ruby-saml/pull/289) Remove uuid gem in favor of SecureRandom
* [#297](https://github.com/onelogin/ruby-saml/pull/297) Implement EncryptedKey RetrievalMethod support
* [#298](https://github.com/onelogin/ruby-saml/pull/298) IDP metadata parsing improved: binding parsing, fingerprint_algorithm support)
* [#299](https://github.com/onelogin/ruby-saml/pull/299) Make 'signing' at KeyDescriptor optional
* [#308](https://github.com/onelogin/ruby-saml/pull/308) Support name_id_format on SAMLResponse
* [#315](https://github.com/onelogin/ruby-saml/pull/315) Support for canonicalization with comments
* [#316](https://github.com/onelogin/ruby-saml/pull/316) Fix Misspelling of transation_id to transaction_id
* [#321](https://github.com/onelogin/ruby-saml/pull/321) Support Attribute Names on IDPSSODescriptor parser
* Changes on empty URI of Signature reference management
* [#320](https://github.com/onelogin/ruby-saml/pull/320) Dont mutate document to fix lack of reference URI
* [#306](https://github.com/onelogin/ruby-saml/pull/306) Support WantAssertionsSigned

### 1.1.2 (February 15, 2016)
* Improve signature validation. Add tests.
 [#302](https://github.com/onelogin/ruby-saml/pull/302) Add Destination validation.
* [#292](https://github.com/onelogin/ruby-saml/pull/292) Improve the error message when validating the audience.
* [#287](https://github.com/onelogin/ruby-saml/pull/287) Keep the extracted certificate when parsing IdP metadata.

### 1.1.1 (November 10, 2015)
* [#275](https://github.com/onelogin/ruby-saml/pull/275) Fix a bug on signature validations that invalidates valid SAML messages.

### 1.1.0 (October 27, 2015)
* [#273](https://github.com/onelogin/ruby-saml/pull/273) Support SAMLResponse without ds:x509certificate
* [#270](https://github.com/onelogin/ruby-saml/pull/270) Allow SAML elements to come from any namespace (at decryption process)
* [#261](https://github.com/onelogin/ruby-saml/pull/261) Allow validate_subject_confirmation Response validation to be skipped
* [#258](https://github.com/onelogin/ruby-saml/pull/258) Fix allowed_clock_drift on the validate_session_expiration test
* [#256](https://github.com/onelogin/ruby-saml/pull/256) Separate the create_authentication_xml_doc in two methods.
* [#255](https://github.com/onelogin/ruby-saml/pull/255) Refactor validate signature.
* [#254](https://github.com/onelogin/ruby-saml/pull/254) Handle empty URI references
* [#251](https://github.com/onelogin/ruby-saml/pull/251) Support qualified and unqualified NameID in attributes
* [#234](https://github.com/onelogin/ruby-saml/pull/234) Add explicit support for JRuby

### 1.0.0 (June 30, 2015)
* [#247](https://github.com/onelogin/ruby-saml/pull/247) Avoid entity expansion (XEE attacks)
* [#246](https://github.com/onelogin/ruby-saml/pull/246) Fix bug generating Logout Response (issuer was at wrong order)
* [#243](https://github.com/onelogin/ruby-saml/issues/243) and [#244](https://github.com/onelogin/ruby-saml/issues/244) Fix metadata builder errors. Fix metadata xsd.
* [#241](https://github.com/onelogin/ruby-saml/pull/241) Add decrypt support (EncryptID and EncryptedAssertion). Improve compatibility with namespaces.
* [#240](https://github.com/onelogin/ruby-saml/pull/240) and [#238](https://github.com/onelogin/ruby-saml/pull/238) Improve test coverage and refactor.
* [#239](https://github.com/onelogin/ruby-saml/pull/239) Improve security: Add more validations to SAMLResponse, LogoutRequest and LogoutResponse. Refactor code and improve tests coverage.
* [#237](https://github.com/onelogin/ruby-saml/pull/237) Don't pretty print metadata by default.
* [#235](https://github.com/onelogin/ruby-saml/pull/235) Remove the soft parameter from validation methods. Now can be configured on the settings and each class read it and store as an attribute of the class. Adding some validations and refactor old ones.
* [#232](https://github.com/onelogin/ruby-saml/pull/232) Improve validations: Store the causes in the errors array, code refactor
* [#231](https://github.com/onelogin/ruby-saml/pull/231) Refactor HTTP-Redirect Sign method, Move test data to right folder
* [#226](https://github.com/onelogin/ruby-saml/pull/226) Ensure IdP certificate is formatted properly
* [#225](https://github.com/onelogin/ruby-saml/pull/225) Add documentation to several methods. Fix xpath injection on xml_security.rb
* [#223](https://github.com/onelogin/ruby-saml/pull/223) Allow logging to be delegated to an arbitrary Logger
* [#222](https://github.com/onelogin/ruby-saml/pull/222) No more silent failure fetching idp metadata (OneLogin::RubySaml::HttpError raised).

### 0.9.2 (Apr 28, 2015)
* [#216](https://github.com/onelogin/ruby-saml/pull/216) Add fingerprint algorithm support
* [#218](https://github.com/onelogin/ruby-saml/pull/218) Update README.md
* [#214](https://github.com/onelogin/ruby-saml/pull/214) Cleanup `SamlMessage` class
* [#213](https://github.com/onelogin/ruby-saml/pull/213) Add ability to sign metadata. (Improved)
* [#212](https://github.com/onelogin/ruby-saml/pull/212) Rename library entry point
* [#210](https://github.com/onelogin/ruby-saml/pull/210) Call assert in tests
* [#208](https://github.com/onelogin/ruby-saml/pull/208) Update tests and CI for Ruby 2.2.0
* [#205](https://github.com/onelogin/ruby-saml/pull/205) Allow requirement of single files
* [#204](https://github.com/onelogin/ruby-saml/pull/204) Require 'net/http' library
* [#201](https://github.com/onelogin/ruby-saml/pull/201) Freeze and duplicate default security settings hash so that it doesn't get modified.
* [#200](https://github.com/onelogin/ruby-saml/pull/200) Set default SSL certificate store in Ruby 1.8.
* [#199](https://github.com/onelogin/ruby-saml/pull/199) Change Nokogiri's runtime dependency to fix support for Ruby 1.8.7.
* [#179](https://github.com/onelogin/ruby-saml/pull/179) Add support for setting the entity ID and name ID format when parsing metadata
* [#175](https://github.com/onelogin/ruby-saml/pull/175) Introduce thread safety to SAML schema validation
* [#171](https://github.com/onelogin/ruby-saml/pull/171) Fix inconsistent results with using regex matches in decode_raw_saml

### 0.9.1 (Feb 10, 2015)
* [#194](https://github.com/onelogin/ruby-saml/pull/194) Relax nokogiri gem requirements
* [#191](https://github.com/onelogin/ruby-saml/pull/191) Use Minitest instead of Test::Unit

### 0.9 (Jan 26, 2015)
* [#169](https://github.com/onelogin/ruby-saml/pull/169) WantAssertionSigned should be either true or false
* [#167](https://github.com/onelogin/ruby-saml/pull/167) (doc update) make unit of clock drift obvious
* [#160](https://github.com/onelogin/ruby-saml/pull/160) Extended solution for Attributes method [] can raise NoMethodError
* [#158](https://github.com/onelogin/ruby-saml/pull/1) Added ability to specify attribute services in metadata
* [#154](https://github.com/onelogin/ruby-saml/pull/154) Fix incorrect gem declaration statement
* [#152](https://github.com/onelogin/ruby-saml/pull/152) Fix the PR #99
* [#150](https://github.com/onelogin/ruby-saml/pull/150) Nokogiri already in gemspec
* [#147](https://github.com/onelogin/ruby-saml/pull/147) Fix LogoutResponse issuer validation and implement SAML Response issuer validation.
* [#144](https://github.com/onelogin/ruby-saml/pull/144) Fix DigestMethod lookup bug
* [#139](https://github.com/onelogin/ruby-saml/pull/139) Fixes handling of some soft and hard validation failures
* [#138](https://github.com/onelogin/ruby-saml/pull/138) Change logoutrequest.rb to UTC time
* [#136](https://github.com/onelogin/ruby-saml/pull/136) Remote idp metadata
* [#135](https://github.com/onelogin/ruby-saml/pull/135) Restored support for NIL as well as empty AttributeValues
* [#134](https://github.com/onelogin/ruby-saml/pull/134) explicitly require "onelogin/ruby-saml/logging"
* [#133](https://github.com/onelogin/ruby-saml/pull/133) Added license to gemspec
* [#132](https://github.com/onelogin/ruby-saml/pull/132) Support AttributeConsumingServiceIndex in AuthnRequest
* [#131](https://github.com/onelogin/ruby-saml/pull/131) Add ruby 2.1.1 to .travis.yml
* [#122](https://github.com/onelogin/ruby-saml/pull/122) Fixes #112 and #117 in a backwards compatible manner
* [#119](https://github.com/onelogin/ruby-saml/pull/119) Add support for extracting IdP details from metadata xml

### 0.8.2 (Jan 26, 2015)
* [#183](https://github.com/onelogin/ruby-saml/pull/183) Resolved a security vulnerability where string interpolation in a `REXML::XPath.first()` method call allowed for arbitrary code execution.

### 0.8.0 (Feb 21, 2014)
**IMPORTANT**: This release changed namespace of the gem from `OneLogin::Saml` to `OneLogin::RubySaml`.  Please update your implementations of the gem accordingly.

* [#111](https://github.com/onelogin/ruby-saml/pull/111) `Onelogin::` is `OneLogin::`
* [#108](https://github.com/onelogin/ruby-saml/pull/108) Change namespacing from `Onelogin::Saml` to `Onelogin::Rubysaml`

### 0.7.3 (Feb 20, 2014)
Updated gem dependencies to be compatible with Ruby 1.8.7-p374 and 1.9.3-p448. Removed unnecessary `canonix` gem dependency.

* [#107](https://github.com/onelogin/ruby-saml/pull/107) Relax nokogiri version requirement to >= 1.5.0
* [#105](https://github.com/onelogin/ruby-saml/pull/105) Lock Gem versions, fix to resolve possible namespace collision


text:
<title>/home/cabal/programming/ogre/sources/ogre_src_v1-8-1/RenderSystems/GL/src/GLX/ Directory Reference - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="doxygen.css">
<link type="text/css" rel="stylesheet" href="tabs.css">

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Directories

RenderSystems

GL

src

GLX

GLX Directory Reference

Directory dependency graph for /home/cabal/programming/ogre/sources/ogre_src_v1-8-1/RenderSystems/GL/src/GLX/:

<map name="dir__678975101f6612587ad3a16724713bda__dep" id="dir__678975101f6612587ad3a16724713bda__dep">
<area shape="rect" id="node2" href="dir_678975101f6612587ad3a16724713bda.html" title="GLX" alt="" coords="27,55,99,103"/><area shape="rect" id="node3" href="dir_2dad093ed019979a3ffeee412aa464e3.html" title="include" alt="" coords="27,151,99,199"/><area shape="rect" id="edge3" href="dir_000037_000025.html" title="1" alt="" coords="67,123,75,141"/><area shape="rect" id="graph2" href="dir_1dc13aa09e1d0c127be1f36f47f4a0a6.html" title="src" alt="" coords="16,16,109,113"/></map>

Files

file  	GLX/OgreGLUtil.h [code]

Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Last modified Sun Sep 2 2012 07:28:07


text:
package com.navercorp.pinpoint.plugin.user;

import java.security.ProtectionDomain;

import com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass;
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentException;
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod;
import com.navercorp.pinpoint.bootstrap.instrument.MethodFilters;
import com.navercorp.pinpoint.bootstrap.instrument.Instrumentor;
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback;
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplate;
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplateAware;
import com.navercorp.pinpoint.bootstrap.logging.PLogger;
import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory;
import com.navercorp.pinpoint.bootstrap.plugin.ProfilerPlugin;
import com.navercorp.pinpoint.bootstrap.plugin.ProfilerPluginSetupContext;

/**
 * @author jaehong.kim
 *
 */
public class UserPlugin implements ProfilerPlugin, TransformTemplateAware {
    private final PLogger logger = PLoggerFactory.getLogger(this.getClass());

    private TransformTemplate transformTemplate;

    @Override
    public void setup(ProfilerPluginSetupContext context) {
        final UserPluginConfig config = new UserPluginConfig(context.getConfig());

        // add user include methods
        for (String fullQualifiedMethodName : config.getIncludeList()) {
            try {
                addUserIncludeClass(fullQualifiedMethodName);
                if (logger.isDebugEnabled()) {
                    logger.debug("Add user include class interceptor {}", fullQualifiedMethodName);
                }
            } catch (Exception e) {
                logger.warn("Failed to add user include class(" + fullQualifiedMethodName + ").", e);
            }
        }
    }

    private void addUserIncludeClass(final String fullQualifiedMethodName) {
        final String className = toClassName(fullQualifiedMethodName);
        final String methodName = toMethodName(fullQualifiedMethodName);

       transformTemplate.transform(className, new TransformCallback() {

            @Override
            public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
                InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);

                for (InstrumentMethod method : target.getDeclaredMethods(MethodFilters.name(methodName))) {
                    try {
                        method.addInterceptor("com.navercorp.pinpoint.plugin.user.interceptor.UserIncludeMethodInterceptor");
                    } catch (Exception e) {
                        if (logger.isWarnEnabled()) {
                            logger.warn("Unsupported method " + method, e);
                        }
                    }
                }

                return target.toBytecode();
            }
        });
    }

    String toClassName(String fullQualifiedMethodName) {
        final int classEndPosition = fullQualifiedMethodName.lastIndexOf(".");
        if (classEndPosition <= 0) {
            throw new IllegalArgumentException("invalid full qualified method name(" + fullQualifiedMethodName + "). not found method");
        }

        return fullQualifiedMethodName.substring(0, classEndPosition);
    }

    String toMethodName(String fullQualifiedMethodName) {
        final int methodBeginPosition = fullQualifiedMethodName.lastIndexOf(".");
        if (methodBeginPosition <= 0 || methodBeginPosition + 1 >= fullQualifiedMethodName.length()) {
            throw new IllegalArgumentException("invalid full qualified method name(" + fullQualifiedMethodName + "). not found method");
        }

        return fullQualifiedMethodName.substring(methodBeginPosition + 1);
    }

    @Override
    public void setTransformTemplate(TransformTemplate transformTemplate) {
        this.transformTemplate = transformTemplate;
    }
}


text:
for s in 16 24 32 48 64 128 256 512 1024; do
  convert -resize ${s}x$s -antialias \
          -background transparent \
          ../../icon.svg icon$s.png
done

# 16px tga file for library
convert icon16.png icon16.tga

# zip for Linux
zip godot-icons.zip icon*.png

# ico for Windows
# Not including biggest ones or it blows up in size
icotool -c -o godot-icon.ico icon{16,24,32,48,64,128,256}.png

# icns for macOS
# Only some sizes: https://iconhandbook.co.uk/reference/chart/osx/
png2icns godot-icon.icns icon{16,32,128,256,512,1024}.png

rm -f icon*.png


text:
<integrate-test-cases>
    <dql-test-case sql-case-id="select_constant_without_table">
        <assertion expected-data-file="select_constant_without_table.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_with_same_table_name_and_alias">
        <assertion parameters="10:int, 1000:int" expected-data-file="select_equal_with_single_table.xml" />
        <assertion parameters="12:int, 1000:int" expected-data-file="empty_order.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_not_equal_with_single_table">
        <assertion parameters="100001:int" expected-data-file="select_not_equal_with_single_table.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_exclamation_equal_with_single_table">
        <assertion parameters="100001:int" expected-data-file="select_not_equal_with_single_table.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_not_in_with_single_table">
        <assertion parameters="100000:int, 100001:int" expected-data-file="select_not_in_with_single_table.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_not_between_with_single_table">
        <assertion parameters="100000:int, 100001:int" expected-data-file="select_not_in_with_single_table.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_equal_with_single_table">
        <assertion parameters="10:int, 1000:int" expected-data-file="select_equal_with_single_table.xml" />
        <assertion parameters="12:int, 1000:int" expected-data-file="empty_order.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_equal_with_same_sharding_column">
        <assertion parameters="1000:int, 1001:int" expected-data-file="empty_order.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_in_with_same_sharding_column">
        <assertion parameters="1000:int, 1001:int, 1001:int, 1100:int" expected-data-file="select_in_with_same_sharding_column.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_in_with_single_table">
        <assertion parameters="10:int, 12:int, 15:int, 1000:int, 1101:int" expected-data-file="select_in_with_single_table.xml" />
        <assertion parameters="10:int, 12:int, 15:int, 1309:int, 1408:int" expected-data-file="empty_order.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_between_with_single_table">
        <assertion parameters="10:int, 12:int, 1009:int, 1108:int" expected-data-file="select_between_with_single_table.xml" />
        <assertion parameters="10:int, 12:int, 1309:int, 1408:int" expected-data-file="empty_order.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_count_like_concat">
        <assertion parameters="init:String, 10:int, 11:int, 1000:int, 2901:int" expected-data-file="select_count_like_concat.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_sharding_route_with_binding_tables">
        <assertion parameters="10:int, 11:int, 1000:int, 1909:int" expected-data-file="select_sharding_route_with_binding_tables.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_full_route_with_binding_tables">
        <assertion expected-data-file="select_full_route_with_binding_tables.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_full_route_for_upper_case_with_binding_tables">
        <assertion parameters="10:int, 11:int, 1000:int, 1909:int" expected-data-file="select_sharding_route_with_binding_tables.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_sharding_route_with_broadcast_table">
        <assertion parameters="10:int, 11:int, 1001:int, 1100:int, init:String" expected-data-file="select_sharding_route_with_broadcast_table.xml" />
        <assertion parameters="10:int, 11:int, 1009:int, 1108:int, none:String" expected-data-file="empty_order_item.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_keyword_table_name_with_back_quotes">
        <assertion parameters="10:int, 11:int, 1001:int, 1100:int, init:String" expected-data-file="select_sharding_route_with_broadcast_table.xml" />
        <assertion parameters="10:int, 11:int, 1009:int, 1108:int, none:String" expected-data-file="empty_order_item.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_keyword_table_name_with_double_quotes">
        <assertion parameters="10:int, 11:int, 1001:int, 1100:int, init:String" expected-data-file="select_sharding_route_with_broadcast_table.xml" />
        <assertion parameters="10:int, 11:int, 1009:int, 1108:int, none:String" expected-data-file="empty_order_item.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_keyword_table_name_with_square_brackets">
        <assertion parameters="10:int, 11:int, 1001:int, 1100:int, init:String" expected-data-file="select_sharding_route_with_broadcast_table.xml" />
        <assertion parameters="10:int, 11:int, 1009:int, 1108:int, none:String" expected-data-file="empty_order_item.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_alias_as_keyword">
        <assertion parameters="100001:int" expected-data-file="select_alias_as_keyword.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_with_force_index_join">
        <assertion parameters="1000:int" expected-data-file="select_with_force_index_join.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_equal_with_geography">
        <assertion parameters="'{"rule2":"null"}', 100:int, 200:int, 10:int, 1000:int" expected-data-file="select_equal_with_single_table.xml" />
        <assertion parameters="'{"rule2":"null"}', 100:int, 200:int, 12:int, 1000:int" expected-data-file="empty_order.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_in_with_geography">
        <assertion parameters="'{"rule2":"null"}', '{"rule2":"null"}', 100:int, 200:int, 10:int, 1000:int" expected-data-file="select_equal_with_single_table.xml" />
        <assertion parameters="'{"rule2":"null"}', '{"rule2":"null"}', 100:int, 200:int, 12:int, 1000:int" expected-data-file="empty_order.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_sum">
        <assertion expected-data-file="select_sum.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_count">
        <assertion expected-data-file="select_count.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_count_with_sub">
        <assertion expected-data-file="select_count_with_sub.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_count_with_sub_with_whitespace">
        <assertion expected-data-file="select_count_with_sub_with_whitespace.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_max">
        <assertion expected-data-file="select_max.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_min">
        <assertion expected-data-file="select_min.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_avg">
        <assertion expected-data-file="select_avg.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_count_with_binding_tables_without_join">
        <assertion parameters="10:int, 11:int, 1000:int, 1909:int" expected-data-file="select_count_with_binding_tables.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_count_with_binding_tables_with_join">
        <assertion parameters="10:int, 11:int, 1000:int, 1909:int" expected-data-file="select_count_with_binding_tables.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_count_with_escape_character">
        <assertion expected-data-file="select_count.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_with_expression">
        <assertion expected-data-file="select_with_expression.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_with_date_function">
        <assertion expected-data-file="select_with_date_function.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_with_regexp">
        <assertion parameters="init:String, 100000:int, 100001:int" expected-data-file="select_with_regexp.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_sum">
        <assertion expected-data-file="select_group_by_with_sum.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_count">
        <assertion expected-data-file="select_group_by_with_count.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_max">
        <assertion expected-data-file="select_group_by_with_max.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_min">
        <assertion expected-data-file="select_group_by_with_min.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_avg">
        <assertion expected-data-file="select_group_by_with_avg.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_order_by_desc">
        <assertion expected-data-file="select_group_by_with_order_by_desc.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_without_grouped_column">
        <assertion parameters="10:int, 11:int, 1000:int, 1109:int" expected-data-file="select_group_by_without_grouped_column.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_limit">
        <assertion parameters="1:int" expected-data-file="select_group_by_with_limit.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_order_by_and_limit">
        <assertion parameters="1:int" expected-data-file="select_group_by_with_order_by_and_limit.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_with_item_alias_match_order_by_and_group_by_items">
        <assertion expected-data-file="select_with_item_alias_match_order_by_and_group_by_items.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_key_word_alias">
        <assertion expected-data-file="select_group_by_with_key_word_alias.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_group_by_with_count_without_column_name">
        <assertion expected-data-file="select_group_by_with_count_without_column_name.xml" />
    </dql-test-case>

    <!--<dql-test-case sql-case-id="select_group_by_with_date_function">-->
        <!--<assertion sharding-rule-type="dbtbl_with_masterslave" parameters="1000:int, 1100:int" expected-data-file="select_group_by_with_date_function.xml" />-->
    <!--</dql-test-case>-->

    <dql-test-case sql-case-id="select_or_with_same_sharding_columns">
        <assertion parameters="1000:int, 1001:int" expected-data-file="select_or_with_same_sharding_columns.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_or_with_different_sharding_columns">
        <assertion parameters="1000:int, 11:int" expected-data-file="select_or_with_different_sharding_columns.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_or_with_none_sharding_columns">
        <assertion parameters="1000:int, init:String" expected-data-file="select_or_with_none_sharding_columns.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_or_mix_and_for_simple_pattern">
        <assertion parameters="1000:int, init:String, 11:int" expected-data-file="select_or_mix_and_for_simple_pattern.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_or_mix_and_for_complex_pattern">
        <assertion parameters="init:String, 1000:int, 1100:int, 10:int, 11:int" expected-data-file="select_or_mix_and_for_complex_pattern.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_or_mix_and_with_binding_tables">
        <assertion parameters="1000:int, 1100:int, 11:int" expected-data-file="select_or_mix_and_with_binding_tables.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_or_mix_and_with_binding_and_broadcast_tables">
        <assertion parameters="1000:int, 1100:int, 11:int, init:String" expected-data-file="select_or_mix_and_with_binding_and_broadcast_tables.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_asc_and_index_desc">
        <assertion expected-data-file="select_order_by_asc_and_index_desc.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_desc_and_index_asc">
        <assertion expected-data-file="select_order_by_desc_and_index_asc.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_with_ordered_column">
        <assertion expected-data-file="select_order_by_with_ordered_column.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_with_date">
        <assertion expected-data-file="select_order_by_with_date.xml" />
    </dql-test-case>

    <!-- // TODO add null data -->
    <dql-test-case sql-case-id="select_order_by_for_nulls_first">
        <assertion expected-data-file="select_order_by_with_ordered_column.xml" />
    </dql-test-case>

    <!-- // TODO add null data -->
    <dql-test-case sql-case-id="select_order_by_for_nulls_last">
        <assertion expected-data-file="select_order_by_with_ordered_column.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_with_multiple_stars">
        <assertion expected-data-file="select_order_by_with_multiple_stars.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_with_alias_star_alias_name">
        <assertion expected-data-file="select_order_by_with_alias_star_alias_name.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_with_alias_star_alias_name">
        <assertion expected-data-file="select_order_by_with_alias_star_alias_name.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_with_star_table_alias">
        <assertion expected-data-file="select_order_by_with_star_table_alias.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_with_table_star_table_name">
        <assertion expected-data-file="select_order_by_with_table_star_table_name.xml" />
    </dql-test-case>

    <!--TODO need to add later-->
    <!--<dql-test-case sql-case-id="select_order_by_with_parameter">-->
        <!--<assertion parameters="order_id:String" expected-data-file="select_order_by_with_star_table_alias.xml" />-->
    <!--</dql-test-case>-->

    <dql-test-case sql-case-id="select_order_by_with_star_no_table_alias">
        <assertion expected-data-file="select_order_by_with_star_no_table_alias.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_offset">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 6:int" expected-data-file="select_pagination_with_offset.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_order_by_with_table_star_without_table_name">
        <assertion expected-data-file="select_order_by_with_table_star_without_table_name.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_row_count">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 2:int" expected-data-file="select_pagination_with_row_count.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_top">
        <assertion parameters="2:int, 10:int, 19:int, 1000:int, 1909:int" expected-data-file="select_pagination_with_row_count.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_row_number">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 2:int" expected-data-file="select_pagination_with_row_count.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_limit_with_back_quotes">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 2:int, 2:int" expected-data-file="select_pagination_with_offset_and_row_count.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_limit_with_double_quotes">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 2:int, 2:int" expected-data-file="select_pagination_with_offset_and_row_count.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_offset_and_limit">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 2:int, 2:int" expected-data-file="select_pagination_with_offset_and_limit.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_top_for_greater_than">
        <assertion parameters="4:int, 10:int, 19:int, 1000:int, 1909:int, 2:int" expected-data-file="select_pagination_with_top_and_limit.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_top_for_greater_than_and_equal">
        <assertion parameters="4:int, 10:int, 19:int, 1000:int, 1909:int, 3:int" expected-data-file="select_pagination_with_top_and_limit.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_row_number_for_greater_than">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 4:int, 2:int" expected-data-file="select_pagination_with_row_number_and_limit.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_row_number_for_greater_than_and_equal">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 4:int, 3:int" expected-data-file="select_pagination_with_row_number_and_limit.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_row_number_not_at_end">
        <assertion parameters="20:int" expected-data-file="select_pagination_with_row_number_not_at_end.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_group_by_and_order_by">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 1:int, 10:int" expected-data-file="select_pagination_with_group_by_and_order_by.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_pagination_with_diff_group_by_and_order_by">
        <assertion parameters="10:int, 19:int, 1000:int, 1909:int, 1:int, 10:int" expected-data-file="select_pagination_with_diff_group_by_and_order_by.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_inner_join_related_with_alias">
        <assertion parameters="1000:int" expected-data-file="select_inner_join.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_inner_join_related_with_name">
        <assertion parameters="1000:int" expected-data-file="select_inner_join.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_join_using">
        <assertion parameters="1000:int" expected-data-file="select_inner_join.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_sub_query_with_single_table">
        <assertion parameters="1000:int, 1001:int" expected-data-file="select_sub_query_with_single_table.xml" />
    </dql-test-case>

    <!--<dql-test-case sql-case-id="select_sub_query_with_multiple_tables">-->
    <!--<assertion parameters="1000:int, 1001:int" expected-data-file="select_sub_query_with_multiple_tables.xml" />-->
    <!--</dql-test-case>-->

    <dql-test-case sql-case-id="select_sub_query_with_order_by">
        <assertion expected-data-file="select_sub_query_with_order_by.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_sub_query_with_group_by">
        <assertion expected-data-file="select_sub_query_with_group_by.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_with_double_quotes">
        <assertion parameters="100001:int" expected-data-file="select_not_equal_with_single_table.xml" />
    </dql-test-case>

     <dql-test-case sql-case-id="select_distinct_with_single_column">
        <assertion expected-data-file="select_distinct_with_single_column.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_with_multi_column">
        <assertion expected-data-file="select_distinct_with_multi_column.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_with_star">
        <assertion expected-data-file="select_distinct_with_star.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_with_sum">
        <assertion expected-data-file="select_distinct_with_sum.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_with_count">
        <assertion expected-data-file="select_distinct_with_count.xml" />
    </dql-test-case>

     <dql-test-case sql-case-id="select_distinct_with_avg">
        <assertion expected-data-file="select_distinct_with_avg.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_function">
        <assertion expected-data-file="select_distinct_function.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_with_count_sum">
        <assertion expected-data-file="select_distinct_with_count_sum.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_with_count_calculation">
        <assertion expected-data-file="select_distinct_with_count_calculation.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_with_single_count_group_by">
        <assertion expected-data-file="select_distinct_with_single_count_group_by.xml" />
    </dql-test-case>

    <dql-test-case sql-case-id="select_distinct_with_count_group_by">
        <assertion expected-data-file="select_distinct_with_count_group_by.xml" />
    </dql-test-case>
</integrate-test-cases>


text:
package namesys

import (
	"context"
	"errors"
	"fmt"
	"strings"
	"sync"
	"time"

	opts "github.com/ipfs/go-ipfs/namesys/opts"
	pb "github.com/ipfs/go-ipfs/namesys/pb"
	path "github.com/ipfs/go-ipfs/path"

	u "gx/ipfs/QmNiJuT8Ja3hMVpBHXv3Q6dwmperaQ6JjLtpMQgMCD7xvx/go-ipfs-util"
	p2phost "gx/ipfs/QmNmJZL7FQySMtE2BQuLMuZg2EB2CLEunJJUSVSc9YnnbV/go-libp2p-host"
	floodsub "gx/ipfs/QmSFihvoND3eDaAYRCeLgLPt62yCPgMZs1NSZmKFEtJQQw/go-libp2p-floodsub"
	routing "gx/ipfs/QmTiWLZ6Fo5j4KcTVutZJ5KWRRJrbxzmxA4td8NfEdrPh7/go-libp2p-routing"
	dshelp "gx/ipfs/QmTmqJGRQfuH8eKWD1FjThwPRipt1QhqJQNZ8MpzmfAAxo/go-ipfs-ds-help"
	record "gx/ipfs/QmUpttFinNDmNPgFwKN8sZK6BUtBmA68Y4KdSBDXa8t9sJ/go-libp2p-record"
	dhtpb "gx/ipfs/QmUpttFinNDmNPgFwKN8sZK6BUtBmA68Y4KdSBDXa8t9sJ/go-libp2p-record/pb"
	ds "gx/ipfs/QmXRKBQA4wXP7xWbFiZsR1GP4HV6wMDQ1aWFxZZ4uBcPX9/go-datastore"
	pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore"
	proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
	peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer"
	mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
	ci "gx/ipfs/QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo/go-libp2p-crypto"
	cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
)

var ErrorNotSubscribed = errors.New("cache is stale because not subscribed to name")

// PubsubPublisher is a publisher that distributes IPNS records through pubsub
type PubsubPublisher struct {
	ctx  context.Context
	ds   ds.Datastore
	host p2phost.Host
	cr   routing.ContentRouting
	ps   *floodsub.PubSub

	mx   sync.Mutex
	subs map[string]struct{}
}

// PubsubResolver is a resolver that receives IPNS records through pubsub
type PubsubResolver struct {
	ctx  context.Context
	ds   ds.Datastore
	host p2phost.Host
	cr   routing.ContentRouting
	pkf  routing.PubKeyFetcher
	ps   *floodsub.PubSub

	mx   sync.Mutex
	subs map[string]*floodsub.Subscription
}

// NewPubsubPublisher constructs a new Publisher that publishes IPNS records through pubsub.
// The constructor interface is complicated by the need to bootstrap the pubsub topic.
// This could be greatly simplified if the pubsub implementation handled bootstrap itself
func NewPubsubPublisher(ctx context.Context, host p2phost.Host, ds ds.Datastore, cr routing.ContentRouting, ps *floodsub.PubSub) *PubsubPublisher {
	return &PubsubPublisher{
		ctx:  ctx,
		ds:   ds,
		host: host, // needed for pubsub bootstrap
		cr:   cr,   // needed for pubsub bootstrap
		ps:   ps,
		subs: make(map[string]struct{}),
	}
}

// NewPubsubResolver constructs a new Resolver that resolves IPNS records through pubsub.
// same as above for pubsub bootstrap dependencies
func NewPubsubResolver(ctx context.Context, host p2phost.Host, ds ds.Datastore, cr routing.ContentRouting, pkf routing.PubKeyFetcher, ps *floodsub.PubSub) *PubsubResolver {
	return &PubsubResolver{
		ctx:  ctx,
		ds:   ds,
		host: host, // needed for pubsub bootstrap
		cr:   cr,   // needed for pubsub bootstrap
		pkf:  pkf,
		ps:   ps,
		subs: make(map[string]*floodsub.Subscription),
	}
}

// Publish publishes an IPNS record through pubsub with default TTL
func (p *PubsubPublisher) Publish(ctx context.Context, k ci.PrivKey, value path.Path) error {
	return p.PublishWithEOL(ctx, k, value, time.Now().Add(DefaultRecordTTL))
}

// PublishWithEOL publishes an IPNS record through pubsub
func (p *PubsubPublisher) PublishWithEOL(ctx context.Context, k ci.PrivKey, value path.Path, eol time.Time) error {
	id, err := peer.IDFromPrivateKey(k)
	if err != nil {
		return err
	}

	_, ipnskey := IpnsKeysForID(id)

	seqno, err := p.getPreviousSeqNo(ctx, ipnskey)
	if err != nil {
		return err
	}

	seqno++

	return p.publishRecord(ctx, k, value, seqno, eol, ipnskey, id)
}

func (p *PubsubPublisher) getPreviousSeqNo(ctx context.Context, ipnskey string) (uint64, error) {
	// the datastore is shared with the routing publisher to properly increment and persist
	// ipns record sequence numbers.
	prevrec, err := p.ds.Get(dshelp.NewKeyFromBinary([]byte(ipnskey)))
	if err != nil {
		if err == ds.ErrNotFound {
			// None found, lets start at zero!
			return 0, nil
		}
		return 0, err
	}

	prbytes, ok := prevrec.([]byte)
	if !ok {
		return 0, fmt.Errorf("unexpected type returned from datastore: %#v", prevrec)
	}

	var dsrec dhtpb.Record
	err = proto.Unmarshal(prbytes, &dsrec)
	if err != nil {
		return 0, err
	}

	var entry pb.IpnsEntry
	err = proto.Unmarshal(dsrec.GetValue(), &entry)
	if err != nil {
		return 0, err
	}

	return entry.GetSequence(), nil
}

func (p *PubsubPublisher) publishRecord(ctx context.Context, k ci.PrivKey, value path.Path, seqno uint64, eol time.Time, ipnskey string, ID peer.ID) error {
	entry, err := CreateRoutingEntryData(k, value, seqno, eol)
	if err != nil {
		return err
	}

	data, err := proto.Marshal(entry)
	if err != nil {
		return err
	}

	// the datastore is shared with the routing publisher to properly increment and persist
	// ipns record sequence numbers; so we need to Record our new entry in the datastore
	dsrec, err := record.MakePutRecord(k, ipnskey, data, true)
	if err != nil {
		return err
	}

	dsdata, err := proto.Marshal(dsrec)
	if err != nil {
		return err
	}

	err = p.ds.Put(dshelp.NewKeyFromBinary([]byte(ipnskey)), dsdata)
	if err != nil {
		return err
	}

	// now we publish, but we also need to bootstrap pubsub for our messages to propagate
	topic := "/ipns/" + ID.Pretty()

	p.mx.Lock()
	_, ok := p.subs[topic]

	if !ok {
		p.subs[topic] = struct{}{}
		p.mx.Unlock()

		bootstrapPubsub(p.ctx, p.cr, p.host, topic)
	} else {
		p.mx.Unlock()
	}

	log.Debugf("PubsubPublish: publish IPNS record for %s (%d)", topic, seqno)
	return p.ps.Publish(topic, data)
}

// Resolve resolves a name through pubsub and default depth limit
func (r *PubsubResolver) Resolve(ctx context.Context, name string, options ...opts.ResolveOpt) (path.Path, error) {
	return resolve(ctx, r, name, opts.ProcessOpts(options), "/ipns/")
}

func (r *PubsubResolver) resolveOnce(ctx context.Context, name string, options *opts.ResolveOpts) (path.Path, error) {
	log.Debugf("PubsubResolve: resolve '%s'", name)

	// retrieve the public key once (for verifying messages)
	xname := strings.TrimPrefix(name, "/ipns/")
	hash, err := mh.FromB58String(xname)
	if err != nil {
		log.Warningf("PubsubResolve: bad input hash: [%s]", xname)
		return "", err
	}

	id := peer.ID(hash)
	if r.host.Peerstore().PrivKey(id) != nil {
		return "", errors.New("cannot resolve own name through pubsub")
	}

	pubk := id.ExtractPublicKey()
	if pubk == nil {
		pubk, err = r.pkf.GetPublicKey(ctx, id)
		if err != nil {
			log.Warningf("PubsubResolve: error fetching public key: %s [%s]", err.Error(), xname)
			return "", err
		}
	}

	// the topic is /ipns/Qmhash
	if !strings.HasPrefix(name, "/ipns/") {
		name = "/ipns/" + name
	}

	r.mx.Lock()
	// see if we already have a pubsub subscription; if not, subscribe
	sub, ok := r.subs[name]
	if !ok {
		sub, err = r.ps.Subscribe(name)
		if err != nil {
			r.mx.Unlock()
			return "", err
		}

		log.Debugf("PubsubResolve: subscribed to %s", name)

		r.subs[name] = sub

		ctx, cancel := context.WithCancel(r.ctx)
		go r.handleSubscription(sub, name, pubk, cancel)
		go bootstrapPubsub(ctx, r.cr, r.host, name)
		r.mx.Unlock()
		return "", ErrorNotSubscribed
	}
	r.mx.Unlock()

	// resolve to what we may already have in the datastore
	dsval, err := r.ds.Get(dshelp.NewKeyFromBinary([]byte(name)))
	if err != nil {
		if err == ds.ErrNotFound {
			return "", ErrResolveFailed
		}
		return "", err
	}

	data := dsval.([]byte)
	entry := new(pb.IpnsEntry)

	err = proto.Unmarshal(data, entry)
	if err != nil {
		return "", err
	}

	value, err := path.ParsePath(string(entry.GetValue()))
	return value, err
}

// GetSubscriptions retrieves a list of active topic subscriptions
func (r *PubsubResolver) GetSubscriptions() []string {
	r.mx.Lock()
	defer r.mx.Unlock()

	var res []string
	for sub := range r.subs {
		res = append(res, sub)
	}

	return res
}

// Cancel cancels a topic subscription; returns true if an active
// subscription was canceled
func (r *PubsubResolver) Cancel(name string) bool {
	r.mx.Lock()
	defer r.mx.Unlock()

	sub, ok := r.subs[name]
	if ok {
		sub.Cancel()
		delete(r.subs, name)
	}

	return ok
}

func (r *PubsubResolver) handleSubscription(sub *floodsub.Subscription, name string, pubk ci.PubKey, cancel func()) {
	defer sub.Cancel()
	defer cancel()

	for {
		msg, err := sub.Next(r.ctx)
		if err != nil {
			if err != context.Canceled {
				log.Warningf("PubsubResolve: subscription error in %s: %s", name, err.Error())
			}
			return
		}

		err = r.receive(msg, name, pubk)
		if err != nil {
			log.Warningf("PubsubResolve: error processing update for %s: %s", name, err.Error())
		}
	}
}

func (r *PubsubResolver) receive(msg *floodsub.Message, name string, pubk ci.PubKey) error {
	data := msg.GetData()
	if data == nil {
		return errors.New("empty message")
	}

	entry := new(pb.IpnsEntry)
	err := proto.Unmarshal(data, entry)
	if err != nil {
		return err
	}

	ok, err := pubk.Verify(ipnsEntryDataForSig(entry), entry.GetSignature())
	if err != nil || !ok {
		return errors.New("signature verification failed")
	}

	_, err = path.ParsePath(string(entry.GetValue()))
	if err != nil {
		return err
	}

	eol, ok := checkEOL(entry)
	if ok && eol.Before(time.Now()) {
		return errors.New("stale update; EOL exceeded")
	}

	// check the sequence number against what we may already have in our datastore
	oval, err := r.ds.Get(dshelp.NewKeyFromBinary([]byte(name)))
	if err == nil {
		odata := oval.([]byte)
		oentry := new(pb.IpnsEntry)

		err = proto.Unmarshal(odata, oentry)
		if err != nil {
			return err
		}

		if entry.GetSequence() <= oentry.GetSequence() {
			return errors.New("stale update; sequence number too small")
		}
	}

	log.Debugf("PubsubResolve: receive IPNS record for %s", name)

	return r.ds.Put(dshelp.NewKeyFromBinary([]byte(name)), data)
}

// rendezvous with peers in the name topic through provider records
// Note: rendezvous/boostrap should really be handled by the pubsub implementation itself!
func bootstrapPubsub(ctx context.Context, cr routing.ContentRouting, host p2phost.Host, name string) {
	topic := "floodsub:" + name
	hash := u.Hash([]byte(topic))
	rz := cid.NewCidV1(cid.Raw, hash)

	err := cr.Provide(ctx, rz, true)
	if err != nil {
		log.Warningf("bootstrapPubsub: error providing rendezvous for %s: %s", topic, err.Error())
	}

	go func() {
		for {
			select {
			case <-time.After(8 * time.Hour):
				err := cr.Provide(ctx, rz, true)
				if err != nil {
					log.Warningf("bootstrapPubsub: error providing rendezvous for %s: %s", topic, err.Error())
				}
			case <-ctx.Done():
				return
			}
		}
	}()

	rzctx, cancel := context.WithTimeout(ctx, time.Second*10)
	defer cancel()

	wg := &sync.WaitGroup{}
	for pi := range cr.FindProvidersAsync(rzctx, rz, 10) {
		if pi.ID == host.ID() {
			continue
		}
		wg.Add(1)
		go func(pi pstore.PeerInfo) {
			defer wg.Done()

			ctx, cancel := context.WithTimeout(ctx, time.Second*10)
			defer cancel()

			err := host.Connect(ctx, pi)
			if err != nil {
				log.Debugf("Error connecting to pubsub peer %s: %s", pi.ID, err.Error())
				return
			}

			// delay to let pubsub perform its handshake
			time.Sleep(time.Millisecond * 250)

			log.Debugf("Connected to pubsub peer %s", pi.ID)
		}(pi)
	}

	wg.Wait()
}


text:
using namespace clang;
using namespace ento;

static bool AreTypesCompatible(QualType Derived, QualType Ancestor,
                               ASTContext &C) {

  // Right now don't compare the compatibility of pointers.  That involves
  // looking at subtyping relationships.  FIXME: Future patch.
  if (Derived->isAnyPointerType() &&  Ancestor->isAnyPointerType())
    return true;

  return C.typesAreCompatible(Derived, Ancestor);
}

static void CompareReturnTypes(const ObjCMethodDecl *MethDerived,
                               const ObjCMethodDecl *MethAncestor,
                               BugReporter &BR, ASTContext &Ctx,
                               const ObjCImplementationDecl *ID,
                               const CheckerBase *Checker) {

  QualType ResDerived = MethDerived->getReturnType();
  QualType ResAncestor = MethAncestor->getReturnType();

  if (!AreTypesCompatible(ResDerived, ResAncestor, Ctx)) {
    std::string sbuf;
    llvm::raw_string_ostream os(sbuf);

    os << "The Objective-C class '"
       << *MethDerived->getClassInterface()
       << "', which is derived from class '"
       << *MethAncestor->getClassInterface()
       << "', defines the instance method '";
    MethDerived->getSelector().print(os);
    os << "' whose return type is '"
       << ResDerived.getAsString()
       << "'.  A method with the same name (same selector) is also defined in "
          "class '"
       << *MethAncestor->getClassInterface()
       << "' and has a return type of '"
       << ResAncestor.getAsString()
       << "'.  These two types are incompatible, and may result in undefined "
          "behavior for clients of these classes.";

    PathDiagnosticLocation MethDLoc =
      PathDiagnosticLocation::createBegin(MethDerived,
                                          BR.getSourceManager());

    BR.EmitBasicReport(
        MethDerived, Checker, "Incompatible instance method return type",
        categories::CoreFoundationObjectiveC, os.str(), MethDLoc);
  }
}

static void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID,
                                       BugReporter &BR,
                                       const CheckerBase *Checker) {

  const ObjCInterfaceDecl *D = ID->getClassInterface();
  const ObjCInterfaceDecl *C = D->getSuperClass();

  if (!C)
    return;

  ASTContext &Ctx = BR.getContext();

  // Build a DenseMap of the methods for quick querying.
  typedef llvm::DenseMap<Selector,ObjCMethodDecl*> MapTy;
  MapTy IMeths;
  unsigned NumMethods = 0;

  for (auto *M : ID->instance_methods()) {
    IMeths[M->getSelector()] = M;
    ++NumMethods;
  }

  // Now recurse the class hierarchy chain looking for methods with the
  // same signatures.
  while (C && NumMethods) {
    for (const auto *M : C->instance_methods()) {
      Selector S = M->getSelector();

      MapTy::iterator MI = IMeths.find(S);

      if (MI == IMeths.end() || MI->second == nullptr)
        continue;

      --NumMethods;
      ObjCMethodDecl *MethDerived = MI->second;
      MI->second = nullptr;

      CompareReturnTypes(MethDerived, M, BR, Ctx, ID, Checker);
    }

    C = C->getSuperClass();
  }
}

//===----------------------------------------------------------------------===//
// ObjCMethSigsChecker
//===----------------------------------------------------------------------===//

namespace {
class ObjCMethSigsChecker : public Checker<
                                      check::ASTDecl<ObjCImplementationDecl> > {
public:
  void checkASTDecl(const ObjCImplementationDecl *D, AnalysisManager& mgr,
                    BugReporter &BR) const {
    CheckObjCInstMethSignature(D, BR, this);
  }
};
}

void ento::registerObjCMethSigsChecker(CheckerManager &mgr) {
  mgr.registerChecker<ObjCMethSigsChecker>();
}

bool ento::shouldRegisterObjCMethSigsChecker(const LangOptions &LO) {
  return true;
}


text:
'''
synbiochem (c) University of Manchester 2015

synbiochem is licensed under the MIT License.

To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.

@author:  neilswainston
'''
import gzip
import os
import tempfile
import zipfile
import requests

def get_file(source_url, target_filename):
    '''Downloads file from url and saves to target.'''

    if not os.path.isfile(target_filename):
        if not os.path.exists(os.path.dirname(target_filename)):
            os.makedirs(os.path.dirname(target_filename))

        resp = requests.get(source_url, allow_redirects=True)

        with open(target_filename, 'w') as target_file:
            target_file.write_bytes(resp.content)

    destination = os.path.dirname(target_filename)

    if target_filename.endswith('.zip'):
        zfile = zipfile.ZipFile(target_filename, 'r')
        target_filename = os.path.join(destination, zfile.namelist()[0])
        zfile.extractall(destination)
    elif target_filename.endswith('.gz'):
        unzipped_filepath = target_filename[:-len('.gz')]

        if os.path.exists(unzipped_filepath):
            target_filename = unzipped_filepath
        else:
            input_file = gzip.open(target_filename, 'rb')
            target_filename = os.path.join(destination,
                                           input_file.name[:-len('.gz')])
            output_file = open(target_filename, 'wb')

            for line in input_file:
                output_file.write(line)

            input_file.close()
            output_file.close()

    return target_filename

def get_filename(filename):
    '''Returns a filename, generating a temp file if necessary.'''
    if filename is None:
        fle = tempfile.NamedTemporaryFile(delete=False)
        return fle.name

    return filename

def get_filenames(filepaths, max_files=int(1e16)):
    '''Get filename.'''
    all_filenames = []

    for filepath in filepaths:
        all_filenames.extend(_get_filenames(filepath))

    return all_filenames[:max_files]

def _get_filenames(filepath):
    '''Get filename.'''
    filenames = []

    if os.path.isdir(filepath):
        for filename in os.listdir(os.path.abspath(filepath)):
            filenames.append(os.path.join(filepath, filename))

        return filenames

    # else:
    return [filepath]